ATLAS Offline Software
Public Types | Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
IOVDbNamespace::IovStore Class Reference

#include <IovStore.h>

Collaboration diagram for IOVDbNamespace::IovStore:

Public Types

typedef std::pair< cool::ValidityKey, cool::ValidityKey > Iov_t
 

Public Member Functions

 IovStore ()
 Default constructor, cache bounds set to 0,0. More...
 
 IovStore (const Iov_t &cacheBounds)
 Constructor, cache bounds set to supplied parameter. More...
 
void addIov (const Iov_t &iov)
 Add an iov to the store and update the span variables. More...
 
void addIov (const cool::ValidityKey &since, const cool::ValidityKey &until)
 
Iov_t getCacheBounds () const
 Report the current cache bounds. More...
 
void setCacheBounds (const Iov_t &cacheBounds)
 Set the cache bound variables. More...
 
Iov_t getMinimumStraddlingSpan () const
 Get the minimum straddling span (max 'since' to min 'until') More...
 
void setIovSpan (const Iov_t &span)
 Set span. More...
 
std::vector< Iov_t > & vectorStore ()
 Return the internal vector store. More...
 
std::pair< unsigned int, unsigned int > numberOfIovsOnBoundaries () const
 Return the current count of added Iovs which straddled cache boundaries. More...
 
bool empty () const
 is the store empty? More...
 
unsigned int size () const
 length of store More...
 
void clear ()
 clear the store More...
 
Iov_t at (const unsigned int idx) const
 'at' to read iov at specific index More...
 
void extendIov (const unsigned int idx, const cool::ValidityKey &newUntilTime)
 Extend a specific iov at the index to a new 'until' time. More...
 
bool extendCacheLo ()
 Extend lower cache bound to the maximum 'since' time; return whether this changes its value. More...
 
bool extendCacheHi ()
 Extend upper cache bound to the minimum 'until' time; return whether this changes its value. More...
 

Static Private Member Functions

static std::pair< bool, bool > straddling (const Iov_t &iov, const Iov_t &bounds)
 

Private Attributes

std::vector< Iov_tm_iovs {}
 main vector of iovs More...
 
Iov_t m_cacheBounds {0,0}
 cache bounds, 'since', 'until', corresponds to m_cachestart, m_cachestop in original More...
 
cool::ValidityKey m_maxStraddlingSince {cool::ValidityKeyMin}
 max 'since' of the iovs which straddle the cache boundary, corresponds to 'm_boundmin' in the original code More...
 
cool::ValidityKey m_minStraddlingUntil {cool::ValidityKeyMax}
 min 'until' of the iovs which straddle the boundary corresponds to 'm_boundmax' in the original code More...
 
std::pair< unsigned int, unsigned int > m_countStraddling {}
 count of iovs straddling the since or until boundaries More...
 

Detailed Description

Definition at line 20 of file IovStore.h.

Member Typedef Documentation

◆ Iov_t

typedef std::pair<cool::ValidityKey, cool::ValidityKey> IOVDbNamespace::IovStore::Iov_t

Definition at line 22 of file IovStore.h.

Constructor & Destructor Documentation

◆ IovStore() [1/2]

IOVDbNamespace::IovStore::IovStore ( )
default

Default constructor, cache bounds set to 0,0.

◆ IovStore() [2/2]

IOVDbNamespace::IovStore::IovStore ( const Iov_t cacheBounds)

Constructor, cache bounds set to supplied parameter.

Definition at line 11 of file IovStore.cxx.

11  :m_cacheBounds(cacheBounds){
12  //
13  }

Member Function Documentation

◆ addIov() [1/2]

void IOVDbNamespace::IovStore::addIov ( const cool::ValidityKey &  since,
const cool::ValidityKey &  until 
)

Definition at line 25 of file IovStore.cxx.

25  {
27  }

◆ addIov() [2/2]

void IOVDbNamespace::IovStore::addIov ( const Iov_t iov)

Add an iov to the store and update the span variables.

Definition at line 16 of file IovStore.cxx.

16  {
17  m_iovs.push_back(iov);
18  const auto straddles = straddling(iov, m_cacheBounds);
19  m_countStraddling.first += straddles.first;
20  m_countStraddling.second += straddles.second;
21  if (straddles.first) m_maxStraddlingSince = std::max(m_maxStraddlingSince, iov.first);
22  if (straddles.second) m_minStraddlingUntil = std::min(m_minStraddlingUntil, iov.second);
23  }

◆ at()

Iov_t IOVDbNamespace::IovStore::at ( const unsigned int  idx) const
inline

'at' to read iov at specific index

Definition at line 49 of file IovStore.h.

49 { return m_iovs.at(idx);}

◆ clear()

void IOVDbNamespace::IovStore::clear ( )

clear the store

Definition at line 56 of file IovStore.cxx.

57  {
58  m_iovs.clear();
59  m_countStraddling = std::make_pair(0,0);
60  }

◆ empty()

bool IOVDbNamespace::IovStore::empty ( ) const
inline

is the store empty?

Definition at line 43 of file IovStore.h.

43 { return m_iovs.empty();}

◆ extendCacheHi()

bool IOVDbNamespace::IovStore::extendCacheHi ( )

Extend upper cache bound to the minimum 'until' time; return whether this changes its value.

Definition at line 96 of file IovStore.cxx.

96  {
97  const bool extend = m_minStraddlingUntil > m_cacheBounds.second;
98  if (extend) m_cacheBounds.second = m_minStraddlingUntil;
99  return extend;
100  }

◆ extendCacheLo()

bool IOVDbNamespace::IovStore::extendCacheLo ( )

Extend lower cache bound to the maximum 'since' time; return whether this changes its value.

Definition at line 89 of file IovStore.cxx.

89  {
90  const bool extend = m_maxStraddlingSince < m_cacheBounds.first;
91  if (extend) m_cacheBounds.first = m_maxStraddlingSince;
92  return extend;
93  }

◆ extendIov()

void IOVDbNamespace::IovStore::extendIov ( const unsigned int  idx,
const cool::ValidityKey &  newUntilTime 
)

Extend a specific iov at the index to a new 'until' time.

Definition at line 77 of file IovStore.cxx.

77  {
78  m_iovs[idx].second = newUntilTime;
79  }

◆ getCacheBounds()

IovStore::Iov_t IOVDbNamespace::IovStore::getCacheBounds ( ) const

Report the current cache bounds.

Definition at line 31 of file IovStore.cxx.

31  {
32  return m_cacheBounds;
33  }

◆ getMinimumStraddlingSpan()

IovStore::Iov_t IOVDbNamespace::IovStore::getMinimumStraddlingSpan ( ) const

Get the minimum straddling span (max 'since' to min 'until')

Get the minimum straddling span (max 'since' - min 'until')

Definition at line 45 of file IovStore.cxx.

◆ numberOfIovsOnBoundaries()

std::pair< unsigned int, unsigned int > IOVDbNamespace::IovStore::numberOfIovsOnBoundaries ( ) const

Return the current count of added Iovs which straddled cache boundaries.

Definition at line 51 of file IovStore.cxx.

51  {
52  return m_countStraddling;
53  }

◆ setCacheBounds()

void IOVDbNamespace::IovStore::setCacheBounds ( const Iov_t cacheBounds)

Set the cache bound variables.

Definition at line 36 of file IovStore.cxx.

36  {
37  if (cacheBounds.second > cool::ValidityKeyMax){
38  m_cacheBounds=IovStore::Iov_t(cacheBounds.first, cool::ValidityKeyMax);
39  } else {
40  m_cacheBounds = cacheBounds;
41  }
42  }

◆ setIovSpan()

void IOVDbNamespace::IovStore::setIovSpan ( const Iov_t span)

Set span.

Definition at line 82 of file IovStore.cxx.

82  {
85  }

◆ size()

unsigned int IOVDbNamespace::IovStore::size ( ) const
inline

length of store

Definition at line 45 of file IovStore.h.

45 { return m_iovs.size();}

◆ straddling()

std::pair< bool, bool > IOVDbNamespace::IovStore::straddling ( const Iov_t iov,
const Iov_t bounds 
)
staticprivate

Definition at line 69 of file IovStore.cxx.

69  {
70  std::pair<bool, bool> straddles(false, false);
71  straddles.first = (iov.first<=bounds.first) and (iov.second>bounds.first);
72  straddles.second = (iov.first<bounds.second) and (iov.second>bounds.second);
73  return straddles;
74  }

◆ vectorStore()

std::vector< IovStore::Iov_t > & IOVDbNamespace::IovStore::vectorStore ( )

Return the internal vector store.

Definition at line 64 of file IovStore.cxx.

64  {
65  return m_iovs;
66  }

Member Data Documentation

◆ m_cacheBounds

Iov_t IOVDbNamespace::IovStore::m_cacheBounds {0,0}
private

cache bounds, 'since', 'until', corresponds to m_cachestart, m_cachestop in original

Definition at line 61 of file IovStore.h.

◆ m_countStraddling

std::pair<unsigned int, unsigned int> IOVDbNamespace::IovStore::m_countStraddling {}
private

count of iovs straddling the since or until boundaries

Definition at line 71 of file IovStore.h.

◆ m_iovs

std::vector<Iov_t> IOVDbNamespace::IovStore::m_iovs {}
private

main vector of iovs

Definition at line 59 of file IovStore.h.

◆ m_maxStraddlingSince

cool::ValidityKey IOVDbNamespace::IovStore::m_maxStraddlingSince {cool::ValidityKeyMin}
private

max 'since' of the iovs which straddle the cache boundary, corresponds to 'm_boundmin' in the original code

Definition at line 65 of file IovStore.h.

◆ m_minStraddlingUntil

cool::ValidityKey IOVDbNamespace::IovStore::m_minStraddlingUntil {cool::ValidityKeyMax}
private

min 'until' of the iovs which straddle the boundary corresponds to 'm_boundmax' in the original code

Definition at line 69 of file IovStore.h.


The documentation for this class was generated from the following files:
CxxUtils::span
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
dqt_zlumi_alleff_HIST.iov
iov
Definition: dqt_zlumi_alleff_HIST.py:119
max
#define max(a, b)
Definition: cfImp.cxx:41
IOVDbNamespace::IovStore::Iov_t
std::pair< cool::ValidityKey, cool::ValidityKey > Iov_t
Definition: IovStore.h:22
IOVDbNamespace::IovStore::m_cacheBounds
Iov_t m_cacheBounds
cache bounds, 'since', 'until', corresponds to m_cachestart, m_cachestop in original
Definition: IovStore.h:61
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
IOVDbNamespace::IovStore::m_iovs
std::vector< Iov_t > m_iovs
main vector of iovs
Definition: IovStore.h:59
IOVDbNamespace::IovStore::m_maxStraddlingSince
cool::ValidityKey m_maxStraddlingSince
max 'since' of the iovs which straddle the cache boundary, corresponds to 'm_boundmin' in the origina...
Definition: IovStore.h:65
min
#define min(a, b)
Definition: cfImp.cxx:40
IOVDbNamespace::IovStore::m_minStraddlingUntil
cool::ValidityKey m_minStraddlingUntil
min 'until' of the iovs which straddle the boundary corresponds to 'm_boundmax' in the original code
Definition: IovStore.h:69
IOVDbNamespace::IovStore::addIov
void addIov(const Iov_t &iov)
Add an iov to the store and update the span variables.
Definition: IovStore.cxx:16
IOVDbNamespace::IovStore::m_countStraddling
std::pair< unsigned int, unsigned int > m_countStraddling
count of iovs straddling the since or until boundaries
Definition: IovStore.h:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
IOVDbNamespace::IovStore::straddling
static std::pair< bool, bool > straddling(const Iov_t &iov, const Iov_t &bounds)
Definition: IovStore.cxx:69