ADTF  3.18.2
codec_type_info.h
Go to the documentation of this file.
1 
15 #ifndef DDL_CODEC_TYPE_INFO_CLASS_HEADER
16 #define DDL_CODEC_TYPE_INFO_CLASS_HEADER
17 
19 
20 #include <vector>
21 
22 namespace ddl {
23 namespace codec {
24 
29 enum class ElementType {
30  cet_empty = a_util::variant::VariantType::VT_Empty,
31  cet_bool = a_util::variant::VariantType::VT_Bool,
32  cet_int8 = a_util::variant::VariantType::VT_Int8,
33  cet_uint8 = a_util::variant::VariantType::VT_UInt8,
34  cet_int16 = a_util::variant::VariantType::VT_Int16,
35  cet_uint16 = a_util::variant::VariantType::VT_UInt16,
36  cet_int32 = a_util::variant::VariantType::VT_Int32,
37  cet_uint32 = a_util::variant::VariantType::VT_UInt32,
38  cet_int64 = a_util::variant::VariantType::VT_Int64,
39  cet_uint64 = a_util::variant::VariantType::VT_UInt64,
44 };
45 
50 
51 // forward declaration
52 class StructAccess;
53 
61 public:
73  const char* getTypeName() const;
81  bool isEnum() const;
87  std::vector<std::string> getEnumElementNames() const;
95  bool hasEnumElementName(const std::string& name) const;
104  a_util::variant::Variant getEnumElementValue(const std::string& name) const;
113  const char* getEnumElementName(const a_util::variant::Variant& value) const;
119 
120 private:
121  friend class StructAccess;
122  CodecTypeInfo(const std::string& type_name, ElementType _element_type);
123  CodecTypeInfo(const std::string& type_name,
124  ElementType _element_type,
125  AccessEnumType enum_access_type);
126 
127 private:
128  ElementType _element_type;
129  std::string _type_name;
130  AccessEnumType _enum_access_type;
131  bool _is_enum;
132 };
133 
138 public:
145  bool isConstant() const;
152  const char* getConstantName() const;
159 
160 private:
161  friend class StructAccess;
162  CodecConstantInfo(const char* constant_name, const a_util::variant::Variant* constant);
163 
164 private:
165  const char* _constant_name;
166  const a_util::variant::Variant* _constant;
167 };
168 
173 public:
180  bool hasDefaultValue() const;
187 
188 private:
189  friend class StructAccess;
190  CodecDefaultValueInfo(const a_util::variant::Variant& default_value);
191 
192 private:
193  const a_util::variant::Variant _default_value;
194 };
195 
196 } // namespace codec
197 } // namespace ddl
198 
199 #endif // DDL_CODEC_TYPE_INFO_CLASS_HEADER
The constant info of a element.
const char * getConstantName() const
Get the name of the constant value.
bool isConstant() const
Determines if the element has a constant value or not.
a_util::variant::Variant getConstantValue() const
Returns the constant value in type T.
The default value info of a element.
bool hasDefaultValue() const
Determines if the element has a constant value or not.
a_util::variant::Variant getDefaultValue() const
Returns the default value in type T.
Description of the elements Type.
ElementType getType() const
Get the Type.
bool isEnum() const
Determines the value is an enum or not.
const char * getEnumElementName(const a_util::variant::Variant &value) const
Returns the enum elements name for the given value if exists.
const AccessEnumType * getLegacyAccessEnumType() const
Legacy Only: Get the Legacy Access Enum Type object.
std::vector< std::string > getEnumElementNames() const
Get the Enum Element Names.
a_util::variant::Variant getEnumElementValue(const std::string &name) const
Returns the current enum elements value of the given enum element name converted to type T if support...
bool hasEnumElementName(const std::string &name) const
Determines if the enum element name exists.
const char * getTypeName() const
Get the typename.
ddl::AccessEnumType AccessEnumType
This is the legacy Access Type for resolving enum names.
ElementType
The element type of the value.
@ cet_float
Variant type is float.
@ cet_int16
Variant type is std::int16_t.
@ cet_int8
Variant type is std::int8_t.
@ cet_uint64
Variant type is std::uint64_t.
@ cet_uint8
Variant type is std::uint8_t.
@ cet_uint32
Variant type is std::uint32_t.
@ cet_sub_codec
type marks a subcodec/substructure with children
@ cet_bool
Variant type is bool.
@ cet_uint16
Variant type is std::uint16_t.
@ cet_int32
Variant type is std::int32_t.
@ cet_int64
Variant type is std::int64_t.
@ cet_empty
Variant type is empty.
@ cet_user_type
type marks a user defined type
@ cet_double
Variant type is double.
std::map< std::string, a_util::variant::Variant > AccessEnumType
Typedef for enumerations name -> value.
Definition of old StructElement legacy header for old Codec API.