ADTF  3.18.2
ConverterBase< T >

Converter Base Contains the base methods used by all inheriting Converter classes. More...

Inheritance diagram for ConverterBase< T >:
[legend]

Static Protected Member Functions

static a_util::result::Result readSignal (uint8_t *buffer, size_t start_bit, size_t bit_length, T *value, Endianess endianess=get_platform_endianess())
 Read value from bitfield. More...
 
static a_util::result::Result writeSignal (uint8_t *buffer, size_t start_bit, size_t bit_length, T value, Endianess endianess=get_platform_endianess())
 Write value to bitfield. More...
 
static a_util::result::Result cutLeadingBits (uint64_t *value, size_t bit_length)
 Set the highest bits of a uint64_t value to zero. More...
 
static a_util::result::Result copyBytesFromBuffer (uint8_t *buffer, uint64_t *value, size_t start_bit, size_t bit_length, uint64_t *ninth_byte, size_t *bytes_to_read)
 Copy bytes_to_read number of bytes from the buffer to value and ninth_byte. More...
 

Detailed Description

template<typename T>
class a_util::memory::detail::ConverterBase< T >

Converter Base Contains the base methods used by all inheriting Converter classes.

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

Member Function Documentation

◆ copyBytesFromBuffer()

static a_util::result::Result copyBytesFromBuffer ( uint8_t *  buffer,
uint64_t *  value,
size_t  start_bit,
size_t  bit_length,
uint64_t *  ninth_byte,
size_t *  bytes_to_read 
)
inlinestaticprotected

Copy bytes_to_read number of bytes from the buffer to value and ninth_byte.

Determines how many bytes need to be copied to receive a copy of all bits in the range described by start_bit and bit_length. The maximum for bit_length is 64, but for unaligned values the range may exceed 8 bytes. In this case, the required ninth byte will be copied to ninth_byte.

Parameters
[in]bufferPointer to the memory buffer to copy from.
[out]valuePointer to the variable to store the copied value in.
[in]start_bitBit position to start reading from. The least significant bit has the index 0.
[in]bit_lengthNumber of bits to read.
[out]ninth_bytePointer to the variable to eventually store a copied ninth byte in.
[out]bytes_to_readNumber of bytes that need to be copied to attain all requested bits.
Returns
Returns a standard result code.

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

References a_util::memory::copy().

Referenced by ConverterBase< T >::readSignal(), and ConverterBase< T >::writeSignal().

◆ cutLeadingBits()

static a_util::result::Result cutLeadingBits ( uint64_t *  value,
size_t  bit_length 
)
inlinestaticprotected

Set the highest bits of a uint64_t value to zero.

The number of bit_length lowest bits remain unchanged.

Parameters
[out]valuePointer to the variable to trim.
[in]bit_lengthNumber of trailing bits to remain unchanged.
Returns
Returns a standard result code.

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

Referenced by ConverterBase< T >::readSignal(), and ConverterBase< T >::writeSignal().

◆ readSignal()

static a_util::result::Result readSignal ( uint8_t *  buffer,
size_t  start_bit,
size_t  bit_length,
T *  value,
Endianess  endianess = get_platform_endianess() 
)
inlinestaticprotected

Read value from bitfield.

Operating on a uint64_t copy to allow bit shifting and masking operations.

Parameters
[in]bufferPointer to the memory buffer to read from.
[in]start_bitBit position to start reading from. The least significant bit has the index 0.
[in]bit_lengthNumber of bits to read.
[out]valuePointer to the variable to store the read value in.
[in]endianessParameter describing the endianess of the bitfield to read from.
Returns
Returns a standard result code.

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

References a_util::memory::copy(), ConverterBase< T >::copyBytesFromBuffer(), ConverterBase< T >::cutLeadingBits(), and a_util::memory::get_platform_endianess().

Referenced by Converter< T, 0, 0 >::read(), Converter< T, 1, 0 >::read(), and Converter< T, 1, 1 >::read().

◆ writeSignal()

static a_util::result::Result writeSignal ( uint8_t *  buffer,
size_t  start_bit,
size_t  bit_length,
value,
Endianess  endianess = get_platform_endianess() 
)
inlinestaticprotected

Write value to bitfield.

Operating on a uint64_t copy to allow bit shifting and masking operations.

Parameters
[in]bufferPointer to the memory buffer to write to.
[in]start_bitBit position to start writing to. The least significant bit has the index 0.
[in]bit_lengthNumber of bits to write.
[out]valueValue to write to the bitfield.
[in]endianessParameter describing the endianess of the bitfield to write to.
Returns
Returns a standard result code.

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

References a_util::memory::copy(), ConverterBase< T >::copyBytesFromBuffer(), and ConverterBase< T >::cutLeadingBits().

Referenced by Converter< T, 0, 0 >::write(), Converter< T, 1, 0 >::write(), and Converter< T, 1, 1 >::write().