PlotNode.cc 1.67 KB
/*
 * 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()["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);
	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);
	}

} /* namespace plot */