22 typedef void *(*hashmap_dupe_t)(
const void *);
int(* hashmap_comp_t)(const void *a, const void *b)
Comparison function, used to compare hash keys.
Definition: hashmap.h:20
void *(* hashmap_dupe_t)(const void *)
Key duplication function, used to duplicate hash keys.
Definition: hashmap.h:22
void hashmap_free(hashmap_t *map)
Frees the memory of the hashmap.
Definition: hashmap.c:139
unsigned int hashmap_str_hash(const void *key)
Transforms a string key into a hash key.
Definition: hashmap.c:91
int hashmap_int_comp(const void *a, const void *b)
Compares two integer hash keys.
Definition: hashmap.c:86
int hashmap_str_comp(const void *a, const void *b)
Compares two string hash keys.
Definition: hashmap.c:104
void * hashmap_remove(hashmap_t *map, const void *key)
Removes the entry with the given key.
Definition: hashmap.c:203
unsigned int(* hashmap_hash_t)(const void *key)
Hashing function, used to generate hash keys.
Definition: hashmap.h:18
unsigned int hashmap_int_hash(const void *key)
Transforms an integer key into a hash key.
Definition: hashmap.c:81
void hashmap_do_not_free(void *value)
This function can be passed as hashmap_free_t, it does nothing.
Definition: hashmap.c:114
void * hashmap_do_not_duplicate(const void *value)
This function can be passed as hashmap_dupe_t, it does nothing.
Definition: hashmap.c:109
void * hashmap_get(hashmap_t *map, const void *key)
Access the value for the given key.
Definition: hashmap.c:190
int hashmap_is_empty(hashmap_t *map)
Checks if the hashmap is empty.
Definition: hashmap.c:236
list_t * hashmap_values(hashmap_t *map)
Provides access to all the values.
Definition: hashmap.c:268
void(* hashmap_free_t)(void *)
Key deallocation function, used to free the memory occupied by hash keys.
Definition: hashmap.h:24
hashmap_t * hashmap_create_int(unsigned int size)
Standard hashmap with keys of type (char *).
hashmap_t * hashmap_create_str(unsigned int size)
Standard hashmap with keys of type (char *).
void * hashmap_set(hashmap_t *map, const void *key, void *value)
Sets the value for the given key in the hashmap map.
Definition: hashmap.c:153
list_t * hashmap_keys(hashmap_t *map)
Provides access to all the keys.
Definition: hashmap.c:257
hashmap_t * hashmap_create(unsigned int size, hashmap_hash_t hash_fun, hashmap_comp_t comp_fun, hashmap_dupe_t dupe_fun, hashmap_free_t key_free_fun)
User-defined hashmap.
Definition: hashmap.c:119
int hashmap_has(hashmap_t *map, const void *key)
Checks if the hashmap contains an entry with the given key.
Definition: hashmap.c:246
An implementation for generic list.
Stores information of an entry of the hashmap.
Definition: hashmap.c:12
Stores information of a hashmap.
Definition: hashmap.c:22
unsigned int size
Size of the hashmap.
Definition: hashmap.c:32
Represent the list.
Definition: list.h:19