ATLAS Offline Software
InternalOffline.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef EVENTCONTAINERS_INTERNALOFFLINE_H
6 #define EVENTCONTAINERS_INTERNALOFFLINE_H
8 
9 namespace EventContainers{
10 /*
11 This class implements the IdentifiableContainer code for the offline case.
12 To avoid excess memory usage just the key-value pair is stored and can be directly
13 iterated upon.
14 
15 Faster consecutive iteration, slower random access.
16 Prefer iteration over FindIndexPtr and indexFind
17 */
18 class InternalOffline final : public I_InternalIDC {
19 public:
20  InternalOffline(size_t max);
21  virtual ~InternalOffline()=default;
22  virtual InternalConstItr cbegin() const override;
23  virtual InternalConstItr cend() const override;
24  virtual InternalConstItr indexFind( IdentifierHash hashId ) const override;
25  virtual const std::vector < hashPair >& getAllHashPtrPair() const override;
26  virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override;
27  virtual bool tryAddFromCache(IdentifierHash hashId) override;
28  virtual void wait() const override;
29  virtual std::vector<IdentifierHash> getAllCurrentHashes() const override;
30  virtual size_t numberOfCollections() const override;
31  virtual void cleanUp(deleter_f* deleter) noexcept override;
32  virtual size_t fullSize() const noexcept override {return m_maximumSize;}
33  virtual StatusCode fetchOrCreate(IdentifierHash hashId) override;
34  virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) override;
35  virtual bool insert(IdentifierHash hashId, const void* ptr) override;
36  virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept override;
37  virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override;
38  virtual void* removeCollection( IdentifierHash hashId ) override;
39  virtual void destructor(deleter_f*) noexcept override;
40 private:
41  std::vector<I_InternalIDC::hashPair> m_map;
42  size_t m_maximumSize;
43 };
44 
45 }
46 #endif
EventContainers::InternalOffline::fullSize
virtual size_t fullSize() const noexcept override
Definition: InternalOffline.h:32
max
#define max(a, b)
Definition: cfImp.cxx:41
EventContainers::InternalOffline::cend
virtual InternalConstItr cend() const override
Definition: InternalOffline.cxx:44
EventContainers::InternalOffline::InternalOffline
InternalOffline(size_t max)
Definition: InternalOffline.cxx:12
EventContainers::InternalOffline::~InternalOffline
virtual ~InternalOffline()=default
EventContainers
Definition: T_AthenaPoolCreateFuncs.h:33
EventContainers::InternalOffline::fetchOrCreate
virtual StatusCode fetchOrCreate(IdentifierHash hashId) override
Definition: InternalOffline.cxx:107
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
EventContainers::InternalOffline::destructor
virtual void destructor(deleter_f *) noexcept override
Definition: InternalOffline.cxx:115
EventContainers::I_InternalIDC
Definition: I_InternalIDC.h:34
EventContainers::InternalOffline::numberOfCollections
virtual size_t numberOfCollections() const override
Definition: InternalOffline.cxx:62
EventContainers::InternalOffline::tryAddFromCache
virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override
Definition: InternalOffline.cxx:21
EventContainers::InternalOffline::insert
virtual bool insert(IdentifierHash hashId, const void *ptr) override
Definition: InternalOffline.cxx:71
EventContainers::InternalOffline::m_maximumSize
size_t m_maximumSize
Definition: InternalOffline.h:42
EventContainers::InternalOffline::cleanUp
virtual void cleanUp(deleter_f *deleter) noexcept override
Definition: InternalOffline.cxx:66
EventContainers::InternalOffline::addLock
virtual StatusCode addLock(IdentifierHash hashId, const void *ptr) override
Definition: InternalOffline.cxx:91
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
deleter_f
void deleter_f(const void *p)
Definition: deleter.h:12
EventContainers::InternalOffline::getAllCurrentHashes
virtual std::vector< IdentifierHash > getAllCurrentHashes() const override
Definition: InternalOffline.cxx:34
EventContainers::InternalOffline::wait
virtual void wait() const override
Definition: InternalOffline.cxx:30
EventContainers::InternalOffline::findIndexPtr
virtual const void * findIndexPtr(IdentifierHash hashId) const noexcept override
Definition: InternalOffline.cxx:85
EventContainers::InternalOffline::getAllHashPtrPair
virtual const std::vector< hashPair > & getAllHashPtrPair() const override
Definition: InternalOffline.cxx:48
EventContainers::InternalOffline::removeCollection
virtual void * removeCollection(IdentifierHash hashId) override
Definition: InternalOffline.cxx:99
EventContainers::InternalOffline::indexFind
virtual InternalConstItr indexFind(IdentifierHash hashId) const override
Definition: InternalOffline.cxx:55
EventContainers::InternalOffline::cbegin
virtual InternalConstItr cbegin() const override
Definition: InternalOffline.cxx:51
EventContainers::IDC_WriteHandleBase
Definition: IDC_WriteHandleBase.h:27
I_InternalIDC.h
EventContainers::InternalOffline
Definition: InternalOffline.h:18
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
EventContainers::InternalOffline::m_map
std::vector< I_InternalIDC::hashPair > m_map
Definition: InternalOffline.h:41
EventContainers::I_InternalIDC::InternalConstItr
std::vector< hashPair >::const_iterator InternalConstItr
Definition: I_InternalIDC.h:37