Class Reader

Inheritance Relationships

Base Type

Class Documentation

class Reader : public ouster::sdk::osf::ReaderBase

OSF Reader that simply reads sequentially messages from the OSF file.

Public Functions

Reader(std::unique_ptr<OsfFile> osf_file, const error_handler_t &error_handler = default_error_handler)

Creates reader from OSF file resource.

Parameters:
  • osf_file[in] – The OsfFile object to use to read from.

  • error_handler[in] – An optional callback that serves as an error handler.

Reader(const std::string &file, const error_handler_t &error_handler = default_error_handler)

Creates reader from OSF file name.

Parameters:
  • file[in] – The OSF file path to read from.

  • error_handler[in] – An optional callback that serves as an error handler.

MessagesStreamingRange messages()

Reads the messages from the first OSF chunk in sequental order till the end.

Doesn’t support RandomAccess.

Throws:

std::logic_error – Exception on not having sensor_info.

Returns:

The MessageStreamingRange object to iterate through the messages.

MessagesStreamingRange messages(const ts_t start_ts, const ts_t end_ts)

Reads the messages from the first OSF chunk in sequental order till the end.

Doesn’t support RandomAccess.

Throws:

std::logic_error – Exception on not having sensor_info.

Parameters:
  • start_ts[in] Specify the start of the timestamps that should be iterated through.

  • end_ts[in] Specify the end of the timestamps that should be iterated through.

Returns:

The MessageStreamingRange object to iterate through the messages.

MessagesStreamingRange messages(const std::vector<uint32_t> &stream_ids)

Reads the messages from the first OSF chunk in sequental order till the end.

Doesn’t support RandomAccess.

Throws:

std::logic_error – Exception on not having sensor_info.

Parameters:

stream_ids[in] Filter the message iteration to specific streams.

Returns:

The MessageStreamingRange object to iterate through the messages.

MessagesStreamingRange messages(const std::vector<uint32_t> &stream_ids, const ts_t start_ts, const ts_t end_ts)

Reads the messages from the first OSF chunk in sequental order till the end.

Doesn’t support RandomAccess.

Throws:

std::logic_error – Exception on not having sensor_info.

Parameters:
  • start_ts[in] Specify the start of the timestamps that should be iterated through.

  • end_ts[in] Specify the end of the timestamps that should be iterated through.

  • stream_ids[in] Filter the message iteration to specific streams.

Returns:

The MessageStreamingRange object to iterate through the messages.

nonstd::optional<ts_t> ts_by_message_idx(uint32_t stream_id, uint32_t message_idx)

Find the timestamp of the message by its index and stream_id.

Requires the OSF with message_counts inside, i.e. has_message_idx() return True, otherwise return value is always empty (nullopt).

Throws:

std::logic_error – Exception on not having sensor_info.

Parameters:
  • stream_id[in] stream id on which the message_idx search is performed

  • message_idx[in] the message index (i.e. rank/number) to search for

Returns:

message timestamp that corresponds to the message_idx in the stream_id

ChunksRange chunks()

Reads chunks and returns the iterator to valid chunks only.

NOTE: Every chunk is read in full and validated. (i.e. it’s not just iterator over chunks index)

Returns:

The iterator to valid chunks only.