Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Functions | |
void | vlQueueInit (vl_queue *queue, vl_memsize_t elementSize) |
Initializes the specified queue. | |
void | vlQueueFree (vl_queue *queue) |
Frees the specified queue. | |
vl_queue * | vlQueueNew (vl_memsize_t elementSize) |
Allocates on the heap, initializes, and returns a queue instance. | |
void | vlQueueDelete (vl_queue *queue) |
Deletes the specified queue. | |
void | vlQueueClear (vl_queue *queue) |
Clears the specified queue. | |
vl_queue * | vlQueueClone (const vl_queue *src, vl_queue *dest) |
Clones the specified queue to another. | |
void | vlQueueReserve (vl_queue *queue, vl_memsize_t numElems) |
Reserves space for n-many elements in the underlying buffer of the specified queue. | |
void | vlQueuePushBack (vl_queue *queue, const void *element) |
Adds a new element to the end of the queue. | |
int | vlQueuePopFront (vl_queue *queue, void *element) |
Copies the first element in the queue, and removes it from the queue. | |
vl_dsidx_t | vlQueueSize (vl_queue *queue) |
Returns the total number of elements in the specified queue. | |
void vlQueueClear | ( | vl_queue * | queue | ) |
Clears the specified queue.
The underlying data in the queue is untouched, but rather some book-keeping variables are reset.
queue |
Clones the specified queue to another.
Clones the entirety of the src queue to the dest queue.
The 'src' queue pointer must be non-null and initialized. The 'dest' queue pointer may be null, but if it is not null it must be initialized.
If the 'dest' queue pointer is null, a new queue is created via vlQueueNew. Otherwise, its element size is set to the source's and all of its existing data is replaced.
src | pointer |
dest | pointer |
void vlQueueDelete | ( | vl_queue * | queue | ) |
Deletes the specified queue.
The queue should have been initialized via vlQueueNew.
queue | pointer |
void vlQueueFree | ( | vl_queue * | queue | ) |
Frees the specified queue.
The queue should have been initialized via vlQueueInit.
queue | pointer |
void vlQueueInit | ( | vl_queue * | queue, |
vl_memsize_t | elementSize ) |
Initializes the specified queue.
The queue should then later be freed via vlQueueFree.
queue | pointer |
elementSize | size of a single queue element, in bytes |
vl_queue * vlQueueNew | ( | vl_memsize_t | elementSize | ) |
Allocates on the heap, initializes, and returns a queue instance.
The queue should then later be deleted via vlQueueDelete.
elementSize | size of a single queue element, in bytes |
int vlQueuePopFront | ( | vl_queue * | queue, |
void * | element ) |
Copies the first element in the queue, and removes it from the queue.
This is a no-op if the queue is empty.
queue | pointer |
element | data pointer |
void vlQueuePushBack | ( | vl_queue * | queue, |
const void * | element ) |
Adds a new element to the end of the queue.
The element data is copied to the queue.
queue | pointer |
element | data pointer |
void vlQueueReserve | ( | vl_queue * | queue, |
vl_memsize_t | n ) |
Reserves space for n-many elements in the underlying buffer of the specified queue.
This is done by doubling the size until the requested growth is met or exceeded. This function will always result in the reallocation of the underlying memory.
queue | pointer |
n | total number of elements to reserve space for. |
vl_dsidx_t vlQueueSize | ( | vl_queue * | queue | ) |
Returns the total number of elements in the specified queue.
queue | pointer |