/* * ParamNode.hh * * Created on: 10 septembre 2013 * Author: CS */ #ifndef PARAMNODE_HH_ #define PARAMNODE_HH_ #include "NodeCfg.hh" #include "ParamNodeConfig.hh" #include "Constant.hh" #include "ParamOutputDataMining.hh" #include "TimeTable.hh" //class ParamOutputDataMining; namespace AMDA { namespace ParamOutputImpl { namespace DataMining { /** * @class TimeFormatNode * @brief read the "timeFormat" node. */ template class TimeFormatNode: public AMDA::XMLConfigurator::NodeCfg { public: void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "TimeFormatNode::proceed") ParamOutputType* lParamOutput = pContext.get(); // Get value on XML node std::string lTimeFormatValue(reinterpret_cast(pNode->children->content)); // Set value in output param lParamOutput->setTimeFormat(lTimeFormatValue); } }; /** * @class FileFormatNode * @brief read the "fileFormat" node. */ template class FileFormatNode: public AMDA::XMLConfigurator::NodeCfg { public: void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "FileFormatNode::proceed") //_fileFormat = (const char*)pNode->children->content; ParamOutputType* lParamOutput = pContext.get(); // Get value on XML node std::string lFileFormatValue(reinterpret_cast(pNode->children->content)); // Set value in output param lParamOutput->setFileFormat(lFileFormatValue); } }; /** * @class OutputStructureNode * @brief read the "outputStructure" node. */ template class OutputStructureNode: public AMDA::XMLConfigurator::NodeCfg { public: void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "OutputStructureNode::proceed") //_outputStructure = (const char*)pNode->children->content; ParamOutputType* lParamOutput = pContext.get(); lParamOutput->setOutputStructure((const char*)pNode->children->content); } }; /** * @class FileNameNode * @brief read the "fileName" node to inform the output filename Time Table. */ template class FileNameNode: public AMDA::XMLConfigurator::NodeCfg { public: void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "FileNameNode::proceed") ParamOutputType* lParamOutput = pContext.get(); // Get value on XML node std::string lFileNameValue(reinterpret_cast(pNode->children->content)); // Set value in output param lParamOutput->setFileName(lFileNameValue); } }; template class ParamNode: public AMDA::XMLConfigurator::NodeGrpCfg { public: ParamNode() : AMDA::XMLConfigurator::NodeGrpCfg() { } void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "ParamNode::proceed") xmlChar* lParamName = NULL; try { if (!(lParamName = xmlGetProp(pNode, (const xmlChar *) "id"))) { ERROR_EXCEPTION( AMDA::XMLConfigurator::ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@" << AMDA::XMLConfigurator::PARAMNAME) } ParamOutputType* lParamOutput = pContext.get(); lParamOutput->setParamName((const char*)lParamName); //_paramName = (const char*)lParamName; } catch (...) { if (lParamName) { xmlFree(lParamName); } throw; } if (lParamName) { xmlFree(lParamName); } NodeGrpCfg::proceed( pNode, pContext); } }; } // DataMining } // ParamOutputImpl } // AMDA #endif /* PARAMNODE_HH_ */