#include <ODJBH4Config.h>
Public Member Functions | |
int | getCaenBoardNumber () const |
std::string | getCaenBridgeType () const |
int | getCaenLinkNumber () const |
std::string | getCbd8210SerialNumber () const |
std::string | getHalAddressTableFile () const |
std::string | getHalModuleFile () const |
std::string | getHalStaticTableFile () const |
int | getId () const |
std::string | getTable () |
int | getUseBuffer () const |
ODJBH4Config () | |
void | setCaenBoardNumber (int x) |
void | setCaenBridgeType (std::string x) |
void | setCaenLinkNumber (int x) |
void | setCbd8210SerialNumber (std::string x) |
void | setHalAddressTableFile (std::string x) |
void | setHalModuleFile (std::string x) |
void | setHalStaticTableFile (std::string x) |
void | setId (int id) |
void | setUseBuffer (int x) |
~ODJBH4Config () | |
Private Member Functions | |
void | clear () |
void | fetchData (ODJBH4Config *result) throw (std::runtime_error) |
int | fetchID () throw (std::runtime_error) |
int | fetchNextId () throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB () throw (std::runtime_error) |
Private Attributes | |
std::string | m_caen1 |
int | m_caen2 |
int | m_caen3 |
std::string | m_hal_add_file |
std::string | m_hal_mod_file |
std::string | m_hal_tab_file |
int | m_ID |
std::string | m_serial |
int | m_use_buffer |
Friends | |
class | EcalCondDBInterface |
Definition at line 9 of file ODJBH4Config.h.
ODJBH4Config::ODJBH4Config | ( | ) |
Definition at line 10 of file ODJBH4Config.cc.
References NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_config_tag=""; m_ID=0; clear(); }
ODJBH4Config::~ODJBH4Config | ( | ) |
Definition at line 23 of file ODJBH4Config.cc.
{ }
void ODJBH4Config::clear | ( | void | ) | [private] |
Definition at line 27 of file ODJBH4Config.cc.
{ m_use_buffer=0; m_hal_mod_file=""; m_hal_add_file=""; m_hal_tab_file=""; m_serial=""; m_caen1=""; m_caen2=0; m_caen3=0; }
void ODJBH4Config::fetchData | ( | ODJBH4Config * | result | ) | throw (std::runtime_error) [private] |
Definition at line 118 of file ODJBH4Config.cc.
References ExpressReco_HICollisions_FallBack::e, and query::result.
{ this->checkConnection(); result->clear(); if(result->getId()==0){ throw(std::runtime_error("ODJBH4Config::fetchData(): no Id defined for this ODJBH4Config ")); } try { m_readStmt->setSQL("SELECT * FROM ECAL_Jbh4_CONFIGURATION " " where ( jbh4_configuration_id = :1 or jbh4_tag=:2 )"); m_readStmt->setInt(1, result->getId()); m_readStmt->setString(2, result->getConfigTag()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); result->setId(rset->getInt(1)); result->setConfigTag(rset->getString(2)); result->setUseBuffer( rset->getInt(3) ); result->setHalModuleFile( rset->getString(4) ); result->setHalAddressTableFile( rset->getString(5) ); result->setHalStaticTableFile( rset->getString(6) ); result->setCbd8210SerialNumber( rset->getString(7) ); result->setCaenBridgeType( rset->getString(8) ); result->setCaenLinkNumber( rset->getInt(9) ); result->setCaenBoardNumber( rset->getInt(10) ); } catch (SQLException &e) { throw(std::runtime_error("ODJBH4Config::fetchData(): "+e.getMessage())); } }
int ODJBH4Config::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 154 of file ODJBH4Config.cc.
References ExpressReco_HICollisions_FallBack::e.
{ // Return from memory if available if (m_ID!=0) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT jbh4_configuration_id FROM ecal_jbh4_configuration " "WHERE jbh4_tag=:jbh4_tag "); stmt->setString(1, getConfigTag()); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ID = rset->getInt(1); } else { m_ID = 0; } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("ODJBH4Config::fetchID: "+e.getMessage())); } return m_ID; }
int ODJBH4Config::fetchNextId | ( | ) | throw (std::runtime_error) [private] |
Definition at line 41 of file ODJBH4Config.cc.
References ExpressReco_HICollisions_FallBack::e, and query::result.
{ int result=0; try { this->checkConnection(); m_readStmt = m_conn->createStatement(); m_readStmt->setSQL("select ecal_JBH4_config_sq.NextVal from dual"); ResultSet* rset = m_readStmt->executeQuery(); while (rset->next ()){ result= rset->getInt(1); } m_conn->terminateStatement(m_readStmt); return result; } catch (SQLException &e) { throw(std::runtime_error("ODJBH4Config::fetchNextId(): "+e.getMessage())); } }
int ODJBH4Config::getCaenBoardNumber | ( | ) | const [inline] |
std::string ODJBH4Config::getCaenBridgeType | ( | ) | const [inline] |
int ODJBH4Config::getCaenLinkNumber | ( | ) | const [inline] |
std::string ODJBH4Config::getCbd8210SerialNumber | ( | ) | const [inline] |
std::string ODJBH4Config::getHalAddressTableFile | ( | ) | const [inline] |
std::string ODJBH4Config::getHalModuleFile | ( | ) | const [inline] |
std::string ODJBH4Config::getHalStaticTableFile | ( | ) | const [inline] |
int ODJBH4Config::getId | ( | ) | const [inline] |
std::string ODJBH4Config::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 16 of file ODJBH4Config.h.
{ return "ECAL_JBH4_CONFIGURATION"; }
int ODJBH4Config::getUseBuffer | ( | ) | const [inline] |
void ODJBH4Config::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 62 of file ODJBH4Config.cc.
References ExpressReco_HICollisions_FallBack::e.
{ this->checkConnection(); int next_id=fetchNextId(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO ECAL_Jbh4_CONFIGURATION ( jbh4_configuration_id, jbh4_tag, " " useBuffer, halModuleFile, halAddressTableFile, halStaticTableFile, halcbd8210serialnumber, " " caenbridgetype, caenlinknumber, caenboardnumber) " " VALUES ( :1, :2, :3, :4, :5, :6, :7, :8 , :9, :10 )"); m_writeStmt->setInt(1, next_id); m_ID=next_id; } catch (SQLException &e) { throw(std::runtime_error("ODJBH4Config::prepareWrite(): "+e.getMessage())); } }
void ODJBH4Config::setCaenBoardNumber | ( | int | x | ) | [inline] |
Definition at line 44 of file ODJBH4Config.h.
References m_caen3, and ExpressReco_HICollisions_FallBack::x.
void ODJBH4Config::setCaenBridgeType | ( | std::string | x | ) | [inline] |
Definition at line 38 of file ODJBH4Config.h.
References m_caen1, and ExpressReco_HICollisions_FallBack::x.
void ODJBH4Config::setCaenLinkNumber | ( | int | x | ) | [inline] |
Definition at line 41 of file ODJBH4Config.h.
References m_caen2, and ExpressReco_HICollisions_FallBack::x.
void ODJBH4Config::setCbd8210SerialNumber | ( | std::string | x | ) | [inline] |
Definition at line 35 of file ODJBH4Config.h.
References m_serial, and ExpressReco_HICollisions_FallBack::x.
void ODJBH4Config::setHalAddressTableFile | ( | std::string | x | ) | [inline] |
Definition at line 28 of file ODJBH4Config.h.
References m_hal_add_file, and ExpressReco_HICollisions_FallBack::x.
{ m_hal_add_file = x; }
void ODJBH4Config::setHalModuleFile | ( | std::string | x | ) | [inline] |
Definition at line 25 of file ODJBH4Config.h.
References m_hal_mod_file, and ExpressReco_HICollisions_FallBack::x.
{ m_hal_mod_file = x; }
void ODJBH4Config::setHalStaticTableFile | ( | std::string | x | ) | [inline] |
Definition at line 31 of file ODJBH4Config.h.
References m_hal_tab_file, and ExpressReco_HICollisions_FallBack::x.
{ m_hal_tab_file = x; }
void ODJBH4Config::setId | ( | int | id | ) | [inline] |
Definition at line 18 of file ODJBH4Config.h.
References ExpressReco_HICollisions_FallBack::id, and m_ID.
void ODJBH4Config::setUseBuffer | ( | int | x | ) | [inline] |
Definition at line 22 of file ODJBH4Config.h.
References m_use_buffer, and ExpressReco_HICollisions_FallBack::x.
{ m_use_buffer = x; }
void ODJBH4Config::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 84 of file ODJBH4Config.cc.
References ExpressReco_HICollisions_FallBack::e.
{ this->checkConnection(); this->checkPrepare(); try { // number 1 is the id number 2 is the tag m_writeStmt->setString(2, this->getConfigTag()); m_writeStmt->setInt(3, this->getUseBuffer()); m_writeStmt->setString(4, this->getHalModuleFile() ); m_writeStmt->setString(5, this->getHalAddressTableFile() ); m_writeStmt->setString(6, this->getHalStaticTableFile() ); m_writeStmt->setString(7, this->getCbd8210SerialNumber() ); m_writeStmt->setString(8, this->getCaenBridgeType() ); m_writeStmt->setInt(9, this->getCaenLinkNumber() ); m_writeStmt->setInt(10, this->getCaenBoardNumber() ); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODJBH4Config::writeDB(): "+e.getMessage())); } // Now get the ID if (!this->fetchID()) { throw(std::runtime_error("ODJBH4Config::writeDB: Failed to write")); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 11 of file ODJBH4Config.h.
std::string ODJBH4Config::m_caen1 [private] |
Definition at line 65 of file ODJBH4Config.h.
Referenced by getCaenBridgeType(), and setCaenBridgeType().
int ODJBH4Config::m_caen2 [private] |
Definition at line 66 of file ODJBH4Config.h.
Referenced by getCaenLinkNumber(), and setCaenLinkNumber().
int ODJBH4Config::m_caen3 [private] |
Definition at line 67 of file ODJBH4Config.h.
Referenced by getCaenBoardNumber(), and setCaenBoardNumber().
std::string ODJBH4Config::m_hal_add_file [private] |
Definition at line 62 of file ODJBH4Config.h.
Referenced by getHalAddressTableFile(), and setHalAddressTableFile().
std::string ODJBH4Config::m_hal_mod_file [private] |
Definition at line 61 of file ODJBH4Config.h.
Referenced by getHalModuleFile(), and setHalModuleFile().
std::string ODJBH4Config::m_hal_tab_file [private] |
Definition at line 63 of file ODJBH4Config.h.
Referenced by getHalStaticTableFile(), and setHalStaticTableFile().
int ODJBH4Config::m_ID [private] |
Definition at line 58 of file ODJBH4Config.h.
std::string ODJBH4Config::m_serial [private] |
Definition at line 64 of file ODJBH4Config.h.
Referenced by getCbd8210SerialNumber(), and setCbd8210SerialNumber().
int ODJBH4Config::m_use_buffer [private] |
Definition at line 60 of file ODJBH4Config.h.
Referenced by getUseBuffer(), and setUseBuffer().