Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
Functions
JMergeHydrophone.cc File Reference

Auxiliary program to merge hydrophone files. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "JDetector/JHydrophone.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JContainer.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to merge hydrophone files.

Author
mdejong

Definition in file JMergeHydrophone.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 22 of file JMergeHydrophone.cc.

23{
24 using namespace std;
25 using namespace JPP;
26
27 typedef JContainer< vector<JHydrophone> > container_type;
28
29 vector<string> inputFile;
30 string outputFile;
31 int debug;
32
33 try {
34
35 JParser<> zap("Auxiliary program to merge hydrophone files.");
36
37 zap['f'] = make_field(inputFile, "hydrophone input file");
38 zap['o'] = make_field(outputFile, "hydrophone output file");
39 zap['d'] = make_field(debug, "debug level") = 2;
40
41 zap(argc, argv);
42 }
43 catch(const exception &error) {
44 FATAL(error.what() << endl);
45 }
46
47 container_type data;
48
49 data.comment.add(JMeta(argc, argv));
50
51 for (vector<string>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
52
53 container_type buffer;
54
55 try {
56 load(*i, buffer);
57 }
58 catch(const JException& error) {
59 FATAL(error);
60 }
61
62 if (data.empty())
63 data = buffer;
64 else
65 copy(buffer.begin(), buffer.end(), back_inserter(data));
66 }
67
68 data.store(outputFile.c_str());
69}