queue.h File Reference
Go to the source code of this file.
Detailed Description
Function Documentation
void* queue_at |
( |
queue_t * |
q, |
|
|
int |
pos | |
|
) |
| | |
Returns element located at position pos.
- Parameters:
-
| q | A pointer to the queue data structure. |
| pos | Zero-based index of element to return. |
- Returns:
- A pointer to the element at position pos.
-
NULL if position out of bounds.
void* queue_dequeue |
( |
queue_t * |
q |
) |
|
Removes and returns element from front of queue.
- Parameters:
-
| q | A pointer to the queue data structure. |
- Returns:
- A pointer to the oldest element in the queue.
-
NULL if the queue is empty.
Frees all associated memory.
Should always be called last.
- Parameters:
-
| q | A pointer to the queue data structure. |
- Returns:
- void
void queue_enqueue |
( |
queue_t * |
q, |
|
|
void * |
item | |
|
) |
| | |
Stores item at the back of the queue.
- Parameters:
-
| q | A pointer to the queue data structure. |
| item | Value of item to be stored. |
- Returns:
- void
Initializes queue structure.
Should always be called first.
- Parameters:
-
| q | A pointer to the queue data structure. |
- Returns:
- void
void queue_iterate |
( |
queue_t * |
q, |
|
|
void(*)(void *, void *) |
iter_func, |
|
|
void * |
arg | |
|
) |
| | |
Helper function to apply operation on each item.
- Parameters:
-
| q | A pointer to the queue data structure. |
| iter_func | Function pointer to operation to be applied. |
| arg | Pass through variable to iter_func. |
- Returns:
- void
void* queue_remove_at |
( |
queue_t * |
q, |
|
|
int |
pos | |
|
) |
| | |
Removes and returns element at position pos.
- Parameters:
-
| q | A pointer to the queue data structure. |
| pos | Position to be removed. |
- Returns:
- A pointer to the element at position pos.
-
NULL if the position is invalid.
unsigned int queue_size |
( |
queue_t * |
q |
) |
|
Returns number of items in the queue.
- Parameters:
-
| q | A pointer to the queue data structure. |
- Returns:
- The number of items in the queue.