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  DbSession& session() { return me;}
61 
62  private:
63  mutable DbSession me;
64  boost::shared_ptr<cond::Logger> logger;
65  };
66 
67  // initializ cond, coral etc
68  class RDBMS {
69  public:
70  RDBMS();
71  ~RDBMS();
72  explicit RDBMS(std::string const & authPath, bool debug=false);
73  RDBMS(std::string const & user,std::string const & pass);
74  void setLogger(std::string const & connstr);
75 
76  CondDB getDB(std::string const & db);
77 
78  CondDB getReadOnlyDB(std::string const & db);
79 
80  GlobalTag const & globalTag(std::string const & connstr,
81  std::string const & gname,
82  std::string const & prefix,
83  std::string const & postfix) const;
84 
85  private:
86  boost::shared_ptr<DbConnection> connection;
87  boost::shared_ptr<cond::Logger> logger;
89 
90  };
91 
92 
93 }
94 
95 
96 #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
DbSession & session()
tuple db
Definition: EcalCondDB.py:151
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
CondDB getReadOnlyDB(std::string const &db)
boost::shared_ptr< impl::FWMagic > magic
#define debug
Definition: MEtoEDMFormat.h:34
boost::shared_ptr< cond::Logger > logger
void setLogger(std::string const &connstr)