Auxiliary class for mapping serial number and object identifier of detectors.
More...
#include <JDBToolkit.hh>
|
void | initialise () |
| Initialise.
|
|
const JDetectors & | operator[] (const std::string &detid) |
| Get detector.
|
|
const JDetectors & | operator[] (const int id) |
| Get detector.
|
|
int | operator() (const std::string &detid) |
| Get detector serial number.
|
|
std::string | operator() (const int id) |
| Get detector identifier.
|
|
int | operator() (const std::string &detid, const JType< int > &type) |
| Get serial number according given data type.
|
|
std::string | operator() (const std::string &detid, const JType< std::string > &type) |
| Get detector identifier according given data type.
|
|
Auxiliary class for mapping serial number and object identifier of detectors.
Definition at line 42 of file JDBToolkit.hh.
◆ initialise()
void JDATABASE::JDetectorsHelper::initialise |
( |
| ) |
|
|
inline |
Initialise.
Definition at line 48 of file JDBToolkit.hh.
49 {
51
52 for (JDetectors parameters; rs >> parameters; ) {
53 this->push_back(parameters);
54 }
55
56 rs.Close();
57 }
static JDB & get()
Get connection to database.
const char * getTable()
Get table name.
◆ operator[]() [1/2]
const JDetectors & JDATABASE::JDetectorsHelper::operator[] |
( |
const std::string & | detid | ) |
|
|
inline |
Get detector.
- Parameters
-
- Returns
- detector
Definition at line 66 of file JDBToolkit.hh.
67 {
70
71 if (this->empty()) {
73 }
74
75 const_iterator p = find_if(this->begin(), this->end(), make_predicate(&
JDetectors::OID, detid));
76
77 if (p != this->end())
78 return *p;
79 else
81 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void initialise()
Initialise.
◆ operator[]() [2/2]
const JDetectors & JDATABASE::JDetectorsHelper::operator[] |
( |
const int | id | ) |
|
|
inline |
Get detector.
- Parameters
-
- Returns
- detector
Definition at line 90 of file JDBToolkit.hh.
91 {
94
95 if (this->empty()) {
97 }
98
100
101 if (p != this->end())
102 return *p;
103 else
105 }
◆ operator()() [1/4]
int JDATABASE::JDetectorsHelper::operator() |
( |
const std::string & | detid | ) |
|
|
inline |
Get detector serial number.
- Parameters
-
- Returns
- serial number
Definition at line 114 of file JDBToolkit.hh.
115 {
116 return (*this)[detid].SERIALNUMBER;
117 }
◆ operator()() [2/4]
std::string JDATABASE::JDetectorsHelper::operator() |
( |
const int | id | ) |
|
|
inline |
Get detector identifier.
- Parameters
-
- Returns
- object identifier
Definition at line 126 of file JDBToolkit.hh.
127 {
128 return (*this)[id].OID;
129 }
◆ operator()() [3/4]
int JDATABASE::JDetectorsHelper::operator() |
( |
const std::string & | detid, |
|
|
const JType< int > & | type ) |
|
inline |
Get serial number according given data type.
- Parameters
-
detid | object identifier or serial number |
type | data type |
- Returns
- object identifier
Definition at line 139 of file JDBToolkit.hh.
140 {
142
144 return to_value<int>(detid);
145 else
146 return (*this)(detid);
147 }
bool is_integer(const std::string &buffer)
Check if string is an integer.
◆ operator()() [4/4]
std::string JDATABASE::JDetectorsHelper::operator() |
( |
const std::string & | detid, |
|
|
const JType< std::string > & | type ) |
|
inline |
Get detector identifier according given data type.
- Parameters
-
detid | object identifier or serial number |
type | data type |
- Returns
- object identifier
Definition at line 157 of file JDBToolkit.hh.
158 {
160
162 return (*this)(to_value<int>(detid));
163 else
164 return detid;
165 }
◆ helper
The documentation for this struct was generated from the following files: