Class IChunkWriter

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class IChunkWriter : public mcap::IWritable

An abstract interface for writing Chunk data. Chunk data is buffered in memory and written to disk as a single record, to support optimal compression and calculating the final Chunk data size.

Subclassed by mcap::BufferWriter, mcap::LZ4Writer, mcap::ZStdWriter

Public Functions

virtual ~IChunkWriter() override = default
virtual void end() override = 0

Called when the writer wants to close the current output Chunk. After this call, data() and size() should return the data and size of the compressed data.

virtual uint64_t size() const override = 0

Returns the size in bytes of the uncompressed data.

virtual uint64_t compressedSize() const = 0

Returns the size in bytes of the compressed data. This will only be called after end().

virtual bool empty() const = 0

Returns true if write() has never been called since initialization or the last call to clear().

void clear()

Clear the internal state of the writer, discarding any input or output buffers.

virtual const std::byte *data() const = 0

Returns a pointer to the uncompressed data.

virtual const std::byte *compressedData() const = 0

Returns a pointer to the compressed data. This will only be called after end().

Protected Functions

virtual void handleClear() = 0