-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.h
42 lines (25 loc) · 918 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
42
typedef struct Entry{
int id;
int lamport_clock;
int meeting_id;
int cylon_id;
struct Entry* next;
} queue_entry;
typedef struct{
int id;
queue_entry* entries;
} r_queue;
//QUEUE FUNCTIONS
r_queue* queue_init(int id);//TESTED
int queue_free(r_queue* queue);//TESTED
int queue_add(r_queue* queue, int id, int lamport_clock);//TESTED
int queue_set_meeting(r_queue* queue, int id, int meeting);//TESTED
int queue_set_cylon(r_queue* queue, int send_id, int cylon);//TESTED
void queue_sort(r_queue* queue);//TODO
queue_entry* queue_get(r_queue* queue, int id);//TESTED
int queue_get_id(r_queue* queue, int num);
int queue_remove(r_queue* queue, int id);//TESTED
int queue_to_array(r_queue* queue, queue_entry array[]);//PROBABLY POINTLESS
int queue_size(r_queue* queue);//TESTED
int queue_top(r_queue* queue, int *id, int *lamport);//TESTED
int queue_position(r_queue* queue, int id);//TESTED