Jpp
18.4.0
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
namespace
{
13
14
const
char
*
const
int_t =
"int"
;
15
const
char
*
const
string_t
=
"string"
;
16
}
17
18
/**
19
* \file
20
*
21
* Auxiliary program to get serial number or object identifier of detector from database.
22
* \author mdejong
23
*/
24
int
main
(
int
argc,
char
**argv)
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
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JDATABASE::getDetector
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition:
JDBToolkit.hh:378
JDBToolkit.hh
JLangToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JLANG::is_integer
bool is_integer(const std::string &buffer)
Check if string is an integer.
Definition:
JLangToolkit.hh:58
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:106
JDB.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
JACOUSTICS::string_t
static const std::string string_t
string
Definition:
JSydney.cc:88
Generated by
1.8.5