Go to the first, previous, next, last section, table of contents.


CNEventScheduler -- Event Scheduler

SYNOPSIS

#include <CNCL/EventScheduler.h>

TYPE

CN_EVENTSCHEDULER

BASE CLASSES

CNEventBaseSched

DERIVED CLASSES

None

RELATED CLASSES

CNEvent, CNEventList, CNEventHandler, CNEventHeapSched

DESCRIPTION

CNEventScheduler is the central simulation control. It manages the events and delivers them to the addressed event handlers.

Scheduled events are sorted with respect to their scheduled simulation time and their priority. If there are two or more events with exactly the same scheduled simulation time and the same priority, they are processed in FIFO order.

If this exact behaviour is not strictly required, if scheduled simulation time and priority are sufficient to determine the procession order of events, then CNEventHeapSched should be used instead of CNEventScheduler. CNEventHeapSched avoids some potential performace deficiencies CNEventScheduler might show.

Constructors:

CNEventScheduler();
CNEventScheduler(CNParam *param);
Initializes the event scheduler.

In addition to the member functions required by CNCL, CNEventScheduler provides:

void add_event(CNEvent *ev);
void send_event(CNEvent *ev);
Adds/sends an event to an event handler.
void delete_event(CNEventID id);
Deletes event with ID id.
void delete_events(CNEventHandler *evh, bool to=TRUE);
Deletes all events from the list that are addressed to event handler evh or that are coming from the event handler if to equals FALSE.
CNEvent *peek_event();
CNEvent *peek_event(CNEventID id);
CNEvent *next_event();
Peeks next event or event with ID id. Returns pointer to event, or NIL if not available.
void stop();
Stops the scheduler after processing the current event and deletes all pending events in the event list. May be used inside an event handler to stop the simulation.
CNEventIterator *create_iterator();
Creates an iterator object to traverse the list of events.


Go to the first, previous, next, last section, table of contents.