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

Detailed Description

Implements the IWritable interface used by McapWriter by wrapping a std::ostream stream.

Definition at line 186 of file writer.hpp.

#include <writer.hpp>

Inheritance diagram for mcap::StreamWriter:
[legend]

Public Member Functions

 StreamWriter (std::ostream &stream)
 
void handleWrite (const std::byte *data, uint64_t size) override
 
void end () override
 Called when the writer is finished writing data to the output MCAP file.
 
void flush () override
 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.
 
uint64_t size () const override
 Returns the current size of the file in bytes. This must be equal to the sum of all size parameters passed to write().
 
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.
 

Public Attributes

bool crcEnabled = false
 

Private Attributes

std::ostreamstream_
 
uint64_t size_ = 0
 
uint32_t crc_
 

Constructor & Destructor Documentation

◆ StreamWriter()

mcap::StreamWriter::StreamWriter ( std::ostream stream)

Definition at line 84 of file writer.inl.

Member Function Documentation

◆ crc()

uint32_t mcap::IWritable::crc ( )
inherited

Returns the CRC32 of the uncompressed data.

Definition at line 28 of file writer.inl.

◆ end()

void mcap::StreamWriter::end ( )
overridevirtual

Called when the writer is finished writing data to the output MCAP file.

Implements mcap::IWritable.

Definition at line 97 of file writer.inl.

◆ flush()

void mcap::StreamWriter::flush ( )
overridevirtual

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 from mcap::IWritable.

Definition at line 93 of file writer.inl.

◆ handleWrite()

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

Implements mcap::IWritable.

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

Returns the current size of the file in bytes. This must be equal to the sum of all size parameters passed to write().

Implements mcap::IWritable.

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

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

◆ size_

uint64_t mcap::StreamWriter::size_ = 0
private

Definition at line 197 of file writer.hpp.

◆ stream_

std::ostream& mcap::StreamWriter::stream_
private

Definition at line 196 of file writer.hpp.


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