Jpp
JAsciiDB.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 
4 #include "KM3NeTDBClient.h"
5 #include "JDB/JDB.hh"
6 #include "JDB/JDBToolkit.hh"
7 #include "JDB/JSelector.hh"
8 #include "JDB/JSupport.hh"
9 
10 #include "JDB/JDBincludes.hh"
13 #include "JROOT/JRootDictionary.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 ASCII 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 
32  string usr;
33  string pwd;
34  string cookie;
35  string query;
36  JSelector selection;
37  int debug;
38 
39  try {
40 
41  JParser<> zap("Auxiliary program to convert data from data base into ASCII format.");
42 
43  zap['u'] = make_field(usr) = "";
44  zap['!'] = make_field(pwd) = "";
45  zap['C'] = make_field(cookie) = "";
46  zap['q'] = make_field(query) = getQueries<typelist>();
47  zap['@'] = make_field(selection) = JPARSER::initialised();
48  zap['d'] = make_field(debug) = 1;
49 
50  zap['q'] = JPARSER::not_initialised();
51 
52  zap(argc, argv);
53  }
54  catch(const exception &error) {
55  FATAL(error.what() << endl);
56  }
57 
58 
59  JRootWriter writer(cout, JEquationParameters(), JRootDictionary::getInstance());
60 
61  JRootStreamObjectOutput<typelist> out(writer, "\n");
62 
63  try {
64 
65  JDB::reset(usr, pwd, cookie);
66 
67  JDetectorsHelper::initialise();
68 
69  JDatabaseObjectIterator<typelist> in(query, selection);
70 
71  in >> out;
72  }
73  catch(const exception& error) {
74  FATAL(error.what() << endl);
75  }
76 }
JMessage.hh
JLANG::getInstance
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:73
JSelector.hh
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
main
int main(int argc, char **argv)
Definition: JAsciiDB.cc:25
JDBToolkit.hh
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JRootStreamObjectOutput.hh
JDB.hh
debug
int debug
debug level
Definition: JSirene.cc:59
JSupport.hh
JLANG::JTypeList
Type list.
Definition: JTypeList.hh:22
JDBincludes.hh
JDETECTOR::reset
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
Definition: JCLBSimulator.hh:41
JParser.hh
JRootDictionary.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JDatabaseObjectIterator.hh
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JPARSER::not_initialised
Empty structure for specification of parser element that is not initialised (i.e.
Definition: JParser.hh:69