|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef EVENTCONTAINERS_IDENTIFIABLECONTAINERMT_H
6 #define EVENTCONTAINERS_IDENTIFIABLECONTAINERMT_H
19 #include "Identifier/Identifier.h"
22 #include "GaudiKernel/DataObject.h"
48 #ifndef __cpp_lib_atomic_wait
59 IDC_WriteHandleBase::ReleaseLock();
109 return reinterpret_cast<const T*
>(
m_itr->second );
113 return reinterpret_cast<const T*
>(
m_itr->second );
164 return m_link->indexFind(hashId);
201 virtual void cleanup() override final;
205 return m_link->fullSize();
210 return m_link->fullSize();
217 return IdentifiableContainerBase::numberOfCollections();
223 return reinterpret_cast<const std::vector < EventContainers::hashPair<T>
>&>
224 (
m_link->getAllHashPtrPair());
232 return IdentifiableContainerBase::GetAllCurrentHashes();
264 return reinterpret_cast<T*
>(m_link->removeCollection(hashId));
277 IdentifiableContainerBase(maxHash,
mode)
294 return reinterpret_cast<const T*
> (IdentifiableContainerBase::indexFindPtr(hashId));
303 if (
ATH_UNLIKELY(! IdentifiableContainerBase::insert(hashId, coll)))
return StatusCode::FAILURE;
304 return StatusCode::SUCCESS;
321 return IdentifiableContainerBase::fetchOrCreate(hashId);
328 return IdentifiableContainerBase::fetchOrCreate(hashIds);
336 return IdentifiableContainerBase::tryAddFromCache(hashId);
343 if(
ATH_UNLIKELY(m_OnlineMode))
return StatusCode::FAILURE;
345 auto p =
reinterpret_cast<const T*
> (m_link->findIndexPtr(hashId));
346 collToRetrieve =
const_cast<T*
>(
p);
347 return StatusCode::SUCCESS;
355 if(
ATH_UNLIKELY(hashId >= m_link->fullSize()))
return StatusCode::FAILURE;
356 auto ptr = uptr.release();
357 bool b = IdentifiableContainerBase::insert(hashId,
ptr);
359 return StatusCode::SUCCESS;
366 if(
ATH_UNLIKELY(hashId >= m_link->fullSize()))
return StatusCode::FAILURE;
367 auto ptr = uptr.release();
368 bool b = IdentifiableContainerBase::insert(hashId,
ptr);
370 return StatusCode::SUCCESS;
377 return m_link->addLock(hashId,
ptr.release());
384 if(
ATH_UNLIKELY(hashId >= m_link->fullSize()))
return StatusCode::FAILURE;
385 auto ptr = uptr.release();
386 bool b = IdentifiableContainerBase::insert(hashId,
ptr);
389 return StatusCode::SUCCESS;
IDC_WriteHandle & operator=(const IDC_WriteHandle &other)=delete
~IdentifiableContainerMT()
IdentifiableContainerMT< T > * m_IDC_ptr
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
const_iterator()
iterator constructor
IDC_WriteHandle & operator=(IDC_WriteHandle &&other) noexcept=delete
bool operator==(const const_iterator &it) const
comparison operator
bool OnlineAndPresentInAnotherView()
This method is to avoid calling an expensive operation in the offline case.
size_t size() const
Duplicate of fullSize for backwards compatability.
const_iterator(const const_iterator &)=default
std::vector< std::atomic< const void * > >::size_type size_type
IdentifiableContainerMT< T > MyType
bool const RAWDATA *ch2 const
bool operator!=(const const_iterator &it) const
comparison operator
const_iterator(EventContainers::I_InternalIDC::InternalConstItr itr)
bool empty() const
return true if container is empty
const_iterator & operator=(const const_iterator &)=default
virtual bool hasExternalCache() const override final
IDC_WriteHandle(IDC_WriteHandle &&other)
EventContainers::IdentifiableCache< T > ICACHE
std::unique_ptr< I_InternalIDC > m_link
virtual size_t numberOfCollections() const override final
return number of collections
const T * operator*() const
virtual std::vector< IdentifierHash > GetAllCurrentHashes() const override final
Returns a collection of all hashes availiable in this IDC.
virtual StatusCode addOrDelete(std::unique_ptr< T >, IdentifierHash hashId) override final
Tries to add the item to the cache, if the item already exists then it is deleted This is a convenien...
StatusCode addLock(std::unique_ptr< T > ptr, IdentifierHash hashId)
Like the other add methods but optimized for changing from the inprogress state.
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual size_t fullSize() const override final
return full size of container
virtual bool tryAddFromCache(IdentifierHash hashId) override final
Looks in the cache to see if item already exists if not it returns false, If it does exist it incorpo...
const_iterator indexFind(IdentifierHash hashId) const
const_iterator end() const
return const_iterator for end of container
T * removeCollection(IdentifierHash hashId)
remove collection from container for id hash, returning it (and ownership) to client
const_iterator begin() const
return const_iterator for first entry
IdentifierHash hashId() const
hashId of the pointed-to element
T *const & const_reference
StatusCode addOrDelete(std::unique_ptr< T > ptr)
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
virtual StatusCode naughtyRetrieve(IdentifierHash hashId, T *&collToRetrieve) const =0
const T * operator->() const
StatusCode fetchOrCreate(IdentifierHash hashId)
Tries will look for item in cache, if it doesn't exist will call the cache IMAKER If cache doesn't ha...
IDC_WriteHandle(const IDC_WriteHandle &other)=delete
static void Swap(IDC_WriteHandle &a, IDC_WriteHandle &b) noexcept
const std::vector< EventContainers::hashPair< T > > & GetAllHashPtrPair() const
EventContainers::I_InternalIDC::InternalConstItr m_itr
virtual StatusCode addOrDelete(std::unique_ptr< const T >, IdentifierHash hashId) override final
virtual StatusCode naughtyRetrieve ATLAS_NOT_THREAD_SAFE(IdentifierHash hashId, T *&collToRetrieve) const override final
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
IdentifiableContainerMT(IdentifierHash hashMax)
constructor initializes the collection the hashmax, OFFLINE usages pattern
const_iterator & operator++()
increment operator
const_iterator(const_iterator &&)=default
std::vector< hashPair >::const_iterator InternalConstItr
virtual void cleanup() override final
reset m_hashids and call IdentifiableCache's cleanup
~const_iterator()=default