Jpp  15.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JConvertDB.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 
4 #include "dbclient/KM3NeTDBClient.h"
5 
6 #include "JDB/JDB.hh"
7 #include "JDB/JDBToolkit.hh"
8 #include "JDB/JSelector.hh"
9 #include "JDB/JSupport.hh"
10 #include "JDB/JDBincludes.hh"
13 #include "JSupport/JMeta.hh"
14 
15 #include "Jeep/JParser.hh"
16 #include "Jeep/JMessage.hh"
17 
18 
19 /**
20  * \file
21  *
22  * Auxiliary program to convert data from data base into ROOT format.
23  * \author mdejong
24  */
25 int main(int argc, char **argv)
26 {
27  using namespace std;
28  using namespace JPP;
29 
30  typedef JDBTypes_t typelist;
31 
33  JServer server;
34  string usr;
35  string pwd;
36  string cookie;
37  string query;
38  JSelector selection;
39  int debug;
40 
41  try {
42 
43  JParser<> zap("Auxiliary program to convert data from data base into ROOT format.");
44 
45  zap['o'] = make_field(outputFile);
46  zap['s'] = make_field(server) = getServernames();
47  zap['u'] = make_field(usr) = "";
48  zap['!'] = make_field(pwd) = "";
49  zap['C'] = make_field(cookie) = "";
50  zap['q'] = make_field(query) = getQueries<typelist>();
51  zap['@'] = make_field(selection) = JPARSER::initialised();
52  zap['d'] = make_field(debug) = 1;
53 
54  zap['q'] = JPARSER::not_initialised();
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
62 
63  try {
64 
65  JDB::reset(usr, pwd, cookie);
66 
67  JDBToolkit::initialise(getDetector);
68 
69  JDatabaseObjectIterator<typelist> in(query, selection);
70 
71  outputFile.open();
72 
73  outputFile.put(JMeta(argc, argv));
74 
75  in >> outputFile;
76 
77  outputFile.close();
78  }
79  catch(const exception& error) {
80  FATAL(error.what() << endl);
81  }
82 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
Object iteration from database.
Recording of objects on file according a format that follows from the file name extension.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary class for specifying selection of database data.
string outputFile
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Definition: JDBToolkit.cc:5
Type list.
Definition: JTypeList.hh:22
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
ROOT I/O of application specific meta data.
ROOT TTree parameter settings.
int debug
debug level
Definition: JSirene.cc:63
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
Definition: JParser.hh:72
void reset(T &value)
Reset value.
Utility class to parse command line options.
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition: JDB.hh:98
Wrapper class for server name.
Definition: JDB.hh:42
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41