ADTF
CodecElement< ElementAccessType, ChildElementsType >

A CodecElement to get and set values. More...

Inheritance diagram for CodecElement< ElementAccessType, ChildElementsType >:
[legend]

Public Types

using factory_base_type = FactoryElement< ElementAccessType, ChildElementsType >
 factory base type
 
using base_type = DecoderElement< ElementAccessType, ChildElementsType >
 base type
 
using self_type = CodecElement< ElementAccessType, ChildElementsType >
 self type
 
using access_type = typename ElementAccessType::access_type
 access type from the concept
 
using child_elements_type = typename factory_base_type::child_elements_type
 allowed container type
 
using iterator_type = typename child_elements_type::iterator
 allowed iterator type
 
using const_iterator_type = typename child_elements_type::const_iterator
 allowed const iterator type
 
- Public Types inherited from DecoderElement< ElementAccessType, ChildElements< ElementAccessType > >
using base_type = FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >
 base type
 
using self_type = DecoderElement< ElementAccessType, ChildElements< ElementAccessType > >
 self type
 
using access_type = typename ElementAccessType::access_type
 access type from concept template
 
using child_elements_type = typename base_type::child_elements_type
 allowed container type
 
using iterator_type = typename child_elements_type::iterator
 allowed iterator type
 
using const_iterator_type = typename child_elements_type::const_iterator
 allowed const iterator type
 
- Public Types inherited from FactoryElement< ElementAccessType, ChildElementsType >
using self_type = FactoryElement< ElementAccessType, ChildElementsType >
 self type
 
using access_type = typename ElementAccessType::access_type
 access type
 
using child_elements_type = ChildElementsType
 allowed container type
 
using iterator_type = typename child_elements_type::iterator
 allowed iterator type
 
using const_iterator_type = typename child_elements_type::const_iterator
 allowed const iterator type
 

Public Member Functions

 CodecElement ()=delete
 CTOR.
 
template<typename T >
void setValue (const T &value)
 Sets the value from value of type T. More...
 
void setVariantValue (const a_util::variant::Variant &value)
 Sets the value from value as variant. More...
 
void setStringValue (const std::string &value)
 Sets the value from value as string. More...
 
void setRawValue (const void *value, size_t value_size)
 Set the value by copying from a value buffer. More...
 
void reset (bool zero_value_of_known_type=false)
 Reset the elements value to their default values, constant values defined in the data definition or zero if zero_value is set. More...
 
void * getAddress ()
 Get the address (with writing access) More...
 
child_elements_typegetChildElements ()
 Gets an reference to the child elements. More...
 
self_type getChildElement (const std::string &name) const
 Get a dedicated ChildElement by name. More...
 
self_type getChildElement (const std::string &name)
 Get a dedicated ChildElement by name. More...
 
self_type getArrayElement (size_t array_pos=0) const
 Get the array element of the given array_pos. More...
 
self_type getArrayElement (size_t array_pos=0)
 Get the array element of the given array_pos. More...
 
const void * getAddress () const
 Get the address of the element. More...
 
const child_elements_typegetChildElements () const
 Get the ChildElements. More...
 
- Public Member Functions inherited from DecoderElement< ElementAccessType, ChildElements< ElementAccessType > >
 DecoderElement ()=delete
 CTOR.
 
getValue () const
 Get the value as type T. More...
 
a_util::variant::Variant getVariantValue () const
 Get the value as variant. More...
 
std::string getStringValue () const
 Get the value as string. More...
 
void getRawValue (void *value, size_t value_size) const
 Get the as copy to the value buffer. More...
 
const void * getAddress () const
 Get the address of the element. More...
 
self_type getChildElement (const std::string &name) const
 Get the child element with the given name. More...
 
self_type getArrayElement (size_t array_pos=0) const
 Get the array element of the given array_pos. More...
 
- Public Member Functions inherited from FactoryElement< ElementAccessType, ChildElementsType >
 FactoryElement ()=delete
 no CTOR
 
 FactoryElement (FactoryElement &&other)
 move CTOR More...
 
FactoryElementoperator= (FactoryElement &&other)
 copy assignment operator More...
 
 FactoryElement (const FactoryElement &other)
 copy CTOR More...
 
FactoryElementoperator= (const FactoryElement &other)
 move assignment operator More...
 
 ~FactoryElement ()=default
 DTOR.
 
const CodecIndexgetIndex () const
 Get the codec index of the element. More...
 
size_t getArraySize () const
 Get the array size. More...
 
ddl::codec::ElementType getType () const
 Get the type of the element. More...
 
std::string getFullName () const
 Get the full name of the element. More...
 
std::string getName () const
 Get the name of the element If the element is an array you get the elements array name representation: "element_name[0]" or element_name[1] ... More...
 
std::string getBaseName () const
 Get the base name of the element. More...
 
bool isArray () const
 Get array information. More...
 
bool hasChildren () const
 Get children information. More...
 
const child_elements_typegetChildElements () const
 Get the ChildElements. More...
 
self_type getChildElement (const std::string &name) const
 Get the child element with the given name. More...
 
self_type getArrayElement (size_t array_pos=0) const
 Get the array element of the given array_pos. More...
 
bool isValid () const
 Get validation indormation. More...
 

Public Attributes

friend child_elements_type
 friend declaration for child_elements_type
 
friend iterator_type
 friend declaration for iterator_type
 
friend const_iterator_type
 friend declaration for const_iterator_type
 
friend access_type
 friend declaration for access_type
 
friend base_type
 friend declaration for base_type
 
friend factory_base_type
 friend declaration for factory_base_type
 
- Public Attributes inherited from DecoderElement< ElementAccessType, ChildElements< ElementAccessType > >
friend base_type
 friend declaration for base_type
 
friend access_type
 friend declaration for access_type
 
friend child_elements_type
 friend declaration for child_elements_type
 
friend iterator_type
 friend declaration for iterator_type
 
friend const_iterator_type
 friend declaration for const_iterator_type
 
friend CodecElement< ElementAccessType, ChildElementsType >
 friend declaration for CodecElement
 
- Public Attributes inherited from FactoryElement< ElementAccessType, ChildElementsType >
friend child_elements_type
 friend declaration for child_elements_type
 
friend iterator_type
 friend declaration for iterator_type
 
friend const_iterator_type
 friend declaration for child_elements_type
 
friend access_type
 friend declaration for access_type
 
friend DecoderElement< ElementAccessType, ChildElementsType >
 friend declaration for DecoderElement
 
friend CodecElement< ElementAccessType, ChildElementsType >
 friend declaration for CodecElement
 

Private Member Functions

 CodecElement (CodecIndex &&index, size_t end_element_index, size_t child_elements_count, access_type &access)
 
 CodecElement (CodecIndex &&index, size_t end_element_index, access_type &access)
 
 CodecElement (const std::string &element_name, access_type &access)
 
 CodecElement (CodecIndex &&index, access_type &access)
 
 CodecElement (access_type &access)
 
void next ()
 

Detailed Description

template<typename ElementAccessType, typename ChildElementsType = ChildElements<ElementAccessType>>
class ddl::codec::CodecElement< ElementAccessType, ChildElementsType >

A CodecElement to get and set values.

Template Parameters
ElementAccessTypeThe element access concept type. (see concept templates CodecElementAccess)

Definition at line 1191 of file codec_iterator.h.

Member Function Documentation

◆ getAddress() [1/2]

void* getAddress ( )
inline

Get the address (with writing access)

Returns
void*

Definition at line 1319 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ getAddress() [2/2]

const void* getAddress
inline

Get the address of the element.

Returns
const void*

Definition at line 1022 of file codec_iterator.h.

◆ getArrayElement() [1/2]

self_type getArrayElement ( size_t  array_pos = 0)
inline

Get the array element of the given array_pos.

Parameters
array_posThe array pos of the element to retrieve
Returns
self_type

Definition at line 1377 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ getArrayElement() [2/2]

self_type getArrayElement ( size_t  array_pos = 0) const
inline

Get the array element of the given array_pos.

Parameters
array_posThe array pos of the element to retrieve
Returns
self_type

Definition at line 1366 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ getChildElement() [1/2]

self_type getChildElement ( const std::string &  name)
inline

Get a dedicated ChildElement by name.

Parameters
nameThe name if point notation.
Returns
self_type
Exceptions
std::runtime_errorif name is not valid or not found

Definition at line 1354 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getFullName().

◆ getChildElement() [2/2]

self_type getChildElement ( const std::string &  name) const
inline

Get a dedicated ChildElement by name.

Parameters
nameThe name if point notation.
Returns
self_type
Exceptions
std::runtime_errorif name is not valid or not found

Definition at line 1340 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getFullName().

◆ getChildElements() [1/2]

child_elements_type& getChildElements ( )
inline

Gets an reference to the child elements.

Returns
child_elements_type&

Definition at line 1330 of file codec_iterator.h.

◆ getChildElements() [2/2]

const child_elements_type& getChildElements
inline

Get the ChildElements.

Returns
child_elements_type
Exceptions
std::runtime_errorif index is invalid

Definition at line 710 of file codec_iterator.h.

◆ reset()

void reset ( bool  zero_value_of_known_type = false)
inline

Reset the elements value to their default values, constant values defined in the data definition or zero if zero_value is set.

Parameters
[in]zero_value_of_known_typeset the value to 0 if no constant or default value set in data definition.

Definition at line 1284 of file codec_iterator.h.

References ddl::codec::cet_empty, ddl::codec::cet_sub_codec, ddl::codec::cet_user_type, FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex(), CodecIndex::getLayout(), and FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getType().

◆ setRawValue()

void setRawValue ( const void *  value,
size_t  value_size 
)
inline

Set the value by copying from a value buffer.

Parameters
[in]valueThe value buffer
[in]value_sizethe size of the value buffer in bytes.
See also
ddl::codec::StaticCodec::setElementRawValue

Definition at line 1272 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ setStringValue()

void setStringValue ( const std::string &  value)
inline

Sets the value from value as string.

Parameters
[in]valueThe value to set as string. string will be converted to the elements type.
See also
ddl::codec::StaticCodec::setElementStringValue

Definition at line 1261 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ setValue()

void setValue ( const T &  value)
inline

Sets the value from value of type T.

Template Parameters
TType of the value
Parameters
[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

Definition at line 1241 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().

◆ setVariantValue()

void setVariantValue ( const a_util::variant::Variant value)
inline

Sets the value from value as variant.

Parameters
[in]valueThe value to set as variant
See also
ddl::codec::StaticCodec::setElementVariantValue

Definition at line 1251 of file codec_iterator.h.

References FactoryElement< ElementAccessType, ChildElements< ElementAccessType > >::getIndex().