| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 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 215 of file PoolDbNTupleCnv.cpp.

    00216 : PoolDbStatCnv(typ, clid, svc)
    00217 {
    00218   m_class = 0;
    00219 }

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

Standard destructor.

Definition at line 221 of file PoolDbNTupleCnv.cpp.

    00221                                    {
    00222 }

## 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 654 of file PoolDbNTupleCnv.cpp.

    00656 {
    00657   typedef INTuple::ItemContainer Cont;
    00658   int cnt = 0;
    00659   //pool::DbBlob&                  s       = cb->stream();
    00660   std::vector<void*>&            addr    = cb->addresses();
    00661   std::vector<PoolDbTokenWrap*>& links   = cb->links();
    00662   const std::vector<int>&        mapping = cb->mapping();
    00663   Cont&                          items   = nt->items();
    00664   for (Cont::iterator i = items.begin(); i != items.end(); ++i, ++cnt )   {
    00665     int count = mapping[cnt];
    00666     if ( count >= 0 )  {
    00667       char* buf = (char*)(*i)->buffer();
    00668       switch( (*i)->type() )   {
    00669         case DataTypeInfo::OBJECT_ADDR:
    00670           addr[count] = &links[cnt];
    00671           break;
    00672         default:
    00673           addr[count] = buf;
    00674           break;
    00675       }
    00676     }
    00677   }
    00678   return S_OK;
    00679 }

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 681 of file PoolDbNTupleCnv.cpp.

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

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 734 of file PoolDbNTupleCnv.cpp.

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

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 403 of file PoolDbNTupleCnv.cpp.

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

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 614 of file PoolDbNTupleCnv.cpp.

    00615 {
    00616   INTuple* pTuple = dynamic_cast<INTuple*>(pObj);
    00617   if ( pTuple )  {
    00618     IRegistry* pRegistry = pObj->registry();
    00619     if ( 0 != pRegistry )  {
    00620       pAddr = pRegistry->address();
    00621       PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pAddr);
    00622       if ( 0 != pdbA )  {
    00623         PoolDbTupleCallback* cb = dynamic_cast<PoolDbTupleCallback*>(pdbA->handler());
    00624         if ( cb )  {
    00625           const pool::DbTypeInfo* typH = dynamic_cast<const pool::DbTypeInfo*>(cb->shape());
    00626           if ( typH )  {
    00627             if ( bindWrite(pTuple, cb).isSuccess() )  {
    00628               std::string path = fileName(pRegistry);
    00629               std::string cntName = containerName(pRegistry);
    00630               if ( !m_dbMgr->connectOutput(path, "UPDATE").isSuccess() )  {
    00631                 MsgStream log(msgSvc(), "PoolDbNTupleCnv");
    00632                 log << MSG::ERROR << "Error: connectOutput(path, UPDATE)" << endmsg;
    00633                 return S_FAIL;
    00634               }
    00635               if ( m_dbMgr->markWrite(cb->clone(), cntName, &pdbA).isSuccess() ) {
    00636                             if ( m_dbMgr->commitOutput(path, true).isSuccess() )  {
    00637                               typedef INTuple::ItemContainer Cont;
    00638                               Cont& it = pTuple->items();
    00639                               for(Cont::iterator i = it.begin(); i != it.end(); ++i)  {
    00640                                 (*i)->reset();
    00641                               }
    00642                               return S_OK;
    00643                             }
    00644               }
    00645             }
    00646           }
    00647         }
    00648       }
    00649     }
    00650   }
    00651   return S_FAIL;
    00652 }

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 226 of file PoolDbNTupleCnv.cpp.

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

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 364 of file PoolDbNTupleCnv.cpp.

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

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_v21r11/GaudiPoolDb/GaudiPoolDb/PoolDbNTupleCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r11/GaudiPoolDb/src/PoolDbNTupleCnv.cpp