summaryrefslogtreecommitdiff
path: root/src/std/containers/hashset.h
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-19 15:15:39 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-06-19 15:15:39 +1000
commit6fccac3372170153b59e829d11c6c0b0a5c2bc77 (patch)
tree92290b3ed628cd2706847fcc3f9bdddeda521d03 /src/std/containers/hashset.h
parent259da84075c62c2ab96c7cb922df2000ebefb735 (diff)
start fleshing out API for hashmap / hashset
Diffstat (limited to 'src/std/containers/hashset.h')
-rw-r--r--src/std/containers/hashset.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/std/containers/hashset.h b/src/std/containers/hashset.h
index d153fd2..978ec00 100644
--- a/src/std/containers/hashset.h
+++ b/src/std/containers/hashset.h
@@ -7,4 +7,23 @@
*
* @copyright Copyright (c) 2024
*
- */ \ No newline at end of file
+ */
+
+#include "defines.h"
+
+typedef struct hashset hashset;
+
+/** @brief Describes a function that will take a pointer to a datatype (e.g. a u64 or a struct)
+ and return a hashed key. */
+typedef uint64_t (*hash_item)(void* item);
+
+void hashset_init(hashset* set, hash_item hash_func, size_t initial_capacity);
+// TODO: void hashset_from_iterator();
+bool hashset_insert(hashset* set, void* item, uint64_t* out_key);
+void hashset_batch_insert(hashset* set, void* items, u64 item_count);
+bool hashset_contains(hashset* set, void* item);
+bool hashset_remove_item(hashset* set, void* item);
+bool hashset_remove_key(hashset* set, uint64_t key);
+void hashset_merge(hashset* set_a, hashset* set_b);
+hashset* hashset_merge_cloned(hashset* set_a, hashset* set_b);
+void hashset_free(hashset* set); \ No newline at end of file