Public Member Functions | Private Attributes | List of all members
mcap::FileStreamReader Class Referencefinal

IReadable implementation wrapping a std::ifstream input file stream. More...

#include <reader.hpp>

Inheritance diagram for mcap::FileStreamReader:
Inheritance graph
[legend]

Public Member Functions

 FileStreamReader (std::ifstream &stream)
 
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. More...
 
uint64_t size () const override
 Returns the size of the file in bytes. More...
 
- Public Member Functions inherited from mcap::IReadable
virtual ~IReadable ()=default
 

Private Attributes

std::vector< std::byte > buffer_
 
uint64_t position_
 
uint64_t size_
 
std::ifstream & stream_
 

Detailed Description

IReadable implementation wrapping a std::ifstream input file stream.

Definition at line 92 of file reader.hpp.

Constructor & Destructor Documentation

◆ FileStreamReader()

mcap::FileStreamReader::FileStreamReader ( std::ifstream &  stream)

Member Function Documentation

◆ read()

uint64_t mcap::FileStreamReader::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.

◆ size()

uint64_t mcap::FileStreamReader::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.

Member Data Documentation

◆ buffer_

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

Definition at line 101 of file reader.hpp.

◆ position_

uint64_t mcap::FileStreamReader::position_
private

Definition at line 103 of file reader.hpp.

◆ size_

uint64_t mcap::FileStreamReader::size_
private

Definition at line 102 of file reader.hpp.

◆ stream_

std::ifstream& mcap::FileStreamReader::stream_
private

Definition at line 100 of file reader.hpp.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:52