root / branches / autonomous_recharging / code / projects / autonomous_recharging / charging_station / queue.h @ 198
History | View | Annotate | Download (1.22 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 |
#ifndef WIRELESS_QUEUE_H
|
11 |
#define WIRELESS_QUEUE_H
|
12 |
|
13 |
struct node_def;
|
14 |
|
15 |
/**
|
16 |
* @defgroup queue Queue
|
17 |
* @brief A queue implementation
|
18 |
*
|
19 |
* A queue implementation.
|
20 |
*
|
21 |
* @{
|
22 |
**/
|
23 |
|
24 |
/**
|
25 |
* @struct Queue
|
26 |
* Represents a queue, a first in, first out data structure.
|
27 |
**/
|
28 |
typedef struct |
29 |
{ |
30 |
/**
|
31 |
* The head of the queue, the next item to be removed.
|
32 |
**/
|
33 |
struct node_def* head;
|
34 |
/**
|
35 |
* The tail of the queue, the last item added.
|
36 |
**/
|
37 |
struct node_def* tail;
|
38 |
/**
|
39 |
* The number of elements in the queue.
|
40 |
**/
|
41 |
int size;
|
42 |
} Queue; |
43 |
|
44 |
/** @brief Create a new queue **/
|
45 |
Queue* queue_create(void);
|
46 |
/** @brief Destroy a queue **/
|
47 |
void queue_destroy(Queue* q);
|
48 |
/** @brief Add an element to a queue **/
|
49 |
void queue_add(Queue* q, void* item); |
50 |
/** @brief Remove an element from a queue **/
|
51 |
void* queue_remove(Queue* q);
|
52 |
/** @brief Remove all instances of a given element from a queue **/
|
53 |
void queue_remove_all(Queue* q, void* item); |
54 |
/** @brief Get the size of a queue **/
|
55 |
int queue_size(Queue* q);
|
56 |
/** @brief Check if the queue is empty **/
|
57 |
int queue_is_empty(Queue* q);
|
58 |
|
59 |
/** @} **/
|
60 |
|
61 |
|
62 |
#endif
|