Class ChunkRef

Class Documentation

class ChunkRef

Thin interface class that holds the pointer to the chunk and hides the messages reading routines.

It expects that Chunk was “verified” before creating a ChunkRef.

Public Functions

ChunkRef(const uint64_t offset, Reader *reader)
Parameters:
  • offset[in] – The offset into the chunk array for the specified chunk.

  • reader[in] – The reader object to use for reading.

ChunkRef(const uint64_t offset, const OsfBuffer &buf, Reader *reader)

Constructs a ChunkRef using a chunk offset, buffer, and Reader pointer.

Parameters:
  • offset[in] – Offset into the OSF chunk array.

  • buf[in] – OSF buffer corresponding to the chunk data.

  • reader[in]Reader instance used to interpret the chunk.

ChunkRef(ChunkRef &&other) = default

Move constructor for ChunkRef.

Parameters:

other[in] – The ChunkRef instance to move from.

ChunkRef &operator=(ChunkRef &&other) = default
ChunkRef(const ChunkRef &other) = default

Copy constructor for ChunkRef.

Parameters:

other[in] – The ChunkRef instance to copy from.

ChunkRef &operator=(const ChunkRef &other) = default
bool operator==(const ChunkRef &other) const

Check if two ChunkRefs are equal.

Parameters:

other[in] – The other ChunkRef to check against.

Returns:

If the two ChunkRef are equal.

bool operator!=(const ChunkRef &other) const

Check if two ChunkRefs are not equal.

Parameters:

other[in] – The other ChunkRef to check against.

Returns:

If the two ChunkRef are not equal.

const ChunkState *state() const

Get the ChunkState for the chunk associated with this ChunkRef.

Returns:

The ChunkState associated with this ChunkRef.

const ChunkInfoNode *info() const

Get the ChunkInfoNode for the chunk associated with this ChunkRef.

Returns:

The ChunkInfoNode associated with this ChunkRef.

MessagesChunkIter begin() const

Begin function for std iterator support.

Returns:

A MessagesChunkIter object for iteration.

MessagesChunkIter end() const

End function for std iterator support.

Returns:

A MessagesChunkIter object for signifying the end of iteration.

const MessageRef operator[](size_t msg_idx) const

Get the message at a specific index.

Parameters:

msg_idx[in] – The message index to get.

Returns:

The resulting message.

std::unique_ptr<const MessageRef> messages(size_t msg_idx) const

Get the message smart pointer at a specific index.

Parameters:

msg_idx[in] – The message index to get.

Returns:

The resulting message smart pointer, returns nullptr if non existent.

std::string to_string() const

Debug string representation.

Returns:

The string representation of a ChunkRef.

uint64_t offset() const

Return the chunk offset in the larger flatbuffer array.

Returns:

The chunk offset in the larger flatbuffer array.

size_t size() const

Returns the summation of the sizes of the chunks messages.

Returns:

The summation of the sizes of the chunks messages, 0 on chunk invalidity.

bool valid() const

Get the validity of the chunk.

Returns:

The validity of the chunk.

ChunkState *state()

Get the ChunkState for the chunk associated with this ChunkRef.

Returns:

The ChunkState associated with this ChunkRef.

ChunkInfoNode *info()

Get the ChunkInfoNode for the chunk associated with this ChunkRef.

Returns:

The ChunkInfoNode associated with this ChunkRef.

ts_t start_ts() const

The lowest timestamp in the chunk.

A shortcut for state()->start_ts

Returns:

starting timestamp in the received chunk

ts_t end_ts() const

The highest timestamp in the chunk.

A shortcut for state()->end_ts

Returns:

last timestamp in the received chunk