ManualCalibrationNode.cc
2.32 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
/*
* ManualCalibrationNode.cc
*
* Created on: Jun 15, 2015
* Author: AKKA
*/
#include "Parameter.hh"
#include "ManualCalibrationNode.hh"
#include <cstdlib>
#include "Config.hh"
#include "Constant.hh"
#include "AMDA_exception.hh"
using namespace AMDA::Parameters;
namespace AMDA {
namespace XMLParameterConfigurator {
ManualCalibrationValueNode::ManualCalibrationValueNode() : NodeCfg() {
}
ManualCalibrationValueNode::~ManualCalibrationValueNode() {
}
void ManualCalibrationValueNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) {
Parameter::InfoValues* lInfoValue = pContext.get<Parameter::InfoValues*>();
try {
if (pNode->children && pNode->children->content && pNode->children->content[0] != '\0') {
double value = atof((const char*)pNode->children->content);
LOG4CXX_DEBUG(gLogger, "ManualCalibrationValueNode::proceed - " << value);
lInfoValue->push_back(value);
}
} catch (...) {
throw;
}
}
ManualCalibrationNode::ManualCalibrationNode() : NodeGrpCfg() {
LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode Constructor");
getChildList()["value"]=AMDA::XMLConfigurator::NodeCfgSPtr(new ManualCalibrationValueNode);
}
ManualCalibrationNode::~ManualCalibrationNode() {
LOG4CXX_DEBUG(gLogger, "~ManualCalibrationNode");
}
void ManualCalibrationNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) {
LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode::proceed");
xmlChar* lClbName = NULL;
try {
Parameter* lParameter = pContext.get<Parameter*>();
if (!(lClbName = xmlGetProp(pNode, (const xmlChar *) "name"))) {
ERROR_EXCEPTION(AMDA::XMLConfigurator::ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@name")
}
LOG4CXX_DEBUG(gLogger, "ManualCalibrationNode::proceed - create " << (const char*)lClbName << " for " << lParameter->getId());
Parameter::InfoValuesSPtr pInfoValues(new Parameter::InfoValues);
lParameter->setInfoValues( std::string((const char*)lClbName), pInfoValues);
AMDA::Parameters::CfgContext lContext(pContext);
lContext.push<Parameter::InfoValues*>(pInfoValues.get());
NodeGrpCfg::proceed(pNode, lContext);
} catch (...) {
if (lClbName) {
xmlFree(lClbName);
}
throw;
}
if (lClbName) {
xmlFree(lClbName);
}
}
} /* namespace XMLParameterConfigurator */
} /* namespace AMDA */