InstantPlotNode.hh 1.88 KB
/*
 * InstantPlotNode.hh
 *
 *  Created on: Dec 6, 2013
 *      Author: amdadev
 */

#ifndef INSTANTPLOTNODE_HH_
#define INSTANTPLOTNODE_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 "InstantSeriesNode.hh"
#include "InstantSpectroNode.hh"

namespace plot {
/**
 * xml node name, this name is used in both config and request xml files.
 */
#define INSTANTPLOT_NODENAME "instantPlot"

/**
 * Reads instantplot node.
 */
class InstantPlotNode: public plot::AbstractPanelPlotNode {
public:
	InstantPlotNode();
	virtual ~InstantPlotNode();
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 instantplot/params/param node.
 */
template<class PlotType>
class InstantPlotParamNode: public ParamNode<PlotType> {
public:
	InstantPlotParamNode() : ParamNode<PlotType>() {
		ParamNode<PlotType>::getChildList()["iserie"] =
				AMDA::XMLConfigurator::NodeCfgSPtr(new InstantSeriesNode<PlotType>());
		ParamNode<PlotType>::getChildList()["ispectro"] =
				AMDA::XMLConfigurator::NodeCfgSPtr(new InstantSpectroNode<PlotType>());
	}

	virtual ~InstantPlotParamNode() {
	}
};

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

	virtual ~InstantPlotParamsNode() {
	}
};

} /* namespace plot */

#endif /* INSTANTPLOTNODE_HH_ */