A Discrete-Event Network Simulator
API
Public Member Functions | Private Attributes | List of all members
ns3::TracedValue< T > Class Template Reference

Trace classes with value semantics. More...

#include "traced-value.h"

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

Constructor & Destructor Documentation

◆ TracedValue() [1/5]

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

Default constructor.

Definition at line 115 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 121 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 127 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 152 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 161 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 181 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 169 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 198 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 189 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 218 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(), ns3::TcpPrrRecovery::ExitRecovery(), ns3::TcpClassicRecovery::ExitRecovery(), ns3::GetCongStateFrom(), 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::ReTxTimeout(), ns3::TcpSocketCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::TcpSocketBase::SendPendingData(), 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 133 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 228 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 242 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 235 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 250 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 141 of file traced-value.h.

◆ Set()

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

Member Data Documentation

◆ m_cb

template<typename T>
TracedCallback<T,T> ns3::TracedValue< T >::m_cb
private

◆ m_v

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

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