Dev Essential
Loading...
Searching...
No Matches
a_util::memory::detail::ConverterBase< T > Class Template Reference

#include <bitserializer.h>

Inherited by a_util::memory::detail::Converter< T, 0, 0 >, a_util::memory::detail::Converter< T, 1, 0 >, and a_util::memory::detail::Converter< T, 1, 1 >.

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())
 
static a_util::result::Result writeSignal (uint8_t *buffer, size_t start_bit, size_t bit_length, T value, Endianess endianess=get_platform_endianess())
 
static a_util::result::Result cutLeadingBits (uint64_t *value, size_t bit_length)
 
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)
 

Detailed Description

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

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

Member Function Documentation

◆ copyBytesFromBuffer()

template<typename T>
static a_util::result::Result a_util::memory::detail::ConverterBase< T >::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.

◆ cutLeadingBits()

template<typename T>
static a_util::result::Result a_util::memory::detail::ConverterBase< T >::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.

◆ readSignal()

template<typename T>
static a_util::result::Result a_util::memory::detail::ConverterBase< T >::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.

◆ writeSignal()

template<typename T>
static a_util::result::Result a_util::memory::detail::ConverterBase< T >::writeSignal ( uint8_t * buffer,
size_t start_bit,
size_t bit_length,
T 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.

The documentation for this class was generated from the following file: