Struct IReadable
Defined in File reader.hpp
Inheritance Relationships
Derived Types
public mcap::FileReader(Class FileReader)public mcap::FileStreamReader(Class FileStreamReader)public mcap::ICompressedReader(Class ICompressedReader)
Struct Documentation
-
struct IReadable
An abstract interface for reading MCAP data.
Subclassed by mcap::FileReader, mcap::FileStreamReader, mcap::ICompressedReader
Public Functions
-
virtual ~IReadable() = default
-
virtual uint64_t size() const = 0
Returns the size of the file in bytes.
- Returns:
uint64_t The total number of bytes in the MCAP file.
-
virtual uint64_t read(std::byte **output, uint64_t offset, uint64_t size) = 0
This method is called by MCAP reader classes when they need to read a portion of the file.
- Parameters:
output – A 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().
offset – The offset in bytes from the beginning of the file to read.
size – The 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
outputtooutput + size. If the read fails, this method should return 0.
-
virtual ~IReadable() = default