CMS 3D CMS Logo

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 const int ECALDB_NROWS = 1024
 

Detailed Description

Def for monitoring run outcomes

Definition at line 12 of file MonRunOutcomeDef.h.

Constructor & Destructor Documentation

◆ MonRunOutcomeDef()

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 }

◆ ~MonRunOutcomeDef()

MonRunOutcomeDef::~MonRunOutcomeDef ( )
override

Definition at line 17 of file MonRunOutcomeDef.cc.

17 {}

Member Function Documentation

◆ fetchAllDefs()

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

Definition at line 84 of file MonRunOutcomeDef.cc.

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 
92  def.setConnection(m_env, m_conn);
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 }

References spu::def(), and MillePedeFileConverter_cfg::e.

◆ fetchID()

int MonRunOutcomeDef::fetchID ( )
overridevirtualnoexcept

Implements IUniqueDBObject.

Definition at line 30 of file MonRunOutcomeDef.cc.

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 }

References MillePedeFileConverter_cfg::e.

Referenced by MonRunDat::writeDB().

◆ getLongDesc()

string MonRunOutcomeDef::getLongDesc ( ) const

Definition at line 28 of file MonRunOutcomeDef.cc.

28 { return m_longDesc; }

◆ getShortDesc()

string MonRunOutcomeDef::getShortDesc ( ) const

Definition at line 19 of file MonRunOutcomeDef.cc.

19 { return m_shortDesc; }

◆ operator!=()

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

Definition at line 31 of file MonRunOutcomeDef.h.

31 { return m_shortDesc != d.m_shortDesc; }

References ztail::d, and m_shortDesc.

◆ operator==()

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

Definition at line 30 of file MonRunOutcomeDef.h.

30 { return m_shortDesc == d.m_shortDesc; }

References ztail::d, and m_shortDesc.

◆ setByID()

void MonRunOutcomeDef::setByID ( int  id)
overridevirtualnoexcept

Implements IUniqueDBObject.

Definition at line 60 of file MonRunOutcomeDef.cc.

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 }

References MillePedeFileConverter_cfg::e, and triggerObjects_cff::id.

Referenced by MonRunDat::fetchData().

◆ setShortDesc()

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

Definition at line 21 of file MonRunOutcomeDef.cc.

21  {
22  if (desc != m_shortDesc) {
23  m_ID = 0;
24  m_shortDesc = desc;
25  }
26 }

References submitPVResolutionJobs::desc.

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

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 14 of file MonRunOutcomeDef.h.

Member Data Documentation

◆ m_longDesc

std::string MonRunOutcomeDef::m_longDesc
protected

Definition at line 36 of file MonRunOutcomeDef.h.

◆ m_shortDesc

std::string MonRunOutcomeDef::m_shortDesc
protected

Definition at line 35 of file MonRunOutcomeDef.h.

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

IUniqueDBObject::m_ID
int m_ID
Definition: IUniqueDBObject.h:18
MonRunOutcomeDef::m_longDesc
std::string m_longDesc
Definition: MonRunOutcomeDef.h:36
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
MonRunOutcomeDef::m_shortDesc
std::string m_shortDesc
Definition: MonRunOutcomeDef.h:35
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ztail.d
d
Definition: ztail.py:151
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
spu::def
int def(FILE *, FILE *, int)
Definition: SherpackUtilities.cc:14
MonRunOutcomeDef
Definition: MonRunOutcomeDef.h:12
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37