Samchon Framework for CPP  1.0.0
IClient.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/protocol/IProtocol.hpp>
5 
6 #include <samchon/protocol/Socket.hpp>
7 #include <string>
8 
9 namespace std
10 {
11  class mutex;
12 };
13 namespace samchon
14 {
15  class ByteArray;
16 };
17 
18 namespace samchon
19 {
20 namespace protocol
21 {
22  class Invoke;
23 
53  class SAMCHON_FRAMEWORK_API IClient
54  : public virtual IProtocol
55  {
56  protected:
60  Socket *socket;
61 
65  std::mutex *sendMtx;
66 
70  virtual auto BUFFER_SIZE() const->size_t;
71 
72  private:
73 
74 
75  public:
79  IClient();
80  virtual ~IClient();
81 
87  virtual void listen();
88 
94  virtual void sendData(std::shared_ptr<Invoke>);
95 
96  protected:
112  virtual void _replyData(std::shared_ptr<Invoke>);
113 
114  private:
115  void handleString(ByteArray &, std::string &, std::shared_ptr<Invoke> &, size_t);
116  void handleBinary(ByteArray &, std::string &, std::shared_ptr<Invoke> &, size_t);
117  };
118 };
119 };
Definition: RWMutex.hpp:4
std::mutex * sendMtx
A mutex for sending message.
Definition: IClient.hpp:65
An interface for a client.
Definition: IClient.hpp:53
An interface of Invoke message chain.
Definition: IProtocol.hpp:31
Standard message of network I/O.
Definition: Invoke.hpp:47
Binary data class.
Definition: ByteArray.hpp:30
Socket * socket
Socket for network I/O.
Definition: IClient.hpp:60
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7