7 #ifndef AULA1_STATICQUEUE_HPP 8 #define AULA1_STATICQUEUE_HPP 23 std::string
getName() {
return "Static Queue"; }
38 size =
count = (
sizeof(data) /
sizeof(data[0])) + 1;
40 tail = (
sizeof(data) /
sizeof(data[0]));
47 throw std::out_of_range(
"The queue is full.");
57 throw std::out_of_range(
"The queue is empty.");
68 throw std::out_of_range(
"The queue is empty.");
T peek()
See the first value from the queue, without removing it.
StaticQueue(int size)
Create a fixed-size queue.
void enqueue(T val)
Add an element to the end of the queue.
int getSize()
Outputs the number of elements stored in the structure.
bool isEmpty()
Check whether the structure is empty.
Abstract queue interface.
T dequeue()
Remove an element from the queue.
Queue implementation using a native C++ array as data storage.
std::string getName()
Provides the name of the data structure as a string representation.
bool isFull()
Check whether the structure is full.
StaticQueue(T data[])
create the structure and populate it with the data from the array