ATLAS Offline Software
Loading...
Searching...
No Matches
IovStore.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6#ifndef IOVDbSvc_IovStore_h
7#define IOVDbSvc_IovStore_h
13#include "CoolKernel/ValidityKey.h"
14#include <vector>
15#include <utility> //pair
16
17namespace IOVDbNamespace{
18 //@brief Manages the caching of IOV since/until pairs but encapsulating the functionality
19 //in a single class
20 class IovStore{
21 public:
22 typedef std::pair<cool::ValidityKey, cool::ValidityKey> Iov_t;
26 IovStore(const Iov_t & cacheBounds);
28 void addIov(const Iov_t & iov);
29 void addIov(const cool::ValidityKey & since, const cool::ValidityKey & until);
31 Iov_t getCacheBounds() const;
33 void setCacheBounds(const Iov_t & cacheBounds);
37 void setIovSpan(const Iov_t & span);
39 std::vector<Iov_t> & vectorStore();
41 std::pair<unsigned int, unsigned int> numberOfIovsOnBoundaries() const;
43 bool empty() const { return m_iovs.empty();}
45 unsigned int size() const { return m_iovs.size();}
47 void clear();
49 Iov_t at(const unsigned int idx) const { return m_iovs.at(idx);}
51 void extendIov(const unsigned int idx, const cool::ValidityKey & newUntilTime);
53 bool extendCacheLo();
55 bool extendCacheHi();
56 private:
57 static std::pair<bool,bool> straddling(const Iov_t & iov, const Iov_t & bounds) ;
59 std::vector<Iov_t> m_iovs{};
65 cool::ValidityKey m_maxStraddlingSince{cool::ValidityKeyMin};
69 cool::ValidityKey m_minStraddlingUntil{cool::ValidityKeyMax};
71 std::pair<unsigned int, unsigned int> m_countStraddling{};
72 };
73
74}
75
76#endif
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
bool empty() const
is the store empty?
Definition IovStore.h:43
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
unsigned int size() const
length of store
Definition IovStore.h:45
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.
Iov_t at(const unsigned int idx) const
'at' to read iov at specific index
Definition IovStore.h:49
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