ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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. More...
 

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 34 of file IdentifiableContainerMT.h.

Constructor & Destructor Documentation

◆ IDC_WriteHandle() [1/3]

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

Definition at line 39 of file IdentifiableContainerMT.h.

◆ 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

Definition at line 49 of file IdentifiableContainerMT.h.

49  : IDC_WriteHandle() {
50  Swap(*this, other);
51  }

Member Function Documentation

◆ addOrDelete()

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

Definition at line 53 of file IdentifiableContainerMT.h.

53  {
54  if(ATH_UNLIKELY(m_hashId >= m_IDC_ptr->m_link->fullSize())) return StatusCode::FAILURE;
55  StatusCode sc = m_IDC_ptr->addLock(std::move(ptr), m_hashId);
56  IDC_WriteHandleBase::ReleaseLock();
57  return sc;
58  }

◆ alreadyPresent()

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

Definition at line 59 of file IdentifiableContainerMT.h.

59 { 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 }

◆ 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 61 of file IdentifiableContainerMT.h.

61 { 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 = reinterpret_cast<const void*>(IdentifiableCacheBase::INVALIDflag);
21  const void* ABORTstate = reinterpret_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 >
static void IdentifiableContainerMT< T >::IDC_WriteHandle::Swap ( IDC_WriteHandle a,
IDC_WriteHandle b 
)
inlinestaticnoexcept

Definition at line 43 of file IdentifiableContainerMT.h.

43  {
44  if(&a == &b) return;
45  std::swap(a.m_IDC_ptr, b.m_IDC_ptr);
46  std::swap(a.m_hashId, b.m_hashId);
47  std::swap(a.m_atomic, b.m_atomic);
48  }

Friends And Related Function Documentation

◆ IdentifiableContainerMT< T >

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

Definition at line 248 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 37 of file IdentifiableContainerMT.h.

◆ m_IDC_ptr

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

Definition at line 36 of file IdentifiableContainerMT.h.


The documentation for this class was generated from the following file:
IdentifiableContainerMT::IDC_WriteHandle::m_hashId
IdentifierHash m_hashId
Definition: IdentifiableContainerMT.h:37
EventContainers::IdentifiableCacheBase::ABORTEDflag
static constexpr uintptr_t ABORTEDflag
Definition: IdentifiableCacheBase.h:31
IdentifiableContainerMT::IDC_WriteHandle::m_IDC_ptr
IdentifiableContainerMT< T > * m_IDC_ptr
Definition: IdentifiableContainerMT.h:36
EventContainers::IDC_WriteHandleBase::IDC_WriteHandleBase
IDC_WriteHandleBase()
Definition: IDC_WriteHandleBase.h:17
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
EventContainers::IDC_WriteHandleBase::m_atomic
std::atomic< const void * > * m_atomic
Definition: IDC_WriteHandleBase.h:15
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
IdentifiableContainerMT::IDC_WriteHandle::Swap
static void Swap(IDC_WriteHandle &a, IDC_WriteHandle &b) noexcept
Definition: IdentifiableContainerMT.h:43
IdentifiableContainerMT::IDC_WriteHandle::IDC_WriteHandle
IDC_WriteHandle()
Definition: IdentifiableContainerMT.h:39
EventContainers::IdentifiableCacheBase::INVALIDflag
static constexpr uintptr_t INVALIDflag
Definition: IdentifiableCacheBase.h:30