ParamPlotNode.cc 1.1 KB
/*
 * ParamPlotNode.cc
 *
 *  Created on: Nov 14, 2014
 *      Author: m.mazel
 */

#include "ParamPlotNode.hh"
#include "ParamPlotParser.hh"
#include "PlotLogger.hh"
// #include "Helper.hh"
#include "Properties.hh"

namespace plot {

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

	xmlChar* value = NULL;
	// -- paramId for the parameter containing plot definition
	value = xmlGetProp(pNode, (const xmlChar *) "id");
	if (value) {
		std::string id = std::string ((const char*) value);
		xmlFree(value);

		// Retrieve application properties
		AMDA::helpers::Properties lProperties("app.properties");

		// Build a param file parser for the parameter (<plot> element) node
		ParamPlotParser parser(lProperties["app.parameter.xsd"].c_str());

		// Build xml filename associated with the parameter
		std::string xmlFileName = lProperties["app.param.path"] + "/" + id + ".xml";

		// Parse parameter xml file (<plot> element section) and build the associated plot
		parser.parse (xmlFileName, pContext);
	}
}

} /* namespace plot */