2 #include <samchon/protocol/master/ParallelClientArray.hpp> 4 #include <samchon/example/interaction/ChiefDriver.hpp> 5 #include <samchon/example/interaction/SlaveDriver.hpp> 6 #include <samchon/protocol/Invoke.hpp> 20 using namespace library;
21 using namespace protocol;
50 :
public master::ParallelClientArray
53 typedef master::ParallelClientArray super;
87 chiefDriver.reset(
new ChiefDriver(
this, port + 10));
91 virtual ~
Master() =
default;
93 virtual void start()
override 95 array<thread, 2> threadArray =
107 for (
auto it = threadArray.begin(); it != threadArray.end(); it++)
112 virtual auto createChild(shared_ptr<XML>) -> ExternalSystem*
override 121 virtual void replyData(shared_ptr<Invoke> invoke)
override 123 if (invoke->getListener() ==
"optimize")
124 optimize(invoke->at(0)->getValueAsXML());
125 else if (invoke->getListener() ==
"replyOptimization")
126 replyOptimization(invoke->at(0)->getValueAsXML());
130 virtual void addClient(Socket *socket)
override 132 cout <<
"A client has connected." << endl;
134 super::addClient(socket);
149 cout <<
"----------------------------------------------------------------------------" << endl;
150 cout <<
" OPTIMIZE" << endl;
151 cout <<
"----------------------------------------------------------------------------" << endl;
165 virtual void replyOptimization(shared_ptr<XML> xml) = 0;
A slave system's driver for optimization.
A master of parallel system solving something.
mutex mtx
A mutex for optimization.
size_t optimized
Number of slaves who'd completed an optimization.
A boundary class interacting with a Chief system.
unique_ptr< ChiefDriver > chiefDriver
A boundary object interacting with a Cheif.
Master(int port)
Construct from a port number to listen.
virtual void optimize(shared_ptr< XML > xml)
Optimize something.