|
CPLHashSet CPL_DLL * | CPLHashSetNew (CPLHashSetHashFunc fnHashFunc, CPLHashSetEqualFunc fnEqualFunc, CPLHashSetFreeEltFunc fnFreeEltFunc) |
|
void CPL_DLL | CPLHashSetDestroy (CPLHashSet *set) |
|
void CPL_DLL | CPLHashSetClear (CPLHashSet *set) |
|
int CPL_DLL | CPLHashSetSize (const CPLHashSet *set) |
|
void CPL_DLL | CPLHashSetForeach (CPLHashSet *set, CPLHashSetIterEltFunc fnIterFunc, void *user_data) |
|
int CPL_DLL | CPLHashSetInsert (CPLHashSet *set, void *elt) |
|
void CPL_DLL * | CPLHashSetLookup (CPLHashSet *set, const void *elt) |
|
int CPL_DLL | CPLHashSetRemove (CPLHashSet *set, const void *elt) |
|
int CPL_DLL | CPLHashSetRemoveDeferRehash (CPLHashSet *set, const void *elt) |
|
unsigned long CPL_DLL | CPLHashSetHashPointer (const void *elt) |
|
int CPL_DLL | CPLHashSetEqualPointer (const void *elt1, const void *elt2) |
|
unsigned long CPL_DLL | CPLHashSetHashStr (const void *pszStr) |
|
int CPL_DLL | CPLHashSetEqualStr (const void *pszStr1, const void *pszStr2) |
|
Hash set implementation.
An hash set is a data structure that holds elements that are unique according to a comparison function. Operations on the hash set, such as insertion, removal or lookup, are supposed to be fast if an efficient "hash" function is provided.
void CPL_DLL CPLHashSetForeach |
( |
CPLHashSet * |
set, |
|
|
CPLHashSetIterEltFunc |
fnIterFunc, |
|
|
void * |
user_data |
|
) |
| |
Walk through the hash set and runs the provided function on all the elements
This function is provided the user_data argument of CPLHashSetForeach. It must return TRUE to go on the walk through the hash set, or FALSE to make it stop.
Note : the structure of the hash set must NOT be modified during the walk.
- Parameters
-
set | the hash set. |
fnIterFunc | the function called on each element. |
user_data | the user data provided to the function. |
CPLHashSet CPL_DLL* CPLHashSetNew |
( |
CPLHashSetHashFunc |
fnHashFunc, |
|
|
CPLHashSetEqualFunc |
fnEqualFunc, |
|
|
CPLHashSetFreeEltFunc |
fnFreeEltFunc |
|
) |
| |
Creates a new hash set
The hash function must return a hash value for the elements to insert. If fnHashFunc is NULL, CPLHashSetHashPointer will be used.
The equal function must return if two elements are equal. If fnEqualFunc is NULL, CPLHashSetEqualPointer will be used.
The free function is used to free elements inserted in the hash set, when the hash set is destroyed, when elements are removed or replaced. If fnFreeEltFunc is NULL, elements inserted into the hash set will not be freed.
- Parameters
-
fnHashFunc | hash function. May be NULL. |
fnEqualFunc | equal function. May be NULL. |
fnFreeEltFunc | element free function. May be NULL. |
- Returns
- a new hash set