-
Notifications
You must be signed in to change notification settings - Fork 2
/
queue.h
73 lines (61 loc) · 1.53 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* \file
* Header file for queue methods and handlers designed to be used in conjunction with libp.c
* \author
* Lutando Ngqakaza <[email protected]>
*/
#ifndef QUEUE_H
#define QUEUE_H
#include "node.h"
/**
* \struct Item
* \properties:
* node - the node
* metric - next item attached to this node
*/
struct Item
{
struct Node *node;
struct Item *next;
};
struct Item *head; //holds the head of the queue
struct Item *tail; //holds the tail of the queue
int elements; //holds the queue size
/**
* \brief Initialize the queue
*
* This function initializes the queue
*/
void queue_init();
/**
* \brief adds node to queue
* \param node The node that needs to be pushed into the back of the queue
*
* The node is added to the back of the queue and the tail is set accordingly
*/
void queue_push(struct Node * node);
/**
* \brief Dequeues the queue
* \returns The head of the queue.
* This function pops the top off the queue
*/
int queue_dequeue();
/**
* \brief Getter for queue size
* \returns The size of the queue
* This function returns the size of the queue
*/
int queue_getSize();
/**
* \brief Getter for queue head
* \returns The queue head
* This function returns the head node of the queue
*/
struct Item * get_head();
/**
* \brief Getter for queue tail
* \returns The queue head
* This function returns the head node of the tails
*/
struct Item * get_tail();
#endif