Blame view

src/ParamOutputImpl/Plot/ParamPlot/ParamPlotParser.cc 1.55 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
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
/*
 * ParamPlotParser.cc
 *
 *  Created on: Oct 6, 2014
 *      Author: m.mazel
 */

#include "NodeCfg.hh"
#include "AMDA_exception.hh"
#include "ParamPlotParser.hh"
#include "ParamParamPlotNode.hh"

using namespace AMDA::XMLConfigurator;

namespace plot {

///////////////////////////////////////////////////////////////////////////////

class ParamOutputNode : public NodeGrpCfg {
public:

	ParamOutputNode () : NodeGrpCfg() {
		getChildList()["plot"] = NodeCfgSPtr(new ParamParamPlotNode);
	}

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) {
		LOG4CXX_INFO(gLogger, "ParamOutputNode::proceed");

		// Proceed nodes
		NodeGrpCfg::proceed(pNode, pContext);
	}
};

///////////////////////////////////////////////////////////////////////////////

ParamPlotParser::ParamPlotParser (const char* pXSDFile) : XMLConfigurator(pXSDFile,true)
{
	// read ParamInfo node
	NodeGrpCfg* lRequestNode = new NodeGrpCfg();
	getXmlConfiguratorMap()["param"] = RootNodeCfgSPtr(lRequestNode);
	lRequestNode->getChildList()["output"] = NodeCfgSPtr(new ParamOutputNode);
}

///////////////////////////////////////////////////////////////////////////////

void ParamPlotParser::parse (const std::string& paramFile, const AMDA::Parameters::CfgContext& pContext) {
	LOG4CXX_INFO(gLogger, "ParamPlotParser::parse parsing " << paramFile);

	// Check schema validity and parse xml file
	try {
		XMLConfigurator::proceed(paramFile.c_str(), pContext);
	}
	catch (...) {
		LOG4CXX_INFO(gLogger, "ParamPlotParser::parse error while parsing file " << paramFile);
	}
}

} /* namespace plot */