#include <CNCL/EventHandler.h>
CN_EVENTHANDLER
CNObject
CNEventExploder
CNEvent, CNEventScheduler, CNSimTime
CNEventHandler
is a base class for creating simulation event
handler. Deriving an event handler class from CNEventHandler
is
necessary for the simulation programm.
Each derived event handler must at least provide the function
event_handler()
, which is defined as pure virtual in class
CNEventHandler
.
Constructors:
CNEventHandler();
CNEventHandler(CNParam *param);
CNEventHandler(CNStringR name);
name
.
In addition to the member functions required by CNCL, CNEventHandler
provides the following protected member functions available to all
derived classes:
virtual void event_handler(const CNEvent *ev) = 0;
CNEventScheduler *scheduler() const;
int state() const;
int state(int new_state);
int get_state() const;
int set_state(int new_state);
CNSimTime now() const;
CNEventID send_event(CNEvent *ev);
CNEventID send(CNEvent *ev);
CNEventID send_now(CNEvent *ev);
send_event()
, but
scheduled time is set to the current time. Returns the event's ID.
CNEventID send_delay(CNEvent *ev, double dt);
send_event()
, but
scheduled time is set to the current time plus a time delay dt. Returns
the event's ID.
void delete_event(CNEventID id);
id
from the scheduler's event list.
void delete_events(CNEventHandler *evh);
evh
. If evh
is NIL
, it deletes all events addressed
to this event handler.
Go to the first, previous, next, last section, table of contents.