Creating a valid Structure Data Definition by a existing type and its member types.
More...
|
| | DDStructureGenerator (const std::string &name, uint32_t struct_version=1) |
| | CTOR to create a structure type based on a type.
|
| |
| template<typename MemberType> |
| DDElementRef | createElement (const std::string &name, MemberType T::*member_offset) |
| |
| template<typename MemberType> |
| DDElementRef | createElement (const std::string &name, MemberType T::*member_offset, const std::string &valid_element_count_or_array_size_name) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset, const std::string &valid_element_count_or_array_size_name) |
| |
| template<typename MemberType> |
| DDElementRef | createElement (const std::string &name, MemberType T::*member_offset, const DDEnum &enum_type) |
| |
| template<typename MemberType> |
| DDElement | createElement (const std::string &name, MemberType T::*member_offset, const DDEnum &enum_type, const std::string &valid_element_count_or_array_size_name) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset, const DDEnum &enum_type) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset, const DDEnum &enum_type, const std::string &valid_element_count_or_array_size_name) |
| |
| template<typename MemberType> |
| DDElementRef | createElement (const std::string &name, MemberType T::*member_offset, const DDStructure &struct_type) |
| |
| template<typename MemberType> |
| DDElementRef | createElement (const std::string &name, MemberType T::*member_offset, const DDStructure &struct_type, const std::string &valid_element_count_or_array_size_name) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset, const DDStructure &struct_type) |
| |
| template<typename MemberType> |
| DDStructureGenerator & | addElement (const std::string &name, MemberType T::*member_offset, const DDStructure &struct_type, const std::string &valid_element_count_or_array_size_name) |
| |
| std::string | getStructDescription () const |
| | Gets the structs data definition as XML String.
|
| |
| std::string | getStructName () const |
| | Gets the Struct Name.
|
| |
| const dd::DataDefinition & | getDD () const |
| | returns a valid DDL.
|
| |
| const dd::StructType & | getStructType () const |
| | Get the Struct Type object.
|
| |
| const DDStructure & | getStructure () const |
| | Get the current valid DDStructure object.
|
| |
| size_t | getSize () const |
| | Retrieves the current evaluated size of the structure.
|
| |
| size_t | getAlignment () const |
| | Retrieves the current evaluated alignment of the structure.
|
| |
| | operator const DDStructure & () const |
| | Get the current valid DDStructure object.
|
| |
| void | setStructInfo (const std::string &comment) |
| | Set additional struct information like comment. This is important to create additional info in type reflection for DDStructureGenerator.
|
| |
| 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.
|
| |
| void | setElementUnit (const std::string &element_name, const DDUnit &unit) |
| | Sets additional element unit information to the given element_name. Any other unit information will be overwritten.
|
| |
| void | setElementUnit (const std::string &element_name, const dd::BaseUnit &base_unit) |
| | Sets additional element base unit information to the given element_name.
|
| |
| DDElementRef | getElement (const std::string &element_name) |
| | Gets a element reference to the element with name element_name owned by the DDStructureGenerator.
|
| |
template<typename T, bool align_with_padding = true>
class ddl::DDStructureGenerator< T, align_with_padding >
Creating a valid Structure Data Definition by a existing type and its member types.
- Template Parameters
-
| T | The Struct type to use. |
| align_with_padding | Set to true to align the structure and structure members with padding bytes to reach expected size of T. |
struct NestedStruct {
uint16_t value1;
uint32_t value2;
uint8_t value3;
};
.addElement("value1", &NestedStruct::value1)
.addElement("value2", &NestedStruct::value2)
.addElement("value3", &NestedStruct::value3);
enum MyEnum { a, b, c };
auto my_enum_type = DDEnumGenerator<MyEnum>("MyEnum", {{"a", a}, {"b", b}, {"c", c}});
struct MyStruct {
uint32_t value1;
NestedStruct nested;
MyEnum nested_enum[2];
};
.addElement("value1", &MyStruct::value1)
.addElement("nested", &MyStruct::nested, nested_definition)
.addElement("nested_enum", &MyStruct::nested_enum, my_enum_type);
DDStructureGenerator(const std::string &name, uint32_t struct_version=1)
CTOR to create a structure type based on a type.
Definition ddstructure_generator.h:129