File indexing completed on 2024-04-06 12:22:57
0001 #ifndef RUNIOV_H
0002 #define RUNIOV_H
0003
0004 #include <stdexcept>
0005 #include <iostream>
0006
0007 #include "OnlineDB/EcalCondDB/interface/IIOV.h"
0008 #include "OnlineDB/EcalCondDB/interface/RunTag.h"
0009 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0010
0011 typedef int run_t;
0012
0013 class RunIOV : public IIOV {
0014 public:
0015 friend class EcalCondDBInterface;
0016
0017 RunIOV();
0018 ~RunIOV() override;
0019
0020
0021 void setRunNumber(run_t run);
0022 run_t getRunNumber() const;
0023 void setRunStart(const Tm& start);
0024 Tm getRunStart() const;
0025 void setRunEnd(const Tm& end);
0026 Tm getRunEnd() const;
0027 void setRunTag(const RunTag& tag);
0028 RunTag getRunTag() const;
0029 void setID(int id);
0030
0031 void setDBInsertionTime(const Tm& dbtime) { m_dbtime = dbtime; }
0032 Tm getDBInsertionTime() { return m_dbtime; }
0033
0034
0035 int getID() { return m_ID; };
0036
0037 int fetchID() noexcept(false) override;
0038 int fetchIDByRunAndTag() noexcept(false);
0039 void setByID(int id) noexcept(false) override;
0040
0041
0042 inline bool operator==(const RunIOV& r) const {
0043 return (m_runNum == r.m_runNum && m_runStart == r.m_runStart && m_runEnd == r.m_runEnd && m_runTag == r.m_runTag);
0044 }
0045
0046 inline bool operator!=(const RunIOV& r) const { return !(*this == r); }
0047
0048 private:
0049
0050 run_t m_runNum;
0051 Tm m_runStart;
0052 Tm m_runEnd;
0053 RunTag m_runTag;
0054 Tm m_dbtime;
0055
0056 int writeDB() noexcept(false);
0057 int updateEndTimeDB() noexcept(false);
0058 int updateStartTimeDB() noexcept(false);
0059
0060 void setByRun(RunTag* tag, run_t run) noexcept(false);
0061 void setByRun(std::string location, run_t run) noexcept(false);
0062 void setByTime(std::string location, const Tm& t) noexcept(false);
0063 void setByRecentData(std::string dataTable, RunTag* tag, run_t run = (unsigned int)-1) noexcept(false);
0064 void setByRecentData(std::string dataTable, std::string location, run_t run) noexcept(false);
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 };
0079
0080 #endif