Blame view

src/ParamOutputImpl/Plot/PlotConfigurationLoader.hh 4.1 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
 * 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_ */