Dev Essential
Loading...
Searching...
No Matches
ddl::dd Namespace Reference

definition of the dd namespace More...

Namespaces

namespace  datamodel
 definition of the datamodel namespace
 
namespace  utility
 definition of the old compatibility utility namespace
 

Classes

class  AlignmentConversion
 Alignment Conversion utility. More...
 
class  AlignmentValidation
 Alignment ConvValidation utility. More...
 
class  ArraySize
 
class  ByteOrderConversion
 ByteOrder Conversion utility. More...
 
class  ByteOrderDefault
 Default ByteOrder Discovery utility class. More...
 
class  DataDefinition
 The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::datamodel::DataDefinition) valid or inform about inconsitence:
See: More...
 
struct  DDFromXMLFactory
 Factory to create a DataDefinition out of a XML based description. This factory uses a template type DOM_NODE_TYPE which is design to follow the a concept class type definition of the a_util::DOMElement. More...
 
struct  DDToXMLFactory
 Template class to create DD DOM nodes with the help of the type DOM_NODE_TYPE. More...
 
struct  DDXmlLiterals
 Singleton for strings used frequently with DD XML serialization. More...
 
class  Error
 Exception helper class to collect information while parsing, adding DD Objects or other failed operatons. More...
 
struct  Problem
 Problem to report to find the corresponding item name in a simple way. More...
 
class  StructArrayElementAccessIterator
 
class  StructElementAccess
 Class to access and obtain the byte position and other information of a instance of this element within a struct (see StructTypeAccess). More...
 
class  StructElementAccessIterator
 Iterator to iterate thru the StructTypeAccess. More...
 
class  StructTypeAccess
 Accessing class for a instance of a struct. This will calculate the byte positions can be used for serialialization and deserialization. More...
 
class  Version
 DDL Version. More...
 
class  VersionConversion
 Version conversion utility class. More...
 

Typedefs

using Header = datamodel::Header
 
using BaseUnit = datamodel::BaseUnit
 
using UnitPrefix = datamodel::UnitPrefix
 
using Unit = datamodel::Unit
 
using DataType = datamodel::DataType
 
using EnumType = datamodel::EnumType
 
using StructType = datamodel::StructType
 
using StreamMetaType = datamodel::StreamMetaType
 
using Stream = datamodel::Stream
 
using DataDescription = dd::DataDefinition
 Alias Name for DataDefinition, formally known as DataDescription.
 
using OptionalSize = utility::Optional<size_t>
 Optional Size Type.
 
using CallbackStructElementAccess
 Callback function type definitions for struct element access traversal.
 
using CallbackStructElementAccessControl
 Callback function type definitions for struct element access traversal. The return value indicates if the traversal should continue into the child or further array elements.
 

Enumerations

enum  TypeOfType : uint8_t {
  invalid_type , data_type , enum_type , struct_type ,
  stream_meta_type
}
 Classification of a Type. More...
 
enum  TypeOfUnit : uint8_t { invalid_unit , unit , base_unit }
 Classification of unit. More...
 
enum  Alignment : size_t {
  e0 = 1 , e1 = 1 , e2 = 2 , e4 = 4 ,
  e8 = 8 , e16 = 16 , e32 = 32 , e64 = 64 ,
  e_invalid = 255
}
 Alignment defintion. More...
 
enum  ByteOrder {
  platform_not_supported = 0x00 , plattform_little_endian_8 = 0x01 , platform_big_endian_8 = 0x02 , e_noe = platform_not_supported ,
  e_le = plattform_little_endian_8 , e_be = platform_big_endian_8
}
 
enum  InfoType : uint8_t {
  validation_info , validation_service_info , type_info , element_type_info ,
  named_container_info = element_type_info , last_info , last_info_last_index = 200 , additional_compatible_members = 201
}
 The Info model type defines the kind of infomodel and interface. More...
 
enum class  ValidationLevel : uint8_t { dont_know , invalid , good_enough , valid }
 Validation level. More...
 

Functions

bool addTypeByName (const std::string &type_name, const DataDefinition &source_dd, DataDefinition &destination_dd)
 Helper function which merges or adds the type with the name of type_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:
 
bool addStreamTypeByName (const std::string &stream_type_name, const DataDefinition &source_dd, DataDefinition &destination_dd)
 Merges or add the streamtype with the name of stream_type_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:
 
bool addUnitByName (const std::string &unit_name, const DataDefinition &source_dd, DataDefinition &destination_dd)
 Merges or add the unit with the name of unit_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:
 
std::vector< std::string > transformValidationProblemList (const std::vector< ddl::dd::Problem > &problems)
 transforms the validation protocol of problems to a simple vrctor of strings.
Simple usage:
 
void forEachElementInfix (const StructTypeAccess &parent, const CallbackStructElementAccess &access_leaf_callback, const CallbackStructElementAccessControl &enter_element_member_callback=[](auto &, auto &) { return true;}, const CallbackStructElementAccess &leave_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccessControl &enter_array_element_member_callback=[](auto &, auto &) { return true;}, const CallbackStructElementAccess &leave_array_element_member_callback=[](auto &, auto &) {}, bool filter_padding_elements=true)
 Traverse all elements of a struct type access in infix order and calls the callbacks.
 
void forEachElementInPathInfix (const StructTypeAccess &parent, std::string_view path, const CallbackStructElementAccess &target_element_callback, const CallbackStructElementAccess &enter_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &leave_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &enter_array_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &leave_array_element_member_callback=[](auto &, auto &) {})
 Traverse all elements along a given path in struct type access in infix order and calls the callbacks.
 
ddl::codec::LeafLayout getLeafLayout (const ddl::dd::StructElementAccess &element_access, ddl::DataRepresentation rep)
 
std::vector< std::string > transformProblemList (const std::vector< Problem > &problems)
 transforms the Problem List to a simple vector of strings.
Simple usage:
 

Detailed Description

definition of the dd namespace

Typedef Documentation

◆ BaseUnit

Reuse of datamodel base unit class - ddl::dd::datamodel::BaseUnit.

◆ CallbackStructElementAccess

Initial value:
std::function<void(const StructElementAccess& , const StructTypeAccess& )>
Class to access and obtain the byte position and other information of a instance of this element with...
Definition dd_struct_access.h:41
Accessing class for a instance of a struct. This will calculate the byte positions can be used for se...
Definition dd_struct_access.h:598

Callback function type definitions for struct element access traversal.

See also
forEachElementInfix

◆ CallbackStructElementAccessControl

Initial value:
std::function<bool(const StructElementAccess& , const StructTypeAccess& )>

Callback function type definitions for struct element access traversal. The return value indicates if the traversal should continue into the child or further array elements.

See also
forEachElementInfix

◆ DataType

Reuse of datamodel datatype class - ddl::dd::datamodel::DataType.

◆ EnumType

Reuse of datamodel enumtype class - ddl::dd::datamodel::EnumType.

◆ Header

Reuse of datamodel header class - ddl::dd::datamodel::Header.

◆ Stream

Reuse of datamodel stream class - ddl::dd::datamodel::Stream.

◆ StreamMetaType

Reuse of datamodel streammetatype class - ddl::dd::datamodel::StreamMetaType.

◆ StructType

Reuse of datamodel structtype class - ddl::dd::datamodel::StructType.

◆ Unit

Reuse of datamodel unit class - ddl::dd::datamodel::Unit.

◆ UnitPrefix

Reuse of datamodel unit prefix class - ddl::dd::datamodel::UnitPrefix.

Enumeration Type Documentation

◆ Alignment

enum ddl::dd::Alignment : size_t

Alignment defintion.

Enumerator
e0 

for backward compatibility

e1 

Default alignment

◆ ByteOrder

Representation of the byteorder enumeration

◆ InfoType

enum ddl::dd::InfoType : uint8_t

The Info model type defines the kind of infomodel and interface.

See also
datamodel::Info, datamodel::InfoMap
Enumerator
validation_info 

Validation Info.

validation_service_info 

Validation Info Service.

type_info 

Type Info.

element_type_info 

Element Type Info.

named_container_info 

internal type

last_info 

for customer info (use a offset to implement own infos if necessary)

last_info_last_index 

last valid customer info (values above are used internally)

additional_compatible_members 

due to binary compatibility the InfoMap is used as pimpl object if necessary

◆ TypeOfType

enum ddl::dd::TypeOfType : uint8_t

Classification of a Type.

Enumerator
invalid_type 

the type is unknown

data_type 

the type is a data type (DataType)

enum_type 

the type is a enum type (EnumType)

struct_type 

the type is a struct type (StructType)

stream_meta_type 

the type is an stream meta type (StreamMetaType)

◆ TypeOfUnit

enum ddl::dd::TypeOfUnit : uint8_t

Classification of unit.

Enumerator
invalid_unit 

the type of the unit is unknown

unit 

the unit is a unit (Unit)

base_unit 

the unit is a base unit (BaseUnit)

◆ ValidationLevel

enum class ddl::dd::ValidationLevel : uint8_t
strong

Validation level.

Enumerator
dont_know 

The validation is not known. This means it is not calculated yet. Use i.e. ddl::dd::DataDefinition::validate.

invalid 

the validation level is invalid, dependencies can not be obtained or the dependency "to" is invalid (struct to struct i.e.).

good_enough 

Structs and elements can be "good_enough" for the TypeInfo. This means the Coder and Decoder can calculate the sizes and the all access Functions can obtain values. Usually this should be the valid state. The problem is, that there are DataDefinition out there (in the users world) using i.e. units, but does not define the unit within that DD. At this point we do not want to break that code! So good enough means: Not well defined in some cases, but good enough for calculate byte positions and TypeInfo.

Only structs, enums and datatypes may have a validationlevel of "good_enough" if there are any other DD Objects used in a DataDefinition and they are "invalid", the DD will also set to "invalid"!

valid 

every thing is well defined.

Function Documentation

◆ addStreamTypeByName()

bool ddl::dd::addStreamTypeByName ( const std::string & stream_type_name,
const DataDefinition & source_dd,
DataDefinition & destination_dd )

Merges or add the streamtype with the name of stream_type_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:

Remarks
This functionality was designed to support adding types that are part of the streams (Stream).
Parameters
stream_type_namethe typename of the type to add.
source_dddependencies will be obtained from this DataDefinition reference (streammetatype, structtype, etc.)
destination_ddwhere to add or merge
Exceptions
ddl::dd::Errorthrows if the type already exists and is not equal to the given one. Will also check dependencies.
Return values
truea type was found and added
falsea type was NOT found and so NOT added

◆ addTypeByName()

bool ddl::dd::addTypeByName ( const std::string & type_name,
const DataDefinition & source_dd,
DataDefinition & destination_dd )

Helper function which merges or adds the type with the name of type_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:

Remarks
This functionality was designed to support adding types that are part of the elements within a StructType.
Parameters
type_namethe typename of the type to add.
source_dddependencies will be obtained from this DataDefinition reference (other streammetatype)
destination_ddwhere to add or merge
Exceptions
ddl::dd::Errorthrows if the type already exists and is not equal to the given one. Will also check dependencies.
Return values
truea type was found and added
falsea type was NOT found and so NOT added

◆ addUnitByName()

bool ddl::dd::addUnitByName ( const std::string & unit_name,
const DataDefinition & source_dd,
DataDefinition & destination_dd )

Merges or add the unit with the name of unit_name. If there are dependencies, they will be retrieved from source_dd.
following types are considered:

Parameters
unit_namethe unitname of the unit to add.
source_dddependencies will be obtained from this DataDefinition reference (baseunit, unitprefix)
destination_ddwhere to add or merge
Exceptions
ddl::dd::Errorthrows if the unit already exists and is not equal to the given one. Will also check dependencies.
Return values
truea unit was found and added
falsea unit was NOT found and so NOT added

◆ forEachElementInfix()

void ddl::dd::forEachElementInfix ( const StructTypeAccess & parent,
const CallbackStructElementAccess & access_leaf_callback,
const CallbackStructElementAccessControl & enter_element_member_callback = [](auto &, auto &) { return true;},
const CallbackStructElementAccess & leave_element_member_callback = [](auto &, auto &) {},
const CallbackStructElementAccessControl & enter_array_element_member_callback = [](auto &, auto &) { return true;},
const CallbackStructElementAccess & leave_array_element_member_callback = [](auto &, auto &) {},
bool filter_padding_elements = true )

Traverse all elements of a struct type access in infix order and calls the callbacks.

Parameters
parentThe struct type access to traverse.
access_leaf_callbackThe callback function to call for each leaf elements found.
enter_element_member_callbackThe callback function to call when entering a struct member, indepentent of it being a leaf or not. You must return true for further entering the members children or array elements. Otherwise it will skip all children and array elements of this element.
leave_element_member_callbackThe callback function to call when leaving a struct member, indepentent of it being a leaf or not. It will be only called, if the enter_element_member_callback has returned true for the same child element.
enter_array_element_member_callbackThe callback function to call when entering the array members of an elements member that is an array indepentent of it being a leaf or not. You must return true for further entering the array member and its children.
leave_array_element_member_callbackThe callback function to call when leaving an array element. It will only be called, if the enter_array_element_member_callback has returned true for the same child element.
filter_padding_elementsIf true, padding elements are filtered out.
Exception Safety

Callbacks may terminate traversal with an exception. No further callbacks are called after any exception is thrown.

◆ forEachElementInPathInfix()

void ddl::dd::forEachElementInPathInfix ( const StructTypeAccess & parent,
std::string_view path,
const CallbackStructElementAccess & target_element_callback,
const CallbackStructElementAccess & enter_element_member_callback = [](auto &, auto &) {},
const CallbackStructElementAccess & leave_element_member_callback = [](auto &, auto &) {},
const CallbackStructElementAccess & enter_array_element_member_callback = [](auto &, auto &) {},
const CallbackStructElementAccess & leave_array_element_member_callback = [](auto &, auto &) {} )

Traverse all elements along a given path in struct type access in infix order and calls the callbacks.

Parameters
parentThe struct type access to traverse.
pathThe child name of the target element in point notation (i.e. "child_element[4].element_value").
target_element_callbackThe callback function to call once when the target element is reached. The target element is not required to be a leaf. Called only before leave_element_member_callback and leave_array_element_member_callback. Never called if the target element is unreachable.
enter_element_member_callbackThe callback function to call when entering a struct member. Called only before target_element_callback.
leave_element_member_callbackThe callback function to call when leaving a struct member.
enter_array_element_member_callbackThe callback function to call when entering the selected array member of an elements member that is an array. Called only before target_element_callback.
leave_array_element_member_callbackThe callback function to call when leaving an array element.
Exception Safety

Exceptions may be thrown if the path is semantically invalid (e.g. invalid characters). Callbacks may terminate traversal with an exception. No further callbacks are called after any exception is thrown.

◆ getLeafLayout()

ddl::codec::LeafLayout ddl::dd::getLeafLayout ( const ddl::dd::StructElementAccess & element_access,
ddl::DataRepresentation rep )

Retrieve the ddl::codec::LeafLayout for the given ddl::dd::StructElementAccess and ddl::DataRepresentation. This will only work for leaf elements and POD types. Dynamic elements or elements after dynamic arrays are not supported.

Parameters
element_accessthe valid StructElementAccess to retrieve the LeafLayout for
repthe data representation to retrieve the LeafLayout for
See also
ddl::codec::ValueSetter::setLeafValue, ddl::codec::ValueGetter::getLeafValue
Returns
valid LeafLayout
Exceptions
std::runtime_errorif the element access is not valid, not a leaf POD type, after a dynamic part or a dynamic element.

◆ transformProblemList()

std::vector< std::string > ddl::dd::transformProblemList ( const std::vector< Problem > & problems)

transforms the Problem List to a simple vector of strings.
Simple usage:

//...
using namespace ddl;
//... adding ... loading ... using
std::cout <<
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::data...
Definition dd.h:92
std::vector< ddl::dd::Problem > getValidationProtocol() const
Gets a collection of all problems obtained while validating the DataDefinition Objects.
std::string join(const std::vector< std::string > &strings, const std::string &delimiter)
std::vector< std::string > transformProblemList(const std::vector< Problem > &problems)
transforms the Problem List to a simple vector of strings. Simple usage:
definition of the ddl namespace
Definition codec.h:21
Parameters
problemsthe problems to tranform.
Returns
std::vector<std::string>

◆ transformValidationProblemList()

std::vector< std::string > ddl::dd::transformValidationProblemList ( const std::vector< ddl::dd::Problem > & problems)

transforms the validation protocol of problems to a simple vrctor of strings.
Simple usage:

//...
using namespace ddl;
//... adding ... loading ... using
std::cout <<
std::vector< std::string > transformValidationProblemList(const std::vector< ddl::dd::Problem > &problems)
transforms the validation protocol of problems to a simple vrctor of strings. Simple usage:
Parameters
problemsthe problems to tranform.
Returns
std::vector<std::string>