ADTF
Loading...
Searching...
No Matches
ddl::codec::CodecElementAccess< AccessType > Class Template Reference

A element access type concept template to retrieve element information from the AccessType, get and set the element value. This class is to retrieve common information of the element, get and set the element value content. More...

#include <codec_iterator.h>

Inherits ddl::codec::DecoderElementAccess< AccessType >.

Public Types

using access_type = AccessType
 access type
 
using self_type = CodecElementAccess<AccessType>
 
using element_type = CodecElement<self_type, ChildElements<self_type>>
 supported element type
 
- Public Types inherited from ddl::codec::DecoderElementAccess< AccessType >
using access_type = AccessType
 access type in use
 
using self_type = DecoderElementAccess<AccessType>
 
using element_type = DecoderElement<self_type, ChildElements<self_type>>
 supported element type
 
- Public Types inherited from ddl::codec::FactoryElementAccess< AccessType >
using access_type = AccessType
 The access type (CodecFactory, Codec, Decoder, etc.)
 
using self_type = FactoryElementAccess<AccessType>
 self type
 
using element_type = FactoryElement<self_type, ChildElements<self_type>>
 element type
 

Static Public Member Functions

static element_type getElement (access_type &access, std::string_view full_path)
 Get a element object for the given full_path.
 
static element_type getElement (access_type &access, const CodecIndex &index)
 Get a element object for the given index.
 
template<typename T>
static void setValue (access_type &access, const CodecIndex &index, const T &value)
 Sets the value from value of type T.
 
static void setVariantValue (access_type &access, const CodecIndex &index, const a_util::variant::Variant &value)
 Sets the value from value as variant.
 
static void setStringValue (access_type &access, const CodecIndex &index, const std::string &value)
 Sets the value from value as string.
 
static void setRawValue (access_type &access, const CodecIndex &index, const void *value, size_t value_size)
 Set the value by copying from a value buffer.
 
static void * getAddress (access_type &access, const CodecIndex &index)
 Get the address (with write access)
 
- Static Public Member Functions inherited from ddl::codec::DecoderElementAccess< AccessType >
static element_type getElement (access_type &access, std::string_view full_path)
 Get a element object for the given full_element_name.
 
static element_type getElement (access_type &access, const CodecIndex &index)
 Get a element object for the given index.
 
static element_type getChildElement (access_type &access, const CodecIndex &parent_index, std::string_view relative_path)
 Get a child element object for the given element_name.
 
template<typename T>
static T getValue (access_type &access, const CodecIndex &index)
 Get the value as type T.
 
static a_util::variant::Variant getVariantValue (access_type &access, const CodecIndex &index)
 Get the value as variant.
 
static std::string getStringValue (access_type &access, const CodecIndex &index)
 Get the value as type string.
 
static void getRawValue (access_type &access, const CodecIndex &index, void *value, size_t value_size)
 Get the value by copy to the given value buffer.
 
static const void * getAddress (access_type &access, const CodecIndex &index)
 Get the address of the element.
 
- Static Public Member Functions inherited from ddl::codec::FactoryElementAccess< AccessType >
static element_type getElement (access_type &access, std::string_view full_path)
 Get a element object for the given full_element_name.
 
static element_type getElement (access_type &access, const CodecIndex &index)
 Get a element object for the given index.
 
static element_type getChildElement (access_type &access, const CodecIndex &parent_index, std::string_view relative_path)
 Get a child element object for the given element_name.
 
static size_t getChildCount (access_type &access, const CodecIndex &index)
 Get the Child Count.
 
static std::string getFullName (access_type &access, const CodecIndex &index)
 Get the full name of the element within its main structure. If the element is an array you get the elements array name representation: "main_element.element_name[0]" or main_element.element_name[1] ... etc. If the element is not an array you get the elements name representation: "main_element.element_name".
 
static std::string getName (access_type &access, const CodecIndex &index)
 Get the name of the element within its level structure. If the element is an array you get the elements array name representation: "element_name[0]" or element_name[1] ... etc. If the element is not an array you get the elements name representation: "element_name".
 
static std::string getBaseName (access_type &access, const CodecIndex &index)
 Get the name of the element within its level structure. If the element is an array you get the elements base name representation : "element_name" for each array element. If the element is not an array you get the elements name representation is also the base name representation: "element_name".
 
static void resolve (access_type &access, CodecIndex &index)
 Resolves the given CodecIndex and set the layout information.
 

Detailed Description

template<typename AccessType>
class ddl::codec::CodecElementAccess< AccessType >

A element access type concept template to retrieve element information from the AccessType, get and set the element value. This class is to retrieve common information of the element, get and set the element value content.

See also
CodecElement.
Template Parameters
AccessTypeThe AccessType for the element (Codec, StaticCodec, etc. )

Member Typedef Documentation

◆ self_type

template<typename AccessType>
using ddl::codec::CodecElementAccess< AccessType >::self_type = CodecElementAccess<AccessType>

self type

Member Function Documentation

◆ getAddress()

template<typename AccessType>
static void * ddl::codec::CodecElementAccess< AccessType >::getAddress ( access_type & access,
const CodecIndex & index )
inlinestatic

Get the address (with write access)

Parameters
accessdefined access type.
indexThe codec index.
Returns
void*

◆ getElement() [1/2]

template<typename AccessType>
static element_type ddl::codec::CodecElementAccess< AccessType >::getElement ( access_type & access,
const CodecIndex & index )
inlinestatic

Get a element object for the given index.

Parameters
accessdefined access type.
indexThe codec index.
Returns
element_type

◆ getElement() [2/2]

template<typename AccessType>
static element_type ddl::codec::CodecElementAccess< AccessType >::getElement ( access_type & access,
std::string_view full_path )
inlinestatic

Get a element object for the given full_path.

Parameters
accessdefined access type.
full_pathThe full name of the element in point notation (i.e. "element1.child_element[4].element_value").
Returns
element_type

◆ setRawValue()

template<typename AccessType>
static void ddl::codec::CodecElementAccess< AccessType >::setRawValue ( access_type & access,
const CodecIndex & index,
const void * value,
size_t value_size )
inlinestatic

Set the value by copying from a value buffer.

Parameters
accessdefined access type.
indexThe codec index.
valueThe value buffer
value_sizethe size of the value buffer in bytes.
See also
StaticCodec::setElementRawValue

◆ setStringValue()

template<typename AccessType>
static void ddl::codec::CodecElementAccess< AccessType >::setStringValue ( access_type & access,
const CodecIndex & index,
const std::string & value )
inlinestatic

Sets the value from value as string.

Parameters
[in]accessThe access type
[in]indexThe codec index of the value
[in]valueThe value to set as string. string will be converted to the elements type.
See also
StaticCodec::setElementStringValue

◆ setValue()

template<typename AccessType>
template<typename T>
static void ddl::codec::CodecElementAccess< AccessType >::setValue ( access_type & access,
const CodecIndex & index,
const T & value )
inlinestatic

Sets the value from value of type T.

Template Parameters
TType of the value
Parameters
[in]accessThe access type
[in]indexThe codec index of the value
[in]valueThe value in type T
Remarks
for T = std::string the value can be set as valid element name in case of enum type otherwise the string is converted
See also
StaticCodec::setElementValue

◆ setVariantValue()

template<typename AccessType>
static void ddl::codec::CodecElementAccess< AccessType >::setVariantValue ( access_type & access,
const CodecIndex & index,
const a_util::variant::Variant & value )
inlinestatic

Sets the value from value as variant.

Parameters
[in]accessThe access type
[in]indexThe codec index of the value
[in]valueThe value to set as variant
See also
StaticCodec::setElementVariantValue

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