| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions

# PoolDbDirectoryCnv Class Reference

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

`#include <GaudiPoolDb/PoolDbDirectoryCnv.h>`

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

List of all members.

## Public Member Functions
| PoolDbDirectoryCnv (long typ, const CLID &clid, ISvcLocator *svc)
| Initializing Constructor.
virtual | ~PoolDbDirectoryCnv ()
| Standard Destructor.
virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
| Converter overrides: Create transient object from persistent data.
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
| Converter overrides: Resolve the references of the transient object.
virtual StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj)
| Converter overrides: Update transient object from persistent data.
virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
| Converter overrides: Update the references of an updated transient object.
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
| Converter overrides: Convert the transient object to the requested representation.
virtual StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObj)
| Converter overrides: Update persistent object representation.
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
| Converter overrides: Update references of persistent object representation.

## 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 26 of file PoolDbDirectoryCnv.h.

## Constructor & Destructor Documentation

PoolDbDirectoryCnv::PoolDbDirectoryCnv | ( | 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

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

Standard Destructor.

Definition at line 39 of file PoolDbDirectoryCnv.h.

    {  }

## Member Function Documentation

StatusCode PoolDbDirectoryCnv::createObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject *& | refpObj
| ) |  | `[virtual]`

Converter overrides: Create transient object from persistent data.

Create transient object from persistent data.

Parameters:

  pAddr | [IN] Pointer to object address.
  refpObj | [OUT] Location to pointer to store data object

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Reimplemented in PoolDbDatabaseCnv.

Definition at line 52 of file PoolDbDirectoryCnv.cpp.

    {
      refpObject = new NTuple::Directory();
      return StatusCode::SUCCESS;
    }

StatusCode PoolDbDirectoryCnv::createRep | ( | DataObject * | pObj,
|  | IOpaqueAddress *& | refpAddr
| ) |  | `[virtual]`

Converter overrides: Convert the transient object to the requested representation.

Parameters:

  pObj | [IN] Pointer to data object
  refpAddr | [OUT] Location to store pointer to object address.

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 60 of file PoolDbDirectoryCnv.cpp.

    {
      std::string dsc;
      pool::Guid guid(pool::Guid::null());
      guid.Data1 = objType();

      if ( objType() == CLID_StatisticsDirectory )  {
        dsc = "Directory containing statistics results.";
      }
      else if ( objType() == CLID_StatisticsFile )  {
        dsc = "File containing statistics results.";
      }
      else  {
        return StatusCode::FAILURE;
      }
      std::string ident = containerName(pObject->registry());
      std::string path  = fileName(pObject->registry());
      return saveDescription(path, ident, dsc, "", guid, objType(), "UPDATE");
    }

StatusCode PoolDbDirectoryCnv::fillObjRefs | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObj
| ) |  | `[virtual]`

Converter overrides: Resolve the references of the transient object.

Parameters:

  pAddr | [IN] Pointer to object address.
  pObj | [IN] Pointer to data object

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 83 of file PoolDbDirectoryCnv.cpp.

    {
      return updateObjRefs(pAddr, pObj);
    }

StatusCode PoolDbDirectoryCnv::updateObj | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObj
| ) |  | `[virtual]`

Converter overrides: Update transient object from persistent data.

Parameters:

  pAddr | [IN] Pointer to object address.
  pObj | [IN] Pointer to data object

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 184 of file PoolDbDirectoryCnv.cpp.

    {
      return StatusCode::SUCCESS;
    }

StatusCode PoolDbDirectoryCnv::updateObjRefs | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObj
| ) |  | `[virtual]`

Converter overrides: Update the references of an updated transient object.

Parameters:

  pAddr | [IN] Pointer to object address.
  pObj | [IN] Pointer to data object

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 89 of file PoolDbDirectoryCnv.cpp.

    {
      typedef std::vector<PoolDbNTupleDescriptor*> REFS;
      REFS refs;
      StatusCode status = StatusCode(StatusCode::FAILURE,true);
      MsgStream log(msgSvc(), "PoolDbDatabaseCnv");
      if ( pAddr ) {
        IRegistry* pReg = pAddr->registry();
        if ( pReg )  {
          std::string ident   = pReg->identifier();
          std::string fname   = fileName(pReg);
          std::string cntName = containerName(pReg);
          std::auto_ptr<pool::DbSelect> iter(m_dbMgr->createSelect("*", fname, "GaudiStatisticsDescription"));
          if ( iter.get() )  {
            pool::DbObjectCallBack cb(pool::DbReflex::forTypeName("PoolDbNTupleDescriptor"));
            typedef std::vector<IRegistry*> Leaves;
            pool::Token* token = 0;
            Leaves leaves;
            while( iter->next(token).isSuccess() )  {
              m_dbMgr->read(&cb, *token).ignore();
              PoolDbNTupleDescriptor* ref = (PoolDbNTupleDescriptor*)cb.object();
              std::string s = ref->container.substr(0,cntName.length());
              if ( s == cntName )  {
                if ( ref->container.length() > cntName.length()+1 )  {
                  if ( ref->container.find('/',cntName.length()+1) == std::string::npos ) {
                    refs.push_back(ref);
                    token->release();
                    continue;
                  }
                }
              }
              delete ref;
              token->release();
            }
            status = m_dataMgr->objectLeaves(pObject, leaves);
            if ( status.isSuccess() )    {
              for(REFS::iterator i = refs.begin(); i != refs.end(); ++i)  {
                REFS::value_type& ref = *i;
                if ( ref )   {
                  bool need_to_add = true;
                  for(Leaves::iterator j=leaves.begin(); j != leaves.end(); ++j )  {
                    std::string curr_leaf = containerName(*j);
                    if ( curr_leaf == ref->container )  {
                      need_to_add = false;
                      break;
                    }
                  }
                  if ( need_to_add )  {
                    IOpaqueAddress* pA= 0;
                    if ( ref->clid == CLID_StatisticsDirectory ||
                         ref->clid == CLID_StatisticsFile      ||
                         ref->clid == CLID_RowWiseTuple        ||
                         ref->clid == CLID_ColumnWiseTuple      )
                    {
                      std::string spar[]   = { fname, ref->container};
                      unsigned long ipar[] = { pool::INVALID, pool::INVALID};
                      status = m_dbMgr->createAddress(repSvcType(),
                                                      ref->clid,
                                                      spar,
                                                      ipar,
                                                      pA);
                    }
                    if ( status.isSuccess() )  {
                      std::string top = topLevel(pReg);
                      std::string leaf_name = top + ref->container.substr(7);
                      status = m_dataMgr->registerAddress(leaf_name, pA);
                      if ( status.isSuccess() )  {
                        continue;
                      }
                      makeError("Failed to register leaves to directory:"+ident,false).ignore();
                      break;
                    }
                    makeError("Failed to create leave address to directory:"+ident,false).ignore();
                    break;
                  }
                }
                makeError("Failed to add leaves to directory:"+ident,false).ignore();
                break;
              }
            }
          }
          else  {
            return makeError("Failed to access required tuple data description.",false);
          }
        }
      }
      for(REFS::iterator k = refs.begin(); k != refs.end(); ++k)  {
        if ( *k ) delete (*k);
      }
      return status;
    }

StatusCode PoolDbDirectoryCnv::updateRep | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObj
| ) |  | `[virtual]`

Converter overrides: Update persistent object representation.

Parameters:

  pObj | [IN] Pointer to data object
  refpAddr | [OUT] Location to store pointer to object address.

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 192 of file PoolDbDirectoryCnv.cpp.

    {
      return StatusCode::SUCCESS;
    }

StatusCode PoolDbDirectoryCnv::updateRepRefs | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObj
| ) |  | `[virtual]`

Converter overrides: Update references of persistent object representation.

Parameters:

  pObj | [IN] Pointer to data object
  refpAddr | [OUT] Location to store pointer to object address.

Returns:
  Status code indicating success or failure.

Reimplemented from PoolDbBaseCnv.

Definition at line 200 of file PoolDbDirectoryCnv.cpp.

    {
      return StatusCode::SUCCESS;
    }

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

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

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