Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef QUETYPE_H_INCLUDED
- #define QUETYPE_H_INCLUDED
- // Header file for Queue ADT.
- #include <new>
- #include <cstddef>
- class FullQueue
- {};
- class EmptyQueue
- {};
- typedef char ItemType;
- struct NodeType;
- class QueType
- {
- public:
- QueType();
- // Class constructor.
- // Because there is a default constructor, the precondition
- // that the queue has been initialized is omitted.
- QueType(int max);
- // Parameterized class constructor.
- ~QueType();
- // Class destructor.
- QueType(const QueType& anotherQue);
- // Copy constructor
- void MakeEmpty();
- // Function: Initializes the queue to an empty state.
- // Post: Queue is empty.
- bool IsEmpty() const;
- // Function: Determines whether the queue is empty.
- // Post: Function value = (queue is empty)
- bool IsFull() const;
- // Function: Determines whether the queue is full.
- // Post: Function value = (queue is full)
- void Enqueue(ItemType newItem);
- // Function: Adds newItem to the rear of the queue.
- // Post: If (queue is full) FullQueue exception is thrown
- // else newItem is at rear of queue.
- void Dequeue(ItemType& item);
- // Function: Removes front item from the queue and returns it in item.
- // Post: If (queue is empty) EmptyQueue exception is thrown
- // and item is undefined
- // else front element has been removed from queue and
- // item is a copy of removed element.
- private:
- NodeType* front;
- NodeType* rear;
- };
- #endif // QUETYPE_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement