summaryrefslogtreecommitdiff
path: root/include/GameSpy/hashtable.h
diff options
context:
space:
mode:
authorRevo <projectrevotpp@hotmail.com>2020-09-29 12:50:12 -0400
committerGitHub <noreply@github.com>2020-09-29 12:50:12 -0400
commitbb28572125c45ec20f5fbf85120cd71fb2486bac (patch)
tree7847f3008d5208a45460af5805087f21b7613a4f /include/GameSpy/hashtable.h
parent1cc68edd6a6967c661579858ec0c1cf1d6d644d5 (diff)
parentc285b7af502dfe463479cecfbb26313be3e5f5f4 (diff)
Merge pull request #106 from mparisi20/master
Finish splitting nw4r::lyt and split more standard library modules
Diffstat (limited to 'include/GameSpy/hashtable.h')
-rw-r--r--include/GameSpy/hashtable.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/GameSpy/hashtable.h b/include/GameSpy/hashtable.h
new file mode 100644
index 0000000..26e0b6d
--- /dev/null
+++ b/include/GameSpy/hashtable.h
@@ -0,0 +1,34 @@
+#ifndef POKEREVO_HASHTABLE_H
+#define POKEREVO_HASHTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "GameSpy/darray.h"
+
+typedef s32 (*HashFunction)(void *, s32);
+
+typedef struct HashTable {
+ DArray **chains;
+ s32 size;
+ DtorFunction dtor;
+ HashFunction hashFunc;
+ CompareFunction compar;
+} HashTable;
+
+HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor);
+HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor);
+void TableFree(HashTable *table);
+s32 TableCount(HashTable *table);
+void TableEnter(HashTable *table, void *elem);
+BOOL TableRemove(HashTable *table, void *elem);
+void *TableLookup(HashTable *table, void *elem);
+void TableMapSafe(HashTable *table, MapFunction p2, s32 p3);
+void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //POKEREVO_HASHTABLE_H