15#ifndef DD_DDL_STRUCT_ACCESS_H_INCLUDED
16#define DD_DDL_STRUCT_ACCESS_H_INCLUDED
43 friend class StructTypeAccess;
44 friend class StructElementAccessIterator;
45 friend class StructArrayElementAccessIterator;
92 operator
bool() const;
351 const ElementTypeInfo* _element_type_info =
nullptr;
364class StructArrayElementAccessIterator {
366 StructArrayElementAccessIterator() =
delete;
374 StructArrayElementAccessIterator&
operator=(
const StructArrayElementAccessIterator&);
382 StructArrayElementAccessIterator& operator=(StructArrayElementAccessIterator&&) noexcept;
386 ~StructArrayElementAccessIterator();
462 friend class StructElementAccess;
463 StructArrayElementAccessIterator(const StructElementAccess* parent,
464 StructElementAccess array_element);
465 const StructElementAccess* _parent;
466 StructElementAccess _current_array_element;
474class StructElementAccessIterator {
476 StructElementAccessIterator() =
delete;
484 StructElementAccessIterator&
operator=(
const StructElementAccessIterator&);
492 StructElementAccessIterator& operator=(StructElementAccessIterator&&) noexcept;
496 ~StructElementAccessIterator();
573 friend StructTypeAccess;
600 friend class DataDefinition;
601 friend class StructElementAccess;
602 friend class ElementTypeInfo;
684 operator
bool() const;
761 const TypeInfo* _type_info =
nullptr;
812 [](
auto&,
auto&) {
return true; },
815 [](
auto&,
auto&) {
return true; },
817 bool filter_padding_elements =
true);
847 std::string_view path,
Definition dd_struct_access.h:364
int difference_type
difference value type definition
Definition dd_struct_access.h:414
const StructElementAccess * const_pointer
pointer to const data value type definition
Definition dd_struct_access.h:410
const StructElementAccess & const_reference
const reference value type definition
Definition dd_struct_access.h:402
StructElementAccess & reference
reference value type definition
Definition dd_struct_access.h:398
std::forward_iterator_tag iterator_category
iterator type definition
Definition dd_struct_access.h:418
StructArrayElementAccessIterator(const StructArrayElementAccessIterator &)
Copy CTOR.
StructArrayElementAccessIterator & operator=(const StructArrayElementAccessIterator &)
Copy Assignment Operator.
StructArrayElementAccessIterator(StructArrayElementAccessIterator &&) noexcept
Move CTOR.
StructArrayElementAccessIterator self_type
this iterator type definition
Definition dd_struct_access.h:390
StructElementAccess value_type
iterator value type definition
Definition dd_struct_access.h:394
StructElementAccess * pointer
pointer value type definition
Definition dd_struct_access.h:406
Iterator to iterate thru the StructTypeAccess.
Definition dd_struct_access.h:474
const StructElementAccess & const_reference
const reference value type definition
Definition dd_struct_access.h:512
int difference_type
difference value type definition
Definition dd_struct_access.h:524
StructElementAccessIterator & operator=(const StructElementAccessIterator &)
Copy Assignment Operator.
const StructElementAccess * const_pointer
pointer to const data value type definition
Definition dd_struct_access.h:520
StructElementAccessIterator(const StructElementAccessIterator &)
Copy CTOR.
StructElementAccess & reference
reference value type definition
Definition dd_struct_access.h:508
StructElementAccess value_type
iterator value type definition
Definition dd_struct_access.h:504
StructElementAccess * pointer
pointer value type definition
Definition dd_struct_access.h:516
StructElementAccessIterator self_type
this iterator type definition
Definition dd_struct_access.h:500
std::forward_iterator_tag iterator_category
iterator type definition
Definition dd_struct_access.h:528
StructElementAccessIterator(StructElementAccessIterator &&) noexcept
Move CTOR.
Class to access and obtain the byte position and other information of a instance of this element with...
Definition dd_struct_access.h:41
bool isStruct() const
Determines if the element is an struct type.
size_t getSerializedBitOffset(size_t array_pos=0) const
Get SerializedBitOffset.
const_iterator begin() const
Get the begin const iterator to the array elements of this element access.
size_t getSerializedBitSize() const
Get the serialized Bit size of the value.
TypeOfType getTypeOfType() const
Get the Type Of the type. Retrieves the information of the elements type.
const datamodel::StructType::Element & getElement() const
Get the Element Information which is also part of the data definition.
StructElementAccess getArrayElement(size_t array_pos=0) const
Retrieves an element with byte and bit offsets for the given array position.
bool isDynamic() const
Retieve information if this element is a dynamic array.
const std::string & getValidElementCount() const
StructElementAccess()=delete
deleted CTOR
bool isArray() const
Determines if the element is an array type.
const_iterator end() const
Get the end const iterator to the array elements of this element access.
StructElementAccess(StructElementAccess &&) noexcept
Default move CTOR.
size_t getDeserializedBytePos(size_t array_pos=0) const
Get the Deserialized Byte Pos relative to the first byte position of the struct obtained by dd::DataD...
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 retu...
size_t getSerializedBytePos(size_t array_pos=0) const
Get SerializedBytePos obtained by dd::DataDefinition::getStructTypeAccess.
bool isLeaf() const
Determines if the element is a leaf type (no struct, no array).
std::string getName() const
size_t getDeserializedByteSize() const
Get the Byte size (depends on alignments, ddlversion and arraysize)
bool hasValidElementCount() const
const_iterator cend() const
Get the end const iterator to the array elements of this element access.
size_t getSerializedTypeBitSize() const
Get the serialized bit size of one element.
OptionalSize getArrayPos() const
Get the Array Pos, if this element was retrieved via StructTypeAccess::getElementByPath and the opera...
size_t getDeserializedTypeAlignedByteSize() const
Get the Serialized Type Byte size aligned.
std::shared_ptr< const datamodel::EnumType > getEnumType() const
Gets the Enum Type if the element is dependent on a enumtype.
std::shared_ptr< const datamodel::StructType > getStructType() const
Gets the Struct Type if the element is dependent on a structtype.
bool isAfterDynamic() const
The element is on a byte position after a dynamic element, the byte position can not be calculated un...
size_t getArraySize() const
Retrieves the array size if the element is an static array type.
StructArrayElementAccessIterator const_iterator
this is the const iterator type definition for the array elements of this element access.
Definition dd_struct_access.h:299
size_t getDeserializedTypeByteSize() const
Get the Serialized Type Byte size.
const_iterator cbegin() const
Get the begin const iterator to the array elements of this element access.
std::shared_ptr< const datamodel::DataType > getDataType() const
Gets the Data Type if the element is dependent on a datatype.
Accessing class for a instance of a struct. This will calculate the byte positions can be used for se...
Definition dd_struct_access.h:598
const_iterator end() const
constant range based end iterator
StructElementAccess getElementByPath(std::string_view name_path) const
Get the StructElementAccess information class by path. Separator is "." or "/" Following element ac...
const_iterator cend() const
constant end iterator
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 + size...
const_iterator begin() const
constant range based iterator access
StructTypeAccess()=delete
default CTOR is deleted
bool isDynamic() const
retrieves information if it contains dynamic elements and so has dynamic size.
const_iterator cbegin() const
constant iterator access
const datamodel::StructType & getStructType() const
Get the Struct Type it refers to (for data definition information)
const StructElementAccessIterator const_iterator
iterator type of this struct
Definition dd_struct_access.h:727
StructTypeAccess(StructTypeAccess &&) noexcept
Move CTOR.
size_t getStaticSerializedBitSize() const
Get the known bitsize of this instance (this is usually the last position + sizeof last element)
definition of the datamodel namespace
Definition datamodel_base.h:28
definition of the dd namespace
Definition datamodel_base.h:26
datamodel::DataType DataType
Definition dd.h:51
datamodel::EnumType EnumType
Definition dd.h:55
std::function< void(const StructElementAccess &, const StructTypeAccess &)> CallbackStructElementAccess
Callback function type definitions for struct element access traversal.
Definition dd_struct_access.h:768
datamodel::StructType StructType
Definition dd.h:59
utility::Optional< size_t > OptionalSize
Optional Size Type.
Definition dd_common_types.h:38
TypeOfType
Classification of a Type.
Definition dd_common_types.h:44
@ struct_type
the type is a struct type (StructType)
Definition dd_common_types.h:64
void forEachElementInfix(const StructTypeAccess &parent, const CallbackStructElementAccess &access_leaf_callback, const CallbackStructElementAccessControl &enter_element_member_callback=[](auto &, auto &) { return true;}, const CallbackStructElementAccess &leave_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccessControl &enter_array_element_member_callback=[](auto &, auto &) { return true;}, const CallbackStructElementAccess &leave_array_element_member_callback=[](auto &, auto &) {}, bool filter_padding_elements=true)
Traverse all elements of a struct type access in infix order and calls the callbacks.
void forEachElementInPathInfix(const StructTypeAccess &parent, std::string_view path, const CallbackStructElementAccess &target_element_callback, const CallbackStructElementAccess &enter_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &leave_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &enter_array_element_member_callback=[](auto &, auto &) {}, const CallbackStructElementAccess &leave_array_element_member_callback=[](auto &, auto &) {})
Traverse all elements along a given path in struct type access in infix order and calls the callbacks...
@ element_type_info
Element Type Info.
Definition dd_infomodel_type.h:44
std::function< bool(const StructElementAccess &, const StructTypeAccess &)> CallbackStructElementAccessControl
Callback function type definitions for struct element access traversal. The return value indicates if...
Definition dd_struct_access.h:776
definition of the ddl namespace
Definition codec.h:21