| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Protected Member Functions

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

    : PoolDbBaseCnv(typ, clid, svc)
    {
    }

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

Standard Destructor.

Definition at line 78 of file PoolDbStatCnv.h.

    {  }

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

                                                                      {
      const std::string& path = pReg->identifier();
      long loc = path.find('/',1);
      std::string local = "<local>";
      if ( loc > 0 )  {
        loc = path.find('/',++loc);
        if ( loc > 0 )  {
          local += path.substr(loc,path.length()-loc);
        }
      }
      return local;
    }

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.

                                                                 {
      std::string path = topLevel(pReg);
      DataObject* pObj = 0;
      dataProvider()->retrieveObject(path, pObj);
      if ( pObj )  {
        NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
        if ( fptr )  {
          return fptr->name();
        }
      }
      return "";
    }

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.

    {
      ROOT::Reflex::Type cl = pool::DbReflex::forTypeInfo(typeid(PoolDbNTupleDescriptor));
      const pool::DbTypeInfo* info = pool::DbTypeInfo::create(cl.Name(ROOT::Reflex::SCOPED));
      if ( info )  {
        StatusCode status = m_dbMgr->connectOutput(path, openMode);
        if ( status.isSuccess() )  {
          std::auto_ptr<PoolDbNTupleDescriptor> dsc(new PoolDbNTupleDescriptor());
          dsc->description = desc;
          dsc->optional    = opt;
          dsc->container   = ident;
          dsc->guid        = guid.toString();
          dsc->clid        = clid;
          pool::DataCallBack* call=new pool::DbObjectCallBack(cl);
          call->setShape(info);
          call->setObject(dsc.release());
          status = m_dbMgr->markWrite(call,"GaudiStatisticsDescription");
          if ( status.isSuccess() ) {
            status = m_dbMgr->commitOutput(path, true);
          }
        }
        return status;
      }
      return StatusCode::FAILURE;
    }

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.

    {
      if ( pReg )    {
        std::string path = pReg->identifier();
        size_t idx = path.find('/', 1);
        if ( idx != std::string::npos )  {
          idx = path.find('/', idx+1);
          if ( idx != std::string::npos )  {
            path = path.substr(0, idx);
          }
          return path;
        }
      }
      return "";
    }

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

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

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