2 #include <samchon/templates/slave/SlaveClient.hpp> 4 #include <samchon/templates/slave/PInvoke.hpp> 5 #include <samchon/examples/interaction/base/MasterBase.hpp> 6 #include <samchon/examples/interaction/TSPRequest.hpp> 7 #include <samchon/examples/interaction/PackerRequest.hpp> 16 :
public templates::slave::SlaveClient
19 typedef templates::slave::SlaveClient super;
21 base::MasterBase *master;
28 ChiefDriver(base::MasterBase *master)
31 this->master = master;
34 virtual ~ChiefDriver() =
default;
39 virtual void sendData(std::shared_ptr<protocol::Invoke> invoke)
override 41 super::sendData(invoke);
44 master->getMonitor()->reportSendData(uid, invoke);
46 virtual void replyData(std::shared_ptr<protocol::Invoke> invoke)
override 48 if (invoke->getListener() ==
"set_chief_uid")
49 uid = invoke->front()->getValue<
int>();
52 auto pInvoke = std::dynamic_pointer_cast<templates::slave::PInvoke>(invoke);
53 if (pInvoke !=
nullptr)
56 ((base::MasterBase*)master)->_Get_p_invoke_queue().push(pInvoke);
59 if (invoke->getListener() ==
"optimizeTSP")
60 master->getTSP()->optimize(invoke->front()->getValueAsXML());
61 else if (invoke->getListener() ==
"optimizePacker")
62 master->getPacker()->optimize(invoke->front()->getValueAsXML());
virtual void replyData(std::shared_ptr< Invoke >)=0
virtual void sendData(std::shared_ptr< Invoke >)=0