/* * InstantSeriesNode.hh * * Created on: Dec 9, 2013 * Author: amdadev */ #ifndef INSTANTSERIESNODE_HH_ #define INSTANTSERIESNODE_HH_ #include #include #include #include #include "FileConfigurator.hh" #include "DrawingPropertiesNode.hh" #include "PlotLogger.hh" #include "InstantSeriesProperties.hh" namespace plot { template class InstantSeriesNode: public plot::DrawingPropertiesNode { public: InstantSeriesNode() : DrawingPropertiesNode() { } virtual ~InstantSeriesNode() { } void proceed(xmlNodePtr pNode_, const AMDA::Parameters::CfgContext& pContext_) { LOG4CXX_DEBUG(gLogger, "InstantSeriesNode::proceed"); PlotType* plotOutput = pContext_.get(); xmlChar* name = pContext_.get(); // initialize series with default properties DrawingProperties defaultProps = plotOutput->getParameter( (const char*) name).getDefaultProperties(); boost::shared_ptr isp(new InstantSeriesProperties(defaultProps)); plotOutput->setOriginalParamId ((const char *) name); plotOutput->setInstantSerieProperties (isp); // parse attributes... parseAttributes(pNode_, *isp); // parse children nodes AMDA::Parameters::CfgContext context; context.push(name); context.push(isp.get()); context.push(isp.get()); AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context); } protected: void parseAttributes(xmlNodePtr pNode_, DrawingProperties& props_) { // read parent attributes DrawingPropertiesNode::parseAttributes(pNode_, props_); // specific series node attributes : xmlChar * value = NULL; // -- xAxis identifier value = xmlGetProp(pNode_, (const xmlChar *) "xAxis"); if( value ) { ((InstantSeriesProperties&) props_).setXAxisId((const char*)value); xmlFree(value); } // -- yAxis identifier value = xmlGetProp(pNode_, (const xmlChar *) "yAxis"); if( value ) { ((InstantSeriesProperties&) props_).setYAxisId((const char*)value); xmlFree(value); } // -- tableOnXAxis value = xmlGetProp(pNode_, (const xmlChar*) "tableOnXAxis"); if (value) { ((InstantSeriesProperties&) props_).setTableOnXAxis(strcasecmp ((const char*)value, "true") == 0); xmlFree(value); } // -- id value = xmlGetProp(pNode_, (const xmlChar*) "id"); if (value) { ((InstantSeriesProperties&) props_).setId(atoi ((const char*)value)); xmlFree(value); } } }; } /* namespace plot */ #endif /* INSTANTSERIESNODE_HH_ */