LCCD  1.3.1
DBConnectionMgr.hh
1 #ifndef DBConnectionMgr_h
2 #define DBConnectionMgr_h
3 
4 #include "lccd.h"
5 // #include "lccd/DBInterface.hh"
6 
7 // forward declarations
8 class ICondDBMgr ;
9 
10 #include <iostream>
11 #include <set>
12 #include <map>
13 
14 
15 namespace lccd {
16 
17  class DBInterface ;
18 
19 
27 
28  private:
29  typedef std::set< DBInterface* > DBSet ;
30 
31  struct DBRefs{
32  DBRefs() : Mgr(0) {}
33  ICondDBMgr* Mgr ;
34  DBSet Set ;
35  } ;
36 
37 // typedef std::map< std::string , std::pair< DBSet,ICondDBMgr*> > DBMap ;
38  typedef std::map< std::string , DBRefs > DBMap ;
39 
40  DBConnectionMgr() ;
41 
42  public:
43 
45  static DBConnectionMgr* instance() ;
46 
48  ICondDBMgr* getDBConnection( const std::string& dbInit , DBInterface* dbInterface ) ;
49 
51  void releaseConnection( const std::string& dbInit, DBInterface* dbInterface ) ;
52 
55 
56  private:
57  DBMap _map ;
58 
59  };
60 
61 } //end namespace
62 
63 #endif // DBConnectionMgr_h
64 
Provides a simple interface to the conditions data base for lccd.
Definition: DBInterface.hh:53
Singleton that manages data base connection on the basis of access strings.
Definition: DBConnectionMgr.hh:26
~DBConnectionMgr()
D'tor.
Definition: DBConnectionMgr.cc:22
void releaseConnection(const std::string &dbInit, DBInterface *dbInterface)
Release the connection for the given interface.
Definition: DBConnectionMgr.cc:79
static DBConnectionMgr * instance()
The only way to access the manager object.
Definition: DBConnectionMgr.cc:41
ICondDBMgr * getDBConnection(const std::string &dbInit, DBInterface *dbInterface)
Get a connection for the given dbInit - create if it does not exist yet.
Definition: DBConnectionMgr.cc:50