26#include "comms/field/Bitfield.h"
27#include "FieldWrapper.h"
32namespace field_wrapper
35class CC_API BitfieldWrapper :
public FieldWrapper
37 using Base = FieldWrapper;
39 typedef std::vector<FieldWrapperPtr> Members;
41 typedef unsigned long long UnderlyingType;
42 typedef std::unique_ptr<BitfieldWrapper> Ptr;
45 BitfieldWrapper(
const BitfieldWrapper&) =
delete;
46 BitfieldWrapper& operator=(
const BitfieldWrapper&) =
delete;
48 virtual ~BitfieldWrapper() noexcept;
50 Members& getMembers();
52 const Members& getMembers() const;
54 void setMembers(Members&& members);
59 virtual Ptr cloneImpl() = 0;
61 void dispatchImpl(FieldWrapperHandler& handler);
67template <typename TField>
68class BitfieldWrapperT : public FieldWrapperT<BitfieldWrapper, TField>
70 using Base = FieldWrapperT<BitfieldWrapper, TField>;
72 static_assert(comms::field::isBitfield<Field>(),
"Must be of Bitfield field type");
74 using UnderlyingType =
typename Base::UnderlyingType;
76 typedef typename Base::Ptr Ptr;
78 explicit BitfieldWrapperT(Field& fieldRef)
83 BitfieldWrapperT(
const BitfieldWrapperT&) =
default;
84 BitfieldWrapperT(BitfieldWrapperT&&) =
default;
85 virtual ~BitfieldWrapperT() noexcept = default;
87 BitfieldWrapperT& operator=(const BitfieldWrapperT&) = delete;
90 virtual Ptr cloneImpl()
override
92 return Ptr(
new BitfieldWrapperT<TField>(Base::field()));
97using BitfieldWrapperPtr = BitfieldWrapper::Ptr;
99template <
typename TField>
101makeBitfieldWrapper(TField& field)
105 new BitfieldWrapperT<TField>(field));