ParamsNode.hh
2.29 KB
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
/*
* ParamsNode.hh
*
* Created on: 21 nov. 2013
* Author: CS
*/
#ifndef PARAMSNODE_HH_
#define PARAMSNODE_HH_
#include "NodeCfg.hh"
#include "PlotLogger.hh"
#include "CommonNode.hh"
#include "DefaultPlotConfiguration.hh"
#include "PanelPlotOutput.hh"
#include "DrawingPropertiesNode.hh"
#include "SeriesNode.hh"
#include "SpectroNode.hh"
#include "IntervalsNode.hh"
namespace plot {
template<class PlotType>
class ParamNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
ParamNode() :
AMDA::XMLConfigurator::NodeGrpCfg() {
getChildList()["default"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new DrawingPropertiesNode<PlotType>());
getChildList()["serie"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new SeriesNode<PlotType>());
getChildList()["spectro"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new SpectroNode<PlotType>());
getChildList()["intervals"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new IntervalsNode<PlotType>());
getChildList()["colorserie"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new ColorSeriesNode<PlotType>());
}
virtual ~ParamNode() {
}
void proceed(xmlNodePtr pNode,
const AMDA::Parameters::CfgContext& pContext) {
LOG4CXX_DEBUG(gLogger, "ParamNode::proceed");
PlotType* plotOutput = pContext.get<PlotType*>();
xmlChar* name = NULL;
// -- param id
name = xmlGetProp(pNode, (const xmlChar *) "id");
if (name) {
plotOutput->addParam((const char*) name);
}
// initialize drawing default properties object:
DrawingProperties props;
// take default value during init...
DefaultPlotConfiguration::getInstance().applyDefaultDrawingProperties(
plotOutput->typeName(),
props
);
// add default properties to parameter
plotOutput->getParameter((const char*)name).setDefaultProperties( props );
AMDA::Parameters::CfgContext context;
context.push<xmlChar*>(name);
context.push<PlotType*>(plotOutput);
AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, context);
if (name) {
xmlFree (name);
}
}
};
template<class PlotType>
class ParamsNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
ParamsNode() :
AMDA::XMLConfigurator::NodeGrpCfg() {
getChildList()["param"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new ParamNode<PlotType>());
}
virtual ~ParamsNode() {
}
};
} /* namespace plot */
#endif /* PARAMSNODE_HH_ */