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

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

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 }
Iov_t m_cacheBounds
cache bounds, 'since', 'until', corresponds to m_cachestart, m_cachestop in original
Definition IovStore.h:61

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 {
26 addIov(IovStore::Iov_t(since, until));
27 }
std::pair< cool::ValidityKey, cool::ValidityKey > Iov_t
Definition IovStore.h:22
void addIov(const Iov_t &iov)
Add an iov to the store and update the span variables.
Definition IovStore.cxx:16

◆ 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 }
static std::pair< bool, bool > straddling(const Iov_t &iov, const Iov_t &bounds)
Definition IovStore.cxx:69
std::vector< Iov_t > m_iovs
main vector of iovs
Definition IovStore.h:59
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
std::pair< unsigned int, unsigned int > m_countStraddling
count of iovs straddling the since or until boundaries
Definition IovStore.h:71
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

◆ 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 }
constexpr std::variant< Args..., T > extend(const std::variant< Args... > &, const T &)

◆ 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 }
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.

◆ 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.

61{0,0};

◆ 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.

71{};

◆ m_iovs

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

main vector of iovs

Definition at line 59 of file IovStore.h.

59{};

◆ 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.

65{cool::ValidityKeyMin};

◆ 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.

69{cool::ValidityKeyMax};

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