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 T &v)
 Construct from an explicit variable. More...
 
 TracedValue (const TracedValue &o)
 Copy constructor. 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 116 of file traced-value.h.

Constructor & Destructor Documentation

◆ TracedValue() [1/5]

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

Default constructor.

Definition at line 120 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 127 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 134 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 161 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 170 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 191 of file traced-value.h.

References ns3::TracedCallback< Ts >::Connect(), ns3::TracedValue< T >::m_cb, and trim-trailing-whitespace::path.

+ Here is the call graph for this function:

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

References ns3::TracedCallback< Ts >::ConnectWithoutContext(), and ns3::TracedValue< T >::m_cb.

+ Here is the call graph for this function:

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

References ns3::TracedCallback< Ts >::Disconnect(), ns3::TracedValue< T >::m_cb, and trim-trailing-whitespace::path.

+ Here is the call graph for this function:

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

References ns3::TracedCallback< Ts >::DisconnectWithoutContext(), and ns3::TracedValue< T >::m_cb.

+ Here is the call graph for this function:

◆ Get()

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

Get the underlying value.

Returns
The value.

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

References ns3::TracedValue< T >::m_v.

Referenced by ns3::TcpDctcp::CeState1to0(), ns3::TcpNewReno::CongestionAvoidance(), ns3::TcpLedbat::CongestionAvoidance(), ns3::TcpBbr::CongestionStateSet(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::TcpSocketBase::DoForwardUp(), TcpIllinoisTest::DoRun(), TcpYeahIncrementTest::DoRun(), TcpHighSpeedIncrementTest::DoRun(), TcpHtcpIncrementTest::DoRun(), TcpHyblaIncrementTest::DoRun(), ns3::TcpLpToNewReno::DoRun(), ns3::TcpLpInferenceTest1::DoRun(), ns3::TcpLpInferenceTest2::DoRun(), PrrRecoveryTest::DoRun(), TcpScalableIncrementTest::DoRun(), TcpVegasTest::DoRun(), TcpVenoTest::DoRun(), ns3::TcpSocketBase::EstimateRtt(), TcpBicIncrementTest::ExecuteTest(), TcpDctcpToLinuxReno::ExecuteTest(), TcpLedbatToNewReno::ExecuteTest(), TcpLedbatIncrementTest::ExecuteTest(), TcpLedbatDecrementTest::ExecuteTest(), ns3::TcpClassicRecovery::ExitRecovery(), ns3::TcpSocketBase::GetHighRxAck(), ns3::TcpSocketBase::GetRWnd(), ns3::TcpBbr::HandleProbeRTT(), ns3::TcpBbr::HandleRestartFromIdle(), ns3::TcpLedbat::IncreaseWindow(), ns3::QueueBase::IsEmpty(), ns3::TcpBbr::ModulateCwndForProbeRTT(), ns3::TcpBbr::ModulateCwndForRecovery(), ns3::TcpSocketBase::NewAck(), TcpVenoTest::NewReno_CongestionAvoidance(), ns3::operator!(), ns3::operator!=(), ns3::operator%=(), ns3::operator&=(), ns3::operator*=(), ns3::operator+(), ns3::TracedValue< T >::operator++(), ns3::operator+=(), ns3::operator-(), ns3::TracedValue< 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::operator~(), ns3::TcpLp::PktsAcked(), ns3::TcpSocketBase::ProcessAck(), ns3::TcpSocketBase::ReceivedAck(), ns3::TcpBbr::RestoreCwnd(), ns3::TcpSocketBase::ReTxTimeout(), ns3::TcpSocketBase::SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendPendingData(), ns3::TcpBbr::SetCwnd(), ns3::TcpBbr::UpdateAckAggregation(), 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 141 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 243 of file traced-value.h.

References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.

+ Here is the call graph for this function:

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

References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.

+ Here is the call graph for this function:

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

References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.

+ Here is the call graph for this function:

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

References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.

+ Here is the call graph for this function:

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

References ns3::TracedValue< T >::m_v, ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.

+ Here is the call graph for this function:

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

References ns3::TracedValue< T >::m_cb, and ns3::TracedValue< T >::m_v.

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

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cb

◆ m_v

template<typename T >
T ns3::TracedValue< T >::m_v
private

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