CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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  {
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 
41  void checkConnection() const
42  throw(std::runtime_error)
43  {
44  if (m_conn == NULL) {
45  throw std::runtime_error("ERROR: Connection was not set");
46  }
47  }
48 };
49 
50 #endif
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
oracle::occi::Connection * conn
virtual ~IDBObject()
Definition: IDBObject.h:20
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
void checkConnection() const
Definition: IDBObject.h:41