Samchon Framework for CPP  1.0.0
PRInvokeHistory.cpp
1 #include <samchon/protocol/master/PRInvokeHistory.hpp>
2 
3 #include <samchon/protocol/master/PRMasterHistory.hpp>
4 #include <samchon/protocol/master/ParallelSystem.hpp>
5 
6 #include <samchon/library/XML.hpp>
7 #include <samchon/protocol/Invoke.hpp>
8 
9 using namespace std;
10 using namespace samchon::library;
11 using namespace samchon::protocol;
12 using namespace samchon::protocol::master;
13 
14 /* --------------------------------------------------------------------
15  CONSTRUCTORS
16 -------------------------------------------------------------------- */
17 PRInvokeHistory::PRInvokeHistory()
18  : super()
19 {
20 }
22  : super(invoke)
23 {
24  this->masterHistory = masterHistory;
25  this->system = system;
26 
27  index = invoke->get("invoke_history_index")->getValue<size_t>();
28  size = invoke->get("invoke_history_size")->getValue<size_t>();
29 }
30 void PRInvokeHistory::construct(shared_ptr<XML> xml)
31 {
32  super::construct(xml);
33 
34  index = xml->getProperty<size_t>("index");
35  size = xml->getProperty<size_t>("size");
36 }
37 
39 {
40  masterHistory->notifyEnd();
41 }
42 
43 /* --------------------------------------------------------------------
44  GETTERS
45 -------------------------------------------------------------------- */
46 auto PRInvokeHistory::getIndex() const -> size_t
47 {
48  return index;
49 }
50 auto PRInvokeHistory::getSize() const -> size_t
51 {
52  return size;
53 }
54 
56 {
57  return calcElapsedTime() / (double)size;
58 }
59 
60 /* --------------------------------------------------------------------
61  EXPORTERS
62 -------------------------------------------------------------------- */
63 auto PRInvokeHistory::toXML() const -> shared_ptr<XML>
64 {
65  shared_ptr<XML> &xml = super::toXML();
66  xml->setProperty("index", index);
67  xml->setProperty("size", size);
68 
69  return xml;
70 }
An entity, a standard data class.
Definition: Entity.hpp:48
A history log of an Invoke message on a master.
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
Package for external system, within the framework of master.
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
PRMasterHistory * masterHistory
A history of master.
A network driver for a parallel system.
auto calcAverageElapsedTime() const -> double
Calculate average of elapsed time for each segmentation.
auto calcElapsedTime() const -> long long
Get elapsed time.
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
ParallelSystem * system
A system the history is belonged to.
Package of network protocol and libraries.
Definition: protocol.hpp:185
virtual void notifyEnd() override
Notify end of the process.
virtual void notifyEnd() override
Notify end of the process.
auto getIndex() const -> size_t
Get index.
auto getSize() const -> size_t
Get size.
XML is a class representing xml object.
Definition: XML.hpp:72
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.