4 #include "ns3/double-probe.h"
6 #include "ns3/random-variable-stream.h"
7 #include "ns3/trace-source-accessor.h"
8 #include "ns3/traced-value.h"
9 #include "ns3/nstime.h"
10 #include "ns3/simulator.h"
11 #include "ns3/object.h"
12 #include "ns3/type-id.h"
13 #include "ns3/names.h"
20 static TypeId GetTypeId (
void);
23 m_var = CreateObject<ExponentialRandomVariable> ();
34 m_time = m_var->GetValue ();
49 aux = m_var->GetValue ();
66 .AddTraceSource (
"Emitter",
"XX",
68 "ns3::TracedValue::DoubleCallback")
80 virtual void DoRun (
void);
81 void TraceSink (std::string context,
double oldValue,
double newValue);
87 :
TestCase (
"basic probe test case"),
105 if (context ==
"testProbe")
109 else if (context ==
"testProbe2")
127 Simulator::Stop (
Seconds (300));
131 Names::Add (
"/Names/SampleEmitter", s);
157 Simulator::Destroy ();
std::string GetName(void) const
Get the object's name.
void TraceSink(std::string context, double oldValue, double newValue)
static ProbeTestSuite probeTestSuite
Ptr< ExponentialRandomVariable > m_var
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
AttributeValue implementation for Time.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual ~ProbeTestCase1()
#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...
static TypeId GetTypeId(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Time Now(void)
Return the current simulation virtual time.
TracedValue< double > m_trace
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
Time Seconds(double value)
Construct a Time in the indicated unit.
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
#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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
#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.