Forward calls to a chain of Callback. More...
#include "traced-callback.h"
Public Types | |
typedef void(* | Uint32Callback) (const uint32_t value) |
TracedCallback signature for POD. | |
Public Member Functions | |
TracedCallback () | |
Constructor. | |
void | Connect (const CallbackBase &callback, std::string path) |
Append a Callback to the chain with a context. | |
void | ConnectWithoutContext (const CallbackBase &callback) |
Append a Callback to the chain (without a context). | |
void | Disconnect (const CallbackBase &callback, std::string path) |
Remove from the chain a Callback which was connected with a context. | |
void | DisconnectWithoutContext (const CallbackBase &callback) |
Remove from the chain a Callback which was connected without a context. | |
bool | IsEmpty () const |
Checks if the Callbacks list is empty. | |
void | operator() (Ts... args) const |
Functor which invokes the chain of Callbacks. | |
Private Types | |
typedef std::list< Callback< void, Ts... > > | CallbackList |
Container type for holding the chain of Callbacks. | |
Private Attributes | |
CallbackList | m_callbackList |
The chain of Callbacks. | |
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.
Ts | [explicit] Types of the functor arguments. |
Definition at line 42 of file traced-callback.h.
|
private |
Container type for holding the chain of Callbacks.
Ts | [deduced] Types of the functor arguments. |
Definition at line 105 of file traced-callback.h.
typedef void(* ns3::TracedCallback< Ts >::Uint32Callback) (const uint32_t value) |
TracedCallback signature for POD.
[in] | value | Value of the traced variable. |
Definition at line 96 of file traced-callback.h.
ns3::TracedCallback< Ts >::TracedCallback | ( | ) |
Constructor.
Definition at line 120 of file traced-callback.h.
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.
[in] | callback | Callback to add to chain. |
[in] | path | Context string to provide when invoking the Callback. |
Definition at line 139 of file traced-callback.h.
References ns3::Callback< R, UArgs >::Bind(), and NS_FATAL_ERROR.
Referenced by ns3::TracedValue< T >::Connect().
void ns3::TracedCallback< Ts >::ConnectWithoutContext | ( | const CallbackBase & | callback | ) |
Append a Callback to the chain (without a context).
[in] | callback | Callback to add to chain. |
Definition at line 127 of file traced-callback.h.
References NS_FATAL_ERROR_NO_MSG.
Referenced by ns3::AlohaNoackNetDevice::AddLinkChangeCallback(), ns3::CsmaNetDevice::AddLinkChangeCallback(), ns3::FdNetDevice::AddLinkChangeCallback(), ns3::lrwpan::LrWpanNetDevice::AddLinkChangeCallback(), ns3::LteNetDevice::AddLinkChangeCallback(), ns3::MockNetDevice::AddLinkChangeCallback(), ns3::PointToPointNetDevice::AddLinkChangeCallback(), ns3::SimpleNetDevice::AddLinkChangeCallback(), ns3::TapBridge::AddLinkChangeCallback(), ns3::UanNetDevice::AddLinkChangeCallback(), ns3::WifiNetDevice::AddLinkChangeCallback(), ns3::TracedValue< T >::ConnectWithoutContext(), and TracedCallbackTypedefTestCase::Checker< Ts >::Invoke().
void ns3::TracedCallback< Ts >::Disconnect | ( | const CallbackBase & | callback, |
std::string | path ) |
Remove from the chain a Callback which was connected with a context.
[in] | callback | Callback to remove from the chain. |
[in] | path | Context path which was used to connect the Callback. |
Definition at line 169 of file traced-callback.h.
References ns3::Callback< R, UArgs >::Bind(), and NS_FATAL_ERROR.
Referenced by ns3::TracedValue< T >::Disconnect().
void ns3::TracedCallback< Ts >::DisconnectWithoutContext | ( | const CallbackBase & | callback | ) |
Remove from the chain a Callback which was connected without a context.
[in] | callback | Callback to remove from the chain. |
Definition at line 152 of file traced-callback.h.
Referenced by ns3::TracedValue< T >::DisconnectWithoutContext().
bool ns3::TracedCallback< Ts >::IsEmpty | ( | ) | const |
Checks if the Callbacks list is empty.
Definition at line 192 of file traced-callback.h.
void ns3::TracedCallback< Ts >::operator() | ( | Ts... | args | ) | const |
Functor which invokes the chain of Callbacks.
Ts | [deduced] Types of the functor arguments. |
[in] | args | The arguments to the functor |
Definition at line 182 of file traced-callback.h.
|
private |
The chain of Callbacks.
Definition at line 107 of file traced-callback.h.