Abstract class to encapsulate event scheduling. More...
#include <cscheduler.h>
Public Member Functions | |
cScheduler () | |
virtual | ~cScheduler () |
virtual void | setSimulation (cSimulation *_sim) |
virtual void | startRun ()=0 |
virtual void | endRun ()=0 |
virtual void | executionResumed () |
virtual cMessage * | getNextEvent ()=0 |
Abstract class to encapsulate event scheduling.
See description of getNextEvent() for more info.
To switch to your own scheduler class (reasons you'd like to do that include real-time simulation, hardware-in-the-loop simulation, distributed (federated) simulation, parallel distributed simulation), subclass cScheduler, register your new class with the Register_Class() macro, then add the following to omnetpp.ini
:
[General] scheduler-class="MyClass"
virtual void cScheduler::executionResumed | ( | ) | [inline, virtual] |
Called every time the user hits the Run button in Tkenv.
Real-time schedulers (e.g. cRealTimeScheduler) may make use this callback to pin current simulation time to current wall clock time.
Reimplemented in cRealTimeScheduler.
virtual cMessage* cScheduler::getNextEvent | ( | ) | [pure virtual] |
The scheduler function -- it should return the next event to be processed.
Normally (with sequential execution) it just returns msgQueue.peekFirst(). With parallel and/or real-time simulation, it is also the scheduler's task to synchronize with real time and/or with other partitions.
If there is no more event, it throws cTerminationException.
A NULL return value means that there is no error but execution was stopped by the user (e.g. with STOP button on the GUI) while getNextEvent() was waiting for external synchronization.
Implemented in cSequentialScheduler, and cRealTimeScheduler.