ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
IOVDbSvc
src
ReadFromFileMetaData.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ReadFromFileMetaData.h
"
6
#include "CoralBase/AttributeList.h"
7
#include "
IOVDbCoolFunctions.h
"
8
#include "
IOVDbDataModel/IOVMetaDataContainer.h
"
9
#include "
IOVDbDataModel/IOVPayloadContainer.h
"
10
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
11
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
12
#include "
IOVDbMetaDataTools/IIOVDbMetaDataTool.h
"
13
14
using
IOVDbNamespace::makeEpochOrRunLumi
;
15
16
namespace
IOVDbNamespace
{
17
ReadFromFileMetaData::ReadFromFileMetaData
(
const
IOVMetaDataContainer
* container,
18
const
IOVTime
& refTime,
const
bool
useEpochTimestamp) :
19
m_metaContainer
(container),
20
m_referenceTime
(refTime) {
21
m_payload
= (container) ? (container->payloadContainer()) : (
nullptr
);
22
if
(
m_payload
){
23
IOVPayloadContainer::const_iterator
pitr=
m_payload
->find(
m_referenceTime
);
24
if
(pitr!=
m_payload
->end()){
25
m_pptr
=*pitr;
26
}
else
{
27
m_pptr
=
new
CondAttrListCollection
(not useEpochTimestamp);
28
m_newedPtr
=
true
;
29
}
30
m_folderType
=
IOVDbNamespace::determineFolderType
(
m_pptr
);
31
}
32
}
33
//
34
ReadFromFileMetaData::ReadFromFileMetaData
(
const
IOVMetaDataContainer
* container,
35
const
cool::ValidityKey & refTimeKey,
const
bool
useEpochTimestamp)
36
:
ReadFromFileMetaData
( container,
37
makeEpochOrRunLumi
(refTimeKey,useEpochTimestamp),
38
useEpochTimestamp )
39
{ }
40
//
41
ReadFromFileMetaData::~ReadFromFileMetaData
(){
42
if
(
m_newedPtr
)
delete
m_pptr
;
43
}
44
45
//
46
bool
47
ReadFromFileMetaData::isValid
(){
48
return
(
m_metaContainer
and
m_payload
);
49
}
50
51
//
52
IOVDbNamespace::FolderType
53
ReadFromFileMetaData::folderType
(){
54
return
m_folderType
;
55
}
56
//
57
unsigned
int
58
ReadFromFileMetaData::numberOfObjects
(){
59
return
m_pptr
->size();
60
}
61
//
62
std::string
63
ReadFromFileMetaData::stringAddress
(){
64
std::string strAddress{};
65
if
((
m_folderType
==
PoolRef
) or (
m_folderType
==
AttrList
)) {
66
const
coral::AttributeList& payload1=
m_pptr
->begin()->second;
67
if
(
m_folderType
==
PoolRef
) {
68
// single channel with PoolRef
69
strAddress=payload1[0].data<std::string>();
70
}
else
{
71
// create an AthenaAttributeList for this data
72
strAddress=
"POOLContainer_AthenaAttributeList][CLID=x"
;
73
}
74
}
75
return
strAddress;
76
}
77
78
//
79
bool
80
ReadFromFileMetaData::poolPayloadRequested
(){
81
return
(
m_folderType
==
PoolRef
) or (
m_folderType
==
PoolRefColl
);
82
}
83
84
IOVRange
85
ReadFromFileMetaData::range
(){
86
if
((
m_folderType
==
PoolRef
) or (
m_folderType
==
AttrList
)) {
87
return
(
m_pptr
->iov_begin())->second;
88
}
else
{
89
return
m_pptr
->minRange();
90
}
91
}
92
93
CondAttrListCollection
*
94
ReadFromFileMetaData::attrListCollection
(){
95
if
((
m_folderType
!=
PoolRef
) and (
m_folderType
!=
AttrList
)) {
96
m_attrListColl
=
new
CondAttrListCollection
(*
m_pptr
);
97
}
98
return
m_attrListColl
;
99
}
100
101
AthenaAttributeList
*
102
ReadFromFileMetaData::attributeList
(){
103
if
(
m_folderType
==
AttrList
)
m_attrList
=
new
AthenaAttributeList
(
m_pptr
->begin()->second);
104
return
m_attrList
;
105
}
106
107
//-----------------------------------------------------------------------
108
FMDReadLock::FMDReadLock
(
IIOVDbMetaDataTool
* metadatatool )
109
:
m_metadatatool
(metadatatool)
110
{
111
m_metadatatool
->lock_shared();
112
}
113
114
IOVMetaDataContainer
*
FMDReadLock::findFolder
(
const
std::string& folderName )
115
{
116
return
m_metadatatool
->findMetaDataContainer( folderName );
117
}
118
119
FMDReadLock::~FMDReadLock
() {
120
m_metadatatool
->unlock_shared();
121
}
122
123
124
SafeReadFromFileMetaData::SafeReadFromFileMetaData
(
125
const
std::string& folderName,
126
IIOVDbMetaDataTool
* metadatatool,
127
const
IOVTime
& refTime,
const
bool
useEpochTimestamp )
128
:
FMDReadLock
(metadatatool),
129
ReadFromFileMetaData
(
FMDReadLock
::
findFolder
(folderName), refTime, useEpochTimestamp )
130
{ }
131
132
SafeReadFromFileMetaData::SafeReadFromFileMetaData
(
133
const
std::string& folderName,
134
IIOVDbMetaDataTool
* metadatatool,
135
const
cool::ValidityKey & refTimeKey,
const
bool
useEpochTimestamp)
136
:
FMDReadLock
(metadatatool),
137
ReadFromFileMetaData
(
FMDReadLock
::
findFolder
(folderName), refTimeKey, useEpochTimestamp )
138
{ }
139
}
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
IIOVDbMetaDataTool.h
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
IOVDbCoolFunctions.h
IOVMetaDataContainer.h
This class is a container for conditions data.
IOVPayloadContainer.h
This class is a container for the payload of conditions data.
ReadFromFileMetaData.h
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
IIOVDbMetaDataTool
This is an interface to a tool used to manage the IOV Meta Data for a given object in the MetaData St...
Definition
IIOVDbMetaDataTool.h:44
IOVDbNamespace::FMDReadLock::FMDReadLock
FMDReadLock(const FMDReadLock &)=delete
IOVDbNamespace::FMDReadLock::m_metadatatool
IIOVDbMetaDataTool * m_metadatatool
Definition
ReadFromFileMetaData.h:70
IOVDbNamespace::FMDReadLock::~FMDReadLock
~FMDReadLock()
Definition
ReadFromFileMetaData.cxx:119
IOVDbNamespace::FMDReadLock::findFolder
IOVMetaDataContainer * findFolder(const std::string &folderName)
Definition
ReadFromFileMetaData.cxx:114
IOVDbNamespace::ReadFromFileMetaData::isValid
bool isValid()
Definition
ReadFromFileMetaData.cxx:47
IOVDbNamespace::ReadFromFileMetaData::stringAddress
std::string stringAddress()
Definition
ReadFromFileMetaData.cxx:63
IOVDbNamespace::ReadFromFileMetaData::m_metaContainer
const IOVMetaDataContainer * m_metaContainer
Definition
ReadFromFileMetaData.h:51
IOVDbNamespace::ReadFromFileMetaData::m_folderType
IOVDbNamespace::FolderType m_folderType
Definition
ReadFromFileMetaData.h:57
IOVDbNamespace::ReadFromFileMetaData::attrListCollection
CondAttrListCollection * attrListCollection()
Definition
ReadFromFileMetaData.cxx:94
IOVDbNamespace::ReadFromFileMetaData::m_attrList
AthenaAttributeList * m_attrList
Definition
ReadFromFileMetaData.h:55
IOVDbNamespace::ReadFromFileMetaData::folderType
IOVDbNamespace::FolderType folderType()
Definition
ReadFromFileMetaData.cxx:53
IOVDbNamespace::ReadFromFileMetaData::m_referenceTime
IOVTime m_referenceTime
Definition
ReadFromFileMetaData.h:52
IOVDbNamespace::ReadFromFileMetaData::attributeList
AthenaAttributeList * attributeList()
Definition
ReadFromFileMetaData.cxx:102
IOVDbNamespace::ReadFromFileMetaData::ReadFromFileMetaData
ReadFromFileMetaData()=delete
IOVDbNamespace::ReadFromFileMetaData::range
IOVRange range()
Definition
ReadFromFileMetaData.cxx:85
IOVDbNamespace::ReadFromFileMetaData::numberOfObjects
unsigned int numberOfObjects()
Definition
ReadFromFileMetaData.cxx:58
IOVDbNamespace::ReadFromFileMetaData::m_payload
const IOVPayloadContainer * m_payload
Definition
ReadFromFileMetaData.h:53
IOVDbNamespace::ReadFromFileMetaData::poolPayloadRequested
bool poolPayloadRequested()
Definition
ReadFromFileMetaData.cxx:80
IOVDbNamespace::ReadFromFileMetaData::m_newedPtr
bool m_newedPtr
Definition
ReadFromFileMetaData.h:58
IOVDbNamespace::ReadFromFileMetaData::m_pptr
CondAttrListCollection * m_pptr
Definition
ReadFromFileMetaData.h:54
IOVDbNamespace::ReadFromFileMetaData::m_attrListColl
CondAttrListCollection * m_attrListColl
Definition
ReadFromFileMetaData.h:56
IOVDbNamespace::ReadFromFileMetaData::~ReadFromFileMetaData
~ReadFromFileMetaData()
Definition
ReadFromFileMetaData.cxx:41
IOVDbNamespace::SafeReadFromFileMetaData::SafeReadFromFileMetaData
SafeReadFromFileMetaData(const std::string &folderName, IIOVDbMetaDataTool *metadatatool, const IOVTime &refTime, const bool useEpochTimestamp)
Definition
ReadFromFileMetaData.cxx:124
IOVMetaDataContainer
This class is a container for conditions data.
Definition
IOVMetaDataContainer.h:37
IOVPayloadContainer::const_iterator
payloadVec::const_iterator const_iterator
Definition
IOVPayloadContainer.h:39
IOVRange
Validity Range object.
Definition
IOVRange.h:30
IOVTime
Basic time unit for IOVSvc.
Definition
IOVTime.h:33
IOVDbNamespace
Definition
Base64Codec.cxx:16
IOVDbNamespace::determineFolderType
FolderType determineFolderType(const std::string &folderDescription, const std::string &spec, const std::vector< cool::ChannelId > &chans)
Determine folder type with optional check using clid service to check clid matches typename.
Definition
FolderTypes.cxx:17
IOVDbNamespace::FolderType
FolderType
Definition
FolderTypes.h:26
IOVDbNamespace::PoolRef
@ PoolRef
Definition
FolderTypes.h:30
IOVDbNamespace::PoolRefColl
@ PoolRefColl
Definition
FolderTypes.h:31
IOVDbNamespace::AttrList
@ AttrList
Definition
FolderTypes.h:28
IOVDbNamespace::makeEpochOrRunLumi
IOVTime makeEpochOrRunLumi(const cool::ValidityKey key, const bool timeIsEpoch)
Create an IOVTime in ns of epoch or run-lumi (determined by the bool) from a ValidityKey.
Definition
IOVDbCoolFunctions.cxx:87
Generated on
for ATLAS Offline Software by
1.17.0