bug fixes
[IRC.git] / Robust / src / Runtime / ObjectHash.h
1 #ifndef OBJECTHASH_H
2 #define OBJECTHASH_H
3
4 #ifndef bool
5 #define bool int
6 #endif
7
8 #ifndef true
9 #define true 1
10 #endif
11
12 #ifndef false
13 #define false 0
14 #endif
15
16 #include "mem.h"
17
18 /* ObjectHash *********************************************************/
19
20 struct ObjectHash * noargallocateObjectHash();
21 struct ObjectHash * allocateObjectHash(int size);
22 void ObjectHashaddChild(struct ObjectHash *thisvar, struct ObjectHash * child);
23 void freeObjectHash(struct ObjectHash *);
24
25 void ObjectHashrehash(struct ObjectHash * thisvar);
26 int ObjectHashadd(struct ObjectHash *, int key, int data, int data2, int data3, int data4);
27 int ObjectHashremove(struct ObjectHash *,int key);
28 bool ObjectHashcontainskey(struct ObjectHash *,int key);
29 bool ObjectHashcontainskeydata(struct ObjectHash *,int key, int data);
30 int ObjectHashget(struct ObjectHash *,int key, int* data, int* data2, int * data3, int* data4);
31 void ObjectHashaddParent(struct ObjectHash *,struct ObjectHash* parent);
32 int ObjectHashfirstkey(struct ObjectHash *);
33 struct ObjectIterator* ObjectHashcreateiterator(struct ObjectHash *);
34 void ObjectHashiterator(struct ObjectHash *, struct ObjectIterator * it);
35 int ObjectHashcount(struct ObjectHash *, int key);
36
37 struct ObjectHash {
38     int numelements;
39     int size;
40     struct ObjectNode **bucket;
41     struct ObjectNode *listhead;
42     struct ObjectNode *listtail;
43 };
44
45 inline int ObjectHashcountset(struct ObjectHash * thisvar);
46
47 /* ObjectIterator *****************************************************/
48
49 struct ObjectNode {
50   struct ObjectNode *next;
51   struct ObjectNode *lnext;
52   struct ObjectNode *lprev;
53   int key;
54   int data;
55   int data2;
56   int data3;
57   int data4;
58 };
59
60 struct ObjectIterator {
61   struct ObjectNode *cur;
62 };
63
64 inline struct ObjectIterator * noargallocateObjectIterator();
65
66 inline struct ObjectIterator * allocateObjectIterator(struct ObjectNode *start);
67
68 inline int ObjhasNext(struct ObjectIterator *thisvar);
69
70 inline int Objnext(struct ObjectIterator *thisvar);
71
72 inline int Objkey(struct ObjectIterator *thisvar);
73
74 inline int Objdata(struct ObjectIterator *thisvar);
75 inline int Objdata2(struct ObjectIterator *thisvar);
76 inline int Objdata3(struct ObjectIterator *thisvar);
77 inline int Objdata4(struct ObjectIterator *thisvar);
78
79
80 #endif