22 #include "ns3/simulator.h"
23 #include "ns3/nstime.h"
24 #include "ns3/command-line.h"
25 #include "ns3/double.h"
26 #include "ns3/random-variable-stream.h"
51 void HandleEvent (
double eventValue);
58 &MyModel::HandleEvent,
62 MyModel::HandleEvent (
double value)
64 std::cout <<
"Member method received event at "
66 <<
"s started at " << value <<
"s" << std::endl;
77 std::cout <<
"ExampleFunction received event at "
88 std::cout <<
"RandomFunction received event at "
96 std::cout <<
"I should never be called... " << std::endl;
102 int main (
int argc,
char *argv[])
105 cmd.
Parse (argc, argv);
static void CancelledEvent(void)
Simple function event handler; the corresponding event is cancelled.
Simple model object to illustrate event handling.
static void Run(void)
Run the simulation.
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
void Start(void)
Start model execution by scheduling a HandleEvent.
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Time Now(void)
Return the current simulation virtual time.
An identifier for simulation events.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Parse(int argc, char *argv[])
Parse the program arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
static void ExampleFunction(MyModel *model)
Simple function event handler which Starts a MyModel object.
static void RandomFunction(void)
Simple function event handler; this function is called randomly.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.