A Discrete-Event Network Simulator
API
ns3::TracedCallback< Ts > Class Template Reference

Forward calls to a chain of Callback. More...

#include "traced-callback.h"

+ Collaboration diagram for ns3::TracedCallback< Ts >:

Public Types

typedef void(* Uint32Callback) (const uint32_t value)
 TracedCallback signature for POD. More...
 

Public Member Functions

 TracedCallback ()
 Constructor. More...
 
void Connect (const CallbackBase &callback, std::string path)
 Append a Callback to the chain with a context. More...
 
void ConnectWithoutContext (const CallbackBase &callback)
 Append a Callback to the chain (without a context). More...
 
void Disconnect (const CallbackBase &callback, std::string path)
 Remove from the chain a Callback which was connected with a context. More...
 
void DisconnectWithoutContext (const CallbackBase &callback)
 Remove from the chain a Callback which was connected without a context. More...
 
void operator() (Ts... args) const
 Functor which invokes the chain of Callbacks. More...
 

Private Types

typedef std::list< Callback< void, Ts... > > CallbackList
 Container type for holding the chain of Callbacks. More...
 

Private Attributes

CallbackList m_callbackList
 The chain of Callbacks. More...
 

Detailed Description

template<typename... Ts>
class ns3::TracedCallback< Ts >

Forward calls to a chain of Callback.

A TracedCallback has almost exactly the same API as a normal Callback but instead of forwarding calls to a single function (as a Callback normally does), it forwards calls to a chain of Callback. Connect adds a Callback at the end of the chain of callbacks. Disconnect removes a Callback from the chain of callbacks.

This is a functor: the chain of Callbacks is invoked by calling the operator() form with the appropriate number of arguments.

Template Parameters
Ts[explicit] Types of the functor arguments.

Definition at line 52 of file traced-callback.h.

Member Typedef Documentation

◆ CallbackList

template<typename... Ts>
typedef std::list<Callback<void,Ts...> > ns3::TracedCallback< Ts >::CallbackList
private

Container type for holding the chain of Callbacks.

Template Parameters
Ts[deduced] Types of the functor arguments.

Definition at line 110 of file traced-callback.h.

◆ Uint32Callback

template<typename... Ts>
typedef void(* ns3::TracedCallback< Ts >::Uint32Callback) (const uint32_t value)

TracedCallback signature for POD.

Parameters
[in]valueValue of the traced variable.

Definition at line 101 of file traced-callback.h.

Constructor & Destructor Documentation

◆ TracedCallback()

template<typename... Ts>
ns3::TracedCallback< Ts >::TracedCallback ( )

Constructor.

Definition at line 125 of file traced-callback.h.

Member Function Documentation

◆ Connect()

template<typename... Ts>
void ns3::TracedCallback< Ts >::Connect ( const CallbackBase callback,
std::string  path 
)

Append a Callback to the chain with a context.

The context string will be provided as the first argument to the Callback.

Parameters
[in]callbackCallback to add to chain.
[in]pathContext string to provide when invoking the Callback.

Definition at line 141 of file traced-callback.h.

Referenced by ns3::TracedValue< uint64_t >::Connect().

+ Here is the caller graph for this function:

◆ ConnectWithoutContext()

◆ Disconnect()

template<typename... Ts>
void ns3::TracedCallback< Ts >::Disconnect ( const CallbackBase callback,
std::string  path 
)

Remove from the chain a Callback which was connected with a context.

Parameters
[in]callbackCallback to remove from the chain.
[in]pathContext path which was used to connect the Callback.

Definition at line 170 of file traced-callback.h.

Referenced by ns3::TracedValue< uint64_t >::Disconnect().

+ Here is the caller graph for this function:

◆ DisconnectWithoutContext()

template<typename... Ts>
void ns3::TracedCallback< Ts >::DisconnectWithoutContext ( const CallbackBase callback)

Remove from the chain a Callback which was connected without a context.

Parameters
[in]callbackCallback to remove from the chain.

Definition at line 153 of file traced-callback.h.

Referenced by ns3::TracedValue< uint64_t >::DisconnectWithoutContext(), and BasicTracedCallbackTestCase::DoRun().

+ Here is the caller graph for this function:

◆ operator()()

template<typename... Ts>
void ns3::TracedCallback< Ts >::operator() ( Ts...  args) const

Functor which invokes the chain of Callbacks.

Template Parameters
Ts[deduced] Types of the functor arguments.
Parameters
[in]argsThe arguments to the functor

Definition at line 182 of file traced-callback.h.

Member Data Documentation

◆ m_callbackList

template<typename... Ts>
CallbackList ns3::TracedCallback< Ts >::m_callbackList
private

The chain of Callbacks.

Definition at line 112 of file traced-callback.h.


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