pjmsg_mcap_wrapper
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
mcap::LZ4Writer Class Referencefinal

Detailed Description

An in-memory IChunkWriter implementation that holds data in a temporary buffer before flushing to an LZ4-compressed buffer.

Definition at line 273 of file writer.hpp.

#include <writer.hpp>

Inheritance diagram for mcap::LZ4Writer:
[legend]

Public Member Functions

 LZ4Writer (CompressionLevel compressionLevel, uint64_t chunkSize)
 
void handleWrite (const std::byte *data, uint64_t size) override
 
void end () override
 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.
 
uint64_t size () const override
 Returns the size in bytes of the uncompressed data.
 
uint64_t compressedSize () const override
 Returns the size in bytes of the compressed data. This will only be called after end().
 
bool empty () const override
 Returns true if write() has never been called since initialization or the last call to clear().
 
void handleClear () override
 
const std::bytedata () const override
 Returns a pointer to the uncompressed data.
 
const std::bytecompressedData () const override
 Returns a pointer to the compressed data. This will only be called after end().
 
void clear ()
 Clear the internal state of the writer, discarding any input or output buffers.
 
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
 

Private Attributes

std::vector< std::byteuncompressedBuffer_
 
std::vector< std::bytecompressedBuffer_
 
CompressionLevel compressionLevel_
 
uint32_t crc_
 

Constructor & Destructor Documentation

◆ LZ4Writer()

mcap::LZ4Writer::LZ4Writer ( CompressionLevel  compressionLevel,
uint64_t  chunkSize 
)

Definition at line 169 of file writer.inl.

Member Function Documentation

◆ clear()

void mcap::IChunkWriter::clear ( )
inherited

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

Definition at line 107 of file writer.inl.

◆ compressedData()

const std::byte * mcap::LZ4Writer::compressedData ( ) const
overridevirtual

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

Implements mcap::IChunkWriter.

Definition at line 214 of file writer.inl.

◆ compressedSize()

uint64_t mcap::LZ4Writer::compressedSize ( ) const
overridevirtual

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

Implements mcap::IChunkWriter.

Definition at line 197 of file writer.inl.

◆ crc()

uint32_t mcap::IWritable::crc ( )
inherited

Returns the CRC32 of the uncompressed data.

Definition at line 28 of file writer.inl.

◆ data()

const std::byte * mcap::LZ4Writer::data ( ) const
overridevirtual

Returns a pointer to the uncompressed data.

Implements mcap::IChunkWriter.

Definition at line 210 of file writer.inl.

◆ empty()

bool mcap::LZ4Writer::empty ( ) const
overridevirtual

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

Implements mcap::IChunkWriter.

Definition at line 201 of file writer.inl.

◆ end()

void mcap::LZ4Writer::end ( )
overridevirtual

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::IChunkWriter.

Definition at line 178 of file writer.inl.

◆ flush()

virtual void mcap::IWritable::flush ( )
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.

◆ handleClear()

void mcap::LZ4Writer::handleClear ( )
overridevirtual

Implements mcap::IChunkWriter.

Definition at line 205 of file writer.inl.

◆ handleWrite()

void mcap::LZ4Writer::handleWrite ( const std::byte data,
uint64_t  size 
)
overridevirtual

Implements mcap::IWritable.

Definition at line 174 of file writer.inl.

◆ resetCrc()

void mcap::IWritable::resetCrc ( )
inherited

Resets the CRC32 calculation.

Definition at line 36 of file writer.inl.

◆ size()

uint64_t mcap::LZ4Writer::size ( ) const
overridevirtual

Returns the size in bytes of the uncompressed data.

Implements mcap::IChunkWriter.

Definition at line 193 of file writer.inl.

◆ write()

void mcap::IWritable::write ( const std::byte data,
uint64_t  size 
)
inherited

Called whenever the writer needs to write data to the output MCAP file.

Parameters
dataA pointer to the data to write.
sizeSize of the data in bytes.

Definition at line 21 of file writer.inl.

Member Data Documentation

◆ compressedBuffer_

std::vector<std::byte> mcap::LZ4Writer::compressedBuffer_
private

Definition at line 288 of file writer.hpp.

◆ compressionLevel_

CompressionLevel mcap::LZ4Writer::compressionLevel_
private

Definition at line 289 of file writer.hpp.

◆ crc_

uint32_t mcap::IWritable::crc_
privateinherited

Definition at line 159 of file writer.hpp.

◆ crcEnabled

bool mcap::IWritable::crcEnabled = false
inherited

Definition at line 116 of file writer.hpp.

◆ uncompressedBuffer_

std::vector<std::byte> mcap::LZ4Writer::uncompressedBuffer_
private

Definition at line 287 of file writer.hpp.


The documentation for this class was generated from the following files: