CMS 3D CMS Logo

MonRunOutcomeDef Class Reference

Def for monitoring run outcomes. More...

#include <OnlineDB/EcalCondDB/interface/MonRunOutcomeDef.h>

Inheritance diagram for MonRunOutcomeDef:

IDef IUniqueDBObject IDBObject

List of all members.

Public Member Functions

int fetchID () throw (std::runtime_error)
std::string getLongDesc () const
std::string getShortDesc () const
 MonRunOutcomeDef ()
bool operator!= (const MonRunOutcomeDef &d) const
bool operator== (const MonRunOutcomeDef &d) const
void setByID (int id) throw (std::runtime_error)
void setShortDesc (std::string desc)
virtual ~MonRunOutcomeDef ()

Protected Member Functions

void fetchAllDefs (std::vector< MonRunOutcomeDef > *fillVec) throw (std::runtime_error)

Protected Attributes

std::string m_longDesc
std::string m_shortDesc

Friends

class EcalCondDBInterface


Detailed Description

Def for monitoring run outcomes.

Definition at line 12 of file MonRunOutcomeDef.h.


Constructor & Destructor Documentation

MonRunOutcomeDef::MonRunOutcomeDef (  ) 

Definition at line 10 of file MonRunOutcomeDef.cc.

References IDBObject::m_conn, IDBObject::m_env, IUniqueDBObject::m_ID, m_longDesc, m_shortDesc, and NULL.

00011 {
00012   m_env = NULL;
00013   m_conn = NULL;
00014   m_ID = 0;
00015   m_shortDesc = "";
00016   m_longDesc = "";
00017 
00018 }

MonRunOutcomeDef::~MonRunOutcomeDef (  )  [virtual]

Definition at line 22 of file MonRunOutcomeDef.cc.

00023 {
00024 }


Member Function Documentation

void MonRunOutcomeDef::fetchAllDefs ( std::vector< MonRunOutcomeDef > *  fillVec  )  throw (std::runtime_error) [protected]

Definition at line 113 of file MonRunOutcomeDef.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, IDBObject::m_env, setByID(), and IDBObject::setConnection().

00115 {
00116   this->checkConnection();
00117   try {
00118     Statement* stmt = m_conn->createStatement();
00119     stmt->setSQL("SELECT def_id FROM mon_run_outcome_def ORDER BY def_id");
00120     ResultSet* rset = stmt->executeQuery();
00121     
00122     MonRunOutcomeDef def;
00123     def.setConnection(m_env, m_conn);
00124 
00125     while(rset->next()) {
00126       def.setByID( rset->getInt(1) );
00127       fillVec->push_back( def );
00128     }
00129   } catch (SQLException &e) {
00130     throw(runtime_error("MonRunOutcomeDef::fetchAllDefs:  "+e.getMessage()));
00131   }
00132 }

int MonRunOutcomeDef::fetchID (  )  throw (std::runtime_error) [virtual]

Implements IUniqueDBObject.

Definition at line 52 of file MonRunOutcomeDef.cc.

References IDBObject::checkConnection(), e, IDBObject::m_conn, IUniqueDBObject::m_ID, and m_shortDesc.

Referenced by MonRunDat::writeDB().

00054 {
00055   // Return def from memory if available
00056   if (m_ID) {
00057     return m_ID;
00058   }
00059 
00060   this->checkConnection();
00061   
00062   try {
00063     Statement* stmt = m_conn->createStatement();
00064     stmt->setSQL("SELECT def_id FROM mon_run_outcome_def WHERE "
00065                  "short_desc = :1");
00066     stmt->setString(1, m_shortDesc);
00067 
00068     ResultSet* rset = stmt->executeQuery();
00069     
00070     if (rset->next()) {
00071       m_ID = rset->getInt(1);
00072     } else {
00073       m_ID = 0;
00074     }
00075     m_conn->terminateStatement(stmt);
00076   } catch (SQLException &e) {
00077     throw(runtime_error("MonRunOutcomeDef::fetchID:  "+e.getMessage()));
00078   }
00079 
00080   return m_ID;
00081 }

string MonRunOutcomeDef::getLongDesc (  )  const

Definition at line 45 of file MonRunOutcomeDef.cc.

References m_longDesc.

00046 {
00047   return m_longDesc;
00048 }

string MonRunOutcomeDef::getShortDesc (  )  const

Definition at line 28 of file MonRunOutcomeDef.cc.

References m_shortDesc.

00029 {
00030   return m_shortDesc;
00031 }

bool MonRunOutcomeDef::operator!= ( const MonRunOutcomeDef d  )  const [inline]

Definition at line 31 of file MonRunOutcomeDef.h.

References m_shortDesc.

00031 { return m_shortDesc != d.m_shortDesc; }

bool MonRunOutcomeDef::operator== ( const MonRunOutcomeDef d  )  const [inline]

Definition at line 30 of file MonRunOutcomeDef.h.

References m_shortDesc.

00030 { return m_shortDesc == d.m_shortDesc; }

void MonRunOutcomeDef::setByID ( int  id  )  throw (std::runtime_error) [virtual]

Implements IUniqueDBObject.

Definition at line 85 of file MonRunOutcomeDef.cc.

References IDBObject::checkConnection(), e, id, IDBObject::m_conn, IUniqueDBObject::m_ID, m_longDesc, and m_shortDesc.

Referenced by fetchAllDefs().

00087 {
00088   this->checkConnection();
00089 
00090   try {
00091     Statement* stmt = m_conn->createStatement();
00092 
00093     stmt->setSQL("SELECT short_desc, long_desc FROM mon_run_outcome_def WHERE def_id = :1");
00094     stmt->setInt(1, id);
00095 
00096     ResultSet* rset = stmt->executeQuery();
00097     if (rset->next()) {
00098       m_shortDesc = rset->getString(1);
00099       m_longDesc = rset->getString(2);
00100       m_ID = id;
00101     } else {
00102       throw(runtime_error("MonRunOutcomeDef::setByID:  Given def_id is not in the database"));
00103     }
00104     
00105     m_conn->terminateStatement(stmt);
00106   } catch (SQLException &e) {
00107    throw(runtime_error("MonRunOutcomeDef::setByID:  "+e.getMessage()));
00108   }
00109 }

void MonRunOutcomeDef::setShortDesc ( std::string  desc  ) 

Referenced by EcalEndcapMonitorClient::writeDb(), and EcalBarrelMonitorClient::writeDb().


Friends And Related Function Documentation

friend class EcalCondDBInterface [friend]

Reimplemented from IDBObject.

Definition at line 14 of file MonRunOutcomeDef.h.


Member Data Documentation

std::string MonRunOutcomeDef::m_longDesc [protected]

Definition at line 36 of file MonRunOutcomeDef.h.

Referenced by getLongDesc(), MonRunOutcomeDef(), and setByID().

std::string MonRunOutcomeDef::m_shortDesc [protected]

Definition at line 35 of file MonRunOutcomeDef.h.

Referenced by fetchID(), getShortDesc(), MonRunOutcomeDef(), operator!=(), operator==(), and setByID().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:24 2009 for CMSSW by  doxygen 1.5.4