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

Detailed Description

An in-memory IChunkWriter implementation backed by a growable buffer.

Definition at line 253 of file writer.hpp.

#include <writer.hpp>

Inheritance diagram for mcap::BufferWriter:
[legend]

Public Member Functions

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::bytebuffer_
 
uint32_t crc_
 

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::BufferWriter::compressedData ( ) const
overridevirtual

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

Implements mcap::IChunkWriter.

Definition at line 142 of file writer.inl.

◆ compressedSize()

uint64_t mcap::BufferWriter::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 126 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::BufferWriter::data ( ) const
overridevirtual

Returns a pointer to the uncompressed data.

Implements mcap::IChunkWriter.

Definition at line 138 of file writer.inl.

◆ empty()

bool mcap::BufferWriter::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 130 of file writer.inl.

◆ end()

void mcap::BufferWriter::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 118 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::BufferWriter::handleClear ( )
overridevirtual

Implements mcap::IChunkWriter.

Definition at line 134 of file writer.inl.

◆ handleWrite()

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

Implements mcap::IWritable.

Definition at line 114 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::BufferWriter::size ( ) const
overridevirtual

Returns the size in bytes of the uncompressed data.

Implements mcap::IChunkWriter.

Definition at line 122 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

◆ buffer_

std::vector<std::byte> mcap::BufferWriter::buffer_
private

Definition at line 265 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.


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