aboutsummaryrefslogtreecommitdiff
path: root/collections/double_ended_queue.h
blob: 332b16ff98e11cbcbfdd9a35613395e91d75bdf8 (plain)
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
#ifndef VECTOR_H
#define VECTOR_H

typedef struct double_ended_queue deq;

/*constructors*/
deq* deq_new();
deq* deq_with_capacity(int);

/*management*/
int deq_size(deq*);
int deq_capacity(deq*);
deq* deq_cp(deq*);

/* Note: Elements are not freed
 * deq_clear should be called before if they are no longer needed.*/
void deq_free(deq*);

/*Free all elements within queue*/
void deq_clear();

/*data*/
void deq_push_back(deq*, void*);
void* deq_pop_front(deq*);
void* deq_pop_back(deq*);
void deq_set(deq*, int, void*);
void* deq_index(deq*, int);

void deq_swap(deq*, int, int);

void* deq_swap_rm_front(deq*, int);
void* deq_swap_rm_back(deq*, int);

/*Note: Does not currently reduce memory footprint*/
void deq_truncate(deq*, int);

void* deq_front(deq*);
void* deq_back(deq*);

void deq_remove(deq*, int);


/*
 * resevee
 * insert
 */
#endif