| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# PoolDbNTupleCnv.cpp File Reference

`#include <algorithm>`
`#include "GaudiPoolDb/IPoolDbMgr.h"`
`#include "GaudiPoolDb/PoolDbAddress.h"`
`#include "GaudiPoolDb/PoolDbNTupleCnv.h"`
`#include "GaudiPoolDb/PoolDbLinkManager.h"`
`#include "GaudiPoolDb/PoolDbNTupleDescriptor.h"`
`#include "GaudiPoolDb/PoolDbTupleCallback.h"`
`#include "GaudiKernel/xtoa.h"`
`#include "GaudiKernel/NTuple.h"`
`#include "GaudiKernel/SmartIF.h"`
`#include "GaudiKernel/SmartRef.h"`
`#include "GaudiKernel/MsgStream.h"`
`#include "GaudiKernel/INTupleSvc.h"`
`#include "GaudiKernel/IRegistry.h"`
`#include "GaudiKernel/ISelectStatement.h"`
`#include "GaudiKernel/ContainedObject.h"`
`#include "GaudiKernel/GenericAddress.h"`
`#include "GaudiKernel/CnvFactory.h"`
`#include "StorageSvc/DbSelect.h"`
`#include "StorageSvc/DbReflex.h"`
`#include "StorageSvc/DbColumn.h"`
`#include "StorageSvc/DbTypeInfo.h"`
`#include "StorageSvc/DbObjectCallBack.h"`
`#include "Reflex/Builder/ReflexBuilder.h"`
`#include <memory>`

Include dependency graph for PoolDbNTupleCnv.cpp:

Go to the source code of this file.

## Namespaces
namespace | pool
## Defines
#define | ALLOW_ALL_TYPES
#define | S_OK StatusCode::SUCCESS
#define | S_FAIL StatusCode::FAILURE
## Functions
const std::string | pool::typeName (const std::type_info &typ)
void | popCurrentDataObject ()
void | pushCurrentDataObject (DataObject **pobjAddr)
void | pool::genMD5 (const std::string &s, void *code)
template<class T>
static void * | save (pool::DbBlob &s, const void *buffer, int len, bool save_len)
static void * | save (const void *b, PoolDbTokenWrap *lnk)
template<class T>
static int | load (pool::DbBlob &s, void *buff)
template<>
int | load< std::string > (pool::DbBlob &s, void *ptr)
static int | load (void *ptr, PoolDbTokenWrap *lnk)
| PLUGINSVC_FACTORY_WITH_ID (PoolDbNTupleCnv, ConverterID(POOL_StorageType, CLID_RowWiseTuple), IConverter *(long, CLID, ISvcLocator *)) PLUGINSVC_FACTORY_WITH_ID(PoolDbNTupleCnv
| ConverterID (POOL_StorageType, CLID_ColumnWiseTuple)
IConverter ISvcLocator *static std::istream & | operator>> (std::istream &is, IOpaqueAddress *&)
template<class TYP>
static StatusCode | createItem (INTuple *tuple, std::istream &is, const std::string &name, const TYP &null)
template<class T>
static void | putRange (std::ostream &os, NTuple::_Data< T > *it)
## Variables
IConverter * | long
IConverter | CLID

## Define Documentation

#define ALLOW_ALL_TYPES

Definition at line 18 of file PoolDbNTupleCnv.cpp.

#define S_FAIL StatusCode::FAILURE

Definition at line 46 of file PoolDbNTupleCnv.cpp.

#define S_OK StatusCode::SUCCESS

Definition at line 45 of file PoolDbNTupleCnv.cpp.

## Function Documentation

ConverterID | ( | POOL_StorageType | ,
|  | CLID_ColumnWiseTuple |  |
| ) |  |  |

template<class TYP>

static StatusCode createItem | ( | INTuple * | tuple,
|  | std::istream & | is,
|  | const std::string & | name,
|  | const TYP & | null |
| ) |  |  | `[inline, static]`

Definition at line 152 of file PoolDbNTupleCnv.cpp.

    00155 {
    00156   std::string idxName;
    00157   long len, ndim, dim[4], hasIdx, idxLow, idxLen;
    00158   long dim1 = 1, dim2 = 1;
    00159   INTupleItem* it = 0;
    00160   char c;
    00161   is >> len    >> c
    00162      >> ndim   >> c
    00163      >> hasIdx >> c;
    00164   if ( hasIdx )  {
    00165     std::getline(is, idxName, ';') >> idxLow >> c >> idxLen >> c;
    00166   }
    00167   for ( int i = 0; i < ndim; i++ )
    00168     is >> dim[i] >> c;
    00169
    00170   TYP low = null, high = null;
    00171   is >> low >> c >> high >> c;
    00172   is >> c;
    00173   switch( ndim )  {
    00174   case 0:
    00175     it = NTuple::_Item<TYP>::create (tuple, name, typeid(TYP), low, high, null);
    00176     break;
    00177   case 1:
    00178     dim1 = (hasIdx) ? idxLen : dim[0];
    00179     it = NTuple::_Array<TYP>::create (tuple,
    00180                                       name,
    00181                                       typeid(TYP),
    00182                                       idxName,
    00183                                       dim1,
    00184                                       low,
    00185                                       high,
    00186                                       null);
    00187     break;
    00188   case 2:
    00189     dim1 = (hasIdx) ? idxLen : dim[0];
    00190     dim2 = (hasIdx) ? dim[0] : dim[1];
    00191     it = NTuple::_Matrix<TYP>::create ( tuple,
    00192                                         name,
    00193                                         typeid(TYP),
    00194                                         idxName,
    00195                                         dim1,
    00196                                         dim2,
    00197                                         low,
    00198                                         high,
    00199                                         null);
    00200     break;
    00201   default:
    00202     return S_FAIL;
    00203   }
    00204   return tuple->add(it);
    00205 }

static int load | ( | void * | ptr,
|  | PoolDbTokenWrap * | lnk |
| ) |  |  | `[inline, static]`

Definition at line 113 of file PoolDbNTupleCnv.cpp.

    00113                                                          {
    00114   IOpaqueAddress* pA = *(IOpaqueAddress**)ptr;
    00115   GenericAddress* pAddr = (GenericAddress*)(pA);
    00116   if ( 0 != pAddr )  {
    00117     pool::Token&    tok = lnk->token;
    00118     std::string*   spar = (std::string*)pAddr->par();
    00119     unsigned long* ipar = (unsigned long*)pAddr->ipar();
    00120     pAddr->setClID(tok.classID().Data1);
    00121     pAddr->setSvcType(tok.technology());
    00122     ipar[0] = tok.oid().first;
    00123     ipar[1] = tok.oid().second;
    00124     spar[0] = tok.dbID();
    00125     spar[1] = tok.contID();
    00126     return 0;
    00127   }
    00128   else if ( pA ) {
    00129     return 10;
    00130         }
    00131   return 11;
    00132 }

template<class T>

static int load | ( | pool::DbBlob & | s,
|  | void * | buff |
| ) |  |  | `[inline, static]`

Definition at line 98 of file PoolDbNTupleCnv.cpp.

    00098                                                                       {
    00099   int len;
    00100   s >> len;
    00101   s.swapFromBuffer(buff, len*sizeof(T));
    00102   return 0;
    00103 }

template<>

int load< std::string > | ( | pool::DbBlob & | s,
|  | void * | ptr |
| ) |  |  | `[inline]`

IConverter ISvcLocator* static std::istream& operator>> | ( | std::istream & | is,
|  | IOpaqueAddress *& |  |
| ) |  |  | `[inline, static]`

Type Constraints

Definition at line 145 of file PoolDbNTupleCnv.cpp.

    00145                                                         {
    00146   long i;
    00147   is >> i;
    00148   return is;
    00149 }

PLUGINSVC_FACTORY_WITH_ID | ( | PoolDbNTupleCnv | ,
|  | ConverterID(POOL_StorageType, CLID_RowWiseTuple) | ,
|  | IConverter * | long, CLID, ISvcLocator * |
| ) |  |  |

void popCurrentDataObject | ( |  | ) |

Definition at line 66 of file PoolDbIOHandler.cpp.

    00066                             {
    00067   Gaudi::popCurrentDataObject();
    00068   resetLastLink();
    00069 }

void pushCurrentDataObject | ( | DataObject ** | pobjAddr | ) |

Definition at line 61 of file PoolDbIOHandler.cpp.

    00061                                                   {
    00062   Gaudi::pushCurrentDataObject(pobjAddr);
    00063   resetLastLink();
    00064 }

template<class T>

static void putRange | ( | std::ostream & | os,
|  | NTuple::_Data< T > * | it |
| ) |  |  | `[inline, static]`

Definition at line 208 of file PoolDbNTupleCnv.cpp.

    00209 {
    00210   const NTuple::Range<T>& x = it->range();
    00211   os << x.lower() << ';' << x.upper() << ';';
    00212 }

static void* save | ( | const void * | b,
|  | PoolDbTokenWrap * | lnk |
| ) |  |  | `[static]`

Definition at line 76 of file PoolDbNTupleCnv.cpp.

    00076                                                         {
    00077   IOpaqueAddress* pA = (*(IOpaqueAddress**)b);
    00078   pool::Token& tok   = lnk->token;
    00079   pool::Guid guid(pool::Guid::null());
    00080   if ( pA )  {
    00081     const std::string*   spar = pA->par();
    00082     const unsigned long* ipar = pA->ipar();
    00083     guid.Data1 = pA->clID();
    00084     tok.setTechnology(pA->svcType());
    00085     tok.setDb(spar[0]).setCont(spar[1]);
    00086     tok.oid().first  = ipar[0];
    00087     tok.oid().second = ipar[1];
    00088   }
    00089   else {
    00090     tok.setTechnology(0).setDb("").setCont("");
    00091     tok.oid().first = tok.oid().second = pool::INVALID;
    00092   }
    00093   tok.setClassID(guid);
    00094   return lnk;
    00095 }

template<class T>

static void* save | ( | pool::DbBlob & | s,
|  | const void * | buffer,
|  | int | len,
|  | bool | save_len |
| ) |  |  | `[inline, static]`

Definition at line 62 of file PoolDbNTupleCnv.cpp.

    00062                                                                        {
    00063   const T* buff = (const T*)buffer;
    00064   if ( len > 1 )  {
    00065     s << len;
    00066     s.swapToBuffer(buff, len*sizeof(T));
    00067     return 0;
    00068   }
    00069   else if ( save_len )  {
    00070     s << len;
    00071     return 0;
    00072   }
    00073   return (void*)buff;
    00074 }

## Variable Documentation

IConverter CLID

Definition at line 142 of file PoolDbNTupleCnv.cpp.

IConverter* long

Definition at line 142 of file PoolDbNTupleCnv.cpp.