Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDBSupportkit.hh
Go to the documentation of this file.
1 #ifndef __JDB_JDBSUPPORTKIT__
2 #define __JDB_JDBSUPPORTKIT__
3 
4 #include "JLang/JComparable.hh"
5 
6 #include "JDB/JRuns.hh"
7 #include "JDB/JRunQuality.hh"
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JDATABASE {};
15 namespace JPP { using namespace JDATABASE; }
16 
17 /**
18  * Auxiliary classes and methods for database I/O.
19  */
20 namespace JDATABASE {
21 
22  using JLANG::JComparable;
23 
24 
25  /**
26  * Auxiliary class for detector/run comparisons.
27  */
28  struct JRun_t :
29  public JComparable<JRun_t>,
30  public JComparable<JRun_t, JRuns>,
31  public JComparable<JRun_t, JRunQuality>
32  {
33  /**
34  * Constructor.
35  *
36  * \param detector detector
37  * \param run run
38  */
39  JRun_t(const int detector,
40  const int run) :
41  detector(detector),
42  run (run)
43  {}
44 
45 
46  /**
47  * Less-than method.
48  *
49  * \param object run
50  */
51  bool less(const JRun_t& object) const
52  {
53  if (this->detector == object.detector)
54  return this->run < object.run;
55  else
56  return this->detector < object.detector;
57  }
58 
59 
60  /**
61  * Less-than method.
62  *
63  * \param object run
64  */
65  bool less(const JRuns& object) const
66  {
67  if (this->detector == object.DETID)
68  return this->run < object.RUN;
69  else
70  return this->detector < object.DETID;
71  }
72 
73 
74  /**
75  * More-than method.
76  *
77  * \param object run
78  */
79  bool more(const JRuns& object) const
80  {
81  if (this->detector == object.DETID)
82  return this->run > object.RUN;
83  else
84  return this->detector > object.DETID;
85  }
86 
87 
88  /**
89  * Less-than method.
90  *
91  * \param object run
92  */
93  bool less(const JRunQuality& object) const
94  {
95  if (this->detector == object.detector)
96  return this->run < object.run;
97  else
98  return this->detector < object.detector;
99  }
100 
101 
102  /**
103  * More-than method.
104  *
105  * \param object run
106  */
107  bool more(const JRunQuality& object) const
108  {
109  if (this->detector == object.detector)
110  return this->run > object.run;
111  else
112  return this->detector > object.detector;
113  }
114 
115 
116  int detector;
117  int run;
118  };
119 
120 }
121 
122 #endif
Auxiliary class for detector/run comparisons.
bool less(const JRuns &object) const
Less-than method.
JRun_t(const int detector, const int run)
Constructor.
bool more(const JRuns &object) const
More-than method.
bool less(const JRunQuality &object) const
Less-than method.
Template definition of auxiliary base class for comparison of data structures.
Definition: JComparable.hh:24
bool less(const JRun_t &object) const
Less-than method.
Auxiliary data structure for data quality.
Definition: JRunQuality.hh:31
bool more(const JRunQuality &object) const
More-than method.