// L-17 MCS 360 Fri 1 Oct 2010 : mcs360_circular_double_ring.h

/* This file is an adaptation of the mcs360_double_list of lecture 12,
   (we use the definition of a double linked node in mcs360_double_node.h),
   adapted to implement a circular list representation for a queue.

Because we allow to push and pop to the front and end of the queue,
the queue is double ended, or a deque. */

#ifndef MCS360_CIRCULAR_DOUBLE_RING_H
#define MCS360_CIRCULAR_DOUBLE_RING_H

#define NULL 0

namespace mcs360_circular_double_ring
{
   template <typename T>
   class Queue
   {
      private:

         #include "mcs360_double_node.h"
         Node *current; // pointer to current node
         int number; // number of elements

      public:

         Queue(); // returns an empty queue

         bool empty();
         // true if queue empty, false otherwise
         int size();
         // returns the size of the queue
         T front();
         // returns the item at front of queue

         void move_front_forward();
         // makes next element front of queue
         void move_front_backward();
         // makes previous item front of queue

         void push_front(T item);
         // inserts item in front of queue
         void push_back(T item);
         // appends item to the end

         void pop_front();
         // removes the element at front
         void pop_back();
         // removes the element at end
   };
}
#include "mcs360_circular_double_ring.tc"
#endif

