ZipPostProcessing.cc
1.49 KB
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
/*
* ZipPostProcessing.cc
*
* Created on: 25 sept. 2013
* Author: CS
*/
#include "ZipPostProcessing.hh"
#include "ArchiveWriter.hh"
#include "ZipNode.hh"
#include "PostProcessingRegistry.hh"
namespace postprocessing {
const std::string ZipPostProcessing::EXTENSION = ".zip";
/**
* Self-registering to post-processing factory
*/
std::string ZipPostProcessing::_key =
PostProcessingRegistry::getInstance().addElement(EXTENSION,
new ZipPostProcessing());
ZipPostProcessing::ZipPostProcessing() :
PostProcessing(), _parentName(std::string()) {
}
ZipPostProcessing::ZipPostProcessing(const std::string& pParentName) :
PostProcessing(), _parentName(pParentName) {
}
ZipPostProcessing::~ZipPostProcessing() {
}
/**
* Applies post-processing.
*/
void ZipPostProcessing::apply(PostProcessingAble* pOutput) {
_outputDestination = pOutput->getDestination();
_files.push_back(zip(pOutput->getOutputs(), _parentName, pOutput->getDestination()));
}
std::string ZipPostProcessing::zip(const std::vector<std::string>& pFiles, const std::string& pPrefix,
const std::string& pOutDir) {
return ArchiveWriter::createArchive(ArchiveWriter::Formats::ZIP, EXTENSION,
pFiles, pPrefix, pOutDir);
}
/**
* Registers related node and process.
*/
void ZipPostProcessing::registerChildList(
std::map<std::string, boost::shared_ptr<AMDA::XMLConfigurator::NodeCfg>>& childList) {
childList["zip"] = boost::shared_ptr<AMDA::XMLConfigurator::NodeCfg>(
new ZipNode());
}
} /* namespace postprocessing */