ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
EventContainers::InternalOffline Class Referencefinal

#include <InternalOffline.h>

Inheritance diagram for EventContainers::InternalOffline:
Collaboration diagram for EventContainers::InternalOffline:

Public Types

typedef EventContainers::hashPair< void > hashPair
 
typedef std::vector< hashPair >::const_iterator InternalConstItr
 

Public Member Functions

 InternalOffline (size_t max)
 
virtual ~InternalOffline ()=default
 
virtual InternalConstItr cbegin () const override
 
virtual InternalConstItr cend () const override
 
virtual InternalConstItr indexFind (IdentifierHash hashId) const override
 
virtual const std::vector< hashPair > & getAllHashPtrPair () const override
 
virtual bool tryAddFromCache (IdentifierHash hashId, EventContainers::IDC_WriteHandleBase &lock) override
 
virtual bool tryAddFromCache (IdentifierHash hashId) override
 
virtual void wait () const override
 
virtual std::vector< IdentifierHashgetAllCurrentHashes () const override
 
virtual size_t numberOfCollections () const override
 
virtual void cleanUp (deleter_f *deleter) noexcept override
 
virtual size_t fullSize () const noexcept override
 
virtual StatusCode fetchOrCreate (IdentifierHash hashId) override
 
virtual StatusCode fetchOrCreate (const std::vector< IdentifierHash > &hashIds) override
 
virtual bool insert (IdentifierHash hashId, const void *ptr) override
 
virtual const void * findIndexPtr (IdentifierHash hashId) const noexcept override
 
virtual StatusCode addLock (IdentifierHash hashId, const void *ptr) override
 
virtual void * removeCollection (IdentifierHash hashId) override
 
virtual void destructor (deleter_f *) noexcept override
 

Private Attributes

std::vector< I_InternalIDC::hashPairm_map
 
size_t m_maximumSize
 

Detailed Description

Definition at line 18 of file InternalOffline.h.

Member Typedef Documentation

◆ hashPair

Definition at line 36 of file I_InternalIDC.h.

◆ InternalConstItr

typedef std::vector< hashPair >::const_iterator EventContainers::I_InternalIDC::InternalConstItr
inherited

Definition at line 37 of file I_InternalIDC.h.

Constructor & Destructor Documentation

◆ InternalOffline()

InternalOffline::InternalOffline ( size_t  max)

Definition at line 12 of file InternalOffline.cxx.

12  : m_maximumSize(max) {
13  //Check optimization assumptions
18 }

◆ ~InternalOffline()

virtual EventContainers::InternalOffline::~InternalOffline ( )
virtualdefault

Member Function Documentation

◆ addLock()

StatusCode InternalOffline::addLock ( IdentifierHash  hashId,
const void *  ptr 
)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 91 of file InternalOffline.cxx.

91  {
92  bool added = insert(hashId, ptr);
93  if(ATH_UNLIKELY(!added)) {
94  throw std::runtime_error("IDC WARNING Deletion shouldn't occur in addLock paradigm");
95  }
96  return StatusCode::SUCCESS;
97 }

◆ cbegin()

InternalConstItr InternalOffline::cbegin ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 51 of file InternalOffline.cxx.

51  {
52  return m_map.cbegin();
53 }

◆ cend()

InternalConstItr InternalOffline::cend ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 44 of file InternalOffline.cxx.

44  {
45  return m_map.cend();
46 }

◆ cleanUp()

void InternalOffline::cleanUp ( deleter_f deleter)
overridevirtualnoexcept

Implements EventContainers::I_InternalIDC.

Definition at line 66 of file InternalOffline.cxx.

66  {
67  for(const auto& x : m_map) deleter(x.second);
68  m_map.clear();
69 }

◆ destructor()

void InternalOffline::destructor ( deleter_f deleter)
overridevirtualnoexcept

Implements EventContainers::I_InternalIDC.

Definition at line 115 of file InternalOffline.cxx.

115  {
116  for(const auto& x : m_map) deleter(x.second);
117 }

◆ fetchOrCreate() [1/2]

StatusCode InternalOffline::fetchOrCreate ( const std::vector< IdentifierHash > &  hashIds)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 110 of file InternalOffline.cxx.

111 {
112  throw std::runtime_error("Not implemented in offline mode");
113 }

◆ fetchOrCreate() [2/2]

StatusCode InternalOffline::fetchOrCreate ( IdentifierHash  hashId)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 107 of file InternalOffline.cxx.

107  {
108  throw std::runtime_error("Not implemented in offline mode");
109 }

◆ findIndexPtr()

const void * InternalOffline::findIndexPtr ( IdentifierHash  hashId) const
overridevirtualnoexcept

Implements EventContainers::I_InternalIDC.

Definition at line 85 of file InternalOffline.cxx.

85  {
86  auto itr = indexFind(hashId);
87  if(itr != m_map.end()) return itr->second;
88  return nullptr;
89 }

◆ fullSize()

virtual size_t EventContainers::InternalOffline::fullSize ( ) const
inlineoverridevirtualnoexcept

Implements EventContainers::I_InternalIDC.

Definition at line 32 of file InternalOffline.h.

32 {return m_maximumSize;}

◆ getAllCurrentHashes()

std::vector< IdentifierHash > InternalOffline::getAllCurrentHashes ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 34 of file InternalOffline.cxx.

34  {
35  std::vector<IdentifierHash> ids;
36  ids.reserve(m_map.size());
37  for(auto &x : m_map) {
38  ids.emplace_back(x.first);
39  }
40  return ids;
41 }

◆ getAllHashPtrPair()

const std::vector< I_InternalIDC::hashPair > & InternalOffline::getAllHashPtrPair ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 48 of file InternalOffline.cxx.

48 { return m_map; }

◆ indexFind()

InternalConstItr InternalOffline::indexFind ( IdentifierHash  hashId) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 55 of file InternalOffline.cxx.

55  {
56  auto itr = std::lower_bound( m_map.cbegin(), m_map.cend(), hashId.value(), [](const hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } );
57  if(itr!= m_map.cend() && itr->first==hashId) return itr;
58  return m_map.cend();
59 // return std::find_if(m_map.begin(), m_map.end(), [hashId](const hashPair &lhs) -> bool { return lhs.first == hashId; });
60 }

◆ insert()

bool InternalOffline::insert ( IdentifierHash  hashId,
const void *  ptr 
)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 71 of file InternalOffline.cxx.

71  {
72  if(m_map.empty() || m_map.back().first < hashId){
73  m_map.emplace_back(hashId, ptr);
74  return true;
75  }
76  auto itr = std::lower_bound( m_map.begin(), m_map.end(), hashId.value(), [](const hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } );
77  if(itr == std::end(m_map) || itr->first != hashId)
78  {
79  m_map.emplace(itr, hashId, ptr);
80  return true;
81  }
82  return false;
83 }

◆ numberOfCollections()

size_t InternalOffline::numberOfCollections ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 62 of file InternalOffline.cxx.

62  {
63  return m_map.size();
64 }

◆ removeCollection()

void * InternalOffline::removeCollection ( IdentifierHash  hashId)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 99 of file InternalOffline.cxx.

99  {
100  auto itr = std::lower_bound( m_map.begin(), m_map.end(), hashId.value(), [](hashPair &lhs, IdentifierHash::value_type rhs) -> bool { return lhs.first < rhs; } );
101  if(itr== m_map.end() || itr->first!=hashId) return nullptr;
102  void* ptr = const_cast< void* > (itr->second);
103  m_map.erase(itr);
104  return ptr;
105 }

◆ tryAddFromCache() [1/2]

bool InternalOffline::tryAddFromCache ( IdentifierHash  hashId)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 25 of file InternalOffline.cxx.

26 {
27  return indexFind(hash) != m_map.cend();//No Cache in offline mode
28 }

◆ tryAddFromCache() [2/2]

bool InternalOffline::tryAddFromCache ( IdentifierHash  hashId,
EventContainers::IDC_WriteHandleBase lock 
)
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 21 of file InternalOffline.cxx.

21  {
22  return indexFind(hash) != m_map.cend();//No Cache in offline mode
23 }

◆ wait()

void InternalOffline::wait ( ) const
overridevirtual

Implements EventContainers::I_InternalIDC.

Definition at line 30 of file InternalOffline.cxx.

30  {
31  //No need to wait in offline, deliberately empty method
32 }

Member Data Documentation

◆ m_map

std::vector<I_InternalIDC::hashPair> EventContainers::InternalOffline::m_map
private

Definition at line 41 of file InternalOffline.h.

◆ m_maximumSize

size_t EventContainers::InternalOffline::m_maximumSize
private

Definition at line 42 of file InternalOffline.h.


The documentation for this class was generated from the following files:
max
#define max(a, b)
Definition: cfImp.cxx:41
athena.value
value
Definition: athena.py:124
IdentifierHash::value_type
unsigned int value_type
Definition: IdentifierHash.h:27
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
EventContainers::hashPair
Definition: I_InternalIDC.h:25
x
#define x
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
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::indexFind
virtual InternalConstItr indexFind(IdentifierHash hashId) const override
Definition: InternalOffline.cxx:55
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
EventContainers::InternalOffline::m_map
std::vector< I_InternalIDC::hashPair > m_map
Definition: InternalOffline.h:41