| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

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

    00039 {  }

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

    00049 {
    00050   refpObject = new NTuple::Directory();
    00051   return StatusCode::SUCCESS;
    00052 }

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 78 of file PoolDbDirectoryCnv.cpp.

    00079 {
    00080   return updateObjRefs(pAddr, pObj);
    00081 }

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 179 of file PoolDbDirectoryCnv.cpp.

    00181 {
    00182   return StatusCode::SUCCESS;
    00183 }

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 84 of file PoolDbDirectoryCnv.cpp.

    00086 {
    00087   typedef std::vector<PoolDbNTupleDescriptor*> REFS;
    00088   REFS refs;
    00089   StatusCode status = StatusCode(StatusCode::FAILURE,true);
    00090   MsgStream log(msgSvc(), "PoolDbDatabaseCnv");
    00091   if ( pAddr ) {
    00092     IRegistry* pReg = pAddr->registry();
    00093     if ( pReg )  {
    00094       std::string ident   = pReg->identifier();
    00095       std::string fname   = fileName(pReg);
    00096       std::string cntName = containerName(pReg);
    00097       std::auto_ptr<pool::DbSelect> iter(m_dbMgr->createSelect("*", fname, "GaudiStatisticsDescription"));
    00098       if ( iter.get() )  {
    00099         pool::DbObjectCallBack cb(pool::DbReflex::forTypeName("PoolDbNTupleDescriptor"));
    00100         typedef std::vector<IRegistry*> Leaves;
    00101         pool::Token* token = 0;
    00102         Leaves leaves;
    00103         while( iter->next(token).isSuccess() )  {
    00104           m_dbMgr->read(&cb, *token).ignore();
    00105           PoolDbNTupleDescriptor* ref = (PoolDbNTupleDescriptor*)cb.object();
    00106           std::string s = ref->container.substr(0,cntName.length());
    00107           if ( s == cntName )  {
    00108             if ( ref->container.length() > cntName.length()+1 )  {
    00109               if ( ref->container.find('/',cntName.length()+1) == std::string::npos ) {
    00110                 refs.push_back(ref);
    00111                 token->release();
    00112                 continue;
    00113               }
    00114             }
    00115           }
    00116           delete ref;
    00117           token->release();
    00118         }
    00119         status = m_dataMgr->objectLeaves(pObject, leaves);
    00120         if ( status.isSuccess() )    {
    00121           for(REFS::iterator i = refs.begin(); i != refs.end(); ++i)  {
    00122             REFS::value_type& ref = *i;
    00123             if ( ref )   {
    00124               bool need_to_add = true;
    00125               for(Leaves::iterator j=leaves.begin(); j != leaves.end(); ++j )  {
    00126                 std::string curr_leaf = containerName(*j);
    00127                 if ( curr_leaf == ref->container )  {
    00128                   need_to_add = false;
    00129                   break;
    00130                 }
    00131               }
    00132               if ( need_to_add )  {
    00133                 IOpaqueAddress* pA= 0;
    00134                 if ( ref->clid == CLID_StatisticsDirectory ||
    00135                      ref->clid == CLID_StatisticsFile      ||
    00136                      ref->clid == CLID_RowWiseTuple        ||
    00137                      ref->clid == CLID_ColumnWiseTuple      )
    00138                 {
    00139                   std::string spar[]   = { fname, ref->container};
    00140                   unsigned long ipar[] = { pool::INVALID, pool::INVALID};
    00141                   status = m_dbMgr->createAddress(repSvcType(),
    00142                                                   ref->clid,
    00143                                                   spar,
    00144                                                   ipar,
    00145                                                   pA);
    00146                 }
    00147                 if ( status.isSuccess() )  {
    00148                   std::string top = topLevel(pReg);
    00149                   std::string leaf_name = top + ref->container.substr(7);
    00150                   status = m_dataMgr->registerAddress(leaf_name, pA);
    00151                   if ( status.isSuccess() )  {
    00152                     continue;
    00153                   }
    00154                   makeError("Failed to register leaves to directory:"+ident,false).ignore();
    00155                   break;
    00156                 }
    00157                 makeError("Failed to create leave address to directory:"+ident,false).ignore();
    00158                 break;
    00159               }
    00160             }
    00161             makeError("Failed to add leaves to directory:"+ident,false).ignore();
    00162             break;
    00163           }
    00164         }
    00165       }
    00166       else  {
    00167         return makeError("Failed to access required tuple data description.",false);
    00168       }
    00169     }
    00170   }
    00171   for(REFS::iterator k = refs.begin(); k != refs.end(); ++k)  {
    00172     if ( *k ) delete (*k);
    00173   }
    00174   return status;
    00175 }

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 55 of file PoolDbDirectoryCnv.cpp.

    00057 {
    00058   std::string dsc;
    00059   pool::Guid guid(pool::Guid::null());
    00060   guid.Data1 = objType();
    00061
    00062   if ( objType() == CLID_StatisticsDirectory )  {
    00063     dsc = "Directory containing statistics results.";
    00064   }
    00065   else if ( objType() == CLID_StatisticsFile )  {
    00066     dsc = "File containing statistics results.";
    00067   }
    00068   else  {
    00069     return StatusCode::FAILURE;
    00070   }
    00071   std::string ident = containerName(pObject->registry());
    00072   std::string path  = fileName(pObject->registry());
    00073   return saveDescription(path, ident, dsc, "", guid, objType(), "UPDATE");
    00074 }

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 187 of file PoolDbDirectoryCnv.cpp.

    00189 {
    00190   return StatusCode::SUCCESS;
    00191 }

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 195 of file PoolDbDirectoryCnv.cpp.

    00197 {
    00198   return StatusCode::SUCCESS;
    00199 }

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

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