-
Notifications
You must be signed in to change notification settings - Fork 0
/
Queue.h
41 lines (33 loc) · 941 Bytes
/
Queue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @file Queue.h
* @brief Contains the queue class definitions
*
* Contains the definition of the queue class and the node struct.
* The queue class is used to store tasks in a FIFO order.
*
* @date 10/31/24
* @author Fiya Clerget, Marcello Novak
*/
#pragma once
#include "Task.h"
struct QueueNode {
Task taskData;
QueueNode* nextTask;
QueueNode* prevTask;
};
class Queue {
private:
QueueNode* head; // Front of the queue
QueueNode* tail; // End of the queue
public:
// Constructor and Destructor
Queue();
~Queue();
// Push and Pop methods
void push(Task task);
void pop();
Task* top(); // Pointer for front task, so it can be accessed without popping
bool isEmpty(); // Bool to check if the queue is empty
void printQueue(); // Function to print the queue
void runExample(); // Function to run the example
};