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

Member Function Documentation

void JDATABASE::JCLBIDHelper::initialise ( )
inline

Initialise.

Definition at line 115 of file JDBToolkit.hh.

116  {
117  ResultSet& rs = JDB::get()->StreamDS(getTable<JCLBID>(), getSelector<JCLBID>());
118 
119  for (JCLBID parameters; rs >> parameters; ) {
120  upi2id[parameters.CLBUPI] = parameters.CLBID;
121  id2upi[parameters.CLBID] = parameters.CLBUPI;
122  }
123 
124  rs.Close();
125  }
*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:178
std::map< int, JUPI_t > id2upi
Definition: JDBToolkit.hh:179
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 134 of file JDBToolkit.hh.

135  {
137 
138  if (p == upi2id.end()) {
139 
140  initialise();
141 
142  p = upi2id.find(upi);
143 
144  if (p == upi2id.end()) {
145  THROW(JDatabaseException, "Invalid UPI " << upi);
146  }
147  }
148 
149  return p->second;
150  }
#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:178
void initialise()
Initialise.
Definition: JDBToolkit.hh:115
JUPI_t JDATABASE::JCLBIDHelper::operator() ( const int  id)
inline

Get UPI.

Parameters
idmodule identifier
Returns
UPI

Definition at line 159 of file JDBToolkit.hh.

160  {
162 
163  if (p == id2upi.end()) {
164 
165  initialise();
166 
167  p = id2upi.find(id);
168 
169  if (p == id2upi.end()) {
170  THROW(JDatabaseException, "Invalid module identifier " << id);
171  }
172  }
173 
174  return p->second;
175  }
#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:179
void initialise()
Initialise.
Definition: JDBToolkit.hh:115

Member Data Documentation

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

Definition at line 178 of file JDBToolkit.hh.

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

Definition at line 179 of file JDBToolkit.hh.


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