CMS 3D CMS Logo

ConnectionHandler.h

Go to the documentation of this file.
00001 #ifndef CondCore_DBCommon_ConnectionHandler_H
00002 #define CondCore_DBCommon_ConnectionHandler_H
00003 //
00004 // Package:     DBCommon
00005 // Class  :     ConnectionHandler
00006 // 
00011 //
00012 // Author:      Zhen Xie
00013 //
00014 #include <map>
00015 #include <string>
00016 namespace cond{
00017   class DBSession;
00018   class Connection;
00019   class ConnectionHandler{
00020   public:
00021     static ConnectionHandler& Instance();
00023     void registerConnection(const std::string& name,
00024                             const std::string& con,
00025                             int timeOutInSec=0);
00027     void registerConnection(const std::string& userconnect,
00028                             cond::DBSession& session,
00029                             int timeOutInSec=0);
00031     void removeConnection( const std::string& name );
00035     void connect(cond::DBSession* session);
00037     void disconnectAll();
00039     ConnectionHandler(){}
00041     Connection* getConnection( const std::string& name );
00042   private:
00044     ConnectionHandler( ConnectionHandler& );
00046     ConnectionHandler& operator=(const ConnectionHandler&);
00048     ~ConnectionHandler(); 
00049   private:
00051     std::map<std::string,cond::Connection*> m_registry;
00052   };// class ConnectionHandler
00053 }//ns cond
00054 #endif

Generated on Tue Jun 9 17:26:04 2009 for CMSSW by  doxygen 1.5.4