CMS 3D CMS Logo

LMFSeqDat.h
Go to the documentation of this file.
1 #ifndef LMFSEQDAT_H
2 #define LMFSEQDAT_H
3 
4 /*
5  Last updated by Giovanni.Organtini@roma1.infn.it 2010
6  */
7 
8 #include <map>
9 
13 
14 class LMFSeqDat : public LMFUnique {
15  public:
16  friend class EcalCondDBInterface;
17 
18  LMFSeqDat();
19  LMFSeqDat(oracle::occi::Environment* env,
20  oracle::occi::Connection* conn);
22  ~LMFSeqDat() override;
23 
24  // Methods for user data
25  LMFSeqDat& setRunIOV(const RunIOV &iov);
26  LMFSeqDat& setSequenceNumber(int n) { setInt("seq_num", n); return *this; }
28  setString("seq_start", start.str());
29  return *this;
30  }
32  setString("seq_stop", end.str());
33  return *this;
34  }
35  LMFSeqDat& setVersions(int vmin, int vmax) {
36  setVmin(vmin) ; setVmax(vmax);
37  return *this;
38  }
39 
40  RunIOV getRunIOV() const;
41  int getSequenceNumber() const { return getInt("seq_num"); }
42  Tm getSequenceStart() const {
43  Tm t;
44  t.setToString(getString("seq_start"));
45  return t;
46  }
47  Tm getSequenceStop() const;
48  int getVmin() const { return getInt("vmin"); }
49  int getVmax() const { return getInt("vmax"); }
50 
51  bool isValid() const override ;
52  // Operators
53  bool operator==(const LMFSeqDat &m) const
54  {
55  return ( getSequenceNumber() == m.getSequenceNumber() &&
56  getRunIOV() == m.getRunIOV() &&
59  getVmin() == m.getVmin() &&
60  getVmax() == m.getVmax());
61  }
62 
63  bool operator!=(const LMFSeqDat &m) const { return !(*this == m); }
64  std::map<int, LMFSeqDat> fetchByRunIOV(RunIOV &iov);
65  std::map<int, LMFSeqDat> fetchByRunIOV(RunIOV &iov, const LMFColor &col);
66  LMFSeqDat fetchByRunIOV(RunIOV &iov, int seq_num) {
67  return fetchByRunIOV(iov)[seq_num];
68  }
69  std::map<int, LMFSeqDat> fetchByRunNumber(int runno);
70  LMFSeqDat fetchByRunNumber(int runno, int seq_num) {
71  return fetchByRunNumber(runno)[seq_num];
72  }
73  LMFSeqDat fetchByRunNumber(int runno, const Tm& taken_at);
74  LMFSeqDat fetchByRunNumber(int runno, std::string taken_at);
77 
78  private:
80 
81  void setVmin(int v) {
82  setInt("vmin", v);
83  }
84  void setVmax(int v) {
85  setInt("vmax", v);
86  }
88  std::string setByIDSql(Statement *stmt, int id) override;
89  std::string writeDBSql(Statement *stmt) override;
90  void getParameters(ResultSet *rset) override;
91 
92  void fetchParentIDs() noexcept(false) override;
93  std::map<int, LMFSeqDat> fetchByRunIOV(const std::vector<std::string>& par,
94  std::string sql,
96  noexcept(false);
97  std::map<int, LMFSeqDat> fetchByRunIOV(int par, std::string sql,
98  std::string method)
99  noexcept(false);
100  std::map<int, LMFSeqDat> fetchByRunIOV(std::string sql,
101  std::string method)
102  noexcept(false);
103 
104 };
105 
106 #endif
Definition: start.py:1
LMFUnique & setInt(std::string key, int value)
Definition: LMFUnique.cc:33
std::map< int, LMFSeqDat > fetchByRunNumber(int runno)
Definition: LMFSeqDat.cc:295
Tm getSequenceStop() const
Definition: LMFSeqDat.cc:55
LMFSeqDat & setRunIOV(const RunIOV &iov)
Definition: LMFSeqDat.cc:66
LMFSeqDat & setSequenceStop(const Tm &end)
Definition: LMFSeqDat.h:31
bool operator!=(const LMFSeqDat &m) const
Definition: LMFSeqDat.h:63
std::map< int, LMFSeqDat > fetchByRunIOV(RunIOV &iov)
Definition: LMFSeqDat.cc:268
LMFSeqDat fetchLast()
Definition: LMFSeqDat.cc:251
int getVmax() const
Definition: LMFSeqDat.h:49
int getSequenceNumber() const
Definition: LMFSeqDat.h:41
#define noexcept
oracle::occi::ResultSet ResultSet
Definition: LMFUnique.h:19
void fetchParentIDs() noexcept(false) override
Definition: LMFSeqDat.cc:181
LMFSeqDat & setSequenceNumber(int n)
Definition: LMFSeqDat.h:26
std::string setByIDSql(Statement *stmt, int id) override
Definition: LMFSeqDat.cc:110
int getInt(std::string fieldname) const
Definition: LMFUnique.cc:203
oracle::occi::Connection * conn
LMFSeqDat fetchByRunIOV(RunIOV &iov, int seq_num)
Definition: LMFSeqDat.h:66
RunIOV m_runIOV
Definition: LMFSeqDat.h:79
void setVmax(int v)
Definition: LMFSeqDat.h:84
oracle::occi::Statement Statement
Definition: LMFUnique.h:20
Tm getSequenceStart() const
Definition: LMFSeqDat.h:42
#define end
Definition: vmac.h:39
void setVmin(int v)
Definition: LMFSeqDat.h:81
~LMFSeqDat() override
Definition: LMFSeqDat.cc:51
bool operator==(const LMFSeqDat &m) const
Definition: LMFSeqDat.h:53
LMFUnique & setString(std::string key, std::string value)
Definition: LMFUnique.cc:15
RunIOV getRunIOV() const
Definition: LMFSeqDat.cc:61
void getParameters(ResultSet *rset) override
Definition: LMFSeqDat.cc:118
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:193
LMFSeqDat fetchByRunNumber(int runno, int seq_num)
Definition: LMFSeqDat.h:70
std::string writeDBSql(Statement *stmt) override
Definition: LMFSeqDat.cc:149
RunIOV fetchLastRun()
Definition: LMFSeqDat.cc:264
LMFSeqDat & setVersions(int vmin, int vmax)
Definition: LMFSeqDat.h:35
std::string fetchIdSql(Statement *stmt) override
Definition: LMFSeqDat.cc:75
std::string str() const
Definition: Tm.cc:89
bool isValid() const override
Definition: LMFSeqDat.cc:134
col
Definition: cuy.py:1010
LMFSeqDat & setSequenceStart(const Tm &start)
Definition: LMFSeqDat.h:27
oracle::occi::Statement * stmt
std::string getString(std::string fieldname) const
Definition: LMFUnique.cc:194
Definition: RunIOV.h:13
Definition: Tm.h:13
int getVmin() const
Definition: LMFSeqDat.h:48