![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
QueueP.hGo to the documentation of this file.00001 00017 #include "QueueException.h" 00018 typedef desired-type-of-queue-item QueueItemType; 00019 00022 class Queue 00023 { 00024 public: 00025 // Constructors and destructor: 00026 00028 Queue(); 00029 00032 Queue(const Queue& Q); 00033 00035 ~Queue(); 00036 00037 // Queue operations: 00038 00044 bool isEmpty() const; 00045 00051 void enqueue(const QueueItemType& newItem) 00052 throw(QueueException); 00053 00059 void dequeue() throw(QueueException); 00060 00067 void dequeue(QueueItemType& queueFront) throw(QueueException); 00068 00074 void getFront(QueueItemType& queueFront) const 00075 throw(QueueException); 00076 00077 private: 00081 struct QueueNode 00082 { QueueItemType item; 00083 QueueNode *next; 00084 }; // end QueueNode 00085 QueueNode *backPtr; 00086 QueueNode *frontPtr; 00087 }; // end Queue 00088 // End of header file. |