CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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
virtual ~IDBObject()
Definition: IDBObject.h:20
static int const ECALDB_NROWS
Definition: IDBObject.h:18
tuple conn
Definition: getInfo.py:9
oracle::occi::Connection * getConn() const
Definition: IDBObject.h:29
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
oracle::occi::Environment * getEnv() const
Definition: IDBObject.h:28