![]() |
![]() |
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 00032 // Methods from IUniqueDBObject 00033 int getID(){ return m_ID;} ; 00034 00035 int fetchID() throw(std::runtime_error); 00036 void setByID(int id) throw(std::runtime_error); 00037 00038 // operators 00039 inline bool operator==(const RunIOV &r) const 00040 { 00041 return (m_runNum == r.m_runNum && 00042 m_runStart == r.m_runStart && 00043 m_runEnd == r.m_runEnd && 00044 m_runTag == r.m_runTag); 00045 } 00046 00047 inline bool operator!=(const RunIOV &r) const { return !(*this == r); } 00048 00049 private: 00050 // User data for this IOV 00051 run_t m_runNum; 00052 Tm m_runStart; 00053 Tm m_runEnd; 00054 RunTag m_runTag; 00055 00056 int writeDB() throw(std::runtime_error); 00057 int updateEndTimeDB() throw(std::runtime_error); 00058 00059 void setByRun(RunTag* tag, run_t run) throw(std::runtime_error); 00060 void setByRun(std::string location, run_t run) throw(std::runtime_error); 00061 void setByRecentData(std::string dataTable, RunTag* tag, run_t run = (unsigned int)-1) throw(std::runtime_error); 00062 void setByRecentData(std::string dataTable, std::string location, run_t run) throw(std::runtime_error); 00063 00064 00065 /* void fetchEarliest(RunIOV* fillIOV, RunTag* tag) const throw(std::runtime_error); */ 00066 /* void fetchLatest(RunIOV* fillIOV, RunTag* tag) const throw(std::runtime_error); */ 00067 /* oracle::occi::Statement* prepareFetch(const std::string sql, RunTag* tag) const throw(std::runtime_error); */ 00068 /* void fill(RunIOV* target, oracle::occi::ResultSet* rset) const throw(std::runtime_error); */ 00069 00070 /* // Methods for fetching by Tm */ 00071 /* void fetchAt(RunIOV* iov, const Tm eventTm, RunTag* tag) const throw(std::runtime_error); */ 00072 /* void fetchWithin(std::vector<RunIOV>* fillVec, const Tm beginTm, const Tm endTm, RunTag* tag) const throw(std::runtime_error); */ 00073 00074 /* // Methods for fetching by run_t */ 00075 /* void fetchAt(RunIOV* fillIOV, const run_t run, RunTag* tag) const throw(std::runtime_error); */ 00076 /* void fetchWithin(std::vector<RunIOV>* fillVec, const run_t beginRun, const run_t endRun, RunTag* tag) const throw(std::runtime_error); */ 00077 }; 00078 00079 #endif