| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# PoolDbCnvSvc.h

Go to the documentation of this file.

    00001 // $Id: PoolDbCnvSvc.h,v 1.14 2008/01/23 14:31:50 hmd Exp $
    00002 //====================================================================
    00003 //      PoolDbCnvSvc definition
    00004 //--------------------------------------------------------------------
    00005 //
    00006 //      Author     : M.Frank
    00007 //====================================================================
    00008 #ifndef POOLDB_POOLDBCNVSVC_H
    00009 #define POOLDB_POOLDBCNVSVC_H
    00010 // $Header: /local/reps/Gaudi/GaudiPoolDb/GaudiPoolDb/PoolDbCnvSvc.h,v 1.14 2008/01/23 14:31:50 hmd Exp $
    00011
    00012 // Framework include files
    00013 #include "GaudiPoolDb/IPoolDbMgr.h"
    00014 #include "GaudiKernel/ConversionSvc.h"
    00015 #include "GaudiKernel/DataObject.h"
    00016 #include "StorageSvc/DbSession.h"
    00017 #include "StorageSvc/DbDomain.h"
    00018 #include "StorageSvc/DbDatabase.h"
    00019 #include "StorageSvc/DbContainer.h"
    00020 #include "StorageSvc/DbOptionCallback.h"
    00021 #include "StorageSvc/DbDefaultDataHandler.h"
    00022
    00023
    00024 #include <map>
    00025
    00026 // Forward declarations
    00027 class IPoolCacheSvc;
    00028 class IDataManagerSvc;
    00029 namespace Gaudi {
    00030   class IFileCatalog;
    00031   class IIODataManager;
    00032   class IDataConnection;
    00033 }
    00034 class PoolDbDataConnection;
    00035
    00045 class PoolDbCnvSvc : public ConversionSvc,
    00046                      public pool::DbOptionCallback,
    00047                      virtual public IPoolDbMgr
    00048 {
    00049 public:
    00050   struct DbH  {
    00051     pool::DbDatabase     first;
    00052     pool::DbTransaction* second;
    00053     int                  count;
    00054
    00055     DbH(const pool::DbDatabase& db, pool::DbTransaction* tr, int cr)
    00056     : first(db), second(tr), count(cr) {}
    00057     DbH(const DbH& c)
    00058     : first(c.first), second(c.second), count(c.count) {}
    00059   };
    00060   typedef std::pair< void*, const ROOT::Reflex::Type >      ObjH;
    00061   typedef std::map<std::string, DbH>                        DbMap;
    00062   typedef std::map<std::string, std::string>                DbFidMap;
    00063
    00064 protected:
    00066   std::string              m_cacheSvcName;
    00067
    00069   std::string              m_implementation;
    00070
    00072   std::string              m_serverConnect;
    00073
    00075   bool                     m_safeTransactions;
    00076
    00078   std::vector<std::string> m_domainOpts;
    00079
    00081   std::vector<std::string> m_databaseOpts;
    00082
    00084   std::vector<std::string> m_containerOpts;
    00085
    00087   IDataManagerSvc*         m_dataMgr;
    00088
    00090   IPoolCacheSvc*           m_cacheSvc;
    00091
    00093   PoolDbDataConnection*    m_current;
    00094
    00096   pool::DbDefaultDataHandler m_handler;
    00097
    00099   pool::DbDomain           m_domH;
    00100
    00102   std::string              m_shareFiles;
    00103
    00105   bool                     m_checkFIDs;
    00106
    00108   Gaudi::IFileCatalog*     m_catalog;
    00109
    00111   Gaudi::IIODataManager*   m_ioMgr;
    00112
    00113 public:
    00115   PoolDbCnvSvc(const std::string& name, ISvcLocator* svc);
    00116
    00118   virtual ~PoolDbCnvSvc();
    00119
    00121   virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
    00122
    00129   StatusCode error(const std::string& msg, bool rethrow=true);
    00130
    00135   StatusCode setDataProvider(IDataProviderSvc* pDataSvc);
    00136
    00137 public:
    00138
    00140   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
    00141
    00143   virtual StatusCode initialize();
    00144
    00146   virtual StatusCode finalize();
    00147
    00149   virtual IConverter* createConverter(long typ,
    00150                                       const CLID& wanted,
    00151                                       const ICnvFactory* fac);
    00152
    00154   virtual void loadConverter(DataObject*);
    00155
    00157   virtual IPoolCacheSvc* cacheSvc() const {  return m_cacheSvc; }
    00158
    00168   virtual StatusCode accessStorageType(const std::string& type_string,
    00169                                        long& gaudi_type);
    00170
    00176   virtual StatusCode connectOutput(const std::string& outputFile,
    00177                                    const std::string& openMode);
    00178
    00180
    00186   StatusCode  connectDatabase(int typ,
    00187                               const std::string& outputFile,
    00188                               pool::DbAccessMode openMode,
    00189                               PoolDbDataConnection** con);
    00190
    00201   StatusCode connectContainer(        pool::DbDatabase& dbH,
    00202                                       const std::string& cntName,
    00203                                       pool::DbAccessMode openMode,
    00204                                       const pool::DbTypeInfo* shape,
    00205                                       pool::DbContainer& cntH);
    00206
    00218   virtual StatusCode connectContainer(int typ,
    00219                                       const std::string& dbName,
    00220                                       const std::string& cntName,
    00221                                       pool::DbAccessMode openMode,
    00222                                       const pool::DbTypeInfo* shape,
    00223                                       pool::DbContainer& cntH
    00224                                       );
    00225
    00230   virtual StatusCode connectOutput(const std::string& outputFile);
    00231
    00241   virtual StatusCode commitOutput(const std::string& outputFile,
    00242                                   bool               do_commit);
    00243
    00252   virtual StatusCode connect(const std::string& dbName,
    00253                              const std::string& cntName,
    00254                              pool::DbContainer& cntH);
    00255
    00261   virtual StatusCode disconnect(const std::string& dbName);
    00262
    00273   virtual StatusCode createAddress( long                 svc_type,
    00274                                     const CLID&          clid,
    00275                                     const std::string*   par,
    00276                                     const unsigned long* ip,
    00277                                     IOpaqueAddress*&     refpAddress);
    00278
    00286   virtual StatusCode createAddress( pool::Token*         pToken,
    00287                                     PoolDbAddress**      ppAddress);
    00288
    00296   virtual pool::DbSelect* createSelect(const std::string& criteria,
    00297                                        const std::string& dbName,
    00298                                        const std::string& cntName);
    00299
    00308   virtual StatusCode markWrite(     pool::DataCallBack* call,
    00309                                     const std::string& cntName,
    00310                                     PoolDbAddress**    ppAddr=0);
    00311
    00318   virtual StatusCode markUpdate(    pool::DataCallBack* call,
    00319                                     PoolDbAddress*     pAddr);
    00320
    00327   virtual StatusCode read(          pool::DataCallBack* call,
    00328                                     PoolDbAddress*     pAddr);
    00329
    00331
    00336   virtual StatusCode read(          pool::DataCallBack* call,
    00337                                     pool::Token& tok);
    00338 };
    00339 #endif  // POOLDB_POOLDBCNVSVC_H