Jpp
JSelectorSupportkit.hh
Go to the documentation of this file.
1 #ifndef __JDB_JSELECTORSUPPORTKIT__
2 #define __JDB_JSELECTORSUPPORTKIT__
3 
4 #include <string>
5 
6 #include "JLang/JConversion.hh"
7 
8 #include "JDB/JSelector.hh"
9 #include "JDB/JDBTypes.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JDATABASE {};
17 namespace JPP { using namespace JDATABASE; }
18 
19 namespace JDATABASE {
20 
21  using JLANG::JConversion;
22 
23  /**
24  * Template definition for getting table specific selector.\n
25  * Note that the template argument
26  * <tt>T</tt> refers to the targeted table and
27  * <tt>JTable_t</tt> to the actual table.\n
28  * This allows to use pointers to data members for column names rather than text strings.
29  */
30  template<class T, class JTable_t = T, bool is_same = JConversion<T, JTable_t>::is_same>
31  struct getSelector;
32 
33  /**
34  * Template specialisation for getting table specific selector.
35  */
36  template<class T>
37  struct getSelector<T, JDetectors, true> :
38  public JSelector
39  {
40  /**
41  * Get selector for the JDetectors table based on the serial number.
42  *
43  * \param id serial number
44  */
45  getSelector(const int id)
46  {
47  this->add(&T::SERIALNUMBER, id);
48  }
49 
50 
51  /**
52  * Get selector for the JDetectors table based on the object identifier.
53  *
54  * \param detid detector identifier
55  * \return selector
56  */
57  getSelector(const std::string& detid)
58  {
59  this->add(&T::OID, detid);
60  }
61  };
62 
63 
64  /**
65  * Template specialisation for getting table specific selector.
66  */
67  template<class T>
68  struct getSelector<T, JRuns, true> :
69  public JSelector
70  {
71  /**
72  * Get selector for the JRuns table based on the detector serial number.
73  *
74  * \param id detector serial number
75  */
76  getSelector(const int id)
77  {
78  this->add(&T::DETID, id);
79  }
80 
81 
82  /**
83  * Get selector for the JRuns table based on the detector serial number and run number.
84  *
85  * \param id detector serial number
86  * \param run run number
87  * \return selector
88  */
89  getSelector(const int id,
90  const int run)
91  {
92  this->add(&T::DETID, id);
93  this->add(&T::RUN, run);
94  }
95  };
96 
97 
98  /**
99  * Template specialisation for getting table specific selector.
100  */
101  template<class T>
102  struct getSelector<T, JDatalogNumbers, true> :
103  public JSelector
104  {
105  /**
106  * Get selector for the JToAshort table based on the detector identifier and a run range.
107  *
108  * \param detid detector identifier
109  * \param minrun minimal run number
110  * \param maxrun maximal run number
111  */
112  getSelector(const std::string& detid,
113  const int minrun,
114  const int maxrun)
115  {
116  this->add(&T::DETID, detid);
117  this->add("MINRUN", minrun);
118  this->add("MAXRUN", maxrun);
119  }
120  };
121 
122 
123  /**
124  * Template specialisation for getting table specific selector.
125  */
126  template<class T>
127  struct getSelector<T, JAllParams, true> :
128  public JSelector
129  {
130  /**
131  * Get selector for the JAllParams table based on the sub-system identifier.
132  *
133  * \param ssid ssid
134  */
135  getSelector(const std::string& ssid)
136  {
137  this->add(&T::SUBSYSTEMID, ssid);
138  }
139  };
140 
141 
142  /**
143  * Template specialisation for getting table specific selector.
144  */
145  template<class T>
146  struct getSelector<T, JToAshort, true> :
147  public JSelector
148  {
149  /**
150  * Get selector for the JToAshort table based on the detector identifier and a run range.
151  *
152  * \param detid detector identifier
153  * \param minrun minimal run number
154  * \param maxrun maximal run number
155  */
156  getSelector(const std::string& detid,
157  const int minrun,
158  const int maxrun)
159  {
160  this->add(&T::DETID, detid);
161  this->add("MINRUN", minrun);
162  this->add("MAXRUN", maxrun);
163  }
164  };
165 
166 
167  /**
168  * Template specialisation for getting table specific selector.
169  */
170  template<class T>
171  struct getSelector<T, JCLBMap, true> :
172  public JSelector
173  {
174  /**
175  * Get selector for the JCLBMap table based on the detector identifier and a run range.
176  *
177  * \param detoid detector identifier
178  */
179  getSelector(const std::string& detoid)
180  {
181  this->add(&T::DETOID, detoid);
182  }
183  };
184 
185 
186  /**
187  * Template specialisation for getting table specific selector.
188  */
189  template<class T>
190  struct getSelector<T, JRunSummaryNumbers, true> :
191  public JSelector
192  {
193  /**
194  * Get selector for the JRunSummaryNumbers table based on the detector identifier and a run range.
195  *
196  * \param detid detector identifier
197  * \param minrun minimal run number
198  * \param maxrun maximal run number
199  */
200  getSelector(const std::string& detid,
201  const int minrun,
202  const int maxrun)
203  {
204  this->add(&T::DETID, detid);
205  this->add("MINRUN", minrun);
206  this->add("MAXRUN", maxrun);
207  }
208  };
209 
210 
211  /**
212  * Template specialisation for getting table specific selector.
213  */
214  template<class T>
215  struct getSelector<T, JRunQuality, true> :
216  public getSelector<JRunSummaryNumbers>
217  {
218  /**
219  * Get selector for the JRunSummaryNumbers table based on the detector identifier and a run range.
220  *
221  * \param detid detector identifier
222  * \param minrun minimal run number
223  * \param maxrun maximal run number
224  */
225  getSelector(const std::string& detid,
226  const int minrun,
227  const int maxrun) :
228  getSelector<JRunSummaryNumbers>(detid, minrun, maxrun)
229  {}
230  };
231 
232 
233  /**
234  * Template specialisation for getting table specific selector.
235  */
236  template<class T>
237  struct getSelector<T, JRunsetupParams, true> :
238  public JSelector
239  {
240  /**
241  * Get selector for the JRunSetupParams table based on the detector and run-setup identifier.
242  *
243  * \param detid detector identifier
244  * \param rs_oid runsetup identifier
245  */
246  getSelector(const std::string& detid,
247  const std::string& rs_oid)
248  {
249  this->add(&T::DETID, detid);
250  this->add(&T::RS_OID, rs_oid);
251  }
252  };
253 
254 
255  /**
256  * Template specialisation for getting table specific selector.
257  */
258  template<class T>
259  struct getSelector<T, JPMTHVRunSettings, true> :
260  public JSelector
261  {
262  /**
263  * Get selector for the JPMTHVRunSettings table based on the detector and run number.
264  *
265  * \param detid detector identifier
266  * \param run run number
267  */
268  getSelector(const std::string& detid,
269  const int run)
270  {
271  this->add(&T::DETOID, detid);
272  this->add(&T::RUN, run);
273  }
274  };
275 }
276 
277 #endif
JDATABASE::getSelector< T, JRuns, true >::getSelector
getSelector(const int id)
Get selector for the JRuns table based on the detector serial number.
Definition: JSelectorSupportkit.hh:76
JDATABASE::JDatalogNumbers
Definition: JDatalogNumbers.hh:17
JDBTypes.hh
JSelector.hh
JDATABASE::getSelector< T, JCLBMap, true >::getSelector
getSelector(const std::string &detoid)
Get selector for the JCLBMap table based on the detector identifier and a run range.
Definition: JSelectorSupportkit.hh:179
JDATABASE::JRunSummaryNumbers
Definition: JRunSummaryNumbers.hh:17
JDATABASE::JToAshort
Definition: JToAshort.hh:17
JLANG::JConversion
Template class test for polymorphism.
Definition: JConversion.hh:21
JDATABASE::getSelector< T, JPMTHVRunSettings, true >::getSelector
getSelector(const std::string &detid, const int run)
Get selector for the JPMTHVRunSettings table based on the detector and run number.
Definition: JSelectorSupportkit.hh:268
JDATABASE::getSelector< T, JRunSummaryNumbers, true >::getSelector
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the JRunSummaryNumbers table based on the detector identifier and a run range.
Definition: JSelectorSupportkit.hh:200
JDATABASE
Auxiliary classes and methods for database I/O.
Definition: JAHRS.hh:12
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDATABASE::getSelector< T, JDatalogNumbers, true >::getSelector
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the JToAshort table based on the detector identifier and a run range.
Definition: JSelectorSupportkit.hh:112
JDATABASE::getSelector< T, JAllParams, true >::getSelector
getSelector(const std::string &ssid)
Get selector for the JAllParams table based on the sub-system identifier.
Definition: JSelectorSupportkit.hh:135
JDATABASE::getSelector< T, JDetectors, true >::getSelector
getSelector(const std::string &detid)
Get selector for the JDetectors table based on the object identifier.
Definition: JSelectorSupportkit.hh:57
JDATABASE::getSelector< T, JDetectors, true >::getSelector
getSelector(const int id)
Get selector for the JDetectors table based on the serial number.
Definition: JSelectorSupportkit.hh:45
JDATABASE::JPMTHVRunSettings
Definition: JPMTHVRunSettings.hh:17
JDATABASE::JCLBMap
Definition: JCLBMap.hh:17
JDATABASE::getSelector
Template definition for getting table specific selector.
Definition: JSelectorSupportkit.hh:31
JDATABASE::getSelector< T, JToAshort, true >::getSelector
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the JToAshort table based on the detector identifier and a run range.
Definition: JSelectorSupportkit.hh:156
JDATABASE::getSelector< T, JRunQuality, true >::getSelector
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the JRunSummaryNumbers table based on the detector identifier and a run range.
Definition: JSelectorSupportkit.hh:225
JDATABASE::JRunQuality
Auxiliary data structure for data quality.
Definition: JRunQuality.hh:31
JDATABASE::JAllParams
Definition: JAllParams.hh:18
JDATABASE::getSelector< T, JRunsetupParams, true >::getSelector
getSelector(const std::string &detid, const std::string &rs_oid)
Get selector for the JRunSetupParams table based on the detector and run-setup identifier.
Definition: JSelectorSupportkit.hh:246
JConversion.hh
JDATABASE::JRunsetupParams
Definition: JRunsetupParams.hh:17
JDATABASE::JSelector
Auxiliary class for specifying selection of database data.
Definition: JDB/JSelector.hh:67
JDATABASE::JDetectors
Definition: JDetectors.hh:18
JDATABASE::JRuns
Definition: JRuns.hh:17
JDATABASE::getSelector< T, JRuns, true >::getSelector
getSelector(const int id, const int run)
Get selector for the JRuns table based on the detector serial number and run number.
Definition: JSelectorSupportkit.hh:89