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 () noexcept |
Create a new (valueless) event. | |
PhysicalEvent (std::string_view name, ReactorContext context) | |
Construct a new PhysicalEvent . | |
void | trigger (const ImmutableValuePtr< void > &value) noexcept |
Create a new event. | |
void | trigger (MutableValuePtr< void > &&value_ptr) |
void | trigger (const void &value) |
void | trigger (void &&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 | ~Element ()=default |
Virtual destructor. | |
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.
This specialization is used for physical events that do not convey any values.
xronos::sdk::PhysicalEvent< void >::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. |
xronos::sdk::PhysicalEvent< void >::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 (valueless) event.
This will automatically assign a timestamp to the newly created event.
|
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< void >::trigger | ( | MutableValuePtr< void > && | 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< void >::trigger | ( | const void & | 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< void >::trigger | ( | void && | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.