//-------------------------------------------------------------------- // // Laboratory 6 queuearr.h // // Class declaration for the array implementation of the Queue ADT // //-------------------------------------------------------------------- #include #include using namespace std; const int defMaxQueueSize = 10; // Default maximum queue size template < class DT > class Queue { public: // Constructor Queue ( int maxNumber = defMaxQueueSize ) throw ( bad_alloc ); // Destructor ~Queue (); // Queue manipulation operations void enqueue ( const DT &newData ) // Enqueue data item throw ( logic_error ); DT dequeue () // Dequeue data item throw ( logic_error ); void clear (); // Clear queue // Queue status operations bool isEmpty () const; // Queue is empty bool isFull () const; // Queue is full // Output the queue structure -- used in testing/debugging void showStructure () const; // In-lab operations void putFront ( const DT &newDataItem ) // Insert at front throw ( logic_error ); DT getRear () // Get from rear throw ( logic_error ); int getLength () const; // Number of data items private: // Data members int maxSize, // Maximum number of data elements in the queue front, // Index of the front data element rear; // Index of the rear data element DT *dataItems; // Array containing the queue data items };