Blame view

src/ParamOutputImpl/Plot/ResamplingNode.cc 1.39 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * ResamplingNode.cc
 *
 *  Created on: Aug 19, 2014
 *      Author: AKKA
 */


#include "ResamplingNode.hh"

#include <libxml/tree.h>
#include <iosfwd>

#include "NodeCfg.hh"
#include "PlotLogger.hh"
#include "SeriesProperties.hh"
#include "CommonNode.hh"



namespace plot {

void ResamplingNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
	LOG4CXX_DEBUG(gLogger, "ResamplingNode::proceed");
//	std::cout << "reading line node ..."<< std::endl;
	DrawingProperties* props = pContext_.get<DrawingProperties*>();
	// read attributes :
	xmlChar* value = NULL;

	// TODO see if we have some default config values to retrieve...

	// overwrites default values if any...
	// type
	value = xmlGetProp(pNode_, (const xmlChar *)"type");
	if( value ){
		try{
			props->getResamplingProperties().setType( stoResamplingType.at(std::string((const char*)value)) );
//			std::cout << "@type="<< value<< std::endl;
		}
		catch( std::out_of_range& err ){
			std::ostringstream msg {};
			msg << "ResamplingNode::proceed invalid resampling type value:" << value <<". Using default value.";
			LOG4CXX_DEBUG(gLogger, msg.str());
		}
		xmlFree(value);
	}

	// value
	value = xmlGetProp(pNode_, (const xmlChar *)"value");
	if( value ){
		props->getResamplingProperties().setValue( atol((const char*)value) );
//		std::cout << "@value="<< value<< std::endl;
		xmlFree(value);
	}
}

} /* namespace plot */