next up previous contents
Next: The process-oriented approach Up: The event-based approach Previous: The Dining Philosophers

The event class

The interface of the event class :

   interface event 
   protected :
     event(int qp=0,int sp=0,int kf = FALSE);  // queuing and scheduling 
                                  // priority and kill flag as arguments
   public :
     virtual ~event();                   // destructor.
     virtual int operator()() = 0;       // empty

     virtual int verify();               // returns OK
     int report(histogram* h,double interval = 0);  // create report
     void stamp();                       // add time stamp
     double timespent();                 // time since the stamp
     int queuingpriority();              // return queuing priority
     int schedulingpriority();           // return scheduling priority
     void queuingpriority(int p);        // adjust queuing priority
     void schedulingpriority(int p);     // adjust scheduling priority
     int active();                       // is active ?
     int pending();                      // is pending ?
     int conditional();                  // is conditional ?
     int closed();                       // is closed ?
     int passive();                      // is passive ?
     int queued();                       // is queued ?

When creating an event it receives the queuing and scheduling priorities and a kill flag, which should be set to OK when the simulation is ran for a number of terminated events. The report method generates a histogram of the time the events stayed in the simulation. It is printed each interval time units.

A Eliens
Tue Oct 31 09:27:21 MET 1995