/** * StatusDefNode.cc * * Created on: 13 jan. 2015 * Author: AKKA */ #include #include #include #include "StatusDefNode.hh" #include "Config.hh" #include "Parameter.hh" #include "ParamInfo.hh" #include "Constant.hh" using namespace log4cxx; using namespace AMDA::Parameters; using namespace AMDA::XMLConfigurator; namespace AMDA { namespace Info { class StatusInfoNode: public AMDA::XMLConfigurator::NodeCfg { public: void proceed( xmlNodePtr pNode, const AMDA::Parameters::CfgContext& context) { LOG4CXX_DEBUG(gLogger, "StatusInfoNode::proceed"); ParamInfo* pParamInfo = context.get(); //Get min value xmlChar* value = xmlGetProp(pNode, (const xmlChar *) "minVal"); double minVal = 0.0; if (value != NULL) { minVal = std::atof((const char*)value); xmlFree(value); } //Get max value value = xmlGetProp(pNode, (const xmlChar *) "maxVal"); double maxVal = 0.0; if (value != NULL) { maxVal = std::atof((const char*)value); xmlFree(value); } else maxVal = minVal; //Get name value = xmlGetProp(pNode, (const xmlChar *) "name"); std::string name = ""; if (value != NULL) { name = std::string((const char*)value); xmlFree(value); } //Get color value = xmlGetProp(pNode, (const xmlChar *) "color"); std::string color = ""; if (value != NULL) { color = std::string((const char*)value); xmlFree(value); } pParamInfo->addStatus(minVal,maxVal,name, color); } }; StatusDefNode::StatusDefNode() : AMDA::XMLConfigurator::NodeGrpCfg() { getChildList()["status"]=NodeCfgSPtr(new StatusInfoNode); } StatusDefNode::~StatusDefNode() { } void StatusDefNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "StatusDefNode::proceed"); AMDA::Parameters::CfgContext lContext(pContext); ParamInfo* pParamInfo = pContext.get(); lContext.push(pParamInfo); NodeGrpCfg::proceed(pNode, lContext); } }/* namespace Info */ } /* namespace AMDA */