#include <nap/signalslot.h>
Public Types | |
using | Function = std::function< void(Args... args)> |
Public Member Functions | |
~Signal () | |
void | connect (Slot< Args... > &slot) |
void | disconnect (Slot< Args... > &slot) |
void | connect (const Function &inFunction) |
void | connect (Signal< Args... > &signal) |
void | disconnect (Signal< Args... > &signal) |
template<typename U , typename F > | |
void | connect (U *object, F memberFunction) |
void | operator() (Args... args) |
void | trigger (Args... args) |
A callable signal to which slots, functions or other signals can be connected to provide loose coupling. The signal variadic template arguments to be able to work with different sets of arguments.
using Function = std::function<void(Args... args)> |
void connect | ( | const Function & | inFunction | ) |
Connect a raw function object. Note that when any captured data in a connected function is deleted this signal will be unsafe to call. Also disconnecting a raw function is not possible. Connecting a function is mainly only good practice when the scope of the signal is the same as the function's.
void connect | ( | Signal< Args... > & | signal | ) |
Connect to another signal that calls other slots, functions or signals when invoked
void connect | ( | Slot< Args... > & | slot | ) |
Connect to a slot with similar signature. A slot is an object managing a function to be called. Advantages of connecting to a slot instead of a raw function:
void connect | ( | U * | object, |
F | memberFunction | ||
) |
Convenience method to connect a member function with one argument.
void disconnect | ( | Signal< Args... > & | signal | ) |
Disconnect from another signal
void disconnect | ( | Slot< Args... > & | slot | ) |
Disconnect from a slot
void operator() | ( | Args... | args | ) |
Call operator to trigger the signal to be emitted.
void trigger | ( | Args... | args | ) |
Trigger the signal to be emitted
args | signal arguments |