ADTF  3.18.2
ddl::codec Namespace Reference

Namespace for the new faster CodecFactory/Decoder/Codec implementation. More...

Classes

class  Decoder
 Decoder for dynamic structures defined by a DataDefinition definition. More...
 
class  Codec
 Decoder for dynamic structures defined by a DataDefinition definition. More...
 
class  CodecFactory
 Factory class for ddl codecs. More...
 
struct  PositionWithTypeSize
 Position with type size information. More...
 
struct  PositionWithAlignedTypeSize
 Position with type size information. More...
 
struct  PositionWithUsedBitsTypeSize
 Position with used bit type size information. More...
 
struct  ElementLayoutBase
 Base layout definition for one element. More...
 
struct  ElementLayout
 Layout defintion for one element with set array position. More...
 
class  CodecIndex
 Fast Access Index Type for the coders. More...
 
class  FactoryElement
 A FactoryElement. More...
 
class  DecoderElement
 A DecoderElement to get values. More...
 
class  CodecElement
 A CodecElement to get and set values. More...
 
class  ElementIterator
 The element iterator. More...
 
class  ElementIteratorConst
 The const element iterator. More...
 
class  ChildElements
 Iteratable container type for the given Element type in ElementAccessType::element_type. More...
 
class  FactoryElementAccess
 A factory element access type concept template to retrieve element information from the AccessType. More...
 
class  DecoderElementAccess
 A element access type concept template to retrieve element information from the AccessType and get the element value. More...
 
class  CodecElementAccess
 A element access type concept template to retrieve element information from the AccessType, get and set the element value. More...
 
class  CodecTypeInfo
 Description of the elements Type. More...
 
class  CodecConstantInfo
 The constant info of a element. More...
 
class  CodecDefaultValueInfo
 The default value info of a element. More...
 
struct  LeafLayout
 small leaf layout information to access codec data very fast. More...
 
class  LeafCodecIndex
 The Leaf codec index is a small layout information index to access the decoders/codecs data very fast. More...
 
struct  LeafValueGetter
 Value getter to retrieve the current value of the given element as a ValueType if supported from a data area. More...
 
struct  LeafValueSetter
 Value setter to set the current value of the given element from a type ValueType if supported. More...
 
class  StaticDecoder
 Decoder for static structures defined by a DataDefinition definition. More...
 
class  StaticCodec
 Codec for static structures defined by a DataDefinition definition. More...
 
struct  ValueGetter
 Value getter to retrieve the current value of the given element as a ValueType if supported. More...
 
struct  ValueGetter< DecoderType, std::string >
 Value getter specialization for std::string. More...
 
struct  ValueSetter
 Value setter to set the current value of the given element from a type ValueType if supported. More...
 
struct  ValueSetter< CodecType, std::string >
 Value setter specialization for std::string. More...
 
struct  ValueGetterSelect
 Value getter to retrieve the current value of the given element as a ValueType if supported. More...
 
struct  ValueGetterSelect< DecoderType, ValueType, true >
 Value getter to retrieve the current value of the given element as a ValueType if supported. More...
 
struct  ValueSetterSelect
 Value setter to set the value of the given element as a ValueType if supported. More...
 
struct  ValueSetterSelect< CodecType, ValueType, true >
 Value setter to set the value of the given element as a ValueType if supported. More...
 

Typedefs

using Position = ddl::Position
 Binary compatible reusing of structure for position of elements.
 
using AccessEnumType = ddl::AccessEnumType
 This is the legacy Access Type for resolving enum names.
 

Enumerations

enum class  ElementType {
  cet_empty = a_util::variant::VariantType::VT_Empty , cet_bool = a_util::variant::VariantType::VT_Bool , cet_int8 = a_util::variant::VariantType::VT_Int8 , cet_uint8 = a_util::variant::VariantType::VT_UInt8 ,
  cet_int16 = a_util::variant::VariantType::VT_Int16 , cet_uint16 = a_util::variant::VariantType::VT_UInt16 , cet_int32 = a_util::variant::VariantType::VT_Int32 , cet_uint32 = a_util::variant::VariantType::VT_UInt32 ,
  cet_int64 = a_util::variant::VariantType::VT_Int64 , cet_uint64 = a_util::variant::VariantType::VT_UInt64 , cet_float = a_util::variant::VariantType::VT_Float , cet_double = a_util::variant::VariantType::VT_Double ,
  cet_sub_codec = cet_double + 1 , cet_user_type = cet_sub_codec + 1
}
 The element type of the value. More...
 
enum class  LeafDataRepresentation : uint8_t { deserialized = 0x00 , serialized = 0x01 , serialized_be = 0x03 , serialized_le = 0x01 }
 LeafLayout data representation flags. More...
 
enum class  LeafElementType : uint8_t {
  let_bool = static_cast<uint8_t>(ElementType::cet_bool) , let_int8 = static_cast<uint8_t>(ElementType::cet_int8) , let_uint8 , let_int16 ,
  let_uint16 , let_int32 , let_uint32 , let_int64 ,
  let_uint64 , let_float = static_cast<uint8_t>(ElementType::cet_float) , let_double = static_cast<uint8_t>(ElementType::cet_double)
}
 Valid ElementTypes for the LeafLayout. More...
 

Functions

template<typename T >
std::vector< CodecIndexgetCodecIndices (const T &decoder_or_factory)
 Retrieves all codec indices for the given codec of type T. More...
 
template<typename T >
std::vector< LeafCodecIndexgetLeafCodecIndices (const T &decoder_or_factory, ddl::DataRepresentation rep)
 Get the leaf indices object. More...
 
std::string toString (const CodecIndex &index)
 Converts the index to a string. More...
 
template<typename ElementsType >
void forEachLeafElement (ElementsType &elements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &func)
 Iterates ALL leaf elements within ALL array elements. More...
 
template<typename ElementsType >
void forEachElement (ElementsType &elements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &func)
 Iterates elements without array elements (also structures). More...
 
 _MAKE_RESULT (-3, ERR_AUTIL_UNEXPECTED)
 Creates an a_util error ERR_AUTIL_UNEXPECTED.
 
template<typename DECODER , typename ENCODER >
a_util::result::Result transform (const DECODER &decoder, ENCODER &encoder)
 Copies all elements from a decoder to a codec. More...
 
a_util::result::Result transformToBuffer (const codec::Decoder &decoder, a_util::memory::MemoryBuffer &buffer, bool zero=false)
 Tranforms the data from a given decoder into the opposite data representation. More...
 

Detailed Description

Namespace for the new faster CodecFactory/Decoder/Codec implementation.

Enumeration Type Documentation

◆ ElementType

enum ElementType
strong

The element type of the value.

Enumerator
cet_empty 

Variant type is empty.

cet_bool 

Variant type is bool.

cet_int8 

Variant type is std::int8_t.

cet_uint8 

Variant type is std::uint8_t.

cet_int16 

Variant type is std::int16_t.

cet_uint16 

Variant type is std::uint16_t.

cet_int32 

Variant type is std::int32_t.

cet_uint32 

Variant type is std::uint32_t.

cet_int64 

Variant type is std::int64_t.

cet_uint64 

Variant type is std::uint64_t.

cet_float 

Variant type is float.

cet_double 

Variant type is double.

cet_sub_codec 

type marks a subcodec/substructure with children

cet_user_type 

type marks a user defined type

Definition at line 29 of file codec_type_info.h.

◆ LeafDataRepresentation

enum LeafDataRepresentation : uint8_t
strong

LeafLayout data representation flags.

Enumerator
deserialized 

first bit is zero for deserialized data representation of the LeafCodecIndex::data_flags

serialized 

first bit is set for serialized data representation of the LeafCodecIndex::data_flags

serialized_be 

first and second bit is set for serialized data representation in big endianess of the LeafCodecIndex::data_flags

serialized_le 

first bit is set second bit is not set for serialized data representation in little endianess of the LeafCodecIndex::data_flags

Definition at line 34 of file leaf_value_access.h.

◆ LeafElementType

enum LeafElementType : uint8_t
strong

Valid ElementTypes for the LeafLayout.

Enumerator
let_bool 

LeafElementType type is bool.

let_int8 

LeafElementType type is std::int8_t.

let_uint8 

LeafElementType type is std::uint8_t.

let_int16 

LeafElementType type is std::int16_t.

let_uint16 

LeafElementType type is std::uint16_t.

let_int32 

LeafElementType type is std::int32_t.

let_uint32 

LeafElementType type is std::uint32_t.

let_int64 

LeafElementType type is std::int64_t.

let_uint64 

LeafElementType type is std::uint64_t.

let_float 

LeafElementType type is float.

let_double 

LeafElementType type is double.

Definition at line 60 of file leaf_value_access.h.

Function Documentation

◆ forEachElement()

void ddl::codec::forEachElement ( ElementsType &  elements,
const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &  func 
)

Iterates elements without array elements (also structures).

Usage:

//description contains a data description where "my_struct" is defined
struct my_sub_struct
{
uint32_t sub_element[3];
uint32_t sub_element_after;
}
struct my_struct
{
my_sub_struct element[2];
}
CodecFactory factory("my_struct", description);
forEachElement(factory.getElements(),
[](const auto& element) {
std::cout << element.getFullName() << std::endl;
std::cout << element.getName() << std::endl;
std::cout << element.getBaseName() << std::endl;
std::cout << element.getArraySize() << std::endl;
});
//following output:
//"element[0]"
//"element[0]"
//"element"
//"2"
//"element[0].sub_element[0]"
//"sub_element[0]"
//"sub_element"
//"3"
//"element[0].sub_element_after"
//"sub_element_after"
//"sub_element_after"
//"1"
void forEachElement(ElementsType &elements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &func)
Iterates elements without array elements (also structures).
Template Parameters
ElementsTypeThe type of elements.
Parameters
elementsThe elements
funcThe function to call per leaf element
See also
CodecFactory::getElements, Codec::getElements, Decoder::getElements, StaticCodec::getElements, StaticDecoder::getElements

Definition at line 1528 of file codec_iterator.h.

◆ forEachLeafElement()

void ddl::codec::forEachLeafElement ( ElementsType &  elements,
const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &  func 
)

Iterates ALL leaf elements within ALL array elements.

Usage:

//description contains a data description where "my_struct" is defined
struct my_sub_struct
{
uint32_t sub_element[3];
uint32_t sub_element_after;
}
struct my_struct
{
my_sub_struct element[2];
}
CodecFactory factory("my_struct", strDescription);
forEachLeafElement(factory.getElements(),
[](const auto& element) {
std::cout << element.getFullName() << std::endl;
});
//following output:
//"element[0].sub_element[0]"
//"element[0].sub_element[1]"
//"element[0].sub_element[2]"
//"element[0].sub_element_after"
//"element[1].sub_element[0]"
//"element[1].sub_element[1]"
//"element[1].sub_element[2]"
//"element[1].sub_element_after"
void forEachLeafElement(ElementsType &elements, const std::function< void(std::conditional_t< std::is_const< ElementsType >::value, const typename ElementsType::element_type, typename ElementsType::element_type > &)> &func)
Iterates ALL leaf elements within ALL array elements.
Template Parameters
ElementsTypeThe type of elements.
Parameters
elementsThe elements
funcThe function to call per leaf element
See also
CodecFactory::getElements, Codec::getElements, Decoder::getElements, StaticCodec::getElements, StaticDecoder::getElements

Definition at line 1449 of file codec_iterator.h.

Referenced by getCodecIndices(), getLeafCodecIndices(), and transform().

◆ getCodecIndices()

std::vector<CodecIndex> ddl::codec::getCodecIndices ( const T &  decoder_or_factory)

Retrieves all codec indices for the given codec of type T.

Template Parameters
TThe codec type or factory.
Parameters
[in]decoder_or_factorythe codec or factory of type T
Returns
std::vector<CodecIndex> the codec indices

Definition at line 322 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/ddl/codec/codec_factory.h.

References forEachLeafElement().

◆ getLeafCodecIndices()

std::vector<LeafCodecIndex> ddl::codec::getLeafCodecIndices ( const T &  decoder_or_factory,
ddl::DataRepresentation  rep 
)

Get the leaf indices object.

Template Parameters
TThe type of the decoder or factory to retrieve all leaf indices from.
Parameters
decoder_or_factoryThe decoder or factory to retrieve all indices from.
repThe data representation to extract the leaf codec index for
Returns
std::vector<LeafCodecIndex>
See also
LeafCodecIndex

Definition at line 340 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/ddl/codec/codec_factory.h.

References forEachLeafElement().

◆ toString()

std::string ddl::codec::toString ( const CodecIndex index)

Converts the index to a string.

Parameters
indexthe index to convert
Returns
std::string

◆ transform()

a_util::result::Result ddl::codec::transform ( const DECODER &  decoder,
ENCODER &  encoder 
)

Copies all elements from a decoder to a codec.

Parameters
[in]decoderThe source decoder.
[out]encoderThe destination codec.
Returns
Standard result.

Definition at line 37 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/ddl/serialization/serialization.h.

References forEachLeafElement().

◆ transformToBuffer()

a_util::result::Result ddl::codec::transformToBuffer ( const codec::Decoder decoder,
a_util::memory::MemoryBuffer buffer,
bool  zero = false 
)

Tranforms the data from a given decoder into the opposite data representation.

Allocates the buffer accordingly.

Parameters
[in]decoderThe source decoder.
[out]bufferThe destination buffer object.
[in]zeroWhether or not to memzero the buffer before writing the elements to it.
Returns
Standard result.