EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
eduart::sensorring::device::Group< T > Class Template Reference

Typed wrapper over a vector of device pointers. More...

#include <Group.hpp>

Classes

class  iterator
class  const_iterator
 Const dereferencing iterator so range-for over a const Group<T> yields const T&. More...

Public Member Functions

 Group (std::vector< T * > devices)
T & operator[] (std::size_t i)
 Access device by index (returns reference).
const T & operator[] (std::size_t i) const
std::size_t size () const
 Number of devices in this group.
bool empty () const
 Whether the group is empty.
std::vector< T * > get () const
 Get the underlying vector of device pointers.
iterator begin ()
 Begin iterator (mutable).
iterator end ()
 Past-the-end iterator (mutable).
const_iterator begin () const
 Begin iterator (const).
const_iterator end () const
 Past-the-end iterator (const).
template<typename U = T, typename = typename U::MeasurementType>
subscription::Subscription subscribe (std::function< void(const typename U::MeasurementType &)> callback)
 Subscribe to all devices in the group.
template<typename U = T, typename = typename U::MeasurementType>
subscription::Subscription subscribeAll (std::function< void(const std::vector< typename U::MeasurementType > &)> callback)
 Subscribe to all devices in the group with synchronized frame delivery.

Detailed Description

template<typename T>
class eduart::sensorring::device::Group< T >

Typed wrapper over a vector of device pointers.

Provides iteration (range-for yields T&) and a subscribe() method that subscribes to all devices in the group at once. Returned Subscription manages all individual subscriptions and cancels them collectively.

Template Parameters
TDevice interface type (DepthSensor, ThermalSensor, Light, …).

Member Function Documentation

◆ subscribe()

template<typename T>
template<typename U = T, typename = typename U::MeasurementType>
subscription::Subscription eduart::sensorring::device::Group< T >::subscribe ( std::function< void(const typename U::MeasurementType &)> callback)
inline

Subscribe to all devices in the group.

Returns a single Subscription that manages all individual subscriptions. When cancelled or destroyed, all subscriptions are cancelled.

Only available when T defines a MeasurementType alias (e.g. DepthSensor, ThermalSensor).

Parameters
[in]callbackInvoked for each measurement from each device.
Returns
RAII Subscription managing all individual subscriptions.

◆ subscribeAll()

template<typename T>
template<typename U = T, typename = typename U::MeasurementType>
subscription::Subscription eduart::sensorring::device::Group< T >::subscribeAll ( std::function< void(const std::vector< typename U::MeasurementType > &)> callback)
inline

Subscribe to all devices in the group with synchronized frame delivery.

The callback is invoked once per complete frame — i.e. only after every device in the group has produced a new measurement. The callback receives a vector containing exactly one measurement per device (ordered by device index). The effective callback rate equals the rate of the slowest device in the group.

Only available when T defines a MeasurementType alias (e.g. DepthSensor, ThermalSensor).

Parameters
[in]callbackInvoked with a complete frame (one measurement per device, ordered by index).
Returns
RAII Subscription managing all individual subscriptions.

The documentation for this class was generated from the following file: