Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1711
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
int debug
debug level