Gaudi Framework, version v21r7p1

Home   Generated: 15 Feb 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 *(long, CLID, ISvcLocator *))
static std::istreamloadLong (std::istream &is)
static std::istreamoperator>> (std::istream &is, SmartRef< DataObject > &)
static std::istreamoperator>> (std::istream &is, SmartRef< ContainedObject > &)
static std::istreamoperator>> (std::istream &is, IOpaqueAddress *&)
static std::istreamoperator>> (std::istream &is, std::string &)
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)


Define Documentation

#define ALLOW_ALL_TYPES

Definition at line 13 of file PoolDbNTupleCnv.cpp.

#define S_FAIL   StatusCode::FAILURE

Definition at line 41 of file PoolDbNTupleCnv.cpp.

#define S_OK   StatusCode::SUCCESS

Definition at line 40 of file PoolDbNTupleCnv.cpp.


Function Documentation

template<class TYP>
static StatusCode createItem ( INTuple tuple,
std::istream is,
const std::string name,
const TYP &  null 
) [inline, static]

Definition at line 163 of file PoolDbNTupleCnv.cpp.

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

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

Definition at line 108 of file PoolDbNTupleCnv.cpp.

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

template<class T>
static int load ( pool::DbBlob s,
void *  buff 
) [inline, static]

Definition at line 93 of file PoolDbNTupleCnv.cpp.

00093                                                                       {
00094   int len;
00095   s >> len;
00096   s.swapFromBuffer(buff, len*sizeof(T));
00097   return 0;
00098 }

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

static std::istream& loadLong ( std::istream is  )  [inline, static]

Definition at line 139 of file PoolDbNTupleCnv.cpp.

00139                                                       {
00140   long i;
00141   is >> i;
00142   return is;
00143 }

static std::istream& operator>> ( std::istream is,
std::string  
) [inline, static]

Definition at line 157 of file PoolDbNTupleCnv.cpp.

00158 {
00159   return loadLong(is);
00160 }

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

Definition at line 153 of file PoolDbNTupleCnv.cpp.

00153                                                         {
00154   return loadLong(is);
00155 }

static std::istream& operator>> ( std::istream is,
SmartRef< ContainedObject > &   
) [inline, static]

Definition at line 149 of file PoolDbNTupleCnv.cpp.

00149                                                                   {
00150   return loadLong(is);
00151 }

static std::istream& operator>> ( std::istream is,
SmartRef< DataObject > &   
) [inline, static]

Definition at line 145 of file PoolDbNTupleCnv.cpp.

00145                                                              {
00146   return loadLong(is);
00147 }

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

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

void popCurrentDataObject (  ) 

Definition at line 60 of file PoolDbIOHandler.cpp.

00060                             {
00061   Gaudi::popCurrentDataObject();
00062   resetLastLink();
00063 }

void pushCurrentDataObject ( DataObject **  pobjAddr  ) 

Definition at line 55 of file PoolDbIOHandler.cpp.

00055                                                   {
00056   Gaudi::pushCurrentDataObject(pobjAddr);
00057   resetLastLink();
00058 }

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

Definition at line 219 of file PoolDbNTupleCnv.cpp.

00220 {
00221   const NTuple::Range<T>& x = it->range();
00222   os << x.lower() << ';' << x.upper() << ';';
00223 }

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

Definition at line 71 of file PoolDbNTupleCnv.cpp.

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

template<class T>
static void* save ( pool::DbBlob s,
const void *  buffer,
int  len,
bool  save_len 
) [inline, static]

Definition at line 57 of file PoolDbNTupleCnv.cpp.

00057                                                                        {
00058   const T* buff = (const T*)buffer;
00059   if ( len > 1 )  {
00060     s << len;
00061     s.swapToBuffer(buff, len*sizeof(T));
00062     return 0;
00063   }
00064   else if ( save_len )  {
00065     s << len;
00066     return 0;
00067   }
00068   return (void*)buff;
00069 }


Generated at Mon Feb 15 17:33:41 2010 for Gaudi Framework, version v21r7p1 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004