Blame view

src/PostProcessing/PostProcessingNode.hh 1.5 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
70
71
/*
 * PostProcessingNode.hh
 *
 *  Created on: 27 sept. 2013
 *      Author: CS
 */

#ifndef POSTPROCESSINGNODE_HH_
#define POSTPROCESSINGNODE_HH_

#include "NodeCfg.hh"
#include <log4cxx/logger.h>
#include "ZipNode.hh"
#include "TarNode.hh"
#include "GzipNode.hh"
#include "PostProcessingRegistry.hh"

namespace postprocessing {

template<class T>
class PostProcessingNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	PostProcessingNode() :
			NodeGrpCfg() {

		/*
		 <postProcess>
		 <!-- any of PostProcessRegistry -->
		 </postProcess>
		 */
		// get class manager for each child node.
		for (auto child : PostProcessingRegistry::getInstance().getAllElements()) {
			child.second->registerChildList(getChildList());
		}
	}

	virtual ~PostProcessingNode() {
	}

	/**
	 * Reads postProcess node.
	 */
	void proceed(xmlNodePtr pNode,
			const AMDA::Parameters::CfgContext& pContext) {
		LOG4CXX_DEBUG(_logger, "PostProcessingNode::proceed");

		// Get manager of the new output parameter for this node
		T* lOutput = pContext.get<T*>();
		AMDA::Parameters::CfgContext lContext;

		// Push post processing able in the context
		lContext.push<PostProcessingAble*>(lOutput);

		// proceed child nodes
		NodeGrpCfg::proceed(pNode, lContext);
	}

private:

	/**
	 * A logger.
	 */
	static const log4cxx::LoggerPtr _logger;
};

template<class T>
const log4cxx::LoggerPtr PostProcessingNode<T>::_logger =
		log4cxx::Logger::getLogger("AMDA-Kernel.PostProcessingNode");

} /* namespace postprocessing */
#endif /* POSTPROCESSINGNODE_HH_ */