Provided by: libglobus-common-doc_18.14-1.1build1_all
NAME
globus_hashtable - Hash Table - Hash Table.
SYNOPSIS
Modules Iterators Iterators. Typedefs typedef int(* globus_hashtable_hash_func_t) (void *key, int limit) typedef int(* globus_hashtable_keyeq_func_t) (void *key1, void *key2) typedef void(* globus_hashtable_copy_func_t) (void **dest_key, void **dest_datum, void *src_key, void *src_datum) typedef void(* globus_hashtable_destructor_func_t) (void *datum) Functions int globus_hashtable_init (globus_hashtable_t *table, int size, globus_hashtable_hash_func_t hash_func, globus_hashtable_keyeq_func_t keyeq_func) Initialize a hash table. int globus_hashtable_insert (globus_hashtable_t *table, void *key, void *datum) Insert a datum into a hash table. void * globus_hashtable_update (globus_hashtable_t *table, void *key, void *datum) Update a hash table mapping. void * globus_hashtable_lookup (globus_hashtable_t *table, void *key) Look up a datum in a hash table. void * globus_hashtable_remove (globus_hashtable_t *table, void *key) Remove a datum from a hash table. int globus_hashtable_to_list (globus_hashtable_t *table, globus_list_t **list) Create a list of all datums in a hash table. globus_bool_t globus_hashtable_empty (globus_hashtable_t *table) Test hash table emptiness. int globus_hashtable_size (globus_hashtable_t *table) Hash table size. int globus_hashtable_destroy (globus_hashtable_t *table) 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. " int globus_hashtable_string_hash (void *string, int limit) Null-terminated string hash function. int globus_hashtable_string_keyeq (void *string1, void *string2) Null-terminated string equality predicate. int globus_hashtable_voidp_hash (void *voidp, int limit) Void pointer hash function. int globus_hashtable_voidp_keyeq (void *voidp1, void *voidp2) Void pointer equality predicate. int globus_hashtable_int_hash (void *integer, int limit) Integer hash function. int globus_hashtable_int_keyeq (void *integer1, void *integer2) Integer equality predicate.
Detailed Description
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.
Typedef Documentation
typedef void(* globus_hashtable_copy_func_t) (void **dest_key, void **dest_datum, void *src_key, void *src_datum) datum copy func typedef void(* globus_hashtable_destructor_func_t) (void *datum) Destructor callback for use with globus_hashtable_destroy_all typedef int(* globus_hashtable_hash_func_t) (void *key, int limit) 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 typedef int(* globus_hashtable_keyeq_func_t) (void *key1, void *key2) 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.
Function Documentation
int globus_hashtable_destroy (globus_hashtable_t * table) 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. globus_bool_t globus_hashtable_empty (globus_hashtable_t * table) Test hash table emptiness. Returns GLOBUS_TRUE if hashtable is empty, GLOBUS_FALSE otherwise int globus_hashtable_init (globus_hashtable_t * table, int size, globus_hashtable_hash_func_t hash_func, globus_hashtable_keyeq_func_t keyeq_func) 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. int globus_hashtable_insert (globus_hashtable_t * table, void * key, void * datum) 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. int globus_hashtable_int_hash (void * integer, int limit) 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. void * globus_hashtable_lookup (globus_hashtable_t * table, void * key) 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. void * globus_hashtable_remove (globus_hashtable_t * table, void * key) 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. int globus_hashtable_size (globus_hashtable_t * table) Hash table size. Returns Number of entries in hashtable int globus_hashtable_string_hash (void * string, int limit) Null-terminated string hash function. A decent hash function for null-terminated character arrays. void * globus_hashtable_update (globus_hashtable_t * table, void * key, void * datum) 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. int globus_hashtable_voidp_hash (void * voidp, int limit) 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.
Author
Generated automatically by Doxygen for globus_common from the source code.