Allows a reaction to write data to a given port. More...
#include <xronos/sdk/reaction.hh>
Public Member Functions | |
| template<template< class > class Serializer> | |
| PortEffect (InputPort< T, Serializer > &port, const ReactionContext &context) | |
| Constructor. | |
| template<template< class > class Serializer> | |
| PortEffect (OutputPort< T, Serializer > &port, const ReactionContext &context) | |
| 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 -> ValueView< T > requires(!std::is_same_v< T, void >) |
| Get a view of a previously set value. | |
| auto | is_present () const noexcept -> bool |
| Check if an event is currently present. | |
| void | set () |
| 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) |
| Write a value to the port, sending a message to connected ports. | |
| void | set (const Value< 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 | set (const ValueView< T > &view) |
| 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. | |
Allows a reaction to write data to a given port.
| T | The value type associated with the port. |
| xronos::sdk::BaseReaction::PortEffect< T >::PortEffect | ( | InputPort< T, Serializer > & | port, |
| const ReactionContext & | context ) |
Constructor.
| port | The port for which the reaction should have write access. |
| context | The context of the reaction the effect is declared for. Can be obtained using context(). |
|
nodiscardnoexcept |
|
nodiscardnoexcept |
Check if an event is currently present.
| 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.
| void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | const U & | value | ) |
Write a value to the port, sending a message to connected ports.
May be called multiple times, but at most one message is sent to connected ports at any given timestamp: when called repeatedly, the previously written value is replaced.
| value | The value to be written to the referenced port. Copy constructs the value from the given lvalue reference. |
| ValidationError | If called before execution has started. |
| void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | const Value< T > & | value | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sends the given value without copying it. The value must not be empty (asserted in debug builds); nothing is sent otherwise.
| void xronos::sdk::BaseReaction::PortEffect< T >::set | ( | const ValueView< T > & | view | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sends the viewed value without copying it. Use this to relay a value received on a trigger. The view must not be absent (asserted in debug builds); nothing is sent otherwise.
| 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.