| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# PoolDbDatabaseCnv Class Reference

`#include <PoolDb/PoolDbDatabaseCnv.h>`

Inheritance diagram for PoolDbDatabaseCnv:

[legend]
Collaboration diagram for PoolDbDatabaseCnv:

[legend]
List of all members.

## Detailed Description

Statistics file converter class definition.

Description: Definition of the converter to open Database file. Wether this is a real file or only a connection to a database depends on the underlying engine.

Author:
  M.Frank

Version:
  1.0

Definition at line 26 of file PoolDbDatabaseCnv.h.

## Public Member Functions
| PoolDbDatabaseCnv (long typ, const CLID &, ISvcLocator *svc)
| Initializing Constructor.
virtual | ~PoolDbDatabaseCnv ()
| Standard destructor.
virtual const std::string | containerName (IRegistry *) const
| Retrieve the name of the container a given object is placed into.
virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Converter overrides: Create transient object from persistent data.

## Constructor & Destructor Documentation

PoolDbDatabaseCnv::PoolDbDatabaseCnv | ( | long | typ,
|  | const CLID & | ,
|  | ISvcLocator * | svc |
| ) |  |  |

Initializing Constructor.

Parameters:

  | typ | [IN] Concrete storage type of the converter
  | svc | [IN] Pointer to service locator object

Returns:
  Reference to PoolDbDatabaseCnv object

Definition at line 24 of file PoolDbDatabaseCnv.cpp.

    00025 : PoolDbDirectoryCnv(typ, cl, svc)
    00026 {
    00027 }

PoolDbDatabaseCnv::~PoolDbDatabaseCnv | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 30 of file PoolDbDatabaseCnv.cpp.

    00030                                         {
    00031 }

## Member Function Documentation

virtual const std::string PoolDbDatabaseCnv::containerName | ( | IRegistry * |  | ) | const`[inline, virtual]`

Retrieve the name of the container a given object is placed into.

Parameters:

  | pReg | [IN] Pointer to registry entry.

Returns:
  Name of the container the object should be put to.

Reimplemented from PoolDbStatCnv.

Definition at line 45 of file PoolDbDatabaseCnv.h.

Referenced by createObj().

    00045                                                                        {
    00046     return "<local>";
    00047   }

StatusCode PoolDbDatabaseCnv::createObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject *& | refpObj |
| ) |  |  | `[virtual]`

Converter overrides: Create transient object from persistent data.

Parameters:

  | refpAddress | [IN] Pointer to object address.
  | refpObject | [OUT] Location to pointer to store data object

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbDirectoryCnv.

Definition at line 35 of file PoolDbDatabaseCnv.cpp.

References containerName(), pool::Guid::Data1, endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::INFO, IOpaqueAddress::ipar(), StatusCode::isSuccess(), Converter::msgSvc(), IRegistry::name(), pool::Guid::null(), Converter::objType(), oname(), IOpaqueAddress::par(), IOpaqueAddress::registry(), PoolDbStatCnv::saveDescription(), and StatusCode::SUCCESS.

    00035                                                                          {
    00036   StatusCode status = StatusCode::FAILURE;
    00037   MsgStream log(msgSvc(), "PoolDbDatabaseCnv");
    00038   if ( pAddr ) {
    00039     IRegistry* pReg = pAddr->registry();
    00040     const unsigned long* ipars = pAddr->ipar();
    00041     const std::string*   spars = pAddr->par();
    00042     char mode = char(ipars[1]);
    00043     pool::Guid guid(pool::Guid::null());
    00044     std::string fname   = spars[0];
    00045     std::string oname   = pReg->name();
    00046     bool recrea = mode == 'R';
    00047     bool create = mode == 'N';
    00048     bool update = mode == 'U';
    00049     bool read   = mode == 'O';
    00050     const CLID& clid = objType();
    00051     status = StatusCode::SUCCESS;
    00052     guid.Data1 = objType();
    00053     std::string cntName = containerName(pReg);
    00054     if ( create ) {
    00055       status = saveDescription(fname, cntName, "File containing statistics results.",
    00056                                "", guid, clid, "NEW");
    00057       if ( status.isSuccess() )  {
    00058         log << MSG::INFO << "Opened NEW Database file:"
    00059             << fname << " as " << oname << endreq;
    00060       }
    00061     }
    00062     else if ( update )  {
    00063       status = saveDescription(fname, cntName, "File containing statistics results.",
    00064                                "", guid, clid, "UPDATE");
    00065       if ( status.isSuccess() )  {
    00066         log << MSG::INFO << "Connect to existing Database file:"
    00067             << fname << " as " << oname << " for UPDATE" << endreq;
    00068       }
    00069     }
    00070     else if ( read ) {
    00071       if ( status.isSuccess() )  {
    00072         log << MSG::INFO << "Connect to existing Database file:"
    00073             << fname << " as " << oname << " for READ" << endreq;
    00074       }
    00075     }
    00076     else if ( recrea )  {
    00077       status = saveDescription(fname, cntName, "File containing statistics results.",
    00078                                "", guid, clid, "RECREATE");
    00079       if ( status.isSuccess() )  {
    00080         log << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endreq;
    00081       }
    00082     }
    00083     else  {
    00084       log << MSG::ERROR << "Don't know what to do:" << fname << endreq;
    00085       status = StatusCode::FAILURE;
    00086     }
    00087     // Now create object
    00088     if ( status.isSuccess() )  {
    00089       NTuple::File* pFile = new NTuple::File(objType(), fname, oname);
    00090       pFile->setOpen(false);
    00091       refpObj = pFile;
    00092     }
    00093   }
    00094   return status;
    00095 }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiPoolDb/v4r0/GaudiPoolDb/PoolDbDatabaseCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiPoolDb/v4r0/src/PoolDbDatabaseCnv.cpp