File indexing completed on 2021-02-14 12:50:20
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 : public std::iterator<std::input_iterator_tag, cond::GTEntry_t> {
0039 public:
0040
0041 Iterator();
0042 explicit Iterator(GTContainer::const_iterator current);
0043 Iterator(const Iterator& rhs);
0044
0045
0046 Iterator& operator=(const Iterator& rhs);
0047
0048
0049 cond::GTEntry_t operator*();
0050
0051
0052 Iterator& operator++();
0053 Iterator operator++(int);
0054
0055
0056 bool operator==(const Iterator& rhs) const;
0057 bool operator!=(const Iterator& rhs) const;
0058
0059 private:
0060 GTContainer::const_iterator m_current;
0061 };
0062
0063 public:
0064 GTProxy();
0065
0066 explicit GTProxy(const std::shared_ptr<SessionImpl>& session);
0067
0068
0069 GTProxy(const GTProxy& rhs);
0070
0071
0072 GTProxy& operator=(const GTProxy& rhs);
0073
0074
0075
0076
0077
0078 void load(const std::string& gtName, const std::string& preFix = "", const std::string& postFix = "");
0079
0080
0081 void reload();
0082
0083
0084 void reset();
0085
0086 std::string name() const;
0087
0088 cond::Time_t validity() const;
0089
0090 boost::posix_time::ptime snapshotTime() const;
0091
0092
0093 Iterator begin() const;
0094
0095
0096 Iterator end() const;
0097
0098
0099 int size() const;
0100
0101 private:
0102 void checkTransaction(const std::string& ctx);
0103
0104 private:
0105 std::shared_ptr<GTProxyData> m_data;
0106 std::shared_ptr<SessionImpl> m_session;
0107 };
0108
0109 }
0110 }
0111
0112 #endif