3#include "ns3/double-probe.h"
7#include "ns3/random-variable-stream.h"
8#include "ns3/simulator.h"
10#include "ns3/trace-source-accessor.h"
11#include "ns3/traced-value.h"
12#include "ns3/type-id.h"
85 .AddTraceSource(
"Emitter",
88 "ns3::TracedValueCallback::Double");
104 void DoRun()
override;
112 void TraceSink(std::string context,
double oldValue,
double newValue);
119 :
TestCase(
"basic probe test case"),
134 "Probed a value outside of the time window");
137 "Probed a value outside of the time window");
142 "Value probed different than value in the variable");
144 if (context ==
"testProbe")
148 else if (context ==
"testProbe2")
163 p->SetName(
"testProbe");
175 p->ConnectByObject(
"Emitter",
m_s);
183 p2->SetName(
"testProbe2");
188 p2->ConnectByPath(
"/Names/SampleEmitter/Emitter");
DoubleProbe class - Test case for connecting and receiving data.
~ProbeTestCase1() override
void TraceSink(std::string context, double oldValue, double newValue)
Trace sink.
uint32_t m_pathProbed
Number of probed by Path.
Ptr< SampleEmitter > m_s
Sample emitter pointer.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_objectProbed
Number of probes by Object.
DoubleProbe class TestSuite.
Simple data emitter to check that a probe receives data.
~SampleEmitter() override
static TypeId GetTypeId()
Get the type ID.
void Reschedule()
Reschedule a report.
Ptr< ExponentialRandomVariable > m_var
Random value generator.
void Report()
Reports a new value and reschedules.
double m_time
Delta time between reschedules.
void Start()
Start emission of data.
TracedValue< double > m_trace
Trace.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Trace classes with value semantics.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static ProbeTestSuite probeTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time Seconds(double value)
Construct a Time in the indicated unit.
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...