Jpp
15.0.3
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
JRuns.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <vector>
4
5
#include "TTimeStamp.h"
6
#include "TRegexp.h"
7
8
#include "
JDB/JDB.hh
"
9
#include "
JDB/JSelector.hh
"
10
#include "
JDB/JSelectorSupportkit.hh
"
11
#include "
JDB/JRuns.hh
"
12
#include "
JDB/JDBToolkit.hh
"
13
14
#include "
JLang/JLangToolkit.hh
"
15
#include "
JROOT/JRootPrinter.hh
"
16
#include "
JROOT/JRootToolkit.hh
"
17
18
#include "
Jeep/JPrint.hh
"
19
#include "
Jeep/JParser.hh
"
20
#include "
Jeep/JMessage.hh
"
21
22
23
/**
24
* \file
25
*
26
* Example program to print data from data base.
27
* \author mdejong
28
*/
29
int
main
(
int
argc,
char
**argv)
30
{
31
using namespace
std;
32
using namespace
JPP;
33
34
JServer server;
35
string
usr;
36
string
pwd;
37
string
cookie;
38
string
detid;
39
TRegexp regexp(
"."
);
40
vector<string>
format;
41
JSelector selection;
42
int
debug
;
43
44
try
{
45
46
JParser<>
zap(
"Example program to print data from data base."
);
47
48
zap[
's'
] =
make_field
(server) =
getServernames
();
49
zap[
'u'
] =
make_field
(usr) =
""
;
50
zap[
'!'
] =
make_field
(pwd) =
""
;
51
zap[
'C'
] =
make_field
(cookie) =
""
;
52
zap[
'D'
] =
make_field
(detid);
53
zap[
'r'
] =
make_field
(regexp,
"TRegexp for selection of run setup names."
) =
JPARSER::initialised
();
54
zap[
'F'
] =
make_field
(format,
"column names: "
<<
JEEPZ
() << getColumns<JRuns>()) =
JPARSER::initialised
();
55
zap[
'@'
] =
make_field
(selection) =
JPARSER::initialised
();
56
zap[
'd'
] =
make_field
(
debug
) = 2;
57
58
zap(argc, argv);
59
}
60
catch
(
const
exception &error) {
61
FATAL
(error.what() << endl);
62
}
63
64
65
if
(format.empty()) {
66
format = getColumns<JRuns>();
67
}
68
69
try
{
70
71
JDB::reset
(usr, pwd, cookie);
72
73
const
int
id
= getDetector<int>(detid);
74
75
selection += getSelector<JRuns>(id);
76
77
ResultSet& rs =
getResultSet
(getTable<JRuns>(), selection);
78
79
for
(JRuns
parameters
; rs >>
parameters
&& selection >>
parameters
; ) {
80
81
if
(TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
82
83
for
(
vector<string>::const_iterator
i = format.begin(); i != format.end(); ++i) {
84
JRootPrinter::print
(cout, parameters, *i);
85
}
86
87
cout << endl;
88
}
89
}
90
}
91
catch
(
const
exception& error) {
92
FATAL
(error.what() << endl);
93
}
94
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JRuns.hh
JRootPrinter.hh
Print objects in ASCII format using ROOT dictionary.
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:66
std::vector
Definition:
JSTDTypes.hh:12
JDBToolkit.hh
JSelector.hh
JPrint.hh
I/O formatting auxiliaries.
JLangToolkit.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
debug
int debug
debug level
Definition:
JSirene.cc:63
JEEPZ
Auxiliary data structure for streaming of STL containers.
Definition:
JPrint.hh:65
print
print
Definition:
JConvertDusj.sh:44
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
JRootToolkit.hh
JParser.hh
Utility class to parse command line options.
JDATABASE::getResultSet
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition:
JDB.hh:432
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:98
JSelectorSupportkit.hh
JDB.hh
Generated by
1.8.5