Go to the documentation of this file.00001 #ifndef LMFSEQDAT_H
00002 #define LMFSEQDAT_H
00003
00004
00005
00006
00007
00008 #include <map>
00009
00010 #include "OnlineDB/EcalCondDB/interface/LMFUnique.h"
00011 #include "OnlineDB/EcalCondDB/interface/LMFColor.h"
00012 #include "OnlineDB/EcalCondDB/interface/RunIOV.h"
00013
00014 class LMFSeqDat : public LMFUnique {
00015 public:
00016 friend class EcalCondDBInterface;
00017
00018 LMFSeqDat();
00019 LMFSeqDat(oracle::occi::Environment* env,
00020 oracle::occi::Connection* conn);
00021 LMFSeqDat(EcalDBConnection *c);
00022 ~LMFSeqDat();
00023
00024
00025 LMFSeqDat& setRunIOV(const RunIOV &iov);
00026 LMFSeqDat& setSequenceNumber(int n) { setInt("seq_num", n); return *this; }
00027 LMFSeqDat& setSequenceStart(Tm start) {
00028 setString("seq_start", start.str());
00029 return *this;
00030 }
00031 LMFSeqDat& setSequenceStop(Tm end) {
00032 setString("seq_stop", end.str());
00033 return *this;
00034 }
00035 LMFSeqDat& setVersions(int vmin, int vmax) {
00036 setVmin(vmin) ; setVmax(vmax);
00037 return *this;
00038 }
00039
00040 RunIOV getRunIOV() const;
00041 int getSequenceNumber() const { return getInt("seq_num"); }
00042 Tm getSequenceStart() const {
00043 Tm t;
00044 t.setToString(getString("seq_start"));
00045 return t;
00046 }
00047 Tm getSequenceStop() const;
00048 int getVmin() const { return getInt("vmin"); }
00049 int getVmax() const { return getInt("vmax"); }
00050
00051 bool isValid() const ;
00052
00053 bool operator==(const LMFSeqDat &m) const
00054 {
00055 return ( getSequenceNumber() == m.getSequenceNumber() &&
00056 getRunIOV() == m.getRunIOV() &&
00057 getSequenceStart() == m.getSequenceStart() &&
00058 getSequenceStop() == m.getSequenceStop() &&
00059 getVmin() == m.getVmin() &&
00060 getVmax() == m.getVmax());
00061 }
00062
00063 bool operator!=(const LMFSeqDat &m) const { return !(*this == m); }
00064 std::map<int, LMFSeqDat> fetchByRunIOV(RunIOV &iov);
00065 std::map<int, LMFSeqDat> fetchByRunIOV(RunIOV &iov, const LMFColor &col);
00066 LMFSeqDat fetchByRunIOV(RunIOV &iov, int seq_num) {
00067 return fetchByRunIOV(iov)[seq_num];
00068 }
00069 std::map<int, LMFSeqDat> fetchByRunNumber(int runno);
00070 LMFSeqDat fetchByRunNumber(int runno, int seq_num) {
00071 return fetchByRunNumber(runno)[seq_num];
00072 }
00073 LMFSeqDat fetchByRunNumber(int runno, Tm taken_at);
00074 LMFSeqDat fetchByRunNumber(int runno, std::string taken_at);
00075 LMFSeqDat fetchLast();
00076 RunIOV fetchLastRun();
00077
00078 private:
00079 RunIOV m_runIOV;
00080
00081 void setVmin(int v) {
00082 setInt("vmin", v);
00083 }
00084 void setVmax(int v) {
00085 setInt("vmax", v);
00086 }
00087 std::string fetchIdSql(Statement *stmt);
00088 std::string setByIDSql(Statement *stmt, int id);
00089 std::string writeDBSql(Statement *stmt);
00090 void getParameters(ResultSet *rset);
00091
00092 void fetchParentIDs() throw(std::runtime_error);
00093 std::map<int, LMFSeqDat> fetchByRunIOV(std::vector<std::string> par,
00094 std::string sql,
00095 std::string method)
00096 throw(std::runtime_error);
00097 std::map<int, LMFSeqDat> fetchByRunIOV(int par, std::string sql,
00098 std::string method)
00099 throw(std::runtime_error);
00100 std::map<int, LMFSeqDat> fetchByRunIOV(std::string sql,
00101 std::string method)
00102 throw(std::runtime_error);
00103
00104 };
00105
00106 #endif