xronos-sdk 0.2.0
Xronos C++ SDK
 
Loading...
Searching...
No Matches
xronos::sdk::PhysicalEvent< T > Class Template Reference

An element for scheduling new events from external contexts. More...

#include <xronos/sdk/physical_event.hh>

Inheritance diagram for xronos::sdk::PhysicalEvent< T >:
[legend]

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)
 
- Public Member Functions inherited from xronos::sdk::Element
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.
 
- Public Member Functions inherited from xronos::sdk::EventSource< T >
virtual ~EventSource ()=default
 Correct deletion of an instance of a derived class is permitted.
 

Detailed Description

template<class T>
class xronos::sdk::PhysicalEvent< T >

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.

Template Parameters
TThe type of values carried by the event.

Constructor & Destructor Documentation

◆ PhysicalEvent()

template<class T>
xronos::sdk::PhysicalEvent< T >::PhysicalEvent ( std::string_view name,
ReactorContext context )

Construct a new PhysicalEvent.

Parameters
nameThe name of the PhysicalEvent.
contextThe context object obtained from the PhysicalEvent's containing reactor.

Member Function Documentation

◆ trigger() [1/4]

template<class T>
void xronos::sdk::PhysicalEvent< T >::trigger ( const ImmutableValuePtr< T > & value)
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.

Parameters
valueA value to be associated with the newly created event.

◆ trigger() [2/4]

template<class T>
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.

◆ trigger() [3/4]

template<class T>
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.

◆ trigger() [4/4]

template<class T>
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.


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