PostProcessingAble.cc 1.12 KB
/*
 * PostProcessingAble.cc
 *
 *  Created on: 27 sept. 2013
 *      Author: CS
 */

#include "PostProcessingAble.hh"
#include "PostProcessing.hh"

namespace postprocessing {

PostProcessingAble::PostProcessingAble() {
}

PostProcessingAble::~PostProcessingAble() {
	std::vector<PostProcessing*>::const_iterator itr;
	for (itr = _postProcessingList.begin(); itr != _postProcessingList.end(); ++itr) {
		delete (*itr);
	}
}

/**
 * Lists output files.
 */
const std::vector<std::string>& PostProcessingAble::getOutputs() const {
	return _files;
}

/**
 * Gives post-processing result out directory.
 */
const std::string& PostProcessingAble::getDestination() const {
	// if empty means current directory
	return _outputDestination;
}

void PostProcessingAble::applyPostProcessing() {
	for (size_t i = 0; i < _postProcessingList.size(); ++i) {
		if(i > 0){
			_postProcessingList[i]->apply(_postProcessingList[i-1]);
		}
		else {
			_postProcessingList[i]->apply(this);
		}
	}
}

void PostProcessingAble::addPostProcessing(PostProcessing* pPostProcessing) {
		_postProcessingList.push_back(pPostProcessing);
	}

} /* namespace postprocessing */