![]() |
![]() |
#include <RunTypeDef.h>
Public Member Functions | |
int | fetchID () throw (std::runtime_error) |
std::string | getDescription () const |
std::string | getRunType () const |
bool | operator!= (const RunTypeDef &t) const |
bool | operator== (const RunTypeDef &t) const |
RunTypeDef () | |
void | setByID (int id) throw (std::runtime_error) |
void | setRunType (std::string runtype) |
virtual | ~RunTypeDef () |
Protected Member Functions | |
void | fetchAllDefs (std::vector< RunTypeDef > *fillVec) throw (std::runtime_error) |
Protected Attributes | |
std::string | m_desc |
std::string | m_runType |
Friends | |
class | EcalCondDBInterface |
Def for Location information
Definition at line 12 of file RunTypeDef.h.
RunTypeDef::RunTypeDef | ( | ) |
RunTypeDef::~RunTypeDef | ( | ) | [virtual] |
Definition at line 20 of file RunTypeDef.cc.
{ }
void RunTypeDef::fetchAllDefs | ( | std::vector< RunTypeDef > * | fillVec | ) | throw (std::runtime_error) [protected] |
Definition at line 111 of file RunTypeDef.cc.
References setByID(), and IDBObject::setConnection().
{ this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT def_id FROM run_type_def ORDER BY def_id"); ResultSet* rset = stmt->executeQuery(); RunTypeDef runTypeDef; runTypeDef.setConnection(m_env, m_conn); while(rset->next()) { runTypeDef.setByID( rset->getInt(1) ); fillVec->push_back( runTypeDef ); } } catch (SQLException &e) { throw(std::runtime_error("RunTypeDef::fetchAllDefs: "+e.getMessage())); } }
int RunTypeDef::fetchID | ( | ) | throw (std::runtime_error) [virtual] |
Implements IUniqueDBObject.
Definition at line 50 of file RunTypeDef.cc.
{ // Return def from memory if available if (m_ID) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT def_id FROM run_type_def WHERE " "run_type = :1" ); stmt->setString(1, m_runType); 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("RunTypeDef::fetchID: "+e.getMessage())); } return m_ID; }
string RunTypeDef::getDescription | ( | ) | const |
Definition at line 43 of file RunTypeDef.cc.
{ return m_desc; }
string RunTypeDef::getRunType | ( | void | ) | const |
Definition at line 26 of file RunTypeDef.cc.
Referenced by EcalTPGDBApp::printTag().
{ return m_runType; }
bool RunTypeDef::operator!= | ( | const RunTypeDef & | t | ) | const [inline] |
Definition at line 31 of file RunTypeDef.h.
References m_runType.
bool RunTypeDef::operator== | ( | const RunTypeDef & | t | ) | const [inline] |
Definition at line 30 of file RunTypeDef.h.
References m_runType.
void RunTypeDef::setByID | ( | int | id | ) | throw (std::runtime_error) [virtual] |
Implements IUniqueDBObject.
Definition at line 84 of file RunTypeDef.cc.
Referenced by fetchAllDefs().
{ this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT run_type, description FROM run_type_def WHERE def_id = :1"); stmt->setInt(1, id); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_runType = rset->getString(1); m_desc = rset->getString(2); } else { throw(std::runtime_error("RunTypeDef::setByID: Given def_id is not in the database")); } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("RunTypeDef::setByID: "+e.getMessage())); } }
void RunTypeDef::setRunType | ( | std::string | runtype | ) |
Definition at line 33 of file RunTypeDef.cc.
Referenced by EcalEndcapMonitorClient::beginRunDb(), EcalBarrelMonitorClient::beginRunDb(), RunList::fetchGlobalRunsByLocation(), RunList::fetchRunsByLocation(), popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects(), popcon::EcalTPGFineGrainEBGroupHandler::getNewObjects(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), popcon::EcalTPGBadXTHandler::getNewObjects(), popcon::EcalTPGWeightIdMapHandler::getNewObjects(), popcon::EcalDAQHandler::getNewObjects(), popcon::EcalTPGBadTTHandler::getNewObjects(), popcon::EcalTPGSlidingWindowHandler::getNewObjects(), popcon::EcalTPGPedestalsHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), popcon::EcalTPGLinConstHandler::getNewObjects(), popcon::EcalTPGLutGroupHandler::getNewObjects(), popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), popcon::EcalChannelStatusHandler::getNewObjects(), popcon::EcalPedestalsHandler::getNewObjectsH2(), popcon::EcalPedestalsHandler::getNewObjectsP5(), EcalTPGDBApp::readFromCondDB_Pedestals(), and EcalPedOffset::writeDb().
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 14 of file RunTypeDef.h.
std::string RunTypeDef::m_desc [protected] |
Definition at line 36 of file RunTypeDef.h.
std::string RunTypeDef::m_runType [protected] |
Definition at line 35 of file RunTypeDef.h.
Referenced by operator!=(), and operator==().