Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:50

0001 #ifndef LMFLMRSUBIOV_H
0002 #define LMFLMRSUBIOV_H
0003 
0004 /*
0005  Last updated by  Giovanni.Organtini@roma1.infn.it 2010
0006  */
0007 
0008 #include <map>
0009 
0010 #include "OnlineDB/EcalCondDB/interface/LMFUnique.h"
0011 #include "OnlineDB/EcalCondDB/interface/LMFIOV.h"
0012 
0013 class LMFLmrSubIOV : public LMFUnique {
0014 public:
0015   friend class EcalCondDBInterface;
0016 
0017   LMFLmrSubIOV();
0018   LMFLmrSubIOV(EcalDBConnection *c);
0019   LMFLmrSubIOV(oracle::occi::Environment *env, oracle::occi::Connection *conn);
0020   ~LMFLmrSubIOV() override;
0021 
0022   LMFLmrSubIOV &setLMFIOV(const LMFIOV &iov);
0023   LMFLmrSubIOV &setLMFIOV(int i);
0024   LMFLmrSubIOV &setTimes(const Tm &t1, const Tm &t2, const Tm &t3);
0025   LMFLmrSubIOV &setTimes(const std::vector<Tm> &t);
0026   LMFLmrSubIOV &setTimes(Tm *t);  // array of three components
0027 
0028   int getLMFIOVID() const { return m_lmfIOV; };
0029   LMFIOV getLMFIOV() const {
0030     LMFIOV iov(m_env, m_conn);
0031     iov.setByID(m_lmfIOV);
0032     return iov;
0033   };
0034   inline void getTimes(Tm *t1, Tm *t2, Tm *t3) const {
0035     *t1 = m_t[0];
0036     *t2 = m_t[1];
0037     *t3 = m_t[2];
0038   }
0039   std::vector<Tm> getTimes() const {
0040     std::vector<Tm> v;
0041     v.push_back(m_t[0]);
0042     v.push_back(m_t[1]);
0043     v.push_back(m_t[2]);
0044     return v;
0045   }
0046   inline void getTimes(Tm *t) const {
0047     t[0] = m_t[0];
0048     t[1] = m_t[1];
0049     t[2] = m_t[2];
0050   }
0051   inline Tm getTime(int i) {
0052     Tm t;
0053     if ((i > 0) && (i < 4)) {
0054       t = m_t[i - 1];
0055     }
0056     return t;
0057   }
0058   inline Tm getT1() { return m_t[0]; }
0059   inline Tm getT2() { return m_t[1]; }
0060   inline Tm getT3() { return m_t[2]; }
0061 
0062   std::list<int> getIOVIDsLaterThan(const Tm &t) noexcept(false);
0063   std::list<int> getIOVIDsLaterThan(const Tm &tmin, const Tm &tmax) noexcept(false);
0064   std::list<int> getIOVIDsLaterThan(const Tm &t, int howMany) noexcept(false);
0065   std::list<int> getIOVIDsLaterThan(const Tm &t, const Tm &tmax, int howMany) noexcept(false);
0066 
0067   // Operators
0068   inline bool operator==(const LMFLmrSubIOV &m) const {
0069     return ((m_lmfIOV == m.m_lmfIOV) && (m_t[0] == m.m_t[0]) && (m_t[1] == m.m_t[1]) && (m_t[2] == m.m_t[2]));
0070   }
0071 
0072   inline bool operator!=(const LMFLmrSubIOV &m) const { return !(*this == m); }
0073 
0074   std::list<LMFLmrSubIOV> fetchByLMFIOV(const LMFIOV &iov);
0075 
0076 private:
0077   int m_lmfIOV;
0078   Tm m_t[3];
0079 
0080   std::string fetchIdSql(Statement *stmt) override;
0081   std::string setByIDSql(Statement *stmt, int id) override;
0082   std::string writeDBSql(Statement *stmt) override;
0083   void getParameters(ResultSet *rset) override;
0084   void init();
0085 };
0086 
0087 #endif