ADTF  3.18.2
leaf_value_access.h File Reference

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

Go to the source code of this file.

Classes

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  SupportedLeafValueTypeExplicit< ValueType >
 
struct  SupportTargetTypeConversion< ElementValueTypeFrom, TargetValueTypeTo >
 
struct  SupportAnyFromFundamentalConversion< ValueType >
 
struct  TargetValueConverter< ElementValueType, TargetValueType, conversion_allowed >
 Converter to convert a value of ElementValueType to a value of TargetValueType. More...
 
struct  TargetValueConverter< ElementValueType, TargetValueType, false >
 Converter to convert a value of ElementValueType to a value of TargetValueType. More...
 
struct  SupportSourceTypeConversion< ElementValueTypeTo, SourceValueTypeFrom >
 
struct  SupportAnyToFundamentalConversion< ValueType >
 
struct  SourceValueConverter< ElementValueType, SourceValueType, conversion_allowed >
 Converter to convert from a value of SourceValueType to a value of ElementValueType. More...
 
struct  SourceValueConverter< ElementValueType, SourceValueType, false >
 Converter to convert from a value of SourceValueType to a value of ElementValueType. More...
 
struct  LeafValueGetter< ValueType >
 Value getter to retrieve the current value of the given element as a ValueType if supported from a data area. More...
 
struct  LeafValueSetter< ValueType >
 Value setter to set the current value of the given element from a type ValueType if supported. More...
 

Namespaces

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

Enumerations

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 ElementValueType , typename TargetValueType >
TargetValueType 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. More...
 
template<typename ElementValueType , typename SourceValueType >
void 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. More...
 
template<typename ElementValueType , typename TargetValueType >
TargetValueType 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. More...
 
template<typename ElementValueType , typename SourceValueType >
void 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. More...
 
template<typename ValueType >
ValueType 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. More...
 
template<typename ValueType >
ValueType 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. More...
 
template<typename ValueType >
void 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. More...
 
template<typename ValueType >
void 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. More...
 

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.

Definition in file leaf_value_access.h.

Function Documentation

◆ readBits()

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

Definition at line 551 of file leaf_value_access.h.

References TargetValueConverter< ElementValueType, TargetValueType, conversion_allowed >::convert(), BitSerializer::read(), and ddl::codec::detail::readBits().

Referenced by ddl::codec::detail::readBits().

◆ readBytes()

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

Definition at line 495 of file leaf_value_access.h.

References TargetValueConverter< ElementValueType, TargetValueType, conversion_allowed >::convert(), and ddl::codec::detail::readBytes().

Referenced by ddl::codec::detail::readBytes().

◆ readDeserializedBytes()

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

Definition at line 613 of file leaf_value_access.h.

References LeafLayout::byte_pos, LeafLayout::element_type, ddl::codec::let_bool, ddl::codec::let_double, ddl::codec::let_float, ddl::codec::let_int16, ddl::codec::let_int32, ddl::codec::let_int64, ddl::codec::let_int8, ddl::codec::let_uint16, ddl::codec::let_uint32, ddl::codec::let_uint64, ddl::codec::let_uint8, and ddl::codec::detail::readDeserializedBytes().

Referenced by ddl::codec::detail::readDeserializedBytes().

◆ readSerializedBits()

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

Definition at line 668 of file leaf_value_access.h.

References LeafLayout::bit_pos, LeafLayout::bit_size, LeafLayout::byte_pos, LeafLayout::data_flags, LeafLayout::element_type, ddl::codec::let_bool, ddl::codec::let_double, ddl::codec::let_float, ddl::codec::let_int16, ddl::codec::let_int32, ddl::codec::let_int64, ddl::codec::let_int8, ddl::codec::let_uint16, ddl::codec::let_uint32, ddl::codec::let_uint64, ddl::codec::let_uint8, ddl::codec::detail::readSerializedBits(), and ddl::codec::serialized_be.

Referenced by ddl::codec::detail::readSerializedBits().

◆ writeBits()

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

Definition at line 580 of file leaf_value_access.h.

References BitSerializer::write(), and ddl::codec::detail::writeBits().

Referenced by ddl::codec::detail::writeBits().

◆ writeBytes()

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

Definition at line 518 of file leaf_value_access.h.

References ddl::codec::detail::writeBytes().

Referenced by ddl::codec::detail::writeBytes().

◆ writeDeserializedBytes()

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

Definition at line 730 of file leaf_value_access.h.

References LeafLayout::byte_pos, LeafLayout::element_type, ddl::codec::let_bool, ddl::codec::let_double, ddl::codec::let_float, ddl::codec::let_int16, ddl::codec::let_int32, ddl::codec::let_int64, ddl::codec::let_int8, ddl::codec::let_uint16, ddl::codec::let_uint32, ddl::codec::let_uint64, ddl::codec::let_uint8, and ddl::codec::detail::writeDeserializedBytes().

Referenced by ddl::codec::detail::writeDeserializedBytes().

◆ writeSerializedBits()

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

Definition at line 789 of file leaf_value_access.h.

References LeafLayout::bit_pos, LeafLayout::bit_size, LeafLayout::byte_pos, LeafLayout::data_flags, LeafLayout::element_type, ddl::codec::let_bool, ddl::codec::let_double, ddl::codec::let_float, ddl::codec::let_int16, ddl::codec::let_int32, ddl::codec::let_int64, ddl::codec::let_int8, ddl::codec::let_uint16, ddl::codec::let_uint32, ddl::codec::let_uint64, ddl::codec::let_uint8, ddl::codec::serialized_be, and ddl::codec::detail::writeSerializedBits().

Referenced by ddl::codec::detail::writeSerializedBits().