|
Veritable Lasagna
An Allocator & Data Structure Library for C.
|
#include "vl_pool.h"
Include dependency graph for vl_queue.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| VL_API void | vlQueueInit (vl_queue *queue, vl_uint16_t elementSize) |
| Initializes the specified queue with a specific element size. | |
| VL_API void | vlQueueFree (vl_queue *queue) |
| De-initializes and frees the internal resources of the specified queue. | |
| VL_API vl_queue * | vlQueueNew (vl_uint16_t elementSize) |
| Allocates on the heap, initializes, and returns a new queue instance. | |
| VL_API void | vlQueueDelete (vl_queue *queue) |
| De-initializes and deletes the specified queue and its resources. | |
| VL_API vl_queue * | vlQueueClone (const vl_queue *src, vl_queue *dest) |
| Clones the specified source queue to another. | |
| VL_API void | vlQueueReserve (vl_queue *queue, vl_dsidx_t n) |
| Reserves space for n-many elements in the underlying buffer of the specified queue. | |
| VL_API void | vlQueueClear (vl_queue *queue) |
| Clears the specified queue. | |
| VL_API void | vlQueuePushBack (vl_queue *queue, const void *element) |
| Adds a new element to the end of the queue. | |
| VL_API int | vlQueuePopFront (vl_queue *queue, void *element) |
| Copies the first element in the queue and removes it. | |
| VL_API 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 must not be NULL.| queue |
Here is the call graph for this function:| VL_API vl_queue * vlQueueClone | ( | const vl_queue * | src, |
| vl_queue * | dest | ||
| ) |
Clones the specified source queue to another.
Clones the entirety of the src queue to the dest queue, including all elements and order.
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.
dest is NULL, the caller owns the returned vl_queue. If dest is provided, ownership remains with the caller.src must not be NULL. dest can be NULL.NULL if allocation fails.NULL on failure.| src | pointer |
| dest | pointer |
Here is the call graph for this function:| VL_API void vlQueueDelete | ( | vl_queue * | queue | ) |
De-initializes and deletes the specified queue and its resources.
The queue should have been initialized via vlQueueNew.
vl_queue struct.queue is NULL.| queue | pointer |
Here is the call graph for this function:| VL_API void vlQueueFree | ( | vl_queue * | queue | ) |
De-initializes and frees the internal resources of the specified queue.
The queue should have been initialized via vlQueueInit.
queue struct itself.queue must not be NULL.| queue | pointer |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API void vlQueueInit | ( | vl_queue * | queue, |
| vl_uint16_t | elementSize | ||
| ) |
Initializes the specified queue with a specific element size.
The queue should then later be de-initialized via vlQueueFree.
queue struct. The function initializes the internal node pool.vlQueueFree or vlQueueDelete.queue must not be NULL.vlQueueFree (causes memory leak).vl_pool which allocates management structures.| queue | pointer |
| elementSize | size of a single queue element, in bytes |
Here is the caller graph for this function:| VL_API vl_queue * vlQueueNew | ( | vl_uint16_t | elementSize | ) |
Allocates on the heap, initializes, and returns a new queue instance.
The queue should then later be deleted via vlQueueDelete.
vl_queue pointer and is responsible for calling vlQueueDelete.vlQueueDelete.NULL if heap allocation for the queue struct fails.NULL on allocation failure.vl_queue struct and its internal node pool.NULL.| elementSize | size of a single queue element, in bytes |
Here is the call graph for this function:
Here is the caller graph for this function:| VL_API int vlQueuePopFront | ( | vl_queue * | queue, |
| void * | element | ||
| ) |
Copies the first element in the queue and removes it.
This is a no-op if the queue is empty.
element.queue must not be NULL. element can be NULL to just discard the front element.| queue | pointer |
| element | data pointer |
Here is the call graph for this function:| VL_API void vlQueuePushBack | ( | vl_queue * | queue, |
| const void * | element | ||
| ) |
Adds a new element to the end of the queue.
The element data is copied into the queue's internal storage.
queue must not be NULL. element must not be NULL.NULL element or an uninitialized queue.| queue | pointer |
| element | data pointer |
Here is the call graph for this function:| VL_API void vlQueueReserve | ( | vl_queue * | queue, |
| vl_dsidx_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 must not be NULL.| queue | pointer |
| n | total number of elements to reserve space for. |
Here is the call graph for this function: