Provides a lightweight signal / event system. More...
#include <ndn-cxx/util/signal/signal.hpp>
Public Types | |
using | Handler = std::function< void(const TArgs &...)> |
Represents a function that can connect to the signal. More... | |
Public Member Functions | |
~Signal () noexcept | |
Connection | connect (Handler handler) |
Connects a handler to the signal. More... | |
Connection | connectSingleShot (Handler handler) |
Connects a single-shot handler to the signal. More... | |
Provides a lightweight signal / event system.
To declare a signal: public: Signal<Owner, T1, T2> signalName; To connect to a signal: owner->signalName.connect(f); Multiple functions can connect to the same signal. To emit a signal from owner: this->signalName(arg1, arg2);
Owner | the signal owner class; only this class can emit the signal |
TArgs | types of signal arguments |
Definition at line 50 of file signal.hpp.
using ndn::signal::Signal< Owner, TArgs >::Handler = std::function<void(const TArgs&...)> |
Represents a function that can connect to the signal.
Definition at line 63 of file signal.hpp.
|
inlinenoexcept |
Definition at line 54 of file signal.hpp.
Connection ndn::signal::Signal< Owner, TArgs >::connect | ( | Handler | handler | ) |
Connects a handler to the signal.
Definition at line 152 of file signal.hpp.
Connection ndn::signal::Signal< Owner, TArgs >::connectSingleShot | ( | Handler | handler | ) |
Connects a single-shot handler to the signal.
After the handler is executed once, it is automatically disconnected.
Definition at line 162 of file signal.hpp.