BinsNode.cc 1.35 KB
/*
 * BinsNode.cc
 *
 *  Created on: Jan 27, 2023
 *      Author: AKKODIS
 */

#include <libxml/tree.h>
#include <iosfwd>
#include "BinsNode.hh"


namespace plot {


	void ManualNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
		LOG4CXX_DEBUG(gLogger, "ManualNode::proceed");
		Histogram2DSeriesProperties* props = pContext_.get<Histogram2DSeriesProperties*>();
		// read attributes :
		xmlChar* value = NULL;

		// overwrites default values if any...
		// xbinnumber
		value = xmlGetProp(pNode_, (const xmlChar *)"xbinnumber");
		if( value ){
			props->getManualProperties().setXBinNumber(std::stoul((const char*)value));
			xmlFree(value);
		}

		// ybinnumber
		value = xmlGetProp(pNode_, (const xmlChar *)"ybinnumber");
		if( value ){
			props->getManualProperties().setYBinNumber(std::stoul((const char*)value));
			xmlFree(value);
		}
	}

	void BinsNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
		LOG4CXX_DEBUG(gLogger, "BinsNode::proceed");
		Histogram2DSeriesProperties* props = pContext_.get<Histogram2DSeriesProperties*>();
		xmlChar* name = pContext_.get<xmlChar*>();

		//parse children nodes
		AMDA::Parameters::CfgContext context;
		context.push<xmlChar*>(name);
		context.push<Histogram2DSeriesProperties*>(props);
		AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context);
	}

} /* namespace plot */