| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions

# Gaudi::RootDatabaseCnv Class Reference

Statistics file converter class definition. More...

`#include <Root/RootDatabaseCnv.h>`

Inheritance diagram for Gaudi::RootDatabaseCnv:
[legend]
Collaboration diagram for Gaudi::RootDatabaseCnv:
[legend]

List of all members.

## Public Member Functions
| RootDatabaseCnv (long typ, const CLID &, ISvcLocator *svc, RootCnvSvc *mgr)
| Initializing Constructor.
virtual | ~RootDatabaseCnv ()
| 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 root database files.

Author:
  M.Frank

Version:
  1.0

Definition at line 29 of file RootDatabaseCnv.h.

## Constructor & Destructor Documentation

RootDatabaseCnv::RootDatabaseCnv | ( | long | typ,
|  | const CLID & | cl,
|  | ISvcLocator * | svc,
|  | RootCnvSvc * | mgr
| ) |  |

Initializing Constructor.

Parameters:

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

Returns:
  Reference to RootDatabaseCnv object

Definition at line 28 of file RootDatabaseCnv.cpp.

    : RootDirectoryCnv(typ, cl, svc, mgr)
    {
    }

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

Standard destructor.

Definition at line 34 of file RootDatabaseCnv.cpp.

                                        {
    }

## Member Function Documentation

virtual const std::string Gaudi::RootDatabaseCnv::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 Gaudi::RootStatCnv.

Definition at line 49 of file RootDatabaseCnv.h.

                                                                             {
          return "<local>";
        }

StatusCode RootDatabaseCnv::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 Gaudi::RootDirectoryCnv.

Definition at line 39 of file RootDatabaseCnv.cpp.

                                                                           {
      StatusCode status = StatusCode::FAILURE;
      if ( pAddr ) {
        RootDataConnection* con = 0;
        IRegistry* pReg = pAddr->registry();
        const unsigned long* ipars = pAddr->ipar();
        const string*   spars = pAddr->par();
        char mode = char(ipars[1]);
        string fname   = spars[0];
        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;
        string cntName = containerName(pReg);
        if ( create ) {
          m_dbMgr->connectDatabase(fname,IDataConnection::CREATE,&con).ignore();
          status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
          if ( status.isSuccess() )  {
            log() << MSG::INFO << "Opened NEW Database file:"
              << fname << " as " << oname << endmsg;
          }
        }
        else if ( update )  {
          m_dbMgr->connectDatabase(fname,IDataConnection::UPDATE,&con).ignore();
          status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
          if ( status.isSuccess() )  {
            log() << MSG::INFO << "Connect to existing Database file:"
              << fname << " as " << oname << " for UPDATE" << endmsg;
          }
        }
        else if ( read ) {
          status = m_dbMgr->connectDatabase(fname,IDataConnection::READ,&con);
          if ( status.isSuccess() )  {
            log() << MSG::INFO << "Connect to existing Database file:"
              << fname << " as " << oname << " for READ" << endmsg;
          }
        }
        else if ( recrea )  {
          m_dbMgr->connectDatabase(fname,IDataConnection::RECREATE,&con).ignore();
          status = saveDescription(fname, cntName, "File containing statistics results.","", clid);
          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_v23r0/RootCnv/RootCnv/RootDatabaseCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/RootCnv/src/RootDatabaseCnv.cpp

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