Class ChunkBuilder

Class Documentation

class ChunkBuilder

Encapsulate chunk seriualization operations.

Public Functions

ChunkBuilder()
~ChunkBuilder()
void save_message(const uint32_t stream_id, const ts_t receive_ts, const ts_t sensor_ts, const std::vector<uint8_t> &msg_buf, const std::string &type)

Save messages to the serialized chunks.

Throws:

std::logic_error – Exception on a size mismatch

Parameters:
  • stream_id[in] The stream to save the message to.

  • receive_ts[in] The receive timestamp to use for the message.

  • sensor_ts[in] The sensor timestamp to use for the message.

  • msg_buf[in] The message to save in the form of a byte vector.

  • type[in] Message type string of the message being saved.

void reset()

Completely wipe all data and start the chunk anew.

std::vector<uint8_t> finish()

Finish out the serialization of the chunk and return the raw flatbuffer output.

Returns:

The serialized chunk in a raw flatbuffer byte vector.

uint32_t size() const

Returns the flatbufferbuilder size.

Returns:

The flatbufferbuilder size.

uint32_t messages_count() const

Returns the number of messages saved so far.

Returns:

The number of messages saved so far.

ts_t start_ts() const

The lowest timestamp in the chunk.

Returns:

The lowest timestamp in the chunk.

ts_t end_ts() const

The highest timestamp in the chunk.

Returns:

The highest timestamp in the chunk.