class QueueInterface
1: // Created by Frank M. Carrano and Tim Henry.
2: // Copyright (c) 2013 __Pearson Education__. All rights reserved.
4: /** Listing 13-1.
5: @file QueueInterface.h */
7: #ifndef _QUEUE_INTERFACE
8: #define _QUEUE_INTERFACE
10: template<class ItemType>
11: class QueueInterface
13: {
14: public:
15: /** Sees whether this queue is empty.
16: @return True if the queue is empty, or false if not. */
17: virtual bool isEmpty() const = 0;
18:
19: /** Adds a new entry to the back of this queue.
20: @post If the operation was successful, newEntry is at the
21: back of the queue.
22: @param newEntry The object to be added as a new entry.
23: @return True if the addition is successful or false if not. */
24: virtual bool enqueue(const ItemType& newEntry) = 0;
25:
26: /** Removes the front of this queue.
27: @post If the operation was successful, the front of the queue
28: has been removed.
29: @return True if the removal is successful or false if not. */
30: virtual bool dequeue() = 0;
31:
32: /** Returns the front of this queue.
33: @pre The queue is not empty.
34: @post The front of the queue has been returned, and the
35: queue is unchanged.
36: @return The front of the queue. */
37: virtual ItemType peekFront() const = 0;
38: }; // end QueueInterface
39: #endif