parallax 1.0
command-line based task/todo manager
Loading...
Searching...
No Matches
hashmap.h
Go to the documentation of this file.
1#ifndef HASHMAP_H
2#define HASHMAP_H
3
4#include "task.h"
5
11
15typedef struct Entry {
16 char* key;
17 void* value;
18 struct Entry* next;
20
26typedef struct HashMap {
28 size_t table_size;
30
31
38HashMap* hashmap_create(size_t table_size);
39
47void hashmap_set(HashMap* map, char* key, void* value);
48
58void* hashmap_get(HashMap* map, char* key);
59
66void hashmap_elem_remove(HashMap* map, char* key);
67
73void hashmap_destroy(HashMap* map);
74
75#endif //HASHMAP_H
HashMap * hashmap_create(size_t table_size)
Creates a hashmap of a fixed size.
Definition hashmap.c:32
void hashmap_set(HashMap *map, char *key, void *value)
Adds an entry to a hashmap by a key string and value.
Definition hashmap.c:42
void hashmap_destroy(HashMap *map)
Frees a hashmap to memory.
Definition hashmap.c:132
void hashmap_elem_remove(HashMap *map, char *key)
Removes an entry in a hashmap by its key.
Definition hashmap.c:102
void * hashmap_get(HashMap *map, char *key)
Finds an entry in a non-empty hashmap by a key.
Definition hashmap.c:80
Linked list node definition of an entry in a hash map.
Definition hashmap.h:15
struct Entry * next
Definition hashmap.h:18
char * key
Definition hashmap.h:16
void * value
Definition hashmap.h:17
Hashmap structure.
Definition hashmap.h:26
size_t table_size
Definition hashmap.h:28
Entry ** buckets
Definition hashmap.h:27
Contains structures and functions for handling task-related operations.