class ListQueue
1: // Created by Frank M. Carrano and Tim Henry.
2: // Copyright (c) 2013 __Pearson Education__. All rights reserved.
4: /** ADT queue: ADT list implementation.
5: Listing 14-1.
6: @file ListQueue.h */
8: #ifndef _LIST_QUEUE
9: #define _LIST_QUEUE
11: #include "QueueInterface.h"
12: #include "LinkedList.h"
13: #include "PrecondViolatedExcep.h"
15: template<class ItemType>
16: class ListQueue : public QueueInterface<ItemType>
17: {
18: private:
19: LinkedList<ItemType>* listPtr; // Pointer to list of queue items
20:
21: public:
22: ListQueue();
23: ListQueue(const ListQueue& aQueue);
24: ~ListQueue();
25: bool isEmpty() const;
26: bool enqueue(const ItemType& newEntry);
27: bool dequeue();
28:
29: /** @throw PrecondViolatedExcep if queue is empty. */
30: ItemType peekFront() const throw(PrecondViolatedExcep);
31: }; // end ListQueue
33: #include "ListQueue.cpp"
34: #endif