ADTF
Loading...
Searching...
No Matches
leaf_value_access.h File Reference
#include <a_util/base/type_traits.h>
#include <ddl/codec/bitserializer.h>
#include <ddl/codec/codec_index.h>
#include <ddl/codec/data_representation.h>
#include <ddl/codec/leaf_layout.h>
#include <ddl/utilities/std_to_string.h>
#include <cstring>
#include <stdexcept>
Include dependency graph for leaf_value_access.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ddl::codec::LeafCodecIndex
 The Leaf codec index is a small layout information index to access the decoders/codecs data very fast. There are following constraints: More...
 
struct  ddl::codec::detail::SupportedLeafValueTypeExplicit< ValueType >
 
struct  ddl::codec::detail::SupportTargetTypeConversion< ElementValueTypeFrom, TargetValueTypeTo >
 
struct  ddl::codec::detail::SupportAnyFromFundamentalConversion< ValueType >
 
struct  ddl::codec::detail::TargetValueConverter< ElementValueType, TargetValueType, conversion_allowed >
 Converter to convert a value of ElementValueType to a value of TargetValueType. More...
 
struct  ddl::codec::detail::TargetValueConverter< ElementValueType, TargetValueType, false >
 Converter to convert a value of ElementValueType to a value of TargetValueType. More...
 
struct  ddl::codec::detail::SupportSourceTypeConversion< ElementValueTypeTo, SourceValueTypeFrom >
 
struct  ddl::codec::detail::SupportAnyToFundamentalConversion< ValueType >
 
struct  ddl::codec::detail::SourceValueConverter< ElementValueType, SourceValueType, conversion_allowed >
 Converter to convert from a value of SourceValueType to a value of ElementValueType. More...
 
struct  ddl::codec::detail::SourceValueConverter< ElementValueType, SourceValueType, false >
 Converter to convert from a value of SourceValueType to a value of ElementValueType. More...
 
struct  ddl::codec::LeafValueGetter< ValueType >
 
struct  ddl::codec::LeafValueSetter< ValueType >
 

Namespaces

namespace  ddl
 definition of the ddl namespace
 
namespace  ddl::codec
 Namespace for the new faster CodecFactory/Decoder/Codec implementation.
 

Functions

template<typename ElementValueType, typename TargetValueType>
TargetValueType ddl::codec::detail::readBytes (const void *data, const size_t &data_size, uint32_t byte_pos)
 Read the bytes from a data area and converts this value to the TargetValueType.
 
template<typename ElementValueType, typename SourceValueType>
void ddl::codec::detail::writeBytes (void *data, const size_t &data_size, uint32_t byte_pos, const SourceValueType &source_value)
 Writes the value of source_value to the data area after conversion to the elements ElementValueType.
 
template<typename ElementValueType, typename TargetValueType>
TargetValueType ddl::codec::detail::readBits (const void *data, size_t data_size, size_t bit_offset, size_t bit_size, a_util::memory::Endianess byte_order)
 Read the bits from a data area and converts this value to the TargetValueType.
 
template<typename ElementValueType, typename SourceValueType>
void ddl::codec::detail::writeBits (void *data, size_t data_size, size_t bit_offset, size_t bit_size, a_util::memory::Endianess byte_order, const SourceValueType &source_value)
 Write the bits of the element to the data area after conversion from source_value.
 
template<typename ValueType>
ValueType ddl::codec::detail::readDeserializedBytes (const void *data, const size_t &data_size, const LeafLayout &layout)
 Retrieves a value from the given data area with the layout information of the layout.
 
template<typename ValueType>
ValueType ddl::codec::detail::readSerializedBits (const void *data, const size_t &data_size, const LeafLayout &layout)
 Retrieves a value from the given data area with the layout information of the layout.
 
template<typename ValueType>
void ddl::codec::detail::writeDeserializedBytes (void *data, const size_t &data_size, const LeafLayout &layout, const ValueType &value)
 Writes a value to the given data area with the layout information of the layout.
 
template<typename ValueType>
void ddl::codec::detail::writeSerializedBits (void *data, const size_t &data_size, const LeafLayout &layout, const ValueType &value)
 Writes a value to the given data area with the layout information of the layout.
 

Detailed Description

The leaf value access decoding and encoding is a header only optimization for leaf values of standard types at 1-byte aligned positions.

Function Documentation

◆ readBits()

template<typename ElementValueType, typename TargetValueType>
TargetValueType ddl::codec::detail::readBits ( const void * data,
size_t data_size,
size_t bit_offset,
size_t bit_size,
a_util::memory::Endianess byte_order )

Read the bits from a data area and converts this value to the TargetValueType.

Template Parameters
ElementValueTypeThe type for retrieving the value
TargetValueTypeThe target value type to convert to
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
bit_offsetThe bit offset of the value to retrieve in ElementValueType
bit_sizeThe size of the value to retrieve in ElementValueType
byte_orderThe byteorder of the value to retrieve in ElementValueType
Returns
TargetValueType
Exceptions
std::runtime_errorif there is no valid conversion or the given bytepos is invalid

◆ readBytes()

template<typename ElementValueType, typename TargetValueType>
TargetValueType ddl::codec::detail::readBytes ( const void * data,
const size_t & data_size,
uint32_t byte_pos )

Read the bytes from a data area and converts this value to the TargetValueType.

Template Parameters
ElementValueTypeThe type for retrieving the value (this idetifies the size of the value within data )
TargetValueTypeThe target value type to convert to
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
byte_posThe byte position to retrieve the value
Returns
TargetValueType
Exceptions
std::runtime_errorif there is no valid conversion or the given bytepos is invalid

◆ readDeserializedBytes()

template<typename ValueType>
ValueType ddl::codec::detail::readDeserializedBytes ( const void * data,
const size_t & data_size,
const LeafLayout & layout )

Retrieves a value from the given data area with the layout information of the layout.

Remarks
The method is only able to copy bytes!
Template Parameters
ValueTypeThe requested value type to retrieve the element in
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
layoutThe layout information
Returns
ValueType
Exceptions
std::runtime_errorif there is no valid conversion or the given layout is invalid

◆ readSerializedBits()

template<typename ValueType>
ValueType ddl::codec::detail::readSerializedBits ( const void * data,
const size_t & data_size,
const LeafLayout & layout )

Retrieves a value from the given data area with the layout information of the layout.

Template Parameters
ValueTypeThe requested value type to retrieve the element in
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
layoutThe layout information
Returns
ValueType
Exceptions
std::runtime_errorif there is no valid conversion or the given layout is invalid

◆ writeBits()

template<typename ElementValueType, typename SourceValueType>
void ddl::codec::detail::writeBits ( void * data,
size_t data_size,
size_t bit_offset,
size_t bit_size,
a_util::memory::Endianess byte_order,
const SourceValueType & source_value )

Write the bits of the element to the data area after conversion from source_value.

Template Parameters
ElementValueTypeThe elements type the write
SourceValueTypeThe type to convert from
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
bit_offsetThe bit offset of the value to write
bit_sizeThe size of the value to write
byte_orderThe byteorder of the value to write
source_valueThe source value to convert from
Exceptions
std::runtime_errorif there is no valid conversion or the given bitpos is invalid

◆ writeBytes()

template<typename ElementValueType, typename SourceValueType>
void ddl::codec::detail::writeBytes ( void * data,
const size_t & data_size,
uint32_t byte_pos,
const SourceValueType & source_value )

Writes the value of source_value to the data area after conversion to the elements ElementValueType.

Template Parameters
ElementValueTypeThe type of the element within the data area
SourceValueTypeThe source value type to write
Parameters
datathe data pointer of the memory
data_sizethe data size of data (in bytes)
byte_posthe byte pos to write the value
source_valueThe source value to convert and write
Exceptions
std::runtime_errorif there is no valid conversion or the given bytepos is invalid

◆ writeDeserializedBytes()

template<typename ValueType>
void ddl::codec::detail::writeDeserializedBytes ( void * data,
const size_t & data_size,
const LeafLayout & layout,
const ValueType & value )

Writes a value to the given data area with the layout information of the layout.

Template Parameters
ValueTypeThe value type to set the elements content from
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
layoutThe layout information
valueThe value to set the element
Exceptions
std::runtime_errorif there is no valid conversion or the given layout is invalid

◆ writeSerializedBits()

template<typename ValueType>
void ddl::codec::detail::writeSerializedBits ( void * data,
const size_t & data_size,
const LeafLayout & layout,
const ValueType & value )

Writes a value to the given data area with the layout information of the layout.

Remarks
The method is only able to copy bytes!
Template Parameters
ValueTypeThe value type to set the elements content from
Parameters
dataThe data pointer of the memory
data_sizeThe data size of data (in bytes)
layoutThe layout information
valueThe value to set the element
Exceptions
std::runtime_errorif there is no valid conversion or the given layout is invalid