forked from dase/CLAIMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdaptiveEndPoint.h
executable file
·49 lines (45 loc) · 1.22 KB
/
AdaptiveEndPoint.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
/*
* AdaptiveActor.h
*
* Created on: Aug 8, 2013
* Author: wangli
*/
#ifndef ADAPTIVEENDPOINT_H_
#define ADAPTIVEENDPOINT_H_
#include <Theron/Theron.h>
#include <string>
#include "Message.h"
#include "Logging.h"
class AdaptiveEndPoint:public Theron::EndPoint {
public:
AdaptiveEndPoint(const char* name, std::string ip, std::string port);
virtual ~AdaptiveEndPoint();
static AdaptiveEndPoint* getInstance();
private:
bool SayHelloToCoordinator(std::string ip,std::string port);
int GetCoordinatorEndPointPort();
bool WaitForReadySignalFromCoordinator();
bool ConnectToCoordinateEndPoint(int port);
bool ConnectToRemoteEndPoint(std::string location);
protected:
Theron::Framework *framework;
Logging* logging_;
private:
Theron::Actor* connectionActor;
int socket_coor;
std::string ip_coor;
/**
* The Actor which receive the node states from the coordinator
*/
friend class ConnectionActor;
//////////////////////////////////////////////////
class ConnectionActor:public Theron::Actor{
public:
ConnectionActor(AdaptiveEndPoint*,const char* Name);
private:
void ReceiveNodeStatus256(const Message256 &message, const Theron::Address from);
private:
AdaptiveEndPoint* AEP;
};
};
#endif /* ADAPTIVEACTOR_H_ */