PlotNode.cc
2.26 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
/*
* PlotNode.cc
*
* Created on: 29 oct. 2013
* Author: CS
*/
#include "PlotNode.hh"
#include "PostProcessingNode.hh"
#include "ParameterManager.hh"
#include "PlotOutput.hh"
#include "PageNode.hh"
#include "PlotLogger.hh"
#include "DefaultPlotConfiguration.hh"
#include "CommonNode.hh"
namespace plot {
PlotNode::PlotNode() :
NodeGrpCfg() {
getChildList()["outputStructure"] = AMDA::XMLConfigurator::NodeCfgSPtr(new OutputStructureNode());
getChildList()["filePrefix"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FilePrefixNode());
getChildList()["page"] = AMDA::XMLConfigurator::NodeCfgSPtr(new PageNode());
getChildList()["postProcess"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new postprocessing::PostProcessingNode<PlotOutput>());
}
PlotNode::~PlotNode() {
}
void PlotNode::proceed(xmlNodePtr pNode,
const AMDA::Parameters::CfgContext& pContext) {
AMDA::Parameters::ParameterManager* lParameterManager = pContext.get<
AMDA::Parameters::ParameterManager*>();
// create plot output and add it to the context and to
// the output manager
AMDA::Parameters::CfgContext lContext;
PlotOutput* plotOutput = new PlotOutput(*lParameterManager);
xmlChar* value;
// -- writeContextFile
if ((value = xmlGetProp(pNode, (const xmlChar *) "writeContextFile")))
{
plotOutput->setWriteContextFile(strcmp ((const char *) value, "true") == 0);
xmlFree(value);
}
lContext.push<PlotOutput*>(plotOutput);
lContext.push<AMDA::Parameters::ParameterManager*>(lParameterManager);
AMDA::Parameters::ParamOutputSPtr lParamOutput(plotOutput);
AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, lContext);
lParameterManager->getParamOutputList().push_back(lParamOutput);
}
void OutputStructureNode::proceed(xmlNodePtr pNode,
const AMDA::Parameters::CfgContext& pContext) {
LOG4CXX_DEBUG(gLogger, "OutputStructureNode::proceed")
PlotOutput* lPlotOutput =
pContext.get<PlotOutput*>();
lPlotOutput->setOutputStructure(
(const char*) pNode->children->content);
}
void FilePrefixNode::proceed(xmlNodePtr pNode,
const AMDA::Parameters::CfgContext& pContext) {
LOG4CXX_DEBUG(gLogger, "FilePrefixNode::proceed")
PlotOutput* lPlotOutput =
pContext.get<PlotOutput*>();
lPlotOutput->setFilePrefix(
(const char*) pNode->children->content);
}
} /* namespace plot */