BinsNode.cc
1.83 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
/*
* Bins1DNode.cc
*
* Created on: Jan 27, 2023
* Author: AKKODIS
*/
#include <libxml/tree.h>
#include <iosfwd>
#include "BinsNode.hh"
namespace plot {
void ManualNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
LOG4CXX_DEBUG(gLogger, "ManualNode::proceed");
HistogramSeriesProperties* props = pContext_.get<HistogramSeriesProperties*>();
// read attributes :
xmlChar* value = NULL;
// overwrites default values if any...
// xbinnumber
value = xmlGetProp(pNode_, (const xmlChar *)"xbinnumber");
if( value ){
props->getManualProperties().setXBinNumber(std::stoul((const char*)value));
xmlFree(value);
}
// -- stairs
value = xmlGetProp(pNode_, (const xmlChar *) "stairs");
if (value) {
std::string strValue((const char*) value);
std::transform(strValue.begin(), strValue.end(), strValue.begin(),
::tolower);
std::istringstream is(strValue);
bool stairs;
is >> std::boolalpha >> stairs;
props->getManualProperties().setStairs(stairs);
xmlFree(value);
}
else{
props->getManualProperties().setStairs(false);
}
// ybinnumber
if(_histogramType == "histogram2d"){
value = xmlGetProp(pNode_, (const xmlChar *)"ybinnumber");
if( value ){
props->getManualProperties().setYBinNumber(std::stoul((const char*)value));
xmlFree(value);
}
}
}
void BinsNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
LOG4CXX_DEBUG(gLogger, "BinsNode::proceed");
HistogramSeriesProperties* props = pContext_.get<HistogramSeriesProperties*>();
xmlChar* name = pContext_.get<xmlChar*>();
//parse children nodes
AMDA::Parameters::CfgContext context;
context.push<xmlChar*>(name);
context.push<HistogramSeriesProperties*>(props);
AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context);
}
} /* namespace plot */