Trace classes with value semantics. More...
#include "traced-value.h"
Public Member Functions | |
TracedValue () | |
Default constructor. | |
TracedValue (const T &v) | |
Construct from an explicit variable. | |
TracedValue (const TracedValue &o) | |
Copy constructor. | |
template<typename U > | |
TracedValue (const TracedValue< U > &other) | |
Copy from a TracedValue of a compatible type. | |
template<typename U > | |
TracedValue (const U &other) | |
Copy from a variable type compatible with this underlying type. | |
void | Connect (const CallbackBase &cb, std::string path) |
Connect a Callback with a context string. | |
void | ConnectWithoutContext (const CallbackBase &cb) |
Connect a Callback (without context.) | |
void | Disconnect (const CallbackBase &cb, std::string path) |
Disconnect a Callback which was connected with context. | |
void | DisconnectWithoutContext (const CallbackBase &cb) |
Disconnect a Callback which was connected without context. | |
T | Get () const |
Get the underlying value. | |
operator T () const | |
Cast to the underlying type. | |
TracedValue & | operator= (const TracedValue &o) |
Assignment. | |
void | Set (const T &v) |
Set the value of the underlying variable. | |
TracedValue & | operator++ () |
Pre/post- increment/decrement operator. | |
TracedValue & | operator-- () |
Pre/post- increment/decrement operator. | |
TracedValue | operator++ (int) |
Pre/post- increment/decrement operator. | |
TracedValue | operator-- (int) |
Pre/post- increment/decrement operator. | |
Private Attributes | |
TracedCallback< T, T > | m_cb |
The connected Callback. | |
T | m_v |
The underlying value. | |
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.
T | [explicit] The type of the underlying value being traced. |
Definition at line 104 of file traced-value.h.
|
inline |
Default constructor.
Definition at line 108 of file traced-value.h.
|
inline |
|
inline |
Construct from an explicit variable.
[in] | v | The variable to trace. |
Definition at line 126 of file traced-value.h.
|
inline |
Copy from a TracedValue of a compatible type.
U | [deduced] The underlying type of the other TracedValue. |
[in] | other | The other TracedValuet to copy. |
Definition at line 158 of file traced-value.h.
|
inline |
Copy from a variable type compatible with this underlying type.
U | [deduced] Type of the other variable. |
[in] | other | The other variable to copy. |
Definition at line 169 of file traced-value.h.
|
inline |
Connect a Callback with a context string.
The context string will be provided as the first argument to the Callback function.
[in] | cb | The Callback to connect to the target trace source. |
[in] | path | The context to bind to the user callback. |
Definition at line 193 of file traced-value.h.
References ns3::TracedCallback< Ts >::Connect(), and ns3::TracedValue< T >::m_cb.
|
inline |
Connect a Callback (without context.)
[in] | cb | The callback to connect. |
Definition at line 179 of file traced-value.h.
References ns3::TracedCallback< Ts >::ConnectWithoutContext(), and ns3::TracedValue< T >::m_cb.
|
inline |
Disconnect a Callback which was connected with context.
[in] | cb | The Callback to disconnect. |
[in] | path | The context to bind to the user callback. |
Definition at line 214 of file traced-value.h.
References ns3::TracedCallback< Ts >::Disconnect(), and ns3::TracedValue< T >::m_cb.
|
inline |
Disconnect a Callback which was connected without context.
[in] | cb | The Callback to disconnect. |
Definition at line 203 of file traced-value.h.
References ns3::TracedCallback< Ts >::DisconnectWithoutContext(), and ns3::TracedValue< T >::m_cb.
|
inline |
Get the underlying value.
Definition at line 238 of file traced-value.h.
References ns3::TracedValue< T >::m_v.
Referenced by ns3::TcpTxBuffer::CopyFromSequence(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::TcpSocketBase::DoForwardUp(), TcpVenoTest::DoRun(), ns3::TcpSocketBase::GetHighRxAck(), ns3::TcpSocketBase::GetRWnd(), ns3::QueueBase::IsEmpty(), ns3::operator!(), ns3::operator!=(), ns3::operator!=(), ns3::operator!=(), ns3::operator%=(), ns3::operator&=(), ns3::operator*=(), ns3::operator+(), ns3::TracedValue< T >::operator++(), ns3::TracedValue< T >::operator++(), ns3::operator+=(), ns3::operator-(), ns3::TracedValue< T >::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::operator>(), ns3::operator>(), ns3::operator>(), ns3::operator>=(), ns3::operator>=(), ns3::operator>=(), ns3::operator>>=(), ns3::operator^=(), ns3::operator|=(), ns3::operator~(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketCongestedRouter::SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), and ns3::TcpSocketBase::Window().
|
inline |
Cast to the underlying type.
Definition at line 135 of file traced-value.h.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 250 of file traced-value.h.
References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 268 of file traced-value.h.
References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 259 of file traced-value.h.
References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 278 of file traced-value.h.
References ns3::TracedValue< T >::Get(), ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.
|
inline |
Assignment.
[in] | o | The value to assign to this instance. |
Definition at line 145 of file traced-value.h.
References ns3::TracedValue< T >::m_v, ns3::TracedValue< T >::Set(), and TRACED_VALUE_DEBUG.
|
inline |
Set the value of the underlying variable.
If the new value differs from the old, the Callback will be invoked.
[in] | v | The new value. |
Definition at line 225 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::TracedValue< T >::operator++(), ns3::operator+=(), ns3::TracedValue< T >::operator--(), ns3::TracedValue< T >::operator--(), ns3::operator-=(), ns3::operator/=(), ns3::TracedValue< T >::operator=(), ns3::operator>>=(), ns3::operator^=(), and ns3::operator|=().
|
private |
The connected Callback.
Definition at line 294 of file traced-value.h.
Referenced by ns3::TracedValue< T >::Connect(), ns3::TracedValue< T >::ConnectWithoutContext(), ns3::TracedValue< T >::Disconnect(), ns3::TracedValue< T >::DisconnectWithoutContext(), and ns3::TracedValue< T >::Set().
|
private |
The underlying value.
Definition at line 292 of file traced-value.h.
Referenced by ns3::TracedValue< T >::Get(), ns3::TracedValue< bool >::operator bool(), ns3::TracedValue< T >::operator=(), and ns3::TracedValue< T >::Set().