File indexing completed on 2024-04-06 12:01:24
0001 #ifndef CondCore_CondDB_GTProxy_h
0002 #define CondCore_CondDB_GTProxy_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "CondCore/CondDB/interface/Time.h"
0016 #include "CondCore/CondDB/interface/Types.h"
0017
0018 #include <boost/date_time/posix_time/posix_time.hpp>
0019
0020 namespace cond {
0021
0022 namespace persistency {
0023
0024
0025 std::string fullyQualifiedTag(const std::string& tag, const std::string& connectionString);
0026 std::pair<std::string, std::string> parseTag(const std::string& tag);
0027
0028 class SessionImpl;
0029 class GTProxyData;
0030
0031
0032 class GTProxy {
0033 public:
0034 typedef std::vector<std::tuple<std::string, std::string, std::string> > GTContainer;
0035
0036 public:
0037
0038 class Iterator {
0039 public:
0040
0041 using iterator_category = std::input_iterator_tag;
0042 using value_type = cond::GTEntry_t;
0043 using difference_type = void;
0044 using pointer = void;
0045 using reference = void;
0046
0047
0048 Iterator();
0049 explicit Iterator(GTContainer::const_iterator current);
0050 Iterator(const Iterator& rhs);
0051
0052
0053 Iterator& operator=(const Iterator& rhs);
0054
0055
0056 cond::GTEntry_t operator*();
0057
0058
0059 Iterator& operator++();
0060 Iterator operator++(int);
0061
0062
0063 bool operator==(const Iterator& rhs) const;
0064 bool operator!=(const Iterator& rhs) const;
0065
0066 private:
0067 GTContainer::const_iterator m_current;
0068 };
0069
0070 public:
0071 GTProxy();
0072
0073 explicit GTProxy(const std::shared_ptr<SessionImpl>& session);
0074
0075
0076 GTProxy(const GTProxy& rhs);
0077
0078
0079 GTProxy& operator=(const GTProxy& rhs);
0080
0081
0082
0083
0084
0085 void load(const std::string& gtName, const std::string& preFix = "", const std::string& postFix = "");
0086
0087
0088 void reload();
0089
0090
0091 void reset();
0092
0093 std::string name() const;
0094
0095 cond::Time_t validity() const;
0096
0097 boost::posix_time::ptime snapshotTime() const;
0098
0099
0100 Iterator begin() const;
0101
0102
0103 Iterator end() const;
0104
0105
0106 int size() const;
0107
0108 private:
0109 void checkTransaction(const std::string& ctx);
0110
0111 private:
0112 std::shared_ptr<GTProxyData> m_data;
0113 std::shared_ptr<SessionImpl> m_session;
0114 };
0115
0116 }
0117 }
0118
0119 #endif