45 #ifndef __CCL_HASH_H__
46 # define __CCL_HASH_H__
59 typedef struct ccl_hash_methods_st {
69 struct ccl_hash_entry_st {
93 ccl_hash_create_methods_struct (
const ccl_hash_methods *methods,
96 extern const ccl_hash_methods *
97 ccl_hash_get_methods (
const ccl_hash *ht);
100 ccl_hash_enable_pool (
ccl_hash *ht,
const char *poolname,
int nb_elements);
130 ccl_hash_has (
const ccl_hash *ht,
const void *key);
145 ccl_hash_get_with_key (
const ccl_hash * ht,
const void * key);
195 extern ccl_pointer_iterator *
206 extern ccl_pointer_iterator *
217 extern ccl_hash_entry_iterator *
ccl_hash * ccl_hash_create(ccl_hash_func *key_hash, ccl_compare_func *key_compare, ccl_delete_proc *key_delete, ccl_delete_proc *object_delete)
Creates a new hash table.
void ccl_hash_insert(ccl_hash *ht, void *object)
Inserts at the cursor position the object.
void ccl_hash_remove(ccl_hash *ht)
Removes the object at the cursor position.
int ccl_hash_find(ccl_hash *ht, void *key)
Looks for key in the table ht.
Frequently used prototypes of generic functions.
A generic iterator interface.
void * ccl_hash_get(ccl_hash *ht)
Returns the object of the entry pointed by the cursor.
int ccl_compare_func(const void *ptr1, const void *ptr2)
Prototype of functions used to order two objects pointed respectively by ptr1 and ptr2...
void ccl_hash_delete(ccl_hash *ht)
Deletes the table ht.
#define CCL_ITERATOR_TYPEDEF(_typename_, _eltype_)
Macro-function used to define and declare a new iterator type.
void ccl_delete_proc(void *ptr)
Prototype of procedures used to release the resources allocated to the object pointed by ptr...
Some useful and common macros.
ccl_pointer_iterator * ccl_hash_get_keys(const ccl_hash *ht)
Builds an iterator over keys of ht.
ccl_pointer_iterator * ccl_hash_get_elements(const ccl_hash *ht)
Builds an iterator over objects stored in ht.
struct ccl_hash_entry_st ccl_hash_entry
Entries of the table that are returned by ad-hoc iterator.
int ccl_hash_get_size(const ccl_hash *ht)
Returns the number of elements in the table.
ccl_hash_entry_iterator * ccl_hash_get_entries(const ccl_hash *ht)
Builds an iterator over entries of ht.
struct ccl_hash_st ccl_hash
abstract type of an hash table.
unsigned int ccl_hash_func(const void *ptr)
Prototype of functions used to compute a hashed value from an abstract object pointed by ptr...