5#include "roo_logging.h"
16 : loc_(), store_(store), key_(key), synced_(false) {}
32 if (loc_ == loc)
return;
50 friend roo_logging::Stream&
operator<<(roo_logging::Stream& os,
59 mutable SensorLocator loc_;
70 : universe_(universe), binding_(binding) {}
76 return universe_.
read(loc);
82 friend roo_logging::Stream&
operator<<(roo_logging::Stream& os,
92 : loc_(), store_(store), key_(key), synced_(false) {}
108 if (loc_ == loc)
return;
126 friend roo_logging::Stream&
operator<<(roo_logging::Stream& os,
135 mutable ActuatorLocator loc_;
137 BindingStore& store_;
140 mutable bool synced_;
146 : universe_(universe), binding_(binding) {}
152 return universe_.
write(loc, value);
158 friend roo_logging::Stream&
operator<<(roo_logging::Stream& os,
169 : universe_(universe), binding_(binding) {}
176 return universe_.
read(sensor_loc);
185 return universe_.
write(loc, value);
191 friend roo_logging::Stream&
operator<<(roo_logging::Stream& os,
ActuatorBinding(BindingStore &store, BindingStore::ActuatorKey key)
friend roo_logging::Stream & operator<<(roo_logging::Stream &os, const ActuatorBinding &binding)
void bind(const ActuatorLocator &loc)
Binds to the specified locator (or unbinds when undefined).
bool isBound() const
Returns true when a locator is bound.
ActuatorLocator get() const
Returns the bound locator (empty if unbound).
void unbind()
Clears the binding.
Identifies actuator within a transceiver device.
const DeviceLocator & device_locator() const
Returns the device locator.
bool isDefined() const
Returns true if the locator is defined.
const ActuatorId & actuator_id() const
Returns the actuator id.
virtual SensorLocator getSensorBinding(SensorKey key)=0
virtual void setActuatorBinding(ActuatorKey key, const ActuatorLocator &locator)=0
virtual void setSensorBinding(SensorKey key, const SensorLocator &locator)=0
virtual void clearActuatorBinding(ActuatorKey key)=0
virtual void clearSensorBinding(SensorKey key)=0
virtual ActuatorLocator getActuatorBinding(ActuatorKey key)=0
BoundActuator(Universe &universe, const ActuatorBinding *binding)
friend roo_logging::Stream & operator<<(roo_logging::Stream &os, const BoundActuator &actuator)
bool write(float value) const
Writes to the bound actuator, if any.
Adapter for actuators that can be read, using actuator id as sensor id.
BoundSensingActuator(Universe &universe, const ActuatorBinding *binding)
bool write(float value) const
Writes to the bound actuator.
friend roo_logging::Stream & operator<<(roo_logging::Stream &os, const BoundSensingActuator &actuator)
Measurement read() const
Reads from the bound actuator as a sensor.
BoundSensor(Universe &universe, const SensorBinding *binding)
Measurement read() const
Reads the bound sensor or returns an initial measurement if unbound.
friend roo_logging::Stream & operator<<(roo_logging::Stream &os, const BoundSensor &sensor)
Measurement of a quantity at a specific time.
Persistent binding of a sensor key to a locator.
bool isBound() const
Returns true when a locator is bound.
friend roo_logging::Stream & operator<<(roo_logging::Stream &os, const SensorBinding &binding)
void bind(const SensorLocator &loc)
Binds to the specified locator (or unbinds when undefined).
SensorBinding(BindingStore &store, BindingStore::SensorKey key)
void unbind()
Clears the binding.
SensorLocator get() const
Returns the bound locator (empty if unbound).
Identifies sensor within a transceiver device.
bool isDefined() const
Returns true if the locator is defined.
An abstract collection of transceiver devices.
virtual bool write(const ActuatorLocator &locator, float value)=0
Writes to the actuator identified by locator.
virtual Measurement read(const SensorLocator &locator) const =0
Returns the latest known reading of the sensor identified by locator.