HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ScheduleStrategySingle.cpp
Go to the documentation of this file.
2 
3 namespace HCE{
4 namespace reduce{
5 namespace core{
6 
8 
10 
11 void ScheduleStrategySingle::executeJob(const Poco::SharedPtr<ReduceJobIf> &reduceJob)
12 {
13  executeReduceTask(reduceJob);
14  fillResult(reduceJob);
15 }
16 
17 void ScheduleStrategySingle::executeReduceTask(const Poco::SharedPtr<ReduceJobIf> &reduceJob)
18 {
19  Poco::SharedPtr<IterableIf> dataStorageIter = reduceJob->getDataStorage();
20  Poco::SharedPtr<ReduceTaskIf>reduceTask = reduceJob->getReduceTask();
21 
22  std::string key = "";
23  std::string value = "";
24  dataStorageIter->reset();
25  while (dataStorageIter->hasNext()){
26  dataStorageIter->getNext(key, value);
27  reduceTask->addKeyValue(key, value);
28  }
29 }
30 
31 void ScheduleStrategySingle::fillResult(const Poco::SharedPtr<ReduceJobIf> &reduceJob)
32 {
33  Poco::SharedPtr<ReduceResultIf>reduceResult = reduceJob->getReduceResult();
34  Poco::SharedPtr<ReduceTaskIf>reduceTask = reduceJob->getReduceTask();
35  reduceTask->fillReduceResult(reduceResult);
36 }
37 
38 }
39 }
40 }