The Hash Implementation
[The Implementations]

The hash implementation. More...


Functions

EAPI Cmaid_Setcmaid_hash_set_new (const Cmaid_Value *v)
 Creates a new set using the hash implementation.
EAPI Cmaid_Mapcmaid_hash_map_new (const Cmaid_Value *key, const Cmaid_Value *value)
 Creates a new map using the hash implementation.
EAPI Cmaid_Cachecmaid_hash_cache_new (const Cmaid_Value *v)
 Creates a new cache using the hash implementation.
void cmaid_hash_dump (Cmaid_Container *c)

Variables

EAPI const Cmaid_Set_Interface cmaid_hash_set_if
EAPI const Cmaid_Map_Interface cmaid_hash_map_if
EAPI const Cmaid_Cache_Interface cmaid_hash_cache_if
EAPI const Cmaid_Iter_Interface cmaid_hash_key_iter_if
EAPI const Cmaid_Iter_Interface cmaid_hash_value_iter_if


Detailed Description

The hash implementation.

The hash table implementation provides a growing hash table used for fast insertions, removes and look-ups. All these operations are in mean constant in time, i.e. O(1) for the best case. Depending on the hash value function, this can become linear in time, i.e. O(N), in the worst case scenario. Keep this in mind and adjust your hash function to the hashed data if you find the basic operations, not constant in time. Unlike like in the tree, the values are not lexically ordered.

The hash table is implement with a growing bucket size, that means, once the hash table table is too full, the bucket array is reallocated with a larger size, and the nodes are re-insert. This happens automatically and you have not to care about it. But it is important to know when using iterators.

As soon as an iterator is attached to the hash table, the hash bucket size is frozen, so that the order of the nodes is not changed. So doing massive adds with an attached iterator may reduce the performance of the hash table.


Function Documentation

EAPI Cmaid_Cache* cmaid_hash_cache_new ( const Cmaid_Value v  ) 

Creates a new cache using the hash implementation.

Parameters:
v The value structure defining the type of the objects that are cached.
Returns:
Returns a newly allocated cache, an allocation error occurs, NULL is returned This functions is creating a cache with the hash table as implementation.

EAPI Cmaid_Map* cmaid_hash_map_new ( const Cmaid_Value key,
const Cmaid_Value value 
)

Creates a new map using the hash implementation.

Parameters:
key The value structure defining the type of the objects used for the key object.
value The value structure defining the type of the objects used for the value object.
Returns:
Returns a newly allocated map, an allocation error occurs, NULL is returned. This functions is creating a map with the hash table as implementation.

EAPI Cmaid_Set* cmaid_hash_set_new ( const Cmaid_Value v  ) 

Creates a new set using the hash implementation.

Parameters:
v The value structure defining the type of the objects used in the set
Returns:
Returns a newly allocated set, an allocation error occurs, NULL is returned This functions is creating a set with the hash table as implementation.


Generated on Wed Aug 5 00:20:49 2009 for Cmaid by  doxygen 1.5.8