CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CondCore/Utilities/interface/CondPyInterface.h

Go to the documentation of this file.
00001 #ifndef CondCore_Utilities_CondPyInterface_h
00002 #define CondCore_Utilities_CondPyInterface_h
00003 
00004 /*  common utilities of the CondCore Python buiding
00005  *
00006  */
00007 
00008 #include "CondCore/IOVService/interface/IOVProxy.h"
00009 #include "CondCore/DBCommon/interface/LogDBEntry.h"
00010 #include "CondCore/DBCommon/interface/DbConnection.h"
00011 #include "CondCore/DBCommon/interface/TagMetadata.h"
00012 
00013 
00014 #include<boost/shared_ptr.hpp>
00015 #include<string>
00016 #include<set>
00017 
00018 namespace cond {
00019 
00020   typedef std::set<cond::TagMetadata> GlobalTag;
00021 
00022 
00023   class Logger;
00024 
00025   namespace impl {
00026     struct FWMagic;
00027   }
00028 
00029   // initialize framework
00030   class FWIncantation {
00031   public:
00032     FWIncantation();
00033     // FWIncantation(FWIncantation const & other );
00034     ~FWIncantation();
00035     
00036   private:
00037     boost::shared_ptr<impl::FWMagic> magic;
00038   };
00039 
00040   // a readonly CondDB and its transaction
00041  class CondDB {
00042   public:
00043    CondDB();
00044    CondDB(const CondDB & other);
00045    CondDB & operator=(const CondDB & other);
00046    CondDB(DbSession& session, boost::shared_ptr<cond::Logger> ilog );
00047    ~CondDB();
00048    std::string allTags() const;
00049 
00050    IOVProxy iov(std::string const & tag) const;
00051    IOVProxy iovWithLib(std::string const & tag) const;
00052 
00053    IOVElementProxy payLoad(std::string const & token) const;
00054 
00055    std::string iovToken(std::string const & tag) const;
00056    
00057    cond::LogDBEntry lastLogEntry(std::string const & tag) const;
00058    cond::LogDBEntry lastLogEntryOK(std::string const & tag) const;
00059 
00060    DbSession& session() { return me;}
00061 
00062  private:
00063    mutable DbSession me;
00064    boost::shared_ptr<cond::Logger> logger;
00065  };
00066 
00067   // initializ cond, coral etc
00068   class RDBMS {
00069   public:
00070     RDBMS();
00071     ~RDBMS();
00072     explicit RDBMS(std::string const & authPath, bool debug=false);
00073     RDBMS(std::string const & user,std::string const & pass);
00074     void setLogger(std::string const & connstr);
00075 
00076     CondDB getDB(std::string const & db);
00077     GlobalTag const & globalTag(std::string const & connstr, 
00078                                 std::string const & gname,
00079                                 std::string const & prefix, 
00080                                 std::string const & postfix) const;
00081 
00082   private:
00083     boost::shared_ptr<DbConnection> connection;
00084     boost::shared_ptr<cond::Logger> logger;
00085     GlobalTag m_globalTag;
00086 
00087   };
00088 
00089 
00090 }
00091 
00092 
00093 #endif //  CondCore_Utilities_CondPyInterface_h