Samchon Framework for CPP  1.0.0
Client.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/protocol/IClient.hpp>
5 #include <samchon/protocol/service/ServiceKeeper.hpp>
6 
7 #include <mutex>
8 #include <string>
9 
13 #define KEEP_CLIENT_ALIVE auto &ucPair = __keepAlive();
14 
15 namespace samchon
16 {
17 namespace protocol
18 {
19 namespace service
20 {
21  class Server;
22  class User;
23  class Service;
24 
46  class SAMCHON_FRAMEWORK_API Client
47  : public IClient
48  {
49  friend class Server;
50  friend class User;
51 
52  private:
53  typedef IClient super;
54 
55  protected:
60 
64  size_t no;
65 
70 
71  public:
77  Client(User*);
78  virtual ~Client();
79 
80  protected:
87  virtual auto createService(const std::string &)->Service* = 0;
88 
89  auto __keepAlive()->ServiceKeeper;
90 
91  public:
95  auto getUser() const->User*;
96 
100  auto getService() const->Service*;
101 
105  auto getNo() const->size_t;
106 
107  public:
123  void sendData(std::shared_ptr<Invoke>);
124 
192  void replyData(std::shared_ptr<Invoke>);
193 
194  private:
204  void constructService(const std::string &);
205  };
206 };
207 };
208 };
Definition: RWMutex.hpp:4
User containing Client(s) with session-id.
Definition: User.hpp:56
A server for (cloud) service.
Definition: Server.hpp:48
size_t no
A sequence number of the Client in an User.
Definition: Client.hpp:64
An interface for a client.
Definition: IClient.hpp:53
A network boundary with the client in an User.
Definition: Client.hpp:46
Standard message of network I/O.
Definition: Invoke.hpp:47
User * user
An User of the Client.
Definition: Client.hpp:59
Service * service
A Service belongs to the Client.
Definition: Client.hpp:69
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7