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 tResult ReadSignal (tUInt8 *pBuffer, tSize nStartBit, tSize nBitLength, T *pValue, tInt nEndianess=PLATFORM_BYTEORDER)
 Read value from bitfield. More...
 
static tResult WriteSignal (tUInt8 *pBuffer, tSize nStartBit, tSize nBitLength, T nValue, tInt nEndianess=PLATFORM_BYTEORDER)
 Write value to bitfield. More...
 
static tResult CutLeadingBits (tUInt64 *pValue, tSize nBitLength)
 Set the highest bits of a tUInt64 value to zero. More...
 
static tResult CopyBytesFromBuffer (tUInt8 *pBuffer, tUInt64 *pValue, tSize nStartBit, tSize nBitLength, tUInt64 *pNinthByte, tSize *pBytesToRead)
 Copy pBytesToRead number of bytes from the buffer to pValue and pNinthByte. More...
 

Detailed Description

template<typename T>
class A_UTILS_NS::bitconverters::ConverterBase< T >

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

Definition at line 51 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/bitserializer.h.

Member Function Documentation

◆ CopyBytesFromBuffer()

static tResult CopyBytesFromBuffer ( tUInt8 pBuffer,
tUInt64 pValue,
tSize  nStartBit,
tSize  nBitLength,
tUInt64 pNinthByte,
tSize pBytesToRead 
)
inlinestaticprotected

Copy pBytesToRead number of bytes from the buffer to pValue and pNinthByte.

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

Parameters
[in]pBufferPointer to the memory buffer to copy from.
[out]pValuePointer to the variable to store the copied value in.
[in]nStartBitBit position to start reading from. The least significant bit has the index 0.
[in]nBitLengthNumber of bits to read.
[out]pNinthBytePointer to the variable to eventually store a copied ninth byte in.
[out]pBytesToReadNumber of bytes that need to be copied to attain all requested bits.
Returns
Returns a standard result code.

Definition at line 387 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/bitserializer.h.

References cMemoryBlock::MemCopy(), and RETURN_NOERROR.

Referenced by ConverterBase< T >::ReadSignal(), and ConverterBase< T >::WriteSignal().

◆ CutLeadingBits()

static tResult CutLeadingBits ( tUInt64 pValue,
tSize  nBitLength 
)
inlinestaticprotected

Set the highest bits of a tUInt64 value to zero.

The number of nBitLength lowest bits remain unchanged.

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

Definition at line 358 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/bitserializer.h.

References RETURN_NOERROR.

Referenced by ConverterBase< T >::ReadSignal(), and ConverterBase< T >::WriteSignal().

◆ ReadSignal()

static tResult ReadSignal ( tUInt8 pBuffer,
tSize  nStartBit,
tSize  nBitLength,
T *  pValue,
tInt  nEndianess = PLATFORM_BYTEORDER 
)
inlinestaticprotected

Read value from bitfield.

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

Parameters
[in]pBufferPointer to the memory buffer to read from.
[in]nStartBitBit position to start reading from. The least significant bit has the index 0.
[in]nBitLengthNumber of bits to read.
[out]pValuePointer to the variable to store the read value in.
[in]nEndianessParameter describing the endianess of the bitfield to read from. PLATFORM_BIG_ENDIAN_8: Bitfield interpreted as Big Endian. PLATFORM_LITTLE_ENDIAN_8: Bitfield interpreted as Little Endian. PLATFORM_BYTEORDER: Endianess can be neglected.
Returns
Returns a standard result code.

Definition at line 71 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/bitserializer.h.

References ConverterBase< T >::CopyBytesFromBuffer(), ConverterBase< T >::CutLeadingBits(), cMemoryBlock::MemCopy(), PLATFORM_BIG_ENDIAN_8, PLATFORM_BYTEORDER, PLATFORM_LITTLE_ENDIAN_8, and RETURN_NOERROR.

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

◆ WriteSignal()

static tResult WriteSignal ( tUInt8 pBuffer,
tSize  nStartBit,
tSize  nBitLength,
nValue,
tInt  nEndianess = PLATFORM_BYTEORDER 
)
inlinestaticprotected

Write value to bitfield.

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

Parameters
[in]pBufferPointer to the memory buffer to write to.
[in]nStartBitBit position to start writing to. The least significant bit has the index 0.
[in]nBitLengthNumber of bits to write.
[out]nValueValue to write to the bitfield.
[in]nEndianessParameter describing the endianess of the bitfield to write to. PLATFORM_BIG_ENDIAN_8: Bitfield interpreted as Big Endian. PLATFORM_LITTLE_ENDIAN_8: Bitfield interpreted as Little Endian. PLATFORM_BYTEORDER: Endianess can be neglected.
Returns
Returns a standard result code.

Definition at line 261 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/bitserializer.h.

References ConverterBase< T >::CopyBytesFromBuffer(), ConverterBase< T >::CutLeadingBits(), cMemoryBlock::MemCopy(), PLATFORM_BIG_ENDIAN_8, and RETURN_NOERROR.

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