Samchon Framework for CPP  1.0.0
DistributedSystemRole.cpp
1 #include <samchon/protocol/master/DistributedSystemRole.hpp>
2 
3 #include <samchon/protocol/master/DistributedSystemArray.hpp>
4 #include <samchon/protocol/master/DistributedSystem.hpp>
5 
6 #include <samchon/library/XML.hpp>
7 #include <samchon/protocol/Invoke.hpp>
8 #include <samchon/protocol/master/DSInvokeHistoryArray.hpp>
9 #include <samchon/protocol/master/DSInvokeHistory.hpp>
10 
11 using namespace std;
12 using namespace samchon;
13 using namespace samchon::library;
14 using namespace samchon::protocol;
15 using namespace samchon::protocol::master;
16 
17 /* ------------------------------------------------------------------
18  CONSTRUCTORS
19 ------------------------------------------------------------------ */
20 DistributedSystemRole::DistributedSystemRole()
21  : super(nullptr)
22 {
24 }
25 DistributedSystemRole::~DistributedSystemRole()
26 {
27  delete invokeHistoryArray;
28 }
29 
30 void DistributedSystemRole::construct(shared_ptr<XML> xml)
31 {
32  super::construct(xml);
33 
34  performance = xml->getProperty<double>("performance");
35 }
36 
37 /* ------------------------------------------------------------------
38  GETTERS
39 ------------------------------------------------------------------ */
40 auto DistributedSystemRole::getAllocationHistoryList() const -> DSRoleHistoryList*
41 {
42  return allocationHistoryList;
43 }
45 {
46  return invokeHistoryArray;
47 }
48 
50 {
51  return performance;
52 }
53 
54 /* ------------------------------------------------------------------
55  CHAIN OF INVOKE MESSAGE
56 ------------------------------------------------------------------ */
57 void DistributedSystemRole::sendData(shared_ptr<Invoke> invoke)
58 {
59  // NOT DEFINED YET
60  // WILL SHIFT THE SENDING RESPONSIBILITY TO IDLE SYSTEM
61 }
62 
63 /* ------------------------------------------------------------------
64  EXPORTERS
65 ------------------------------------------------------------------ */
66 auto DistributedSystemRole::toXML() const -> shared_ptr<XML>
67 {
68  shared_ptr<XML> &xml = super::toXML();
69  xml->setProperty("performance", performance);
70 
71  if (invokeHistoryArray->empty() == false)
72  xml->push_back(invokeHistoryArray->toXML());
73 
74  return xml;
75 }
DSInvokeHistoryArray * invokeHistoryArray
A history log for archiving elapsed time for each process.
An entity, a standard data class.
Definition: Entity.hpp:48
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
Package for external system, within the framework of master.
Definition: RWMutex.hpp:4
auto getInvokeHistoryArray() const -> DSInvokeHistoryArray *
Get invoke histories.
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
Package of libraries.
Definition: library.hpp:84
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the EntityGroup.
Package of network protocol and libraries.
Definition: protocol.hpp:185
virtual void sendData(std::shared_ptr< Invoke >) override
Send a message.
auto getAllocationHistoryList() const -> DSRoleHistoryList *
Get allocation histories.
auto getPerformance() const -> double
Get performance.
XML is a class representing xml object.
Definition: XML.hpp:72
double performance
A required performance index.
DSRoleHistoryList * allocationHistoryList
A history log for archiving role allocation to a system.
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7