pjmsg_mcap_wrapper
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | List of all members
mcap::IChunkWriter Class Referenceabstract

Detailed Description

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>

Inheritance diagram for mcap::IChunkWriter:
[legend]

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::bytedata () const =0
 Returns a pointer to the uncompressed data.
 
virtual const std::bytecompressedData () 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_
 

Constructor & Destructor Documentation

◆ ~IChunkWriter()

virtual mcap::IChunkWriter::~IChunkWriter ( )
overridevirtualdefault

Member Function Documentation

◆ clear()

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.

◆ compressedData()

virtual const std::byte * mcap::IChunkWriter::compressedData ( ) const
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.

◆ compressedSize()

virtual uint64_t mcap::IChunkWriter::compressedSize ( ) const
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.

◆ crc()

uint32_t mcap::IWritable::crc ( )
inherited

Returns the CRC32 of the uncompressed data.

Definition at line 28 of file writer.inl.

◆ data()

virtual const std::byte * mcap::IChunkWriter::data ( ) const
pure virtual

Returns a pointer to the uncompressed data.

Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.

◆ empty()

virtual bool mcap::IChunkWriter::empty ( ) const
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.

◆ end()

virtual void mcap::IChunkWriter::end ( )
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.

◆ 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()

virtual void mcap::IChunkWriter::handleClear ( )
protectedpure virtual

◆ handleWrite()

virtual void mcap::IWritable::handleWrite ( const std::byte data,
uint64_t  size 
)
protectedpure virtualinherited

◆ resetCrc()

void mcap::IWritable::resetCrc ( )
inherited

Resets the CRC32 calculation.

Definition at line 36 of file writer.inl.

◆ size()

virtual uint64_t mcap::IChunkWriter::size ( ) const
overridepure virtual

Returns the size in bytes of the uncompressed data.

Implements mcap::IWritable.

Implemented in mcap::BufferWriter, mcap::LZ4Writer, and mcap::ZStdWriter.

◆ 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

◆ 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.


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