Class CallbackOsfFile

Inheritance Relationships

Base Type

Class Documentation

class CallbackOsfFile : public ouster::sdk::osf::OsfFile

OSF file implementation that fetches data via a user-provided callback.

CallbackOsfFile allows reading data from an OSF file by delegating the data retrieval to a supplied callback function. This is useful for custom sources such as remote storage, streaming, or on-demand loading.

Public Types

using fetch_callback_t = std::function<OsfBuffer(OsfOffset offset)>

Type alias for the data fetch callback.

The callback takes an OsfOffset and returns an OsfBuffer containing the fetched data.

Param offset:

[in] Offset in the OSF file from which data should be fetched.

Return:

OsfBuffer Buffer containing the requested data.

Public Functions

CallbackOsfFile(fetch_callback_t callback, uint64_t file_size, const std::string &name_or_url = "Fetch OSF file")

Construct a CallbackOsfFile with a data fetch callback.

Parameters:
  • callback[in] Function to call to fetch data from the file.

  • file_size[in] Size of the OSF file in bytes.

  • name_or_url[in] Name or URL identifying the file source (optional).

~CallbackOsfFile()

Destructor for CallbackOsfFile.

CallbackOsfFile(CallbackOsfFile &&other)

Move constructor.

Parameters:

other[inout] Source object to move from.

CallbackOsfFile &operator=(CallbackOsfFile &&other)

Move assignment operator.

Parameters:

other[inout] Source object to move from.

Returns:

Reference to this object.

virtual OsfBuffer read(OsfOffset offset) override

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

Throws:

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

Parameters:

offset[in] Offset in the file to read from.

Returns:

OsfBuffer Buffer containing the read data.

virtual uint64_t size() const override

Returns the size of the OSF file.

Returns:

The size of the OSF file in bytes.

virtual OsfBuffer read(OsfOffset base_offset, OsfOffset offset) override

Read a buffer from the OSF file using a base and relative offset.

Throws:

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

Parameters:
  • base_offset[in] Base offset in the file.

  • offset[in] Relative offset to read from.

Returns:

OsfBuffer Buffer containing the read data.