Samchon Framework for CPP  1.0.0
SlaveSystem.cpp
1 #include <samchon/protocol/slave/SlaveSystem.hpp>
2 
3 #include <samchon/protocol/Invoke.hpp>
4 #include <samchon/protocol/InvokeHistory.hpp>
5 #include <thread>
6 
7 using namespace std;
8 using namespace samchon::library;
9 using namespace samchon::protocol;
10 using namespace samchon::protocol::slave;
11 
12 SlaveSystem::SlaveSystem()
13  : super()
14 {
15 }
16 void SlaveSystem::_replyData(shared_ptr<Invoke> invoke)
17 {
18  if (invoke->has("invoke_history_uid") == true)
19  {
20  thread
21  (
22  [this, invoke]
23  {
24  InvokeHistory history(invoke);
25 
26  replyData(invoke);
27 
28  history.notifyEnd();
29  sendData(history.toInvoke());
30  }
31  ).detach();
32  }
33  else
34  replyData(invoke);
35 }
Package of external system, within the framework of slave.
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
A history of an Invoke message.
virtual void sendData(std::shared_ptr< Invoke >)
Sends message to a related system.
Definition: IClient.cpp:309
virtual void replyData(std::shared_ptr< Invoke >) override
Handling replied message from an external system.
An Entity and a container of children Entity objects.
Definition: EntityGroup.hpp:52
Package of network protocol and libraries.
Definition: protocol.hpp:185
virtual void notifyEnd()
Notify end of the process.
auto toInvoke() const -> std::shared_ptr< Invoke >
Get an Invoke message.
virtual void _replyData(std::shared_ptr< Invoke >) override
Pre-processor for reporting elapsed time.
Definition: SlaveSystem.cpp:16