// PoolSvc.h #ifndef POOLSVC_POOLSVC_H #define POOLSVC_POOLSVC_H // Valeri Fine and David Adams // May 2003 // // PoolSvc is a Gaudi service that initializes POOL and facilitates // the reading and writing of event data. #include "GaudiKernel/Service.h" #include "POOLCore/Guid.h" #include "POOLCore/pool.h" #include "FileCatalog/IFileCatalog.h" // Forward declarations namespace pool { class IFileCatalog; class ITokenValidator; class IDataSvc; class Placement; } template class SvcFactory; static const InterfaceID IID_PoolSvc(2003, 2, 07); class PoolSvc : public ::Service { public: // static members // Return the Gaudi interface ID. static const InterfaceID& interfaceID() { return IID_PoolSvc; } // Return the ID for a class. static pool::Guid getClassId(const std::string &className); // Print an error message. static void checkStatus(pool::Status sc, const std::string& msg); public: // Constructor and destructor // Constructor. PoolSvc (const std::string& name, ISvcLocator* pSvcLocator); // Destructor. ~PoolSvc(); public: // non-static members // Gaudi Service interface method implementatios: StatusCode initialize(); StatusCode finalize(); StatusCode queryInterface( const IID& riid, void** ppvInterface ); // Return the data service. pool::IDataSvc* context() const { return m_context; } // Return the file catalog. pool::IFileCatalog* catalog() const { return m_catalog; } // Return the techology and file or DB name for the input // data file. long getTechnology() const; pool::IFileCatalog::FileID getDbIDbyName(); // Start a transaction and brodcast error if it fails. void startTransaction(pool::ConnectionH &token, pool::TransactionH &tr); // End a transaction and brodcast error if it fails. void endTransaction(pool::TransactionH &tr); // Clear the POOL transient cache. void clearData(); // Register a class for conversion. // Each converter calls this for its class. void registerDefaultTransform(const std::string &className); private: // data pool::IFileCatalog *m_catalog; pool::ITokenValidator *m_validator; pool::IDataSvc *m_context; private: // internal helper functions // initialise pool components void initPool(); // instantiate the POOL Data Service: pool::IDataSvc* createContext(); // instantiate the POOL File Catalog: pool::IFileCatalog* createCatalog(); // Empty. void initDictionary(); private: // Hide copy and assignement // Copy PoolSvc(const PoolSvc& rhs); // Assignment. PoolSvc& operator=(const PoolSvc& rhs); }; #endif