|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
The DataConnection incanation for the usage in GaudiPoolDb. More...
#include <PoolDbDataConnection.h>

Public Member Functions | |
| PoolDbDataConnection (IInterface *owner, const std::string &nam, int typ, int mode, pool::DbDomain &domH) | |
| Standard constructor. | |
| virtual | ~PoolDbDataConnection () |
| Standard destructor. | |
| pool::DbDatabase & | database () |
| Access to POOL database handle. | |
| pool::DbTransaction & | transaction () |
| Access to POOL transaction handle. | |
| virtual bool | isConnected () const |
| Check if connected to data source. | |
| virtual StatusCode | connectRead () |
| Open data stream in read mode. | |
| virtual StatusCode | connectWrite (IoType) |
| Open data stream in write mode. | |
| virtual StatusCode | disconnect () |
| Release data stream. | |
| virtual StatusCode | read (void *const , size_t) |
| Read raw byte buffer from input stream. | |
| virtual StatusCode | write (const void *, int) |
| Write raw byte buffer to output stream. | |
| virtual long long int | seek (long long int, int) |
| Seek on the file described by ioDesc. Arguments as in seek(). | |
Protected Member Functions | |
| virtual StatusCode | i_connect () |
| Internal connect call. | |
Protected Attributes | |
| int | m_type |
| int | m_mode |
| Datasource access mode. | |
| pool::DbTransaction | m_transaction |
| Transaction handle for this data source. | |
| pool::DbDatabase | m_dbH |
| Database handle for this data source. | |
| pool::DbDomain | m_domH |
| Domain handle specifying the storage domain. | |
The DataConnection incanation for the usage in GaudiPoolDb.
This entity interacts with the IODataManager from the GaudiUtils package and allows to connect refereneces between objects stored in POOL files.
M.Frank
Definition at line 29 of file PoolDbDataConnection.h.
| PoolDbDataConnection::PoolDbDataConnection | ( | IInterface * | owner, | |
| const std::string & | nam, | |||
| int | typ, | |||
| int | mode, | |||
| pool::DbDomain & | domH | |||
| ) |
Standard constructor.
| PoolDbDataConnection::~PoolDbDataConnection | ( | ) | [virtual] |
Standard destructor.
Definition at line 48 of file PoolDbDataConnection.cpp.
00048 { 00049 s_connectionCount->decrement(); 00050 }
| virtual StatusCode PoolDbDataConnection::connectRead | ( | ) | [inline, virtual] |
Open data stream in read mode.
Definition at line 55 of file PoolDbDataConnection.h.
00055 { return i_connect(); }
| virtual StatusCode PoolDbDataConnection::connectWrite | ( | IoType | ) | [inline, virtual] |
Open data stream in write mode.
Definition at line 57 of file PoolDbDataConnection.h.
00057 {return i_connect(); }
| pool::DbDatabase& PoolDbDataConnection::database | ( | ) | [inline] |
Access to POOL database handle.
Definition at line 49 of file PoolDbDataConnection.h.
00049 { return m_dbH; }
| StatusCode PoolDbDataConnection::disconnect | ( | ) | [virtual] |
Release data stream.
Definition at line 86 of file PoolDbDataConnection.cpp.
00086 { 00087 if ( m_dbH.isValid() ) { 00088 m_dbH.close(); 00089 m_dbH = DbDatabase(pool::POOL_StorageType); 00090 return StatusCode::SUCCESS; 00091 } 00092 return StatusCode::FAILURE; 00093 }
| StatusCode PoolDbDataConnection::i_connect | ( | ) | [protected, virtual] |
Internal connect call.
Open data stream.
Definition at line 53 of file PoolDbDataConnection.cpp.
00053 { 00054 DbAccessMode mode = (DbAccessMode)m_mode; 00055 // Note: (1<<4) means RECREATE existing: We need to get the GUID in order to not 00056 // create a new one, if the catalog is pre-allocated 00057 bool open_existing = isEqualMode(mode,pool::READ)||isEqualMode(mode,pool::UPDATE|(1<<4)); 00058 m_dbH = DbDatabase(m_domH.find(fid())); 00059 if ( !m_dbH.isValid() ) { 00060 std::string true_fid; 00061 pool::DbStatus sc = m_dbH.open(m_domH, pfn(), fid(), mode); 00062 if ( sc.isSuccess() && open_existing ) { 00063 m_dbH.param("FID",true_fid); 00064 if ( fid() == pfn() ) { 00065 m_fid = true_fid; 00066 m_dbH.close(); 00067 sc = m_dbH.open(m_domH, pfn(), fid(), mode); 00068 } 00069 else if ( strcasecmp(true_fid.c_str(),fid().c_str()) != 0 ) { 00070 m_dbH.close(); 00071 throw std::runtime_error("FID mismatch:\n\t\t\t\tFID="+ 00072 fid()+" (catalog) <> \n\t\t\t\t"+ 00073 true_fid+" (file) for PFN="+pfn()); 00074 return BAD_DATA_CONNECTION; 00075 } 00076 } 00077 else if ( open_existing ) { 00078 return BAD_DATA_CONNECTION; 00079 } 00080 return sc.isSuccess() ? StatusCode::SUCCESS : StatusCode::FAILURE; 00081 } 00082 return StatusCode::SUCCESS; 00083 }
| virtual bool PoolDbDataConnection::isConnected | ( | ) | const [inline, virtual] |
Check if connected to data source.
Definition at line 53 of file PoolDbDataConnection.h.
00053 { return m_dbH.ptr() != 0; }
| virtual StatusCode PoolDbDataConnection::read | ( | void * | const, | |
| size_t | ||||
| ) | [inline, virtual] |
Read raw byte buffer from input stream.
Definition at line 61 of file PoolDbDataConnection.h.
00062 { return StatusCode::FAILURE; }
Seek on the file described by ioDesc. Arguments as in seek().
Definition at line 67 of file PoolDbDataConnection.h.
| pool::DbTransaction& PoolDbDataConnection::transaction | ( | ) | [inline] |
Access to POOL transaction handle.
Definition at line 51 of file PoolDbDataConnection.h.
00051 { return m_transaction; }
| virtual StatusCode PoolDbDataConnection::write | ( | const void * | , | |
| int | ||||
| ) | [inline, virtual] |
Write raw byte buffer to output stream.
Definition at line 64 of file PoolDbDataConnection.h.
00065 { return StatusCode::FAILURE; }
pool::DbDatabase PoolDbDataConnection::m_dbH [protected] |
Database handle for this data source.
Definition at line 37 of file PoolDbDataConnection.h.
pool::DbDomain PoolDbDataConnection::m_domH [protected] |
Domain handle specifying the storage domain.
Definition at line 39 of file PoolDbDataConnection.h.
int PoolDbDataConnection::m_mode [protected] |
Datasource access mode.
Definition at line 33 of file PoolDbDataConnection.h.
pool::DbTransaction PoolDbDataConnection::m_transaction [protected] |
Transaction handle for this data source.
Definition at line 35 of file PoolDbDataConnection.h.
int PoolDbDataConnection::m_type [protected] |
Definition at line 31 of file PoolDbDataConnection.h.