Add the prototypes for 3 hash implementations
[IRC.git] / Robust / src / Runtime / DSTM / interface / llookup.h
1 #ifndef _LLOOKUP_H_
2 #define _LLOOKUP_H_
3
4 #define LOADFACTOR 0.75
5 #define HASH_SIZE 100
6
7 typedef struct hashlistnode {
8         unsigned int oid;
9         unsigned int mid;
10         void *val;// points to the object header structure
11         struct hashlistnode *next;
12 } lhashlistnode_t;
13
14 typedef struct hashtable {
15         lhashlistnode_t *table; // points to beginning of hash table
16         unsigned int size;
17         unsigned int numelements;
18         float loadfactor;
19 } lhashtable_t;
20
21 /* Prototypes for hash*/
22 lhashtable_t *lhashCreate(unsigned int size, float loadfactor);
23 unsigned int lhashFunction(lhashtable_t *table, unsigned int oid);
24 void lhashInsert(lhashtable_t *table, unsigned int oid, void *val, unsigned int mid);
25 void *lhashSearch(lhashtable_t *table, unsigned int oid); //returns val, NULL if not found
26 int lhashRemove(lhashtable_t *table, unsigned int oid); //returns -1 if not found
27 void lhashResize(lhashtable_t *table, unsigned int newsize);
28 /* end hash */
29
30 #endif
31