Data Structures in C++
Queue.hpp
Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-14
4  * @brief Abstract queue interface
5  */
6 
7 #ifndef AULA1_QUEUE_HPP
8 #define AULA1_QUEUE_HPP
9 
10 #include <string>
11 #include "DataStructure.hpp"
12 
13 //! Abstract queue interface
14 //! \tparam T The type of object the data structure will contain
15 template<class T>
16 class Queue : public DataStructure {
17  public:
18 
19  std::string getName() { return "Queue Interface"; }
20 
21  //! Add an element to the end of the queue
22  //! \param val the value to be added to the queue
23  virtual void enqueue(T val) =0;
24 
25  //! Remove an element from the queue
26  //! \return the value that is being removed
27  virtual T dequeue()=0;
28 
29  //! See the first value from the queue, without removing it
30  //! \return The first value on the queue
31  virtual T peek() =0;
32 };
33 
34 #endif
Base class for all data structures.
virtual T dequeue()=0
Remove an element from the queue.
Abstract queue interface.
Definition: Queue.hpp:16
std::string getName()
Provides the name of the data structure as a string representation.
Definition: Queue.hpp:19
virtual void enqueue(T val)=0
Add an element to the end of the queue.
virtual T peek()=0
See the first value from the queue, without removing it.