pjmsg_mcap_wrapper
|
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.
Definition at line 205 of file writer.hpp.
#include <writer.hpp>
Public Member 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() . | |
void | write (const std::byte *data, uint64_t size) |
Called whenever the writer needs to write data to the output MCAP file. | |
uint32_t | crc () |
Returns the CRC32 of the uncompressed data. | |
void | resetCrc () |
Resets the CRC32 calculation. | |
virtual void | flush () |
flushes any buffered data to the output. This is called by McapWriter after every completed chunk. Callers may also retain a reference to the writer and call flush() at their own cadence. Defaults to a no-op. | |
Public Attributes | |
bool | crcEnabled = false |
Protected Member Functions | |
virtual void | handleClear ()=0 |
virtual void | handleWrite (const std::byte *data, uint64_t size)=0 |
Private Attributes | |
uint32_t | crc_ |
|
overridevirtualdefault |
void mcap::IChunkWriter::clear | ( | ) |
Clear the internal state of the writer, discarding any input or output buffers.
Definition at line 107 of file writer.inl.
|
pure virtual |
Returns a pointer to the compressed data. This will only be called after end()
.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
pure virtual |
Returns the size in bytes of the compressed data. This will only be called after end()
.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
inherited |
Returns the CRC32 of the uncompressed data.
Definition at line 28 of file writer.inl.
|
pure virtual |
Returns a pointer to the uncompressed data.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
pure virtual |
Returns true if write()
has never been called since initialization or the last call to clear()
.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
overridepure virtual |
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.
Implements mcap::IWritable.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
inlinevirtualinherited |
flushes any buffered data to the output. This is called by McapWriter after every completed chunk. Callers may also retain a reference to the writer and call flush() at their own cadence. Defaults to a no-op.
Reimplemented in mcap::FileWriter, and mcap::StreamWriter.
Definition at line 153 of file writer.hpp.
|
protectedpure virtual |
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
protectedpure virtualinherited |
Implemented in mcap::FileWriter, mcap::StreamWriter, mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
inherited |
Resets the CRC32 calculation.
Definition at line 36 of file writer.inl.
|
overridepure virtual |
Returns the size in bytes of the uncompressed data.
Implements mcap::IWritable.
Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.
|
inherited |
Called whenever the writer needs to write data to the output MCAP file.
data | A pointer to the data to write. |
size | Size of the data in bytes. |
Definition at line 21 of file writer.inl.
|
privateinherited |
Definition at line 159 of file writer.hpp.
|
inherited |
Definition at line 116 of file writer.hpp.