Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | 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...
 

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 112 of file JDBToolkit.hh.

Member Function Documentation

void JDATABASE::JCLBIDHelper::initialise ( )
inline

Initialise.

Definition at line 116 of file JDBToolkit.hh.

117  {
118  ResultSet& rs = JDB::get()->StreamDS(getTable<JCLBID>(), getSelector<JCLBID>());
119 
120  for (JCLBID parameters; rs >> parameters; ) {
121  upi2id[parameters.CLBUPI] = parameters.CLBID;
122  id2upi[parameters.CLBID] = parameters.CLBUPI;
123  }
124 
125  rs.Close();
126  }
*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:179
std::map< int, JUPI_t > id2upi
Definition: JDBToolkit.hh:180
Template definition for getting table specific selector.
static JDB & get()
Get connection to database.
Definition: JDB.hh:81
int JDATABASE::JCLBIDHelper::operator() ( const JUPI_t upi)
inline

Get module identifier.

Parameters
upiUPI
Returns
module identifier

Definition at line 135 of file JDBToolkit.hh.

136  {
138 
139  if (p == upi2id.end()) {
140 
141  initialise();
142 
143  p = upi2id.find(upi);
144 
145  if (p == upi2id.end()) {
146  THROW(JDatabaseException, "Invalid UPI " << upi);
147  }
148  }
149 
150  return p->second;
151  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
std::map< JUPI_t, int > upi2id
Definition: JDBToolkit.hh:179
void initialise()
Initialise.
Definition: JDBToolkit.hh:116
JUPI_t JDATABASE::JCLBIDHelper::operator() ( const int  id)
inline

Get UPI.

Parameters
idmodule identifier
Returns
UPI

Definition at line 160 of file JDBToolkit.hh.

161  {
163 
164  if (p == id2upi.end()) {
165 
166  initialise();
167 
168  p = id2upi.find(id);
169 
170  if (p == id2upi.end()) {
171  THROW(JDatabaseException, "Invalid module identifier " << id);
172  }
173  }
174 
175  return p->second;
176  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
std::map< int, JUPI_t > id2upi
Definition: JDBToolkit.hh:180
void initialise()
Initialise.
Definition: JDBToolkit.hh:116

Member Data Documentation

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

Definition at line 179 of file JDBToolkit.hh.

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

Definition at line 180 of file JDBToolkit.hh.


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