00001 //==================================================================== 00002 // DbSession object definition 00003 //-------------------------------------------------------------------- 00004 // 00005 // Package : System ( The LHCb Offline System) 00006 // 00007 // Description: Generic data persistency 00008 // 00009 // Author : M.Frank 00010 // History : 00011 // +---------+----------------------------------------------+--------- 00012 // | Date | Comment | Who 00013 // +---------+----------------------------------------------+--------- 00014 // | 11/07/99| Initial version | MF 00015 // +---------+----------------------------------------------+--------- 00016 //==================================================================== 00017 #ifndef DBCNV_DBSESSIONOBJ_H 00018 #define DBCNV_DBSESSIONOBJ_H 1 00019 00020 // Framework includes 00021 #include "GaudiDb/DbHandle.h" 00022 #include "GaudiDb/DbSession.h" 00023 #include "GaudiDb/DbAccessObj.h" 00024 00025 // Forward declarations 00026 class IOODataBase; 00027 class IDbSession; 00028 template <class T> class dbHandle; 00029 00056 class DbSession : public DbAccessObj<std::string, DbFederation > { 00058 friend DbSessionImpl; 00059 friend dbHandle<DbSession>; 00060 private: 00062 IOODataBase* m_dbOOMs; 00064 IMessageSvc* m_msgSvc; 00066 IDbSession* m_info; 00067 private: 00069 DbSession(IOODataBase* db, IMessageSvc* msg, unsigned char type); 00071 virtual ~DbSession(); 00073 long addRef() const; 00075 long release() const; 00077 IDbSession* info(); 00079 IOODataBase* db(); 00081 IMessageSvc* msgSvc(); 00083 DbResult open(DbAccessMode mode = DbOOMs::READ); 00085 DbResult close(); 00086 }; 00087 00088 // inline code 00089 00090 inline long DbSession::addRef() const { 00091 return ++m_refCount; 00092 } 00093 00094 inline long DbSession::release() const { 00095 long count = --m_refCount; 00096 if ( m_refCount <= 0 ) { 00097 delete this; 00098 } 00099 return count; 00100 } 00101 00102 inline IDbSession* DbSession::info() { 00103 return m_info; 00104 } 00105 00106 inline IOODataBase* DbSession::db() { 00107 return m_dbOOMs; 00108 } 00109 00110 inline IMessageSvc* DbSession::msgSvc() { 00111 return m_msgSvc; 00112 } 00113 00114 #endif // DBCNV_DBSESSIONOBJ_H 00115
1.2.3 written by Dimitri van Heesch,
© 1997-2000