root / trunk / code / projects / libwireless / lib / queue.h @ 17
History | View | Annotate | Download (1.16 KB)
1 |
/**
|
---|---|
2 |
* @file queue.h
|
3 |
* @brief A queue implementation
|
4 |
*
|
5 |
* Implements a queue, a first in, first out data structure.
|
6 |
*
|
7 |
* @author Brian Coltin, Colony Project
|
8 |
**/
|
9 |
|
10 |
struct node_def;
|
11 |
|
12 |
/**
|
13 |
* @defgroup queue Queue
|
14 |
* @brief A queue implementation
|
15 |
*
|
16 |
* A queue implementation.
|
17 |
*
|
18 |
* @{
|
19 |
**/
|
20 |
|
21 |
/**
|
22 |
* @struct Queue
|
23 |
* Represents a queue, a first in, first out data structure.
|
24 |
**/
|
25 |
typedef struct |
26 |
{ |
27 |
/**
|
28 |
* The head of the queue, the next item to be removed.
|
29 |
**/
|
30 |
struct node_def* head;
|
31 |
/**
|
32 |
* The tail of the queue, the last item added.
|
33 |
**/
|
34 |
struct node_def* tail;
|
35 |
/**
|
36 |
* The number of elements in the queue.
|
37 |
**/
|
38 |
int size;
|
39 |
} Queue; |
40 |
|
41 |
/** @brief Create a new queue **/
|
42 |
Queue* queue_create(void);
|
43 |
/** @brief Destroy a queue **/
|
44 |
void queue_destroy(Queue* q);
|
45 |
/** @brief Add an element to a queue **/
|
46 |
void queue_add(Queue* q, void* item); |
47 |
/** @brief Remove an element from a queue **/
|
48 |
void* queue_remove(Queue* q);
|
49 |
/** @brief Remove all instances of a given element from a queue **/
|
50 |
void queue_remove_all(Queue* q, void* item); |
51 |
/** @brief Get the size of a queue **/
|
52 |
int queue_size(Queue* q);
|
53 |
/** @brief Check if the queue is empty **/
|
54 |
int queue_is_empty(Queue* q);
|
55 |
|
56 |
/** @} **/
|
57 |
|