2 #include <samchon/protocol/Server.hpp> 3 #include <samchon/examples/interaction/base/MonitorBase.hpp> 5 #include <samchon/examples/interaction/System.hpp> 6 #include <samchon/examples/interaction/Reporter.hpp> 15 :
public protocol::Server,
16 public base::MonitorBase
25 Monitor() : protocol::
Server()
27 reporter.reset(
new Reporter(
this));
30 virtual ~Monitor() =
default;
32 virtual void constructSystemTree()
override 34 for (
auto it = system_map.begin(); it != system_map.end(); it++)
37 for (
auto it = system_map.begin(); it != system_map.end(); it++)
38 if (it->second->getParent() !=
nullptr)
39 it->second->getParent()->push_back(it->second);
43 virtual void addClient(std::shared_ptr<protocol::ClientDriver> driver)
override 46 std::unique_ptr<System> system(
new System(
this, driver, uid));
48 system_map.emplace(uid, system.get());
49 driver->listen(system.get());
51 system_map.erase(uid);
58 virtual auto getRootSystem() const -> System*
60 if (system_map.empty())
65 System *system = system_map.begin()->second;
66 while (system->getParent() !=
nullptr)
67 system = system->getParent();
79 monitor.getReporter()->open(37950);
virtual void addClient(std::shared_ptr< ClientDriver >)=0