ngscopeclient 0.1-dev+51fbda87c
Protected Member Functions | List of all members

Helper class for binary driver: provides methods for handling binary data. More...

#include <BinaryDriver.h>

Inheritance diagram for BinaryDriver:
Inheritance graph
[legend]

Protected Member Functions

void PushUint16 (std::vector< uint8_t > *data, uint16_t value, bool littleEndian=true)
 Helper function to push a uint16 to a std::vector of bytes, as two consecutive bytes (either little-endian or big-endian according to littleEndian parameter) More...
 
uint16_t ReadUint16 (const std::vector< uint8_t > &data, uint8_t index, bool littleEndian=true)
 Bounds-checked read of a 16-bit value from a byte vector. More...
 
uint8_t ReadUint8 (const std::vector< uint8_t > &data, uint8_t index)
 Bounds-checked read of an 8-bit value from a byte vector. More...
 
uint16_t CalculateCRC (const uint8_t *buff, size_t len)
 

Detailed Description

Helper class for binary driver: provides methods for handling binary data.

Member Function Documentation

◆ PushUint16()

void BinaryDriver::PushUint16 ( std::vector< uint8_t > *  data,
uint16_t  value,
bool  littleEndian = true 
)
inlineprotected

Helper function to push a uint16 to a std::vector of bytes, as two consecutive bytes (either little-endian or big-endian according to littleEndian parameter)

Parameters
datathe vector to push data to
valuethe value to push
littleEndianpush data in little-endian format if true (default), big-endian otherwise

◆ ReadUint16()

uint16_t BinaryDriver::ReadUint16 ( const std::vector< uint8_t > &  data,
uint8_t  index,
bool  littleEndian = true 
)
inlineprotected

Bounds-checked read of a 16-bit value from a byte vector.

Parameters
dataInput vector
indexByte index to read
littleEndianpush data in little-endian format if true (default), big-endian otherwise
Returns
data[index] if in bounds, or 0 if out of bounds

◆ ReadUint8()

uint8_t BinaryDriver::ReadUint8 ( const std::vector< uint8_t > &  data,
uint8_t  index 
)
inlineprotected

Bounds-checked read of an 8-bit value from a byte vector.

Parameters
dataInput vector
indexByte index to read
Returns
data[index] if in bounds, or 0 if out of bounds

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