ADTF  3.18.2
ddl::dd::datamodel Namespace Reference

definition of the datamodel namespace More...

Classes

class  DataDefinition
 DataDefinition Datamodel This datamodel is observable for any change of: More...
 
class  Header
 Data Definition datamodel for the Header. More...
 
class  KeyValuePair
 observable KeyValuePair More...
 
class  Stream
 observable Stream DataDefinition object. More...
 
class  TypeBase
 type Base defintion More...
 
class  DataType
 observable DataDefinition object class to describe (POD) DataType. More...
 
class  EnumType
 observable DataDefinition object class to describe EnumType. More...
 
class  StructType
 observable DataDefinition object class to describe StructType. More...
 
class  StreamMetaType
 observable DataDefinition object class to describe StreamMetaType. More...
 
struct  ElementType
 helper union class for an element that uses one of the datatype, enumtype, structtype More...
 
class  UnitBase
 UnitBase is the base class for Unit or BaseUnit. More...
 
class  BaseUnit
 BaseUnit. More...
 
class  UnitPrefix
 Unit Prefix - datamodel pefixes. More...
 
class  Unit
 BaseUnit. More...
 
class  IInfo
 Basic Info interface can be added to the InfoMap. More...
 
class  Info
 Helper template class to create valid IInfo objects. More...
 
class  InfoMap
 Info Map for the datamodel to hold a set of optional IInfo instances. More...
 

Typedefs

template<typename TYPE >
using ModelSubject = utility::ModelSubjectUtility< TYPE, ModelEventCode >
 Subject template class that is observable. More...
 
template<typename TYPE >
using ModelObserver = utility::ModelObserverUtility< TYPE, ModelEventCode >
 Observer template class that observe the TYPE. More...
 

Enumerations

enum  ModelEventCode {
  item_changed , item_removed , item_added , item_renamed ,
  subitem_added , subitem_removed , subitem_changed , subitem_renamed ,
  subitem_popped , subitem_inserted
}
 Model event code for the data model observer. More...
 

Functions

DataDefinition fromXMLString (const std::string &xml_string, const dd::Version &ddl_language_version={}, bool strict=false)
 creates a datamodel from a xml string More...
 
std::string toXMLString (const DataDefinition &dd)
 creates a XML from the DD datamodel. More...
 
DataDefinition fromXMLFile (const std::string &xml_filepath, bool strict=false)
 creates a datamodel from a xml file More...
 
void toXMLFile (const DataDefinition &dd, const std::string &xml_filepath)
 creates a XML file from the given DD datamodel. More...
 
void toXMLFile (const DataDefinition &dd, const std::string &xml_filepath, a_util::SortingOrder order)
 creates a XML file from the given DD datamodel. More...
 

Detailed Description

definition of the datamodel namespace

Typedef Documentation

◆ ModelObserver

Observer template class that observe the TYPE.

Template Parameters
TYPEDataDefinition object type that is the subject to observe.

Definition at line 160 of file datamodel_base.h.

◆ ModelSubject

Subject template class that is observable.

Template Parameters
TYPEDataDefinition object type that is the subject to observe.

Definition at line 152 of file datamodel_base.h.

Enumeration Type Documentation

◆ ModelEventCode

Model event code for the data model observer.

Enumerator
item_changed 

any content of the item was changed.


Possible items

  • header
  • datatype
  • enumtype
  • structtype
  • streammetatype
  • stream

The event has a additional parameter "additional_info": This is set to the name of attribute changed. Following rule (camelCase to snake_case):

  • if the function setSymbol() was call this is set to "symbol"
  • if the function setStructVersion() was called this is set to "struct_version"
item_removed 

the item was removed.


Possible items

  • header
  • datatype
  • enumtype
  • structtype
  • streammetatype
  • stream
item_added 

the item was added.


Possible items

  • header
  • datatype
  • enumtype
  • structtype
  • streammetatype
  • stream
item_renamed 

the item was renamed.


Possible items

  • header
  • datatype
  • enumtype
  • structtype
  • streammetatype
  • stream

The event has a additional parameter "additional_info": This is set to the old name of item that was changed.

subitem_added 

the sub item was added

  • for struct -> element
  • for header -> ext declaration
  • for enum -> element
  • for streammetatype -> property
  • stream -> streamstruct
subitem_removed 

the sub item was removed

  • for struct -> element at the end
  • for header -> ext declaration
  • for enum -> element
  • for streammetatype -> property
  • stream -> streamstruct
subitem_changed 

the sub item was changed

  • for struct -> element
  • for header -> ext declaration
  • for enum -> element
  • for streammetatype -> property
  • stream -> streamstruct

The event has a additional parameter "additional_info": This is set to the name of attribute changed. Following rule (camelCase to snake_case):

  • if the function setSymbol() was call this is set to "symbol"
  • if the function setType() was called this is set to "type"
  • if the function setArraySize() was called this is set to "array_size"
subitem_renamed 

the sub item was renamed

  • for struct -> element
  • for header -> ext declaration
  • for enum -> element
  • for streammetatype -> property
  • stream -> streamstruct

The event has a additional parameter "additional_info": This is set to the old name of item that was changed.

subitem_popped 

the last item was removed.


Possible items

  • structtype
subitem_inserted 

the sub item was inserted

  • for struct -> element

Definition at line 34 of file datamodel_base.h.

Function Documentation

◆ fromXMLFile()

DataDefinition ddl::dd::datamodel::fromXMLFile ( const std::string &  xml_filepath,
bool  strict = false 
)

creates a datamodel from a xml file

Parameters
xml_filepatha valid file path (if relative the current working directory is base)
strictset to true to load the datamodel exactly like defined (no mixture of DDL tag definitions allowed).
Returns
DataDefinition
Exceptions
throwsdd::Error if the XML given is not valid. More information on exception.

◆ fromXMLString()

DataDefinition ddl::dd::datamodel::fromXMLString ( const std::string &  xml_string,
const dd::Version ddl_language_version = {},
bool  strict = false 
)

creates a datamodel from a xml string

Parameters
xml_stringthe string as xml
ddl_language_versionthe language to use if no header is in the defintion
strictset to true to load the datamodel exactly like defined (no mixture of DDL tag definitions allowed).
Returns
DataDefinition
Exceptions
throwsdd::Error if the XML given is not valid. More information on exception.

◆ toXMLFile() [1/2]

void ddl::dd::datamodel::toXMLFile ( const DataDefinition dd,
const std::string &  xml_filepath 
)

creates a XML file from the given DD datamodel.

Parameters
ddthe Data Defintion the xml file is to create
xml_filepatha valid file path (if relative the current working directory is base)

◆ toXMLFile() [2/2]

void ddl::dd::datamodel::toXMLFile ( const DataDefinition dd,
const std::string &  xml_filepath,
a_util::SortingOrder  order 
)

creates a XML file from the given DD datamodel.

Parameters
ddthe Data Defintion the xml file is to create
xml_filepatha valid file path (if relative the current working directory is base)
orderSort nodes either in ascending or in descending order

◆ toXMLString()

std::string ddl::dd::datamodel::toXMLString ( const DataDefinition dd)

creates a XML from the DD datamodel.

Parameters
ddthe Data Defintion the xml string is to create
Returns
std::string the xml string