start of new file
[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 #ifdef RAW
28 int ObjectHashadd_I(struct ObjectHash *, int key, int data, int data2, int data3, int data4);
29 #endif
30 int ObjectHashremove(struct ObjectHash *,int key);
31 bool ObjectHashcontainskey(struct ObjectHash *,int key);
32 bool ObjectHashcontainskeydata(struct ObjectHash *,int key, int data);
33 int ObjectHashget(struct ObjectHash *,int key, int* data, int* data2, int * data3, int* data4);
34 void ObjectHashaddParent(struct ObjectHash *,struct ObjectHash* parent);
35 int ObjectHashfirstkey(struct ObjectHash *);
36 struct ObjectIterator* ObjectHashcreateiterator(struct ObjectHash *);
37 void ObjectHashiterator(struct ObjectHash *, struct ObjectIterator * it);
38 int ObjectHashcount(struct ObjectHash *, int key);
39
40 struct ObjectHash {
41     int numelements;
42     int size;
43     struct ObjectNode **bucket;
44     struct ObjectNode *listhead;
45     struct ObjectNode *listtail;
46 };
47
48 inline int ObjectHashcountset(struct ObjectHash * thisvar);
49
50 /* ObjectIterator *****************************************************/
51
52 struct ObjectNode {
53   struct ObjectNode *next;
54   struct ObjectNode *lnext;
55   struct ObjectNode *lprev;
56   int key;
57   int data;
58   int data2;
59   int data3;
60   int data4;
61 };
62
63 struct ObjectIterator {
64   struct ObjectNode *cur;
65 };
66
67 inline struct ObjectIterator * noargallocateObjectIterator();
68
69 inline struct ObjectIterator * allocateObjectIterator(struct ObjectNode *start);
70
71 inline int ObjhasNext(struct ObjectIterator *thisvar);
72
73 inline int Objnext(struct ObjectIterator *thisvar);
74
75 inline int Objkey(struct ObjectIterator *thisvar);
76
77 inline int Objdata(struct ObjectIterator *thisvar);
78 inline int Objdata2(struct ObjectIterator *thisvar);
79 inline int Objdata3(struct ObjectIterator *thisvar);
80 inline int Objdata4(struct ObjectIterator *thisvar);
81
82
83 #endif