RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::SimulationSensor< T > Class Template Referencefinal

A sensor whose reading and connection are set directly, for tests. More...

#include <SimulationSensor.hpp>

Inheritance diagram for rz::SimulationSensor< T >:
rz::Sensor< T >

Public Member Functions

void set (T value)
void disconnect ()
void reconnect (T value)
 Reconnects, optionally with a new reading (as if the device power-cycled).
bool connected () const override
Public Member Functions inherited from rz::Sensor< T >
 Sensor ()=default
 Sensor (const Sensor &)=delete
Sensor & operator= (const Sensor &)=delete
 Sensor (Sensor &&)=delete
Sensor & operator= (Sensor &&)=delete
virtual ~Sensor ()=default
T get ()
 The current reading. The last good value while disconnected.
T delta ()
 Change since the previous snapshot (covers several ticks if nobody read in between).

Protected Member Functions

T raw () const override
 This tick's reading from the source; the last good value while disconnected. May restart after a reconnect.
std::uint32_t epoch () const override
 Increments every time the source reconnects. Readings across a reconnect are not comparable.

Detailed Description

template<class T>
class rz::SimulationSensor< T >

A sensor whose reading and connection are set directly, for tests.

Member Function Documentation

◆ connected()

template<class T>
bool rz::SimulationSensor< T >::connected ( ) const
inlinenodiscardoverridevirtual

Implements rz::Sensor< T >.

◆ disconnect()

template<class T>
void rz::SimulationSensor< T >::disconnect ( )
inline

◆ epoch()

template<class T>
std::uint32_t rz::SimulationSensor< T >::epoch ( ) const
inlinenodiscardoverrideprotectedvirtual

Increments every time the source reconnects. Readings across a reconnect are not comparable.

Reimplemented from rz::Sensor< T >.

◆ raw()

template<class T>
T rz::SimulationSensor< T >::raw ( ) const
inlinenodiscardoverrideprotectedvirtual

This tick's reading from the source; the last good value while disconnected. May restart after a reconnect.

Implements rz::Sensor< T >.

◆ reconnect()

template<class T>
void rz::SimulationSensor< T >::reconnect ( T value)
inline

Reconnects, optionally with a new reading (as if the device power-cycled).

◆ set()

template<class T>
void rz::SimulationSensor< T >::set ( T value)
inline

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