#include <CNCL/EventHeapSched.h>
CN_EVENTHEAPSCHED
CNEventBaseSched
None
CNEvent, CNEventHandler, CNEventScheduler
CNEventHeapSched
is a replacement for
CNEventScheduler
. From the user's point of view, it is completely
compatible, but it differs in the internally used datastructures and
algorithms.
If a high number of events is used simultaneously, the eventlist used in
CNEventScheduler
can become very slow. CNEventHeapSched
solves that problem by using a more efficient algorithm, a "heap".
However there is one drawback with CNEventHeapSched
: in
contrast to CNEventScheduler
no FIFO order of processing can be
guaranteed if events compare equal. If there are for example two or
more events with exactly the same scheduled simulation time and the same
priority, then they are processed in random order.
Constructors:
CNEventHeapSched();
CNEventHeapSched(CNParam *param);
In addition to the member functions required by CNCL, CNEventHeapSched
provides:
void add_event(CNEvent *ev);
void send_event(CNEvent *ev);
void delete_event(CNEventID id);
id
.
void delete_events(CNEventHandler *evh, bool to=TRUE);
evh
.
CNEvent *peek_event();
CNEvent *peek_event(CNEventID id);
id
. Returns pointer to
event, or NIL
if not available.
CNEvent *next_event();
CNEvent
from the current heap.
void stop();
CNEventIterator *create_iterator();
Go to the first, previous, next, last section, table of contents.