-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGlobalNodeList.h
73 lines (54 loc) · 1.54 KB
/
GlobalNodeList.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
/*
* GlobalNodeList.h
*
* Created on: 6 set 2019
* Author: Albo
*/
#include <omnetpp.h>
#include <iostream>
#include <map>
#include <set>
#include <vector>
class Node;
using namespace std;
using namespace omnetpp;
#ifndef GLOBALNODELIST_H_INCLUDED__
#define GLOBALNODELIST_H_INCLUDED__
class GlobalNodeList : public cSimpleModule
{
public:
string getBootstrapNode();
const std::map<std::string, std::string>& getNodeMap() const {
return nodeMap;
}
void setNodeMap(const std::map<std::string, std::string>& nodeMap) {
this->nodeMap = nodeMap;
}
const std::set<std::string>& getSetNode() const {
return setNode;
}
void setSetNode(const std::set<std::string>& setNode) {
this->setNode = setNode;
}
int getNumberOfNodes() const {
return numberOfNodes;
}
void setNumberOfNodes(int numberOfNodes) {
this->numberOfNodes = numberOfNodes;
}
void addBooststrapNode(Node* boot);
void printList();
bool willFail(string key);
private:
std::map<std::string,std::string> nodeMap; // per ora non usata
std::set<std::string> setNode; // lista di tutti i nodi nella rete
std::vector<std::string> boostrapList; // lista aggiornata dei nodi che fanno parte di chord
int numberOfNodes;
std::vector<std::string> failedNodes;
protected:
// The following redefined virtual function holds the algorithm.
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void pickFailed();
};
#endif