NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::util::signal::Signal< Owner, TArgs > Class Template Reference

provides a lightweight signal / event system More...

#include <signal-signal.hpp>

Inheritance diagram for ndn::util::signal::Signal< Owner, TArgs >:
Collaboration diagram for ndn::util::signal::Signal< Owner, TArgs >:

Public Types

typedef function< void(const TArgs &...)> Handler
 represents a function that can connect to the signal More...
 

Public Member Functions

 Signal ()
 
 ~Signal ()
 
Connection connect (const Handler &handler)
 connects a handler to the signal More...
 
Connection connectSingleShot (const Handler &handler)
 connects a single-shot handler to the signal More...
 

Detailed Description

template<typename Owner, typename... TArgs>
class ndn::util::signal::Signal< Owner, TArgs >

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);

Template Parameters
Ownerthe signal owner class; only this class can emit the signal
TArgstypes of signal arguments
See also
signal-emit.hpp allows owner's derived classes to emit signals

Definition at line 50 of file signal-signal.hpp.

Member Typedef Documentation

template<typename Owner, typename... TArgs>
typedef function<void(const TArgs&...)> ndn::util::signal::Signal< Owner, TArgs >::Handler

represents a function that can connect to the signal

Definition at line 55 of file signal-signal.hpp.

Constructor & Destructor Documentation

template<typename Owner , typename... TArgs>
ndn::util::signal::Signal< Owner, TArgs >::Signal ( )

Definition at line 161 of file signal-signal.hpp.

template<typename Owner , typename... TArgs>
ndn::util::signal::Signal< Owner, TArgs >::~Signal ( )

Definition at line 167 of file signal-signal.hpp.

Member Function Documentation

template<typename Owner , typename... TArgs>
Connection ndn::util::signal::Signal< Owner, TArgs >::connect ( const Handler handler)
inline

connects a handler to the signal

Note
If invoked from a handler, the new handler won't receive the current emitted signal.
Warning
The handler is permitted to disconnect itself, but it must ensure its validity.

Definition at line 174 of file signal-signal.hpp.

template<typename Owner , typename... TArgs>
Connection ndn::util::signal::Signal< Owner, TArgs >::connectSingleShot ( const Handler handler)
inline

connects a single-shot handler to the signal

After the handler is executed once, it is automatically disconnected.

Definition at line 184 of file signal-signal.hpp.


The documentation for this class was generated from the following file: