| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# PoolDbNTupleCnv Class Reference

NTuple converter class definition. More...

`#include <PoolDb/PoolDbNTupleCnv.h>`

Inheritance diagram for PoolDbNTupleCnv:

[legend]
Collaboration diagram for PoolDbNTupleCnv:

[legend]

List of all members.

## Public Member Functions
| PoolDbNTupleCnv (long typ, const CLID &clid, ISvcLocator *svc)
| Standard constructor.
virtual | ~PoolDbNTupleCnv ()
| Standard destructor.
virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
| Converter overrides: Convert the transient object to the requested representation.
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Resolve the references of the converted object.
virtual StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
| Converter overrides: Update the references of an updated transient object.
virtual StatusCode | fillObjRefs (IOpaqueAddress *, DataObject *)
| Converter overrides: Update the references of an updated transient object.
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
| Update the transient object: NTuples end here when reading records.
virtual StatusCode | updateObjRefs (IOpaqueAddress *, DataObject *)
| Converter overrides: Update the references of an updated transient object.
virtual StatusCode | updateRep (IOpaqueAddress *, DataObject *)
| Converter overrides: Update the converted representation of a transient object.
virtual StatusCode | updateRepRefs (IOpaqueAddress *, DataObject *)
| Converter overrides: Update the converted representation of a transient object.
## Protected Member Functions
StatusCode | bindRead (INTuple *pTuple, PoolDbTupleCallback *call)
| Callback to bind N-tuple data for reading.
StatusCode | readData (INTuple *pTuple, PoolDbTupleCallback *call)
| Callback to extract N-tuple data which needed to be put into BLOBs.
StatusCode | bindWrite (INTuple *pTuple, PoolDbTupleCallback *call)
| Callback to bind N-tuple data for writing.

## Detailed Description

NTuple converter class definition.

Description: Definition of the generic converter for row wise and column wise Ntuples.

Author:
  M.Frank

Version:
  1.0

Definition at line 30 of file PoolDbNTupleCnv.h.

## Constructor & Destructor Documentation

PoolDbNTupleCnv::PoolDbNTupleCnv | ( | long | typ,
|  | const CLID & | clid,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard constructor.

Parameters:

  | clid | [IN] Class ID of the object type to be converted.
  | db | [IN] Pointer to POOL database interface
  | svc | [IN] Pointer to Gaudi service locator

Returns:
  Reference to PoolDbNTupleCnv object

Definition at line 226 of file PoolDbNTupleCnv.cpp.

    00227 : PoolDbStatCnv(typ, clid, svc)
    00228 {
    00229   m_class = 0;
    00230 }

PoolDbNTupleCnv::~PoolDbNTupleCnv | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 232 of file PoolDbNTupleCnv.cpp.

    00232                                    {
    00233 }

## Member Function Documentation

StatusCode PoolDbNTupleCnv::bindRead | ( | INTuple * | pTuple,
|  | PoolDbTupleCallback * | call |
| ) |  |  | `[protected]`

Callback to bind N-tuple data for reading.

Parameters:

  | pTuple | [IN] Pointer to N-tuple structure
  | call | [IN] Pointer to N-tuple callback structure

Returns:
  StatusCode indicating success or failure

Definition at line 667 of file PoolDbNTupleCnv.cpp.

    00669 {
    00670   typedef INTuple::ItemContainer Cont;
    00671   int cnt = 0;
    00672   //pool::DbBlob&                  s       = cb->stream();
    00673   std::vector<void*>&            addr    = cb->addresses();
    00674   std::vector<PoolDbTokenWrap*>& links   = cb->links();
    00675   const std::vector<int>&        mapping = cb->mapping();
    00676   Cont&                          items   = nt->items();
    00677   for (Cont::iterator i = items.begin(); i != items.end(); ++i, ++cnt )   {
    00678     int count = mapping[cnt];
    00679     if ( count >= 0 )  {
    00680       char* buf = (char*)(*i)->buffer();
    00681       switch( (*i)->type() )   {
    00682         case DataTypeInfo::OBJECT_ADDR:
    00683           addr[count] = &links[cnt];
    00684           break;
    00685         default:
    00686           addr[count] = buf;
    00687           break;
    00688       }
    00689     }
    00690   }
    00691   return S_OK;
    00692 }

StatusCode PoolDbNTupleCnv::readData | ( | INTuple * | pTuple,
|  | PoolDbTupleCallback * | call |
| ) |  |  | `[protected]`

Callback to extract N-tuple data which needed to be put into BLOBs.

Parameters:

  | pTuple | [IN] Pointer to N-tuple structure
  | call | [IN] Pointer to N-tuple callback structure

Returns:
  StatusCode indicating success or failure

Definition at line 694 of file PoolDbNTupleCnv.cpp.

    00696 {
    00697   typedef INTuple::ItemContainer Cont;
    00698   int cnt = 0;
    00699   pool::DbBlob&                  s       = cb->stream();
    00700   std::vector<PoolDbTokenWrap*>& links   = cb->links();
    00701   const std::vector<int>&        mapping = cb->mapping();
    00702   INTuple::ItemContainer&        items   = nt->items();
    00703   for (Cont::iterator i = items.begin(); i != items.end(); ++i, ++cnt )   {
    00704     int count = mapping[cnt];
    00705     int typ   = (*i)->type();
    00706     if(count < 0 || typ == DataTypeInfo::OBJECT_ADDR || typ == DataTypeInfo::POINTER)  {
    00707       char* buf = (char*)(*i)->buffer();
    00708       int sc = 11;
    00709       switch( (*i)->type() )   {
    00710       case DataTypeInfo::UCHAR:       sc=load<unsigned char> (s,buf); break;
    00711       case DataTypeInfo::USHORT:      sc=load<unsigned short>(s,buf); break;
    00712       case DataTypeInfo::UINT:        sc=load<unsigned int>  (s,buf); break;
    00713       case DataTypeInfo::ULONG:       sc=load<unsigned long> (s,buf); break;
    00714       case DataTypeInfo::CHAR:        sc=load<char>          (s,buf); break;
    00715       case DataTypeInfo::SHORT:       sc=load<short>         (s,buf); break;
    00716       case DataTypeInfo::INT:         sc=load<int>           (s,buf); break;
    00717       case DataTypeInfo::LONG:        sc=load<long>          (s,buf); break;
    00718       case DataTypeInfo::BOOL:        sc=load<bool>          (s,buf); break;
    00719       case DataTypeInfo::FLOAT:       sc=load<float>         (s,buf); break;
    00720       case DataTypeInfo::DOUBLE:      sc=load<double>        (s,buf); break;
    00721       case DataTypeInfo::STRING:      sc=load<std::string>   (s,buf); break;
    00722       case DataTypeInfo::NTCHAR:      sc=load<char*>         (s,buf); break;
    00723       case DataTypeInfo::OBJECT_ADDR: sc=load(buf,links[count]);      break;
    00724       case DataTypeInfo::POINTER:                                     break;
    00725       case DataTypeInfo::UNKNOWN:                                     break;
    00726       default:                                                        break;
    00727       }
    00728       if ( 0 != sc )  {
    00729         MsgStream log(msgSvc(), "PoolDbNTupleCnv");
    00730         log << MSG::DEBUG;
    00731         switch (sc)  {
    00732           case 10:
    00733             log << "CANNOT Set Ntuple token: dynamic_cast<GenericAddress*> is NULL";
    00734           break;
    00735           case 11:
    00736               log << "CANNOT Set Ntuple token: invalid address buffer";
    00737           break;
    00738         }
    00739         log << endmsg;
    00740       }
    00741     }
    00742   }
    00743   return S_OK;
    00744 }

StatusCode PoolDbNTupleCnv::bindWrite | ( | INTuple * | pTuple,
|  | PoolDbTupleCallback * | call |
| ) |  |  | `[protected]`

Callback to bind N-tuple data for writing.

Parameters:

  | pTuple | [IN] Pointer to N-tuple structure
  | call | [IN] Pointer to N-tuple callback structure

Returns:
  StatusCode indicating success or failure

Definition at line 747 of file PoolDbNTupleCnv.cpp.

    00748 {
    00749   int cnt = 0;
    00750   pool::DbBlob&                  s       = cb->stream();
    00751   std::vector<void*>&            addr    = cb->addresses();
    00752   std::vector<PoolDbTokenWrap*>& links   = cb->links();
    00753   const std::vector<int>&        mapping = cb->mapping();
    00754   const INTuple::ItemContainer&  items   = nt->items();
    00755   INTuple::ItemContainer::const_iterator i;
    00756
    00757   s.setMode(pool::DbBlob::WRITING);
    00758   for(i = items.begin(); i != items.end(); ++i, ++cnt )   {
    00759     char* b     = (char*)(*i)->buffer();
    00760     int   len   = (*i)->filled();
    00761     long  ndim  = (*i)->ndim();
    00762     int   count = mapping[cnt];
    00763     void* ptr = 0;
    00764     switch( (*i)->type() )  {
    00765     case DataTypeInfo::UCHAR:       ptr=save<unsigned char >(s,b,len,ndim>0); break;
    00766     case DataTypeInfo::USHORT:      ptr=save<unsigned short>(s,b,len,ndim>0); break;
    00767     case DataTypeInfo::UINT:        ptr=save<unsigned int  >(s,b,len,ndim>0); break;
    00768     case DataTypeInfo::ULONG:       ptr=save<unsigned long >(s,b,len,ndim>0); break;
    00769     case DataTypeInfo::CHAR:        ptr=save<char          >(s,b,len,ndim>0); break;
    00770     case DataTypeInfo::SHORT:       ptr=save<short         >(s,b,len,ndim>0); break;
    00771     case DataTypeInfo::INT:         ptr=save<int           >(s,b,len,ndim>0); break;
    00772     case DataTypeInfo::LONG:        ptr=save<long          >(s,b,len,ndim>0); break;
    00773     case DataTypeInfo::BOOL:        ptr=save<bool          >(s,b,len,ndim>0); break;
    00774     case DataTypeInfo::FLOAT:       ptr=save<float         >(s,b,len,ndim>0); break;
    00775     case DataTypeInfo::DOUBLE:      ptr=save<double        >(s,b,len,ndim>0); break;
    00776     case DataTypeInfo::STRING:      ptr=save<std::string   >(s,b,len,ndim>0); break;
    00777     case DataTypeInfo::NTCHAR:      ptr=save<char*         >(s,b,len,ndim>0); break;
    00778     case DataTypeInfo::POINTER:     ptr=*(void**)b;                           break;
    00779     case DataTypeInfo::OBJECT_ADDR: ptr=save(b,links[count]);                 break;
    00780     case DataTypeInfo::UNKNOWN:                                               break;
    00781     default:                     /* Do we have to take some action here ? */  break;
    00782     }
    00783     if ( count >= 0 )  {
    00784       addr[count] = ptr;
    00785     }
    00786   }
    00787   return S_OK;
    00788 }

StatusCode PoolDbNTupleCnv::createRep | ( | DataObject * | pObject,
|  | IOpaqueAddress *& | refpAddress |
| ) |  |  | `[virtual]`

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

Convert the transient object to the requested representation.

Parameters:

  | pObject | [IN] Valid pointer to DataObject
  | refpAddress | [OUT] Location to store pointer to the object's opaque address

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 414 of file PoolDbNTupleCnv.cpp.

    00414                                                                     {
    00415   IRegistry* pRegistry = pObj->registry();
    00416   if ( 0 != pRegistry )  {
    00417     pAddr = pRegistry->address();
    00418     PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pAddr);
    00419     if ( 0 == pdbA )  {
    00420       const INTuple* nt  = dynamic_cast<const INTuple*>(pObj);
    00421       std::string    loc = containerName(pObj->registry());
    00422       if ( 0 != nt )  {
    00423         const INTuple::ItemContainer& items = nt->items();
    00424         std::vector<const pool::DbColumn*> cols;
    00425         std::vector<int> item_map(items.size()+1,-1);
    00426         std::ostringstream os;
    00427         int pool_type = 0;
    00428         size_t item_no;
    00429         os << nt->title()<<';'<<pObj->clID()<<';'<<items.size()<< ';';
    00430         for(item_no = 0; item_no < items.size(); ++item_no ) {
    00431           pool::DbColumn* col = 0;
    00432           INTupleItem* it = items[item_no];
    00433           os << '{'
    00434              << it->name()      << ';'
    00435              << it->type()      << ';'
    00436              << it->length()    << ';'
    00437              << it->ndim()      << ';'
    00438              << it->hasIndex()  << ';';
    00439           if ( it->hasIndex() )   {
    00440             os << it->index() << ';';
    00441             INTupleItem* itm = it->indexItem();
    00442             switch( itm->type() )    {
    00443             case DataTypeInfo::UCHAR:
    00444               putRange(os, dynamic_cast<NTuple::_Data<unsigned char>*>(itm));
    00445               break;
    00446             case DataTypeInfo::USHORT:
    00447               putRange(os, dynamic_cast<NTuple::_Data<unsigned short>*>(itm));
    00448               break;
    00449             case DataTypeInfo::UINT:
    00450               putRange(os, dynamic_cast<NTuple::_Data<unsigned int>*>(itm));
    00451               break;
    00452             case DataTypeInfo::ULONG:
    00453               putRange(os, dynamic_cast<NTuple::_Data<unsigned long>*>(itm));
    00454               break;
    00455             case DataTypeInfo::CHAR:
    00456               putRange(os, dynamic_cast<NTuple::_Data<char>*>(itm));
    00457               break;
    00458             case DataTypeInfo::SHORT:
    00459               putRange(os, dynamic_cast<NTuple::_Data<short>*>(itm));
    00460               break;
    00461             case DataTypeInfo::INT:
    00462               putRange(os, dynamic_cast<NTuple::_Data<int>*>(itm));
    00463               break;
    00464             case DataTypeInfo::LONG:
    00465               putRange(os, dynamic_cast<NTuple::_Data<long>*>(itm));
    00466               break;
    00467             default: {
    00468               MsgStream err(msgSvc(), "NTuple:"+pRegistry->name());
    00469               err << MSG::ERROR << "Column " << it->index()
    00470                   << " is not a valid index column!" << endmsg;
    00471               return S_FAIL;
    00472               }
    00473             }
    00474           }
    00475           for ( long k = 0; k < it->ndim(); k++ )  {
    00476             os << it->dim(k) << ';';
    00477           }
    00478           switch(it->type())  {
    00479             case DataTypeInfo::STRING:
    00480               pool_type = pool::DbColumn::STRING;
    00481               os << 0 << ';' << 0 << ';';
    00482               break;
    00483             case DataTypeInfo::NTCHAR:
    00484               pool_type = pool::DbColumn::NTCHAR;
    00485               os << 0 << ';' << 0 << ';';
    00486               break;
    00487             case DataTypeInfo::OBJECT_ADDR:
    00488               if ( it->length() == 1 )  {
    00489                 col = new pool::DbColumn(it->name(),
    00490                                          pool::typeName(typeid(PoolDbTokenWrap)),
    00491                                          pool::DbColumn::POINTER,
    00492                                          0);
    00493                 item_map[item_no] = cols.size();
    00494                 cols.push_back(col);
    00495               }
    00496               os << 0 << ';' << 0 << ';';
    00497               break;
    00498             case DataTypeInfo::POINTER:
    00499               if ( it->length() == 1 )  {
    00500                 ROOT::Reflex::Type typ = ROOT::Reflex::Type::ByName(it->typeName());
    00501                 col = new pool::DbColumn(it->name(),
    00502                                          typ.Name(ROOT::Reflex::SCOPED),
    00503                                          pool::DbColumn::POINTER,
    00504                                          0);
    00505                 item_map[item_no] = cols.size();
    00506                 cols.push_back(col);
    00507                 os << 0 << ';' << 0 << ';';
    00508               }
    00509               break;
    00510             case DataTypeInfo::UCHAR:
    00511               pool_type = pool::DbColumn::UCHAR;
    00512               putRange(os, dynamic_cast<NTuple::_Data<unsigned char>*>(it));
    00513               goto MakeCol;
    00514             case DataTypeInfo::USHORT:
    00515               pool_type = pool::DbColumn::USHORT;
    00516               putRange(os, dynamic_cast<NTuple::_Data<unsigned short>*>(it));
    00517               goto MakeCol;
    00518             case DataTypeInfo::UINT:
    00519               pool_type = pool::DbColumn::UINT;
    00520               putRange(os, dynamic_cast<NTuple::_Data<unsigned int>*>(it));
    00521               goto MakeCol;
    00522             case DataTypeInfo::ULONG:
    00523               pool_type = pool::DbColumn::ULONG;
    00524               putRange(os, dynamic_cast<NTuple::_Data<unsigned long>*>(it));
    00525               goto MakeCol;
    00526             case DataTypeInfo::CHAR:
    00527               pool_type = pool::DbColumn::CHAR;
    00528               putRange(os, dynamic_cast<NTuple::_Data<char>*>(it));
    00529               goto MakeCol;
    00530             case DataTypeInfo::SHORT:
    00531               pool_type = pool::DbColumn::SHORT;
    00532               putRange(os, dynamic_cast<NTuple::_Data<short>*>(it));
    00533               goto MakeCol;
    00534             case DataTypeInfo::INT:
    00535               pool_type = pool::DbColumn::INT;
    00536               putRange(os, dynamic_cast<NTuple::_Data<int>*>(it));
    00537               goto MakeCol;
    00538             case DataTypeInfo::LONG:
    00539               pool_type = pool::DbColumn::LONG;
    00540               putRange(os, dynamic_cast<NTuple::_Data<long>*>(it));
    00541               goto MakeCol;
    00542             case DataTypeInfo::BOOL:
    00543               pool_type = pool::DbColumn::BOOL;
    00544               putRange(os, dynamic_cast<NTuple::_Data<bool>*>(it));
    00545               goto MakeCol;
    00546             case DataTypeInfo::FLOAT:
    00547               pool_type = pool::DbColumn::FLOAT;
    00548               putRange(os, dynamic_cast<NTuple::_Data<float>*>(it));
    00549               goto MakeCol;
    00550             case DataTypeInfo::DOUBLE:
    00551               pool_type = pool::DbColumn::DOUBLE;
    00552               putRange(os, dynamic_cast<NTuple::_Data<double>*>(it));
    00553               goto MakeCol;
    00554   MakeCol:
    00555               if ( it->length() == 1 )  {
    00556                 pool::DbColumn* col = new pool::DbColumn(it->name(),
    00557                                                          pool_type,
    00558                                                          0,
    00559                                                          DataTypeInfo::size(it->type()));
    00560                 item_map[item_no] = cols.size();
    00561                 cols.push_back(col);
    00562               }
    00563               // Everything else CANNOT be identified using SQL
    00564             break;
    00565             case DataTypeInfo::UNKNOWN:
    00566             default:
    00567               std::cout << "Create item[FAIL]]: " << it->name()
    00568                         << " Typ:" << it->type() << std::endl;
    00569               break;
    00570           }
    00571           os << '}';
    00572         }
    00573         item_map[item_no] = cols.size();
    00574         pool::DbColumn* col =
    00575           new pool::DbColumn("BlobData",
    00576                              pool::DbColumn::BLOB,
    00577                              0,
    00578                              DataTypeInfo::size(pool::DbColumn::BLOB));
    00579         cols.push_back(col);
    00580         pool::Guid guid;
    00581         std::string cntName = containerName(pRegistry);
    00582         std::string path    = fileName(pRegistry);
    00583         genMD5(os.str(), &guid);
    00584         const pool::DbTypeInfo* typH = pool::DbTypeInfo::createEx(guid, cols);
    00585         StatusCode sc = saveDescription(path,
    00586                                         cntName,
    00587                                         os.str(),
    00588                                         typH->toString(),
    00589                                         guid,
    00590                                         pObj->clID(),
    00591                                         "UPDATE");
    00592         if ( sc.isSuccess() )  {
    00593           // Check if the database container can be connected
    00594           pool::DbContainer cntH(POOL_StorageType);
    00595           StatusCode sc =
    00596             m_dbMgr->connectContainer(IPoolDbMgr::UNKNOWN,
    00597                                       path,
    00598                                       cntName,
    00599                                       pool::RECREATE|pool::UPDATE,
    00600                                       typH,
    00601                                       cntH);
    00602           if ( sc.isSuccess() )  {
    00603             PoolDbTupleCallback* hdlr = new PoolDbTupleCallback(pObj);
    00604             pool::Token*         tok = new pool::Token(cntH.token());
    00605             PoolDbAddress*       add = new PoolDbAddress(tok);
    00606             hdlr->configure(nt, typH, cntH);
    00607             tok->oid().second = 0;
    00608             tok->release();
    00609             pAddr = add;
    00610             add->setHandler(hdlr);
    00611             return m_dbMgr->commitOutput(path, true);
    00612           }
    00613           return S_FAIL;
    00614         }
    00615         return sc;
    00616       }
    00617     }
    00618     else  {
    00619       return S_OK;
    00620     }
    00621   }
    00622   return S_FAIL;
    00623 }

StatusCode PoolDbNTupleCnv::fillRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Resolve the references of the converted object.

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 627 of file PoolDbNTupleCnv.cpp.

    00628 {
    00629   INTuple* pTuple = dynamic_cast<INTuple*>(pObj);
    00630   if ( pTuple )  {
    00631     IRegistry* pRegistry = pObj->registry();
    00632     if ( 0 != pRegistry )  {
    00633       pAddr = pRegistry->address();
    00634       PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pAddr);
    00635       if ( 0 != pdbA )  {
    00636         PoolDbTupleCallback* cb = dynamic_cast<PoolDbTupleCallback*>(pdbA->handler());
    00637         if ( cb )  {
    00638           const pool::DbTypeInfo* typH = dynamic_cast<const pool::DbTypeInfo*>(cb->shape());
    00639           if ( typH )  {
    00640             if ( bindWrite(pTuple, cb).isSuccess() )  {
    00641               std::string path = fileName(pRegistry);
    00642               std::string cntName = containerName(pRegistry);
    00643               if ( !m_dbMgr->connectOutput(path, "UPDATE").isSuccess() )  {
    00644                 MsgStream log(msgSvc(), "PoolDbNTupleCnv");
    00645                 log << MSG::ERROR << "Error: connectOutput(path, UPDATE)" << endmsg;
    00646                 return S_FAIL;
    00647               }
    00648               if ( m_dbMgr->markWrite(cb->clone(), cntName, &pdbA).isSuccess() ) {
    00649                             if ( m_dbMgr->commitOutput(path, true).isSuccess() )  {
    00650                               typedef INTuple::ItemContainer Cont;
    00651                               Cont& it = pTuple->items();
    00652                               for(Cont::iterator i = it.begin(); i != it.end(); ++i)  {
    00653                                 (*i)->reset();
    00654                               }
    00655                               return S_OK;
    00656                             }
    00657               }
    00658             }
    00659           }
    00660         }
    00661       }
    00662     }
    00663   }
    00664   return S_FAIL;
    00665 }

StatusCode PoolDbNTupleCnv::createObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject *& | refpObject |
| ) |  |  | `[virtual]`

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

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | refpObject | [OUT] Location to store pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 237 of file PoolDbNTupleCnv.cpp.

    00238 {
    00239   StatusCode status = S_FAIL;
    00240   PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pAddress);
    00241   if ( 0 != pdbA )  {
    00242     const pool::Token* tok = pdbA->token();
    00243     if ( tok )  {
    00244       pool::DbContainer cntH(tok->technology());
    00245       status = m_dbMgr->connect(tok->dbID(),tok->contID(),cntH);
    00246       if ( status.isSuccess() ) {
    00247         std::string par_val, par_guid, par_typ;
    00248         std::auto_ptr<pool::DbSelect> iter(m_dbMgr->createSelect("*", tok->dbID(), "GaudiStatisticsDescription"));
    00249         if ( iter.get() )  {
    00250           pool::Token* token;
    00251           ROOT::Reflex::Type typ = pool::DbReflex::forTypeName("PoolDbNTupleDescriptor");
    00252           pool::DbObjectCallBack* call = new pool::DbObjectCallBack(typ);
    00253           while( iter->next(token).isSuccess() )  {
    00254             typedef pool::DbObjectHandle<pool::DbObject> ObjH;
    00255             pool::DbContainer& cH = iter->container();
    00256             if ( ObjH::openEx(cH, *token, call, pool::READ).isSuccess() )  {
    00257               PoolDbNTupleDescriptor* ref = (PoolDbNTupleDescriptor*)call->object();
    00258               if ( ref->container == tok->contID() )  {
    00259                 par_val  = ref->description;
    00260                 par_typ  = ref->optional;
    00261                 par_guid = ref->guid;
    00262                 token->release();
    00263                 call->release();
    00264                 call = 0;
    00265                 delete ref;
    00266                 break;
    00267               }
    00268               delete ref;
    00269             }
    00270             token->release();
    00271           }
    00272           if ( call ) call->release();
    00273         }
    00274         if ( !par_val.empty() && !par_guid.empty() && !par_typ.empty() )
    00275         {
    00276           SmartIF<INTupleSvc> ntupleSvc(dataProvider());
    00277           if ( ntupleSvc.isValid() )  {
    00278             char c;
    00279             CLID clid;
    00280             int siz, typ;
    00281             std::string title;
    00282             NTuple::Tuple* nt = 0;
    00283             std::istringstream is(par_val);
    00284             std::getline(is, title, ';') >> clid >> c >> siz >> c;
    00285             status = ntupleSvc->create(clid, title, nt);
    00286             for ( int j = 0; j < siz && status.isSuccess(); j++ ) {
    00287               is >> c;
    00288               std::getline(is, title, ';') >> typ >> c;
    00289               switch ( typ )    {
    00290               case DataTypeInfo::UCHAR:
    00291                 status = createItem(nt, is, title, (unsigned char)0);
    00292                 break;
    00293               case DataTypeInfo::USHORT:
    00294                 status = createItem(nt, is, title, (unsigned short)0);
    00295                 break;
    00296               case DataTypeInfo::UINT:
    00297                 status = createItem(nt, is, title, (unsigned int)0);
    00298                 break;
    00299               case DataTypeInfo::ULONG:
    00300                 status = createItem(nt, is, title, (unsigned long)0);
    00301                 break;
    00302               case DataTypeInfo::CHAR:
    00303                 status = createItem(nt, is, title, char(0));
    00304                 break;
    00305               case DataTypeInfo::SHORT:
    00306                 status = createItem(nt, is, title, short(0));
    00307                 break;
    00308               case DataTypeInfo::INT:
    00309                 status = createItem(nt, is, title, int(0));
    00310                 break;
    00311               case DataTypeInfo::LONG:
    00312                 status = createItem(nt, is, title, long(0));
    00313                 break;
    00314               case DataTypeInfo::BOOL:
    00315                 status = createItem(nt, is, title, false);
    00316                 break;
    00317               case DataTypeInfo::FLOAT:
    00318                 status = createItem(nt, is, title, float(0.0));
    00319                 break;
    00320               case DataTypeInfo::DOUBLE:
    00321                 status = createItem(nt, is, title, double(0.0));
    00322                 break;
    00323                 /*
    00324               case DataTypeInfo::NTCHAR:
    00325               case DataTypeInfo::LONG_NTCHAR:
    00326                 status =
    00327                 createItem(nt, is, title, (char*)0);
    00328                 break;
    00329               case DataTypeInfo::STRING:
    00330               case DataTypeInfo::LONG_STRING:
    00331                 status =
    00332                 createItem(nt, is, title, std::string(""));
    00333                 break;
    00334                 */
    00335               case DataTypeInfo::OBJECT_ADDR:
    00336                 status = createItem(nt, is, title, (IOpaqueAddress*)0);
    00337                 break;
    00338               case DataTypeInfo::POINTER:
    00339                 status = createItem(nt, is, title, (void*)0);
    00340                 break;
    00341               case DataTypeInfo::UNKNOWN:
    00342               default:
    00343                 status = S_FAIL;
    00344                 break;
    00345               }
    00346               if ( !status.isSuccess() )  {
    00347                 MsgStream err(msgSvc(),"NTupleCnv");
    00348                 err << MSG::FATAL
    00349                     << "Error connecting (Unknown) column:" << j << endmsg
    00350                     << par_val << endmsg;
    00351                 return makeError("createObj[NTuple]> Cannot determine column!");
    00352               }
    00353             }
    00354             if ( status.isSuccess() )  {
    00355               PoolDbTupleCallback* hdlr = new PoolDbTupleCallback(nt);
    00356               const pool::DbTypeInfo* typ = pool::DbTypeInfo::fromString(par_typ);
    00357               hdlr->configure(nt, typ, cntH);
    00358               pdbA->setHandler(hdlr);
    00359               refpObject  = nt;
    00360             }
    00361             else {
    00362               refpObject = 0;
    00363               if ( nt ) nt->release();
    00364             }
    00365           }
    00366         }
    00367       }
    00368     }
    00369   }
    00370   return status;
    00371 }

virtual StatusCode PoolDbNTupleCnv::fillObjRefs | ( | IOpaqueAddress * | ,
|  | DataObject * |  |
| ) |  |  | `[inline, virtual]`

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

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 117 of file PoolDbNTupleCnv.h.

    00119   {  return StatusCode::SUCCESS;                                      }

StatusCode PoolDbNTupleCnv::updateObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Update the transient object: NTuples end here when reading records.

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 375 of file PoolDbNTupleCnv.cpp.

    00375                                                                    {
    00376   INTuple*       tupl = dynamic_cast<INTuple*>(pObj);
    00377   PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pAddr);
    00378   if ( 0 != tupl && 0 != pdbA )  {
    00379     PoolDbTupleCallback* hdlr = dynamic_cast<PoolDbTupleCallback*>(pdbA->handler());
    00380     pool::DbSelect* it = hdlr->iterator();
    00381     if ( 0 == it )  {
    00382       it = hdlr->select(tupl->selector());
    00383     }
    00384     if ( it )  {
    00385       pool::Token* t = 0;
    00386       if ( hdlr->iterator()->next(t).isSuccess() )  {
    00387         std::auto_ptr<pool::Token> next(t);
    00388         // Now reload!
    00389         if ( bindRead(tupl, hdlr).isSuccess() )  {
    00390           // No support for SmartRefs<T> for N-tuples
    00391           //pushCurrentDataObject((DataObject**)&pObj);
    00392           if ( m_dbMgr->read(hdlr, *next.get()).isSuccess() )  {
    00393             if ( readData(tupl, hdlr).isSuccess() )  {
    00394               //popCurrentDataObject();
    00395               return S_OK;
    00396             }
    00397             //popCurrentDataObject();
    00398             return makeError("updateObj> Cannot interprete data.");
    00399           }
    00400           //popCurrentDataObject();
    00401           return makeError("updateObj> Cannot read data.");
    00402         }
    00403         return makeError("updateObj> Cannot bind data.");
    00404       }
    00405       return S_FAIL;
    00406     }
    00407     return makeError("updateObj> Token selection failed!");
    00408   }
    00409   return makeError("updateObj> Invalid Tuple reference.");
    00410 }

virtual StatusCode PoolDbNTupleCnv::updateObjRefs | ( | IOpaqueAddress * | ,
|  | DataObject * |  |
| ) |  |  | `[inline, virtual]`

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

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 139 of file PoolDbNTupleCnv.h.

    00141   {  return StatusCode::SUCCESS;                                      }

virtual StatusCode PoolDbNTupleCnv::updateRep | ( | IOpaqueAddress * | ,
|  | DataObject * |  |
| ) |  |  | `[inline, virtual]`

Converter overrides: Update the converted representation of a transient object.

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 151 of file PoolDbNTupleCnv.h.

    00153   {  return StatusCode::SUCCESS;                                      }

virtual StatusCode PoolDbNTupleCnv::updateRepRefs | ( | IOpaqueAddress * | ,
|  | DataObject * |  |
| ) |  |  | `[inline, virtual]`

Converter overrides: Update the converted representation of a transient object.

Parameters:

  | pAddress | [IN] Valid pointer to the object's opaque address
  | pObject | [IN] Valid pointer to DataObject

Returns:
  Status code indicating success or failure

Reimplemented from PoolDbBaseCnv.

Definition at line 163 of file PoolDbNTupleCnv.h.

    00165   {  return StatusCode::SUCCESS;                                      }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiPoolDb/GaudiPoolDb/PoolDbNTupleCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiPoolDb/src/PoolDbNTupleCnv.cpp