LCCD  1.5.0
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  ICondDBMgr* Mgr = nullptr ;
33  DBSet Set{} ;
34  } ;
35 
36 // typedef std::map< std::string , std::pair< DBSet,ICondDBMgr*> > DBMap ;
37  typedef std::map< std::string , DBRefs > DBMap ;
38 
39  DBConnectionMgr() ;
40 
41  public:
42 
44  static DBConnectionMgr* instance() ;
45 
47  ICondDBMgr* getDBConnection( const std::string& dbInit , DBInterface* dbInterface ) ;
48 
50  void releaseConnection( const std::string& dbInit, DBInterface* dbInterface ) ;
51 
54 
55  private:
56  DBMap _map{} ;
57 
58  };
59 
60 } //end namespace
61 
62 #endif // DBConnectionMgr_h
63 
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&#39;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