| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# 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 GAUDI_API PoolDbCnvSvc: public extends1<ConversionSvc, IPoolDbMgr>,
    00047                               public pool::DbOptionCallback
    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   std::string              m_recordName;
    00076
    00078   bool                     m_safeTransactions;
    00079
    00081   std::vector<std::string> m_domainOpts;
    00082
    00084   std::vector<std::string> m_databaseOpts;
    00085
    00087   std::vector<std::string> m_containerOpts;
    00088
    00090   IDataManagerSvc*         m_dataMgr;
    00091
    00093   IPoolCacheSvc*           m_cacheSvc;
    00094
    00096   PoolDbDataConnection*    m_current;
    00097
    00099   pool::DbDefaultDataHandler m_handler;
    00100
    00102   pool::DbDomain           m_domH;
    00103
    00105   std::string              m_shareFiles;
    00106
    00108   bool                     m_checkFIDs;
    00109
    00111   Gaudi::IFileCatalog*     m_catalog;
    00112
    00114   Gaudi::IIODataManager*   m_ioMgr;
    00115
    00117   IIncidentSvc*            m_incidentSvc;
    00118
    00120   bool                     m_incidentEnabled;
    00121 public:
    00123   PoolDbCnvSvc(const std::string& name, ISvcLocator* svc);
    00124
    00126   virtual ~PoolDbCnvSvc();
    00127
    00129   virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
    00130
    00137   StatusCode error(const std::string& msg, bool rethrow=true);
    00138
    00143   StatusCode setDataProvider(IDataProviderSvc* pDataSvc);
    00144
    00145 public:
    00146
    00148   virtual StatusCode initialize();
    00149
    00151   virtual StatusCode finalize();
    00152
    00154   virtual IConverter* createConverter(long typ,
    00155                                       const CLID& wanted,
    00156                                       const ICnvFactory* fac);
    00157
    00159   virtual void loadConverter(DataObject*);
    00160
    00162   virtual IPoolCacheSvc* cacheSvc() const {  return m_cacheSvc; }
    00163
    00173   virtual StatusCode accessStorageType(const std::string& type_string,
    00174                                        long& gaudi_type);
    00175
    00181   virtual StatusCode connectOutput(const std::string& outputFile,
    00182                                    const std::string& openMode);
    00183
    00185
    00191   StatusCode  connectDatabase(int typ,
    00192                               const std::string& outputFile,
    00193                               pool::DbAccessMode openMode,
    00194                               PoolDbDataConnection** con);
    00195
    00206   StatusCode connectContainer(        pool::DbDatabase& dbH,
    00207                                       const std::string& cntName,
    00208                                       pool::DbAccessMode openMode,
    00209                                       const pool::DbTypeInfo* shape,
    00210                                       pool::DbContainer& cntH);
    00211
    00223   virtual StatusCode connectContainer(int typ,
    00224                                       const std::string& dbName,
    00225                                       const std::string& cntName,
    00226                                       pool::DbAccessMode openMode,
    00227                                       const pool::DbTypeInfo* shape,
    00228                                       pool::DbContainer& cntH
    00229                                       );
    00230
    00235   virtual StatusCode connectOutput(const std::string& outputFile);
    00236
    00246   virtual StatusCode commitOutput(const std::string& outputFile,
    00247                                   bool               do_commit);
    00248
    00257   virtual StatusCode connect(const std::string& dbName,
    00258                              const std::string& cntName,
    00259                              pool::DbContainer& cntH);
    00260
    00266   virtual StatusCode disconnect(const std::string& dbName);
    00267
    00278   virtual StatusCode createAddress( long                 svc_type,
    00279                                     const CLID&          clid,
    00280                                     const std::string*   par,
    00281                                     const unsigned long* ip,
    00282                                     IOpaqueAddress*&     refpAddress);
    00283
    00291   virtual StatusCode createAddress( pool::Token*         pToken,
    00292                                     PoolDbAddress**      ppAddress);
    00293
    00301   virtual pool::DbSelect* createSelect(const std::string& criteria,
    00302                                        const std::string& dbName,
    00303                                        const std::string& cntName);
    00304
    00312   virtual pool::DbSelect* createSelect(const std::string& criteria,
    00313                                        pool::DbDatabase&  dbH,
    00314                                        const std::string& cntName);
    00315
    00324   virtual StatusCode markWrite(     pool::DataCallBack* call,
    00325                                     const std::string& cntName,
    00326                                     PoolDbAddress**    ppAddr=0);
    00327
    00334   virtual StatusCode markUpdate(    pool::DataCallBack* call,
    00335                                     PoolDbAddress*     pAddr);
    00336
    00343   virtual StatusCode read(          pool::DataCallBack* call,
    00344                                     PoolDbAddress*     pAddr);
    00345
    00347
    00352   virtual StatusCode read(          pool::DataCallBack* call,
    00353                                     pool::Token& tok);
    00354 };
    00355 #endif  // POOLDB_POOLDBCNVSVC_H