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

Access to a port that this reaction may write to. More...

#include <xronos/sdk/reaction.hh>

Public Member Functions

 PortEffect (Port< T > &port, ReactionContext context)
 Construct a new PortEffect object.
 
void set (const ImmutableValuePtr< T > &value_ptr)
 Set the port value and send a message to connected ports.
 
void set (MutableValuePtr< T > &&value_ptr)
 
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void set (const U &value)
 
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void set (U &&value)
 
void set ()
 Set the port without sending any value to connected ports.
 

Detailed Description

template<class T>
class xronos::sdk::BaseReaction::PortEffect< T >

Access to a port that this reaction may write to.

Template Parameters
TThe type of value carried by the port.

Constructor & Destructor Documentation

◆ PortEffect()

template<class T>
xronos::sdk::BaseReaction::PortEffect< T >::PortEffect ( Port< T > & port,
ReactionContext context )

Construct a new PortEffect object.

Parameters
portAn port of the containing reactor, which can be obtained using the Reaction::self method.
contextThe current reaction's initialization context, which can be obtained using the BaseReaction::context method.

Member Function Documentation

◆ set() [1/4]

template<class T>
void xronos::sdk::BaseReaction::PortEffect< T >::set ( const ImmutableValuePtr< T > & value_ptr)

Set the port value and send a message to connected ports.

Can be called multiple times, but at each time at most one value is sent to connected ports. When called repeatedly at a given timestamp, the previous value is overwritten.

Parameters
value_ptrA pointer to the value to be written to the referenced port.

◆ set() [2/4]

template<class T>
void xronos::sdk::BaseReaction::PortEffect< T >::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.

◆ set() [3/4]

template<class T>
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
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.

◆ set() [4/4]

template<class T>
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
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.


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