Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
JMergeTransmitter.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <vector>
4 
6 
7 #include "JSupport/JMeta.hh"
8 
9 #include "Jeep/JContainer.hh"
10 #include "Jeep/JPrint.hh"
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 
15 /**
16  * \file
17  *
18  * Auxiliary program to merge transmitter files.
19  *
20  * \author mdejong
21  */
22 int main(int argc, char **argv)
23 {
24  using namespace std;
25  using namespace JPP;
26 
27  typedef JContainer< vector<JTransmitter> > container_type;
28 
29  vector<string> inputFile;
30  string outputFile;
31  int debug;
32 
33  try {
34 
35  JParser<> zap("Auxiliary program to merge transmitter files.");
36 
37  zap['f'] = make_field(inputFile, "transmitter input file");
38  zap['o'] = make_field(outputFile, "transmitter 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 }
Container I/O.
string outputFile
int main(int argc, char **argv)
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
ROOT I/O of application specific meta data.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
I/O formatting auxiliaries.
Data structure for transmitter.
General exception.
Definition: JException.hh:24
Utility class to parse command line options.
Definition: JParser.hh:1698
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition: JContainer.hh:42
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72