ADTF
|
Utility class for a complete valid data definition of one StructType and its dependencies. More...
Public Types | |
typedef dd::datamodel::StructType::Elements::const_iterator | const_iterator |
iterator to iterate the elements of the struct | |
Public Member Functions | |
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... | |
DDStructure & | operator= (DDStructure &&other) |
move assignment operator More... | |
DDStructure & | operator= (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... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const dd::DataType &data_type, size_t array_size=1) |
Creates one element to the struct using a (POD) DataType. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const dd::DataType &data_type, size_t array_size, size_t alignment) |
Creates one element to the struct using a (POD) DataType. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDDataType &data_type, size_t array_size=1) |
Creates one element to the struct using a (POD) DataType. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDDataType &data_type, size_t array_size, size_t alignment) |
Creates one element to the struct using a (POD) DataType. More... | |
template<typename PREDEF_DATA_TYPE > | |
DDStructure & | addElement (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 > | |
DDElementRef | createElement (const std::string &element_name, size_t array_size=1, const std::string &special_type_name={}) |
Create one element to the struct using a (POD) DataType. More... | |
template<typename PREDEF_DATA_TYPE > | |
DDStructure & | addElement (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... | |
template<typename PREDEF_DATA_TYPE > | |
DDElementRef | createElement (const std::string &element_name, size_t array_size, size_t alignment, const std::string &special_type_name={}) |
Creates one element to the struct using a (POD) DataType. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDEnum &enum_type, size_t array_size, const std::string &constant_value={}) |
Creates one element to the struct using the convenience class DDEnum. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDEnum &enum_type, size_t array_size, size_t alignment, const std::string &constant_value={}) |
Creates one element to the struct using the convenience class DDEnum. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDEnum &enum_type, const std::string &constant_value={}) |
Creates one element to the struct using the convenience class DDEnum. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDStructure &struct_type, size_t array_size=1) |
Creates one element to the struct using the convenience class DDStructure. More... | |
DDStructure & | addElement (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... | |
DDElementRef | createElement (const std::string &element_name, const DDStructure &struct_type, size_t array_size, size_t alignment) |
Creates one element to the struct using the convenience class DDStructure. More... | |
DDStructure & | addElement (const DDElement &element) |
Adds one element to the struct using the convenience class DDElement. More... | |
DDElementRef | createElement (const DDElement &element) |
Creates one element to the struct using the convenience class DDElement. More... | |
DDStructure & | addElements (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::DataDefinition & | getDD () const |
returns a valid DDL. More... | |
const dd::StructType & | getStructType () 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... | |
DDElementRef | getElement (const std::string &element_name) |
Gets a element reference to the element with name element_name owned by the DDStructure. More... | |
Private Member Functions | |
void | popLastElement () |
Private Attributes | |
dd::DataDefinition | _dd |
std::shared_ptr< dd::StructType > | _struct_type |
dd::OptionalSize | _initial_alignment = {} |
Utility class for a complete valid data definition of one StructType and its dependencies.
This class is for convenience to use create a StructType data defintion in code.
The class is to use as follows:
Definition at line 57 of file ddstructure.h.
DDStructure | ( | DDStructure && | other | ) |
Construct a new DDStructure object.
other | the structure to move. |
DDStructure | ( | const DDStructure & | other | ) |
Construct a new DDStructure object.
other | the structure to copy. |
|
explicit |
Construct a new DDStructure object.
name | typename of the new StructType |
struct_version | version of the struct |
alignment | optional alignment (if not set the alignment will be calculated automatically) |
comment | optional comment |
ddl_version | optional DDL language version of this struct (defines the size of the struct by alignment or not!) |
|
explicit |
Construct a new DDStructure object.
name | typename of the new StructType |
xml_string | the xml string to read |
ddl_xml_file_version_to_parse | optional DDL language version of the string. |
ddl::dd::Error | if the xml string is not valid against the xsd definition! (depending on the DDL Version). |
ddl::dd::Error | if the validation level of the created DataDefinition is not at least "good_enough"! |
ddl::dd::Error | if the given name is not part of this description. |
DDStructure& addElement | ( | const DDElement & | element | ) |
Adds one element to the struct using the convenience class DDElement.
Usage:
element | the DDElement |
ddl::dd::Error | if the name of the given element already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | const std::string & | element_name, |
const DDDataType & | data_type, | ||
size_t | array_size = 1 |
||
) |
Adds one element to the struct using a (POD) DataType.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
enum_type | the enum type |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
enum_type | the enum type |
array_size | the arrysize of the element (by default 1) |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
enum_type | the enum type |
array_size | the arrysize of the element (by default 1) |
alignment | alignment of the element |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
struct_type | the struct type |
array_size | the arraysize of the element (by default 1) |
alignment | the alignment for the element |
ddl::dd::Error | if the given element_name already exists. |
DDStructure& addElement | ( | 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.
Usage:
element_name | the name of the element |
struct_type | the struct type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
|
inline |
Adds one element to the struct using a (POD) DataType.
Usage:
PREDEF_DATA_TYPE | The POD type (float, int32_t ... etc. ) |
element_name | the name of the element |
array_size | the arrysize of the element (by default 1) |
special_type_name | this typename is used instead of the typename predefined in DataType |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
Definition at line 395 of file ddstructure.h.
|
inline |
Adds one element to the struct using a (POD) DataType.
Usage:
PREDEF_DATA_TYPE | The POD type (float, int32_t ... etc. ) |
element_name | the name of the element |
array_size | the arrysize of the element (by default 1) |
special_type_name | this typename is used instead of the typename predefined in DataType |
ddl::dd::Error | if the given element_name already exists. |
Definition at line 326 of file ddstructure.h.
DDStructure& addElements | ( | const std::vector< DDElement > & | elements | ) |
Adds a list of element to the struct using the convenience class DDElement.
Usage:
elements | the list of DDElement |
ddl::dd::Error | if a name of the given elements already exists. |
|
inline |
returns the first elenents iterator for range based iterations.
Definition at line 755 of file ddstructure.h.
|
inline |
returns the first elements iterator.
Definition at line 737 of file ddstructure.h.
|
inline |
returns the end elements iterator.
Definition at line 746 of file ddstructure.h.
DDElementRef createElement | ( | const DDElement & | element | ) |
Creates one element to the struct using the convenience class DDElement.
Usage:
element | the DDElement |
ddl::dd::Error | if the name of the given element already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const dd::DataType & | data_type, | ||
size_t | array_size, | ||
size_t | alignment | ||
) |
Creates one element to the struct using a (POD) DataType.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const dd::DataType & | data_type, | ||
size_t | array_size = 1 |
||
) |
Creates one element to the struct using a (POD) DataType.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDDataType & | data_type, | ||
size_t | array_size, | ||
size_t | alignment | ||
) |
Creates one element to the struct using a (POD) DataType.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arraysize of the element (by default 1) |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDDataType & | data_type, | ||
size_t | array_size = 1 |
||
) |
Creates one element to the struct using a (POD) DataType.
Usage:
element_name | the name of the element |
data_type | the data type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDEnum & | enum_type, | ||
const std::string & | constant_value = {} |
||
) |
Creates one element to the struct using the convenience class DDEnum.
Usage:
element_name | the name of the element |
enum_type | the enum type |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDEnum & | enum_type, | ||
size_t | array_size, | ||
const std::string & | constant_value = {} |
||
) |
Creates one element to the struct using the convenience class DDEnum.
Usage:
element_name | the name of the element |
enum_type | the enum type |
array_size | the arrysize of the element (by default 1) |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDEnum & | enum_type, | ||
size_t | array_size, | ||
size_t | alignment, | ||
const std::string & | constant_value = {} |
||
) |
Creates one element to the struct using the convenience class DDEnum.
Usage:
element_name | the name of the element |
enum_type | the enum type |
array_size | the arrysize of the element (by default 1) |
alignment | alignment of the element |
constant_value | the constant value name, defined within enum_type |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDStructure & | struct_type, | ||
size_t | array_size, | ||
size_t | alignment | ||
) |
Creates one element to the struct using the convenience class DDStructure.
Usage:
element_name | the name of the element |
struct_type | the struct type |
array_size | the arraysize of the element (by default 1) |
alignment | the alignment for the element |
ddl::dd::Error | if the given element_name already exists. |
DDElementRef createElement | ( | const std::string & | element_name, |
const DDStructure & | struct_type, | ||
size_t | array_size = 1 |
||
) |
Creates one element to the struct using the convenience class DDStructure.
Usage:
element_name | the name of the element |
struct_type | the struct type |
array_size | the arrysize of the element (by default 1) |
ddl::dd::Error | if the given element_name already exists. |
|
inline |
Creates one element to the struct using a (POD) DataType.
Usage:
PREDEF_DATA_TYPE | The POD type (float, int32_t ... etc. ) |
element_name | the name of the element |
array_size | the arrysize of the element (by default 1) |
special_type_name | this typename is used instead of the typename predefined in DataType |
alignment | alignment of the element |
ddl::dd::Error | if the given element_name already exists. |
Definition at line 432 of file ddstructure.h.
|
inline |
Create one element to the struct using a (POD) DataType.
Usage:
PREDEF_DATA_TYPE | The POD type (float, int32_t ... etc. ) |
element_name | the name of the element |
array_size | the arrysize of the element (by default 1) |
special_type_name | this typename is used instead of the typename predefined in DataType |
ddl::dd::Error | if the given element_name already exists. |
Definition at line 360 of file ddstructure.h.
|
inline |
returns the end elements iterator.
Definition at line 764 of file ddstructure.h.
size_t getAlignment | ( | ) | const |
Retrieves the current evaluated alignment of the structure.
Referenced by DDStructureGenerator< T, align_with_padding >::getAlignment().
const dd::DataDefinition& getDD | ( | ) | const |
returns a valid DDL.
Referenced by DDStructureGenerator< T, align_with_padding >::getDD().
DDElementRef getElement | ( | const std::string & | element_name | ) |
Gets a element reference to the element with name element_name
owned by the DDStructure.
element_name | the elements name |
dd::Error | if element was not found |
Referenced by DDStructureGenerator< T, align_with_padding >::getElement().
size_t getSize | ( | ) | const |
Retrieves the current evaluated deserialized size (in bytes) of the structure.
Referenced by DDStructureGenerator< T, align_with_padding >::getSize().
std::string getStructDescription | ( | ) | const |
Gets the Struct Data Description as XML String.
Referenced by DDStructureGenerator< T, align_with_padding >::getStructDescription().
std::string getStructName | ( | ) | const |
Gets the Struct Name.
Referenced by DDStructureGenerator< T, align_with_padding >::getStructName().
const dd::StructType& getStructType | ( | ) | const |
Get the Struct Type object.
Referenced by DDStructureGenerator< T, align_with_padding >::getStructType().
bool isCompatible | ( | const DDStructure & | other | ) | const |
binary compares the structs
other | the other struct to binary compare to |
bool isEqual | ( | const DDStructure & | other | ) | const |
equal in names and descriptions
other | the other struct |
DDStructure& operator= | ( | const DDStructure & | other | ) |
DDStructure& operator= | ( | DDStructure && | other | ) |
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
.
element_name
must have been added before! The info will only be set if the string of the parameter is not empty!element_name | The element name to set the additional info to |
description | The description |
comment | The comment |
value | The value |
minimum_value | The minimum value |
maximum_value | The maximum value |
default_value | The default value |
scale | The scale |
offset | The offset |
dd::Error | if element with element_name does not exist. |
void setElementUnit | ( | const std::string & | element_name, |
const dd::BaseUnit & | base_unit | ||
) |
Sets additional element base unit information to the given element_name
.
Any other unit information will be overwritten.
element_name
must have been added before!element_name | The element name |
base_unit | The baseunit to set |
dd::Error | if element with element_name does not exist. |
void setElementUnit | ( | const std::string & | element_name, |
const DDUnit & | unit | ||
) |
Sets additional element unit information to the given element_name
.
element_name
must have been added before!element_name | The element name |
unit | The unit to set |
dd::Error | if element with element_name does not exist. |
Referenced by DDStructureGenerator< T, align_with_padding >::setElementUnit().
void setStructInfo | ( | const std::string & | comment | ) |
Set additional struct information like comment.
This is important to create additional info in type reflection for DDStructureGenerator.
comment | The comment of the struct type. |
Referenced by DDStructureGenerator< T, align_with_padding >::setStructInfo().