#include <nap/signalslot.h>
Public Types | |
using | Function = std::function< void(Args... args)> |
Public Member Functions | |
Slot ()=default | |
Slot (Function inFunction) | |
template<typename U , typename F > | |
Slot (U *parent, F memberFunction) | |
template<typename U , typename F > | |
Slot (U *parent, F memberFunction, Signal< Args... > &signal) | |
~Slot () | |
void | disconnect () |
void | setFunction (Function func) |
void | trigger (Args... args) |
void | copyCauses (const Slot &rhs) |
Slot & | operator= (Slot &&other) |
Slot & | operator= (const Slot &other) |
Manages a function call that can be connected to a signal. A slot hides the connect / disconnect behavior of an event.
using Function = std::function<void(Args... args)> |
|
default |
Initialize this slot with the function to call
inFunction | function to call |
Slot | ( | U * | parent, |
F | memberFunction | ||
) |
This templated constructor can be used to initialize the slot with a member function with one single parameter
parent | parent object |
memberFunction | member function to call |
This templated constructor can be used to initialize the slot with a member function with one single parameter, last argument is a signal to connect to straightaway after construction
parent | parent object |
memberFunction | member function to call |
~Slot | ( | ) |
void copyCauses | ( | const Slot< Args > & | rhs | ) |
Clears existing and copies rhs connections
rhs |
void disconnect |
Disconnects the slot from all signals it is connected to
Assign a slot by copying all signal connections and callable function. Note that the assigned callback is NOT copied, only the connections. The data of the other slot is invalidated -> all active connections are removed.
Assign a slot by copying all connections and callable function Note that the function is NOT copied, only the active signal connections.
void setFunction | ( | Function | func | ) |
Update callable function
func | the function to set |
void trigger | ( | Args... | args | ) |
Trigger function using given argument
args | callabale argument |