Blame view

src/ParamOutputImpl/IntervalTrue/OutputIntervalTrueNode.hh 1.71 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
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * OutputIntervalTrueNode.hh
 *
 *  Created on: Oct 31, 2012
 *      Author: f.casimir
 */

#ifndef OutputIntervalTrueNode_HH_
#define OutputIntervalTrueNode_HH_

#include "NodeCfg.hh"

#include "DownloadParamNode.hh"

namespace AMDA {
namespace ParamOutputImpl {
namespace Download {

class OutputIntervalTrueNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	OutputIntervalTrueNode();
	void proceed(xmlNodePtr pNode,
			const AMDA::Parameters::CfgContext& pContext);
};

template<class ParamOutputType>
class SingleParamNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	SingleParamNode() :
			AMDA::XMLConfigurator::NodeGrpCfg() {
		getChildList()["index"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new IndexNode<ParamOutputType>());
		getChildList()["calibration_info"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new CalibrationInfoNode<ParamOutputType>());
	}

	void proceed(xmlNodePtr pNode,
			const AMDA::Parameters::CfgContext& pContext) {
		LOG4CXX_DEBUG(gLogger, "SingleParamNode::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)
			}
			std::string lStrParamName((const char*) lParamName);
			ParamOutputType* lParamOutput = pContext.get<ParamOutputType*>();
			lParamOutput->setParamName(lStrParamName);

		} catch (...) {
			if (lParamName) {
				xmlFree(lParamName);
			}
			throw;
		}
		if (lParamName) {
			xmlFree(lParamName);
		}
		NodeGrpCfg::proceed(pNode, pContext);
	}
};

} // namespace Download
} // namespace ParamOutputImpl
} // namespace AMDA
#endif // OutputIntervalTrueNode_HH_