Blame view

src/PostProcessing/TarPostProcessing.cc 1.52 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
/*
 * 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<std::string>& 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<std::string, boost::shared_ptr<AMDA::XMLConfigurator::NodeCfg>>& childList) {
	childList["tar"] = boost::shared_ptr<AMDA::XMLConfigurator::NodeCfg>(
			new TarNode());
}


} /* namespace postprocessing */