CMS 3D CMS Logo

RunInfoSchema.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_RunInfoSchema_h
2 #define CondCore_CondDB_RunInfoSchema_h
3 
4 #include "DbCore.h"
5 #include "IDbSchema.h"
6 //
7 #include <boost/date_time/posix_time/posix_time.hpp>
8 
9 namespace cond {
10 
11  namespace persistency {
12 
13  conddb_table(RUN_INFO) {
15  conddb_column(START_TIME, boost::posix_time::ptime);
16  conddb_column(END_TIME, boost::posix_time::ptime);
17 
18  struct MAX_RUN_NUMBER {
19  typedef cond::Time_t type;
20  static constexpr size_t size = 0;
22  static std::string fullyQualifiedName() { return "MAX(" + RUN_NUMBER::fullyQualifiedName() + ")"; }
23  };
24 
25  struct MIN_RUN_NUMBER {
26  typedef cond::Time_t type;
27  static constexpr size_t size = 0;
29  static std::string fullyQualifiedName() { return "MIN(" + RUN_NUMBER::fullyQualifiedName() + ")"; }
30  };
31 
32  struct MIN_START_TIME {
33  typedef boost::posix_time::ptime type;
34  static constexpr size_t size = 0;
36  static std::string fullyQualifiedName() { return "MIN(" + START_TIME::fullyQualifiedName() + ")"; }
37  };
38 
39  class Table : public IRunInfoTable {
40  public:
41  explicit Table(coral::ISchema& schema);
42  ~Table() override {}
43  bool exists() override;
44  void create() override;
45  bool select(cond::Time_t runNumber, boost::posix_time::ptime& start, boost::posix_time::ptime& end) override;
46  cond::Time_t getLastInserted(boost::posix_time::ptime& start, boost::posix_time::ptime& end) override;
47  bool getInclusiveRunRange(
48  cond::Time_t lower,
49  cond::Time_t upper,
50  std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >& runData)
51  override;
52  bool getInclusiveTimeRange(
53  const boost::posix_time::ptime& lower,
54  const boost::posix_time::ptime& upper,
55  std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >& runData)
56  override;
57  void insertOne(cond::Time_t runNumber,
58  const boost::posix_time::ptime& start,
59  const boost::posix_time::ptime& end) override;
60  void insert(const std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >&
61  runs) override;
62  void updateEnd(cond::Time_t runNumber, const boost::posix_time::ptime& end) override;
63 
64  private:
65  coral::ISchema& m_schema;
66  };
67  }
68 
69  class RunInfoSchema : public IRunInfoSchema {
70  public:
71  explicit RunInfoSchema(coral::ISchema& schema);
72  ~RunInfoSchema() override {}
73  bool exists() override;
74  bool create() override;
75  IRunInfoTable& runInfoTable() override;
76 
77  private:
79  };
80 
81  } // namespace persistency
82 } // namespace cond
83 #endif
Definition: start.py:1
IRunInfoTable & runInfoTable() override
def create(alignables, pedeDump, additionalData, outputFile, config)
#define conddb_column(...)
Definition: DbCore.h:76
unsigned long long Time_t
Definition: Time.h:14
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
RunInfoSchema(coral::ISchema &schema)
#define conddb_table(NAME)
Definition: DbCore.h:49