ATLAS Offline Software
Loading...
Searching...
No Matches
IdentifiableContainerMT< T >::IDC_WriteHandle Class Reference

#include <IdentifiableContainerMT.h>

Inheritance diagram for IdentifiableContainerMT< T >::IDC_WriteHandle:
Collaboration diagram for IdentifiableContainerMT< T >::IDC_WriteHandle:

Public Member Functions

 IDC_WriteHandle ()
IDC_WriteHandleoperator= (const IDC_WriteHandle &other)=delete
 IDC_WriteHandle (const IDC_WriteHandle &other)=delete
IDC_WriteHandleoperator= (IDC_WriteHandle &&other) noexcept=delete
 IDC_WriteHandle (IDC_WriteHandle &&other)
StatusCode addOrDelete (std::unique_ptr< T > ptr)
bool alreadyPresent ()
bool OnlineAndPresentInAnotherView ()
 This method is to avoid calling an expensive operation in the offline case.

Static Public Member Functions

static void Swap (IDC_WriteHandle &a, IDC_WriteHandle &b) noexcept

Private Member Functions

void LockOn (std::atomic< const void * > *in) noexcept
void DropLock () noexcept
void ReleaseLock ()

Private Attributes

IdentifiableContainerMT< T > * m_IDC_ptr
IdentifierHash m_hashId
std::atomic< const void * > * m_atomic

Friends

class IdentifiableContainerMT< T >

Detailed Description

template<class T>
class IdentifiableContainerMT< T >::IDC_WriteHandle

Definition at line 35 of file IdentifiableContainerMT.h.

Constructor & Destructor Documentation

◆ IDC_WriteHandle() [1/3]

template<class T>
IdentifiableContainerMT< T >::IDC_WriteHandle::IDC_WriteHandle ( )
inline

◆ IDC_WriteHandle() [2/3]

template<class T>
IdentifiableContainerMT< T >::IDC_WriteHandle::IDC_WriteHandle ( const IDC_WriteHandle & other)
delete

◆ IDC_WriteHandle() [3/3]

template<class T>
IdentifiableContainerMT< T >::IDC_WriteHandle::IDC_WriteHandle ( IDC_WriteHandle && other)
inline

Member Function Documentation

◆ addOrDelete()

template<class T>
StatusCode IdentifiableContainerMT< T >::IDC_WriteHandle::addOrDelete ( std::unique_ptr< T > ptr)
inlinenodiscard

Definition at line 54 of file IdentifiableContainerMT.h.

54 {
55 if(ATH_UNLIKELY(m_hashId >= m_IDC_ptr->m_link->fullSize())) return StatusCode::FAILURE;
58 return sc;
59 }
#define ATH_UNLIKELY(x)

◆ alreadyPresent()

template<class T>
bool IdentifiableContainerMT< T >::IDC_WriteHandle::alreadyPresent ( )
inline

Definition at line 60 of file IdentifiableContainerMT.h.

60{ return m_IDC_ptr->m_link->tryAddFromCache(m_hashId, *this); }

◆ DropLock()

void IDC_WriteHandleBase::DropLock ( )
noexceptinherited

Definition at line 36 of file IDC_WriteHandleBase.cxx.

36 {
37 m_atomic = nullptr;
38}
std::atomic< const void * > * m_atomic

◆ LockOn()

void EventContainers::IDC_WriteHandleBase::LockOn ( std::atomic< const void * > * in)
inlinenoexceptinherited

Definition at line 21 of file IDC_WriteHandleBase.h.

21 {
22 m_atomic = in;
23 }

◆ OnlineAndPresentInAnotherView()

template<class T>
bool IdentifiableContainerMT< T >::IDC_WriteHandle::OnlineAndPresentInAnotherView ( )
inline

This method is to avoid calling an expensive operation in the offline case.

Definition at line 62 of file IdentifiableContainerMT.h.

62{ return m_IDC_ptr->m_OnlineMode && m_IDC_ptr->m_link->tryAddFromCache(m_hashId, *this); }

◆ operator=() [1/2]

template<class T>
IDC_WriteHandle & IdentifiableContainerMT< T >::IDC_WriteHandle::operator= ( const IDC_WriteHandle & other)
delete

◆ operator=() [2/2]

template<class T>
IDC_WriteHandle & IdentifiableContainerMT< T >::IDC_WriteHandle::operator= ( IDC_WriteHandle && other)
deletenoexcept

◆ ReleaseLock()

void IDC_WriteHandleBase::ReleaseLock ( )
inherited

Definition at line 17 of file IDC_WriteHandleBase.cxx.

17 {
18 if(m_atomic==nullptr) return;
19//Convenience declarations
20 const void* waitstate = std::bit_cast<const void*>(IdentifiableCacheBase::INVALIDflag);
21 const void* ABORTstate = std::bit_cast<const void*>(IdentifiableCacheBase::ABORTEDflag);
22
23//Running code
24 assert(m_atomic->load() != ABORTstate);
25 //If you have got here the ptr was not set so creation is being aborted
26 //The hash is being set to the aborted flag
27 //I think memory ordering can be relaxed here but to be safe we will use defaults.
28 m_atomic->compare_exchange_strong(waitstate, ABORTstate);
29 //Notify_all to wake up any threads waiting for this hash
30 m_atomic->notify_all();
31
32 m_atomic = nullptr;
33}

◆ Swap()

template<class T>
void IdentifiableContainerMT< T >::IDC_WriteHandle::Swap ( IDC_WriteHandle & a,
IDC_WriteHandle & b )
inlinestaticnoexcept

Definition at line 44 of file IdentifiableContainerMT.h.

44 {
45 if(&a == &b) return;
46 std::swap(a.m_IDC_ptr, b.m_IDC_ptr);
47 std::swap(a.m_hashId, b.m_hashId);
48 std::swap(a.m_atomic, b.m_atomic);
49 }
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)

◆ IdentifiableContainerMT< T >

template<class T>
friend class IdentifiableContainerMT< T >
friend

Definition at line 249 of file IdentifiableContainerMT.h.

Member Data Documentation

◆ m_atomic

std::atomic<const void*>* EventContainers::IDC_WriteHandleBase::m_atomic
protectedinherited

Definition at line 15 of file IDC_WriteHandleBase.h.

◆ m_hashId

template<class T>
IdentifierHash IdentifiableContainerMT< T >::IDC_WriteHandle::m_hashId
private

Definition at line 38 of file IdentifiableContainerMT.h.

◆ m_IDC_ptr

template<class T>
IdentifiableContainerMT<T>* IdentifiableContainerMT< T >::IDC_WriteHandle::m_IDC_ptr
private

Definition at line 37 of file IdentifiableContainerMT.h.


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