Allows a reaction to write data to a given Port. More...
#include <xronos/sdk/reaction.hh>
Public Member Functions | |
PortEffect (Port< T > &port, ReactionContext context) | |
Constructor. | |
void | set (const ImmutableValuePtr< T > &value_ptr) |
Write a value to the port sending a message to connected ports. | |
void | set (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. | |
template<class U> requires (!std::is_same_v<U, void> && std::is_same_v<T, U>) | |
void | set (const U &value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<class U> requires (!std::is_same_v<U, void> && std::is_same_v<T, U>) | |
void | set (U &&value) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | set () |
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 -> ImmutableValuePtr< T > requires(!std::is_same_v< T, void >) |
Get a previously set value. | |
auto | is_present () const noexcept -> bool |
Check if an event is present at the current timestamp. |
Allows a reaction to write data to a given Port.
T | The value type associated with the port. |
xronos::sdk::BaseReaction::PortEffect< T >::PortEffect | ( | Port< T > & | port, |
ReactionContext | context ) |
void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | const ImmutableValuePtr< T > & | value_ptr | ) |
Write a value to the port sending a message to connected ports.
May be called multiple times, but at most one value is sent to connected ports. When called repeatedly at a given timestamp, the previous value is overwritten.
value_ptr | A pointer to the value to be written to the referenced port. |
void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | const U & | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Copy constructs the value using the given lvalue reference.
void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | U && | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Move constructs the value using the given rvalue reference.
void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Set the port without sending a value. This is only available if T is void.
|
nodiscardnoexcept |
Get a previously set value.
|
nodiscardnoexcept |
Check if an event is present at the current timestamp.