ADTF
Loading...
Searching...
No Matches
ddl::dd::StructTypeAccess Class Reference

Accessing class for a instance of a struct. This will calculate the byte positions can be used for serialialization and deserialization. More...

#include <dd_struct_access.h>

Public Types

typedef const StructElementAccessIterator const_iterator
 iterator type of this struct
 

Public Member Functions

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

Friends

class DataDefinition
 
class StructElementAccess
 
class ElementTypeInfo
 

Detailed Description

Accessing class for a instance of a struct. This will calculate the byte positions can be used for serialialization and deserialization.

Constructor & Destructor Documentation

◆ StructTypeAccess()

ddl::dd::StructTypeAccess::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.

Member Function Documentation

◆ begin()

const_iterator ddl::dd::StructTypeAccess::begin ( ) const

constant range based iterator access

Returns
const_iterator

◆ cbegin()

const_iterator ddl::dd::StructTypeAccess::cbegin ( ) const

constant iterator access

Returns
const_iterator

◆ cend()

const_iterator ddl::dd::StructTypeAccess::cend ( ) const

constant end iterator

Returns
const_iterator

◆ end()

const_iterator ddl::dd::StructTypeAccess::end ( ) const

constant range based end iterator

Returns
const_iterator

◆ getElementByPath()

StructElementAccess ddl::dd::StructTypeAccess::getElementByPath ( std::string_view 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 ddl::dd::StructTypeAccess::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 ddl::dd::StructTypeAccess::getStaticStructSize ( ) const

Get the known Static Struct Size of this instance.

Returns
size_t size of the instance (without dynamic content)

◆ getStaticUnalignedStructSize()

size_t ddl::dd::StructTypeAccess::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 & ddl::dd::StructTypeAccess::getStructType ( ) const

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

Returns
const dd::datamodel::StructType&

◆ isDynamic()

bool ddl::dd::StructTypeAccess::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()

ddl::dd::StructTypeAccess::operator bool ( ) const

The Struct access is a valid access type.

Remarks
Any call except DTOR or move assigned on an invalid StructTypeAccess is undefined behavior!
Returns
true the access is valid.
false the access is not valid.

◆ operator=()

StructTypeAccess & ddl::dd::StructTypeAccess::operator= ( StructTypeAccess && )
noexcept

Move assignment operator.

Returns
StructTypeAccess&

The documentation for this class was generated from the following file: