An element for scheduling new events from external contexts. More...
#include <xronos/sdk/physical_event.hh>
Public Member Functions | |
PhysicalEvent (std::string_view name, ReactorContext context) | |
Construct a new PhysicalEvent . | |
void | trigger (const ImmutableValuePtr< T > &value) noexcept |
Create a new event. | |
void | trigger (MutableValuePtr< T > &&value_ptr) |
void | trigger (const T &value) |
void | trigger (T &&value) |
![]() | |
auto | name () const noexcept -> const std::string & |
The name of the current element. | |
auto | fqn () const noexcept -> const std::string & |
The fully qualified name of the current element. | |
![]() | |
virtual | ~EventSource ()=default |
Correct deletion of an instance of a derived class is permitted. | |
An element for scheduling new events from external contexts.
Physical events may be used to schedule new events from an external context outside of the scope of the reactor program. These could be external event handlers that respond to sensor inputs. Physical events do not provide direct access to their values. A reaction may declare a BaseReaction::Trigger
or BaseReaction::Source
to access the value associated with an active event.
T | The type of values carried by the event. |
xronos::sdk::PhysicalEvent< T >::PhysicalEvent | ( | std::string_view | name, |
ReactorContext | context ) |
Construct a new PhysicalEvent
.
name | The name of the PhysicalEvent . |
context | The context object obtained from the PhysicalEvent 's containing reactor. |
|
noexcept |
Create a new event.
This will automatically assign a timestamp to the newly created event. This timestamp will be derived from the system clock and will align with real time on a best-effort basis.
value | A value to be associated with the newly created event. |
void xronos::sdk::PhysicalEvent< T >::trigger | ( | MutableValuePtr< T > && | value_ptr | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void xronos::sdk::PhysicalEvent< T >::trigger | ( | const T & | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void xronos::sdk::PhysicalEvent< T >::trigger | ( | T && | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.