ADTF  3.18.2
DDEnum

Utility class for a complete valid data definition of one EnumType and its dependencies. More...

Inheritance diagram for DDEnum:
[legend]

Public Member Functions

 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...
 

Private Attributes

dd::DataDefinition _dd
 the data definition
 
std::shared_ptr< dd::EnumType_enum_type
 

Detailed Description

Utility class for a complete valid data definition of one EnumType and its dependencies.

This class is for convenience to use it together with ddl::DDStructure .

See also
ddl::DDStructure.

Definition at line 29 of file ddenum.h.

Constructor & Destructor Documentation

◆ DDEnum() [1/3]

DDEnum ( const DDEnum other)

Construct a new DDEnum object.

Parameters
otherthe enum type definition to copy

◆ DDEnum() [2/3]

DDEnum ( const std::string &  name,
const dd::DataType data_type,
const std::vector< dd::EnumType::Element > &  elements = {} 
)

Construct a new DDEnum object.

Parameters
namename of the enum type.
data_typebase data type to use (see templates ddl::DataType).
elementsvector of element of the enum type.
Exceptions
ddl::dd::Errorthrows if elements with the same name are added.

◆ DDEnum() [3/3]

DDEnum ( const std::string &  name,
const DDDataType data_type,
const std::vector< dd::EnumType::Element > &  elements = {} 
)

Construct a new DDEnum object.

Parameters
namename of the enum type.
data_typethe data type to use (use this if you created a new datatype with units i.e. )
elementsvector of element of the enum type.
Exceptions
ddl::dd::Errorthrows if elements with the same name are added.

Member Function Documentation

◆ addElement() [1/2]

DDEnum& addElement ( const dd::EnumType::Element element)

adds a EnumType element.

Parameters
elementthe elment to add.
Exceptions
ddl::dd::Errorthrows if element with the same name already exists.

Referenced by DDEnumGenerator< EnumDataType, Enable >::addElement().

◆ addElement() [2/2]

DDEnum& addElement ( const std::string &  name,
int64_t  value 
)

adds a EnumType element.

Parameters
namethe name of the element to add.
valuethe name of the element (if it is an integer value).
Exceptions
ddl::dd::Errorthrows if element with the same name already exists.

◆ addElements()

DDEnum& addElements ( const std::vector< dd::EnumType::Element > &  elements)

adds a vector of EnumType elements.

Parameters
elementsthe elments to add.
Exceptions
ddl::dd::Errorthrows if element with the same name already exists.

◆ getAlignment()

size_t getAlignment ( ) const

returns the alignment of the underlying data type.

Returns
the alignemnt of the datatype

◆ getDD()

const dd::DataDefinition& getDD ( ) const

return the valid data definition.

Returns
const dd::DataDefinition&

◆ getEnumType()

const dd::EnumType& getEnumType ( ) const

Get the Enum Type object.

Returns
const dd::EnumType&

Referenced by enumeration< Type >::GetAlignment(), and enumeration< Type >::GetSize().

◆ operator=() [1/2]

DDEnum& operator= ( const DDEnum other)

copies a DDEnum object

Parameters
otherthe enum type definition to copy

◆ operator=() [2/2]

DDEnum& operator= ( DDEnum &&  )
Returns
DDEnum&