XanHashTable Struct Reference

Hash table. More...

#include <xanlib.h>

Collaboration diagram for XanHashTable:
Collaboration graph
[legend]

Data Fields

XanHashTableItemtable
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)

Detailed Description

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.


Field Documentation

void*(* XanHashTable::alloc)(size_t size)
void*(* XanHashTable::clone)(void *data)

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().

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().

Free the memory used by the hash table

Definition at line 360 of file xanlib.h.

Referenced by xanHashTableNew().

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)
void(* XanHashTable::free)(void *addr)

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)
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

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().

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

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().

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().

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().

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().

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().

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().

Return the list of elements stored inside the HashTable

Definition at line 361 of file xanlib.h.

Referenced by xanHashTableNew().

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().

Unlock the entire hash table

Definition at line 356 of file xanlib.h.

Referenced by xanHashTableNew().


The documentation for this struct was generated from the following file:
Generated on Mon Apr 26 15:54:47 2010 for xanlib by  doxygen 1.6.3