10#include "ns3/object.h"
11#include "ns3/sequence-number.h"
13#include "ns3/traced-value.h"
14#include "ns3/type-id.h"
15#include "ns3/type-name.h"
63 std::cout <<
": " <<
static_cast<int64_t
>(oldValue) <<
" -> " <<
static_cast<int64_t
>(newValue)
73 g_Result += std::string(
g_Result.empty() ?
"" :
" | ") +
"newValue should be 1";
126 template <
typename T>
148 .AddTraceSource(
"value",
149 "A value being traced.",
166 template <
typename U>
170 std::cout <<
GetTypeId() <<
": " << (ok ?
"connected " :
"failed to connect ")
177 std::cout << std::endl;
180 g_Result =
"failed to connect callback";
203 template <
typename T,
typename U>
214 void DoRun()
override;
218 :
TestCase(
"Check basic TracedValue callback operation")
A class to check that the callback function typedef will actually connect to the TracedValue.
static TypeId GetTypeId()
Register this type.
void Invoke(U cb)
Check the sink function against the actual TracedValue invocation.
TracedValue< T > m_value
Traced value.
TracedValueCallback Test Case.
~TracedValueCallbackTestCase() override
void CheckType()
Check the TracedValue typedef against TracedValueCbSink<T>.
void DoRun() override
Implementation to actually run this TestCase.
TracedValueCallbackTestCase()
TracedValueCallback TestSuite.
TracedValueCallbackTestSuite()
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
A base class which provides memory management and object aggregation.
NUMERIC_TYPE GetValue() const
Extracts the numeric value of the sequence number.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
int64_t GetInteger() const
Get the raw time value, in the current resolution unit.
Trace classes with value semantics.
a unique identifier for an interface.
TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const
Get the trace source by index.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::string TypeNameGet()
Type name strings for AttributeValue types.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
std::string g_Result
Result of callback test.
void TracedValueCbSink< SequenceNumber32 >(SequenceNumber32 oldValue, SequenceNumber32 newValue)
TracedValueCbSink specialization for SequenceNumber32.
void TracedValueCbSink< Time >(Time oldValue, Time newValue)
TracedValueCbSink specialization for Time.
void TracedValueCbSink(T oldValue, T newValue)
Template for TracedValue sink functions.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static TracedValueCallbackTestSuite tracedValueCallbackTestSuite
Static variable for test initialization.
Ptr< PacketSink > sink
Pointer to the packet sink application.