Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JAsciiDB.cc File Reference

Auxiliary program to convert data from data base into ASCII format. More...

#include <iostream>
#include <iomanip>
#include "dbclient/KM3NeTDBClient.h"
#include "JDB/JDB.hh"
#include "JDB/JDBToolkit.hh"
#include "JDB/JSelector.hh"
#include "JDB/JSupport.hh"
#include "JDB/JDBincludes.hh"
#include "JDB/JDBDictionary.hh"
#include "JDB/JDatabaseObjectIterator.hh"
#include "JROOT/JRootStreamObjectOutput.hh"
#include "JROOT/JRootDictionary.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 convert data from data base into ASCII format.

Author
mdejong

Definition in file JAsciiDB.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 26 of file JAsciiDB.cc.

27 {
28  using namespace std;
29  using namespace JPP;
30 
31  typedef JDBTypes_t typelist;
32 
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 ASCII format.");
44 
45  zap['s'] = make_field(server) = getServernames();
46  zap['u'] = make_field(usr) = "";
47  zap['!'] = make_field(pwd) = "";
48  zap['C'] = make_field(cookie) = "";
49  zap['q'] = make_field(query) = getQueries<typelist>();
50  zap['@'] = make_field(selection) = JPARSER::initialised();
51  zap['d'] = make_field(debug) = 1;
52 
53  zap['q'] = JPARSER::not_initialised();
54 
55  zap(argc, argv);
56  }
57  catch(const exception &error) {
58  FATAL(error.what() << endl);
59  }
60 
61 
62  JRootWriter writer(cout, JEquationParameters(), JDBDictionary::getInstance());
63 
64  JRootStreamObjectOutput<typelist> out(writer, "\n");
65 
66  try {
67 
68  JDB::reset(usr, pwd, cookie);
69 
70  JDBToolkit::initialise(getDetector);
71 
72  JDatabaseObjectIterator<typelist> in(query, selection);
73 
74  in >> out;
75  }
76  catch(const exception& error) {
77  FATAL(error.what() << endl);
78  }
79 }
Utility class to parse command line options.
Definition: JParser.hh:1711
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:84
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:378
Type list.
Definition: JTypeList.hh:22
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
#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:90
void reset(T &value)
Reset value.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition: JDB.hh:106
int debug
debug level