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 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... | |
T | Get (void) const |
Get the underlying value. More... | |
operator T () const | |
Cast to the underlying type. More... | |
TracedValue & | operator= (const TracedValue &o) |
Assignment. More... | |
void | Set (const T &v) |
Set the value of the underlying variable. More... | |
TracedValue & | operator++ () |
Pre/post- increment/decrement operator. More... | |
TracedValue & | operator-- () |
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... | |
T | m_v |
The underlying value. More... | |
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 110 of file traced-value.h.
|
inline |
Default constructor.
Definition at line 114 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 compatable type.
U | [deduced] The underlying type of the other TracedValue. |
[in] | other | The other TracedValuet to copy. |
Definition at line 151 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 160 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 180 of file traced-value.h.
|
inline |
Connect a Callback (without context.)
[in] | cb | The callback to connect. |
Definition at line 168 of file traced-value.h.
|
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 197 of file traced-value.h.
|
inline |
Disconnect a Callback which was connected without context.
[in] | cb | The Callback to disconnect. |
Definition at line 188 of file traced-value.h.
|
inline |
Get the underlying value.
Definition at line 217 of file traced-value.h.
Referenced by ns3::TcpSocketBase::BytesInFlight(), ns3::TcpTxBuffer::CopyFromSequence(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::TcpSocketBase::DoForwardUp(), ns3::GetCongStateFrom(), ns3::TcpSocketBase::NewAck(), ns3::operator!(), ns3::operator!=(), ns3::operator%(), ns3::operator%=(), ns3::operator&(), ns3::operator&=(), ns3::operator*(), ns3::operator*=(), ns3::operator+(), ns3::TracedValue< TcpCongState_t >::operator++(), ns3::operator+=(), ns3::operator-(), ns3::TracedValue< TcpCongState_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::TcpSocketBase::SendDataPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::TcpSocketBase::UnAckDataCount(), and ns3::TcpSocketBase::Window().
|
inline |
Cast to the underlying type.
Definition at line 132 of file traced-value.h.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 227 of file traced-value.h.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 241 of file traced-value.h.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 234 of file traced-value.h.
|
inline |
Pre/post- increment/decrement operator.
This invokes the Callback.
Definition at line 249 of file traced-value.h.
|
inline |
Assignment.
[in] | o | The value to assign to this instance. |
Definition at line 140 of file traced-value.h.
|
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 206 of file traced-value.h.
Referenced by ns3::operator%=(), ns3::operator&=(), ns3::operator*=(), ns3::TracedValue< TcpCongState_t >::operator++(), ns3::operator+=(), ns3::TracedValue< TcpCongState_t >::operator--(), ns3::operator-=(), ns3::operator/=(), ns3::operator<<=(), ns3::TracedValue< TcpCongState_t >::operator=(), ns3::operator>>=(), ns3::operator^=(), and ns3::operator|=().
|
private |
The connected Callback.
Definition at line 263 of file traced-value.h.
Referenced by ns3::TracedValue< TcpCongState_t >::Connect(), ns3::TracedValue< TcpCongState_t >::ConnectWithoutContext(), ns3::TracedValue< TcpCongState_t >::Disconnect(), ns3::TracedValue< TcpCongState_t >::DisconnectWithoutContext(), and ns3::TracedValue< TcpCongState_t >::Set().
|
private |
The underlying value.
Definition at line 261 of file traced-value.h.
Referenced by ns3::TracedValue< TcpCongState_t >::Get(), ns3::TracedValue< ValueClassTest >::operator ValueClassTest(), ns3::TracedValue< TcpCongState_t >::operator=(), and ns3::TracedValue< TcpCongState_t >::Set().