Data Structures | |
struct | Queue |
struct | Queue |
Functions | |
Queue * | queue_create (void) |
Create a new queue. | |
void | queue_destroy (Queue *q) |
Destroy a queue. | |
void | queue_add (Queue *q, void *item) |
Add an element to a queue. | |
void * | queue_remove (Queue *q) |
Remove an element from a queue. | |
void | queue_remove_all (Queue *q, void *item) |
Remove all instances of a given element from a queue. | |
int | queue_size (Queue *q) |
Get the size of a queue. | |
int | queue_is_empty (Queue *q) |
Check if the queue is empty. |
A queue implementation.
void queue_add | ( | Queue * | q, | |
void * | item | |||
) |
Add an element to a queue.
Add an element to a queue.
q | the queue to add an element to | |
item | the item to add to the queue |
Queue* queue_create | ( | void | ) |
Create a new queue.
Create a queue.
void queue_destroy | ( | Queue * | q | ) |
Destroy a queue.
Destroys a queue, freeing memory.
q | the queue to destroy |
int queue_is_empty | ( | Queue * | q | ) |
Check if the queue is empty.
Check if the queue is empty.
q | the queue to check |
void* queue_remove | ( | Queue * | q | ) |
Remove an element from a queue.
Remove an element from the front of a queue.
q | the queue to remove the element from |
void queue_remove_all | ( | Queue * | q, | |
void * | item | |||
) |
Remove all instances of a given element from a queue.
Remove all instances of a given element from a queue.
q | the queue to remove the elements from | |
item | the element to remove all instances of |
int queue_size | ( | Queue * | q | ) |
Get the size of a queue.
Get the number of elements in the queue.
q | the queue to get the size of |