ADTF  3.18.2
StructTypeAccess

Accessing class for a instance of a struct. More...

Public Types

typedef const StructElementAccessIterator const_iterator
 iterator type of this struct
 

Public Member Functions

 StructTypeAccess ()=delete
 default CTOR is deleted
 
 StructTypeAccess (StructTypeAccess &&)=default
 Move CTOR.
 
StructTypeAccessoperator= (StructTypeAccess &&)=default
 Move assignment operator. More...
 
 StructTypeAccess (const StructTypeAccess &)=default
 copy assignment operator
 
StructTypeAccessoperator= (const StructTypeAccess &)=default
 Copy CTOR.
 
 StructTypeAccess (const std::shared_ptr< const datamodel::StructType > &struct_type)
 Construct a new Struct Type Access object. More...
 
 StructTypeAccess (std::nullptr_t)
 Construct a empty Struct Type Access.
 
StructElementAccess getElementByPath (const std::string name_path) const
 Get the StructElementAccess information class by path. More...
 
 operator bool () const
 The Struct access is a valid access type. More...
 
size_t getStaticStructSize () const
 Get the known Static Struct Size of this instance. More...
 
size_t getStaticUnalignedStructSize () const
 Get the known unaligned Static Struct Size of this instance (this is usually the last position + sizeof last element) More...
 
size_t getStaticSerializedBitSize () const
 Get the known bitsize of this instance (this is usually the last position + sizeof last element) More...
 
bool isDynamic () const
 retrieves information if it contains dynamic elements and so has dynamic size. More...
 
const datamodel::StructTypegetStructType () const
 Get the Struct Type it refers to (for data definition information) More...
 
const_iterator cbegin () const
 constant iterator access More...
 
const_iterator begin () const
 constant range based iterator access More...
 
const_iterator cend () const
 constant end iterator More...
 
const_iterator end () const
 constant range based end iterator More...
 

Private Member Functions

 StructTypeAccess (const std::shared_ptr< const datamodel::StructType > &struct_type, OptionalSize serialized_struct_offset, OptionalSize deserialized_struct_offset)
 Construct a new Struct Type Access object. More...
 

Private Attributes

std::shared_ptr< const datamodel::StructType_struct_type
 
OptionalSize _serialized_struct_as_element_offset
 
OptionalSize _deserialized_struct_as_element_offset
 
const TypeInfo_type_info = nullptr
 

Detailed Description

Accessing class for a instance of a struct.

This will calculate the byte positions can be used for serialialization and deserialization.

Definition at line 336 of file dd_struct_access.h.

Constructor & Destructor Documentation

◆ StructTypeAccess() [1/2]

StructTypeAccess ( const std::shared_ptr< const datamodel::StructType > &  struct_type)

Construct a new Struct Type Access object.

Parameters
struct_typethe struct type it refers to.
Remarks
This is for optimizing recalculations of sizes and access and will only work well if the TypeInfo is set to the struct_types infomodel.

◆ StructTypeAccess() [2/2]

StructTypeAccess ( const std::shared_ptr< const datamodel::StructType > &  struct_type,
OptionalSize  serialized_struct_offset,
OptionalSize  deserialized_struct_offset 
)
private

Construct a new Struct Type Access object.

Parameters
struct_typethe struct type it refers to.
serialized_struct_offsetthe offset of this instance within another struct
deserialized_struct_offsetthe offset of this instance within another struct

Member Function Documentation

◆ begin()

const_iterator begin ( ) const

constant range based iterator access

Returns
const_iterator

◆ cbegin()

const_iterator cbegin ( ) const

constant iterator access

Returns
const_iterator

◆ cend()

const_iterator cend ( ) const

constant end iterator

Returns
const_iterator

◆ end()

const_iterator end ( ) const

constant range based end iterator

Returns
const_iterator

◆ getElementByPath()

StructElementAccess getElementByPath ( const std::string  name_path) const

Get the StructElementAccess information class by path.

Separator is "." or "/"
Following element access paths are possible:

  • "element_1" -> access to a element with the name "element_1"
  • "element_1.sub_2" -> access to a element with the name "element_1" which is a structtype that has a element with the name "sub_2"
  • "element_1/sub_2" -> same as before
  • "element_2[3]" -> access to a element with the name "element_2" which is a array element with an possible array pos [3]
  • "element_2[3].sub_2[24]" -> access to a element with the name "element_2" which is a array element with an possible array pos [3], this array pos contains a structtype with an element named sub_2 that is an array with an valid position [24]
  • "element_2[3]/sub_2[24]" -> same as before
    Following element access paths are NOT possible:
  • "element_1.sub_2/subsub_3" -> invalid. No mixture of separator possible!
  • "element_2[24]" -> invalid, if the element_2 is no array or arraysize is below 24!
Parameters
name_pathThe path to the element.
Returns
StructElementAccess

◆ getStaticSerializedBitSize()

size_t getStaticSerializedBitSize ( ) const

Get the known bitsize of this instance (this is usually the last position + sizeof last element)

Returns
size_t serialized bitsize of the instance (without dynamic content)

◆ getStaticStructSize()

size_t getStaticStructSize ( ) const

Get the known Static Struct Size of this instance.

Returns
size_t size of the instance (without dynamic content)

Referenced by structure< T >::GetSize().

◆ getStaticUnalignedStructSize()

size_t getStaticUnalignedStructSize ( ) const

Get the known unaligned Static Struct Size of this instance (this is usually the last position + sizeof last element)

Returns
size_t size of the instance (without dynamic content)

◆ getStructType()

const datamodel::StructType& getStructType ( ) const

Get the Struct Type it refers to (for data definition information)

Returns
const dd::datamodel::StructType&

◆ isDynamic()

bool isDynamic ( ) const

retrieves information if it contains dynamic elements and so has dynamic size.

Return values
truehas dynamic elements
falsehas no dynamic elements

◆ operator bool()

operator bool ( ) const

The Struct access is a valid access type.

Returns
true the access is valid.
false the access is not valid.

◆ operator=()

StructTypeAccess& operator= ( StructTypeAccess &&  )
default

Move assignment operator.

Returns
StructTypeAccess&

Member Data Documentation

◆ _deserialized_struct_as_element_offset

OptionalSize _deserialized_struct_as_element_offset
private
Initial value:
=
{}

Definition at line 488 of file dd_struct_access.h.

◆ _serialized_struct_as_element_offset

OptionalSize _serialized_struct_as_element_offset
private
Initial value:
=
{}

Definition at line 485 of file dd_struct_access.h.