Class MemoryMappedOsfFile

Inheritance Relationships

Base Type

Class Documentation

class MemoryMappedOsfFile : public ouster::sdk::osf::OsfFile

Memory-mapped OSF file implementation.

This class provides an interface to read from an OSF file using memory-mapped I/O, allowing efficient access to the file’s contents without loading the entire file into memory.

Public Functions

MemoryMappedOsfFile(const std::string &filename)

Construct a memory-mapped view of the given OSF file.

Parameters:

filename[in] – Path to the OSF file to be memory-mapped.

~MemoryMappedOsfFile() override
virtual void close() override

Un-maps memory and essentially invalidates the memory addresses that might be captured within MessageRefs and Reader.

MemoryMappedOsfFile(MemoryMappedOsfFile&&) noexcept

Move constructor.

MemoryMappedOsfFile &operator=(MemoryMappedOsfFile&&) noexcept
virtual OsfBuffer read(OsfOffset offset) override

Read a buffer from the OSF file at a given offset.

Reads a contiguous block of data starting at the specified offset within the OSF file.

Parameters:

offset[in] – Byte offset from the beginning of the file.

Throws:

std::out_of_range – if the offset exceeds file size or is invalid.

Returns:

An OsfBuffer containing the requested data.

virtual OsfBuffer read(OsfOffset base_offset, OsfOffset offset) override

Read a buffer from the OSF file relative to a base offset.

Computes the absolute position as base_offset + offset and reads data starting from that location.

Parameters:
  • base_offset[in] – Starting reference offset within the file.

  • offset[in] – Relative offset from the base offset.

Throws:

std::out_of_range – if the offset exceeds file size or is invalid.

Returns:

An OsfBuffer containing the requested data.

inline virtual uint64_t size() const override

Returns the size of the OSF file.

Returns:

The size of the OSF file in bytes.