-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
76 lines (64 loc) · 1.59 KB
/
Copy pathqueue.h
File metadata and controls
76 lines (64 loc) · 1.59 KB
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
74
75
76
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "list.h"
/* queue.c
* Max Malmer, [email protected]
* Laboration 4 5DV088 HT19
* Version 1.0, 2019-10-24
* A implementation of the datatype queue with a double linked list.
* Use queue_free() to clear the memory after use. Give the input 1
* to the queue to take control of the memory cleaning. Give it 0
* otherwise.
*/
// ===========INTERNAL DATA TYPES============
typedef struct queue queue;
// ===========INTERNAL FUNCTION IMPLEMENTATIONS============
/**
* queue_empty() - Creates a new empty queue.
* @boolean: The value given for taking control of memory.
*
* Returns: A pointer to a new queue.
*/
queue *queue_empty(int boolean);
/**
* list_is_empty() - Checks if the queue is empty.
* @q: The specified queue.
*
* Returns: A boolean if it's empty or not.
*/
bool queue_is_empty(queue *q);
/**
* queue_push() - Adds a element to the queue.
* @q: The specified queue.
* @v: The element to be added.
*
* Returns: The queue.
*/
queue *queue_push(queue *q, void *v);
/**
* queue_pop() - Removes the top element in the queue.
* @q: The specified queue.
*
* Returns: The queue.
*/
queue *queue_pop(queue *q);
/**
* queue_inspect() - Inspects the top element of the queue
* @q: The specified queue.
*
* Returns: A pointer to the element.
*/
void *queue_inspect(queue *q);
/**
* queue_free() - Removes the queue and it's elements from memory.
* @q: The specified queue.
*
*/
void queue_free(queue *q);
/**
* queue_print() - Prints the queue.
* @q: The specified queue.
*
*/
void queue_print(queue *q);