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

/* We used an array of fixed capacity as a circular buffer. */

#ifndef MCS360_CIRCULAR_FIXED_BUFFER_H
#define MCS360_CIRCULAR_FIXED_BUFFER_H

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

         T *data;
         size_t capacity; // capacity of buffer
         int current;     // index to front of queue
         int back;        // index to end of queue
         size_t number;   // number of elements

      public:
 
         Queue( int c );
         // creates an empty queue

         void push( T item );
         // pushes the item at the end of the queue

         bool empty();
         // return true if queue is empty

         T front();
         // returns the element at the front of the queue

         void pop();
         // removes the front element
   };
}
#include "mcs360_circular_fixed_buffer.tc"
#endif

