# cScheduler Class Reference
[Extension interface to Envir, Internal classes]

`#include <cscheduler.h>`

Inheritance diagram for cScheduler:

List of all members.

## Detailed Description

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"

## 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

## Constructor & Destructor Documentation

cScheduler::cScheduler | ( |  | ) |

| Constructor.

virtual cScheduler::~cScheduler | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

virtual void cScheduler::endRun | ( |  | ) | `[pure virtual]`

| Called at the end of a simulation run. Implemented in cSequentialScheduler, and cRealTimeScheduler.

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's no more event, it throws cTerminationException.

A NULL return value means that there's 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.

virtual void cScheduler::setSimulation | ( | cSimulation * | _sim | ) | `[virtual]`

| Pass cSimulation object to scheduler.

virtual void cScheduler::startRun | ( |  | ) | `[pure virtual]`

| Called at the beginning of a simulation run. Implemented in cSequentialScheduler, and cRealTimeScheduler.

The documentation for this class was generated from the following file:

- cscheduler.h