DataMiningNode.cc
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* DataMiningNode.cc
*
* Created on: 23 août 2013
* Author: CS
*/
#include <string.h>
// Common module includes
#include "OutputFormatTime.hh"
// Parameters module includes
#include "ServicesServer.hh"
#include "Parameter.hh"
#include "FileConfigurator.hh"
#include "ParameterManager.hh"
// XMLConfigurator module includes
#include "Constant.hh"
// DataMining module includes
#include "Config.hh"
#include "ParamNode.hh"
#include "DataMiningNode.hh"
#include "ParamOutputDataMining.hh"
#include "DataMiningType.hh"
#include "PostProcessingNode.hh"
using namespace AMDA::Parameters;
using namespace AMDA::XMLConfigurator;
namespace AMDA {
namespace ParamOutputImpl {
namespace DataMining {
DataMiningNode::DataMiningNode(ParamOutputDataMining::PRIORITY pTaskPriority) : NodeGrpCfg(), _outputPriority(pTaskPriority) {
/*
<dataMining>
<timeFormat/>
<fileFormat/>
<outputStructure/>
<param id='imf'/>
</dataMining>
*/
// Assign a class node on each parameter of Data Mining output to retrieve value.
getChildList()["timeFormat"] = NodeCfgSPtr(new TimeFormatNode<ParamOutputDataMining>());
getChildList()["fileFormat"] = NodeCfgSPtr(new FileFormatNode<ParamOutputDataMining>());
getChildList()["outputStructure"] = NodeCfgSPtr(new OutputStructureNode<ParamOutputDataMining>());
getChildList()["fileName"] = NodeCfgSPtr(new FileNameNode<ParamOutputDataMining>());
getChildList()["param"] = NodeCfgSPtr(new ParamNode<ParamOutputDataMining>());
getChildList()["postProcess"] = NodeCfgSPtr(new postprocessing::PostProcessingNode<ParamOutputDataMining>());
}
void DataMiningNode::proceed(xmlNodePtr pNode,
const AMDA::Parameters::CfgContext& pContext) {
// Get manager of the new output parameter for this node
ParameterManager* lParameterManager = pContext.get<ParameterManager*>();
CfgContext lContext;
// Create DataMining instance
boost::shared_ptr<ParamOutputDataMining> lParamOutputDataMining(new ParamOutputDataMining(*lParameterManager));
// Set priority
lParamOutputDataMining->setOutputPriority(_outputPriority);
// Push data mining in the context
lContext.push<ParamOutputDataMining*>(lParamOutputDataMining.get());
// Go to next node
NodeGrpCfg::proceed(pNode, lContext);
// Set param output in parameter manager list to be executed
lParameterManager->getParamOutputList().push_back(lParamOutputDataMining);
// When Data Mining output is set in param tag, param id can be retrived automatically.
// So it's not necessary to set param tag in Data Mining output to identify param id.
if (_outputPriority == ParamOutputDataMining::PRIORITY::PARAM) {
xmlChar* paramName = NULL;
paramName = xmlGetProp(pNode->parent->parent, (const xmlChar *) "id");
lParamOutputDataMining->setParamName(reinterpret_cast<const char*>(paramName));
xmlFree(paramName);
}
}
} // namespace Download
} // namespace ParamOutputImpl
} // namespace AMDA