File indexing completed on 2021-02-14 12:50:20
0001 #ifndef CondCore_CondDB_RunInfoProxy_h
0002 #define CondCore_CondDB_RunInfoProxy_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "CondCore/CondDB/interface/Types.h"
0016
0017
0018 namespace cond {
0019
0020 namespace persistency {
0021
0022 class SessionImpl;
0023 class RunInfoProxyData;
0024
0025
0026 class RunInfoProxy {
0027 public:
0028 typedef std::vector<std::tuple<Time_t, boost::posix_time::ptime, boost::posix_time::ptime> > RunInfoData;
0029
0030 public:
0031
0032 class Iterator : public std::iterator<std::input_iterator_tag, cond::RunInfo_t> {
0033 public:
0034
0035 Iterator();
0036 explicit Iterator(RunInfoData::const_iterator current);
0037 Iterator(const Iterator& rhs);
0038
0039
0040 Iterator& operator=(const Iterator& rhs);
0041
0042
0043 cond::RunInfo_t operator*();
0044
0045
0046 Iterator& operator++();
0047 Iterator operator++(int);
0048
0049
0050 bool operator==(const Iterator& rhs) const;
0051 bool operator!=(const Iterator& rhs) const;
0052
0053 private:
0054 RunInfoData::const_iterator m_current;
0055 };
0056
0057 public:
0058 RunInfoProxy();
0059
0060
0061 explicit RunInfoProxy(const std::shared_ptr<SessionImpl>& session);
0062
0063
0064 RunInfoProxy(const RunInfoProxy& rhs);
0065
0066
0067 RunInfoProxy& operator=(const RunInfoProxy& rhs);
0068
0069
0070 void load(Time_t low, Time_t up);
0071
0072
0073 void load(const boost::posix_time::ptime& low, const boost::posix_time::ptime& up);
0074
0075
0076 void reset();
0077
0078
0079 Iterator begin() const;
0080
0081
0082 Iterator end() const;
0083
0084
0085 Iterator find(Time_t target) const;
0086
0087
0088 Iterator find(const boost::posix_time::ptime& target) const;
0089
0090
0091 cond::RunInfo_t get(Time_t target) const;
0092
0093
0094 cond::RunInfo_t get(const boost::posix_time::ptime& target) const;
0095
0096
0097 int size() const;
0098
0099 private:
0100 void checkTransaction(const std::string& ctx);
0101
0102 private:
0103 std::shared_ptr<RunInfoProxyData> m_data;
0104 std::shared_ptr<SessionImpl> m_session;
0105 };
0106
0107 }
0108 }
0109
0110 #endif