| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Public Member Functions

# PoolDbDatabaseCnv Class Reference

Statistics file converter class definition. More...

`#include <PoolDb/PoolDbDatabaseCnv.h>`

Inheritance diagram for PoolDbDatabaseCnv:
[legend]
Collaboration diagram for PoolDbDatabaseCnv:
[legend]

List of all members.

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

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

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

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

Standard destructor.

Definition at line 30 of file PoolDbDatabaseCnv.cpp.

                                            {
    }

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

                                                                           {
        return "<local>";
      }

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.

                                                                             {
      StatusCode status = StatusCode::FAILURE;
      MsgStream log(msgSvc(), "PoolDbDatabaseCnv");
      if ( pAddr ) {
        IRegistry* pReg = pAddr->registry();
        const unsigned long* ipars = pAddr->ipar();
        const std::string*   spars = pAddr->par();
        char mode = char(ipars[1]);
        pool::Guid guid(pool::Guid::null());
        std::string fname   = spars[0];
        std::string oname   = pReg->name();
        bool recrea = mode == 'R';
        bool create = mode == 'N';
        bool update = mode == 'U';
        bool read   = mode == 'O';
        const CLID& clid = objType();
        status = StatusCode::SUCCESS;
        guid.Data1 = objType();
        std::string cntName = containerName(pReg);
        if ( create ) {
          status = saveDescription(fname, cntName, "File containing statistics results.",
                                   "", guid, clid, "NEW");
          if ( status.isSuccess() )  {
            log << MSG::INFO << "Opened NEW Database file:"
                << fname << " as " << oname << endmsg;
          }
        }
        else if ( update )  {
          status = saveDescription(fname, cntName, "File containing statistics results.",
                                   "", guid, clid, "UPDATE");
          if ( status.isSuccess() )  {
            log << MSG::INFO << "Connect to existing Database file:"
                << fname << " as " << oname << " for UPDATE" << endmsg;
          }
        }
        else if ( read ) {
          if ( status.isSuccess() )  {
            log << MSG::INFO << "Connect to existing Database file:"
                << fname << " as " << oname << " for READ" << endmsg;
          }
        }
        else if ( recrea )  {
          status = saveDescription(fname, cntName, "File containing statistics results.",
                                   "", guid, clid, "RECREATE");
          if ( status.isSuccess() )  {
            log << MSG::INFO << "Recreate Database file:" << fname << " as " << oname << endmsg;
          }
        }
        else  {
          log << MSG::ERROR << "Don't know what to do:" << fname << endmsg;
          status = StatusCode::FAILURE;
        }
        // Now create object
        if ( status.isSuccess() )  {
          NTuple::File* pFile = new NTuple::File(objType(), fname, oname);
          pFile->setOpen(false);
          refpObj = pFile;
        }
      }
      return status;
    }

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines