summaryrefslogtreecommitdiff
path: root/include/SDK/DWC/gamespy/hashtable.h
blob: beb48126f1e35e6d09545ad89dd6db337f8f4a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef POKEREVO_HASHTABLE_H
#define POKEREVO_HASHTABLE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <DWC/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