equal
deleted
inserted
replaced
18 * If you want to trace the change of value of a class or |
18 * If you want to trace the change of value of a class or |
19 * primitive type which have value semantics (they _must_ |
19 * primitive type which have value semantics (they _must_ |
20 * support operator !=), you can wrap them in an instance of |
20 * support operator !=), you can wrap them in an instance of |
21 * this template: this instance will behave just like |
21 * this template: this instance will behave just like |
22 * the original class (if it did not export any special method), |
22 * the original class (if it did not export any special method), |
23 * and will define Connect/Disconnect methods to work |
23 * and will define Connect/DisconnectWithoutContext methods to work |
24 * with an ns3::TraceSourceAccessor. |
24 * with an ns3::TraceSourceAccessor. |
25 */ |
25 */ |
26 template <typename T> |
26 template <typename T> |
27 class TracedValue |
27 class TracedValue |
28 { |
28 { |
59 TracedValue (const Enum &value) |
59 TracedValue (const Enum &value) |
60 : m_v (value.Get ()) {} |
60 : m_v (value.Get ()) {} |
61 operator Enum () const { |
61 operator Enum () const { |
62 return Enum (m_v); |
62 return Enum (m_v); |
63 } |
63 } |
64 void Connect (const CallbackBase &cb) { |
64 void ConnectWithoutContext (const CallbackBase &cb) { |
65 m_cb.Connect (cb); |
65 m_cb.ConnectWithoutContext (cb); |
66 } |
66 } |
67 void ConnectWithContext (const CallbackBase &cb, std::string path) { |
67 void Connect (const CallbackBase &cb, std::string path) { |
68 m_cb.ConnectWithContext (cb, path); |
68 m_cb.Connect (cb, path); |
69 } |
69 } |
70 void Disconnect (const CallbackBase &cb) { |
70 void DisconnectWithoutContext (const CallbackBase &cb) { |
71 m_cb.Disconnect (cb); |
71 m_cb.DisconnectWithoutContext (cb); |
72 } |
72 } |
73 void DisconnectWithContext (const CallbackBase &cb, std::string path) { |
73 void Disconnect (const CallbackBase &cb, std::string path) { |
74 m_cb.DisconnectWithContext (cb, path); |
74 m_cb.Disconnect (cb, path); |
75 } |
75 } |
76 void Set (const T &v) { |
76 void Set (const T &v) { |
77 if (m_v != v) |
77 if (m_v != v) |
78 { |
78 { |
79 m_cb (m_v, v); |
79 m_cb (m_v, v); |