siplasplas
A library for C++ reflection and introspection
|
Interface to the signals sink API. More...
#include <siplasplas/signals/sink.hpp>
Public Member Functions | |
template<typename Caller , typename Callee > | |
SignalSink (Caller &caller, Callee &callee) | |
Constructs a sink given the connection caller and the callee. More... | |
template<typename Caller > | |
SignalSink (Caller &caller) | |
Constructs a sink given the connection caller object. More... | |
template<typename... Args> | |
void | operator() (Args &&...args) |
Invokes the sink with the given arguments. More... | |
SignalEmitter * | callee () const |
Gives the callee of the connection. More... | |
SignalEmitter * | caller () const |
Gives the caller of the connection. More... | |
virtual bool | pull ()=0 |
Protected Member Functions | |
virtual void | invoke (std::vector< cpp::SimpleAny32 > &&args)=0 |
virtual bool | invokeWithoutCallee () const =0 |
Interface to the signals sink API.
A signal sink represents the destination of an emitted signal, that is, the action that should be invoked and how. Sinks keep track of the objects participating in a signal interchange (The source SignalEmitter and the destination object, if any). The interface provides two member functions to be overrided:
Also the user must specify whether the sink should be invoked with ot without a callee object (See SignalSink::operator()() template). Callee (if any) is always the first argument of type erased invoke() function.
When an user invokes the signal, he/she does through the SignalSInk::invoke() template, which perfect forwards the signal arguments to the type erased protected functions above.
|
inline |
Constructs a sink given the connection caller and the callee.
This constructor is used by child classes to initialize connection participants. Note the SignalSink is pure virtual.
caller | Reference to the caller object. Caller must inherit SignalEmitter. |
callee | Reference to the callee object. Caller must inherit SignalEmitter. |
|
inline |
Constructs a sink given the connection caller object.
This constructor is used by child classes to initialize connection caller. This constructor is used by connections with no associated callee (Such as connections invoking a lambda or a free function). Note the SignalSink is pure virtual.
caller | Reference to the caller object. Caller must inherit SignalEmitter. |
|
inline |
Gives the callee of the connection.
|
inline |
Gives the caller of the connection.
|
inline |
Invokes the sink with the given arguments.
This function invokes the sink by type erasing the call arguments and passing them to SignalSink::invoke(). If neccesary (See SignalSink::invokeWithoutCallee()) it also passes a reference to the callee object first.
args | call arguments. |