Advertisement
Phr0zen_Penguin

ArrayBasedQueue.h - VTC C++ Array-Based Queue Header

Apr 29th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. /**
  2.  * [ArrayBasedQueue.h]
  3.  * The ArrayBasedQueue class declaration/specification.
  4.  */
  5.  
  6. #ifndef ARRAYBASEDQUEUE_H
  7. #define ARRAYBASEDQUEUE_H
  8.  
  9. #include <iostream>
  10.  
  11. class ArrayBasedQueue
  12. {
  13.     /**
  14.      * Everything under public can be accessed by all other programs or classes.
  15.      */
  16.     public:
  17.         /**
  18.          * Constructor(s):
  19.          */
  20.         ArrayBasedQueue(int);
  21.  
  22.         /**
  23.          * Destructor:
  24.          */
  25.         ~ArrayBasedQueue();
  26.  
  27.         /**
  28.          * Mutators:
  29.          */
  30.         void Enqueue(float);
  31.  
  32.         /**
  33.          * Accessors:
  34.          */
  35.         void Dequeue(float &);
  36.  
  37.         /**
  38.          * General Use:
  39.          */
  40.         void MakeEmpty(void);       // empties the queue
  41.         bool IsEmpty(void);         // returns true if the queue is empty
  42.         bool IsFull(void);          // returns true if the queue is full
  43.  
  44.  
  45.     /**
  46.      * Everything under protected can be accessed only by the class itself or (derived) subclasses,
  47.      * as in the case of inheritance.
  48.      */
  49.     protected:
  50.  
  51.  
  52.     /**
  53.      * (Private) DATA MEMBERS/PROPERTIES:
  54.      *
  55.      * Everything under private can only be accessed by the class itself (the code in the
  56.      * implementation file).
  57.      */
  58.     private:
  59.         float   *pData;             // a pointer to the data (because the data is going to be stored in a dynamic array)
  60.         int     q_rear;             // the rear of the queue
  61.         int     q_front;            // the front of the queue
  62.         int     MAX_LENGTH;         // the max length of the queue
  63. };
  64.  
  65. #endif // ARRAYBASEDQUEUE_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement