-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHChordSuccessorList.h
73 lines (46 loc) · 1.42 KB
/
HChordSuccessorList.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef __HCHORDSUCCESSORLIST_H_
#define __HCHORDSUCCESSORLIST_H_
#include <map>
#include <omnetpp.h>
#include <InitStages.h>
#include <NodeHandle.h>
class HChord_U;
class OverlayKey;
class HNotifyResponse;
struct SuccessorListEntry
{
NodeHandle nodeHandle ;//*< the nodehandle
bool newEntry; //*< true, if this entry has just been added
};
std::ostream& operator<<(std::ostream& os, const SuccessorListEntry& e);
class HChordSuccessorList : public cSimpleModule
{
public:
virtual int numInitStages() const
{
return MAX_STAGE_OVERLAY + 1;
}
virtual void initialize(int stage);
virtual void handleMessage(cMessage* msg);
virtual void initializeList(uint size, NodeHandle owner,HChord_U* overlay);
virtual uint getSize();
virtual void clear();
virtual bool isEmpty();
virtual const NodeHandle& getSuccessor(uint pos = 0);
virtual void addSuccessor(NodeHandle successor, bool resize = true);
virtual NodeHandle popSuccessor();
virtual void removeSuccessor(NodeHandle successor);
virtual void updateList(HNotifyResponse* notify);
void display ();
protected:
NodeHandle thisNode;
std::map<OverlayKey, SuccessorListEntry> successorMap;
uint successorListSize;
HChord_U* overlay;
int keyLength;
void removeOldSuccessors();
void buildSuccessorList();
void updateDisplayString();
void updateTooltip();
};
#endif