ADTF
StructType::Element

observable DataDefinition object class for a Element of a StructType. More...

Inheritance diagram for StructType::Element:
[legend]

Public Member Functions

 Element ()
 default CTOR
 
 Element (const Element &other)
 copy CTOR
 
 Element (Element &&other)
 move CTOR
 
Elementoperator= (const Element &other)
 copy assignment operator More...
 
Elementoperator= (Element &&other)
 move assignment operator More...
 
 Element (const std::string &name, const std::string &type_name, const DeserializedInfo &deserialized_info, const SerializedInfo &serialized_info, const dd::ArraySize &array_size={}, const std::string &description={}, const std::string &comment={}, const std::string &unit_name={}, 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={})
 CTOR. More...
 
 Element (const std::string &name, const std::string &type_name, const DeserializedInfo &deserialized_info, const SerializedInfo &serialized_info, const dd::ArraySize &array_size, const std::string &description, const std::string &comment, const std::string &unit_name, 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, const std::string &valid_element_count)
 CTOR. More...
 
bool operator== (const Element &other) const
 equality operator. More...
 
bool operator!= (const Element &other) const
 non equality operator. More...
 
const std::string & getName () const
 Get the Name. More...
 
void setName (const std::string &name)
 Set the Name. More...
 
const std::string & getTypeName () const
 Get the Type Name. More...
 
void setTypeName (const std::string &type_name)
 Set the Type Name. More...
 
const std::string & getDescription () const
 Get the Description. More...
 
void setDescription (const std::string &description)
 Set the Description. More...
 
const std::string & getComment () const
 Get the Comment. More...
 
void setComment (const std::string &comment)
 Set the Comment object. More...
 
const ArraySizegetArraySize () const
 Get the Array Size. More...
 
void setArraySize (const ArraySize &array_size)
 Set the Array Size. More...
 
const std::string & getValidElementCount () const
 Get the Valid Element Count element name. More...
 
void setValidElementCount (const std::string &valid_element_count)
 Set the Valid Element Count element name. More...
 
const std::string & getUnitName () const
 Get the Unit Name. More...
 
void setUnitName (const std::string &unit_name)
 Set the Unit Name. More...
 
const std::string & getValue () const
 Get the value. More...
 
void setValue (const std::string &value)
 Set the Value This is only valid if the data type is set to an enum type where this constant value is part of. More...
 
const std::string & getMin () const
 Get the Min (for information only). More...
 
void setMin (const std::string &minimum_value)
 Set the Min (for information only). More...
 
const std::string & getMax () const
 Get the Max (for information only). More...
 
void setMax (const std::string &maximum_value)
 Set the Max (for information only). More...
 
const std::string & getDefault () const
 Get the Default object. More...
 
void setDefault (const std::string &default_value)
 Set the Default Value. More...
 
const std::string & getScale () const
 Get the Scale (for information only) More...
 
void setScale (const std::string &scale)
 Set the Scale (for information only) More...
 
const std::string & getOffset () const
 Get the Offset (for information only) More...
 
void setOffset (const std::string &offset)
 Set the Offset (for information only) More...
 
- Public Member Functions inherited from StructType::SerializedInfo
 SerializedInfo ()
 default CTOR.
 
 SerializedInfo (const SerializedInfo &)=default
 copy CTOR
 
 SerializedInfo (SerializedInfo &&)=default
 move CTOR
 
SerializedInfooperator= (const SerializedInfo &)=default
 copy assignment operator More...
 
SerializedInfooperator= (SerializedInfo &&)=default
 move assignment operator More...
 
virtual ~SerializedInfo ()=default
 DTOR.
 
 SerializedInfo (OptionalSize byte_pos, ByteOrder byte_order=ByteOrderDefault::getPlatformDefault(), OptionalSize bit_pos={}, OptionalSize num_bits={})
 CTOR. More...
 
 SerializedInfo (const std::initializer_list< size_t > &intializer)
 CTOR with string list initializing. More...
 
bool operator== (const SerializedInfo &other) const
 equality operator. More...
 
OptionalSize getBytePos () const
 Get the Byte Pos. More...
 
void setBytePos (OptionalSize byte_pos, bool prevent_notification=false)
 Set the Byte Pos. More...
 
OptionalSize getBitPos () const
 Get the Bit Pos (if set) More...
 
void setBitPos (OptionalSize bit_pos, bool prevent_notification=false)
 Sets the Bit Pos. More...
 
OptionalSize getNumBits () const
 Get the Num Bits (if set) More...
 
void setNumBits (OptionalSize num_bits)
 Set the Num Bits. More...
 
ByteOrder getByteOrder () const
 Get the Byte Order. More...
 
void setByteOrder (ByteOrder byte_order)
 Set the Byte Order. More...
 
- Public Member Functions inherited from StructType::DeserializedInfo
 DeserializedInfo ()
 Default CTOR.
 
 DeserializedInfo (const DeserializedInfo &)=default
 copy CTOR
 
 DeserializedInfo (DeserializedInfo &&)=default
 move CTOR
 
DeserializedInfooperator= (const DeserializedInfo &)=default
 copy assignment operator More...
 
DeserializedInfooperator= (DeserializedInfo &&)=default
 move assignment operator More...
 
virtual ~DeserializedInfo ()=default
 DTOR.
 
 DeserializedInfo (size_t alignment)
 CTOR. More...
 
 DeserializedInfo (const std::initializer_list< size_t > &intializer)
 CTOR. More...
 
bool operator== (const DeserializedInfo &other) const
 equality operator. More...
 
virtual size_t getAlignment () const
 Get the Alignment. More...
 
void setAlignment (size_t alignment)
 Set the Alignment. More...
 
- Public Member Functions inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
 ModelSubjectUtility ()=default
 CTOR.
 
 ModelSubjectUtility (const ModelSubjectUtility &)
 copy CTOR which removes the observers in case of!
 
ModelSubjectUtilityoperator= (const ModelSubjectUtility &)
 copy assignment operator which removes the observers in case of! More...
 
virtual ~ModelSubjectUtility ()=default
 DTOR.
 
void attachObserver (observer_type *observer)
 adda a observer to notify. More...
 
void detachObserver (observer_type *observer)
 remove a observer if in list. More...
 
- Public Member Functions inherited from InfoMap
 InfoMap ()=default
 CTOR.
 
 InfoMap (const InfoMap &)
 copy CTOR More...
 
 InfoMap (InfoMap &&)
 move CTOR More...
 
InfoMapoperator= (const InfoMap &)
 copy assignment operator More...
 
InfoMapoperator= (InfoMap &&)
 move assignment operator More...
 
template<typename INFO_T >
const INFO_T * getInfo () const
 Get the Info Pointer. More...
 
template<typename INFO_T >
INFO_T * getInfo ()
 Get the Info Pointer. More...
 
template<typename INFO_T >
void setInfo (const std::shared_ptr< INFO_T > &info)
 Set the Info object as shared pointer. More...
 

Private Member Functions

void notifyChangeSerialized (const std::string &additional_info) override
 notification forwarding of serialized information to the StructType::Element object. More...
 
void notifyChangeDeserialized (const std::string &additional_info) override
 Forwarding the notification. More...
 

Private Attributes

std::string _name
 
std::string _type_name
 
std::string _description
 
std::string _unit_name
 
std::string _comment
 
ArraySize _array_size = 1
 
std::string _value
 
std::string _minimum_value
 
std::string _maximum_value
 
std::string _default_value
 
std::string _scale
 
std::string _offset
 

Additional Inherited Members

- Public Types inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
typedef EVENT_CODE_T event_code_type
 local definition of the event code type
 
typedef MODEL_SUBJECT_T subject_type
 local definition of the subject type
 
typedef ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T > observer_type
 local definition of the observer type to notify
 
- Protected Member Functions inherited from ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
void notifyChanged (event_code_type event_code, subject_type &changed_subject, const std::string &additional_info)
 helper utility function to notify the current observers More...
 

Detailed Description

observable DataDefinition object class for a Element of a StructType.

Definition at line 734 of file datamodel_types.h.

Constructor & Destructor Documentation

◆ Element() [1/2]

Element ( const std::string &  name,
const std::string &  type_name,
const DeserializedInfo deserialized_info,
const SerializedInfo serialized_info,
const dd::ArraySize array_size = {},
const std::string &  description = {},
const std::string &  comment = {},
const std::string &  unit_name = {},
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 = {} 
)

CTOR.

Parameters
namename of the element
type_nametype name of the element (datatype, enumtype or structtype)
deserialized_infothe deserialized info (default is a alignment of 1)
serialized_infoserialized info (default is LE, bytepos will be calculated automatically in typeinfo model)
array_sizearray size of the element (default is 1) for setting dynamic use a string with a valid previous element name
descriptiondescription of the element
commentcomment of the element
unit_namethe unit name of the element
valuea constant value of the element (only valid if the type is set to a enumtype and this value is part of the enumtype elements)
minimum_valueminimum value (for information only)
maximum_valuemaximum value (for information only)
default_valuedefault value can be set for POD types (supported is a interger or a float/double value)
scalescale value (for information only)
offsetoffset value (for information only)

◆ Element() [2/2]

Element ( const std::string &  name,
const std::string &  type_name,
const DeserializedInfo deserialized_info,
const SerializedInfo serialized_info,
const dd::ArraySize array_size,
const std::string &  description,
const std::string &  comment,
const std::string &  unit_name,
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,
const std::string &  valid_element_count 
)

CTOR.

Parameters
namename of the element
type_nametype name of the element (datatype, enumtype or structtype)
deserialized_infothe deserialized info (default is a alignment of 1)
serialized_infoserialized info (default is LE, bytepos will be calculated automatically in typeinfo model)
array_sizearray size of the element (default is 1) for setting dynamic use a string with a valid previous element name
descriptiondescription of the element
commentcomment of the element
unit_namethe unit name of the element
valuea constant value of the element (only valid if the type is set to a enumtype and this value is part of the enumtype elements)
minimum_valueminimum value (for information only)
maximum_valuemaximum value (for information only)
default_valuedefault value can be set for POD types (supported is a interger or a float/double value)
scalescale value (for information only)
offsetoffset value (for information only)
valid_element_countname of the valid element count element name (for arrays)

Member Function Documentation

◆ getArraySize()

const ArraySize& getArraySize ( ) const

Get the Array Size.

Returns
ArraySize return the arraysize

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getComment()

const std::string& getComment ( ) const

Get the Comment.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getDefault()

const std::string& getDefault ( ) const

Get the Default object.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getDescription()

const std::string& getDescription ( ) const

Get the Description.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getMax()

const std::string& getMax ( ) const

Get the Max (for information only).

This was introduced in DDL 3.0.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getMin()

const std::string& getMin ( ) const

Get the Min (for information only).

This was introduced in DDL 3.0.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getName()

const std::string& getName ( ) const

Get the Name.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getOffset()

const std::string& getOffset ( ) const

Get the Offset (for information only)

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getScale()

const std::string& getScale ( ) const

Get the Scale (for information only)

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getTypeName()

const std::string& getTypeName ( ) const

Get the Type Name.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getUnitName()

const std::string& getUnitName ( ) const

Get the Unit Name.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getValidElementCount()

const std::string& getValidElementCount ( ) const

Get the Valid Element Count element name.

Returns
std::string return the valid element count element name
Return values
std::string()if not set
See also
Dynamic arrays in specification.

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ getValue()

const std::string& getValue ( ) const

Get the value.

Returns
const std::string&

Referenced by DDToXMLFactory< DOM_NODE_TYPE >::createNode().

◆ notifyChangeDeserialized()

void notifyChangeDeserialized ( const std::string &  )
overrideprivatevirtual

Forwarding the notification.

param std::string string additional_info - the additional info of the item changed notification.

Reimplemented from StructType::DeserializedInfo.

◆ notifyChangeSerialized()

void notifyChangeSerialized ( const std::string &  )
overrideprivatevirtual

notification forwarding of serialized information to the StructType::Element object.

param std::string string additional_info - The name of the additional info in the notification to forward.

Reimplemented from StructType::SerializedInfo.

◆ operator!=()

bool operator!= ( const Element other) const

non equality operator.

Parameters
otherthe other element to compare to.
Returns
false the elements is equal.
true the elements is not equal.

◆ operator=() [1/2]

Element& operator= ( const Element other)

copy assignment operator

Returns
Element&

◆ operator=() [2/2]

Element& operator= ( Element &&  other)

move assignment operator

Returns
Element&

◆ operator==()

bool operator== ( const Element other) const

equality operator.

Parameters
otherthe other element to compare to.
Returns
true the elements is equal.
false the elements is not equal.

◆ setArraySize()

void setArraySize ( const ArraySize array_size)

Set the Array Size.

Parameters
array_sizethe arraysize to set
Remarks
This is observable.

◆ setComment()

void setComment ( const std::string &  comment)

Set the Comment object.

Parameters
commentthe comment to set
Remarks
This is observable.

◆ setDefault()

void setDefault ( const std::string &  default_value)

Set the Default Value.

This is only valid if the default value is convertable to the datatype used.

Parameters
default_valuethe value for the default.
Remarks
This is observable.

◆ setDescription()

void setDescription ( const std::string &  description)

Set the Description.

Parameters
descriptionthe description
Remarks
This is observable.

◆ setMax()

void setMax ( const std::string &  maximum_value)

Set the Max (for information only).

Parameters
maximum_valuethe maximum value
Remarks
This is observable.

◆ setMin()

void setMin ( const std::string &  minimum_value)

Set the Min (for information only).

Parameters
minimum_valuethe minimum value
Remarks
This is observable.

◆ setName()

void setName ( const std::string &  name)

Set the Name.

Parameters
namethe name to set
Remarks
This is observable.
Exceptions
thismay throw if a element with the same name already exists in the container this element is part of.

◆ setOffset()

void setOffset ( const std::string &  offset)

Set the Offset (for information only)

Parameters
offsetthe offset to set
Remarks
This is observable.

◆ setScale()

void setScale ( const std::string &  scale)

Set the Scale (for information only)

Parameters
scalethe scale factor
Remarks
This is observable.

◆ setTypeName()

void setTypeName ( const std::string &  type_name)

Set the Type Name.

Parameters
type_namethe type name to set ((POD) datatype, enumtype, structtype).
Remarks
This is observable.

◆ setUnitName()

void setUnitName ( const std::string &  unit_name)

Set the Unit Name.

Parameters
unit_namethe unit name
Remarks
This is observable.

◆ setValidElementCount()

void setValidElementCount ( const std::string &  valid_element_count)

Set the Valid Element Count element name.

This value is usually only used if array size is greater than 1 and the valid content of the array elements varies.

Parameters
valid_element_countthe Valid Element Count element name to set
Remarks
This is observable.
See also
Dynamic arrays in specification.

◆ setValue()

void setValue ( const std::string &  value)

Set the Value This is only valid if the data type is set to an enum type where this constant value is part of.

Parameters
valuethe constant value to set
Remarks
This is observable.