CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
MonRunOutcomeDef Class Reference

#include <MonRunOutcomeDef.h>

Inheritance diagram for MonRunOutcomeDef:
IDef IUniqueDBObject IDBObject

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 ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Protected Member Functions

void fetchAllDefs (std::vector< MonRunOutcomeDef > *fillVec) throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 

Protected Attributes

std::string m_longDesc
 
std::string m_shortDesc
 
- Protected Attributes inherited from IUniqueDBObject
int m_ID
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 

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 NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_ID = 0;
15  m_shortDesc = "";
16  m_longDesc = "";
17 
18 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_shortDesc
#define NULL
Definition: scimark2.h:8
std::string m_longDesc
MonRunOutcomeDef::~MonRunOutcomeDef ( )
virtual

Definition at line 22 of file MonRunOutcomeDef.cc.

23 {
24 }

Member Function Documentation

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

Definition at line 113 of file MonRunOutcomeDef.cc.

References spu::def(), alignCSCRings::e, setByID(), and IDBObject::setConnection().

115 {
116  this->checkConnection();
117  try {
118  Statement* stmt = m_conn->createStatement();
119  stmt->setSQL("SELECT def_id FROM mon_run_outcome_def ORDER BY def_id");
120  ResultSet* rset = stmt->executeQuery();
121 
123  def.setConnection(m_env, m_conn);
124 
125  while(rset->next()) {
126  def.setByID( rset->getInt(1) );
127  fillVec->push_back( def );
128  }
129  } catch (SQLException &e) {
130  throw(std::runtime_error("MonRunOutcomeDef::fetchAllDefs: "+e.getMessage()));
131  }
132 }
int def(FILE *, FILE *, int)
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setByID(int id)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int MonRunOutcomeDef::fetchID ( )
throw (std::runtime_error
)
virtual

Implements IUniqueDBObject.

Definition at line 52 of file MonRunOutcomeDef.cc.

References alignCSCRings::e.

Referenced by MonRunDat::writeDB().

54 {
55  // Return def from memory if available
56  if (m_ID) {
57  return m_ID;
58  }
59 
60  this->checkConnection();
61 
62  try {
63  Statement* stmt = m_conn->createStatement();
64  stmt->setSQL("SELECT def_id FROM mon_run_outcome_def WHERE "
65  "short_desc = :1");
66  stmt->setString(1, m_shortDesc);
67 
68  ResultSet* rset = stmt->executeQuery();
69 
70  if (rset->next()) {
71  m_ID = rset->getInt(1);
72  } else {
73  m_ID = 0;
74  }
75  m_conn->terminateStatement(stmt);
76  } catch (SQLException &e) {
77  throw(std::runtime_error("MonRunOutcomeDef::fetchID: "+e.getMessage()));
78  }
79 
80  return m_ID;
81 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_shortDesc
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void checkConnection() const
Definition: IDBObject.h:41
string MonRunOutcomeDef::getLongDesc ( ) const

Definition at line 45 of file MonRunOutcomeDef.cc.

46 {
47  return m_longDesc;
48 }
std::string m_longDesc
string MonRunOutcomeDef::getShortDesc ( ) const

Definition at line 28 of file MonRunOutcomeDef.cc.

29 {
30  return m_shortDesc;
31 }
std::string m_shortDesc
bool MonRunOutcomeDef::operator!= ( const MonRunOutcomeDef d) const
inline

Definition at line 31 of file MonRunOutcomeDef.h.

References m_shortDesc.

31 { return m_shortDesc != d.m_shortDesc; }
std::string m_shortDesc
bool MonRunOutcomeDef::operator== ( const MonRunOutcomeDef d) const
inline

Definition at line 30 of file MonRunOutcomeDef.h.

References m_shortDesc.

30 { return m_shortDesc == d.m_shortDesc; }
std::string m_shortDesc
void MonRunOutcomeDef::setByID ( int  id)
throw (std::runtime_error
)
virtual

Implements IUniqueDBObject.

Definition at line 85 of file MonRunOutcomeDef.cc.

References alignCSCRings::e.

Referenced by fetchAllDefs(), and MonRunDat::fetchData().

87 {
88  this->checkConnection();
89 
90  try {
91  Statement* stmt = m_conn->createStatement();
92 
93  stmt->setSQL("SELECT short_desc, long_desc FROM mon_run_outcome_def WHERE def_id = :1");
94  stmt->setInt(1, id);
95 
96  ResultSet* rset = stmt->executeQuery();
97  if (rset->next()) {
98  m_shortDesc = rset->getString(1);
99  m_longDesc = rset->getString(2);
100  m_ID = id;
101  } else {
102  throw(std::runtime_error("MonRunOutcomeDef::setByID: Given def_id is not in the database"));
103  }
104 
105  m_conn->terminateStatement(stmt);
106  } catch (SQLException &e) {
107  throw(std::runtime_error("MonRunOutcomeDef::setByID: "+e.getMessage()));
108  }
109 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_shortDesc
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string m_longDesc
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void checkConnection() const
Definition: IDBObject.h:41
void MonRunOutcomeDef::setShortDesc ( std::string  desc)

Definition at line 35 of file MonRunOutcomeDef.cc.

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

36 {
37  if (desc != m_shortDesc) {
38  m_ID = 0;
39  m_shortDesc = desc;
40  }
41 }
std::string m_shortDesc

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

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.

std::string MonRunOutcomeDef::m_shortDesc
protected

Definition at line 35 of file MonRunOutcomeDef.h.

Referenced by operator!=(), and operator==().