Samchon Framework for CPP  1.0.0
MediatorServer.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/templates/parallel/MediatorSystem.hpp>
5 #include <samchon/protocol/Server.hpp>
6 
7 #include <samchon/protocol/ClientDriver.hpp>
8 
9 namespace samchon
10 {
11 namespace templates
12 {
13 namespace parallel
14 {
25  : public MediatorSystem,
26  public virtual protocol::Server
27  {
28  private:
29  typedef MediatorSystem super;
30 
31  int port_;
32 
33  public:
40  MediatorServer(external::base::ExternalSystemArrayBase *system_array, int port)
41  : super(system_array),
42  protocol::Server()
43  {
44  this->port_ = port;
45  };
46  virtual ~MediatorServer() = default;
47 
48  virtual void start() override
49  {
50  open(port_);
51  };
52 
53  protected:
54  virtual void addClient(std::shared_ptr<protocol::ClientDriver> driver) override
55  {
56  this->communicator_ = driver;
57  driver->listen(this);
58  };
59  };
60 };
61 };
62 };
virtual void open(int port)
Definition: Server.hpp:74
MediatorServer(external::base::ExternalSystemArrayBase *system_array, int port)