ADTF  3.18.3
structure< void >

This is used to create a structure type independently. More...

Inheritance diagram for structure< void >:
[legend]

Public Member Functions

 structure (const std::string &strName)
 Initializes the structure. More...
 
 structure (const std::string &strName, size_t nAlignment)
 Initializes the structure. More...
 
size_t GetSize () const
 Returns the current size of the structure. More...
 
size_t GetAlignment () const
 Returns the current calculated or set alignment of the structure. More...
 
structureAdd (const std::string &strName, const ddl::dd::DataType &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
 Adds a new member of an enumeration type. More...
 
template<typename ArithmeticType >
structureAdd (const std::string &strName, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
 Adds a new member of arithmetic type (POD) More...
 
structureAdd (const std::string &strName, const ddl::DDEnum &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
 Adds a new member of an enumeration type. More...
 
structureAdd (const std::string &strName, const ddl::DDStructure &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
 Adds a new member of a structure type. More...
 
const ddl::DDStructureGetStructure () const
 Get the current valid DDStructure object. More...
 
- Public Member Functions inherited from DDStructure
 DDStructure ()=delete
 Construct a new DDStructure object.
 
 DDStructure (DDStructure &&other)
 Construct a new DDStructure object. More...
 
 DDStructure (const DDStructure &other)
 Construct a new DDStructure object. More...
 
DDStructureoperator= (DDStructure &&other)
 move assignment operator More...
 
DDStructureoperator= (const DDStructure &other)
 copy assignment operator More...
 
 ~DDStructure ()=default
 Destroy the DDStructure object.
 
 DDStructure (const std::string &name, const uint32_t struct_version=1, dd::OptionalSize alignment={}, const std::string &comment={}, const dd::Version &ddl_version={})
 Construct a new DDStructure object. More...
 
 DDStructure (const std::string &name, const std::string &xml_string, const dd::Version &ddl_xml_file_version_to_parse=dd::Version(0, 0))
 Construct a new DDStructure object. More...
 
DDStructureaddElement (const std::string &element_name, const dd::DataType &data_type, size_t array_size=1)
 Adds one element to the struct using a (POD) DataType. More...
 
DDStructureaddElement (const std::string &element_name, const dd::DataType &data_type, size_t array_size, size_t alignment)
 Adds one element to the struct using a (POD) DataType. More...
 
DDStructureaddElement (const std::string &element_name, const DDDataType &data_type, size_t array_size=1)
 Adds one element to the struct using a (POD) DataType. More...
 
DDStructureaddElement (const std::string &element_name, const DDDataType &data_type, size_t array_size, size_t alignment)
 Adds one element to the struct using a (POD) DataType. More...
 
template<typename PREDEF_DATA_TYPE >
DDStructureaddElement (const std::string &element_name, size_t array_size=1, const std::string &special_type_name={})
 Adds one element to the struct using a (POD) DataType. More...
 
template<typename PREDEF_DATA_TYPE >
DDStructureaddElement (const std::string &element_name, size_t array_size, size_t alignment, const std::string &special_type_name={})
 Adds one element to the struct using a (POD) DataType. More...
 
DDStructureaddElement (const std::string &element_name, const DDEnum &enum_type, size_t array_size, const std::string &constant_value={})
 Adds one element to the struct using the convenience class DDEnum. More...
 
DDStructureaddElement (const std::string &element_name, const DDEnum &enum_type, size_t array_size, size_t alignment, const std::string &constant_value={})
 Adds one element to the struct using the convenience class DDEnum. More...
 
DDStructureaddElement (const std::string &element_name, const DDEnum &enum_type, const std::string &constant_value={})
 Adds one element to the struct using the convenience class DDEnum. More...
 
DDStructureaddElement (const std::string &element_name, const DDStructure &struct_type, size_t array_size=1)
 Adds one element to the struct using the convenience class DDStructure. More...
 
DDStructureaddElement (const std::string &element_name, const DDStructure &struct_type, size_t array_size, size_t alignment)
 Adds one element to the struct using the convenience class DDStructure. More...
 
DDStructureaddElement (const DDElement &element)
 Adds one element to the struct using the convenience class DDElement. More...
 
DDStructureaddElements (const std::vector< DDElement > &elements)
 Adds a list of element to the struct using the convenience class DDElement. More...
 
const_iterator cbegin () const
 returns the first elements iterator. More...
 
const_iterator cend () const
 returns the end elements iterator. More...
 
const_iterator begin () const
 returns the first elenents iterator for range based iterations. More...
 
const_iterator end () const
 returns the end elements iterator. More...
 
const dd::DataDefinitiongetDD () const
 returns a valid DDL. More...
 
const dd::StructTypegetStructType () const
 Get the Struct Type object. More...
 
std::string getStructDescription () const
 Gets the Struct Data Description as XML String. More...
 
std::string getStructName () const
 Gets the Struct Name. More...
 
bool isCompatible (const DDStructure &other) const
 binary compares the structs More...
 
bool isEqual (const DDStructure &other) const
 equal in names and descriptions More...
 
size_t getSize () const
 Retrieves the current evaluated deserialized size (in bytes) of the structure. More...
 
size_t getAlignment () const
 Retrieves the current evaluated alignment of the structure. More...
 
void setStructInfo (const std::string &comment)
 Set additional struct information like comment. More...
 
void setElementInfo (const std::string &element_name, const std::string &description={}, const std::string &comment={}, const std::string &value={}, const std::string &minimum_value={}, const std::string &maximum_value={}, const std::string &default_value={}, const std::string &scale={}, const std::string &offset={})
 Set additional element information to the given element_name. More...
 
void setElementUnit (const std::string &element_name, const DDUnit &unit)
 Sets additional element unit information to the given element_name. More...
 
void setElementUnit (const std::string &element_name, const dd::BaseUnit &base_unit)
 Sets additional element base unit information to the given element_name. More...
 

Additional Inherited Members

- Public Types inherited from DDStructure
typedef dd::datamodel::StructType::Elements::const_iterator const_iterator
 iterator to iterate the elements of the struct
 

Detailed Description

This is used to create a structure type independently.

Example Usage

auto oSubType = structure<>("tSub")
.Add<uint8_t>("nValue1")
.Add<uint8_t>("nValue2");
auto oParentType = structure<tParent>("tParent")
.Add<uint32_t>("nSomething", &tParent::nSomething)
.Add("sSub", oSubType);
structure & Add(const std::string &strName, const ddl::dd::DataType &oTypeDefinition, size_t nArrayCount=1, size_t nAlignment=0, int32_t nBytePosition=-1, bool bLittleEndian=true)
Adds a new member of an enumeration type.

Definition at line 245 of file type_reflection.h.

Constructor & Destructor Documentation

◆ structure() [1/2]

structure ( const std::string &  strName)

Initializes the structure.

Parameters
[in]strNameThe name

◆ structure() [2/2]

structure ( const std::string &  strName,
size_t  nAlignment 
)

Initializes the structure.

Parameters
[in]strNameThe name
[in]nAlignmentThe alignment.

Member Function Documentation

◆ Add() [1/4]

structure& Add ( const std::string &  strName,
const ddl::dd::DataType oTypeDefinition,
size_t  nArrayCount = 1,
size_t  nAlignment = 0,
int32_t  nBytePosition = -1,
bool  bLittleEndian = true 
)

Adds a new member of an enumeration type.

Parameters
[in]strNameThe name of the member.
[in]oTypeDefinitionThe data type definition.
[in]nArrayCountThe array size of the member.
[in]nAlignmentThe Alignment of the member. 0 => alignment is taken from the type.
[in]nBytePositionThe byte position in the serialized representation.
[in]bLittleEndianWhether the value in the serialized representation is little endian or not.
Returns
A reference to the structure.

◆ Add() [2/4]

structure& Add ( const std::string &  strName,
const ddl::DDEnum oTypeDefinition,
size_t  nArrayCount = 1,
size_t  nAlignment = 0,
int32_t  nBytePosition = -1,
bool  bLittleEndian = true 
)

Adds a new member of an enumeration type.

Parameters
[in]strNameThe name of the member.
[in]oTypeDefinitionThe enumeration type definition.
[in]nArrayCountThe array size of the member.
[in]nAlignmentThe Alignment of the member. 0 => alignment is taken from the type.
[in]nBytePositionThe byte position in the serialized representation.
[in]bLittleEndianWhether the value in the serialized representation is little endian or not.
Returns
A reference to the structure.

◆ Add() [3/4]

structure& Add ( const std::string &  strName,
const ddl::DDStructure oTypeDefinition,
size_t  nArrayCount = 1,
size_t  nAlignment = 0,
int32_t  nBytePosition = -1,
bool  bLittleEndian = true 
)

Adds a new member of a structure type.

Parameters
[in]strNameThe name of the member.
[in]oTypeDefinitionThe structure type definition.
[in]nArrayCountThe array size of the member.
[in]nAlignmentThe Alignment of the member. 0 => alignment is taken from the type.
[in]nBytePositionThe byte position in the serialized representation.
[in]bLittleEndianWhether the value in the serialized representation is little endian or not.
Returns
A reference to the structure.

◆ Add() [4/4]

structure& Add ( const std::string &  strName,
size_t  nArrayCount = 1,
size_t  nAlignment = 0,
int32_t  nBytePosition = -1,
bool  bLittleEndian = true 
)
inline

Adds a new member of arithmetic type (POD)

Parameters
[in]strNameThe name of the member.
[in]nArrayCountThe array size of the member.
[in]nAlignmentThe Alignment of the member. 0 => alignment is taken from the type.
[in]nBytePositionThe byte position in the serialized representation.
[in]bLittleEndianWhether the value in the serialized representation is little endian or not.
Returns
A reference to the structure.

Definition at line 300 of file type_reflection.h.

References structure< T >::Add().

◆ GetAlignment()

size_t GetAlignment ( ) const

Returns the current calculated or set alignment of the structure.

Returns
size_t The alignment

◆ GetSize()

size_t GetSize ( ) const

Returns the current size of the structure.

Returns
size_t The size in bytes

◆ GetStructure()

const ddl::DDStructure& GetStructure ( ) const
inline

Get the current valid DDStructure object.

Returns
const DDStructure&
Exceptions
ddl::dd::ErrorThrows if the evaluated size is not sizeof(T). Check if there may be missed elements.

Definition at line 355 of file type_reflection.h.