ADTF  3.18.4
StructElementAccess

Class to access and obtain the byte position and other information of a instance of this element within a struct (see StructTypeAccess). More...

Public Member Functions

 StructElementAccess ()=delete
 deleted CTOR
 
 StructElementAccess (std::nullptr_t)
 empty element access. More...
 
 StructElementAccess (StructElementAccess &&)=default
 Default move CTOR.
 
StructElementAccessoperator= (StructElementAccess &&)=default
 Default move assignment. More...
 
 StructElementAccess (const StructElementAccess &)=default
 Default copy CTOR.
 
StructElementAccessoperator= (const StructElementAccess &)=default
 Default copy assignment. More...
 
 operator bool () const
 Retrieve if the StructElementAccess is valid or not! More...
 
TypeOfType getTypeOfType () const
 Get the Type Of the type. More...
 
std::shared_ptr< const datamodel::StructTypegetStructType () const
 Gets the Struct Type if the element is dependent on a structtype. More...
 
std::shared_ptr< const datamodel::EnumTypegetEnumType () const
 Gets the Enum Type if the element is dependent on a enumtype. More...
 
std::shared_ptr< const datamodel::DataTypegetDataType () const
 Gets the Data Type if the element is dependent on a datatype. More...
 
StructTypeAccess getStructTypeAccess (size_t array_pos=0) const
 Get the Struct Type Access if the element depends on a structtype. More...
 
const datamodel::StructType::ElementgetElement () const
 Get the Element Information which is also part of the data definition. More...
 
bool isDynamic () const
 Retieve information if this element is a dynamic array. More...
 
bool isAfterDynamic () const
 The element is on a byte position after a dynamic element, the byte position can not be calculated until it is instanciated. More...
 
OptionalSize getArrayPos () const
 Get the Array Pos, if this element was retrieved via StructTypeAccess::getElementByPath and the operator[]. More...
 
size_t getDeserializedBytePos (size_t array_size=0) const
 Get the Deserialized Byte Pos relative to the first byte position of the struct obtained by dd::DataDefinition::getStructTypeAccess. More...
 
size_t getDeserializedByteSize () const
 Get the Byte size (depends on alignments, ddlversion and arraysize) More...
 
size_t getDeserializedTypeByteSize () const
 Get the Serialized Type Byte size. More...
 
size_t getSerializedBytePos (size_t array_size=0) const
 Get SerializedBytePos obtained by dd::DataDefinition::getStructTypeAccess. More...
 
size_t getSerializedBitOffset (size_t array_size=0) const
 Get SerializedBitOsset obtained by dd::DataDefinition::getStructTypeAccess. More...
 
size_t getSerializedBitSize () const
 Get the serialized Bit size of the value. More...
 
size_t getSerializedTypeBitSize () const
 Get the serialized bit size of one element. More...
 

Private Member Functions

 StructElementAccess (const std::shared_ptr< const datamodel::StructType::Element > &elem, OptionalSize serialized_element_bit_offset, OptionalSize deserialized_element_byte_offset, OptionalSize array_pos)
 Construct a new Struct Element Access object. More...
 

Private Attributes

std::shared_ptr< const datamodel::StructType::Element_element = {}
 
const ElementTypeInfo_element_type_info = nullptr
 
OptionalSize _deserialized_struct_byte_offset = {}
 
OptionalSize _serialized_struct_bit_offset = {}
 
OptionalSize _array_pos = {}
 

Detailed Description

Class to access and obtain the byte position and other information of a instance of this element within a struct (see StructTypeAccess).

Definition at line 34 of file dd_struct_access.h.

Constructor & Destructor Documentation

◆ StructElementAccess() [1/2]

StructElementAccess ( std::nullptr_t  )

empty element access.

This kind of element access will be returned, if i.e. StructTypeAccess::getElementByPath can not find the given path.

See also
operator bool()

◆ StructElementAccess() [2/2]

StructElementAccess ( const std::shared_ptr< const datamodel::StructType::Element > &  elem,
OptionalSize  serialized_element_bit_offset,
OptionalSize  deserialized_element_byte_offset,
OptionalSize  array_pos 
)
private

Construct a new Struct Element Access object.

Parameters
elemthe element information of the dd::DataDefinition.
serialized_element_offsetthe serialized offset of the element
deserialized_element_offset
array_pos

Member Function Documentation

◆ getArrayPos()

OptionalSize getArrayPos ( ) const

Get the Array Pos, if this element was retrieved via StructTypeAccess::getElementByPath and the operator[].

Returns
valid OptionalSize if it was a array position
invalid OptionalSize if it was not a array position or the array position was not valid.

◆ getDataType()

std::shared_ptr<const datamodel::DataType> getDataType ( ) const

Gets the Data Type if the element is dependent on a datatype.

Returns
std::shared_ptr<const datamodel::DataType> with a valid datatype if type of element is a datatype
std::shared_ptr<const datamodel::DataType>() (empty) if element does not depend on a datatype

◆ getDeserializedBytePos()

size_t getDeserializedBytePos ( size_t  array_size = 0) const

Get the Deserialized Byte Pos relative to the first byte position of the struct obtained by dd::DataDefinition::getStructTypeAccess.

Returns
valid OptionalSize with a byte position
invalid OptionalSize if is after a dynamic content.

◆ getDeserializedByteSize()

size_t getDeserializedByteSize ( ) const

Get the Byte size (depends on alignments, ddlversion and arraysize)

Returns
valid OptionalSize with a size position
invalid OptionalSize if it is a dynamic content.

◆ getDeserializedTypeByteSize()

size_t getDeserializedTypeByteSize ( ) const

Get the Serialized Type Byte size.

Returns
valid OptionalSize with a size position
invalid OptionalSize if it has a dynamic

◆ getElement()

const datamodel::StructType::Element& getElement ( ) const

Get the Element Information which is also part of the data definition.

Returns
const datamodel::StructType::Element&

◆ getEnumType()

std::shared_ptr<const datamodel::EnumType> getEnumType ( ) const

Gets the Enum Type if the element is dependent on a enumtype.

Returns
std::shared_ptr<const datamodel::EnumType> with a valid enumtype if type of element is a enumtype
std::shared_ptr<const datamodel::EnumType>() (empty) if element does not depend on a enumtype

◆ getSerializedBitOffset()

size_t getSerializedBitOffset ( size_t  array_size = 0) const

Get SerializedBitOsset obtained by dd::DataDefinition::getStructTypeAccess.

Returns
valid OptionalSize with a byte position
invalid OptionalSize if is after a dynamic content.

◆ getSerializedBitSize()

size_t getSerializedBitSize ( ) const

Get the serialized Bit size of the value.

Returns
valid OptionalSize with a size position
invalid OptionalSize if it is a dynamic content.

◆ getSerializedBytePos()

size_t getSerializedBytePos ( size_t  array_size = 0) const

Get SerializedBytePos obtained by dd::DataDefinition::getStructTypeAccess.

Returns
valid OptionalSize with a byte position
invalid OptionalSize if is after a dynamic content.

◆ getSerializedTypeBitSize()

size_t getSerializedTypeBitSize ( ) const

Get the serialized bit size of one element.

Returns
valid OptionalSize with a size position
invalid OptionalSize if it is a dynamic content.

◆ getStructType()

std::shared_ptr<const datamodel::StructType> getStructType ( ) const

Gets the Struct Type if the element is dependent on a structtype.

Returns
std::shared_ptr<const datamodel::StructType> with a valid structtype if type of element is a structtype
std::shared_ptr<const datamodel::StructType>() (empty) if element does not depend on a structtype

◆ getStructTypeAccess()

StructTypeAccess getStructTypeAccess ( size_t  array_pos = 0) const

Get the Struct Type Access if the element depends on a structtype.

All byte positions within the returned StructTypeAccess are relativ to the elements StructTypeAccess parent.

Returns
StructTypeAccess of the struct can also retrieved by getStructType.
See also
getStructType

◆ getTypeOfType()

TypeOfType getTypeOfType ( ) const

Get the Type Of the type.

Retrieves the infomation of the elements type.

Return values
TypeOfType

◆ isAfterDynamic()

bool isAfterDynamic ( ) const

The element is on a byte position after a dynamic element, the byte position can not be calculated until it is instanciated.

Return values
truethe element is after a dynamic content.
falsethe element is not after dynamic content
See also
isDynamic

◆ isDynamic()

bool isDynamic ( ) const

Retieve information if this element is a dynamic array.

Return values
truethe element is dynamic or it contains dynamic content.
falsethe element is not dynamic.

◆ operator bool()

operator bool ( ) const

Retrieve if the StructElementAccess is valid or not!

Return values
trueis valid
falseis not valid

◆ operator=() [1/2]

StructElementAccess& operator= ( const StructElementAccess )
default

Default copy assignment.

Returns
StructElementAccess& reference

◆ operator=() [2/2]

StructElementAccess& operator= ( StructElementAccess &&  )
default

Default move assignment.

Returns
StructElementAccess& reference