The Gaudi Framework
master (37c0b60a)
Backend.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
Gaudi/TestSuite/Conditions/ConditionAccessorHolder.h
>
12
#include <
GaudiKernel/System.h
>
13
14
namespace
Gaudi::TestSuite::Conditions::details
{
15
ConditionsStore
&
ConditionsStore::instance
() {
16
static
ConditionsStore
store{};
17
return
store;
18
}
19
20
void
ConditionsStore::declareKey
(
const
ConditionKey
&
key
) {
21
if
( std::get<1>(
m_requestedKeys
.emplace(
key
) ) ) {
22
std::cout
<<
"ConditionsStore: requested condition "
<<
key
<<
'\n'
;
23
}
24
}
25
26
const
ConditionsStore::ConditionContext
&
ConditionsStore::getConditionContext
(
const
EventContext
&
ctx
)
const
{
27
static
ConditionContext
current_iov = 0;
28
29
current_iov =
ctx
.evt() % 2;
30
return
current_iov;
31
}
32
33
const
std::any*
ConditionsStore::getConditionAny
(
const
ConditionKey
&
key
,
const
ConditionContext
&
ctx
)
const
{
34
auto
lg = std::scoped_lock{
m_storageMtx
};
35
if
(
m_storage
.
find
(
ctx
) ==
end
(
m_storage
) ) {
36
std::cout
<<
"ConditionsStore: first access to store "
<<
ctx
<<
'\n'
;
37
auto
& store =
m_storage
[
ctx
];
38
for
(
const
auto
&
key
:
m_requestedKeys
) {
39
std::cout
<<
"ConditionsStore: prepare condition "
<<
key
<<
'\n'
;
40
store.emplace(
key
,
ctx
);
41
}
42
}
else
{
43
std::cout
<<
"ConditionsStore: using existing store "
<<
ctx
<<
'\n'
;
44
}
45
return
&
m_storage
[
ctx
][
key
];
46
}
47
}
// namespace Gaudi::TestSuite::Conditions::details
Gaudi::TestSuite::Conditions::details::ConditionsStore::instance
static ConditionsStore & instance()
Definition:
Backend.cpp:15
std::string
STL class.
System.h
std::map::find
T find(T... args)
Gaudi::TestSuite::Conditions::details::ConditionsStore::getConditionContext
const ConditionContext & getConditionContext(const EventContext &ctx) const
Definition:
Backend.cpp:26
Gaudi::TestSuite::Conditions::details::ConditionsStore::declareKey
void declareKey(const ConditionKey &key)
Definition:
Backend.cpp:20
GaudiPython.Pythonizations.ctx
ctx
Definition:
Pythonizations.py:578
std::cout
Gaudi::TestSuite::Conditions::details::ConditionsStore::m_requestedKeys
std::set< ConditionKey > m_requestedKeys
Definition:
ConditionAccessorHolder.h:49
Gaudi::TestSuite::Conditions::details::ConditionsStore
Example class to implement an actual backend for Gaudi::TestSuite::Conditions::ConditionAccessorHolde...
Definition:
ConditionAccessorHolder.h:24
Gaudi::TestSuite::Conditions::details::ConditionsStore::ConditionContext
int ConditionContext
Definition:
ConditionAccessorHolder.h:26
Gaudi::TestSuite::Conditions::details::ConditionsStore::m_storage
IOVSlots m_storage
Definition:
ConditionAccessorHolder.h:48
ConditionAccessorHolder.h
EventContext
Definition:
EventContext.h:34
Gaudi::TestSuite::Conditions::details::ConditionsStore::m_storageMtx
std::mutex m_storageMtx
Definition:
ConditionAccessorHolder.h:47
IOTest.end
end
Definition:
IOTest.py:125
ProduceConsume.key
key
Definition:
ProduceConsume.py:84
Gaudi::TestSuite::Conditions::details
Definition:
ConditionAccessorHolder.h:22
Gaudi::TestSuite::Conditions::details::ConditionsStore::getConditionAny
const std::any * getConditionAny(const ConditionKey &key, const ConditionContext &ctx) const
Definition:
Backend.cpp:33
GaudiTestSuite
src
ConditionAccessor
Backend.cpp
Generated on Thu Dec 19 2024 15:35:06 for The Gaudi Framework by
1.8.18