| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 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 52 of file PoolDbDirectoryCnv.cpp.

    00054 {
    00055   refpObject = new NTuple::Directory();
    00056   return StatusCode::SUCCESS;
    00057 }

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.

    00084 {
    00085   return updateObjRefs(pAddr, pObj);
    00086 }

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.

    00186 {
    00187   return StatusCode::SUCCESS;
    00188 }

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.

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

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.

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

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.

    00194 {
    00195   return StatusCode::SUCCESS;
    00196 }

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.

    00202 {
    00203   return StatusCode::SUCCESS;
    00204 }

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

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