driver_mgr.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: driver_mgr.hpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 19:17:54 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef DBAPI___DRIVER_MGR__HPP
- #define DBAPI___DRIVER_MGR__HPP
- /* $Id: driver_mgr.hpp,v 1000.3 2004/06/01 19:17:54 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: Michael Kholodov, Denis Vakatov
- *
- * File Description: Driver Manager definition
- *
- */
- #include <corelib/ncbistd.hpp>
- #include <corelib/ncbireg.hpp>
- #include <dbapi/driver/driver_mgr.hpp>
- #include <map>
- /** @addtogroup DbDrvMgr
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- /////////////////////////////////////////////////////////////////////////////
- //
- // CDriverManager::
- //
- // Static class for registering drivers and getting the datasource
- //
- class NCBI_DBAPI_EXPORT CDriverManager : public C_DriverMgr
- {
- public:
- // Get a single instance of CDriverManager
- static CDriverManager& GetInstance();
- // Remove instance of CDriverManager
- static void RemoveInstance();
- // Create datasource object
- class IDataSource* CreateDs(const string& driver_name,
- map<string, string> *attr = 0);
- class IDataSource* CreateDsFrom(const string& drivers,
- CNcbiRegistry* reg = 0);
- // Destroy datasource object
- void DestroyDs(const string& driver_name);
- protected:
- // Prohibit explicit construction and destruction
- CDriverManager();
- virtual ~CDriverManager();
- // Put the new data source into the internal list with
- // corresponding driver name, return previous, if already exists
- class IDataSource* RegisterDs(const string& driver_name,
- class I_DriverContext* ctx);
- map<string, class IDataSource*> m_ds_list;
- private:
- static CDriverManager* sm_Instance;
- DECLARE_CLASS_STATIC_MUTEX(sm_Mutex);
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: driver_mgr.hpp,v $
- * Revision 1000.3 2004/06/01 19:17:54 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/04/22 11:28:41 ivanov
- * Use pointer to driver manager instance instead auto_ptr
- *
- * Revision 1.6 2003/12/17 14:57:00 ivanov
- * Changed type of the Driver Manager instance to auto_ptr.
- * Added RemoveInstance() method.
- *
- * Revision 1.5 2003/12/15 20:05:41 ivanov
- * Added export specifier for building DLLs in MS Windows.
- *
- * Revision 1.4 2003/04/11 17:45:57 siyan
- * Added doxygen support
- *
- * Revision 1.3 2003/02/10 17:21:09 kholodov
- * Added: DestroyDs() method
- *
- * Revision 1.2 2002/04/29 19:13:14 kholodov
- * Modified: using C_DriverMgr as parent class of CDriverManager
- *
- * Revision 1.1 2002/01/30 14:51:24 kholodov
- * User DBAPI implementation, first commit
- *
- * ===========================================================================
- */
- #endif /* DBAPI___DBAPI__HPP */