ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaRoot
RootAuxDynIO
src
RootAuxDynStore.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AthContainers/exceptions.h
"
6
#include "
AthContainersInterfaces/IAuxTypeVector.h
"
7
#include "GaudiKernel/ThreadLocalContext.h"
8
9
#include "
RootAuxDynStore.h
"
10
#include "
RootAuxDynReader.h
"
11
12
13
RootAuxDynStore::RootAuxDynStore
(
RootAuxDynReader
& reader,
14
long
long
entry,
bool
standalone, std::recursive_mutex* iomtx)
15
:
SG
::AuxStoreInternal( standalone ),
16
m_entry
(entry),
17
m_ctx
(
Gaudi
::Hive::currentContext()),
18
m_iomutex
(iomtx)
19
{
20
for
(
auto
id
: reader.auxIDs() ) {
21
addAuxID(id);
22
}
23
lock
();
24
}
25
26
27
const
void
*
RootAuxDynStore::getData
(
SG::auxid_t
auxid)
const
28
{
29
const
SG::IAuxTypeVector
* v =
getVector
( auxid );
30
if
( v ) {
31
return
v->toPtr();
32
}
33
return
nullptr
;
34
}
35
36
37
const
SG::IAuxTypeVector
*
RootAuxDynStore::getVector
(
SG::auxid_t
auxid)
const
38
{
39
guard_t
guard (
m_mutex
);
40
// lock
41
const
SG::IAuxTypeVector
* ret = SG::AuxStoreInternal::getVector (auxid);
42
if
(!ret) {
43
auto
this_nc
ATLAS_THREAD_SAFE
=
const_cast<
RootAuxDynStore
*
>
(
this
);
// locked above
44
if
( this_nc->readData(auxid) ) {
45
ret = SG::AuxStoreInternal::getVector (auxid);
46
}
47
}
48
return
ret;
49
}
50
51
52
void
*
RootAuxDynStore::getData
(
SG::auxid_t
/*auxid*/
,
size_t
/*size*/
,
size_t
/*capacity*/
)
53
{
54
// MN: how do we add new attributes to this store? A:for now we don't
55
throw
(
"Non-const access to RootAuxDynStore is not supported"
);
56
}
57
58
59
const
void
*
RootAuxDynStore::getIOData
(
SG::auxid_t
auxid)
const
60
{
61
guard_t
guard (
m_mutex
);
62
const
void
* ret = SG::AuxStoreInternal::getIODataInternal (auxid,
true
);
63
if
(!ret) {
64
auto
this_nc
ATLAS_THREAD_SAFE
=
const_cast<
RootAuxDynStore
*
>
(
this
);
// locked above
65
if
( this_nc->readData(auxid) ) {
66
ret = SG::AuxStoreInternal::getIOData (auxid);
67
}
68
}
69
return
ret;
70
}
71
88
void
*
89
RootAuxDynStore::getDecoration
(
SG::auxid_t
auxid,
size_t
size
,
size_t
capacity)
90
{
91
guard_t
guard (
m_mutex
);
92
if
(SG::AuxStoreInternal::getIODataInternal (auxid,
true
) == 0 &&
93
SG::AuxStoreInternal::getAuxIDs().
count
(auxid) > 0)
94
{
95
throw
SG::ExcStoreLocked
(auxid);
96
}
97
return
SG::AuxStoreInternal::getDecoration (auxid,
size
, capacity);
98
}
99
100
107
bool
RootAuxDynStore::isDecoration
(
SG::auxid_t
auxid)
const
108
{
109
guard_t
guard(
m_mutex
);
110
if
(SG::AuxStoreInternal::getIODataInternal (auxid,
true
) == 0 &&
111
SG::AuxStoreInternal::getAuxIDs().
count
(auxid) > 0)
112
{
113
return
false
;
114
}
115
return
SG::AuxStoreInternal::isDecoration (auxid);
116
}
117
123
size_t
RootAuxDynStore::size
()
const
124
{
125
const
std::size_t s = SG::AuxStoreInternal::size();
126
if
( s != 0 ) {
127
return
s;
128
}
129
130
for
(
SG::auxid_t
id
: getAuxIDs() ) {
131
if
(
getData
(
id
) !=
nullptr
) {
132
return
SG::AuxStoreInternal::size();
133
}
134
}
135
136
return
0;
137
}
exceptions.h
Exceptions that can be thrown from AthContainers.
IAuxTypeVector.h
Abstract interface for manipulating vectors of arbitrary types.
lock
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
RootAuxDynReader.h
RootAuxDynStore.h
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
RootAuxDynReader
Definition
RootAuxDynReader.h:14
RootAuxDynStore::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition
RootAuxDynStore.h:71
RootAuxDynStore::RootAuxDynStore
RootAuxDynStore(RootAuxDynReader &reader, long long entry, bool standalone, std::recursive_mutex *iomtx=nullptr)
Definition
RootAuxDynStore.cxx:13
RootAuxDynStore::getIOData
virtual const void * getIOData(SG::auxid_t auxid) const override
implementation of the IAuxStoreIO interface
Definition
RootAuxDynStore.cxx:59
RootAuxDynStore::getData
virtual const void * getData(SG::auxid_t auxid) const override
implementation of the IAuxStore interface
Definition
RootAuxDynStore.cxx:27
RootAuxDynStore::getDecoration
virtual void * getDecoration(SG::auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
Definition
RootAuxDynStore.cxx:89
RootAuxDynStore::size
virtual size_t size() const override
Return the number of elements in the store.
Definition
RootAuxDynStore.cxx:123
RootAuxDynStore::m_iomutex
std::recursive_mutex * m_iomutex
Optional mutex used to serialize I/O with RootStorageSvc (not owned).
Definition
RootAuxDynStore.h:75
RootAuxDynStore::m_entry
long long m_entry
Definition
RootAuxDynStore.h:64
RootAuxDynStore::m_ctx
EventContext m_ctx
Event context associated with the event store.
Definition
RootAuxDynStore.h:67
RootAuxDynStore::isDecoration
virtual bool isDecoration(SG::auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
Definition
RootAuxDynStore.cxx:107
RootAuxDynStore::getVector
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Definition
RootAuxDynStore.cxx:37
RootAuxDynStore::m_mutex
mutex_t m_mutex
Definition
RootAuxDynStore.h:72
SG::ExcStoreLocked
Exception — Attempted to modify auxiliary data in a locked store.
Definition
Control/AthContainers/AthContainers/exceptions.h:183
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition
IAuxTypeVector.h:45
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
Gaudi
=============================================================================
Definition
CaloGPUClusterAndCellDataMonitorOptions.h:273
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition
AuxTypes.h:27
Generated on
for ATLAS Offline Software by
1.17.0