Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDB.cc File Reference

Example program to test detector reading using KM3NETDB::JDB. More...

#include <iostream>
#include <iomanip>
#include "JDB/JDB.hh"
#include "JDetector/JDetector.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

Example program to test detector reading using KM3NETDB::JDB.

Author
mdejong

Definition in file JDB.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file JDB.cc.

18 {
19  using namespace std;
20 
21  string usr;
22  string pwd;
23  string cookie;
24  string id;
25  string t0set;
26  string calibset;
27  int run;
28  int debug;
29 
30  try {
31 
32  JParser<> zap("Example program to test detector reading from data base.");
33 
34  zap['u'] = make_field(usr) = "";
35  zap['!'] = make_field(pwd) = "";
36  zap['C'] = make_field(cookie) = "";
37  zap['D'] = make_field(id) = "14";
38  zap['r'] = make_field(run);
39  zap['t'] = make_field(t0set) = "";
40  zap['c'] = make_field(calibset) = "";
41  zap['d'] = make_field(debug) = 1, 0, 2, 3;
42 
43  zap(argc, argv);
44  }
45  catch(const exception &error) {
46  FATAL(error.what() << endl);
47  }
48 
49  using namespace JPP;
50  using namespace KM3NETDB;
51 
52  if (usr != "" && pwd != "")
53  JDB::reset(usr, pwd);
54  else if (cookie != "")
55  JDB::reset(cookie);
56  else
57  FATAL("Must provide either username (with password) or cookie." << endl);
58 
59  JDetector detector;
60  if (!t0set.empty() && !calibset.empty())
61  *JDB::get()->DetX(id.c_str(), run, t0set.c_str(), calibset.c_str()) >> detector;
62  else
63  *JDB::get()->DetX(id.c_str(), run) >> detector;
64 
65  cout << detector << endl;
66 
67 }
Utility class to parse command line options.
Definition: JParser.hh:1410
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
T get(const JHead &head)
Get object from header.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
int debug
debug level
Definition: JSirene.cc:59
#define FATAL(A)
Definition: JMessage.hh:65