15 #ifndef DDSTRUCTURE_H_INCLUDED
16 #define DDSTRUCTURE_H_INCLUDED
23 #include <type_traits>
108 const uint32_t struct_version = 1,
110 const std::string& comment = {},
111 const dd::Version& ddl_version = {});
125 const std::string& xml_string,
146 size_t array_size = 1);
167 size_t array_size = 1);
234 size_t array_size = 1);
256 size_t array_size = 1);
325 template <
typename PREDEF_DATA_TYPE>
327 size_t array_size = 1,
328 const std::string& special_type_name = {})
330 if (special_type_name.empty()) {
334 addElement(element_name, DataType<PREDEF_DATA_TYPE>(special_type_name), array_size);
359 template <
typename PREDEF_DATA_TYPE>
361 size_t array_size = 1,
362 const std::string& special_type_name = {})
364 if (special_type_name.empty()) {
369 element_name, DataType<PREDEF_DATA_TYPE>(special_type_name), array_size);
394 template <
typename PREDEF_DATA_TYPE>
398 const std::string& special_type_name = {})
400 if (special_type_name.empty()) {
405 element_name, DataType<PREDEF_DATA_TYPE>(special_type_name), array_size, alignment);
431 template <
typename PREDEF_DATA_TYPE>
435 const std::string& special_type_name = {})
437 if (special_type_name.empty()) {
442 element_name, DataType<PREDEF_DATA_TYPE>(special_type_name), array_size, alignment);
466 const std::string& constant_value = {});
488 const std::string& constant_value = {});
512 const std::string& constant_value = {});
536 const std::string& constant_value = {});
556 const std::string& constant_value = {});
576 const std::string& constant_value = {});
600 size_t array_size = 1);
624 size_t array_size = 1);
739 return _struct_type->getElements().cbegin();
748 return _struct_type->getElements().cend();
757 return _struct_type->getElements().begin();
766 return _struct_type->getElements().end();
849 const std::string& description = {},
850 const std::string& comment = {},
851 const std::string& value = {},
852 const std::string& minimum_value = {},
853 const std::string& maximum_value = {},
854 const std::string& default_value = {},
855 const std::string& scale = {},
856 const std::string& offset = {});
890 template <
typename T,
bool align_with_padding>
893 void popLastElement();
896 std::shared_ptr<dd::StructType> _struct_type;
A DataType class holding the DD for a Datatype with dependencies.
Utility class for a complete valid data definition of one StructType::Element and its dependencies.
Utility class for a complete valid data definition of one StructType::Element and its dependencies.
Utility class for a complete valid data definition of one EnumType and its dependencies.
Creating a valid Structure Data Definition by a existing type and its member types.
Utility class for a complete valid data definition of one StructType and its dependencies.
std::string getStructName() const
Gets the Struct Name.
DDStructure(const DDStructure &other)
Construct a new DDStructure object.
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.
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.
DDElementRef createElement(const DDElement &element)
Creates one element to the struct using the convenience class DDElement.
std::string getStructDescription() const
Gets the Struct Data Description as XML String.
const_iterator begin() const
returns the first elenents iterator for range based iterations.
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.
~DDStructure()=default
Destroy the DDStructure object.
bool isCompatible(const DDStructure &other) const
binary compares the structs
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.
const_iterator cbegin() const
returns the first elements iterator.
const dd::DataDefinition & getDD() const
returns a valid DDL.
DDElementRef getElement(const std::string &element_name)
Gets a element reference to the element with name element_name owned by the DDStructure.
DDStructure & addElement(const DDElement &element)
Adds one element to the struct using the convenience class DDElement.
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.
dd::datamodel::StructType::Elements::const_iterator const_iterator
iterator to iterate the elements of the struct
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.
void setElementUnit(const std::string &element_name, const dd::BaseUnit &base_unit)
Sets additional element base unit information to the given element_name.
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.
const dd::StructType & getStructType() const
Get the Struct Type object.
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.
DDStructure()=delete
Construct a new DDStructure object.
size_t getAlignment() const
Retrieves the current evaluated alignment of the structure.
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.
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.
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.
const_iterator cend() const
returns the end elements iterator.
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.
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.
size_t getSize() const
Retrieves the current evaluated deserialized size (in bytes) of the structure.
DDStructure & addElements(const std::vector< DDElement > &elements)
Adds a list of element to the struct using the convenience class DDElement.
void setStructInfo(const std::string &comment)
Set additional struct information like comment.
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.
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.
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.
void setElementUnit(const std::string &element_name, const DDUnit &unit)
Sets additional element unit information to the given element_name.
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.
DDStructure & operator=(const DDStructure &other)
copy assignment operator
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.
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.
const_iterator end() const
returns the end elements iterator.
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.
DDStructure & operator=(DDStructure &&other)
move assignment operator
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.
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.
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.
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.
bool isEqual(const DDStructure &other) const
equal in names and descriptions
DDStructure(DDStructure &&other)
Construct a new DDStructure object.
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.
The unit class holding a reference to its complete DD (references to baseunits and prefixes)
Generator template to create DataType for the plain c-types.
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
observable DataDefinition object class to describe (POD) DataType.
observable DataDefinition object class to describe StructType.
container_type::const_iterator const_iterator
local definition of the container const_iterator
OO DataDefinition - Data Definition.
OO DataDefinition Element Header.
OO DataDefinition Element Header.
@ enum_type
the type is a enum type (EnumType)
@ data_type
the type is a data type (DataType)
@ struct_type
the type is a struct type (StructType)
@ unit
the unit is a unit (Unit)
@ base_unit
the unit is a base unit (BaseUnit)
definition of the ddl namespace
Utility for the Neutrino gcc5 compiler which has really no std::to_string implementation!