Gaudi Framework, version v20r2

Generated: 18 Jul 2008

PoolDbNTupleCnv.cpp File Reference

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

#define S_FAIL   StatusCode::FAILURE

Definition at line 38 of file PoolDbNTupleCnv.cpp.

#define S_OK   StatusCode::SUCCESS

Definition at line 37 of file PoolDbNTupleCnv.cpp.


Function Documentation

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

Definition at line 158 of file PoolDbNTupleCnv.cpp.

References INTuple::add(), c, NTuple::_Matrix< TYP >::create(), NTuple::_Array< TYP >::create(), std::getline(), name, and S_FAIL.

Referenced by CollectionCloneAlg::book(), and PoolDbNTupleCnv::createObj().

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

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

Definition at line 103 of file PoolDbNTupleCnv.cpp.

References pool::Token::classID(), pool::Token::contID(), pool::Token::dbID(), GenericAddress::ipar(), pool::Token::oid(), GenericAddress::par(), GenericAddress::setClID(), GenericAddress::setSvcType(), pool::Token::technology(), and PoolDbTokenWrap::token.

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

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

Definition at line 88 of file PoolDbNTupleCnv.cpp.

References Gaudi::Units::s.

Referenced by PoolDbNTupleCnv::readData().

00088                                                                       {
00089   int len;
00090   s >> len;
00091   s.swapFromBuffer(buff, len*sizeof(T));
00092   return 0;
00093 }

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

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

Definition at line 134 of file PoolDbNTupleCnv.cpp.

Referenced by operator>>().

00134                                                       {
00135   long i;
00136   is >> i;
00137   return is;
00138 }

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

Definition at line 152 of file PoolDbNTupleCnv.cpp.

References loadLong().

00153 {
00154   return loadLong(is);
00155 }

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

Definition at line 148 of file PoolDbNTupleCnv.cpp.

References loadLong().

00148                                                         {
00149   return loadLong(is);
00150 }

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

Definition at line 144 of file PoolDbNTupleCnv.cpp.

References loadLong().

00144                                                                   {
00145   return loadLong(is);
00146 }

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

Definition at line 140 of file PoolDbNTupleCnv.cpp.

References loadLong().

00140                                                              {
00141   return loadLong(is);
00142 }

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 63 of file PoolDbIOHandler.cpp.

References c, currentObject(), last_link_hint, last_link_object, s_currObj, and s_objPtr.

00063                             {
00064   static std::vector<DataObject**>& c = currentObject();
00065   last_link_object = 0;
00066   last_link_hint   = -1;
00067   switch(c.size())  {
00068     case 0:
00069       s_currObj = c.back();
00070       c.pop_back();
00071       break;
00072     default:
00073       s_currObj = &s_objPtr;
00074       break;
00075   }
00076 }

void pushCurrentDataObject ( DataObject **  pobjAddr  ) 

Definition at line 55 of file PoolDbIOHandler.cpp.

References c, currentObject(), last_link_hint, last_link_object, s_currObj, and s_objPtr.

00055                                                   {
00056   static std::vector<DataObject**>& c = currentObject();
00057   c.push_back(pobjAddr);
00058   s_currObj = pobjAddr ? pobjAddr : &s_objPtr;
00059   last_link_object = 0;
00060   last_link_hint   = -1;
00061 }

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

Definition at line 214 of file PoolDbNTupleCnv.cpp.

References NTuple::Range< TYP >::lower(), NTuple::_Data< TYP >::range(), and NTuple::Range< TYP >::upper().

Referenced by PoolDbNTupleCnv::createRep().

00215 { 
00216   const NTuple::Range<T>& x = it->range();
00217   os << x.lower() << ';' << x.upper() << ';';
00218 }

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

Definition at line 66 of file PoolDbNTupleCnv.cpp.

References IOpaqueAddress::clID(), pool::Guid::Data1, pool::INVALID, IOpaqueAddress::ipar(), pool::Guid::null(), pool::Token::oid(), IOpaqueAddress::par(), pool::Token::setClassID(), pool::Token::setDb(), pool::Token::setTechnology(), IOpaqueAddress::svcType(), and PoolDbTokenWrap::token.

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

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

Definition at line 52 of file PoolDbNTupleCnv.cpp.

References Gaudi::Units::s.

Referenced by PoolDbNTupleCnv::bindWrite().

00052                                                                        {
00053   const T* buff = (const T*)buffer;
00054   if ( len > 1 )  {
00055     s << len;
00056     s.swapToBuffer(buff, len*sizeof(T));
00057     return 0;
00058   }
00059   else if ( save_len )  {
00060     s << len;
00061     return 0;
00062   }
00063   return (void*)buff;
00064 }


Generated at Fri Jul 18 12:04:47 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004