NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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.hpp>

Inherits noncopyable.

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 (Handler handler)
 connects a handler to the signal More...
 
Connection connectSingleShot (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 52 of file signal.hpp.

Member Typedef Documentation

◆ Handler

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 57 of file signal.hpp.

Constructor & Destructor Documentation

◆ Signal()

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

Definition at line 149 of file signal.hpp.

◆ ~Signal()

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

Definition at line 155 of file signal.hpp.

Member Function Documentation

◆ connect()

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

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 162 of file signal.hpp.

◆ connectSingleShot()

template<typename Owner , typename ... TArgs>
Connection ndn::util::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 172 of file signal.hpp.


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