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"
48 void HandleEvent (
double eventValue);
61 std::cout <<
"Member method received event at "
63 <<
"s started at " << value <<
"s" << std::endl;
74 std::cout <<
"ExampleFunction received event at "
85 std::cout <<
"RandomFunction received event at "
93 std::cout <<
"I should never be called... " << std::endl;
96 int main (
int argc,
char *argv[])
99 cmd.
Parse (argc, argv);
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...
void Start(void)
Start model execution by scheduling a HandleEvent.
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.
static void CancelledEvent(void)
Simple function event handler; the corresponding event is cancelled.
Parse command-line arguments.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void HandleEvent(double eventValue)
Simple event handler.
static Time Now(void)
Return the current simulation virtual time.
static void RandomFunction(void)
Simple function event handler; this function is called randomly.
An identifier for simulation events.
Simple model object to illustrate event handling.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Parse(int argc, char *argv[])
Parse the program arguments.
static void ExampleFunction(MyModel *model)
Simple function event handler which Starts a MyModel object.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.