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  {
25  m_env = env;
26  m_conn = conn;
27  }
28 
29  inline oracle::occi::Environment * getEnv() const {
30  return m_env;
31  }
32  inline oracle::occi::Connection * getConn() const {
33  return m_conn;
34  }
35 
36  protected:
37  // Database connection to use
38  oracle::occi::Environment* m_env;
39  oracle::occi::Connection* m_conn;
40 
42  {
43  if (m_conn == nullptr) {
44  throw std::runtime_error("ERROR: Connection was not set");
45  }
46  }
47 };
48 
49 #endif
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::Connection * conn
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
virtual ~IDBObject()
Definition: IDBObject.h:20
#define noexcept
static int const ECALDB_NROWS
Definition: IDBObject.h:18
oracle::occi::Connection * getConn() const
Definition: IDBObject.h:32
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
oracle::occi::Environment * getEnv() const
Definition: IDBObject.h:29