PlotConfigurationLoader.hh 4.1 KB
/*
 * PlotConfigurationLoader.hh
 *
 *  Created on: 8 nov. 2013
 *      Author: guillaume
 */

#ifndef PLOTCONFIGURATIONLOADER_HH_
#define PLOTCONFIGURATIONLOADER_HH_

#include "PlotLogger.hh"
#include "tuple"
#include "map"
#include <libxml/xmlreader.h>
#include "NodeCfg.hh"
#include "AxesNode.hh"
#include "TimeAxis.hh"
#include "EpochAxis.hh"
#include "ColorAxis.hh"
#include "DigitalAxis.hh"


namespace plot {

using namespace AMDA::XMLConfigurator;

class DefaultPlotConfiguration;
class ColormapManager;

class PlotConfigurationLoader {

	typedef std::tuple<std::string , NodeCfgSPtr> NodeLoader;
	typedef std::map<std::string, NodeLoader> NodeMapLoader;

	public:
		PlotConfigurationLoader();

		virtual ~PlotConfigurationLoader();

		template <typename T>
		void load(T* pObject) {
			AMDA::Parameters::CfgContext ctx;

			// GetLoader.
			_nodeLoader = _nodeMapLoader[typeid(T).name()];

			// Push object to load
			ctx.push<T*>(pObject);

			initParser(ctx);
		}

	private:
		void initParser(const AMDA::Parameters::CfgContext&);

		NodeMapLoader _nodeMapLoader;

		NodeLoader _nodeLoader;


};

class EmptyNode: public NodeGrpCfg {
public:
	EmptyNode() { }
	virtual ~EmptyNode() { }

	void proceed(xmlNodePtr, const AMDA::Parameters::CfgContext&) { }
};

class RootNode: public NodeGrpCfg {
	typedef std::tuple<std::string , NodeCfgSPtr> NodeLoader;

	public:
		RootNode(const NodeLoader& pNodeLoader);
		virtual ~RootNode();

		void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultNode: public NodeGrpCfg {
public:
	DefaultNode();
	virtual ~DefaultNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultPageNode: public NodeGrpCfg {
public:
	DefaultPageNode();
	virtual ~DefaultPageNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultPanelNode: public NodeGrpCfg {
public:
	DefaultPanelNode();
	virtual ~DefaultPanelNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultDigitalAxisNode: public AnyAxisNode<DigitalAxis> {
public:
	DefaultDigitalAxisNode() :
			AnyAxisNode<DigitalAxis>() {
	}
	virtual ~DefaultDigitalAxisNode() {
	}

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultTimeAxisNode: public AnyAxisNode<TimeAxis> {
public:
	DefaultTimeAxisNode() :
			AnyAxisNode<TimeAxis>() {
	}
	virtual ~DefaultTimeAxisNode() {
	}

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultEpochAxisNode: public AnyAxisNode<EpochAxis> {
public:
	DefaultEpochAxisNode() :
			AnyAxisNode<EpochAxis>() {
	}
	virtual ~DefaultEpochAxisNode() {
	}

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class DefaultColorAxisNode: public AnyAxisNode<ColorAxis> {
public:
	DefaultColorAxisNode() :
			AnyAxisNode<ColorAxis>() {
	}
	virtual ~DefaultColorAxisNode() {
	}

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class ColormapNode: public NodeGrpCfg {
public:
	ColormapNode();
	virtual ~ColormapNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class GrayscaleNode: public NodeGrpCfg {
public:
	GrayscaleNode();
	virtual ~GrayscaleNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class ColorscaleNode: public NodeGrpCfg {
public:
	ColorscaleNode();
	virtual ~ColorscaleNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class ColormapAxisNode: public NodeGrpCfg {
public:
	ColormapAxisNode();
	virtual ~ColormapAxisNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

class ColorFileNode: public NodeGrpCfg {
public:
	ColorFileNode();
	virtual ~ColorFileNode();

	void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx);
};

//class DefaultPlotConfigsNode: public NodeGrpCfg{
//public:
//	DefaultPlotConfigsNode();
//	virtual ~DefaultPlotConfigsNode();
//
//	void proceed(xmlNodePtr pNode_, const AMDA::Parameters::CfgContext& context_);
//};


} /* namespace plot */
#endif /* PLOTCONFIGURATIONLOADER_HH_ */