Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, JPersons, true> :
38  public JSelector
39  {
40  /**
41  * Get selector for the given table based on the location identifier.
42  *
43  * \param locID location identifier
44  * \return selector
45  */
46  getSelector(const JDBString& locID)
47  {
48  this->add(&T::LOCATIONID, locID);
49  }
50 
51  /**
52  * Get selector for the given table based on the login name.
53  *
54  * \param login login string
55  */
56  getSelector(const std::string& login)
57  {
58  this->add(&T::LOGIN, login);
59  }
60  };
61 
62 
63  /**
64  * Template specialisation for getting table specific selector.
65  */
66  template<class T>
67  struct getSelector<T, JDetectors, true> :
68  public JSelector
69  {
70  /**
71  * Get selector for the given table based on the serial number.
72  *
73  * \param id serial number
74  */
75  getSelector(const int id)
76  {
77  this->add(&T::SERIALNUMBER, id);
78  }
79 
80 
81  /**
82  * Get selector for the given table based on the object identifier.
83  *
84  * \param detid detector identifier
85  * \return selector
86  */
87  getSelector(const std::string& detid)
88  {
89  this->add(&T::OID, detid);
90  }
91  };
92 
93 
94  /**
95  * Template specialisation for getting table specific selector.
96  */
97  template<class T>
98  struct getSelector<T, JRuns, true> :
99  public JSelector
100  {
101  /**
102  * Get selector for the given table based on the detector serial number.
103  *
104  * \param id detector serial number
105  */
106  getSelector(const int id)
107  {
108  this->add(&T::DETID, id);
109  }
110 
111 
112  /**
113  * Get selector for the given table based on the detector serial number and run number.
114  *
115  * \param id detector serial number
116  * \param run run number
117  * \return selector
118  */
119  getSelector(const int id,
120  const int run)
121  {
122  this->add(&T::DETID, id);
123  this->add(&T::RUN, run);
124  }
125  };
126 
127 
128  /**
129  * Template specialisation for getting table specific selector.
130  */
131  template<class T>
132  struct getSelector<T, JDatalogNumbers, true> :
133  public JSelector
134  {
135  /**
136  * Get selector for the given table based on the detector identifier and a run range.
137  *
138  * \param detid detector identifier
139  * \param minrun minimal run number
140  * \param maxrun maximal run number
141  */
142  getSelector(const std::string& detid,
143  const int minrun,
144  const int maxrun)
145  {
146  this->add(&T::DETID, detid);
147  this->add("MINRUN", minrun);
148  this->add("MAXRUN", maxrun);
149  }
150  };
151 
152 
153  /**
154  * Template specialisation for getting table specific selector.
155  */
156  template<class T>
157  struct getSelector<T, JAllParams, true> :
158  public JSelector
159  {
160  /**
161  * Get selector for the given table based on the sub-system identifier.
162  *
163  * \param ssid ssid
164  */
165  getSelector(const std::string& ssid)
166  {
167  this->add(&T::SUBSYSTEMID, ssid);
168  }
169  };
170 
171 
172  /**
173  * Template specialisation for getting table specific selector.
174  */
175  template<class T>
176  struct getSelector<T, JToAshort, true> :
177  public JSelector
178  {
179  /**
180  * Get selector for the given table based on the detector identifier and a run range.
181  *
182  * \param detid detector identifier
183  * \param minrun minimal run number
184  * \param maxrun maximal run number
185  */
186  getSelector(const std::string& detid,
187  const int minrun,
188  const int maxrun)
189  {
190  this->add(&T::DETID, detid);
191  this->add("MINRUN", minrun);
192  this->add("MAXRUN", maxrun);
193  }
194  };
195 
196 
197  /**
198  * Template specialisation for getting table specific selector.
199  */
200  template<class T>
201  struct getSelector<T, JCLBMap, true> :
202  public JSelector
203  {
204  /**
205  * Get selector for the given table based on the detector identifier.
206  *
207  * \param detoid detector identifier
208  */
209  getSelector(const std::string& detoid)
210  {
211  this->add(&T::DETOID, detoid);
212  }
213  };
214 
215 
216  /**
217  * Template specialisation for getting table specific selector.
218  */
219  template<class T>
221  public JSelector
222  {
223  /**
224  * Get selector for the given table based on the serial number.
225  *
226  * \param id serial number
227  */
228  getSelector(const int id)
229  {
230  this->add(&T::DETID, id);
231  }
232 
233 
234  /**
235  * Get selector for the given table based on the detector identifier and a run range.
236  *
237  * \param detoid detector identifier
238  */
239  getSelector(const std::string& detoid)
240  {
241  this->add(&T::DETOID, detoid);
242  }
243  };
244 
245 
246  /**
247  * Template specialisation for getting table specific selector.
248  */
249  template<class T>
251  public JSelector
252  {
253  /**
254  * Get selector for the given table based on the detector identifier and a run range.
255  *
256  * \param detid detector identifier
257  * \param minrun minimal run number
258  * \param maxrun maximal run number
259  */
260  getSelector(const std::string& detid,
261  const int minrun,
262  const int maxrun)
263  {
264  this->add(&T::DETID, detid);
265  this->add("MINRUN", minrun);
266  this->add("MAXRUN", maxrun);
267  }
268  };
269 
270 
271  /**
272  * Template specialisation for getting table specific selector.
273  */
274  template<class T>
275  struct getSelector<T, JRunQuality, true> :
276  public getSelector<JRunSummaryNumbers>
277  {
278  /**
279  * Get selector for the given table based on the detector identifier and a run range.
280  *
281  * \param detid detector identifier
282  * \param minrun minimal run number
283  * \param maxrun maximal run number
284  */
285  getSelector(const std::string& detid,
286  const int minrun,
287  const int maxrun) :
288  getSelector<JRunSummaryNumbers>(detid, minrun, maxrun)
289  {}
290  };
291 
292 
293  /**
294  * Template specialisation for getting table specific selector.
295  */
296  template<class T>
297  struct getSelector<T, JRunsetupParams, true> :
298  public JSelector
299  {
300  /**
301  * Get selector for the given table based on the detector and run-setup identifier.
302  *
303  * \param detid detector identifier
304  * \param rs_oid runsetup identifier
305  */
306  getSelector(const std::string& detid,
307  const std::string& rs_oid)
308  {
309  this->add(&T::DETID, detid);
310  this->add(&T::RS_OID, rs_oid);
311  }
312  };
313 
314 
315  /**
316  * Template specialisation for getting table specific selector.
317  */
318  template<class T>
319  struct getSelector<T, JPMTHVRunSettings, true> :
320  public JSelector
321  {
322  /**
323  * Get selector for the given table based on the detector and run number.
324  *
325  * \param detoid detector identifier
326  * \param run run number
327  */
328  getSelector(const std::string& detoid,
329  const int run)
330  {
331  this->add(&T::DETOID, detoid);
332  this->add(&T::RUN, run);
333  }
334  };
335 
336 
337  /**
338  * Template specialisation for getting table specific selector.
339  */
340  template<class T>
341  struct getSelector<T, JVendorHV, true> :
342  public JSelector
343  {
344  /**
345  * Get selector for the given table based on the detector identifier.
346  *
347  * \param detid detector identifier
348  */
349  getSelector(const int detid)
350  {
351  this->add(&T::DETID, detid);
352  }
353  };
354 
355 
356  /**
357  * Template specialisation for getting table specific selector.
358  */
359  template<class T>
360  struct getSelector<T, JCLBID, true> :
361  public JSelector
362  {
363  /**
364  * Get selector for the given table.
365  */
367  {
368  this->add(&T::CLBID, -1, Selector::RelOp::Different);
369  }
370  };
371 
372 
373  /**
374  * Template specialisation for getting table specific selector.
375  */
376  template<class T>
377  struct getSelector<T, JUPI, true> :
378  public JSelector
379  {
380  /**
381  * Get selector for the given table based on the detector identifier.
382  *
383  * \param pbs %PBS
384  */
385  getSelector(const JPBS_t pbs)
386  {
387  this->add(&T::PBS, pbs);
388  }
389  };
390 
391 
392  /**
393  * Template specialisation for getting table specific selector.
394  */
395  template<class T>
396  struct getSelector<T, JAHRS, true> :
397  public JSelector
398  {
399  /**
400  * Get selector for the given table based on the detector identifier and a run range.
401  *
402  * \param detid detector identifier
403  * \param minrun minimal run number
404  * \param maxrun maximal run number
405  */
406  getSelector(const int detid,
407  const int minrun,
408  const int maxrun)
409  {
410  this->add(&T::DETID, detid);
411  this->add("MINRUN", minrun);
412  this->add("MAXRUN", maxrun);
413  }
414  };
415 
416 
417  /**
418  * Template specialisation for getting table specific selector.
419  */
420  template<class T>
422  public JSelector
423  {
424  /**
425  * Get selector for the given table based on the detector and run number.
426  *
427  * \param detoid detector identifier
428  */
429  getSelector(const std::string& detoid)
430  {
431  this->add(&T::DETOID, detoid);
432  }
433  };
434 }
435 
436 #endif
getSelector(const int id, const int run)
Get selector for the given table based on the detector serial number and run number.
getSelector(const std::string &detoid, const int run)
Get selector for the given table based on the detector and run number.
getSelector(const int id)
Get selector for the given table based on the serial number.
Wrapper class to read string until end-of-line.
Definition: JDBString.hh:19
Template class test for polymorphism.
Definition: JConversion.hh:21
getSelector()
Get selector for the given table.
getSelector(const JDBString &locID)
Get selector for the given table based on the location identifier.
getSelector(const int detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
Auxiliary class for specifying selection of database data.
getSelector(const JPBS_t pbs)
Get selector for the given table based on the detector identifier.
getSelector(const std::string &detoid)
Get selector for the given table based on the detector identifier.
getSelector(const std::string &detoid)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &login)
Get selector for the given table based on the login name.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then rm i $OUTPUT_FILE fi let RUN
getSelector(const int detid)
Get selector for the given table based on the detector identifier.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
getSelector(const std::string &detid)
Get selector for the given table based on the object identifier.
getSelector(const int id)
Get selector for the given table based on the detector serial number.
getSelector(const std::string &ssid)
Get selector for the given table based on the sub-system identifier.
Product breakdown structure (PBS).
Definition: JPBS_t.hh:25
getSelector(const std::string &detoid)
Get selector for the given table based on the detector and run number.
getSelector(const int id)
Get selector for the given table based on the serial number.
getSelector(const std::string &detid, const std::string &rs_oid)
Get selector for the given table based on the detector and run-setup identifier.
Template definition for getting table specific selector.
getSelector(const std::string &detid, const int minrun, const int maxrun)
Get selector for the given table based on the detector identifier and a run range.
Auxiliary data structure for data quality.
Definition: JRunQuality.hh:31