#include "hycomp.h"
#include "hyport.h"
Data Structures | |
struct | HyPool |
struct | HyPoolState |
Functions | |
HY_CFUNC void VMCALL | pool_do (HyPool *aPool, void(*aFunction)(void *anElement, void *userData), void *userData) |
Calls a user provided function for each element in the list. | |
HY_CFUNC void VMCALL | pool_removeElement (HyPool *aPool, void *anElement) |
Deallocates an element from a pool. | |
HY_CFUNC UDATA VMCALL | pool_numElements (HyPool *aPool) |
Returns the number of elements in a given pool. | |
HY_CFUNC void *VMCALL | pool_newElement (HyPool *aPool) |
Asks for the address of a new pool element. | |
HY_CFUNC HyPool *VMCALL | pool_forPortLib (U_32 structSize, HyPortLibrary *portLibrary) |
Shortcut for pool_new, using the default malloc/free from the portLibrary. | |
HY_CFUNC void VMCALL | pool_kill (HyPool *aPool) |
Deallocates all memory associated with a pool. | |
HY_CFUNC void VMCALL | pool_sortFree (HyPool *aPool) |
Sorts the free list of the current pool. | |
HY_CFUNC void VMCALL | pool_clear (HyPool *aPool) |
Clear the contents of a pool but not delete it. | |
HY_CFUNC UDATA VMCALL | pool_capacity (HyPool *aPool) |
Returns the total capacity of a pool. | |
HY_CFUNC UDATA VMCALL | pool_ensureCapacity (HyPool *aPool, UDATA newCapacity) |
Ensures that the pool is large enough for newCapacity elements. |
HY_CFUNC UDATA VMCALL pool_capacity | ( | HyPool * | aPool | ) |
Returns the total capacity of a pool.
[in] | aPool | The pool |
numElements in aPool otherwise
HY_CFUNC void VMCALL pool_clear | ( | HyPool * | aPool | ) |
Clear the contents of a pool but not delete it.
[in] | aPool | The pool to clear |
HY_CFUNC void VMCALL pool_do | ( | HyPool * | aPool, | |
void(*)(void *anElement, void *userData) | aFunction, | |||
void * | userData | |||
) |
Calls a user provided function for each element in the list.
[in] | aPool | The pool to "do" things to |
[in] | aFunction | Pointer to function which will "do" things to the elements of aPool |
[in] | userData | Pointer to data to be passed to "do" function, along with each pool-element |
HY_CFUNC UDATA VMCALL pool_ensureCapacity | ( | HyPool * | aPool, | |
UDATA | newCapacity | |||
) |
Ensures that the pool is large enough for newCapacity elements.
This has the side effect of setting the POOL_NEVER_FREE_PUDDLES flag. Without this, the pool could shrink back down to its original size. Note that this does not take into account the number of elements already used in the pool.
[in] | aPool | The pool |
[in] | newCapacity | The desired new-size of the pool |
-1 on failure
HY_CFUNC HyPool* VMCALL pool_forPortLib | ( | U_32 | structSize, | |
HyPortLibrary * | portLibrary | |||
) |
Shortcut for pool_new, using the default malloc/free from the portLibrary.
[in] | structSize | size of pool-element |
[in] | portLibrary |
HY_CFUNC void VMCALL pool_kill | ( | HyPool * | aPool | ) |
Deallocates all memory associated with a pool.
[in] | aPool | Pool to be deallocated |
HY_CFUNC void* VMCALL pool_newElement | ( | HyPool * | aPool | ) |
Asks for the address of a new pool element.
If it succeeds, the address returned will have space for one element of the correct structure size. The contents of the element are undefined. If the current pool is full, a new one will be grafted onto the end of the pool chain and memory from there will be used.
[in] | aPool |
pointer to a new element otherwise
HY_CFUNC UDATA VMCALL pool_numElements | ( | HyPool * | aPool | ) |
Returns the number of elements in a given pool.
[in] | aPool |
the number of elements in the pool otherwise
HY_CFUNC void VMCALL pool_removeElement | ( | HyPool * | aPool, | |
void * | anElement | |||
) |
Deallocates an element from a pool.
It is safe to call pool_removeElement() while looping over the pool with pool_startDo / pool_nextDo on the element returned by those calls. This is because the free element is always inserted at either the head of the free list or before the nextFree element in the pool_state.
[in] | aPool | |
[in] | anElement | Pointer to the element to be removed |
HY_CFUNC void VMCALL pool_sortFree | ( | HyPool * | aPool | ) |
Sorts the free list of the current pool.
(ie: does not follow nextPool pointers...) This is a O(n) most of the time.
[in] | aPool | The pool to be sorted |
Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.