CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CondPyInterface.h
Go to the documentation of this file.
1 #ifndef CondCore_Utilities_CondPyInterface_h
2 #define CondCore_Utilities_CondPyInterface_h
3 
4 /* common utilities of the CondCore Python buiding
5  *
6  */
7 
12 
13 
14 #include<boost/shared_ptr.hpp>
15 #include<string>
16 #include<set>
17 
18 namespace cond {
19 
20  typedef std::set<cond::TagMetadata> GlobalTag;
21 
22 
23  class Logger;
24 
25  namespace impl {
26  struct FWMagic;
27  }
28 
29  // initialize framework
30  class FWIncantation {
31  public:
32  FWIncantation();
33  // FWIncantation(FWIncantation const & other );
35 
36  private:
37  boost::shared_ptr<impl::FWMagic> magic;
38  };
39 
40  // a readonly CondDB and its transaction
41  class CondDB {
42  public:
43  CondDB();
44  CondDB(const CondDB & other);
45  CondDB & operator=(const CondDB & other);
46  CondDB(DbSession& session, boost::shared_ptr<cond::Logger> ilog );
47  ~CondDB();
48  std::string allTags() const;
49 
50  IOVProxy iov(std::string const & tag) const;
51  IOVProxy iovWithLib(std::string const & tag) const;
52 
53  IOVElementProxy payLoad(std::string const & token) const;
54 
55  std::string iovToken(std::string const & tag) const;
56 
57  cond::LogDBEntry lastLogEntry(std::string const & tag) const;
58  cond::LogDBEntry lastLogEntryOK(std::string const & tag) const;
59 
60  void startTransaction() const;
61  void startReadOnlyTransaction() const;
62  void commitTransaction() const;
63 
64  void closeSession() const;
65 
66  DbSession& session() const { return me;}
67 
68  private:
69  mutable DbSession me;
70  boost::shared_ptr<cond::Logger> logger;
71  };
72 
73  // initializ cond, coral etc
74  class RDBMS {
75  public:
76  RDBMS();
77  ~RDBMS();
78  explicit RDBMS(std::string const & authPath, bool debug=false);
79  RDBMS(std::string const & user,std::string const & pass);
80  void setLogger(std::string const & connstr);
81 
82  CondDB getDB(std::string const & db);
83 
84  CondDB getReadOnlyDB(std::string const & db);
85 
86  GlobalTag const & globalTag(std::string const & connstr,
87  std::string const & gname,
88  std::string const & prefix,
89  std::string const & postfix) const;
90 
91  private:
92  boost::shared_ptr<DbConnection> connection;
93  boost::shared_ptr<cond::Logger> logger;
95 
96  };
97 
98 
99 }
100 
101 
102 #endif // CondCore_Utilities_CondPyInterface_h
GlobalTag m_globalTag
boost::shared_ptr< DbConnection > connection
CondDB getDB(std::string const &db)
IOVProxy iov(std::string const &tag) const
cond::LogDBEntry lastLogEntryOK(std::string const &tag) const
GlobalTag const & globalTag(std::string const &connstr, std::string const &gname, std::string const &prefix, std::string const &postfix) const
std::set< cond::TagMetadata > GlobalTag
IOVProxy iovWithLib(std::string const &tag) const
tuple db
Definition: EcalCondDB.py:151
void commitTransaction() const
void startTransaction() const
std::string allTags() const
CondDB & operator=(const CondDB &other)
DbSession me
cond::LogDBEntry lastLogEntry(std::string const &tag) const
IOVElementProxy payLoad(std::string const &token) const
boost::shared_ptr< cond::Logger > logger
std::string iovToken(std::string const &tag) const
DbSession & session() const
void closeSession() const
#define debug
Definition: HDRShower.cc:19
void startReadOnlyTransaction() const
CondDB getReadOnlyDB(std::string const &db)
boost::shared_ptr< impl::FWMagic > magic
boost::shared_ptr< cond::Logger > logger
void setLogger(std::string const &connstr)