Declares a reaction trigger and provides read access to the triggering event source.
More...
#include <xronos/sdk/reaction.hh>
|
| template<template< class > class Serializer> |
| | Trigger (const InputPort< T, Serializer > &trigger, const ReactionContext &context) |
| | Constructor.
|
|
template<template< class > class Serializer> |
| | Trigger (const OutputPort< T, Serializer > &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| Trigger (const PeriodicTimer &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| Trigger (const PhysicalEvent< T > &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| Trigger (const ProgrammableTimer< T > &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| Trigger (const Shutdown &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
| Trigger (const Startup &trigger, const ReactionContext &context) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| auto | get () const noexcept -> ValueView< T > requires(!std::is_same_v< T, void >) |
| | Get a view of the current event's value.
|
| auto | is_present () const noexcept -> bool |
| | Check if an event is currently present.
|
template<class T>
class xronos::sdk::BaseReaction::Trigger< T >
Declares a reaction trigger and provides read access to the triggering event source.
- Template Parameters
-
| T | The value type associated with events received on the triggering event source. |
◆ Trigger()
template<class T>
template<template< class > class Serializer>
Constructor.
Constructing a Trigger automatically registers the given event source as a trigger of the reaction, causing the reaction handler to run whenever the event source emits an event.
- Parameters
-
| trigger | An event source that should trigger the reaction. |
| context | Context of the reaction the trigger is declared for. Can be obtained using context(). |
◆ get()
Get a view of the current event's value.
- Returns
- A ValueView of the current event's value. The view is absent (evaluates to false) if no event is present. The view is only valid for the duration of the current reaction handler; copy it into a Value to keep it alive beyond that.
◆ is_present()
Check if an event is currently present.
- Returns
- true if an event is present, false otherwise.
The documentation for this class was generated from the following file: