CMS 3D CMS Logo

IDBObject.h
Go to the documentation of this file.
1 #ifndef IDBOBJECT_H
2 #define IDBOBJECT_H
3 
4 #include <stdexcept>
6 
7 // XXX remove later
8 #include <iostream>
9 
13 class IDBObject {
14 public:
15  // give the interface class permission to use the functions
16  friend class EcalCondDBInterface;
17 
18  static int const ECALDB_NROWS = 1024;
19 
20  virtual ~IDBObject() {}
21 
22  // Sets the connection
23  inline void setConnection(oracle::occi::Environment* env, oracle::occi::Connection* conn) {
24  m_env = env;
25  m_conn = conn;
26  }
27 
28  inline oracle::occi::Environment* getEnv() const { return m_env; }
29  inline oracle::occi::Connection* getConn() const { return m_conn; }
30 
31 protected:
32  // Database connection to use
33  oracle::occi::Environment* m_env;
34  oracle::occi::Connection* m_conn;
35 
36  void checkConnection() const noexcept(false) {
37  if (m_conn == nullptr) {
38  throw std::runtime_error("ERROR: Connection was not set");
39  }
40  }
41 };
42 
43 #endif
EcalCondDBInterface
Definition: EcalCondDBInterface.h:37
funct::false
false
Definition: Factorize.h:34
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
IDBObject
Definition: IDBObject.h:13
watchdog.const
const
Definition: watchdog.py:83
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
web.browse_db.env
env
Definition: browse_db.py:18
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
IDBObject::getEnv
oracle::occi::Environment * getEnv() const
Definition: IDBObject.h:28
IDBObject::getConn
oracle::occi::Connection * getConn() const
Definition: IDBObject.h:29
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
IDBObject::~IDBObject
virtual ~IDBObject()
Definition: IDBObject.h:20
Oracle.h
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
IDBObject::ECALDB_NROWS
static const int ECALDB_NROWS
Definition: IDBObject.h:18