/* * TarPostProcessing.cc * * Created on: 26 sept. 2013 * Author: CS */ #include "TarPostProcessing.hh" #include "ArchiveWriter.hh" #include "TarNode.hh" #include "PostProcessingRegistry.hh" namespace postprocessing { const std::string TarPostProcessing::EXTENSION = ".tar"; /** * Self-registering to post-processing factory */ std::string TarPostProcessing::_key = PostProcessingRegistry::getInstance().addElement(EXTENSION, new TarPostProcessing()); TarPostProcessing::TarPostProcessing() : PostProcessing(), _parentName(std::string()) { } TarPostProcessing::TarPostProcessing(const std::string& pParentName) : PostProcessing(), _parentName(pParentName) { } TarPostProcessing::~TarPostProcessing() { } /** * Applies post-processing. */ void TarPostProcessing::apply(PostProcessingAble* pOutput) { _outputDestination = pOutput->getDestination(); _files.push_back(tar(pOutput->getOutputs(), _parentName, pOutput->getDestination())); } /** * Archives some files. */ std::string TarPostProcessing::tar(const std::vector& pFiles, const std::string& pPrefix, const std::string& pOutDir) { return ArchiveWriter::createArchive(ArchiveWriter::Formats::TAR, EXTENSION, pFiles, pPrefix, pOutDir); } /** * Registers related node and process. */ void TarPostProcessing::registerChildList( std::map>& childList) { childList["tar"] = boost::shared_ptr( new TarNode()); } } /* namespace postprocessing */