ADTF  3.18.2
enumeration< Type >

This is used to create an enumeration ytpe from an existing c++ enum. More...

Inheritance diagram for enumeration< Type >:
[legend]

Public Types

typedef ddl::DDEnumGenerator< Type > base_type
 

Public Member Functions

 enumeration (const std::string &strName)
 
size_t GetSize () const
 Returns the size of the enumeration and underlying data type. More...
 
size_t GetAlignment () const
 Returns the alignment of the enumeration and underlying data type. More...
 
enumerationAdd (const std::string &strName, Type eValue)
 Adds a new mapped value to the enumeration. More...
 
- Public Member Functions inherited from DDEnumGenerator< Type >
 DDEnumGenerator (const std::string &name, const std::vector< std::pair< std::string, Type >> elements={})
 CTOR. More...
 
DDEnumGeneratoraddElement (const std::string &name, Type value)
 Adds a element for the enumeration with name and value. More...
 
- Public Member Functions inherited from DDEnum
 DDEnum ()=delete
 Construct a new DDEnum object.
 
 DDEnum (DDEnum &&)
 Construct a new DDEnum object.
 
DDEnumoperator= (DDEnum &&)
 
 DDEnum (const DDEnum &other)
 Construct a new DDEnum object. More...
 
DDEnumoperator= (const DDEnum &other)
 copies a DDEnum object More...
 
 DDEnum (const std::string &name, const dd::DataType &data_type, const std::vector< dd::EnumType::Element > &elements={})
 Construct a new DDEnum object. More...
 
 DDEnum (const std::string &name, const DDDataType &data_type, const std::vector< dd::EnumType::Element > &elements={})
 Construct a new DDEnum object. More...
 
DDEnumaddElement (const dd::EnumType::Element &element)
 adds a EnumType element. More...
 
DDEnumaddElement (const std::string &name, int64_t value)
 adds a EnumType element. More...
 
DDEnumaddElements (const std::vector< dd::EnumType::Element > &elements)
 adds a vector of EnumType elements. More...
 
const dd::EnumTypegetEnumType () const
 Get the Enum Type object. More...
 
const dd::DataDefinitiongetDD () const
 return the valid data definition. More...
 
size_t getAlignment () const
 returns the alignment of the underlying data type. More...
 

Detailed Description

template<typename Type>
class adtf::mediadescription::osborn::enumeration< Type >

This is used to create an enumeration ytpe from an existing c++ enum.

Example Usage

enum tMyEnum
{
eA = 0,
eB = 1
};
//possibility 1
auto oMyEnumType = enumeration<tMyEnum>("tMyEnum")
.Add("eA", eA)
.Add("eB", eB);
//possibility 2
auto oMyEnumType = enumeration<uint8_t>("tMyEnum")
.Add("eA", 0)
.Add("eB", 1);

Definition at line 49 of file type_reflection.h.

Constructor & Destructor Documentation

◆ enumeration()

enumeration ( const std::string &  strName)
inline
Parameters
[in]strNameThe name of the enumeration.

Definition at line 57 of file type_reflection.h.

Member Function Documentation

◆ Add()

enumeration& Add ( const std::string &  strName,
Type  eValue 
)
inline

Adds a new mapped value to the enumeration.

Parameters
[in]strNameThe name of the value.
[in]eValueThe value.
Returns
A reference to the enumeration.

Definition at line 86 of file type_reflection.h.

References DDEnumGenerator< Type >::addElement().

◆ GetAlignment()

size_t GetAlignment ( ) const
inline

Returns the alignment of the enumeration and underlying data type.

Returns
size_t The alignment

Definition at line 75 of file type_reflection.h.

References DDEnum::getEnumType().

◆ GetSize()

size_t GetSize ( ) const
inline

Returns the size of the enumeration and underlying data type.

Returns
size_t The size in bytes

Definition at line 66 of file type_reflection.h.

References DDEnum::getEnumType().