Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JDB
getDetector.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
4
#include "
JDB/JDB.hh
"
5
#include "
JDB/JDBToolkit.hh
"
6
7
#include "
JLang/JLangToolkit.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
#include "
Jeep/JMessage.hh
"
11
12
13
/**
14
* \file
15
*
16
* Auxiliary program to get serial number or object identifier of detector from database.
17
* \author mdejong
18
*/
19
int
main
(
int
argc,
char
**argv)
20
{
21
using namespace
std;
22
using namespace
JPP;
23
24
string
usr;
25
string
pwd;
26
string
cookie;
27
string
detid;
28
int
debug
;
29
30
try
{
31
32
JParser<>
zap(
"Auxiliary program to get serial number or object identifier of detector from database."
);
33
34
zap[
'u'
] =
make_field
(usr) =
""
;
35
zap[
'!'
] =
make_field
(pwd) =
""
;
36
zap[
'C'
] =
make_field
(cookie) =
""
;
37
zap[
'D'
] =
make_field
(detid);
38
zap[
'd'
] =
make_field
(
debug
) = 1;
39
40
zap(argc, argv);
41
}
42
catch
(
const
exception &error) {
43
FATAL
(error.what() << endl);
44
}
45
46
47
try
{
48
49
JDB::reset
(usr, pwd, cookie);
50
51
if
(
is_integer
(detid))
52
cout << getDetector(to_value<int>(detid)) << endl;
53
else
54
cout <<
getDetector
(detid) << endl;
55
}
56
catch
(
const
exception& error) {
57
FATAL
(error.what() << endl);
58
}
59
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JDBToolkit.hh
JLangToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
JLANG::is_integer
bool is_integer(const std::string &buffer)
Check if string is an integer.
Definition:
JLangToolkit.hh:58
debug
int debug
debug level
Definition:
JSirene.cc:61
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JDATABASE::getDetector
static const JDetectorsHelper & getDetector
Function object for mapping serial number and object identifier of detectors.
Definition:
JDBToolkit.hh:131
JTOOLS::reset
void reset(T &value)
Reset value.
Definition:
JToolsToolkit.hh:219
JParser.hh
Utility class to parse command line options.
JDB.hh
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5