MeVisLab Toolbox Reference
asio::ObservableConnection< Result, Args > Class Template Reference

Templated implementation of the asio::Connection interface for multi-input asynchronous pipelines using asio::Processable. More...

#include <ObservableConnection.h>

Inheritance diagram for asio::ObservableConnection< Result, Args >:
asio::Connection

Public Member Functions

 ObservableConnection ()=default
 
 ObservableConnection (ObservableConnectionInput< Args >... inputs, std::shared_ptr< Observable< Result > > target, std::shared_ptr< Processable< Result, Args... > > processable, std::unique_ptr< ExecutionPolicy > policy, bool muteUntilTargetSignalEmitted)
 
void suspend () override
 
void resume () override
 
- Public Member Functions inherited from asio::Connection
virtual ~Connection ()=default
 

Detailed Description

template<typename Result, typename... Args>
class asio::ObservableConnection< Result, Args >

Templated implementation of the asio::Connection interface for multi-input asynchronous pipelines using asio::Processable.

Synopsis:

template<typename T>
class ComplexCreator : public asio::Processable<std::complex<T>, T, T>
{
public:
std::complex<T> process(const T& real, const T& imag) override
{
return std::complex<T>{real, imag};
}
};
auto real_source = std::make_shared<DoubleSource>();
auto imag_source = std::make_shared<DoubleSource>();
auto complex_target = std::make_shared<ComplexTarget>();
auto complex_creator = std::make_shared<ComplexCreator<double>>();
{
// this configuration will trigger on each input change once all inputs have been set at least once
// ---------------------------------------------------------------------------------------------------
// should trigger should be invalidated after processing
complex_target, complex_creator, asio::make_unique<asio::SynchronousExecution>()
};
real_source->signal(42.0); // no output signal as imag_source has not yet fired
imag_source->signal(42.0); // now output signals (42 + 42i) as both inputs are valid
imag_source->signal(4.2); // output signals again this time with (42 + 4.2i) as inputs configured to stay valid
real_source->signal(4.2); // output signals again this time with (4.2 + 4.2i) as inputs configured to stay valid
connection->suspend();
real_source->signal(42.0); // no output signal as connection has been suspended
connection->resume();
imag_source->signal(42.0); // output signals with (4.2 + 42i) as the last real_source update was not recorded due to suspension
}
// connection is destroyed due to block end. inputs that signal won't affect the output anymore.
real_source->signal(42.0)
@ T
Templated input configuration class for the asio::ObservableConnection.
Templated implementation of the asio::Connection interface for multi-input asynchronous pipelines usi...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.

Definition at line 142 of file ObservableConnection.h.

Constructor & Destructor Documentation

◆ ObservableConnection() [1/2]

template<typename Result , typename... Args>
asio::ObservableConnection< Result, Args >::ObservableConnection ( )
default

◆ ObservableConnection() [2/2]

template<typename Result , typename... Args>
asio::ObservableConnection< Result, Args >::ObservableConnection ( ObservableConnectionInput< Args >... inputs,
std::shared_ptr< Observable< Result > > target,
std::shared_ptr< Processable< Result, Args... > > processable,
std::unique_ptr< ExecutionPolicy > policy,
bool muteUntilTargetSignalEmitted )
inline

Definition at line 177 of file ObservableConnection.h.

References mlrange_cast().

Member Function Documentation

◆ resume()

template<typename Result , typename... Args>
void asio::ObservableConnection< Result, Args >::resume ( )
inlineoverridevirtual

Implements asio::Connection.

Definition at line 201 of file ObservableConnection.h.

References mlrange_cast().

◆ suspend()

template<typename Result , typename... Args>
void asio::ObservableConnection< Result, Args >::suspend ( )
inlineoverridevirtual

Implements asio::Connection.

Definition at line 194 of file ObservableConnection.h.

References mlrange_cast().


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