28#define NS_LOG_APPEND_CONTEXT \
30 std::clog << "(local context) "; \
33#include "ns3/core-module.h"
34#include "ns3/network-module.h"
108main(
int argc,
char** argv)
111 cmd.Parse(argc, argv);
114 auto node = CreateObject<Node>();
117 auto myObj = CreateObject<MyEventObject>();
120 node->AggregateObject(myObj);
122 NS_LOG_UNCOND(
"Scheduling the MyEventObject::Event with node context");
123 Simulator::ScheduleWithContext(node->GetId(),
Seconds(3), &MyEventObject::Event, &(*myObj));
131 Simulator::Destroy();
Simple object to aggregate to a node.
MyEventObject()
Constructor.
void Event()
Class member function with logging.
~MyEventObject() override
Destructor.
static TypeId GetTypeId()
Get the type ID.
Parse command-line arguments.
A base class which provides memory management and object aggregation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
void FreeEvent()
A free function with logging.
Every class exported by the ns3 library is enclosed in the ns3 namespace.