2 #include <samchon/API.hpp> 4 #include <samchon/templates/external/ExternalSystem.hpp> 5 #include <samchon/protocol/IListener.hpp> 7 #include <samchon/templates/parallel/base/ParallelSystemArrayBase.hpp> 10 #include <samchon/HashMap.hpp> 11 #include <samchon/templates/parallel/PRInvokeHistory.hpp> 68 double performance_{ 1.0 };
69 bool enforced_{
false };
70 bool excluded_{
false };
96 for (
auto it = progress_list_.begin(); it != progress_list_.end(); it++)
99 std::shared_ptr<protocol::Invoke> invoke = it->second.first;
100 std::shared_ptr<slave::InvokeHistory> history = it->second.second;
103 _Send_back_history(invoke, history);
107 virtual void construct(std::shared_ptr<library::XML> xml)
override 111 performance_ = xml->getProperty<
double>(
"performance");
112 enforced_ = xml->getProperty<
bool>(
"enforced");
213 virtual void _Reply_data(std::shared_ptr<protocol::Invoke> invoke)
override 215 if (invoke->getListener() ==
"_Report_history")
216 _Report_history(invoke->front()->getValueAsXML());
217 else if (invoke->getListener() ==
"_Send_back_history")
219 size_t uid = invoke->front()->getValue<
size_t>();
220 auto it = progress_list_.find(uid);
222 if (it != progress_list_.end())
223 _Send_back_history(it->second.first, it->second.second);
229 virtual void _Report_history(std::shared_ptr<library::XML> xml)
237 history->construct(xml);
240 auto progress_it = progress_list_.find(history->getUID());
241 if (progress_it == progress_list_.end())
245 history->first_ = std::dynamic_pointer_cast<
PRInvokeHistory>(progress_it->second.second)->getFirst();
246 history->last_ = std::dynamic_pointer_cast<PRInvokeHistory>(progress_it->second.second)->getLast();
249 progress_list_.erase(progress_it);
250 history_list_.insert({ history->getUID(), history });
253 ((base::ParallelSystemArrayBase*)system_array_)->_Complete_history(history);
256 virtual void _Send_back_history(std::shared_ptr<protocol::Invoke> invoke, std::shared_ptr<slave::InvokeHistory> $history)
258 std::shared_ptr<PRInvokeHistory> history = std::dynamic_pointer_cast<
PRInvokeHistory>($history);
259 if (history ==
nullptr)
263 for (
size_t i = invoke->size(); i < invoke->size(); i--)
265 const std::string &
name = invoke->at(i)->getName();
267 if (name ==
"_History_uid" || name ==
"_Piece_first" || name ==
"_Piece_last")
268 invoke->erase(invoke->begin() + i);
274 &base::ParallelSystemArrayBase::sendPieceData, (base::ParallelSystemArrayBase*)system_array_,
275 invoke, history->getFirst(), history->getLast()
279 progress_list_.erase(history->getUID());
286 virtual auto toXML() const ->
std::shared_ptr<library::XML>
override 289 xml->setProperty(
"performance", performance_);
290 xml->setProperty(
"enforced", enforced_);
304 auto _Is_enforced()
const ->
bool 308 auto _Is_excluded()
const ->
bool
virtual void construct(std::shared_ptr< library::XML > xml) override
Construct data of the Entity from an XML object.
virtual void construct(std::shared_ptr< library::XML > xml) override
Construct data of the Entity from an XML object.
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the EntityGroup.
An Entity and a container of children Entity objects.
void setPerformance(double val)
virtual void replyData(std::shared_ptr< protocol::Invoke > invoke) override
virtual ~ParallelSystem()
void enforcePerformance(double val)
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the EntityGroup.
Customized std::unordered_map.
auto getPerformance() const -> double