HistoPlotNode.hh 2.05 KB
/*
 * HistoPlotNode.hh
 *
 *  Created on: Dec 6, 2013
 *      Author: amdadev
 */

#ifndef HISTOPLOTNODE_HH_
#define HISTOPLOTNODE_HH_

#include <boost/smart_ptr/shared_ptr.hpp>
#include <libxml/tree.h>

#include "AbstractPanelPlotNode.hh"
#include "PanelPlotOutput.hh"
#include "PlotOutput.hh"
#include "Panel.hh"
#include "ParamsNode.hh"
#include "SeriesNode.hh"
#include "HistogramSeriesNode.hh"

namespace plot {
/**
 * xml node name, this name is used in both config and request xml files.
 */
#define HISTOPLOT_NODENAME "histoPlot"
#define HISTOGRAM1D "histogram1d"
#define HISTOGRAM2D "histogram2d"
/**
 * Reads Histoplot node.
 */
class HistoPlotNode: public plot::AbstractPanelPlotNode {
public:
	HistoPlotNode();
	virtual ~HistoPlotNode();
protected:
	boost::shared_ptr<PanelPlotOutput> proceed(xmlNodePtr, PlotOutput*, Panel*);
private:
	/**
	 * constant to uniquely identify this node in the registry
	 */
	static const std::string NODENAME;
	/**
	 * artificial special attribute to force registering node.
	 */
	static std::string _key;
};

/**
 * Reads histoplot/params/param node.
 */
template<class PlotType>
class HistoPlotParamNode: public ParamNode<PlotType> {
public:
	HistoPlotParamNode() :
			ParamNode<PlotType>() {
		ParamNode<PlotType>::getChildList()["xserie"] =
				AMDA::XMLConfigurator::NodeCfgSPtr(new XSeriesNode<PlotType>());
		ParamNode<PlotType>::getChildList()["histogram1d"] =
				AMDA::XMLConfigurator::NodeCfgSPtr(new HistogramSeriesNode<PlotType>(HISTOGRAM1D));
		ParamNode<PlotType>::getChildList()["histogram2d"] =
				AMDA::XMLConfigurator::NodeCfgSPtr(new HistogramSeriesNode<PlotType>(HISTOGRAM2D));
	}

	virtual ~HistoPlotParamNode() {
	}
};

/**
 * Reads histoplot/params node.
 */
template<class PlotType>
class HistoPlotParamsNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	HistoPlotParamsNode() :
			AMDA::XMLConfigurator::NodeGrpCfg() {
		getChildList()["param"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new HistoPlotParamNode<PlotType>());
	}

	virtual ~HistoPlotParamsNode() {
	}
};

} /* namespace plot */

#endif /* HISTOPLOTNODE_HH_ */