NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
emit.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


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


 Copyright (c) 2011-2015 Regents of the University of California.


#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)
template<typename ...TArgs> \
void emit_##signalName(const TArgs&... args) \
{ \
signalName(args...); \

(implementation detail) declares a 'emit_signalName' method

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 60 of file emit.hpp.


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

(implementation detail) invokes emit_signalName method

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 72 of file emit.hpp.

◆ emitSignal

#define emitSignal (   ...)    NDN_CXX_SIGNAL_EMIT(__VA_ARGS__, ::ndn::util::signal::DummyExtraArg())

(implementation detail)

Definition at line 77 of file emit.hpp.