/* * ManualCalibrationNode.cc * * Created on: Jun 15, 2015 * Author: AKKA */ #include "Parameter.hh" #include "ManualCalibrationNode.hh" #include #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(); 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(); 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(pInfoValues.get()); NodeGrpCfg::proceed(pNode, lContext); } catch (...) { if (lClbName) { xmlFree(lClbName); } throw; } if (lClbName) { xmlFree(lClbName); } } } /* namespace XMLParameterConfigurator */ } /* namespace AMDA */