26#include "comms/field/Bundle.h"
27#include "FieldWrapper.h"
32namespace field_wrapper
35class CC_API BundleWrapper :
public FieldWrapper
37 using Base = FieldWrapper;
39 typedef std::vector<FieldWrapperPtr> Members;
41 typedef std::unique_ptr<BundleWrapper> Ptr;
44 BundleWrapper(
const BundleWrapper&) =
delete;
45 BundleWrapper& operator=(
const BundleWrapper&) =
delete;
47 virtual ~BundleWrapper() noexcept;
49 Members& getMembers();
51 const Members& getMembers() const;
53 void setMembers(Members&& members);
58 virtual Ptr cloneImpl() = 0;
60 void dispatchImpl(FieldWrapperHandler& handler);
66template <typename TField>
67class BundleWrapperT : public FieldWrapperT<BundleWrapper, TField>
69 using Base = FieldWrapperT<BundleWrapper, TField>;
71 static_assert(comms::field::isBundle<Field>(),
"Must be of Bundle field type");
74 typedef typename Base::Ptr Ptr;
76 explicit BundleWrapperT(Field& fieldRef)
81 BundleWrapperT(
const BundleWrapperT&) =
default;
82 BundleWrapperT(BundleWrapperT&&) =
default;
83 virtual ~BundleWrapperT() noexcept = default;
85 BundleWrapperT& operator=(const BundleWrapperT&) = delete;
88 virtual Ptr cloneImpl()
override
90 return Ptr(
new BundleWrapperT(Base::field()));
94using BundleWrapperPtr = BundleWrapper::Ptr;
96template <
typename TField>
98makeBundleWrapper(TField& field)
102 new BundleWrapperT<TField>(field));