ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
enumeration< Type >

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

#include <type_reflection.h>

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

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.

Member Typedef Documentation

◆ base_type

template<typename Type>
typedef ddl::DDEnumGenerator<Type> base_type

Definition at line 52 of file type_reflection.h.

Constructor & Destructor Documentation

◆ enumeration()

template<typename Type>
enumeration ( const std::string & strName)
inline
Parameters
[in]strNameThe name of the enumeration.

Definition at line 57 of file type_reflection.h.

Referenced by Add().

Member Function Documentation

◆ Add()

template<typename Type>
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 enumeration(), and addElement().

◆ addElement()

template<typename Type>
DDEnumGenerator & addElement ( const std::string & name,
Type value )
inline

Adds a element for the enumeration with name and value.

Parameters
namethe name of the enumeration value
valuethe value for the name out of given type EnumDataType
Returns
DDEnumGenerator& a reference of this

Definition at line 183 of file ddenum.h.

Referenced by Add().

◆ GetAlignment()

template<typename Type>
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::getAlignment().

◆ GetSize()

template<typename Type>
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::getTypeByteSize().