| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# PoolDbDataConnection Class Reference

The DataConnection incanation for the usage in GaudiPoolDb. More...

`#include <PoolDbDataConnection.h>`

Collaboration diagram for PoolDbDataConnection:

[legend]

List of all members.

## 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.

## Detailed Description

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

Version:
  1.0

Date:
  20/10/2007

Definition at line 29 of file PoolDbDataConnection.h.

## Constructor & Destructor Documentation

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 }

## Member Function Documentation

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   bool open_existing = isEqualMode(mode,pool::READ)||isEqualMode(mode,pool::UPDATE)||(1<<4);
    00056   m_dbH = DbDatabase(m_domH.find(fid()));
    00057   if ( !m_dbH.isValid() )  {
    00058     std::string true_fid;
    00059     pool::DbStatus sc = m_dbH.open(m_domH, pfn(), fid(), mode);
    00060     if ( sc.isSuccess() && open_existing )  {
    00061       m_dbH.param("FID",true_fid);
    00062       if ( fid() == pfn() ) {
    00063         m_fid = true_fid;
    00064         m_dbH.close();
    00065         sc = m_dbH.open(m_domH, pfn(), fid(), mode);
    00066       }
    00067       else if ( strcasecmp(true_fid.c_str(),fid().c_str()) != 0 )  {
    00068         m_dbH.close();
    00069         throw std::runtime_error("FID mismatch:\n\t\t\t\tFID="+
    00070                                  fid()+" (catalog) <> \n\t\t\t\t"+
    00071                                  true_fid+" (file) for PFN="+pfn());
    00072         return BAD_DATA_CONNECTION;
    00073       }
    00074     }
    00075     else if ( open_existing ) {
    00076       return BAD_DATA_CONNECTION;
    00077     }
    00078     return sc.isSuccess() ? StatusCode::SUCCESS : StatusCode::FAILURE;
    00079   }
    00080   return StatusCode::SUCCESS;
    00081 }

pool::DbDatabase& PoolDbDataConnection::database | ( |  | ) | `[inline]`

Access to POOL database handle.

Definition at line 49 of file PoolDbDataConnection.h.

    00049 {     return m_dbH;                }

pool::DbTransaction& PoolDbDataConnection::transaction | ( |  | ) | `[inline]`

Access to POOL transaction handle.

Definition at line 51 of file PoolDbDataConnection.h.

    00051 {     return m_transaction;        }

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::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();    }

StatusCode PoolDbDataConnection::disconnect | ( |  | ) | `[virtual]`

Release data stream.

Definition at line 84 of file PoolDbDataConnection.cpp.

    00084                                              {
    00085   if ( m_dbH.isValid() )  {
    00086     m_dbH.close();
    00087     m_dbH = DbDatabase(pool::POOL_StorageType);
    00088     return StatusCode::SUCCESS;
    00089   }
    00090   return StatusCode::FAILURE;
    00091 }

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;                                             }

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;                                             }

virtual long long int PoolDbDataConnection::seek | ( | long long | int,
|  | int |  |
| ) |  |  | `[inline, virtual]`

Seek on the file described by ioDesc. Arguments as in seek().

Definition at line 67 of file PoolDbDataConnection.h.

    00068   {  return -1;                                                              }

## Member Data Documentation

int PoolDbDataConnection::m_type`[protected]`

Definition at line 31 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.

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.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiPoolDb/GaudiPoolDb/PoolDbDataConnection.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiPoolDb/src/PoolDbDataConnection.cpp