CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/OnlineDB/EcalCondDB/interface/LMFLmrSubIOV.h

Go to the documentation of this file.
00001 #ifndef LMFLMRSUBIOV_H
00002 #define LMFLMRSUBIOV_H
00003 
00004 /*
00005  Last updated by  Giovanni.Organtini@roma1.infn.it 2010
00006  */
00007 
00008 #include <map>
00009 
00010 #include "OnlineDB/EcalCondDB/interface/LMFUnique.h"
00011 #include "OnlineDB/EcalCondDB/interface/LMFIOV.h"
00012 
00013 class LMFLmrSubIOV : public LMFUnique {
00014  public:
00015   friend class EcalCondDBInterface;
00016 
00017   LMFLmrSubIOV();
00018   LMFLmrSubIOV(EcalDBConnection *c);
00019   LMFLmrSubIOV(oracle::occi::Environment* env,
00020                oracle::occi::Connection* conn);
00021   ~LMFLmrSubIOV();
00022 
00023   LMFLmrSubIOV& setLMFIOV(const LMFIOV &iov);
00024   LMFLmrSubIOV& setLMFIOV(int i);
00025   LMFLmrSubIOV& setTimes(Tm t1, Tm t2, Tm t3);
00026   LMFLmrSubIOV& setTimes(std::vector<Tm> t);
00027   LMFLmrSubIOV& setTimes(Tm *t); // array of three components
00028   
00029   int getLMFIOVID() const {
00030     return m_lmfIOV;
00031   };
00032   LMFIOV getLMFIOV() const {
00033     LMFIOV iov(m_env, m_conn);
00034     iov.setByID(m_lmfIOV);
00035     return iov;
00036   };
00037   inline void getTimes(Tm *t1, Tm *t2, Tm *t3) const {
00038     *t1 = m_t[0];
00039     *t2 = m_t[1];
00040     *t3 = m_t[2];
00041   }
00042   std::vector<Tm> getTimes() const {
00043     std::vector<Tm> v;
00044     v.push_back(m_t[0]);
00045     v.push_back(m_t[1]);
00046     v.push_back(m_t[2]);
00047     return v;
00048   }
00049   inline void getTimes(Tm *t) const {
00050     t[0] = m_t[0];
00051     t[1] = m_t[1];
00052     t[2] = m_t[2];
00053   }
00054   inline Tm getTime(int i) {
00055     Tm t;
00056     if ((i > 0) && (i < 4)) {
00057       t = m_t[i - 1];
00058     }
00059     return t;
00060   }
00061   inline Tm getT1() {
00062     return m_t[0];
00063   }
00064   inline Tm getT2() {
00065     return m_t[1];
00066   }
00067   inline Tm getT3() {
00068     return m_t[2];
00069   }
00070 
00071   std::list<int> getIOVIDsLaterThan(const Tm &t)
00072     throw(std::runtime_error);
00073   std::list<int> getIOVIDsLaterThan(const Tm &tmin, const Tm &tmax)
00074     throw(std::runtime_error);
00075   std::list<int> getIOVIDsLaterThan(const Tm &t, int howMany)
00076     throw(std::runtime_error);
00077   std::list<int> getIOVIDsLaterThan(const Tm &t, const Tm &tmax,
00078                                     int howMany)
00079     throw(std::runtime_error);
00080 
00081   // Operators
00082   inline bool operator==(const LMFLmrSubIOV &m) const
00083     {
00084       return ( (m_lmfIOV   == m.m_lmfIOV) &&
00085                (m_t[0]    == m.m_t[0]) &&
00086                (m_t[1]    == m.m_t[1]) && 
00087                (m_t[2]    == m.m_t[2]));
00088     }
00089 
00090   inline bool operator!=(const LMFLmrSubIOV &m) const { return !(*this == m); }
00091 
00092   std::list<LMFLmrSubIOV> fetchByLMFIOV(const LMFIOV &iov);
00093 
00094  private:
00095   int m_lmfIOV;
00096   Tm m_t[3];
00097 
00098   std::string fetchIdSql(Statement *stmt);
00099   std::string setByIDSql(Statement *stmt, int id);
00100   std::string writeDBSql(Statement *stmt);
00101   void getParameters(ResultSet *rset);
00102   void init();
00103 };
00104 
00105 #endif