CMS 3D CMS Logo

RunInfoProxy.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_RunInfoProxy_h
2 #define CondCore_CondDB_RunInfoProxy_h
3 //
4 // Package: CondDB
5 // Class : RunInfoProxy
6 //
10 //
11 // Author: Giacomo Govi
12 // Created: Dec 2016
13 //
14 
16 //
17 
18 namespace cond {
19 
20  namespace persistency {
21 
22  class SessionImpl;
23  class RunInfoProxyData;
24 
25  // value semantics. to be used WITHIN the parent session transaction ( therefore the session should be kept alive ).
26  class RunInfoProxy {
27  public:
28  typedef std::vector<std::tuple<Time_t, boost::posix_time::ptime, boost::posix_time::ptime> > RunInfoData;
29 
30  public:
31  // more or less compliant with typical iterator semantics...
32  class Iterator : public std::iterator<std::input_iterator_tag, cond::RunInfo_t> {
33  public:
34  //
35  Iterator();
36  explicit Iterator(RunInfoData::const_iterator current);
37  Iterator(const Iterator& rhs);
38 
39  //
40  Iterator& operator=(const Iterator& rhs);
41 
42  // returns a VALUE not a reference!
44 
45  //
47  Iterator operator++(int);
48 
49  //
50  bool operator==(const Iterator& rhs) const;
51  bool operator!=(const Iterator& rhs) const;
52 
53  private:
54  RunInfoData::const_iterator m_current;
55  };
56 
57  public:
58  RunInfoProxy();
59 
60  //
61  explicit RunInfoProxy(const std::shared_ptr<SessionImpl>& session);
62 
63  //
64  RunInfoProxy(const RunInfoProxy& rhs);
65 
66  //
67  RunInfoProxy& operator=(const RunInfoProxy& rhs);
68 
69  // loads in memory the RunInfo data for the specified run range
70  void load(Time_t low, Time_t up);
71 
72  // loads in memory the RunInfo data for the specified run range
73  void load(const boost::posix_time::ptime& low, const boost::posix_time::ptime& up);
74 
75  // clear all the iov data in memory
76  void reset();
77 
78  // start the iteration.
79  Iterator begin() const;
80 
81  //
82  Iterator end() const;
83 
84  //
85  Iterator find(Time_t target) const;
86 
87  //
88  Iterator find(const boost::posix_time::ptime& target) const;
89 
90  //
92 
93  //
94  cond::RunInfo_t get(const boost::posix_time::ptime& target) const;
95 
96  //
97  int size() const;
98 
99  private:
100  void checkTransaction(const std::string& ctx);
101 
102  private:
103  std::shared_ptr<RunInfoProxyData> m_data;
104  std::shared_ptr<SessionImpl> m_session;
105  };
106 
107  } // namespace persistency
108 } // namespace cond
109 
110 #endif
cond::persistency::RunInfoProxy::Iterator::Iterator
Iterator()
Definition: RunInfoProxy.cc:18
cond::persistency::RunInfoProxy::RunInfoProxy
RunInfoProxy()
Definition: RunInfoProxy.cc:52
cond::persistency::RunInfoProxy::find
Iterator find(Time_t target) const
Definition: RunInfoProxy.cc:142
cond::persistency::RunInfoProxy::Iterator::m_current
RunInfoData::const_iterator m_current
Definition: RunInfoProxy.h:54
cond::persistency::RunInfoProxy::load
void load(Time_t low, Time_t up)
Definition: RunInfoProxy.cc:66
cond::persistency::RunInfoProxy
Definition: RunInfoProxy.h:26
cond::persistency::RunInfoProxy::m_session
std::shared_ptr< SessionImpl > m_session
Definition: RunInfoProxy.h:104
cond::persistency::RunInfoProxy::end
Iterator end() const
Definition: RunInfoProxy.cc:119
cond::persistency::RunInfoProxy::Iterator::operator!=
bool operator!=(const Iterator &rhs) const
Definition: RunInfoProxy.cc:50
cond::persistency::RunInfoProxy::reset
void reset()
Definition: RunInfoProxy.cc:99
cond::persistency::RunInfoProxy::begin
Iterator begin() const
Definition: RunInfoProxy.cc:112
cond::persistency::RunInfoProxy::RunInfoData
std::vector< std::tuple< Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > RunInfoData
Definition: RunInfoProxy.h:28
cond::persistency::RunInfoProxy::operator=
RunInfoProxy & operator=(const RunInfoProxy &rhs)
Definition: RunInfoProxy.cc:59
cond::persistency::RunInfoProxy::Iterator
Definition: RunInfoProxy.h:32
cond
Definition: plugin.cc:23
cond::persistency::RunInfoProxy::Iterator::operator==
bool operator==(const Iterator &rhs) const
Definition: RunInfoProxy.cc:44
cond::persistency::RunInfoProxy::get
cond::RunInfo_t get(Time_t target) const
Definition: RunInfoProxy.cc:159
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
cond::persistency::RunInfoProxy::Iterator::operator*
cond::RunInfo_t operator*()
Definition: RunInfoProxy.cc:31
cond::persistency::RunInfoProxy::Iterator::operator=
Iterator & operator=(const Iterator &rhs)
Definition: RunInfoProxy.cc:24
cond::RunInfo_t
Definition: Types.h:139
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::RunInfoProxy::size
int size() const
Definition: RunInfoProxy.cc:179
cond::persistency::RunInfoProxy::Iterator::operator++
Iterator & operator++()
Definition: RunInfoProxy.cc:33
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
cond::persistency::RunInfoProxy::m_data
std::shared_ptr< RunInfoProxyData > m_data
Definition: RunInfoProxy.h:103
Types.h
cond::persistency::RunInfoProxy::checkTransaction
void checkTransaction(const std::string &ctx)
Definition: RunInfoProxy.cc:105
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
up
Definition: BitonicSort.h:7