A simple static queue data
*, void *);
These functions implement a simple queue data structure that is statically sized. This implementation does not actually store the values of the items in it; it only stores pointers to the data. As such, you will still have to manually maintain all your data. The advantage of this is that these functions don't have to copy data, and thus don't care how big the data is. Furthermore, arbitrary data can be stored in the queue.
This queue implementation operates on the heap. It is a circular queue, and it does not grow as it is used. Once the size is set, the queue never gets any bigger.
These functions operate on a queue structure which is opaque to the caller.
allocate and deallocate a queue, respectively. Note that
QueueFree() does not free any of the values stored
in the queue; it is the caller's job to manage the memory for each item.
Typically, the caller would dequeue all the items in the queue and free them
before freeing the queue itself.
are the main functions used to modify the array. They enqueue and dequeue
elements from the queue structure, respectively.
simply returns the pointer that is next up in the queue without actually
discarding it, such that the next call to
return the same pointer.
return a boolean value that indicates whether or not the queue is full or
QueueCreate() returns a queue structure,
NULL if there was a memory allocation error.
QueuePush() as well as
all return boolean values. In the case of
QueuePush() whether or not the push was actually
successful is returned. This will only happen if the queue is already full,
NULL pointer is passed.
QueuePeek() both return caller-managed pointers that
would have been at some point pushed into the queue with the
QueuePush() function. They may also return
NULL if the queue is empty.