/* File: queues.h
 *
 * The interface to the abstract function queue
 */

#define DEFAULT_QSIZE 10       // defualt queue size

class Queue {
    public:
        int remove();                // remove and return the head element
        int peek();                  // return the head element
        void insert(int element);    // add element to the tail

        class Queue_empty {};        // exception if we remove an empty queue
        class Queue_full {};         // exception if we insert to a full queue

        Queue(int size = DEFAULT_QSIZE) { data = new int[size];
                                          queue_size = size;
                                          head = tail = 0;
                                          empty = true; }
        ~Queue() { delete[] data; }

    private:
        int head;                    // the index of the head
        int tail;                    // the next free index
        bool empty;                  // is the queue empty?
        int queue_size;              // the size of the queue
        int *data;                   // the array used for the queue
};


