-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRpcClient.h
More file actions
56 lines (40 loc) · 1.29 KB
/
Copy pathRpcClient.h
File metadata and controls
56 lines (40 loc) · 1.29 KB
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
#ifndef MicroMiddleware_RpcClient_h_Included
#define MicroMiddleware_RpcClient_h_Included
#include <set>
#include"MicroMiddleware/IncludeExtLibs.h"
#include"MicroMiddleware/Net/RpcBase.h"
#include"MicroMiddleware/NetObjects/InterfaceHandle.h"
#include"MicroMiddleware/NetObjects/GroupHandle.h"
#include"MicroMiddleware/NetObjects/RpcIdentifier.h"
#include"MicroMiddleware/Export.h"
namespace MicroMiddleware
{
class DLL_STATE RpcClient : public RpcBase, protected Thread
{
public:
RpcClient(const InterfaceHandle &interfaceHandle, bool autoStart = true);
virtual ~RpcClient();
void StopClient(bool waitForTermination = true);
void StartClient();
bool ConnectToHost();
bool WaitConnected();
virtual void AddTarget(GroupHandle &handle);
virtual void RemoveTarget(GroupHandle &handle);
public:
inline InterfaceHandle GetInterfaceHandle() { return interfaceHandle_; }
inline bool IsRunning() { return isRunning(); }
protected:
virtual void run();
private:
bool connectToHost();
void initTcpSocket();
protected:
bool runThread_;
InterfaceHandle interfaceHandle_;
mutable Mutex clientMutex_;
TcpSocket::Ptr tcpSocket_;
RpcIdentifier rpcAddTarget_;
RpcIdentifier rpcRemoveTarget_;
};
}; // namespace MicroMiddleware
#endif // MicroMiddleware_RpcClient_h_Included