The simulation package provides the following classes: simulation (which contains the scheduler), event (representing the events), entity (representing processes consisting of events), generator (which provides a variety of random distribution functions), resource (to model passive objects conveniently), histogram (to plot the results of a simulation) and analysis (to perform statistical analyses on the results).
The public interface of the class event (used in the simulation package) looks as follows:
interface event : handler { int operator()(); // called when activating the event void timestamp(); double timespent(); // time spent since last stamp ... };In addition it contains functions to determine the status of an event. For example, an event may be conditional (which means that it will be tried for each cycle of the scheduler) or pending (which means that its activation will be delayed until it becomes active or conditional).
The interface of the class entity (representing processes) looks as follows:
interface entity : event { int phase(); void phase( int ph ); };An entity may be regarded as a 'structured event', that is as an active object with phases in its life-cycle. In our approach, however, an explicit switch on the entity's phases must be included in the operator() function.
From the perspective of our hypermedia framework, we benefit from the simulation package by having an efficient scheduler at our disposal and hence a convenient way to employ application-defined events. In addition, we extended the simulation package with a real time option, that allows us for example to define easily a clock-synchronized slide show. (See the examples???)