data_structures
|
Go to the source code of this file.
Data Structures | |
struct | s_hashmap |
A symbol table of generic key-value pairs, implemented as a dynamically resizing linear-probing hashmap. More... | |
Macros | |
#define | HASHMAP_INIT_CAPACITY 51 |
The default initial capacity of a newly initialized hashmap. More... | |
Typedefs | |
typedef struct s_hashmap | t_hashmap |
Functions | |
t_hashmap * | hashmap_new (const t_type *key_type, const t_type *val_type) |
Initializes a new empty map. More... | |
void | hashmap_put (t_hashmap *hm, const void *key, const void *val) |
Adds a key-value pair to the symbol table. More... | |
void * | hashmap_get (const t_hashmap *hm, const void *key) |
Fetches the value associated with the given key. More... | |
t_queue * | hashmap_keys (const t_hashmap *hm) |
Returns a queue with all the keys in the map. More... | |
t_queue * | hashmap_vals (const t_hashmap *hm) |
Returns a queue with all the values in the map. More... | |
size_t | hashmap_size (const t_hashmap *hm) |
Returns the number of elements in this map. More... | |
void | hashmap_delete (t_hashmap *hm) |
Deletes this hashmap and free all its items and the associated data. More... | |
void | hashmap_remove (t_hashmap *hm, const void *key) |
Removed the element associated with the specified key from the map. More... | |
int | hashmap_contains (const t_hashmap *hm, const void *key) |
Is the specified key contained in the map? More... | |
#define HASHMAP_INIT_CAPACITY 51 |
int hashmap_contains | ( | const t_hashmap * | hm, |
const void * | key | ||
) |
Is the specified key contained in the map?
key | The key |
1
if the key is in the map, 0
otherwise Definition at line 16 of file hashmap_contains.c.
void hashmap_delete | ( | t_hashmap * | hm | ) |
Deletes this hashmap and free all its items and the associated data.
Does nothing if the argument is NULL
.
Definition at line 16 of file hashmap_delete.c.
void* hashmap_get | ( | const t_hashmap * | hm, |
const void * | key | ||
) |
Fetches the value associated with the given key.
key | The key |
NULL
if the key is not in the map. Definition at line 17 of file hashmap_get.c.
Returns a queue with all the keys in the map.
Definition at line 16 of file hashmap_keys.c.
Initializes a new empty map.
key_type | The type of keys that this map can hold |
val_type | The type of values that this map can hold |
hash
function). Definition at line 16 of file hashmap_new.c.
void hashmap_put | ( | t_hashmap * | hm, |
const void * | key, | ||
const void * | val | ||
) |
Adds a key-value pair to the symbol table.
key | The key |
val | The value |
Definition at line 17 of file hashmap_put.c.
void hashmap_remove | ( | t_hashmap * | hm, |
const void * | key | ||
) |
Removed the element associated with the specified key from the map.
key | The key |
Definition at line 36 of file hashmap_remove.c.
size_t hashmap_size | ( | const t_hashmap * | hm | ) |
Returns the number of elements in this map.
Definition at line 16 of file hashmap_size.c.
Returns a queue with all the values in the map.
Definition at line 16 of file hashmap_vals.c.