25#include "comms/field/EnumValue.h"
26#include "NumericValueWrapper.h"
31namespace field_wrapper
34class CC_API EnumValueWrapper :
public NumericValueWrapper<long long int>
36 using Base = NumericValueWrapper<long long int>;
38 using UnderlyingType = Base::UnderlyingType;
39 typedef std::unique_ptr<EnumValueWrapper> Ptr;
42 virtual ~EnumValueWrapper() noexcept;
47 virtual Ptr cloneImpl() = 0;
49 void dispatchImpl(FieldWrapperHandler& handler);
52template <typename TField>
53class EnumValueWrapperT : public NumericValueWrapperT<EnumValueWrapper, TField>
55 using Base = NumericValueWrapperT<EnumValueWrapper, TField>;
57 static_assert(comms::field::isEnumValue<Field>(),
"Must be of EnumValueField type");
59 using ValueType =
typename Field::ValueType;
60 using UnderlyingType =
typename Base::UnderlyingType;
61 static_assert(
sizeof(ValueType) <=
sizeof(UnderlyingType),
"This wrapper cannot handle provided field.");
66 typedef typename Base::Ptr Ptr;
68 explicit EnumValueWrapperT(Field& fieldRef)
73 EnumValueWrapperT(
const EnumValueWrapperT&) =
default;
74 EnumValueWrapperT(EnumValueWrapperT&&) =
default;
75 virtual ~EnumValueWrapperT() noexcept = default;
77 EnumValueWrapperT& operator=(const EnumValueWrapperT&) = delete;
80 virtual Ptr cloneImpl()
override
82 return Ptr(
new EnumValueWrapperT<TField>(Base::field()));
87using EnumValueWrapperPtr = std::unique_ptr<EnumValueWrapper>;
89template <
typename TField>
91makeEnumValueWrapper(TField& field)
95 new EnumValueWrapperT<TField>(field));