|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
27 #include "ns3/core-module.h"
28 #include "ns3/double-probe.h"
45 static TypeId GetTypeId (
void);
48 void DoInitialize (
void);
64 .SetGroupName (
"Stats")
66 .AddTraceSource (
"Counter",
69 "ns3::TracedValueCallback::Double")
78 m_var = CreateObject<ExponentialRandomVariable> ();
111 NS_LOG_DEBUG (
"context: " << context <<
" old " << oldVal <<
" new " << newVal);
118 NS_LOG_DEBUG (
"context: " << context <<
" old " << oldVal <<
" new " << newVal);
121 int main (
int argc,
char *argv[])
124 cmd.Parse (argc, argv);
149 probe1->
SetName (
"ObjectProbe");
153 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1");
159 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1 Output");
177 NS_ASSERT_MSG (connected,
"Trace source not connected to probe2 Output");
184 probe3->
SetName (
"StaticallyAccessedProbe");
192 NS_ASSERT_MSG (connected,
"Trace source not connected to probe3 Output");
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Parse command-line arguments.
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
void DoInitialize(void)
Initialize() implementation.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
A base class which provides memory management and object aggregation.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static void Run(void)
Run the simulation.
void NotifyViaProbe(std::string context, double oldVal, double newVal)
std::string GetName(void) const
Get the object's name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
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.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
static void SetValueByPath(std::string path, double value)
Set a probe value by its name in the Config system.
Ptr< ExponentialRandomVariable > m_var
TracedValue< double > m_counter
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
static TypeId GetTypeId(void)
Register this type.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
void NotifyViaTraceSource(std::string context, double oldVal, double newVal)