//================================================================ // This module provides class Queue, a kind of first-in-first-out // queue. The constructor creates an empty queue. Objects of // class Queue have the following capabilities. // // q.insert(x) Insert object x at the back of queue q. // // q.remove(x) Remove the object at the front of queue q and store // the object into variable x. An attempt to remove // an object from an empty queue will cause the program // to stop. // // q.isEmpty() Return true if q is empty, false if not. // // q.length() Return the length of queue q. // // q.print() Print all of the objects in queue q, from // front to back. //================================================================ #ifndef QUEUE_H #define QUEUE_H #include "simobject.h" class Queue { public: Queue(); void insert(SimObject* obj); void remove(SimObject*& obj); bool isEmpty() const; int length() const; void print() const; private: struct QCell; QCell* ptr; int len; void insert(QCell*& p, SimObject* obj); }; #endif