ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DDEnum

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

#include <ddenum.h>

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

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

References DDEnum().

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

References DDEnum().

Referenced by DDEnumGenerator< Type >::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.

References DDEnum().

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

References DDEnum().

◆ getAlignment()

size_t getAlignment ( ) const

returns the alignment of the underlying datatype.

Returns
the alignment of the datatype

Referenced by enumeration< Type >::GetAlignment().

◆ 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&

◆ getTypeByteSize()

size_t getTypeByteSize ( ) const

returns the size of the underlying datatype.

Returns
the size in bytes of the underlying datatype

Referenced by enumeration< Type >::GetSize().

◆ operator=() [1/2]

DDEnum & operator= ( const DDEnum & other)

copies a DDEnum object

Parameters
otherthe enum type definition to copy

References DDEnum().

◆ operator=() [2/2]

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

References DDEnum().

Member Data Documentation

◆ _dd

dd::DataDefinition _dd
private

the data definition

Definition at line 136 of file ddenum.h.

◆ _enum_type

std::shared_ptr<dd::EnumType> _enum_type
private

Definition at line 138 of file ddenum.h.