Class PacketBuffer

Class Documentation

class PacketBuffer

A packetbuffer for the raw data from the sensor.

Public Types

typedef boost::array<uint8_t, MAXSIZE> ArrayBuffer

Typedef for an arraybuffer which can be read from the sensor.

Public Functions

PacketBuffer()

Constructor of PacketBuffer.

PacketBuffer(const std::vector<uint8_t> &buffer)

Constructor of PacketBuffer.

No explicit tag used to allow implicit conversion from different inputs types.

Parameters:

buffer – vector to set for the PacketBuffer.

PacketBuffer(const ArrayBuffer &buffer, const size_t &length)

Constructor of PacketBuffer.

Parameters:
  • buffer – Arraybuffer to set for the PacketBuffer.

  • length – Length of the array.

std::shared_ptr<std::vector<uint8_t> const> getBuffer() const

Getter to return a copy of the data saved in the PacketBuffer.

Returns:

Data copy as shared_ptr<vector const>. Needed because this bufer could be overwritten.

void setBuffer(const std::vector<uint8_t> &buffer)

Setter for the PacketBuffer.

Parameters:

buffer – Input VectorBuffer to save.

void setBuffer(const ArrayBuffer &buffer, const size_t &length)

Setter for the PacketBuffer.

Parameters:
  • buffer – Input ArrayBuffer to save.

  • length – Length of input ArrayBuffer.

size_t getLength() const

Returns length of the current PacketBuffer.

Returns:

Length.

Public Static Functions

static inline uint32_t getMaxSize()

Returns defined maximum size of PacketBuffer.

Returns:

Maximum size of PacketBuffer.