Veritable Lasagna
An Allocator & Data Structure Library for C.
|
Functions | |
void | vlLinearPoolInit (vl_linearpool *pool, vl_memsize_t elementSize) |
Initializes the specified pool instance. | |
void | vlLinearPoolFree (vl_linearpool *pool) |
De-initializes the specified pool instance. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlLinearPoolInit. | |
vl_linearpool * | vlLinearPoolNew (vl_memsize_t elementSize) |
Allocates and initializes a pool instance. | |
void | vlLinearPoolDelete (vl_linearpool *pool) |
De-initializes and deletes the specified pool. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlLinearPoolNew. | |
void | vlLinearPoolClear (vl_linearpool *pool) |
vl_linearpool * | vlLinearPoolClone (const vl_linearpool *src, vl_linearpool *dest) |
Clones the specified source pool. | |
void | vlLinearPoolReserve (vl_linearpool *pool, vl_memsize_t n) |
Reserves space for n-many elements in the underlying pool buffer. | |
vl_linearpool_idx | vlLinearPoolTellIndex (vl_linearpool *pool, const vl_transient *dataPtr) |
Calculates the index of the specified element pointer. May return VL_POOL_INVALID_IDX if the specified pointer is outside the pool buffer range. | |
vl_linearpool_idx | vlLinearPoolTake (vl_linearpool *pool) |
void | vlLinearPoolReturn (vl_linearpool *pool, vl_linearpool_idx offset) |
void vlLinearPoolClear | ( | vl_linearpool * | pool | ) |
Clears the specified pool. This does not clear any buffers associated with the pool. Rather, this function resets the "next" offset at which the next (new) pool index will be to 0.
pool | pointer |
vl_linearpool * vlLinearPoolClone | ( | const vl_linearpool * | src, |
vl_linearpool * | dest ) |
Clones the specified source pool.
Clones the entirety of the src pool to the dest pool.
The 'src' pool pointer must be non-null and initialized. The 'dest' pool pointer may be null, but if it is not null it must be initialized.
If the 'dest' pool pointer is null, a new pool is initialized via vlLinearPoolNew. Otherwise, its element size is set to the source's and all of its existing data is replaced.
src | pointer to pool to clone |
dest | pointer to target pool, or NULL |
void vlLinearPoolDelete | ( | vl_linearpool * | pool | ) |
De-initializes and deletes the specified pool. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlLinearPoolNew.
pool | pointer |
void vlLinearPoolFree | ( | vl_linearpool * | pool | ) |
De-initializes the specified pool instance. This will clear up all memory associated with members of the pool. This pool should have been initialized via vlLinearPoolInit.
pool |
void vlLinearPoolInit | ( | vl_linearpool * | pool, |
vl_memsize_t | elementSize ) |
Initializes the specified pool instance.
This pool should be freed via vlLinearPoolFree.
pool | pointer |
elementSize | size of each element, in bytes. |
vl_linearpool * vlLinearPoolNew | ( | vl_memsize_t | elementSize | ) |
Allocates and initializes a pool instance.
This pool should later be deleted via vlLinearPoolDelete.
elementSize | size of each element, in bytes. |
void vlLinearPoolReserve | ( | vl_linearpool * | pool, |
vl_memsize_t | n ) |
Reserves space for n-many elements in the underlying pool buffer.
This is accomplished by using the standard buffer resizing method for this library, which is doubling the size of the underlying buffer until it is greater than a specified minimum size.
This function will always result in the reallocation of the underlying memory.
pool | pointer |
n | total elements to reserve space for |
void vlLinearPoolReturn | ( | vl_linearpool * | pool, |
vl_linearpool_idx | offset ) |
Gives the specified index back to the pool, allowing it to be re-used.
pool | |
offset |
vl_linearpool_idx vlLinearPoolTake | ( | vl_linearpool * | pool | ) |
Takes a new index from the pool, which corresponds to a valid memory location within the pool.
pool | pointer |
vl_linearpool_idx vlLinearPoolTellIndex | ( | vl_linearpool * | pool, |
const vl_transient * | dataPtr ) |
Calculates the index of the specified element pointer. May return VL_POOL_INVALID_IDX if the specified pointer is outside the pool buffer range.
If the underlying pool allocation is implicitly resized, make sure the specified pointer still refers to a current, relevant location in memory. Otherwise, this will return VL_POOL_INVALID_IDX.
pool | |
dataPtr |