Blame view

src/ParamOutputImpl/Plot/PlotNode.cc 2.26 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * 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());
8d19d171   Benjamin Renard   Fix bug with rela...
22
	getChildList()["filePrefix"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FilePrefixNode());
fbe3c2bb   Benjamin Renard   First commit
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	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);
8499fbdd   Benjamin Renard   Context file gene...
42
43
44
45
46
47
48
49
50
51

	xmlChar* value;

	// -- writeContextFile
	if ((value = xmlGetProp(pNode, (const xmlChar *) "writeContextFile")))
	{
		plotOutput->setWriteContextFile(strcmp ((const char *) value, "true") == 0);
		xmlFree(value);
	}

fbe3c2bb   Benjamin Renard   First commit
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	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);
	}

8d19d171   Benjamin Renard   Fix bug with rela...
69
70
71
72
73
74
75
76
77
78
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);
}

fbe3c2bb   Benjamin Renard   First commit
79
} /* namespace plot */