Go to the documentation of this file.
19 # include <sys/types.h>
28 # define HASHMAP_INIT_CAPACITY 51
t_hashmap * hashmap_new(const t_type *key_type, const t_type *val_type)
Initializes a new empty map.
t_queue * hashmap_keys(const t_hashmap *hm)
Returns a queue with all the keys in the map.
const t_type * key_type
The type of keys in the hashmap.
void hashmap_delete(t_hashmap *hm)
Deletes this hashmap and free all its items and the associated data.
t_queue * hashmap_vals(const t_hashmap *hm)
Returns a queue with all the values in the map.
size_t size
The number of elements in the hashmap.
void hashmap_put(t_hashmap *hm, const void *key, const void *val)
Adds a key-value pair to the symbol table.
Doubly-linked list of generic items.
A full representation of a data type, used to achieve polymorphism in the implementation of data stru...
A symbol table of generic key-value pairs, implemented as a dynamically resizing linear-probing hashm...
int hashmap_contains(const t_hashmap *hm, const void *key)
Is the specified key contained in the map?
const t_type * val_type
The type of values in the hashmap.
void hashmap_remove(t_hashmap *hm, const void *key)
Removed the element associated with the specified key from the map.
size_t hashmap_size(const t_hashmap *hm)
Returns the number of elements in this map.
size_t capacity
The current capacity of the hashmap.
void * hashmap_get(const t_hashmap *hm, const void *key)
Fetches the value associated with the given key.