forked from rezass/HMMsim-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge.cpp
More file actions
executable file
·47 lines (36 loc) · 1.02 KB
/
merge.cpp
File metadata and controls
executable file
·47 lines (36 loc) · 1.02 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
/*
* Copyright (c) 2015 Santiago Bock
*
* See the file LICENSE.txt for copying permission.
*/
/*
* This program decompreses and merges a trace from multiple files into one file.
*/
#include "Arguments.H"
#include "TraceHandler.H"
int main(int argc, char * argv[]){
ArgumentContainer args("merge", false);
PositionalArgument<string> tracePrefix(&args, "trace_prefix", "trace prefix", "");
PositionalArgument<string> outputFile(&args, "output_file", "output file", "");
OptionalArgument<string> compression(&args, "c", "compression algorithm (gzip|bzip2)", "gzip");
if (args.parse(argc, argv)){
args.usage(cerr);
return -1;
}
CompressionType comp;
if (compression.getValue() == "gzip"){
comp = GZIP;
} else if (compression.getValue() == "bzip2"){
comp = BZIP2;
} else {
args.usage(cerr);
return -1;
}
CompressedTraceReader reader(tracePrefix.getValue(), comp);
TraceWriter writer(outputFile.getValue());
TraceEntry entry;
while(reader.readEntry(&entry)){
writer.writeEntry(&entry);
}
return 0;
}