#include <stdio.h>#include <stdlib.h>#include "queue.h"Data Structures | |
| struct | queue_node |
| Private. More... | |
Functions | |
| void | queue_init (queue_t *q) |
| Initializes queue structure. | |
| void | queue_destroy (queue_t *q) |
| Frees all associated memory. | |
| void * | queue_dequeue (queue_t *q) |
| Removes and returns element from front of queue. | |
| void * | queue_remove_at (queue_t *q, int pos) |
| Removes and returns element at position pos. | |
| void * | queue_at (queue_t *q, int pos) |
| Returns element located at position pos. | |
| void | queue_enqueue (queue_t *q, void *item) |
| Stores item at the back of the queue. | |
| unsigned int | queue_size (queue_t *q) |
| Returns number of items in the queue. | |
| void | queue_iterate (queue_t *q, void(*iter_func)(void *, void *), void *arg) |
| Helper function to apply operation on each item. | |
| void* queue_at | ( | queue_t * | q, | |
| int | pos | |||
| ) |
Returns element located at position pos.
| q | A pointer to the queue data structure. | |
| pos | Zero-based index of element to return. |
| void* queue_dequeue | ( | queue_t * | q | ) |
Removes and returns element from front of queue.
| q | A pointer to the queue data structure. |
| void queue_destroy | ( | queue_t * | q | ) |
Frees all associated memory.
Should always be called last.
| q | A pointer to the queue data structure. |
| void queue_enqueue | ( | queue_t * | q, | |
| void * | item | |||
| ) |
Stores item at the back of the queue.
| q | A pointer to the queue data structure. | |
| item | Value of item to be stored. |
| void queue_init | ( | queue_t * | q | ) |
Initializes queue structure.
Should always be called first.
| q | A pointer to the queue data structure. |
| void queue_iterate | ( | queue_t * | q, | |
| void(*)(void *, void *) | iter_func, | |||
| void * | arg | |||
| ) |
Helper function to apply operation on each item.
| q | A pointer to the queue data structure. | |
| iter_func | Function pointer to operation to be applied. | |
| arg | Pass through variable to iter_func. |
| void* queue_remove_at | ( | queue_t * | q, | |
| int | pos | |||
| ) |
Removes and returns element at position pos.
| q | A pointer to the queue data structure. | |
| pos | Position to be removed. |
| unsigned int queue_size | ( | queue_t * | q | ) |
Returns number of items in the queue.
| q | A pointer to the queue data structure. |
1.6.1