Auxiliary class for mapping PBS and serial number of product to UPI.
More...
#include <JDBToolkit.hh>
Auxiliary class for mapping PBS and serial number of product to UPI.
Definition at line 254 of file JDBToolkit.hh.
◆ initialise()
void JDATABASE::JUPIHelper::initialise |
( |
const JPBS_t & | pbs | ) |
|
|
inline |
Initialise.
- Parameters
-
Definition at line 262 of file JDBToolkit.hh.
263 {
265
266 for (JUPI parameters; rs >> parameters; ) {
267
268 const JUPI_t upi(parameters.PBS,
269 parameters.VARIANT,
270 parameters.VERSION,
271 parameters.SERIALNUMBER);
272
273 (*this)[pbs][parameters.SERIALNUMBER] = upi;
274 }
275
276 rs.Close();
277 }
static JDB & get()
Get connection to database.
const char * getTable()
Get table name.
◆ operator()()
JUPI_t JDATABASE::JUPIHelper::operator() |
( |
const JPBS_t & | pbs, |
|
|
const int | number ) |
|
inline |
Get UPI.
- Parameters
-
pbs | PBS |
number | serial number |
- Returns
- UPI
Definition at line 287 of file JDBToolkit.hh.
288 {
289 const_iterator p = this->find(pbs);
290
291 if (p == this->end()) {
292
294
295 p = this->find(pbs);
296 }
297
298 if (p != this->end()) {
299
300 typename mapped_type::const_iterator q = p->second.find(number);
301
302 if (q != p->second.end()) {
303
304 return q->second;
305
306 } else {
307
308 THROW(JValueOutOfRange,
"Invalid serial number " << number);
309 }
310
311 } else {
312
313 THROW(JDatabaseException,
"Invalid PBS " << pbs);
314 }
315 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
void initialise(const JPBS_t &pbs)
Initialise.
◆ helper
The documentation for this struct was generated from the following files: