Jpp  17.0.0-rc.1
the software that should make you happy
 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  * Get selector for the given table based on the detector serial number and run number.
129  *
130  * \param id detector serial number
131  * \param minrun minimal run number
132  * \param maxrun maximal run number
133  * \return selector
134  */
135  getSelector(const int id,
136  const int minrun,
137  const int maxrun)
138  {
139  this->add(&T::DETID, id);
140  this->add(&T::RUN, minrun, Selector::RelOp::GreaterEqual);
141  this->add(&T::RUN, maxrun, Selector::RelOp::LessEqual);
142  }
143  };
144 
145 
146  /**
147  * Template specialisation for getting table specific selector.
148  */
149  template<class T>
150  struct getSelector<T, JDatalogNumbers, true> :
151  public JSelector
152  {
153  /**
154  * Get selector for the given table based on the detector identifier and a run range.
155  *
156  * \param detid detector identifier
157  * \param minrun minimal run number
158  * \param maxrun maximal run number
159  */
160  getSelector(const std::string& detid,
161  const int minrun,
162  const int maxrun)
163  {
164  this->add(&T::DETID, detid);
165  this->add("MINRUN", minrun);
166  this->add("MAXRUN", maxrun);
167  }
168  };
169 
170 
171  /**
172  * Template specialisation for getting table specific selector.
173  */
174  template<class T>
175  struct getSelector<T, JAllParams, true> :
176  public JSelector
177  {
178  /**
179  * Get selector for the given table based on the sub-system identifier.
180  *
181  * \param ssid ssid
182  */
183  getSelector(const std::string& ssid)
184  {
185  this->add(&T::SUBSYSTEMID, ssid);
186  }
187  };
188 
189 
190  /**
191  * Template specialisation for getting table specific selector.
192  */
193  template<class T>
194  struct getSelector<T, JToAshort, true> :
195  public JSelector
196  {
197  /**
198  * Get selector for the given table based on the detector identifier and a run range.
199  *
200  * \param detid detector identifier
201  * \param minrun minimal run number
202  * \param maxrun maximal run number
203  */
204  getSelector(const std::string& detid,
205  const int minrun,
206  const int maxrun)
207  {
208  this->add(&T::DETID, detid);
209  this->add("MINRUN", minrun);
210  this->add("MAXRUN", maxrun);
211  }
212  };
213 
214 
215  /**
216  * Template specialisation for getting table specific selector.
217  */
218  template<class T>
219  struct getSelector<T, JCLBMap, true> :
220  public JSelector
221  {
222  /**
223  * Get selector for the given table based on the detector identifier.
224  *
225  * \param detoid detector identifier
226  */
227  getSelector(const std::string& detoid)
228  {
229  this->add(&T::DETOID, detoid);
230  }
231  };
232 
233 
234  /**
235  * Template specialisation for getting table specific selector.
236  */
237  template<class T>
239  public JSelector
240  {
241  /**
242  * Get selector for the given table based on the serial number.
243  *
244  * \param id serial number
245  */
246  getSelector(const int id)
247  {
248  this->add(&T::DETID, id);
249  }
250 
251 
252  /**
253  * Get selector for the given table based on the detector identifier and a run range.
254  *
255  * \param detoid detector identifier
256  */
257  getSelector(const std::string& detoid)
258  {
259  this->add(&T::DETOID, detoid);
260  }
261  };
262 
263 
264  /**
265  * Template specialisation for getting table specific selector.
266  */
267  template<class T>
269  public JSelector
270  {
271  /**
272  * Get selector for the given table based on the detector identifier and a run range.
273  *
274  * \param detid detector identifier
275  * \param minrun minimal run number
276  * \param maxrun maximal run number
277  */
278  getSelector(const std::string& detid,
279  const int minrun,
280  const int maxrun)
281  {
282  this->add(&T::DETID, detid);
283  this->add("MINRUN", minrun);
284  this->add("MAXRUN", maxrun);
285  }
286  };
287 
288 
289  /**
290  * Template specialisation for getting table specific selector.
291  */
292  template<class T>
293  struct getSelector<T, JRunQuality, true> :
294  public getSelector<JRunSummaryNumbers>
295  {
296  /**
297  * Get selector for the given table based on the detector identifier and a run range.
298  *
299  * \param detid detector identifier
300  * \param minrun minimal run number
301  * \param maxrun maximal run number
302  */
303  getSelector(const std::string& detid,
304  const int minrun,
305  const int maxrun) :
306  getSelector<JRunSummaryNumbers>(detid, minrun, maxrun)
307  {}
308  };
309 
310 
311  /**
312  * Template specialisation for getting table specific selector.
313  */
314  template<class T>
315  struct getSelector<T, JRunsetupParams, true> :
316  public JSelector
317  {
318  /**
319  * Get selector for the given table based on the detector and run-setup identifier.
320  *
321  * \param detid detector identifier
322  * \param rs_oid runsetup identifier
323  */
324  getSelector(const std::string& detid,
325  const std::string& rs_oid)
326  {
327  this->add(&T::DETID, detid);
328  this->add(&T::RS_OID, rs_oid);
329  }
330  };
331 
332 
333  /**
334  * Template specialisation for getting table specific selector.
335  */
336  template<class T>
337  struct getSelector<T, JPMTHVSettings, true> :
338  public JSelector
339  {
340  /**
341  * Get selector for the given table based on the detector and run number.
342  *
343  * \param detoid detector identifier
344  * \param cg_name cg_name
345  */
346  getSelector(const std::string& detoid,
347  const std::string& cg_name)
348  {
349  this->add(&T::DETOID, detoid);
350  this->add(&T::CG_NAME, cg_name);
351  }
352  };
353 
354 
355  /**
356  * Template specialisation for getting table specific selector.
357  */
358  template<class T>
359  struct getSelector<T, JPMTHVRunSettings, true> :
360  public JSelector
361  {
362  /**
363  * Get selector for the given table based on the detector and run number.
364  *
365  * \param detoid detector identifier
366  * \param run run number
367  */
368  getSelector(const std::string& detoid,
369  const int run)
370  {
371  this->add(&T::DETOID, detoid);
372  this->add(&T::RUN, run);
373  }
374  };
375 
376 
377  /**
378  * Template specialisation for getting table specific selector.
379  */
380  template<class T>
381  struct getSelector<T, JVendorHV, true> :
382  public JSelector
383  {
384  /**
385  * Get selector for the given table based on the detector identifier.
386  *
387  * \param detid detector identifier
388  */
389  getSelector(const int detid)
390  {
391  this->add(&T::DETID, detid);
392  }
393  };
394 
395 
396  /**
397  * Template specialisation for getting table specific selector.
398  */
399  template<class T>
400  struct getSelector<T, JCLBID, true> :
401  public JSelector
402  {
403  /**
404  * Get selector for the given table.
405  */
407  {
408  this->add(&T::CLBID, -1, Selector::RelOp::Different);
409  }
410  };
411 
412 
413  /**
414  * Template specialisation for getting table specific selector.
415  */
416  template<class T>
417  struct getSelector<T, JUPI, true> :
418  public JSelector
419  {
420  /**
421  * Get selector for the given table based on the detector identifier.
422  *
423  * \param pbs %PBS
424  */
425  getSelector(const JPBS_t pbs)
426  {
427  this->add(&T::PBS, pbs);
428  }
429  };
430 
431 
432  /**
433  * Template specialisation for getting table specific selector.
434  */
435  template<class T>
436  struct getSelector<T, JAHRS, true> :
437  public JSelector
438  {
439  /**
440  * Get selector for the given table based on the detector identifier and a run range.
441  *
442  * \param detid detector identifier
443  * \param minrun minimal run number
444  * \param maxrun maximal run number
445  */
446  getSelector(const int detid,
447  const int minrun,
448  const int maxrun)
449  {
450  this->add(&T::DETID, detid);
451  this->add("MINRUN", minrun);
452  this->add("MAXRUN", maxrun);
453  }
454  };
455 
456 
457  /**
458  * Template specialisation for getting table specific selector.
459  */
460  template<class T>
462  public JSelector
463  {
464  /**
465  * Get selector for the given table based on the detector and run number.
466  *
467  * \param detoid detector identifier
468  */
469  getSelector(const std::string& detoid)
470  {
471  this->add(&T::DETOID, detoid);
472  }
473  };
474 }
475 
476 #endif
set_variable LOCATIONID(getLocationID-L ${LOGIN}) if(($
Definition: JEditTuneHV.sh:80
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.
then set_variable DETID
Definition: JEditTuneHV.sh:63
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.
getSelector(const int id, const int minrun, const int maxrun)
Get selector for the given table based on the detector serial number and run number.
Product breakdown structure (PBS).
Definition: JPBS_t.hh:27
getSelector(const std::string &detoid)
Get selector for the given table based on the detector and run number.
getSelector(const std::string &detoid, const std::string &cg_name)
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:34