Samchon Framework for CPP  1.0.0
MediatorWebClient.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/templates/parallel/MediatorClient.hpp>
5 #include <samchon/protocol/WebServerConnector.hpp>
6 
7 namespace samchon
8 {
9 namespace templates
10 {
11 namespace parallel
12 {
23  : public MediatorClient
24  {
25  private:
26  typedef MediatorClient super;
27 
28  protected:
29  std::string path_;
30 
31  public:
32  /* ---------------------------------------------------------
33  CONSTRUCTORS
34  --------------------------------------------------------- */
42  MediatorWebClient(external::base::ExternalSystemArrayBase *system_array_, const std::string &ip, int port)
43  : MediatorWebClient(system_array_, ip, port, "")
44  {
45  };
46 
55  MediatorWebClient(external::base::ExternalSystemArrayBase *system_array_, const std::string &ip, int port, const std::string &path)
56  : super(system_array_, ip, port)
57  {
58  this->path_ = path;
59  };
60  virtual ~MediatorWebClient() = default;
61 
62  protected:
64  {
65  return new protocol::WebServerConnector(this);
66  };
67 
68  public:
69  /* ---------------------------------------------------------
70  METHOD OF CONNECTOR
71  --------------------------------------------------------- */
72  virtual void start() override
73  {
74  if (communicator_ != nullptr)
75  return;
76 
78  communicator_.reset(connector);
79 
80  connector->connect(ip_, port_, path_);
81  };
82  };
83 };
84 };
85 };
MediatorWebClient(external::base::ExternalSystemArrayBase *system_array_, const std::string &ip, int port)
virtual void connect(const std::string &ip, int port) override
virtual auto createServerConnector() -> protocol::ServerConnector *
MediatorWebClient(external::base::ExternalSystemArrayBase *system_array_, const std::string &ip, int port, const std::string &path)