ATLAS Offline Software
Loading...
Searching...
No Matches
IovStore.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "IovStore.h"
6
7namespace IOVDbNamespace{
8
9 IovStore::IovStore()= default;
11 IovStore::IovStore(const IovStore::Iov_t & cacheBounds):m_cacheBounds(cacheBounds){
12 //
13 }
14
15 void
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 }
24 void
25 IovStore::addIov(const cool::ValidityKey & since, const cool::ValidityKey & until){
26 addIov(IovStore::Iov_t(since, until));
27 }
28
32 return m_cacheBounds;
33 }
34
35 void
37 if (cacheBounds.second > cool::ValidityKeyMax){
38 m_cacheBounds=IovStore::Iov_t(cacheBounds.first, cool::ValidityKeyMax);
39 } else {
40 m_cacheBounds = cacheBounds;
41 }
42 }
43
48
50 std::pair<unsigned int, unsigned int>
54
57 {
58 m_iovs.clear();
59 m_countStraddling = std::make_pair(0,0);
60 }
61
63 std::vector<IovStore::Iov_t> &
65 return m_iovs;
66 }
67
68 std::pair<bool,bool>
69 IovStore::straddling(const Iov_t & iov, const Iov_t & bounds) {
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 }
75
76 void
77 IovStore::extendIov(const unsigned int idx, const cool::ValidityKey & newUntilTime){
78 m_iovs[idx].second = newUntilTime;
79 }
80
81 void
83 m_maxStraddlingSince=span.first;
84 m_minStraddlingUntil=span.second;
85 }
86
88 bool
90 const bool extend = m_maxStraddlingSince < m_cacheBounds.first;
91 if (extend) m_cacheBounds.first = m_maxStraddlingSince;
92 return extend;
93 }
94
95 bool
97 const bool extend = m_minStraddlingUntil > m_cacheBounds.second;
98 if (extend) m_cacheBounds.second = m_minStraddlingUntil;
99 return extend;
100 }
101
102
103
104
105
106
107}
helper class for IOVDbFolder managing cached iov since/until pairs
bool extendCacheHi()
Extend upper cache bound to the minimum 'until' time; return whether this changes its value.
Definition IovStore.cxx:96
std::pair< unsigned int, unsigned int > numberOfIovsOnBoundaries() const
Return the current count of added Iovs which straddled cache boundaries.
Definition IovStore.cxx:51
static std::pair< bool, bool > straddling(const Iov_t &iov, const Iov_t &bounds)
Definition IovStore.cxx:69
std::vector< Iov_t > & vectorStore()
Return the internal vector store.
Definition IovStore.cxx:64
Iov_t getCacheBounds() const
Report the current cache bounds.
Definition IovStore.cxx:31
Iov_t getMinimumStraddlingSpan() const
Get the minimum straddling span (max 'since' to min 'until')
Definition IovStore.cxx:45
void setIovSpan(const Iov_t &span)
Set span.
Definition IovStore.cxx:82
std::vector< Iov_t > m_iovs
main vector of iovs
Definition IovStore.h:59
void setCacheBounds(const Iov_t &cacheBounds)
Set the cache bound variables.
Definition IovStore.cxx:36
void extendIov(const unsigned int idx, const cool::ValidityKey &newUntilTime)
Extend a specific iov at the index to a new 'until' time.
Definition IovStore.cxx:77
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
Iov_t m_cacheBounds
cache bounds, 'since', 'until', corresponds to m_cachestart, m_cachestop in original
Definition IovStore.h:61
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
IovStore()
Default constructor, cache bounds set to 0,0.
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
bool extendCacheLo()
Extend lower cache bound to the maximum 'since' time; return whether this changes its value.
Definition IovStore.cxx:89
void clear()
clear the store
Definition IovStore.cxx:56