Jpp - the software that should make you happy
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
JServer server;
25
string
usr;
26
string
pwd;
27
string
cookie;
28
string
detid;
29
int
debug
;
30
31
try
{
32
33
JParser<>
zap(
"Auxiliary program to get serial number or object identifier of detector from database."
);
34
35
zap[
's'
] =
make_field
(server) =
getServernames
();
36
zap[
'u'
] =
make_field
(usr) =
""
;
37
zap[
'!'
] =
make_field
(pwd) =
""
;
38
zap[
'C'
] =
make_field
(cookie) =
""
;
39
zap[
'D'
] =
make_field
(detid);
40
zap[
'd'
] =
make_field
(
debug
) = 1;
41
42
zap(argc, argv);
43
}
44
catch
(
const
exception &error) {
45
FATAL
(error.what() << endl);
46
}
47
48
49
try
{
50
51
JDB::reset
(usr, pwd, cookie);
52
53
if
(
is_integer
(detid))
54
cout << getDetector(to_value<int>(detid)) << endl;
55
else
56
cout <<
getDetector
(detid) << endl;
57
}
58
catch
(
const
exception& error) {
59
FATAL
(error.what() << endl);
60
}
61
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JDBToolkit.hh
JDATABASE::getDetector
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Definition:
JDBToolkit.cc:5
JLangToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
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:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JTOOLS::reset
void reset(T &value)
Reset value.
Definition:
JToolsToolkit.hh:219
JParser.hh
Utility class to parse command line options.
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:98
JDB.hh
Generated by
1.8.5