ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8#include "RootAuxDynStore.h"
9#include "RootAuxDynReader.h"
10
11
13 long long entry, bool standalone, std::recursive_mutex* iomtx)
15 m_entry(entry),
16 m_iomutex(iomtx)
17{
18 for( auto id : reader.auxIDs() ) {
19 addAuxID(id);
20 }
21 lock();
22}
23
24
25const void* RootAuxDynStore::getData(SG::auxid_t auxid) const
26{
27 const SG::IAuxTypeVector* v = getVector( auxid );
28 if( v ) {
29 return v->toPtr();
30 }
31 return nullptr;
32}
33
34
36{
37 guard_t guard (m_mutex);
38 // lock
40 if (!ret) {
41 auto this_nc ATLAS_THREAD_SAFE = const_cast<RootAuxDynStore*>(this); // locked above
42 if( this_nc->readData(auxid) ) {
44 }
45 }
46 return ret;
47}
48
49
50void* RootAuxDynStore::getData(SG::auxid_t /*auxid*/, size_t /*size*/, size_t /*capacity*/)
51{
52 // MN: how do we add new attributes to this store? A:for now we don't
53 throw("Non-const access to RootAuxDynStore is not supported");
54}
55
56
58{
59 guard_t guard (m_mutex);
60 const void* ret = SG::AuxStoreInternal::getIODataInternal (auxid, true);
61 if (!ret) {
62 auto this_nc ATLAS_THREAD_SAFE = const_cast<RootAuxDynStore*>(this); // locked above
63 if( this_nc->readData(auxid) ) {
65 }
66 }
67 return ret;
68}
69
86void*
87RootAuxDynStore::getDecoration (SG::auxid_t auxid, size_t size, size_t capacity)
88{
89 guard_t guard (m_mutex);
90 if (SG::AuxStoreInternal::getIODataInternal (auxid, true) == 0 &&
92 {
93 throw SG::ExcStoreLocked (auxid);
94 }
95 return SG::AuxStoreInternal::getDecoration (auxid, size, capacity);
96}
97
98
106{
107 guard_t guard( m_mutex );
108 if (SG::AuxStoreInternal::getIODataInternal (auxid, true) == 0 &&
110 {
111 return false;
112 }
114}
115
122{
123 const std::size_t s = SG::AuxStoreInternal::size();
124 if( s != 0 ) {
125 return s;
126 }
127
128 for( SG::auxid_t id : getAuxIDs() ) {
129 if( getData( id ) != nullptr ) {
131 }
132 }
133
134 return 0;
135}
Exceptions that can be thrown from AthContainers.
Abstract interface for manipulating vectors of arbitrary types.
#define ATLAS_THREAD_SAFE
AthContainers_detail::lock_guard< mutex_t > guard_t
RootAuxDynStore(RootAuxDynReader &reader, long long entry, bool standalone, std::recursive_mutex *iomtx=nullptr)
virtual const void * getIOData(SG::auxid_t auxid) const override
implementation of the IAuxStoreIO interface
virtual const void * getData(SG::auxid_t auxid) const override
implementation of the IAuxStore interface
virtual void * getDecoration(SG::auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
virtual size_t size() const override
Return the number of elements in the store.
std::recursive_mutex * m_iomutex
Optional mutex used to serialize I/O with RootStorageSvc (not owned)
virtual bool isDecoration(SG::auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
bool standalone() const
Return the standalone flag.
const void * getIODataInternal(auxid_t auxid, bool quiet) const
Return a pointer to the data to be stored for one aux data item.
virtual const SG::auxid_set_t & getAuxIDs() const override
Return a set of identifiers for existing data items in this store.
virtual bool isDecoration(auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
virtual size_t size() const override
Return the number of elements in the store.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
virtual void lock() override
Lock the container.
AuxStoreInternal(bool standalone=false)
Constructor.
virtual const void * getIOData(SG::auxid_t auxid) const override
Return a pointer to the data to be stored for one aux data item.
Exception — Attempted to modify auxiliary data in a locked store.
Abstract interface for manipulating vectors of arbitrary types.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Forward declaration.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27