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

provides a lightweight event system More...

#include <event-emitter.hpp>

Inheritance diagram for ndn::util::EventEmitter< TArgs >:
Collaboration diagram for ndn::util::EventEmitter< TArgs >:

Public Types

typedef function< void(const TArgs &...)> Handler
 represents a handler that can subscribe to the event More...
 

Public Member Functions

void operator+= (const Handler &handler)
 subscribes to the event More...
 
bool isEmpty () const
 
void clear ()
 clears all subscriptions More...
 
void operator() (const TArgs &...args) const
 triggers the event More...
 

Detailed Description

template<typename... TArgs>
class ndn::util::EventEmitter< TArgs >

provides a lightweight event system

To declare an event: EventEmitter<TArgs> onEventName; To subscribe to an event: eventSource->onEventName += eventHandler; Multiple functions can subscribe to the same event. To trigger an event: onEventName(args); To clear event subscriptions: onEventName.clear();

Deprecated:
use Signal instead

Definition at line 47 of file event-emitter.hpp.

Member Typedef Documentation

template<typename... TArgs>
typedef function<void(const TArgs&...)> ndn::util::EventEmitter< TArgs >::Handler

represents a handler that can subscribe to the event

Definition at line 52 of file event-emitter.hpp.

Member Function Documentation

template<typename... TArgs>
void ndn::util::EventEmitter< TArgs >::operator+= ( const Handler handler)
inline

subscribes to the event

Definition at line 80 of file event-emitter.hpp.

template<typename... TArgs>
bool ndn::util::EventEmitter< TArgs >::isEmpty ( ) const
inline
Returns
true if there is no subscription, false otherwise

Definition at line 87 of file event-emitter.hpp.

template<typename... TArgs>
void ndn::util::EventEmitter< TArgs >::clear ( )
inline

clears all subscriptions

Definition at line 94 of file event-emitter.hpp.

template<typename... TArgs>
void ndn::util::EventEmitter< TArgs >::operator() ( const TArgs &...  args) const
inline

triggers the event

Definition at line 101 of file event-emitter.hpp.


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