CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/OnlineDB/EcalCondDB/interface/RunIOV.h

Go to the documentation of this file.
00001 #ifndef RUNIOV_H
00002 #define RUNIOV_H
00003 
00004 #include <stdexcept>
00005 #include <iostream>
00006 
00007 #include "OnlineDB/EcalCondDB/interface/IIOV.h"
00008 #include "OnlineDB/EcalCondDB/interface/RunTag.h"
00009 #include "OnlineDB/EcalCondDB/interface/Tm.h"
00010 
00011 typedef int run_t;
00012 
00013 class RunIOV : public IIOV {
00014  public:
00015   friend class EcalCondDBInterface;
00016 
00017   RunIOV();
00018   ~RunIOV();
00019 
00020   // Methods for user data
00021   void setRunNumber(run_t run);
00022   run_t getRunNumber() const;
00023   void setRunStart(Tm start);
00024   Tm getRunStart() const;
00025   void setRunEnd(Tm end);
00026   Tm getRunEnd() const;
00027   void setRunTag(RunTag tag);
00028   RunTag getRunTag() const;
00029   void setID(int id);
00030 
00031   void setDBInsertionTime(Tm dbtime){m_dbtime=dbtime;}
00032   Tm getDBInsertionTime(){return m_dbtime;}
00033  
00034 
00035   // Methods from IUniqueDBObject
00036   int getID(){ return m_ID;} ;
00037 
00038   int fetchID() throw(std::runtime_error);
00039   int fetchIDByRunAndTag() throw(std::runtime_error);
00040   void setByID(int id) throw(std::runtime_error);
00041 
00042   // operators
00043   inline bool operator==(const RunIOV &r) const
00044     {
00045       return (m_runNum   == r.m_runNum &&
00046               m_runStart == r.m_runStart &&
00047               m_runEnd   == r.m_runEnd &&
00048               m_runTag   == r.m_runTag);
00049     }
00050 
00051   inline bool operator!=(const RunIOV &r) const { return !(*this == r); }
00052 
00053  private:
00054   // User data for this IOV
00055   run_t m_runNum;
00056   Tm m_runStart;
00057   Tm m_runEnd;
00058   RunTag m_runTag;
00059   Tm m_dbtime;
00060 
00061   int writeDB() throw(std::runtime_error);
00062   int updateEndTimeDB() throw(std::runtime_error);
00063   int updateStartTimeDB() throw(std::runtime_error);
00064 
00065   void setByRun(RunTag* tag, run_t run) throw(std::runtime_error);
00066   void setByRun(std::string location, run_t run) throw(std::runtime_error);
00067   void setByTime(std::string location, const Tm &t) throw(std::runtime_error);
00068   void setByRecentData(std::string dataTable, RunTag* tag, run_t run = (unsigned int)-1) throw(std::runtime_error);
00069   void setByRecentData(std::string dataTable, std::string location, run_t run) throw(std::runtime_error);
00070 
00071 
00072 /*   void fetchEarliest(RunIOV* fillIOV, RunTag* tag) const throw(std::runtime_error); */
00073 /*   void fetchLatest(RunIOV* fillIOV, RunTag* tag) const throw(std::runtime_error); */
00074 /*   oracle::occi::Statement* prepareFetch(const std::string sql, RunTag* tag) const throw(std::runtime_error); */
00075 /*   void fill(RunIOV* target, oracle::occi::ResultSet* rset) const throw(std::runtime_error); */
00076 
00077 /*   // Methods for fetching by Tm */
00078 /*   void fetchAt(RunIOV* iov, const Tm eventTm, RunTag* tag) const throw(std::runtime_error); */
00079 /*   void fetchWithin(std::vector<RunIOV>* fillVec, const Tm beginTm, const Tm endTm, RunTag* tag) const throw(std::runtime_error); */
00080 
00081 /*   // Methods for fetching by run_t */
00082 /*   void fetchAt(RunIOV* fillIOV, const run_t run, RunTag* tag) const throw(std::runtime_error); */
00083 /*   void fetchWithin(std::vector<RunIOV>* fillVec, const run_t beginRun, const run_t endRun, RunTag* tag) const throw(std::runtime_error); */
00084 };
00085 
00086 #endif