class SL_PriorityQueue
1: // Created by Frank M. Carrano and Tim Henry.
2: // Copyright (c) 2013 __Pearson Education__. All rights reserved.
4: /** ADT priority queue: ADT sorted list implementation.
5: Listing 14-6.
6: @file SL_PriorityQueue.h */
8: #ifndef _PRIORITY_QUEUE
9: #define _PRIORITY_QUEUE
11: #include "PriorityQueueInterface.h"
12: #include "LinkedSortedList.h"
13: #include "PrecondViolatedExcep.h"
15: template<class ItemType>
16: class SL_PriorityQueue : public PriorityQueueInterface<ItemType>
17: {
18: private:
19: LinkedSortedList<ItemType>* slistPtr; // Pointer to sorted list of
20: // items in the priority queue
22: public:
23: SL_PriorityQueue();
24: SL_PriorityQueue(const SL_PriorityQueue& pq);
25: ~SL_PriorityQueue();
27: bool isEmpty() const;
28: bool add(const ItemType& newEntry);
29: bool remove();
31: /** @throw PrecondViolatedExcep if priority queue is empty. */
32: ItemType peek() const throw(PrecondViolatedExcep);
33: }; // end SL_PriorityQueue
35: #include "SL_PriorityQueue.cpp"
36: #endif