NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
emit.hpp File Reference

This header provides macros that allows a signal to be emitted from a derived class of its owner. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ndn::util::signal::DummyExtraArg
 (implementation detail) a filler for extra argument More...
 

Namespaces

 ndn
 Copyright (c) 2011-2015 Regents of the University of California.
 
 ndn::util
 
 ndn::util::signal
 

Macros

#define DECLARE_SIGNAL_EMIT(signalName)
 (implementation detail) declares a 'emit_signalName' method More...
 
#define NDN_CXX_SIGNAL_EMIT(signalName, ...)   emit_##signalName(__VA_ARGS__)
 (implementation detail) invokes emit_signalName method More...
 
#define emitSignal(...)   NDN_CXX_SIGNAL_EMIT(__VA_ARGS__, ::ndn::util::signal::DummyExtraArg())
 (implementation detail) More...
 

Detailed Description

This header provides macros that allows a signal to be emitted from a derived class of its owner.

In 'protected' section of owner class declaration, DECLARE_SIGNAL_EMIT(signalName) From a derived class of owner, this->emitSignal(signalName, arg1, arg2);

Definition in file emit.hpp.

Macro Definition Documentation

#define DECLARE_SIGNAL_EMIT (   signalName)
Value:
template<typename ...TArgs> \
void emit_##signalName(const TArgs&... args) \
{ \
signalName(args...); \
}

(implementation detail) declares a 'emit_signalName' method

Note
This macro should be used in 'protected' section so that it's accessible by derived classes.
emit_signalName method is implementation detail. Derived classes should use 'emitSignal' macro.
The name 'emit_signalName' is an intentional violation of code-style rule 2.5.
The method is declared as a template, so that the macro doesn't need argument types. But only argument types that are compatible with Signal declaration will work.

Definition at line 59 of file emit.hpp.

#define NDN_CXX_SIGNAL_EMIT (   signalName,
  ... 
)    emit_##signalName(__VA_ARGS__)

(implementation detail) invokes emit_signalName method

Note
C99 requires at least one argument to be passed in VA_ARGS, thus a DummyExtraArg is expected at the end of VA_ARGS, which will be accepted but ignored by Signal::operator() overload.

Definition at line 71 of file emit.hpp.