CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 () noexcept(false) override
 
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) noexcept(false) override
 
void setShortDesc (std::string desc)
 
 ~MonRunOutcomeDef () override
 
- 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) noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 

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 9 of file MonRunOutcomeDef.cc.

9  {
10  m_env = nullptr;
11  m_conn = nullptr;
12  m_ID = 0;
13  m_shortDesc = "";
14  m_longDesc = "";
15 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
std::string m_shortDesc
std::string m_longDesc
MonRunOutcomeDef::~MonRunOutcomeDef ( )
override

Definition at line 17 of file MonRunOutcomeDef.cc.

17 {}

Member Function Documentation

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

Definition at line 84 of file MonRunOutcomeDef.cc.

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

84  {
85  this->checkConnection();
86  try {
87  Statement* stmt = m_conn->createStatement();
88  stmt->setSQL("SELECT def_id FROM mon_run_outcome_def ORDER BY def_id");
89  ResultSet* rset = stmt->executeQuery();
90 
93 
94  while (rset->next()) {
95  def.setByID(rset->getInt(1));
96  fillVec->push_back(def);
97  }
98  } catch (SQLException& e) {
99  throw(std::runtime_error("MonRunOutcomeDef::fetchAllDefs: " + e.getMessage()));
100  }
101 }
int def(FILE *, FILE *, int)
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
void setByID(int id) noexcept(false) override
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int MonRunOutcomeDef::fetchID ( )
overridevirtualnoexcept

Implements IUniqueDBObject.

Definition at line 30 of file MonRunOutcomeDef.cc.

References alignCSCRings::e.

Referenced by MonRunDat::writeDB().

30  {
31  // Return def from memory if available
32  if (m_ID) {
33  return m_ID;
34  }
35 
36  this->checkConnection();
37 
38  try {
39  Statement* stmt = m_conn->createStatement();
40  stmt->setSQL(
41  "SELECT def_id FROM mon_run_outcome_def WHERE "
42  "short_desc = :1");
43  stmt->setString(1, m_shortDesc);
44 
45  ResultSet* rset = stmt->executeQuery();
46 
47  if (rset->next()) {
48  m_ID = rset->getInt(1);
49  } else {
50  m_ID = 0;
51  }
52  m_conn->terminateStatement(stmt);
53  } catch (SQLException& e) {
54  throw(std::runtime_error("MonRunOutcomeDef::fetchID: " + e.getMessage()));
55  }
56 
57  return m_ID;
58 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string m_shortDesc
string MonRunOutcomeDef::getLongDesc ( ) const

Definition at line 28 of file MonRunOutcomeDef.cc.

28 { return m_longDesc; }
std::string m_longDesc
string MonRunOutcomeDef::getShortDesc ( ) const

Definition at line 19 of file MonRunOutcomeDef.cc.

19 { return m_shortDesc; }
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)
overridevirtualnoexcept

Implements IUniqueDBObject.

Definition at line 60 of file MonRunOutcomeDef.cc.

References alignCSCRings::e, and gpuClustering::id.

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

60  {
61  this->checkConnection();
62 
63  try {
64  Statement* stmt = m_conn->createStatement();
65 
66  stmt->setSQL("SELECT short_desc, long_desc FROM mon_run_outcome_def WHERE def_id = :1");
67  stmt->setInt(1, id);
68 
69  ResultSet* rset = stmt->executeQuery();
70  if (rset->next()) {
71  m_shortDesc = rset->getString(1);
72  m_longDesc = rset->getString(2);
73  m_ID = id;
74  } else {
75  throw(std::runtime_error("MonRunOutcomeDef::setByID: Given def_id is not in the database"));
76  }
77 
78  m_conn->terminateStatement(stmt);
79  } catch (SQLException& e) {
80  throw(std::runtime_error("MonRunOutcomeDef::setByID: " + e.getMessage()));
81  }
82 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
uint16_t *__restrict__ id
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string m_shortDesc
std::string m_longDesc
void MonRunOutcomeDef::setShortDesc ( std::string  desc)

Definition at line 21 of file MonRunOutcomeDef.cc.

References submitPVResolutionJobs::desc.

Referenced by ecaldqm::SummaryWriter::run().

21  {
22  if (desc != m_shortDesc) {
23  m_ID = 0;
24  m_shortDesc = desc;
25  }
26 }
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==().