Class StreamOsfFile

Inheritance Relationships

Base Type

Class Documentation

class StreamOsfFile : public ouster::sdk::osf::OsfFile

OSF file reader using standard file streams.

Provides a stream-based implementation of the OsfFile interface, enabling efficient reading of OSF file content without memory-mapping or loading the full file into memory.

This implementation uses std::ifstream to support seeking and reading arbitrary byte ranges, such as metadata and chunked sensor data.

Public Functions

StreamOsfFile(const std::string &filename)

Construct a new StreamOsfFile from the given filename.

Opens the file for binary input and initializes header and metadata buffers.

Parameters:

filename[in] – Path to the OSF file.

~StreamOsfFile() override
StreamOsfFile(StreamOsfFile&&)

Move constructor.

Transfers ownership of file stream and state from another instance.

StreamOsfFile &operator=(StreamOsfFile&&)
virtual void close() override

Clears file handle and allocated resources.

See also

ouster::osf::MessageRef, ouster::osf::Reader

virtual OsfBuffer read(OsfOffset offset) override

Read the following span of bytes (represented by OsfOffset) into the provided OsfBuffer.

Throws:

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

Parameters:

offset[in] The offset and number of bytes to read.

Returns:

an OsfBuffer initialized with the data specified by the offset.

virtual OsfBuffer read(OsfOffset base_offset, OsfOffset offset) override

Read the following span of bytes (represented by OsfOffset) using the provided base offset into the provided OsfBuffer.

Throws:

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

Parameters:
  • offset[in] The offset and number of bytes to read.

  • base_offset[in]

Returns:

an OsfBuffer initialized with the data specified by the offset.

virtual uint64_t size() const override

Returns the size of the OSF file.

Returns:

The size of the OSF file in bytes.