|
ADTF
|
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...
#include <dd.h>
Inherits ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >, and ddl::dd::utility::ModelObserverUtility< TYPE, ModelEventCode >.
Public Types | |
| using | BaseUnits = datamodel::DataDefinition::BaseUnits |
| Reuse of datamodel base unit container - ddl::dd::datamodel::DataDefinition::BaseUnits. | |
| using | UnitPrefixes = datamodel::DataDefinition::UnitPrefixes |
| Reuse of datamodel unit prefixes container - ddl::dd::datamodel::DataDefinition::BaseUnits. | |
| using | Units = datamodel::DataDefinition::Units |
| Reuse of datamodel units container - ddl::dd::datamodel::DataDefinition::Units. | |
| using | DataTypes = datamodel::DataDefinition::DataTypes |
| Reuse of datamodel datatypes container - ddl::dd::datamodel::DataDefinition::DataTypes. | |
| using | EnumTypes = datamodel::DataDefinition::EnumTypes |
| Reuse of datamodel enumtypes container - ddl::dd::datamodel::DataDefinition::EnumTypes. | |
| using | StructTypes = datamodel::DataDefinition::StructTypes |
| Reuse of datamodel structs container - ddl::dd::datamodel::DataDefinition::StructTypes. | |
| using | StreamMetaTypes = datamodel::DataDefinition::StreamMetaTypes |
| Reuse of datamodel streammetatypes container - ddl::dd::datamodel::DataDefinition::StreamMetaTypes. | |
| using | Streams = datamodel::DataDefinition::Streams |
| Reuse of datamodel streams container - ddl::dd::datamodel::DataDefinition::Streams. | |
Public Member Functions | |
| DataDefinition () | |
| Construct a new DataDefinition object with a new datamodel::DataDefinition. The used language version of the new datamodel is ddl::dd::Version::ddl_version_current. | |
| DataDefinition (Version ddl_version) | |
| Construct a new DataDefinition object with a new datamodel::DataDefinition. | |
| DataDefinition (const DataDefinition &other) | |
| Construct a new DataDefinition object and copies the datamodel. | |
| DataDefinition (DataDefinition &&other) | |
| Construct a new DataDefinition object and take the datamodel of the other. | |
| DataDefinition (const std::shared_ptr< datamodel::DataDefinition > &datamodel) | |
| Construct a new DataDefinition object and set the datamodel to the given one. | |
| DataDefinition & | operator= (const DataDefinition &other) |
| Assigns the DataDefinition object and copies the datamodel. | |
| DataDefinition & | operator= (DataDefinition &&other) |
| Assigns the DataDefinition object and moves the datamodel. | |
| virtual | ~DataDefinition () |
| Destroy the DataDefinition object. | |
| void | setModel (const std::shared_ptr< datamodel::DataDefinition > &datamodel) |
| Sets and references the datamodel object, that is to validate and observe. | |
| std::shared_ptr< const datamodel::DataDefinition > | getModel () const |
| Gets the datamodel reference. | |
| void | setVersion (const Version &ddl_version) |
| Set the language version of the containing datamodel. | |
| Version | getVersion () const |
| Get the current language version set in datamodel. | |
| void | setHeader (const Header &header) |
| Resets the DataDefinition Header of the datamodel. | |
| const Header & | getHeader () const |
| Gets the Header of the datamodel. | |
| Header & | getHeader () |
| Gets the Header of the datamodel. | |
| const BaseUnits & | getBaseUnits () const |
| Get the Base Units of the datamodel. | |
| BaseUnits & | getBaseUnits () |
| Get the Base Units of the datamodel. | |
| const UnitPrefixes & | getUnitPrefixes () const |
| Get the Unit Prefixes of the datamodel. | |
| UnitPrefixes & | getUnitPrefixes () |
| Get the Unit Prefixes of the datamodel. | |
| const Units & | getUnits () const |
| Get the Units of the datamodel. | |
| Units & | getUnits () |
| Get the Units of the datamodel. | |
| const DataTypes & | getDataTypes () const |
| Get the Data Types of the datamodel. | |
| DataTypes & | getDataTypes () |
| Get the Data Types of the datamodel. | |
| const EnumTypes & | getEnumTypes () const |
| Get the Enum Types of the datamodel. | |
| EnumTypes & | getEnumTypes () |
| Get the Enum Types of the datamodel. | |
| const StructTypes & | getStructTypes () const |
| Get the Struct Types of the datamodel. | |
| StructTypes & | getStructTypes () |
| Get the Struct Types of the datamodel. | |
| bool | containsType (const std::string &type_name) const |
| Retrieve information if the datamodel contains a type with the given name. Following types are considered: DataType, StructType, EnumType, StreamMetaType. | |
| TypeOfType | getTypeOfType (const std::string &type_name) const |
| Retrieve information if the datamodel contains a type with the given name and return the type of it. Following types are considered: DataType, StructType, EnumType, StreamMetaType. | |
| bool | containsUnit (const std::string &unit_name) const |
| Retrieve information if the datamodel contains a unit with the given name. Following units are considered: BaseUnit, Unit. | |
| TypeOfUnit | getTypeOfUnit (const std::string &unit_name) const |
| Retrieve information if the datamodel contains a unit with the given name and return the type of it. Following units are considered: BaseUnit, Unit. | |
| const StreamMetaTypes & | getStreamMetaTypes () const |
| Get the Streammeta Types of the datamodel. | |
| StreamMetaTypes & | getStreamMetaTypes () |
| Get the Streammeta Types of the datamodel. | |
| const Streams & | getStreams () const |
| Get the Streams of the datamodel. | |
| Streams & | getStreams () |
| Get the Streams of the datamodel. | |
| bool | isValid (ValidationLevel level=ValidationLevel::valid) const |
Obtains if the validation level has reached at least the given level. | |
| void | validate (bool force_revalidation=false) |
| Calculate the validation level of all DataDefinition objects that does not have a validation level yet or is below ValidationLevel::valid. | |
| std::vector< ddl::dd::Problem > | getValidationProtocol () const |
| Gets a collection of all problems obtained while validating the DataDefinition Objects. | |
| void | calculatePositions (const std::string &type_name={}, TypeOfType type_of_type=TypeOfType::invalid_type, bool force_recalculation=false) |
| calculates the element sizes and positions of all structs, enumtypes and datatypes or dedicated for the one given. | |
| StructTypeAccess | getStructTypeAccess (const std::string &type_name) const |
| Get the Struct Type Access, where to enter the type and calculated element position information. | |
| void | add (const BaseUnit &base_unit, const DataDefinition &source_dd) |
Merges or add the given base unit. If there are dependencies, they will be retrieved from source_dd. If there does already exist one base unit with the same name, the base unit must be equal (ddl::dd::datamodel::BaseUnit). | |
| void | add (const UnitPrefix &unit_prefix, const DataDefinition &source_dd) |
Merges or add the given unit prefix. If there are dependencies, they will be retrieved from source_dd. If there does already exist one unit prefix with the same name, the prefix must be equal (ddl::dd::datamodel::UnitPrefix). | |
| void | add (const Unit &unit, const DataDefinition &source_dd) |
Merges or add the given unit. If there are dependencies, they will be retrieved from source_dd. If there does already exist one unit with the same name, the unit must be equal (ddl::dd::datamodel::Unit). | |
| void | add (const DataType &data_type, const DataDefinition &source_dd) |
Merges or add the given datatype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one datatype with the same name, the datatype must be equal (ddl::dd::datamodel::DataType). | |
| void | add (const EnumType &enum_type, const DataDefinition &source_dd) |
Merges or add the given enumtype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one enumtype with the same name, the enumtype must be equal (ddl::dd::datamodel::EnumType). | |
| void | add (const StructType &struct_type, const DataDefinition &source_dd) |
Merges or add the given structtype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one structtype with the same name, the structtype must be equal (ddl::dd::datamodel::StructType). | |
| void | add (const StreamMetaType &stream_meta_type, const DataDefinition &source_dd) |
Merges or add the given streammetatype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one streammetatype with the same name, the streammetatype must be equal (ddl::dd::datamodel::StreamMetaType). | |
| void | add (const Stream &stream, const DataDefinition &source_dd) |
Merges or add the given stream. If there are dependencies, they will be retrieved from source_dd. If there does already exist one stream with the same name, the stream must be equal (ddl::dd::datamodel::Stream). | |
| void | add (const DataDefinition &source_dd) |
Merges or add the DataDefinition objects of the given source_dd. | |
Friends | |
| class | ddl::DDMerge |
The Data Definiton class uses the validation model to keep a Data Definition datamodel (ddl::dd::datamodel::DataDefinition) valid or inform about inconsitence:
See:
Additionally, it provides access to a address, offset and type information via the typeinfo model:
There are predefined objects that can be used without adding it explicitly: see ddl::PredefinedDataTypes.
There are predefined unit objects that can be used immediatelly: see ddl::PredefinedUnits.
| ddl::dd::DataDefinition::DataDefinition | ( | Version | ddl_version | ) |
Construct a new DataDefinition object with a new datamodel::DataDefinition.
| ddl_version | The used language version of the new datamodel. |
| ddl::dd::DataDefinition::DataDefinition | ( | const DataDefinition & | other | ) |
Construct a new DataDefinition object and copies the datamodel.
| other | The other data definition to copy. |
| ddl::dd::DataDefinition::DataDefinition | ( | DataDefinition && | other | ) |
Construct a new DataDefinition object and take the datamodel of the other.
| other | The other data definition to move the model from. |
| ddl::dd::DataDefinition::DataDefinition | ( | const std::shared_ptr< datamodel::DataDefinition > & | datamodel | ) |
Construct a new DataDefinition object and set the datamodel to the given one.
| datamodel | the datamodel to validate and observe. |
| void ddl::dd::DataDefinition::add | ( | const BaseUnit & | base_unit, |
| const DataDefinition & | source_dd ) |
Merges or add the given base unit. If there are dependencies, they will be retrieved from source_dd. If there does already exist one base unit with the same name, the base unit must be equal (ddl::dd::datamodel::BaseUnit).
| base_unit | the base unit to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference. |
| ddl::dd::Error | throws if base unit already exists and is not equal to the given one. |
| void ddl::dd::DataDefinition::add | ( | const DataDefinition & | source_dd | ) |
Merges or add the DataDefinition objects of the given source_dd.
| source_dd | the data definition to add. |
| ddl::dd::Error | throws if a DataDefinition object to add already exists and it is not equal to the given one. |
add methods. | void ddl::dd::DataDefinition::add | ( | const DataType & | data_type, |
| const DataDefinition & | source_dd ) |
Merges or add the given datatype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one datatype with the same name, the datatype must be equal (ddl::dd::datamodel::DataType).
| data_type | the data_type to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (base units and units) |
| ddl::dd::Error | throws if a datatype already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const EnumType & | enum_type, |
| const DataDefinition & | source_dd ) |
Merges or add the given enumtype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one enumtype with the same name, the enumtype must be equal (ddl::dd::datamodel::EnumType).
| enum_type | the enumtype to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (datatype) |
| ddl::dd::Error | throws if a datatype already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const Stream & | stream, |
| const DataDefinition & | source_dd ) |
Merges or add the given stream. If there are dependencies, they will be retrieved from source_dd. If there does already exist one stream with the same name, the stream must be equal (ddl::dd::datamodel::Stream).
| stream | the stream to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (streammetatype, structtype) |
| ddl::dd::Error | throws if a Stream already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const StreamMetaType & | stream_meta_type, |
| const DataDefinition & | source_dd ) |
Merges or add the given streammetatype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one streammetatype with the same name, the streammetatype must be equal (ddl::dd::datamodel::StreamMetaType).
| stream_meta_type | the streammetatype to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (other streammetatype) |
| ddl::dd::Error | throws if a streammetatype already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const StructType & | struct_type, |
| const DataDefinition & | source_dd ) |
Merges or add the given structtype. If there are dependencies, they will be retrieved from source_dd. If there does already exist one structtype with the same name, the structtype must be equal (ddl::dd::datamodel::StructType).
| struct_type | the structtype to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (datatype, other structtype, enumtype, units) |
| ddl::dd::Error | throws if a structype already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const Unit & | unit, |
| const DataDefinition & | source_dd ) |
Merges or add the given unit. If there are dependencies, they will be retrieved from source_dd. If there does already exist one unit with the same name, the unit must be equal (ddl::dd::datamodel::Unit).
| unit | the unit to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference (base units and unit prefixes) |
| ddl::dd::Error | throws if a unit already exists and is not equal to the given one. Will also check dependencies. |
| void ddl::dd::DataDefinition::add | ( | const UnitPrefix & | unit_prefix, |
| const DataDefinition & | source_dd ) |
Merges or add the given unit prefix. If there are dependencies, they will be retrieved from source_dd. If there does already exist one unit prefix with the same name, the prefix must be equal (ddl::dd::datamodel::UnitPrefix).
| unit_prefix | the unit prefix to add. |
| source_dd | dependencies will be obtained from this DataDefinition reference. |
| ddl::dd::Error | throws if a unit prefix already exists and is not equal to the given one. |
| void ddl::dd::DataDefinition::calculatePositions | ( | const std::string & | type_name = {}, |
| TypeOfType | type_of_type = TypeOfType::invalid_type, | ||
| bool | force_recalculation = false ) |
calculates the element sizes and positions of all structs, enumtypes and datatypes or dedicated for the one given.
| type_name | the type name to calculate the size and type info for. if empty recalculate all, if necessary. |
| type_of_type | if type name is empty, this parameter can choose the types to recalculate. |
| force_recalculation | if set to true this will force the recalculation. |
| bool ddl::dd::DataDefinition::containsType | ( | const std::string & | type_name | ) | const |
Retrieve information if the datamodel contains a type with the given name.
Following types are considered: DataType, StructType, EnumType, StreamMetaType.
| type_name | the name to check |
| bool ddl::dd::DataDefinition::containsUnit | ( | const std::string & | unit_name | ) | const |
| BaseUnits & ddl::dd::DataDefinition::getBaseUnits | ( | ) |
| const BaseUnits & ddl::dd::DataDefinition::getBaseUnits | ( | ) | const |
| DataTypes & ddl::dd::DataDefinition::getDataTypes | ( | ) |
Get the Data Types of the datamodel.
| const DataTypes & ddl::dd::DataDefinition::getDataTypes | ( | ) | const |
Get the Data Types of the datamodel.
| EnumTypes & ddl::dd::DataDefinition::getEnumTypes | ( | ) |
Get the Enum Types of the datamodel.
| const EnumTypes & ddl::dd::DataDefinition::getEnumTypes | ( | ) | const |
Get the Enum Types of the datamodel.
| Header & ddl::dd::DataDefinition::getHeader | ( | ) |
| const Header & ddl::dd::DataDefinition::getHeader | ( | ) | const |
| std::shared_ptr< const datamodel::DataDefinition > ddl::dd::DataDefinition::getModel | ( | ) | const |
Gets the datamodel reference.
| StreamMetaTypes & ddl::dd::DataDefinition::getStreamMetaTypes | ( | ) |
Get the Streammeta Types of the datamodel.
| const StreamMetaTypes & ddl::dd::DataDefinition::getStreamMetaTypes | ( | ) | const |
Get the Streammeta Types of the datamodel.
| Streams & ddl::dd::DataDefinition::getStreams | ( | ) |
| const Streams & ddl::dd::DataDefinition::getStreams | ( | ) | const |
| StructTypeAccess ddl::dd::DataDefinition::getStructTypeAccess | ( | const std::string & | type_name | ) | const |
Get the Struct Type Access, where to enter the type and calculated element position information.
| type_name | the struct type name to retrieve the structtype access for. |
| StructTypes & ddl::dd::DataDefinition::getStructTypes | ( | ) |
Get the Struct Types of the datamodel.
| const StructTypes & ddl::dd::DataDefinition::getStructTypes | ( | ) | const |
Get the Struct Types of the datamodel.
| TypeOfType ddl::dd::DataDefinition::getTypeOfType | ( | const std::string & | type_name | ) | const |
Retrieve information if the datamodel contains a type with the given name and return the type of it.
Following types are considered: DataType, StructType, EnumType, StreamMetaType.
| type_name | the name to check |
| TypeOfType::invalid_type | A type with the given name does not exists. |
| TypeOfType::data_type | A type with the given name is a DataType. |
| TypeOfType::enum_type | A type with the given name is a EnumType. |
| TypeOfType::struct_type | A type with the given name is a StructType. |
| TypeOfType::streammetatype_type | A type with the given name is a StreamMetaType. |
| TypeOfUnit ddl::dd::DataDefinition::getTypeOfUnit | ( | const std::string & | unit_name | ) | const |
Retrieve information if the datamodel contains a unit with the given name and return the type of it.
Following units are considered: BaseUnit, Unit.
| unit_name | the name to check |
| TypeOfUnit::invalid_unit | A unit with the given name does not exists. |
| TypeOfUnit::unit | A unit with the given name is a Unit. |
| TypeOfUnit::base_unit | A unit with the given name is a BaseUnit. |
| UnitPrefixes & ddl::dd::DataDefinition::getUnitPrefixes | ( | ) |
Get the Unit Prefixes of the datamodel.
| const UnitPrefixes & ddl::dd::DataDefinition::getUnitPrefixes | ( | ) | const |
Get the Unit Prefixes of the datamodel.
| Units & ddl::dd::DataDefinition::getUnits | ( | ) |
| const Units & ddl::dd::DataDefinition::getUnits | ( | ) | const |
| std::vector< ddl::dd::Problem > ddl::dd::DataDefinition::getValidationProtocol | ( | ) | const |
Gets a collection of all problems obtained while validating the DataDefinition Objects.
| Version ddl::dd::DataDefinition::getVersion | ( | ) | const |
Get the current language version set in datamodel.
| bool ddl::dd::DataDefinition::isValid | ( | ValidationLevel | level = ValidationLevel::valid | ) | const |
Obtains if the validation level has reached at least the given level.
| level | the level to check |
level level | DataDefinition & ddl::dd::DataDefinition::operator= | ( | const DataDefinition & | other | ) |
Assigns the DataDefinition object and copies the datamodel.
| other | The other data definition to copy from. |
| DataDefinition & ddl::dd::DataDefinition::operator= | ( | DataDefinition && | other | ) |
Assigns the DataDefinition object and moves the datamodel.
| other | The other data definition to move from. |
| void ddl::dd::DataDefinition::setHeader | ( | const Header & | header | ) |
Resets the DataDefinition Header of the datamodel.
| header | The header to set. |
| void ddl::dd::DataDefinition::setModel | ( | const std::shared_ptr< datamodel::DataDefinition > & | datamodel | ) |
Sets and references the datamodel object, that is to validate and observe.
| datamodel | the datamodel to validate and observe. |
| void ddl::dd::DataDefinition::setVersion | ( | const Version & | ddl_version | ) |
Set the language version of the containing datamodel.
| ddl_version | the lanuage version to set. |
| void ddl::dd::DataDefinition::validate | ( | bool | force_revalidation = false | ) |
Calculate the validation level of all DataDefinition objects that does not have a validation level yet or is below ValidationLevel::valid.
| force_revalidation | if a validation level was already calculated to ValidationLevel::valid this will force a recalculation! |