Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
getDetector.cc File Reference

Auxiliary program to get serial number or object identifier of detector from database. More...

#include <iostream>
#include <iomanip>
#include "JDB/JDB.hh"
#include "JDB/JDBToolkit.hh"
#include "JLang/JLangToolkit.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 get serial number or object identifier of detector from database.

Author
mdejong

Definition in file getDetector.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 24 of file getDetector.cc.

25{
26 using namespace std;
27 using namespace JPP;
28
29 JServer server;
30 string usr;
31 string pwd;
32 string cookie;
33 string detid;
34 string option;
35 int debug;
36
37 try {
38
39 JParser<> zap("Auxiliary program to get serial number or object identifier of detector from database.");
40
41 zap['s'] = make_field(server) = getServernames();
42 zap['u'] = make_field(usr) = "";
43 zap['!'] = make_field(pwd) = "";
44 zap['C'] = make_field(cookie) = "";
45 zap['D'] = make_field(detid);
46 zap['O'] = make_field(option) = "", int_t, string_t;
47 zap['d'] = make_field(debug) = 1;
48
49 zap(argc, argv);
50 }
51 catch(const exception &error) {
52 FATAL(error.what() << endl);
53 }
54
55
56 try {
57
58 JDB::reset(usr, pwd, cookie);
59
60 if (is_integer(detid))
61 (option == string_t || option == "" ? cout << getDetector(to_value<int>(detid)) : cout << detid) << endl;
62 else
63 (option == int_t || option == "" ? cout << getDetector(detid) : cout << detid) << endl;
64 }
65 catch(const exception& error) {
66 FATAL(error.what() << endl);
67 }
68}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
const char *const string_t
routing by string
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition JDB.hh:108
bool is_integer(const std::string &buffer)
Check if string is an integer.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Wrapper class for server name.
Definition JDB.hh:54