![]() |
cppexpose
1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
|
Signal class for communicating events. More...
#include <cppexpose/include/cppexpose/signal/Signal.h>


Public Types | |
| using | Callback = std::function< void(Arguments...)> |
| Signature for callbacks. More... | |
Public Member Functions | |
| Signal () | |
| Constructor. More... | |
| void | operator() (Arguments...arguments) |
| Emit signal. More... | |
| Connection | connect (Callback callback) const |
| Connect signal to callback function. More... | |
| template<class T , class U > | |
| Connection | connect (T *object, void(U::*method)(Arguments...)) const |
| Connect signal to member function of an object. More... | |
| Connection | connect (Signal &signal) const |
| Connect signal to another signal. More... | |
| Connection | onFire (std::function< void()> callback) const |
| Connect to when the signal is emitted. More... | |
| void | block () |
| Block signal. More... | |
| void | unblock () |
| Unblock signal. More... | |
Public Member Functions inherited from cppexpose::AbstractSignal | |
| AbstractSignal () | |
| Constructor. More... | |
| virtual | ~AbstractSignal () |
| Destructor. More... | |
Protected Member Functions | |
| void | fire (Arguments...arguments) const |
| Emit signal. More... | |
| virtual void | disconnectId (Connection::Id id) const override |
| Disconnect connection by ID. More... | |
Protected Member Functions inherited from cppexpose::AbstractSignal | |
| Connection | createConnection () const |
| Create new empty connection. More... | |
| void | disconnect (Connection &connection) const |
| Disconnect connection. More... | |
Protected Attributes | |
| std::unordered_map< Connection::Id, Callback > | m_callbacks |
| List of registered callbacks. More... | |
| bool | m_blocked |
| If 'true', the signal does not emit when invoked. More... | |
Protected Attributes inherited from cppexpose::AbstractSignal | |
| Connection::Id | m_nextId |
| Next free connection ID. More... | |
| std::unordered_map< Connection::Id, Connection > | m_connections |
| Map of connections by ID. More... | |
Signal class for communicating events.
| using cppexpose::Signal< Arguments >::Callback = std::function<void(Arguments...)> |
Signature for callbacks.
| cppexpose::Signal< Arguments >::Signal | ( | ) |
Constructor.
| void cppexpose::Signal< Arguments >::operator() | ( | Arguments... | arguments | ) |
Emit signal.
| [in] | arguments | Signal arguments |
References cppexpose::Signal< Arguments >::fire().
| Connection cppexpose::Signal< Arguments >::connect | ( | Callback | callback | ) | const |
Connect signal to callback function.
| [in] | callback | Callback function that is invoked |
References cppexpose::AbstractSignal::createConnection(), cppexpose::Connection::id(), and cppexpose::Signal< Arguments >::m_callbacks.
Referenced by cppexpose::Signal< Arguments >::connect(), and cppexpose::Signal< Arguments >::onFire().
| Connection cppexpose::Signal< Arguments >::connect | ( | T * | object, |
| void(U::*)(Arguments...) | method | ||
| ) | const |
Connect signal to member function of an object.
| [in] | object | Object |
| [in] | method | Member function that is invoked |
References cppexpose::Signal< Arguments >::connect().
| Connection cppexpose::Signal< Arguments >::connect | ( | Signal< Arguments > & | signal | ) | const |
Connect signal to another signal.
| [in] | signal | Signal that is invoked |
References cppexpose::Signal< Arguments >::connect().
| Connection cppexpose::Signal< Arguments >::onFire | ( | std::function< void()> | callback | ) | const |
Connect to when the signal is emitted.
| [in] | callback | Callback function that is invoked |
References cppexpose::Signal< Arguments >::connect().
| void cppexpose::Signal< Arguments >::block | ( | ) |
Block signal.
References cppexpose::Signal< Arguments >::m_blocked.
| void cppexpose::Signal< Arguments >::unblock | ( | ) |
Unblock signal.
References cppexpose::Signal< Arguments >::m_blocked.
|
protected |
Emit signal.
| [in] | arguments | Signal arguments |
References cppexpose::Signal< Arguments >::m_blocked, and cppexpose::Signal< Arguments >::m_callbacks.
Referenced by cppexpose::Signal< Arguments >::operator()().
|
overrideprotectedvirtual |
Disconnect connection by ID.
| [in] | id | Connection ID |
Implements cppexpose::AbstractSignal.
References cppexpose::Signal< Arguments >::m_callbacks.
|
mutableprotected |
List of registered callbacks.
Referenced by cppexpose::Signal< Arguments >::connect(), cppexpose::Signal< Arguments >::disconnectId(), and cppexpose::Signal< Arguments >::fire().
|
protected |
If 'true', the signal does not emit when invoked.
Referenced by cppexpose::Signal< Arguments >::block(), cppexpose::Signal< Arguments >::fire(), and cppexpose::Signal< Arguments >::unblock().
1.8.11