-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSuccessorList.h
44 lines (34 loc) · 932 Bytes
/
SuccessorList.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
/*
* SuccessorList.h
*
* Created on: 30 ago 2019
* Author: Albo
*/
#include <omnetpp.h>
#include <string.h>
#include <string>
#include "ChordMessages_m.h"
class Node;
class NotifyResponse;
using namespace std;
using namespace omnetpp;
#ifndef SUCCESSORLIST_H_INCLUDED__
#define SUCCESSORLIST_H_INCLUDED__
class SuccessorList: public cSimpleModule {
protected:
std::vector<pair<pair<string, bool>,Node*>> successorMap; // il bool dice se è una new entry
int successorListSize;
Node* thisNode;
public:
void initializeList(int size, Node* owner, bool debug = true);
int getSize();
bool isEmpty();
Node* getSuccessor(int pos = 0);
void addSuccessor(Node* successor, bool resize = true, bool debug = true);
void updateList(NotifyResponse* notifyResponse);
void removeOldSuccessors();
void print();
bool handleFailedNode(string failed);
void sortList();
};
#endif