A Discrete-Event Network Simulator
API
ns3::TracedValue< T > Class Template Reference

Trace classes with value semantics. More...

#include <traced-value.h>

+ Inheritance diagram for ns3::TracedValue< T >:
+ Collaboration diagram for ns3::TracedValue< T >:

Public Types

typedef void(* BoolCallback) (const bool oldValue, const bool newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Int8Callback) (const int8_t oldValue, const int8_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Uint8Callback) (const uint8_t oldValue, const uint8_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Int16Callback) (const int16_t oldValue, const int16_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Uint16Callback) (const uint16_t oldValue, const uint16_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Int32Callback) (const int32_t oldValue, const int32_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* Uint32Callback) (const uint32_t oldValue, const uint32_t newValue)
 TracedValue Callback signature for POD. More...
 
typedef void(* DoubleCallback) (const double oldValue, const double newValue)
 TracedValue Callback signature for POD. More...
 

Public Member Functions

 TracedValue ()
 Default constructor. More...
 
 TracedValue (const TracedValue &o)
 Copy constructor. More...
 
 TracedValue (const T &v)
 Construct from an explicit variable. More...
 
template<typename U >
 TracedValue (const TracedValue< U > &other)
 Copy from a TracedValue of a compatable type. More...
 
template<typename U >
 TracedValue (const U &other)
 Copy from a variable type compatible with this underlying type. More...
 
void Connect (const CallbackBase &cb, std::string path)
 Connect a Callback with a context string. More...
 
void ConnectWithoutContext (const CallbackBase &cb)
 Connect a Callback (without context.) More...
 
void Disconnect (const CallbackBase &cb, std::string path)
 Disconnect a Callback which was connected with context. More...
 
void DisconnectWithoutContext (const CallbackBase &cb)
 Disconnect a Callback which was connected without context. More...
 
Get (void) const
 Get the underlying value. More...
 
 operator T () const
 Cast to the underlying type. More...
 
TracedValueoperator= (const TracedValue &o)
 Assignment. More...
 
void Set (const T &v)
 Set the value of the underlying variable. More...
 
TracedValueoperator++ ()
 Pre/post- increment/decrement operator. More...
 
TracedValueoperator-- ()
 Pre/post- increment/decrement operator. More...
 
TracedValue operator++ (int)
 Pre/post- increment/decrement operator. More...
 
TracedValue operator-- (int)
 Pre/post- increment/decrement operator. More...
 

Private Attributes

TracedCallback< T, T > m_cb
 The connected Callback. More...
 
m_v
 The underlying value. More...
 

Detailed Description

template<typename T>
class ns3::TracedValue< T >

Trace classes with value semantics.

If you want to trace the change of value of a class or primitive type which have value semantics (they must support operator !=), you can wrap them in an instance of this template. This instance will behave just like the original class (if it did not export any special method), and will define Connect/DisconnectWithoutContext methods to work with MakeTraceSourceAccessor.

Template Parameters
TThe type of the underlying value being traced.

Definition at line 79 of file traced-value.h.

Member Typedef Documentation

template<typename T>
typedef void(* ns3::TracedValue< T >::BoolCallback) (const bool oldValue, const bool newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 235 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::DoubleCallback) (const double oldValue, const double newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 242 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Int16Callback) (const int16_t oldValue, const int16_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 238 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Int32Callback) (const int32_t oldValue, const int32_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 240 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Int8Callback) (const int8_t oldValue, const int8_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 236 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Uint16Callback) (const uint16_t oldValue, const uint16_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 239 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Uint32Callback) (const uint32_t oldValue, const uint32_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 241 of file traced-value.h.

template<typename T>
typedef void(* ns3::TracedValue< T >::Uint8Callback) (const uint8_t oldValue, const uint8_t newValue)

TracedValue Callback signature for POD.

Parameters
[in]oldValueoriginal value of the traced variable
[in]newValuenew value of the traced variable

Definition at line 237 of file traced-value.h.

Constructor & Destructor Documentation

template<typename T>
ns3::TracedValue< T >::TracedValue ( )
inline

Default constructor.

Definition at line 83 of file traced-value.h.

template<typename T>
ns3::TracedValue< T >::TracedValue ( const TracedValue< T > &  o)
inline

Copy constructor.

Parameters
oThe value to copy.

Definition at line 89 of file traced-value.h.

template<typename T>
ns3::TracedValue< T >::TracedValue ( const T &  v)
inline

Construct from an explicit variable.

Parameters
vThe variable to trace.

Definition at line 95 of file traced-value.h.

template<typename T>
template<typename U >
ns3::TracedValue< T >::TracedValue ( const TracedValue< U > &  other)
inline

Copy from a TracedValue of a compatable type.

Template Parameters
UThe underlying type of the other TracedValue.
Parameters
otherThe other TracedValuet to copy.

Definition at line 120 of file traced-value.h.

template<typename T>
template<typename U >
ns3::TracedValue< T >::TracedValue ( const U &  other)
inline

Copy from a variable type compatible with this underlying type.

Template Parameters
UType of the other variable.
Parameters
otherThe other variable to copy.

Definition at line 129 of file traced-value.h.

Member Function Documentation

template<typename T>
void ns3::TracedValue< T >::Connect ( const CallbackBase cb,
std::string  path 
)
inline

Connect a Callback with a context string.

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

Parameters
cbThe Callback to connect to the target trace source.
pathThe context to bind to the user callback.

Definition at line 149 of file traced-value.h.

template<typename T>
void ns3::TracedValue< T >::ConnectWithoutContext ( const CallbackBase cb)
inline

Connect a Callback (without context.)

Parameters
cbThe callback to connect.

Definition at line 137 of file traced-value.h.

template<typename T>
void ns3::TracedValue< T >::Disconnect ( const CallbackBase cb,
std::string  path 
)
inline

Disconnect a Callback which was connected with context.

Parameters
cbThe Callback to disconnect.
pathThe context to bind to the user callback.

Definition at line 166 of file traced-value.h.

template<typename T>
void ns3::TracedValue< T >::DisconnectWithoutContext ( const CallbackBase cb)
inline

Disconnect a Callback which was connected without context.

Parameters
cbThe Callback to disconnect.

Definition at line 157 of file traced-value.h.

template<typename T>
ns3::TracedValue< T >::operator T ( ) const
inline

Cast to the underlying type.

Returns
The underlying value.

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

template<typename T>
TracedValue& ns3::TracedValue< T >::operator++ ( )
inline

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

Definition at line 196 of file traced-value.h.

template<typename T>
TracedValue ns3::TracedValue< T >::operator++ ( int  )
inline

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

Definition at line 210 of file traced-value.h.

template<typename T>
TracedValue& ns3::TracedValue< T >::operator-- ( )
inline

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

Definition at line 203 of file traced-value.h.

template<typename T>
TracedValue ns3::TracedValue< T >::operator-- ( int  )
inline

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

Definition at line 218 of file traced-value.h.

template<typename T>
TracedValue& ns3::TracedValue< T >::operator= ( const TracedValue< T > &  o)
inline

Assignment.

Parameters
oThe value to assign to this instance.
Returns
This TracedValue.

Definition at line 109 of file traced-value.h.

template<typename T>
void ns3::TracedValue< T >::Set ( const T &  v)
inline

Set the value of the underlying variable.

If the new value differs from the old, the Callback will be invoked.

Parameters
vThe new value.

Definition at line 175 of file traced-value.h.

Referenced by ns3::operator%=(), ns3::operator&=(), ns3::operator*=(), ns3::TracedValue< ns3::SequenceNumber >::operator++(), ns3::operator+=(), ns3::TracedValue< ns3::SequenceNumber >::operator--(), ns3::operator-=(), ns3::operator/=(), ns3::operator<<=(), ns3::TracedValue< ns3::SequenceNumber >::operator=(), ns3::operator>>=(), ns3::operator^=(), and ns3::operator|=().

+ Here is the caller graph for this function:

Member Data Documentation


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