ADTF
Loading...
Searching...
No Matches
ddl::DDEnum Class Reference

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

#include <ddenum.h>

Inherited by ddl::DDEnumGenerator< Type >, ddl::DDEnumGenerator< EnumDataType, typename std::enable_if< std::is_arithmetic< EnumDataType >::value >::type >, ddl::DDEnumGenerator< EnumDataType, Enable >, and ddl::DDEnumGenerator< EnumDataType, typename std::enable_if< std::is_arithmetic< EnumDataType >::value >::type >.

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.
 

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.

Constructor & Destructor Documentation

◆ DDEnum() [1/3]

ddl::DDEnum::DDEnum ( const DDEnum & other)

Construct a new DDEnum object.

Parameters
otherthe enum type definition to copy

◆ DDEnum() [2/3]

ddl::DDEnum::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]

ddl::DDEnum::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 & ddl::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.

◆ addElement() [2/2]

DDEnum & ddl::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 & ddl::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 ddl::DDEnum::getAlignment ( ) const

returns the alignment of the underlying datatype.

Returns
the alignment of the datatype

◆ getDD()

const dd::DataDefinition & ddl::DDEnum::getDD ( ) const

return the valid data definition.

Returns
const dd::DataDefinition&

◆ getEnumType()

const dd::EnumType & ddl::DDEnum::getEnumType ( ) const

Get the Enum Type object.

Returns
const dd::EnumType&

◆ getTypeByteSize()

size_t ddl::DDEnum::getTypeByteSize ( ) const

returns the size of the underlying datatype.

Returns
the size in bytes of the underlying datatype

◆ operator=() [1/2]

DDEnum & ddl::DDEnum::operator= ( const DDEnum & other)

copies a DDEnum object

Parameters
otherthe enum type definition to copy

◆ operator=() [2/2]

DDEnum & ddl::DDEnum::operator= ( DDEnum && )
Returns
DDEnum&

The documentation for this class was generated from the following file: