ATLAS Offline Software
Loading...
Searching...
No Matches
RootAuxDynStore Class Referenceabstract

#include <RootAuxDynStore.h>

Inheritance diagram for RootAuxDynStore:
Collaboration diagram for RootAuxDynStore:

Public Member Functions

 RootAuxDynStore (RootAuxDynReader &reader, long long entry, bool standalone, std::recursive_mutex *iomtx=nullptr)
virtual ~RootAuxDynStore ()
virtual const void * getData (SG::auxid_t auxid) const override
 implementation of the IAuxStore interface
virtual const SG::IAuxTypeVectorgetVector (SG::auxid_t auxid) const override
virtual void * getData (SG::auxid_t auxid, size_t size, size_t capacity) override
virtual const void * getIOData (SG::auxid_t auxid) const override
 implementation of the IAuxStoreIO 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 bool isDecoration (SG::auxid_t auxid) const override
 Test if a particular variable is tagged as a decoration.
virtual size_t size () const override
 Return the number of elements in the store.

Protected Types

typedef AthContainers_detail::mutex mutex_t
 Mutex used to synchronize modifications to the cache vector.
typedef AthContainers_detail::lock_guard< mutex_tguard_t

Protected Member Functions

virtual bool readData (SG::auxid_t auxid)=0
 read data from ROOT and store it in m_vecs. Returns False on error

Protected Attributes

long long m_entry
mutex_t m_mutex
std::recursive_mutex * m_iomutex
 Optional mutex used to serialize I/O with RootStorageSvc (not owned).

Detailed Description

Definition at line 16 of file RootAuxDynStore.h.

Member Typedef Documentation

◆ guard_t

◆ mutex_t

Mutex used to synchronize modifications to the cache vector.

Definition at line 66 of file RootAuxDynStore.h.

Constructor & Destructor Documentation

◆ RootAuxDynStore()

RootAuxDynStore::RootAuxDynStore ( RootAuxDynReader & reader,
long long entry,
bool standalone,
std::recursive_mutex * iomtx = nullptr )

Definition at line 12 of file RootAuxDynStore.cxx.

14 : SG::AuxStoreInternal( standalone ),
15 m_entry(entry),
16 m_iomutex(iomtx)
17{
18 for( auto id : reader.auxIDs() ) {
19 addAuxID(id);
20 }
21 lock();
22}
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
std::recursive_mutex * m_iomutex
Optional mutex used to serialize I/O with RootStorageSvc (not owned).
void addAuxID(auxid_t auxid)
Add a new auxid to the set of those being managed by this store.
AuxStoreInternal(bool standalone=false)
An auxiliary data store that holds data internally.
reader
read the goodrunslist xml file(s)
Definition collisions.py:22

◆ ~RootAuxDynStore()

virtual RootAuxDynStore::~RootAuxDynStore ( )
inlinevirtual

Definition at line 22 of file RootAuxDynStore.h.

22{}

Member Function Documentation

◆ getData() [1/2]

const void * RootAuxDynStore::getData ( SG::auxid_t auxid) const
overridevirtual

implementation of the IAuxStore interface

Definition at line 25 of file RootAuxDynStore.cxx.

26{
27 const SG::IAuxTypeVector* v = getVector( auxid );
28 if( v ) {
29 return v->toPtr();
30 }
31 return nullptr;
32}
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override

◆ getData() [2/2]

void * RootAuxDynStore::getData ( SG::auxid_t auxid,
size_t size,
size_t capacity )
overridevirtual

Definition at line 50 of file RootAuxDynStore.cxx.

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}

◆ getDecoration()

void * RootAuxDynStore::getDecoration ( SG::auxid_t auxid,
size_t size,
size_t capacity )
overridevirtual

Return the data vector for one aux data decoration item.

Parameters
auxidThe identifier of the desired aux data item.
sizeThe current size of the container (in case the data item does not already exist).
capacityThe current capacity of the container (in case the data item does not already exist).
auxidThe identifier of the desired aux data item.
sizeThe current size of the container (in case the data item does not already exist).
capacityThe current capacity of the container (in case the data item does not already exist).

Each aux data item is stored as a vector, with one entry per entry in the owning container. This returns a pointer to the start of the vector.

The base class implementation works except for the case where we have not yet created a vector for an item in the root file. We need to detect that case and raise an exception.

Definition at line 87 of file RootAuxDynStore.cxx.

88{
89 guard_t guard (m_mutex);
90 if (SG::AuxStoreInternal::getIODataInternal (auxid, true) == 0 &&
91 SG::AuxStoreInternal::getAuxIDs().count (auxid) > 0)
92 {
93 throw SG::ExcStoreLocked (auxid);
94 }
95 return SG::AuxStoreInternal::getDecoration (auxid, size, capacity);
96}
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual size_t size() const override
Return the number of elements in the store.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148

◆ getIOData()

const void * RootAuxDynStore::getIOData ( SG::auxid_t auxid) const
overridevirtual

implementation of the IAuxStoreIO interface

Definition at line 57 of file RootAuxDynStore.cxx.

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) ) {
64 ret = SG::AuxStoreInternal::getIOData (auxid);
65 }
66 }
67 return ret;
68}
#define ATLAS_THREAD_SAFE
RootAuxDynStore(RootAuxDynReader &reader, long long entry, bool standalone, std::recursive_mutex *iomtx=nullptr)

◆ getVector()

const SG::IAuxTypeVector * RootAuxDynStore::getVector ( SG::auxid_t auxid) const
overridevirtual

Definition at line 35 of file RootAuxDynStore.cxx.

36{
37 guard_t guard (m_mutex);
38 // lock
39 const SG::IAuxTypeVector* ret = SG::AuxStoreInternal::getVector (auxid);
40 if (!ret) {
41 auto this_nc ATLAS_THREAD_SAFE = const_cast<RootAuxDynStore*>(this); // locked above
42 if( this_nc->readData(auxid) ) {
43 ret = SG::AuxStoreInternal::getVector (auxid);
44 }
45 }
46 return ret;
47}

◆ isDecoration()

bool RootAuxDynStore::isDecoration ( SG::auxid_t auxid) const
overridevirtual

Test if a particular variable is tagged as a decoration.

Parameters
auxidThe identifier of the desired aux data item.
auxidThe identifier of the desired aux data item.

See getDecoration() above.

Definition at line 105 of file RootAuxDynStore.cxx.

106{
107 guard_t guard( m_mutex );
108 if (SG::AuxStoreInternal::getIODataInternal (auxid, true) == 0 &&
109 SG::AuxStoreInternal::getAuxIDs().count (auxid) > 0)
110 {
111 return false;
112 }
113 return SG::AuxStoreInternal::isDecoration (auxid);
114}

◆ readData()

virtual bool RootAuxDynStore::readData ( SG::auxid_t auxid)
protectedpure virtual

read data from ROOT and store it in m_vecs. Returns False on error

Implemented in RNTupleAuxDynStore, and TBranchAuxDynStore.

◆ size()

size_t RootAuxDynStore::size ( ) const
overridevirtual

Return the number of elements in the store.

May return 0 for a store with no aux data.

NOTE: this method will attempt to read data if size unknown (0) May return 0 for a store with no aux data.

Definition at line 121 of file RootAuxDynStore.cxx.

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 ) {
130 return SG::AuxStoreInternal::size();
131 }
132 }
133
134 return 0;
135}
virtual const void * getData(SG::auxid_t auxid) const override
implementation of the IAuxStore interface
const SG::auxid_set_t & getAuxIDs() const
Return a set of identifiers for existing data items for this object.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

Member Data Documentation

◆ m_entry

long long RootAuxDynStore::m_entry
protected

Definition at line 63 of file RootAuxDynStore.h.

◆ m_iomutex

std::recursive_mutex* RootAuxDynStore::m_iomutex
protected

Optional mutex used to serialize I/O with RootStorageSvc (not owned).

Definition at line 71 of file RootAuxDynStore.h.

◆ m_mutex

mutex_t RootAuxDynStore::m_mutex
mutableprotected

Definition at line 68 of file RootAuxDynStore.h.


The documentation for this class was generated from the following files: