| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# 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: /tmp/svngaudi/tmp.jEpFh25751/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 IIncidentSvc;
    00031   class IFileCatalog;
    00032   class IIODataManager;
    00033   class IDataConnection;
    00034 }
    00035 class PoolDbDataConnection;
    00036
    00046 class PoolDbCnvSvc : public ConversionSvc,
    00047                      public pool::DbOptionCallback,
    00048                      virtual public IPoolDbMgr
    00049 {
    00050 public:
    00051   struct DbH  {
    00052     pool::DbDatabase     first;
    00053     pool::DbTransaction* second;
    00054     int                  count;
    00055
    00056     DbH(const pool::DbDatabase& db, pool::DbTransaction* tr, int cr)
    00057     : first(db), second(tr), count(cr) {}
    00058     DbH(const DbH& c)
    00059     : first(c.first), second(c.second), count(c.count) {}
    00060   };
    00061   typedef std::pair< void*, const ROOT::Reflex::Type >      ObjH;
    00062   typedef std::map<std::string, DbH>                        DbMap;
    00063   typedef std::map<std::string, std::string>                DbFidMap;
    00064
    00065 protected:
    00067   std::string              m_cacheSvcName;
    00068
    00070   std::string              m_implementation;
    00071
    00073   std::string              m_serverConnect;
    00074
    00076   bool                     m_safeTransactions;
    00077
    00079   std::vector<std::string> m_domainOpts;
    00080
    00082   std::vector<std::string> m_databaseOpts;
    00083
    00085   std::vector<std::string> m_containerOpts;
    00086
    00088   IDataManagerSvc*         m_dataMgr;
    00089
    00091   IPoolCacheSvc*           m_cacheSvc;
    00092
    00094   PoolDbDataConnection*    m_current;
    00095
    00097   pool::DbDefaultDataHandler m_handler;
    00098
    00100   pool::DbDomain           m_domH;
    00101
    00103   std::string              m_shareFiles;
    00104
    00106   bool                     m_checkFIDs;
    00107
    00109   Gaudi::IFileCatalog*     m_catalog;
    00110
    00112   Gaudi::IIODataManager*   m_ioMgr;
    00113
    00115   IIncidentSvc*            m_incidentSvc;
    00116
    00118   bool                     m_incidentEnabled;
    00119 public:
    00121   PoolDbCnvSvc(const std::string& name, ISvcLocator* svc);
    00122
    00124   virtual ~PoolDbCnvSvc();
    00125
    00127   virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
    00128
    00135   StatusCode error(const std::string& msg, bool rethrow=true);
    00136
    00141   StatusCode setDataProvider(IDataProviderSvc* pDataSvc);
    00142
    00143 public:
    00144
    00146   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
    00147
    00149   virtual StatusCode initialize();
    00150
    00152   virtual StatusCode finalize();
    00153
    00155   virtual IConverter* createConverter(long typ,
    00156                                       const CLID& wanted,
    00157                                       const ICnvFactory* fac);
    00158
    00160   virtual void loadConverter(DataObject*);
    00161
    00163   virtual IPoolCacheSvc* cacheSvc() const {  return m_cacheSvc; }
    00164
    00174   virtual StatusCode accessStorageType(const std::string& type_string,
    00175                                        long& gaudi_type);
    00176
    00182   virtual StatusCode connectOutput(const std::string& outputFile,
    00183                                    const std::string& openMode);
    00184
    00186
    00192   StatusCode  connectDatabase(int typ,
    00193                               const std::string& outputFile,
    00194                               pool::DbAccessMode openMode,
    00195                               PoolDbDataConnection** con);
    00196
    00207   StatusCode connectContainer(        pool::DbDatabase& dbH,
    00208                                       const std::string& cntName,
    00209                                       pool::DbAccessMode openMode,
    00210                                       const pool::DbTypeInfo* shape,
    00211                                       pool::DbContainer& cntH);
    00212
    00224   virtual StatusCode connectContainer(int typ,
    00225                                       const std::string& dbName,
    00226                                       const std::string& cntName,
    00227                                       pool::DbAccessMode openMode,
    00228                                       const pool::DbTypeInfo* shape,
    00229                                       pool::DbContainer& cntH
    00230                                       );
    00231
    00236   virtual StatusCode connectOutput(const std::string& outputFile);
    00237
    00247   virtual StatusCode commitOutput(const std::string& outputFile,
    00248                                   bool               do_commit);
    00249
    00258   virtual StatusCode connect(const std::string& dbName,
    00259                              const std::string& cntName,
    00260                              pool::DbContainer& cntH);
    00261
    00267   virtual StatusCode disconnect(const std::string& dbName);
    00268
    00279   virtual StatusCode createAddress( long                 svc_type,
    00280                                     const CLID&          clid,
    00281                                     const std::string*   par,
    00282                                     const unsigned long* ip,
    00283                                     IOpaqueAddress*&     refpAddress);
    00284
    00292   virtual StatusCode createAddress( pool::Token*         pToken,
    00293                                     PoolDbAddress**      ppAddress);
    00294
    00302   virtual pool::DbSelect* createSelect(const std::string& criteria,
    00303                                        const std::string& dbName,
    00304                                        const std::string& cntName);
    00305
    00313   virtual pool::DbSelect* createSelect(const std::string& criteria,
    00314                                        pool::DbDatabase&  dbH,
    00315                                        const std::string& cntName);
    00316
    00325   virtual StatusCode markWrite(     pool::DataCallBack* call,
    00326                                     const std::string& cntName,
    00327                                     PoolDbAddress**    ppAddr=0);
    00328
    00335   virtual StatusCode markUpdate(    pool::DataCallBack* call,
    00336                                     PoolDbAddress*     pAddr);
    00337
    00344   virtual StatusCode read(          pool::DataCallBack* call,
    00345                                     PoolDbAddress*     pAddr);
    00346
    00348
    00353   virtual StatusCode read(          pool::DataCallBack* call,
    00354                                     pool::Token& tok);
    00355 };
    00356 #endif  // POOLDB_POOLDBCNVSVC_H