ATLAS Offline Software
Loading...
Searching...
No Matches
InternalOfflineFast.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_INTERNALOFFLINEFAST_H
6#define EVENTCONTAINERS_INTERNALOFFLINEFAST_H
9#include <atomic>
10#include <mutex>
11
12namespace EventContainers{
13/*
14This class implements the IdentifiableContainer code for the offline case.
15This class may use excess memory for fast random access purposes
16
17Fast random access.
18*/
19class InternalOfflineFast final : public I_InternalIDC {
20public:
22 virtual ~InternalOfflineFast()=default;
23 virtual InternalConstItr cbegin() const override;
24 virtual InternalConstItr cend() const override;
25 virtual InternalConstItr indexFind( IdentifierHash hashId ) const override;
26 virtual const std::vector < hashPair >& getAllHashPtrPair() const override;
27 virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override;
28 virtual bool tryAddFromCache(IdentifierHash hashId) override;
29 virtual void wait() const override;
30 virtual std::vector<IdentifierHash> getAllCurrentHashes() const override;
31 virtual size_t numberOfCollections() const override;
32 virtual void cleanUp(deleter_f* deleter) noexcept override;
33 virtual size_t fullSize() const noexcept override {return m_fullMap.size();}
34 virtual StatusCode fetchOrCreate(IdentifierHash hashId) override;
35 virtual StatusCode fetchOrCreate(const std::vector<IdentifierHash> &hashIds) override;
36 virtual bool insert(IdentifierHash hashId, const void* ptr) override;
37 virtual const void* findIndexPtr(IdentifierHash hashId) const noexcept override;
38 virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override;
39 virtual void* removeCollection( IdentifierHash hashId ) override;
40 virtual void destructor(deleter_f*) noexcept override;
41private:
42 mutable std::vector<I_InternalIDC::hashPair> m_map ATLAS_THREAD_SAFE;
43 std::vector<const void*> m_fullMap;
44 mutable std::mutex m_waitMutex ATLAS_THREAD_SAFE;
45 mutable std::atomic<bool> m_needsupdate ATLAS_THREAD_SAFE; //These mutables are carefully thought out, do not change
46};
47
48}
49#endif
#define max(a, b)
Definition cfImp.cxx:41
Define macros for attributes used to control the static checker.
std::vector< hashPair >::const_iterator InternalConstItr
void deleter_f(const void *p)
virtual bool insert(IdentifierHash hashId, const void *ptr) override
virtual InternalConstItr cend() const override
virtual const std::vector< hashPair > & getAllHashPtrPair() const override
virtual const void * findIndexPtr(IdentifierHash hashId) const noexcept override
virtual std::vector< IdentifierHash > getAllCurrentHashes() const override
virtual StatusCode fetchOrCreate(IdentifierHash hashId) override
virtual bool tryAddFromCache(IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override
virtual InternalConstItr cbegin() const override
virtual InternalConstItr indexFind(IdentifierHash hashId) const override
std::vector< const void * > m_fullMap
virtual void * removeCollection(IdentifierHash hashId) override
virtual void destructor(deleter_f *) noexcept override
virtual size_t numberOfCollections() const override
virtual size_t fullSize() const noexcept override
virtual void cleanUp(deleter_f *deleter) noexcept override
std::vector< I_InternalIDC::hashPair > m_map ATLAS_THREAD_SAFE
virtual StatusCode addLock(IdentifierHash hashId, const void *ptr) override
This is a "hash" representation of an Identifier.
void deleter_f(const void *p)
Definition deleter.h:13