Access to a reactor element that triggers the reaction and that it may read. More...
#include <xronos/sdk/reaction.hh>
Public Member Functions | |
Trigger (const EventSource< T > &trigger, ReactionContext context) | |
Construct a new Trigger object. | |
auto | get () const noexcept -> ImmutableValuePtr< T > requires(!std::is_same_v< T, void >) |
Get the value of a currently present event. | |
auto | is_present () const noexcept -> bool |
Check if an event is present at the current timestamp. | |
Access to a reactor element that triggers the reaction and that it may read.
T | The type of value carried by the trigger. |
xronos::sdk::BaseReaction::Trigger< T >::Trigger | ( | const EventSource< T > & | trigger, |
ReactionContext | context ) |
Construct a new Trigger object.
Constructing a Trigger object ensures that the corresponding reaction is invoked for every event on the given event source.
trigger | An event source of the containing reactor, which can be obtained using the Reaction::self method. |
context | The current reaction's initialization context, which can be obtained using the BaseReaction::context method. |
|
nodiscardnoexcept |
Get the value of a currently present event.
nullptr
if there is no present event.
|
nodiscardnoexcept |
Check if an event is present at the current timestamp.
true
if an event is present, false
otherwise.