1 #ifndef HASHSTRUCTURE_H_
\r
2 #define HASHSTRUCTURE_H_
\r
4 #include "mlp_runtime.h"
\r
5 //#include "WaitingQueue.h"
\r
7 #define ITEM_NOT_AT_FRONT_OF_WAITINGQ 3
\r
8 #define TRAVERSER_FINISHED 2
\r
9 #define bitvt unsigned long long
\r
11 //Note READEFFECT = READBIN and WRITEEFFECT=WRITEBIN. They mean the same thing
\r
12 //but are named differently for clarity in code.
\r
13 #define READEFFECT 0
\r
14 #define WRITEEFFECT 1
\r
15 #define WAITINGQUEUENOTE 2
\r
23 #define SPECNOTREADY 2
\r
33 #define RNUMRENTRY 256
\r
34 #define RH_MASK (RNUMBINS)-1
\r
36 //Note: put resolved things at the end and unresolved at the front.
\r
37 typedef struct BinItem_rcr {
\r
41 //TODO keep track of record ptr here
\r
42 struct BinItem_rcr * next;
\r
45 typedef struct BinElement_rcr {
\r
50 typedef struct Hashtable_rcr {
\r
51 BinElement_rcr array[RNUMBINS];
\r
52 // WaitingQueueBin * waitingQueue;
\r
55 //Todo this is a clone of REntry, remove data fields as necessary
\r
56 typedef struct Entry_rcr {
\r
61 typedef struct WriteBinItem_rcr {
\r
68 typedef struct ReadBinItem_rcr {
\r
70 TraverserData array[RNUMREAD];
\r
71 //We don't need a head index since if the item before it was freed, then all these would be considered ready as well.
\r
75 extern HashStructure ** allHashStructures;
\r
77 void rcr_createMasterHashTableArray(int maxSize); //temporary
\r
78 HashStructure* rcr_createHashtable(int sizeofWaitingQueue);
\r
79 WriteBinItem_rcr* rcr_createWriteBinItem();
\r
80 ReadBinItem_rcr* rcr_createReadBinItem();
\r
81 int rcr_isReadBinItem(BinItem_rcr* b);
\r
82 int rcr_isWriteBinItem(BinItem_rcr* b);
\r
83 inline int rcr_generateKey(void * ptr);
\r
85 //Method signatures are not in their final form since I have still not decided what is the optimum amount of data
\r
86 //to store in each entry.
\r
88 int rcr_WRITEBINCASE(HashStructure *T, void *ptr, SESEcommon *task, int index);
\r
89 int rcr_READBINCASE(HashStructure *T, void *ptr, SESEcommon * task, int index);
\r
90 int rcr_TAILREADCASE(HashStructure *T, void * ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index);
\r
91 void rcr_TAILWRITECASE(HashStructure *T, void *ptr, BinItem_rcr *val, BinItem_rcr *bintail, int key, SESEcommon * task, int index);
\r