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

# PoolDbStatCnv Class Reference

`#include <PoolDb/PoolDbStatCnv.h>`

Inheritance diagram for PoolDbStatCnv:

[legend]
Collaboration diagram for PoolDbStatCnv:

[legend]
List of all members.

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

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

## 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 24 of file PoolDbStatCnv.cpp.

    00027 : PoolDbBaseCnv(typ, clid, svc)
    00028 {
    00029 }

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 32 of file PoolDbStatCnv.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::find(), IRegistry::identifier(), std::basic_string< _CharT, _Traits, _Alloc >::length(), Gaudi::Utils::Histos::path(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

Referenced by PoolDbNTupleCnv::createRep(), PoolDbDirectoryCnv::createRep(), PoolDbNTupleCnv::fillRepRefs(), and PoolDbDirectoryCnv::updateObjRefs().

    00032                                                                   {
    00033   const std::string& path = pReg->identifier();
    00034   long loc = path.find('/',1);
    00035   std::string local = "<local>";
    00036   if ( loc > 0 )  {
    00037     loc = path.find('/',++loc);
    00038     if ( loc > 0 )  {
    00039       local += path.substr(loc,path.length()-loc);
    00040     }
    00041   }
    00042   return local;
    00043 }

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 45 of file PoolDbStatCnv.cpp.

References Converter::dataProvider(), NTuple::File::name(), Gaudi::Utils::Histos::path(), IDataProviderSvc::retrieveObject(), and topLevel().

Referenced by PoolDbNTupleCnv::createRep(), PoolDbDirectoryCnv::createRep(), PoolDbNTupleCnv::fillRepRefs(), and PoolDbDirectoryCnv::updateObjRefs().

    00045                                                              {
    00046   std::string path = topLevel(pReg);
    00047   DataObject* pObj = 0;
    00048   dataProvider()->retrieveObject(path, pObj);
    00049   if ( pObj )  {
    00050     NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
    00051     if ( fptr )  {
    00052       return fptr->name();
    00053     }
    00054   }
    00055   return "";
    00056 }

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 59 of file PoolDbStatCnv.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::find(), IRegistry::identifier(), std::basic_string< _CharT, _Traits, _Alloc >::npos, Gaudi::Utils::Histos::path(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

Referenced by fileName(), and PoolDbDirectoryCnv::updateObjRefs().

    00060 {
    00061   if ( pReg )    {
    00062     std::string path = pReg->identifier();
    00063     size_t idx = path.find('/', 1);
    00064     if ( idx != std::string::npos )  {
    00065       idx = path.find('/', idx+1);
    00066       if ( idx != std::string::npos )  {
    00067         path = path.substr(0, idx);
    00068       }
    00069       return path;
    00070     }
    00071   }
    00072   return "";
    00073 }

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 75 of file PoolDbStatCnv.cpp.

References IPoolDbMgr::commitOutput(), IPoolDbMgr::connectOutput(), pool::DbTypeInfo::create(), StatusCode::FAILURE, pool::DbReflex::forTypeInfo(), StatusCode::isSuccess(), PoolDbBaseCnv::m_dbMgr, IPoolDbMgr::markWrite(), Gaudi::Utils::Histos::path(), pool::DataCallBack::setObject(), pool::DataCallBack::setShape(), and pool::Guid::toString().

Referenced by PoolDbDatabaseCnv::createObj(), PoolDbNTupleCnv::createRep(), and PoolDbDirectoryCnv::createRep().

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

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

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