Class Slicer

Inheritance Relationships

Base Type

Class Documentation

class Slicer : public ouster::sdk::core::ScanSource

ScanSource that slices a given ScanSource.

Public Functions

Slicer(const ScanSource &source, int start, int end, int step)

Slice the provided source with the provided bounds.

Parameters:
  • source[in] source to slice

  • start[in] start index of slice

  • end[in] end index of slice

  • step[in] step size of slice

Slicer(ScanSource &&source, int start, int end, int step)

Slice the provided source with the provided bounds.

Parameters:
  • source[in] – source to slice

  • start[in] – start index of slice

  • end[in] – end index of slice

  • step[in] – step size of slice

Slicer(Slicer &&source) = default

Move constructor for Slicer.

Parameters:

source[in] – The Slicer instance to move from.

virtual ScanIterator begin() const override

Provides each scan from all sensors in time order.

Returns:

start iterator for all sensors

virtual ScanIterator begin(int idx) const override

Provides scans from a single sensor in time order If idx < 0 provides scans 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 std::unique_ptr<ScanSource> move() override

move into a newly allocated item

Returns:

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

virtual bool is_live() const override

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

Returns:

if live or not

virtual bool is_indexed() const override

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

Returns:

if indexed or not

virtual size_t size_hint() const override

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 const std::vector<size_t> &scans_num() const override

Get the scan count for each sensor in the file.

Throws:

std::runtime_error – if unindexed

Returns:

scan count for each sensor in the file

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

Get the sensor info for each sensor in this dataset.

Returns:

sensor info for each sensor

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

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

Throws:

std::runtime_error – if unindexed

Returns:

index

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

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

Throws:

std::runtime_error – if unindexed

Returns:

index