Defines | |
#define | HASH_FLAG_AUTOGROW |
Flag permitting a hash table to automatically grow. More... | |
#define | HASH_FLAG_AUTOSHRINK |
Flag permitting a hash table to automatically shrink. More... | |
#define | HASH_TABLE_INIT(flags, func, comp, resize, extra) |
Hash table static initializer. More... | |
#define | ht_verify(table) |
Hash table verification macro. More... | |
#define | ht_flags(table) |
Hash table flags. More... | |
#define | ht_frozen(table) |
Determine if a hash table is frozen. More... | |
#define | ht_modulus(table) |
Hash table modulus. More... | |
#define | ht_count(table) |
Hash table count. More... | |
#define | ht_func(table) |
Hash table hash function. More... | |
#define | ht_comp(table) |
Hash table comparison function. More... | |
#define | ht_rsize(table) |
Hash table resize callback function. More... | |
#define | ht_extra(table) |
Extra pointer data in a hash table. More... | |
#define | ht_size(table) |
Hash table memory size. More... | |
#define | HASH_ENTRY_INIT(value) |
Hash table entry static initializer. More... | |
#define | he_verify(entry) |
Hash table entry verification macro. More... | |
#define | he_link(entry) |
Hash table entry linked list element. More... | |
#define | he_flags(entry) |
Hash table entry flags. More... | |
#define | he_table(entry) |
Hash table entry table pointer. More... | |
#define | he_hash(entry) |
Hash table entry hash value. More... | |
#define | he_key(entry) |
Hash table entry key pointer. More... | |
#define | he_value(entry) |
Hash table entry value pointer. More... | |
#define | st_rsize(table) |
Sparse matrix table resize callback function. More... | |
Typedefs | |
typedef struct _hash_table_s | hash_table_t |
Hash table. More... | |
typedef struct _hash_entry_s | hash_entry_t |
Hash table entry. More... | |
typedef unsigned long (* | hash_iter_t )(hash_table_t *, hash_entry_t *, void *) |
Hash table iteration callback. More... | |
typedef unsigned long (* | hash_func_t )(hash_table_t *, db_key_t *) |
Hash function callback. More... | |
typedef unsigned long (* | hash_comp_t )(hash_table_t *, db_key_t *, db_key_t *) |
Hash table comparison callback. More... | |
typedef unsigned long (* | hash_resize_t )(hash_table_t *, unsigned long) |
Hash table resize callback. More... | |
Functions | |
unsigned long | ht_init (hash_table_t *table, unsigned long flags, hash_func_t func, hash_comp_t comp, hash_resize_t resize, void *extra, unsigned long init_mod) |
Dynamically initialize a hash table. More... | |
unsigned long | ht_add (hash_table_t *table, hash_entry_t *entry, db_key_t *key) |
Add an entry to a hash table. More... | |
unsigned long | ht_move (hash_table_t *table, hash_entry_t *entry, db_key_t *key) |
Move an entry in the hash table. More... | |
unsigned long | ht_remove (hash_table_t *table, hash_entry_t *entry) |
Remove an element from a hash table. More... | |
unsigned long | ht_find (hash_table_t *table, hash_entry_t **entry_p, db_key_t *key) |
Find an entry in a hash table. More... | |
unsigned long | ht_iter (hash_table_t *table, hash_iter_t iter_func, void *extra) |
Iterate over each entry in a hash table. More... | |
unsigned long | ht_flush (hash_table_t *table, hash_iter_t flush_func, void *extra) |
Flush a hash table. More... | |
unsigned long | ht_resize (hash_table_t *table, unsigned long new_size) |
Resize a hash table. More... | |
unsigned long | ht_free (hash_table_t *table) |
Free memory used by an empty hash table. More... | |
unsigned long | he_init (hash_entry_t *entry, void *value) |
Dynamically initialize a hash table entry. More... |
Entries may be added to and removed from the table using the ht_add() and ht_remove() functions. Additionally, the key on a given entry may be changed using the ht_move() function. Of course, any given entry may be looked up using the ht_find() function, and ht_iter() will execute a user-defined function for each entry in the hash table (in an unspecified order). The ht_flush() function will remove all entries from the hash table, optionally executing a user-specified clean-up function.
|
This macro statically initializes a hash_entry_t.
|
|
If passed in to HASH_TABLE_INIT() or ht_init(), allows the hash table to grow automatically. |
|
If passed in to HASH_TABLE_INIT() or ht_init(), allows the hash table to shrink automatically. |
|
This macro statically initializes a hash_table_t.
|
|
This macro retrieves a set of user-defined flags associated with the entry. It may be used as an lvalue to set those flags.
|
|
This macro retrieves the hash value of the given hash entry. If the hash table has been resized, this value may not be the same as a previous value.
|
|
This macro retrieves the key associated with the hash table entry.
|
|
This macro provides access to the linked list element buried in the hash table entry. It should *not* be used on entries currently in a hash table. The purpose of this macro is to allow an object containing a hash table entry to be placed upon a free list.
|
|
This macro retrieves a pointer to the hash table the entry is in.
|
|
This macro retrieves the value associated with the hash table entry. It may be treated as an lvalue to change that value. Care should be taken when using this option.
|
|
This macro verifies that a given pointer actually does point to a hash table entry.
|
|
This macro retrieves the comparison function pointer.
|
|
This macro retrieves the total number of items actually in the hash table.
|
|
This macro retrieves the extra pointer data associated with a particular hash table.
|
|
This macro retrieves the flags associated with the hash table. Only HASH_FLAG_AUTOGROW and HASH_FLAG_AUTOSHRINK have any meaning to the application; all other bits are reserved for use in the library. This macro may be used as an lvalue, but care must be taken to avoid modifying the library-specific bits.
|
|
This macro returns a non-zero value if the table is currently frozen. The hash table may be frozen if there is an iteration in progress.
|
|
This macro retrieves the hash function pointer.
|
|
This macro retrieves the number of buckets allocated for the hash table. An application may wish to save this value between invocations to avoid the overhead of growing the table while filling it with data.
|
|
This macro retrieves the resize callback function pointer.
|
|
This macro returns the physical size of the bucket array allocated by the library for this hash table.
|
|
This macro verifies that a given pointer actually does point to a hash table.
|
|
This macro retrieves the resize callback function pointer.
|
|
This function pointer references a callback used to compare entries in a hash table. It should return 0 for identical entries and non-zero otherwise. No assumptions should be made about the order in which the two keys are passed to this function. |
|
This structure represents a single entry of a hash table. |
|
This function is associated with a hash table, and is responsible for generating a hash value. The full 32-bit range of an |
|
This function pointer references a callback used by ht_iter() and ht_flush(). It should return 0 for success. A non-zero return value will terminate the operation and will become the return value of the ht_iter() or ht_flush() call. |
|
This function pointer references a callback that will be called with both the old and new hash table sizes whenever a hash table is resized. It should return non-zero only when the resize should be inhibited. |
|
This structure is the basis of all hash tables maintained by this library. |
|
This function dynamically initializes a hash table entry.
|
|
This function adds an entry to a hash table.
|
|
This function looks up an entry matching the given
|
|
This function flushes a hash table--that is, it removes each entry from the table. If a
|
|
This function releases the memory used by the bucket table in an empty hash table.
|
|
This function dynamically initializes a hash table.
|
|
This function iterates over every entry in a hash table (in an unspecified order), executing the given
|
|
This function moves an existing entry in the hash table to correspond to the new key.
|
|
This function removes the given element from the specified hash table.
|
|
This function resizes a hash table to the given
|