EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
FairDbValRecSet.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairDbValRecSet.cxx
1
2
#include "
FairDbProxy.h
"
3
#include "
FairDbResult.h
"
4
#include "
FairDbTableProxy.h
"
5
#include "
FairDbTableProxyRegistry.h
"
6
#include "
FairDbValidityRec.h
"
7
#include "
FairDbValRecSet.h
"
8
9
ClassImp
(
FairDbValRecSet
)
10
11
12
13
FairDbValRecSet
::
FairDbValRecSet
(const
string
& tableName,UInt_t dbNo,UInt_t seqNo) :
14
fDbNo(dbNo),
15
fResult(NULL),
16
fSeqNoToRec()
17
{
18
// Get Db proxy for the table.
19
FairDbValidityRec
pet;
20
const
FairDbProxy
& proxy =
FairDbTableProxyRegistry::Instance
()
21
.
GetTableProxy
(tableName,&pet)
22
.
GetDBProxy
();
23
24
// Collect up all validity records.
25
FairDbResultSet
* rset = proxy.
QueryAllValidities
(dbNo,seqNo);
26
fResult =
new
FairDbResultNonAgg
(rset,&pet,0,kFALSE);
27
delete
rset;
28
29
30
}
31
32
33
34
FairDbValRecSet::~FairDbValRecSet
()
35
{
36
37
delete
fResult
;
38
39
}
40
41
42
UInt_t
FairDbValRecSet::GetNumRows
()
const
43
{
44
45
return
fResult
?
fResult
->
GetNumRows
() : 0;
46
}
47
48
49
const
string
FairDbValRecSet::GetTableName
()
const
50
{
51
52
return
fResult
?
fResult
->
TableName
() :
"Unknown"
;
53
}
54
55
56
const
FairDbValidityRec
*
FairDbValRecSet::GetTableRow
(UInt_t rowNum)
const
57
{
58
59
return
fResult
?
60
dynamic_cast<
const
FairDbValidityRec
*
>
(
fResult
->
GetTableRow
(rowNum))
61
: 0;
62
}
63
64
65
const
FairDbValidityRec
*
FairDbValRecSet::GetTableRowBySeqNo
(UInt_t seqNo
66
)
const
67
{
68
69
UInt_t numRows =
GetNumRows
();
70
if
( numRows == 0 ) {
return
0; }
71
72
// Create look-up table if not yet built.
73
74
if
(
fSeqNoToRec
.size() == 0 ) {
75
for
( UInt_t irow = 0; irow < numRows; ++irow) {
76
const
FairDbValidityRec
* vrec =
GetTableRow
(irow);
77
fSeqNoToRec
[vrec->
GetSeqNo
()] = vrec;
78
}
79
}
80
81
map<UInt_t,const FairDbValidityRec*>::const_iterator itr =
fSeqNoToRec
.find(seqNo);
82
return
( itr ==
fSeqNoToRec
.end() ) ? 0 : itr->second;
83
84
}
85
EicRoot
blob
master
dbase
dbInterface
FairDbValRecSet.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:33
using
1.8.2 with
EIC GitHub integration