| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# PoolDbStatCnv Class Reference

Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples. More...

`#include <PoolDb/PoolDbStatCnv.h>`

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

List of all members.

## Public Member Functions
| PoolDbStatCnv (long typ, const CLID &clid, ISvcLocator *svc)
| Initializing Constructor.
virtual | ~PoolDbStatCnv ()
| Standard Destructor.
## Protected Member Functions
virtual const std::string | containerName (IRegistry *pDir) const
| Retrieve the name of the container a given object is placed into.
virtual const std::string | fileName (IRegistry *pReg) const
| Retrieve the name of the file a given object is placed into.
virtual const std::string | topLevel (IRegistry *pReg) const
| Retrieve the full path of the file a given object is placed into.
StatusCode | saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const pool::Guid &guid, const CLID &clid, const std::string &openMode)
| Save statistics object description.

## Detailed Description

Description: NTuple directory converter class definition Definition of the converter to manage the directories in an database representing N-Tuples.

Author:
  M.Frank

Version:
  1.0

Definition at line 24 of file PoolDbStatCnv.h.

## Constructor & Destructor Documentation

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

Initializing Constructor.

Parameters:

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

Returns:
  Reference to PoolDbBaseCnv object

Definition at line 31 of file PoolDbStatCnv.cpp.

    00034 : PoolDbBaseCnv(typ, clid, svc)
    00035 {
    00036 }

virtual PoolDbStatCnv::~PoolDbStatCnv | ( |  | ) | `[inline, virtual]`

Standard Destructor.

Definition at line 78 of file PoolDbStatCnv.h.

    00078 {  }

## Member Function Documentation

const std::string PoolDbStatCnv::containerName | ( | IRegistry * | pDir | ) | const`[protected, 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 PoolDbBaseCnv.

Reimplemented in PoolDbDatabaseCnv.

Definition at line 39 of file PoolDbStatCnv.cpp.

    00039                                                                   {
    00040   const std::string& path = pReg->identifier();
    00041   long loc = path.find('/',1);
    00042   std::string local = "<local>";
    00043   if ( loc > 0 )  {
    00044     loc = path.find('/',++loc);
    00045     if ( loc > 0 )  {
    00046       local += path.substr(loc,path.length()-loc);
    00047     }
    00048   }
    00049   return local;
    00050 }

const std::string PoolDbStatCnv::fileName | ( | IRegistry * | pReg | ) | const`[protected, virtual]`

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

Parameters:

  | pReg | [IN] Pointer to registry entry.

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

Definition at line 52 of file PoolDbStatCnv.cpp.

    00052                                                              {
    00053   std::string path = topLevel(pReg);
    00054   DataObject* pObj = 0;
    00055   dataProvider()->retrieveObject(path, pObj);
    00056   if ( pObj )  {
    00057     NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
    00058     if ( fptr )  {
    00059       return fptr->name();
    00060     }
    00061   }
    00062   return "";
    00063 }

StatusCode PoolDbStatCnv::saveDescription | ( | const std::string & | path,
|  | const std::string & | ident,
|  | const std::string & | desc,
|  | const std::string & | opt,
|  | const pool::Guid & | guid,
|  | const CLID & | clid,
|  | const std::string & | openMode |
| ) |  |  | `[protected]`

Save statistics object description.

Parameters:

  | path | [IN] Path of file to save the description on.
  | ident | [IN] Identifier of description to be saved.
  | desc | [IN] Description
  | opt | [IN] Optional description
  | guid | [IN] Object giud of described object
  | openMode | [IN] Mode of opening the file to save description

Returns:
  Status code indicating success or failure.

Definition at line 82 of file PoolDbStatCnv.cpp.

    00089 {
    00090   ROOT::Reflex::Type cl = pool::DbReflex::forTypeInfo(typeid(PoolDbNTupleDescriptor));
    00091   const pool::DbTypeInfo* info = pool::DbTypeInfo::create(cl.Name(ROOT::Reflex::SCOPED));
    00092   if ( info )  {
    00093     StatusCode status = m_dbMgr->connectOutput(path, openMode);
    00094     if ( status.isSuccess() )  {
    00095       std::auto_ptr<PoolDbNTupleDescriptor> dsc(new PoolDbNTupleDescriptor());
    00096       dsc->description = desc;
    00097       dsc->optional    = opt;
    00098       dsc->container   = ident;
    00099       dsc->guid        = guid.toString();
    00100       dsc->clid        = clid;
    00101       pool::DataCallBack* call=new pool::DbObjectCallBack(cl);
    00102       call->setShape(info);
    00103       call->setObject(dsc.release());
    00104       status = m_dbMgr->markWrite(call,"GaudiStatisticsDescription");
    00105       if ( status.isSuccess() ) {
    00106         status = m_dbMgr->commitOutput(path, true);
    00107       }
    00108     }
    00109     return status;
    00110   }
    00111   return StatusCode::FAILURE;
    00112 }

const std::string PoolDbStatCnv::topLevel | ( | IRegistry * | pReg | ) | const`[protected, virtual]`

Retrieve the full path of the file a given object is placed into.

Parameters:

  | pReg | [IN] Pointer to registry entry.

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

Definition at line 66 of file PoolDbStatCnv.cpp.

    00067 {
    00068   if ( pReg )    {
    00069     std::string path = pReg->identifier();
    00070     size_t idx = path.find('/', 1);
    00071     if ( idx != std::string::npos )  {
    00072       idx = path.find('/', idx+1);
    00073       if ( idx != std::string::npos )  {
    00074         path = path.substr(0, idx);
    00075       }
    00076       return path;
    00077     }
    00078   }
    00079   return "";
    00080 }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r0/GaudiPoolDb/GaudiPoolDb/PoolDbStatCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r0/GaudiPoolDb/src/PoolDbStatCnv.cpp

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