| # Gaudi Framework, version v21r7 |

Home |  | Generated: 22 Jan 2010

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

    00029 : PoolDbBaseCnv(typ, clid, svc)
    00030 {
    00031 }

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

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

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

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

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

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

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

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

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

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