/* scheduler.h
 *
 * The scheduler maintains a priority queue of events.  It
 * can add events and execute the next event.
 */


#ifndef SCHEDULER_H
#define SCHEDULER_H

#include "seq.h"

class Event;


class Scheduler {

  seq<Event*> events;		// list of events (no fancy queue, here)

public:
  
  // Return true iff there are events remaining in the queue

  bool eventsRemain() {
    return events.size() != 0;
  }

  // Add an event to the queue

  void addEvent( Event *event ) {
    events.add( event );
  }

  // Remove the event of minimum time and execute its handler

  void handleNextEvent();
};

#endif
