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
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
JDATABASE::JCLBIDHelper Struct Reference

Auxiliary class for mapping UPI of central-logic board to module identifier. More...

#include <JDBToolkit.hh>

Public Member Functions

void initialise ()
 Initialise. More...
 
int operator() (const JUPI_t &upi)
 Get module identifier. More...
 
JUPI_t operator() (const int id)
 Get UPI. More...
 

Static Public Attributes

static JCLBIDHelper helper
 Helper object. More...
 

Protected Attributes

std::map< JUPI_t, int > upi2id
 
std::map< int, JUPI_tid2upi
 

Detailed Description

Auxiliary class for mapping UPI of central-logic board to module identifier.

Definition at line 156 of file JDBToolkit.hh.

Member Function Documentation

void JDATABASE::JCLBIDHelper::initialise ( )
inline

Initialise.

Definition at line 160 of file JDBToolkit.hh.

161  {
162  ResultSet& rs = JDB::get()->StreamDS(getTable<JCLBID>(), getSelector<JCLBID>());
163 
164  for (JCLBID parameters; rs >> parameters; ) {
165  upi2id[parameters.CLBUPI] = parameters.CLBID;
166  id2upi[parameters.CLBID] = parameters.CLBUPI;
167  }
168 
169  rs.Close();
170  }
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
std::map< JUPI_t, int > upi2id
Definition: JDBToolkit.hh:229
std::map< int, JUPI_t > id2upi
Definition: JDBToolkit.hh:230
Template definition for getting table specific selector.
static JDB & get()
Get connection to database.
Definition: JDB.hh:225
int JDATABASE::JCLBIDHelper::operator() ( const JUPI_t upi)
inline

Get module identifier.

Parameters
upiUPI
Returns
module identifier

Definition at line 179 of file JDBToolkit.hh.

180  {
182 
183  if (p == upi2id.end()) {
184 
185  initialise();
186 
187  p = upi2id.find(upi);
188 
189  if (p == upi2id.end()) {
190  THROW(JDatabaseException, "Invalid UPI " << upi);
191  }
192  }
193 
194  return p->second;
195  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
std::map< JUPI_t, int > upi2id
Definition: JDBToolkit.hh:229
void initialise()
Initialise.
Definition: JDBToolkit.hh:160
JUPI_t JDATABASE::JCLBIDHelper::operator() ( const int  id)
inline

Get UPI.

Parameters
idmodule identifier
Returns
UPI

Definition at line 204 of file JDBToolkit.hh.

205  {
207 
208  if (p == id2upi.end()) {
209 
210  initialise();
211 
212  p = id2upi.find(id);
213 
214  if (p == id2upi.end()) {
215  THROW(JDatabaseException, "Invalid module identifier " << id);
216  }
217  }
218 
219  return p->second;
220  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
std::map< int, JUPI_t > id2upi
Definition: JDBToolkit.hh:230
void initialise()
Initialise.
Definition: JDBToolkit.hh:160

Member Data Documentation

JCLBIDHelper JDATABASE::JCLBIDHelper::helper
static

Helper object.

Definition at line 226 of file JDBToolkit.hh.

std::map<JUPI_t, int> JDATABASE::JCLBIDHelper::upi2id
protected

Definition at line 229 of file JDBToolkit.hh.

std::map<int, JUPI_t> JDATABASE::JCLBIDHelper::id2upi
protected

Definition at line 230 of file JDBToolkit.hh.


The documentation for this struct was generated from the following files: