- /*#### Je met juste les principaux prototypes, pour donner une idée de la source. ####*/
-
- /* Creation – destruction */
- Hash_table hash_table_create (unsigned int(*hash)(const Key_t e1), int(*compare)(const Key_t e1, const Key_t e2));
- int hash_table_free (Hash_table tab);
-
- /* Utilisation */
- char hash_table_get (Hash_table tab, Key_t k, Value_t *v);
- char hash_table_replace (Hash_table tab, Key_t k, Value_t v);
- char hash_table_add (Hash_table tab, Key_t k, Value_t v);
- char hash_table_remove (Hash_table tab, Key_t k, Value_t *v);
-
- /* Utilisation si HASH_TABLE_NOENTRY définit */
- char hash_table_get (Hash_table tab, Key_t k);
- char hash_table_add (Hash_table tab, Key_t k);
- char hash_table_remove (Hash_table tab, Key_t k);
-
- /* nombre d’éléments */
- int hash_table_count (Hash_table tab);
-
-
- /******* iterateur à la JAVA *******/
- Hash_table_it it = hash_table_it_create( tab );
- while( hash_table_it_hasNext( it ) ) {
- hash_table_entry *elt = hash_table_it_next( it );
- traiter( elt ); // utilisation
- }
- hash_table_it_free( it ); // désallocation
/*#### Je met juste les principaux prototypes, pour donner une idée de la source. ####*/
/* Creation – destruction */
Hash_table hash_table_create (unsigned int(*hash)(const Key_t e1), int(*compare)(const Key_t e1, const Key_t e2));
int hash_table_free (Hash_table tab);
/* Utilisation */
char hash_table_get (Hash_table tab, Key_t k, Value_t *v);
char hash_table_replace (Hash_table tab, Key_t k, Value_t v);
char hash_table_add (Hash_table tab, Key_t k, Value_t v);
char hash_table_remove (Hash_table tab, Key_t k, Value_t *v);
/* Utilisation si HASH_TABLE_NOENTRY définit */
char hash_table_get (Hash_table tab, Key_t k);
char hash_table_add (Hash_table tab, Key_t k);
char hash_table_remove (Hash_table tab, Key_t k);
/* nombre d’éléments */
int hash_table_count (Hash_table tab);
/******* iterateur à la JAVA *******/
Hash_table_it it = hash_table_it_create( tab );
while( hash_table_it_hasNext( it ) ) {
hash_table_entry *elt = hash_table_it_next( it );
traiter( elt ); // utilisation
}
hash_table_it_free( it ); // désallocation