Hash table -
The globus_hashtable data type provides an abstract hashtable mapping representation and operations on such mappings. These queues can contain arbitrary data in the form of a void pointer for each key and a void pointer for each datum. It is the user's responsibility to provide and interpret keys and data of the correct type.
datum copy func
Destructor callback for use with globus_hashtable_destroy_all
An anonymous hash function providing an onto mapping of (key, limit) pairs to integers, where the result integer is in the range [ 0, limit - 1 ] .
Note that as a proper function, such hash routines must always compute the same result given the same key and limit value.
Parameters:
key Value to map
limit Map range limit
Returns:
Integer hash value of key
An anonymous predicate that returns true when the keys are equal and false otherwise. Truth and falsity are represented by non-zero and zero (0) integers for use directly in C language conditionals.
Destroy a hash table
Destroys a hashtable representation, releasing any resources used to represent the mappings (abandoning any data in the queue). After this call, a hashtable is no longer considered initialized. It is an error to destroy a hashtable that is not initialized.
Parameters:
table Hash table to destroy.
Test hash table emptiness.
Returns:
GLOBUS_TRUE if hashtable is empty, GLOBUS_FALSE otherwise
Initialize a hash table. Initializes a generic chaining hashtable to represent an empty mapping and returns zero, or returns non-zero on failure. The size parameter specifies the number of chains with which to represent the mapping. This defines the maximum possible number of mappings that can be represented without conflict given a perfect hash, and therefore affects performance as hash conflicts will be resolved by linear chains.
The hash_func and keyeq_func anonymous functions will be used by the table to manipulate the user's keys.
Insert a datum into a hash table. The routine globus_hashtable_insert adds a new mapping to the table, returning zero on success or non-zero on failure. Any previous mapping for the same key (where equality is defined by the keyeq_func provided at table initialization) is lost.
It is an error to call this routine on an uninitialized table.
Integer hash function. A pathetic hash function for integers, calculating the index as the remainder of dividing the integer by the table size.
Your pet gerbil could probably design a better hash function for your integer keys, but you might as well use this one if you were going to use modular division anyway.
Look up a datum in a hash table. The globus_hashtable_lookup routine returns the datum mapped to the given key in the table, or NULL if the key is not mapped.
It is an error to call this routine on an uninitialized or empty table.
Remove a datum from a hash table. The globus_hashtable_remove() function removes the mapping of key in the table, or does nothing if no such mapping exists.
It is an error to call this routine on an uninitialized or empty table.
Hash table size.
Returns:
Number of entries in hashtable
Null-terminated string hash function. A decent hash function for null-terminated character arrays.
Update a hash table mapping. Update an existing key -> datum association with new values for both, key and datum. The old datum is returned. If key is non-scalar (eg, string), it should be part of datum so its resources may be recovered. If old key does not exist, NULL is returned.
Void pointer hash function. A decent hash function for void pointers. This routine goes to some effort to distribute the information from the address into the hash index by XORing the upper and lower halves of the pointer into one accumulator and calculating the index as the remainder of dividing the accumulator by the table size.
Generated automatically by Doxygen for globus_common from the source code.