// This may look like C code, but it is really -*- C++ -*- // (The line above tells Emacs to use C++ mode to edit this file.) // The two lines below prevent multiple-inclusion problems #ifndef QUEUE_H #define QUEUE_H template class Queue { public: // Constructs a queue; requires the number of elements to allow. Queue(int num_items); // Destructor ~Queue(); // Copy constructor Queue(Queue& q); // Overloaded assignment const Queue& operator=(const Queue& q); // PRE: !isFull() // Places an item at the tail of the queue. void enqueue(T item); // PRE: !isEmpty() // Removes an item from the head of the queue and places it into // the output parameter item. void dequeue(T& item); // Returns true if the queue is empty, or false otherwise. int isEmpty(void); // Returns true if no more items will fit in the queue, or false // otherwise. int isFull(void); private: // By convention, private and protected class members start with // the '_' character. int _head, _tail; // The head and tail indices T *_elts; // The array of elements. int _eltsSize; // The size of the _elts array }; #endif