PostProcessingNode.hh 1.5 KB
/*
 * 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_ */