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

Detailed Description

ICompressedReader implementation that decompresses LZ4 (https://lz4.github.io/lz4/) data.

Definition at line 194 of file reader.hpp.

#include <reader.hpp>

Inheritance diagram for mcap::LZ4Reader:
[legend]

Public Member Functions

void reset (const std::byte *data, uint64_t size, uint64_t uncompressedSize) override
 Reset the reader state, clearing any internal buffers and state, and initialize with new compressed data.
 
uint64_t read (std::byte **output, uint64_t offset, uint64_t size) override
 This method is called by MCAP reader classes when they need to read a portion of the file.
 
uint64_t size () const override
 Returns the size of the file in bytes.
 
Status status () const override
 Report the current status of decompression. A StatusCode other than StatusCode::Success after reset() is called indicates the decompression was not successful and the reader is in an invalid state.
 
Status decompressAll (const std::byte *data, uint64_t size, uint64_t uncompressedSize, ByteArray *output)
 Decompresses an entire LZ4-encoded chunk into output.
 
 LZ4Reader ()
 
 LZ4Reader (const LZ4Reader &)=delete
 
LZ4Readeroperator= (const LZ4Reader &)=delete
 
 LZ4Reader (LZ4Reader &&)=delete
 
LZ4Readeroperator= (LZ4Reader &&)=delete
 
 ~LZ4Reader () override
 

Private Attributes

void * decompressionContext_ = nullptr
 
Status status_
 
const std::bytecompressedData_
 
ByteArray uncompressedData_
 
uint64_t compressedSize_
 
uint64_t uncompressedSize_
 

Constructor & Destructor Documentation

◆ LZ4Reader() [1/3]

mcap::LZ4Reader::LZ4Reader ( )

Definition at line 127 of file reader.inl.

◆ LZ4Reader() [2/3]

mcap::LZ4Reader::LZ4Reader ( const LZ4Reader )
delete

◆ LZ4Reader() [3/3]

mcap::LZ4Reader::LZ4Reader ( LZ4Reader &&  )
delete

◆ ~LZ4Reader()

mcap::LZ4Reader::~LZ4Reader ( )
override

Definition at line 138 of file reader.inl.

Member Function Documentation

◆ decompressAll()

Status mcap::LZ4Reader::decompressAll ( const std::byte data,
uint64_t  size,
uint64_t  uncompressedSize,
ByteArray output 
)

Decompresses an entire LZ4-encoded chunk into output.

Parameters
dataThe LZ4-compressed input chunk.
sizeThe size of the LZ4-compressed input.
uncompressedSizeThe size of the data once uncompressed.
outputThe output vector. This will be resized to uncompressedSize to fit the data, or 0 if the decompression encountered an error.
Returns
Status

Definition at line 171 of file reader.inl.

◆ operator=() [1/2]

LZ4Reader & mcap::LZ4Reader::operator= ( const LZ4Reader )
delete

◆ operator=() [2/2]

LZ4Reader & mcap::LZ4Reader::operator= ( LZ4Reader &&  )
delete

◆ read()

uint64_t mcap::LZ4Reader::read ( std::byte **  output,
uint64_t  offset,
uint64_t  size 
)
overridevirtual

This method is called by MCAP reader classes when they need to read a portion of the file.

Parameters
outputA pointer to a pointer to the buffer to write to. This method is expected to either maintain an internal buffer, read data into it, and update this pointer to point at the internal buffer, or update this pointer to point directly at the source data if possible. The pointer and data must remain valid and unmodified until the next call to read().
offsetThe offset in bytes from the beginning of the file to read.
sizeThe number of bytes to read.
Returns
uint64_t Number of bytes actually read. This may be less than the requested size if the end of the file is reached. The output pointer must be readable from output to output + size. If the read fails, this method should return 0.

Implements mcap::IReadable.

Definition at line 154 of file reader.inl.

◆ reset()

void mcap::LZ4Reader::reset ( const std::byte data,
uint64_t  size,
uint64_t  uncompressedSize 
)
overridevirtual

Reset the reader state, clearing any internal buffers and state, and initialize with new compressed data.

Parameters
dataCompressed data to read from.
sizeSize of the compressed data in bytes.
uncompressedSizeSize of the data in bytes after decompression. A buffer of this size will be allocated for the uncompressed data.

Implements mcap::ICompressedReader.

Definition at line 144 of file reader.inl.

◆ size()

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

Returns the size of the file in bytes.

Returns
uint64_t The total number of bytes in the MCAP file.

Implements mcap::IReadable.

Definition at line 164 of file reader.inl.

◆ status()

Status mcap::LZ4Reader::status ( ) const
overridevirtual

Report the current status of decompression. A StatusCode other than StatusCode::Success after reset() is called indicates the decompression was not successful and the reader is in an invalid state.

Implements mcap::ICompressedReader.

Definition at line 168 of file reader.inl.

Member Data Documentation

◆ compressedData_

const std::byte* mcap::LZ4Reader::compressedData_
private

Definition at line 223 of file reader.hpp.

◆ compressedSize_

uint64_t mcap::LZ4Reader::compressedSize_
private

Definition at line 225 of file reader.hpp.

◆ decompressionContext_

void* mcap::LZ4Reader::decompressionContext_ = nullptr
private

Definition at line 221 of file reader.hpp.

◆ status_

Status mcap::LZ4Reader::status_
private

Definition at line 222 of file reader.hpp.

◆ uncompressedData_

ByteArray mcap::LZ4Reader::uncompressedData_
private

Definition at line 224 of file reader.hpp.

◆ uncompressedSize_

uint64_t mcap::LZ4Reader::uncompressedSize_
private

Definition at line 226 of file reader.hpp.


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