Class FrameSetSource

Inheritance Relationships

Derived Types

Class Documentation

class FrameSetSource

Provides a base API for classes that provide access to frames in a file.

Subclassed by ouster::sdk::core::FrameSetSourceWrapper, ouster::sdk::core::MultiFrameSetSource, ouster::sdk::osf::OsfFrameSetSource, ouster::sdk::pcap::PcapFrameSetSource, ouster::sdk::sensor::SensorFrameSetSource

Public Functions

virtual ~FrameSetSource() = default
virtual FrameSetIterator begin() const = 0

Provides each frame from all sensors in time order.

Returns:

start iterator for all sensors

virtual FrameSetIterator begin(int sensor_index) const = 0

Provides frames from a single sensor in time order If idx < 0 provides frames from all sensors.

Parameters:
  • sensor_index[in] sensor index

  • sensor_index[in] sensor index

Throws:

std::runtime_error – if sensor_idx >= number of sensors

Returns:

start iterator for the sensor with the given index

virtual FrameSetIterator end() const

Return the end iterator.

Returns:

end iterator

virtual const std::vector<std::shared_ptr<SensorInfo>> &sensor_info() const = 0

Get the sensor info for each sensor in this dataset.

Returns:

sensor info for each sensor

virtual bool is_live() const

Indicates if the source is streaming from a device, such as a sensor.

Returns:

if live or not

virtual bool is_indexed() const

Indicates if the source contains an index for fast random access.

Returns:

if indexed or not

virtual size_t size_hint() const = 0

The approximate length of the source if unindexed, or the real size if indexed.

Live sources or sources with undefined length will return 0.

Returns:

approximate length of source

virtual size_t size() const

The length of the source from begin to end.

For example: If uncollated this is the total number of frames in the source, if collated this is the number of frame collations.

Throws:

std::runtime_error – if unindexed

Returns:

length of the source

virtual const std::vector<size_t> &frames_num() const

Get the frame count for each sensor in the file.

Throws:

std::runtime_error – if unindexed

Returns:

frame count for each sensor in the file

virtual const std::vector<size_t> &scans_num() const

Deprecated:

Use frames_num() instead

Deprecated:

Use “frames_num()” instead. The last supported version for this will be 1.0.0 .

Returns:

frame count for each sensor in the file

virtual FrameSet operator[](int index) const

Returns the Nth frame in time order Supports negative indices for python-like indexing behavior.

Parameters:

index[in] frame index

Returns:

frame at given index

virtual const std::vector<std::vector<std::pair<uint64_t, uint64_t>>> &individual_index() const

timestamp based index of all frames in the file for each sensor, each pair is timestamp followed by global frame index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual const std::vector<std::pair<uint64_t, uint64_t>> &full_index() const

timestamp based index of all frames in the file, each pair is timestamp followed by sensor index

Throws:

std::runtime_error – if unindexed

Returns:

index

virtual std::unique_ptr<FrameSetSource> move() = 0

move into a newly allocated item

Returns:

a unique pointer to a newly allocated FrameSetSource instance containing the moved-from state.

template<class T = Singler>
inline T single(int sensor_idx = 0) const &

Get only a single sensor’s stream from this source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

sensor_idx[in] Index of the sensor.

Returns:

singled frame set source

template<class T = Singler>
inline T single(int sensor_idx = 0) &&

Get only a single sensor’s stream from this source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

sensor_idx[in] Index of the sensor.

Returns:

singled frame set source

template<class T = Slicer>
inline T operator[](std::initializer_list<nonstd::optional<int>> l) const &

Slice a frame set source.

Template Parameters:

T – hack to allow usage of yet-undefined class. Do not change.

Parameters:

l[in] slice

Returns:

sliced frame set source

template<class T = Slicer>
inline T operator[](std::initializer_list<nonstd::optional<int>> l) &&
virtual bool has_metadata(const std::string &key) const

Check if the frame set source has metadata associated with a given key.

Parameters:

key[in] The key to check for in the metadata.

Returns:

True if the metadata contains the key, false otherwise.

virtual std::set<std::string> metadata_keys() const

Get the keys of the metadata entries associated with the frame set source.

Returns:

A set of strings representing the keys of the metadata entries.

virtual const FrameSetSourceMetadata &metadata(const std::string &name) const

Get the metadata entry associated with a given key.

Parameters:

name[in] The key of the metadata entry to retrieve.

Throws:

std::out_of_range – if the key is not found in the metadata.

Returns:

The metadata entry associated with the given key.

virtual bool is_collated() const

Check if the source provides collated frames.

Returns:

true if collations are provided.

virtual bool contains_collations() const

Check if the most underlying source stores collated frames.

Returns:

true if collations are stored.