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 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 compatible 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
T[explicit] The type of the underlying value being traced.

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

Constructor & Destructor Documentation

◆ TracedValue() [1/5]

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

Default constructor.

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

◆ TracedValue() [2/5]

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

Copy constructor.

Parameters
[in]oThe value to copy.

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

◆ TracedValue() [3/5]

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

Construct from an explicit variable.

Parameters
[in]vThe variable to trace.

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

◆ TracedValue() [4/5]

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

Copy from a TracedValue of a compatible type.

Template Parameters
U[deduced] The underlying type of the other TracedValue.
Parameters
[in]otherThe other TracedValuet to copy.

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

◆ TracedValue() [5/5]

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
U[deduced] Type of the other variable.
Parameters
[in]otherThe other variable to copy.

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

Member Function Documentation

◆ Connect()

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
[in]cbThe Callback to connect to the target trace source.
[in]pathThe context to bind to the user callback.

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

◆ ConnectWithoutContext()

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

Connect a Callback (without context.)

Parameters
[in]cbThe callback to connect.

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

◆ Disconnect()

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

Disconnect a Callback which was connected with context.

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

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

◆ DisconnectWithoutContext()

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

Disconnect a Callback which was connected without context.

Parameters
[in]cbThe Callback to disconnect.

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

◆ Get()

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

Get the underlying value.

Returns
The value.

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

Referenced by ns3::TcpLedbat::CongestionAvoidance(), ns3::TcpNewReno::CongestionAvoidance(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::TcpSocketBase::DoForwardUp(), TcpHighSpeedIncrementTest::DoRun(), TcpHyblaIncrementTest::DoRun(), TcpScalableIncrementTest::DoRun(), TcpHtcpIncrementTest::DoRun(), TcpVegasTest::DoRun(), TcpVenoTest::DoRun(), PrrRecoveryTest::DoRun(), TcpYeahIncrementTest::DoRun(), TcpIllinoisTest::DoRun(), ns3::TcpSocketBase::EstimateRtt(), ns3::TcpLpToNewReno::ExecuteTest(), TcpLedbatToNewReno::ExecuteTest(), TcpBicIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest1::ExecuteTest(), TcpLedbatIncrementTest::ExecuteTest(), ns3::TcpLpInferenceTest2::ExecuteTest(), TcpLedbatDecrementTest::ExecuteTest(), TcpDctcpToNewReno::ExecuteTest(), TcpDctcpDecrementTest::ExecuteTest(), ns3::TcpPrrRecovery::ExitRecovery(), ns3::TcpClassicRecovery::ExitRecovery(), ns3::GetCongStateFrom(), ns3::TcpSocketBase::GetHighRxAck(), ns3::TcpSocketBase::GetRWnd(), ns3::TcpLedbat::IncreaseWindow(), ns3::QueueBase::IsEmpty(), ns3::TcpSocketBase::NewAck(), TcpVenoTest::NewReno_CongestionAvoidance(), ns3::operator!(), ns3::operator!=(), ns3::operator%=(), ns3::operator&=(), ns3::operator*=(), ns3::operator+(), ns3::TracedValue< uint64_t >::operator++(), ns3::operator+=(), ns3::operator-(), ns3::TracedValue< uint64_t >::operator--(), ns3::operator-=(), ns3::operator/=(), ns3::operator<<=(), ns3::operator==(), ns3::operator>(), ns3::operator>=(), ns3::operator>>(), ns3::operator>>=(), ns3::operator^=(), ns3::operator|=(), ns3::operator~(), ns3::TcpLp::PktsAcked(), ns3::TcpSocketBase::ReceivedAck(), ns3::TcpLinuxReno::ReduceCwnd(), ns3::TcpBic::ReduceCwnd(), ns3::TcpNewReno::ReduceCwnd(), ns3::TcpSocketBase::ReTxTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::TcpSocketBase::SendPendingData(), ns3::TcpSocketBase::UpdatePacingRate(), and ns3::TcpSocketBase::Window().

◆ operator T()

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

Cast to the underlying type.

Returns
The underlying value.

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

◆ operator++() [1/2]

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

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

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

◆ operator++() [2/2]

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 256 of file traced-value.h.

◆ operator--() [1/2]

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

Pre/post- increment/decrement operator.

This invokes the Callback.

Returns
This TracedValue.

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

◆ operator--() [2/2]

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 265 of file traced-value.h.

◆ operator=()

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

Assignment.

Parameters
[in]oThe value to assign to this instance.
Returns
This TracedValue.

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

◆ Set()

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
[in]vThe new value.

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

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cb

◆ m_v


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