Hash table. More...
#include <xanlib.h>
Data Fields | |
XanHashTableItem * | table |
unsigned int | primeIndex |
unsigned int | length |
unsigned int | size |
int | hasFixedLength |
float | currentLoadFactor |
sem_t | mutex |
void *(* | alloc )(size_t size) |
void *(* | realloc )(void *oldAddress, size_t newSize) |
void(* | free )(void *addr) |
unsigned int(* | hash )(void *element) |
int(* | equals )(void *key1, void *key2) |
void *(* | clone )(void *data) |
void(* | synchInsert )(struct XanHashTable *table, void *key, void *element) |
void *(* | synchLookup )(struct XanHashTable *table, void *key) |
void(* | synchDelete )(struct XanHashTable *table, void *key) |
void(* | synchDestroy )(struct XanHashTable *table) |
XanList *(* | synchToList )(struct XanHashTable *table) |
XanList *(* | synchToSlotList )(struct XanHashTable *table) |
int(* | synchElementsInside )(struct XanHashTable *table) |
struct XanHashTable *(* | synchCloneHashTable )(struct XanHashTable *table) |
void(* | synchSetCloneFunction )(struct XanHashTable *table, void *(*cloneFunction)(void *data)) |
void *(* | synchGetCloneFunction )(struct XanHashTable *table) |
void(* | lock )(struct XanHashTable *table) |
void(* | unlock )(struct XanHashTable *table) |
void(* | insert )(struct XanHashTable *table, void *key, void *element) |
void *(* | lookup )(struct XanHashTable *table, void *key) |
void(* | delete )(struct XanHashTable *table, void *key) |
void(* | destroy )(struct XanHashTable *table) |
XanList *(* | toList )(struct XanHashTable *table) |
XanList *(* | toSlotList )(struct XanHashTable *table) |
struct XanHashTable *(* | cloneHashTable )(struct XanHashTable *table) |
int(* | elementsInside )(struct XanHashTable *table) |
void(* | setCloneFunction )(struct XanHashTable *table, void *(*cloneFunction)(void *data)) |
void *(* | getCloneFunction )(struct XanHashTable *table) |
Hash table.
This structure implements the closed hash table. The equals, hash functions can be customized by the user.
Definition at line 325 of file xanlib.h.
void*(* XanHashTable::alloc)(size_t size) |
Definition at line 335 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableExpand(), _xanHashTableInsert(), _xanHashTableToList(), _xanHashTableToSlotList(), XanHashTable_ToItemList(), and xanHashTableNew().
void*(* XanHashTable::clone)(void *data) |
Definition at line 340 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableGetCloneFunction(), _xanHashTableSetCloneFunction(), and xanHashTableNew().
struct XanHashTable*(* XanHashTable::cloneHashTable)(struct XanHashTable *table) [read] |
Clone the hash table calling the function clone for each elements stored inside itself
Definition at line 363 of file xanlib.h.
Referenced by xanHashTableNew().
Definition at line 333 of file xanlib.h.
Referenced by _xanHashTableDelete(), _xanHashTableExpand(), _xanHashTableInsert(), and xanHashTableNew().
void(* XanHashTable::delete)(struct XanHashTable *table, void *key) |
Delete the element identified by the key given as input
Definition at line 359 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::destroy)(struct XanHashTable *table) |
Free the memory used by the hash table
Definition at line 360 of file xanlib.h.
Referenced by xanHashTableNew().
int(* XanHashTable::elementsInside)(struct XanHashTable *table) |
Return the number of element stored inside the HashTable
Definition at line 364 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), and xanHashTableNew().
int(* XanHashTable::equals)(void *key1, void *key2) |
Definition at line 339 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableDelete(), _xanHashTableLookup(), and xanHashTableNew().
void(* XanHashTable::free)(void *addr) |
Definition at line 337 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableDelete(), _xanHashTableDestroy(), _xanHashTableExpand(), _xanHashTableToList(), _xanHashTableToSlotList(), XanHashTable_ToItemList(), and xanHashTableNew().
void*(* XanHashTable::getCloneFunction)(struct XanHashTable *table) |
Return the clone function.
Definition at line 366 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), and xanHashTableNew().
Definition at line 332 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableInsert(), and xanHashTableNew().
unsigned int(* XanHashTable::hash)(void *element) |
Definition at line 338 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableImproveHash(), and xanHashTableNew().
void(* XanHashTable::insert)(struct XanHashTable *table, void *key, void *element) |
Definition at line 357 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), and xanHashTableNew().
unsigned int XanHashTable::length |
Definition at line 330 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableDelete(), _xanHashTableDestroy(), _xanHashTableExpand(), _xanHashTableInsert(), _xanHashTableLookup(), _xanHashTableToList(), _xanHashTableToSlotList(), XanHashTable_ToItemList(), xanHashTableDelete(), xanHashTableDestroy(), xanHashTableInsert(), xanHashTableLookup(), and xanHashTableNew().
void(* XanHashTable::lock)(struct XanHashTable *table) |
Lock the entire hash table
Definition at line 355 of file xanlib.h.
Referenced by xanHashTableNew().
void*(* XanHashTable::lookup)(struct XanHashTable *table, void *key) |
If exist an element identified by the key given as input, then it is returned, otherwise NULL is returned.
Definition at line 358 of file xanlib.h.
Referenced by xanHashTableNew().
sem_t XanHashTable::mutex |
Definition at line 334 of file xanlib.h.
Referenced by _xanHashTableLock(), _xanHashTableUnlock(), xanHashTableCloneHashTable(), xanHashTableDelete(), xanHashTableDestroy(), xanHashTableElementsInside(), xanHashTableGetCloneFunction(), xanHashTableInsert(), xanHashTableLookup(), xanHashTableNew(), xanHashTableSetCloneFunction(), xanHashTableToList(), and xanHashTableToSlotList().
unsigned int XanHashTable::primeIndex |
Definition at line 329 of file xanlib.h.
Referenced by _xanHashTableExpand(), and xanHashTableNew().
void*(* XanHashTable::realloc)(void *oldAddress, size_t newSize) |
Definition at line 336 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), and xanHashTableNew().
void(* XanHashTable::setCloneFunction)(struct XanHashTable *table, void *(*cloneFunction)(void *data)) |
Set the function callable by the hash table when it has to clone itself and then it has to clone the inside elements also. If the clone function is set to be NULL, then when the hash table clone itself, it does not clone the internal elements (it makes the shallow copy).
Definition at line 365 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), and xanHashTableNew().
unsigned int XanHashTable::size |
Definition at line 331 of file xanlib.h.
Referenced by _xanHashTableDelete(), _xanHashTableElementsInside(), _xanHashTableInsert(), and xanHashTableNew().
struct XanHashTable*(* XanHashTable::synchCloneHashTable)(struct XanHashTable *table) [read] |
Clone the hash table calling the function clone for each elements stored inside itself. This operation is act only after taked the lock of the hash table.
Definition at line 350 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::synchDelete)(struct XanHashTable *table, void *key) |
Definition at line 345 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::synchDestroy)(struct XanHashTable *table) |
Free the memory used by the hash table. This operation is act only after taked the lock of the hash table.
Definition at line 346 of file xanlib.h.
Referenced by xanHashTableNew().
int(* XanHashTable::synchElementsInside)(struct XanHashTable *table) |
Return the number of elements stored inside the hash table. This operation is act only after taked the lock of the hash table.
Definition at line 349 of file xanlib.h.
Referenced by xanHashTableNew().
void*(* XanHashTable::synchGetCloneFunction)(struct XanHashTable *table) |
Return the clone function. This operation is act only after taked the lock of the hash table.
Definition at line 352 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::synchInsert)(struct XanHashTable *table, void *key, void *element) |
Definition at line 343 of file xanlib.h.
Referenced by xanHashTableNew().
void*(* XanHashTable::synchLookup)(struct XanHashTable *table, void *key) |
Definition at line 344 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::synchSetCloneFunction)(struct XanHashTable *table, void *(*cloneFunction)(void *data)) |
Set the function callable by the hash table when it has to clone itself and then it has to clone the inside elements also. If the clone function is set to be NULL, then when the hash table clone itself, it does not clone the internal elements (it makes the shallow copy). This operation is act only after taked the lock of the hash table.
Definition at line 351 of file xanlib.h.
Referenced by xanHashTableNew().
XanList*(* XanHashTable::synchToList)(struct XanHashTable *table) |
Return the list of elements stored inside the HashTable. This operation is act only after taked the lock of the hash table.
Definition at line 347 of file xanlib.h.
Referenced by xanHashTableNew().
XanList*(* XanHashTable::synchToSlotList)(struct XanHashTable *table) |
Return the list of slots used to store the elements of the HashTable; each element of this list is the memory address of the slot used to store the single element of the Hash table. This operation is act only after taked the lock of the hash table.
Definition at line 348 of file xanlib.h.
Referenced by xanHashTableNew().
Definition at line 328 of file xanlib.h.
Referenced by _xanHashTableCloneHashTable(), _xanHashTableDelete(), _xanHashTableDestroy(), _xanHashTableExpand(), _xanHashTableInsert(), _xanHashTableLookup(), _xanHashTableToList(), _xanHashTableToSlotList(), XanHashTable_ToItemList(), xanHashTableDelete(), xanHashTableDestroy(), xanHashTableInsert(), xanHashTableLookup(), and xanHashTableNew().
XanList*(* XanHashTable::toList)(struct XanHashTable *table) |
Return the list of elements stored inside the HashTable
Definition at line 361 of file xanlib.h.
Referenced by xanHashTableNew().
XanList*(* XanHashTable::toSlotList)(struct XanHashTable *table) |
Return the list of slots used to store the elements of the HashTable; each element of this list is the memory address of the slot used to store the single element of the Hash table.
Definition at line 362 of file xanlib.h.
Referenced by xanHashTableNew().
void(* XanHashTable::unlock)(struct XanHashTable *table) |
Unlock the entire hash table
Definition at line 356 of file xanlib.h.
Referenced by xanHashTableNew().