Gaudi Framework, version v20r2

Generated: 18 Jul 2008

PoolDbIOHandler.cpp File Reference

#include "GaudiPoolDb/PoolDbIOHandler.h"
#include "GaudiKernel/ObjectContainerBase.h"
#include "GaudiKernel/ContainedObject.h"
#include "GaudiKernel/LinkManager.h"
#include "GaudiKernel/IRegistry.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/SmartRef.h"
#include <stdexcept>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TClass.h"
#include "TStreamerInfo.h"
#include "Cintex/Cintex.h"
#include "POOLCore/Token.h"
#include "POOLCore/Reference.h"
#include "StorageSvc/DbReflex.h"
#include "StorageSvc/DataCallBack.h"
#include "StorageSvc/DbDataHandlerGuard.h"

Include dependency graph for PoolDbIOHandler.cpp:

Go to the source code of this file.

Namespaces

namespace  ROOT
namespace  ROOT::Cintex
namespace  pool
namespace  GaudiPoolDb

Functions

bool ROOT::Cintex::IsTypeOf (Type &typ, const std::string &base_name)
const std::string pool::typeName (const std::type_info &typ)
static std::vector< DataObject ** > & currentObject ()
void pushCurrentDataObject (DataObject **pobjAddr)
void popCurrentDataObject ()
static void getOID_40000 (TBuffer &b, TClass *cl, Token::OID_t &oid)
template<class T>
static bool makeStreamer (MsgStream &log)
bool GaudiPoolDb::patchStreamers (MsgStream &log)

Variables

static DataObjects_objPtr = 0
static DataObject ** s_currObj = &s_objPtr
static const DataObjectlast_link_object = 0
static int last_link_hint = -1


Function Documentation

static std::vector<DataObject**>& currentObject (  )  [static]

Definition at line 47 of file PoolDbIOHandler.cpp.

References std::auto_ptr< _Tp >::get().

Referenced by popCurrentDataObject(), and pushCurrentDataObject().

00047                                                 {
00048   static std::auto_ptr<std::vector<DataObject**> > s_current;
00049   if ( 0 == s_current.get() )  {
00050     s_current = std::auto_ptr<std::vector<DataObject**> >(new std::vector<DataObject**>());
00051   }
00052   return *(s_current.get());
00053 }

static void getOID_40000 ( TBuffer &  b,
TClass *  cl,
Token::OID_t oid 
) [static]

Definition at line 208 of file PoolDbIOHandler.cpp.

References count(), std::pair< _T1, _T2 >::first, and std::pair< _T1, _T2 >::second.

Referenced by PoolDbIOHandler< T >::get().

00208                                                                   {
00209   unsigned long loid[2];
00210   UInt_t start, count, tmp;
00211   // read the class version from the buffer
00212   /* Version_t vsn = */ b.ReadVersion(&start, &count, 0);
00213   switch(count) {
00214   case 22:              // These tokens were written as pair<long,long>
00215     b >> tmp;           //
00216     b.ReadFastArray(loid,2); // There was a bug in POOL....
00217     oid.first = loid[0];
00218     oid.second = loid[1];
00219     break;              // see TBuffer::ReadFastArray(ulong*, int)
00220   case 14:              // Normal case: version:checksum+8 Bytes
00221     b >> tmp;           //
00222   case 10:              // Normal case: version:checksum+8 Bytes
00223   case 8:               // Without checksum and version
00224   default:              // No better idea
00225     b.ReadFastArray(&oid.first, 2);
00226     break;
00227   }
00228   // Check that the buffer position correesponds to the byte count
00229   b.CheckByteCount(start, count, cl);
00230 }

template<class T>
static bool makeStreamer ( MsgStream log  )  [static]

Definition at line 287 of file PoolDbIOHandler.cpp.

References c, std::basic_string< _CharT, _Traits, _Alloc >::c_str(), MSG::DEBUG, endmsg(), MSG::ERROR, Gaudi::Units::s, and GaudiDict::typeName().

00287                                                              {
00288   std::string cl_name = typeName(typeid(T));
00289   ROOT::Reflex::Type t = ROOT::Reflex::Type::ByName(cl_name);
00290   if ( t )  {
00291     TClass* c = gROOT->GetClass(cl_name.c_str());
00292     if ( c ) {
00293       TClassStreamer* s = new PoolDbIOHandler<T>(t,c);
00294       c->AdoptStreamer(s);
00295       log << MSG::DEBUG << "Installed IOHandler for class " << cl_name << endmsg;
00296       return true;
00297     }
00298     else if ( !c )  {
00299       log << MSG::ERROR << "[No ROOT TClass] Failed to install IOHandler for class " << cl_name << endmsg;
00300     }
00301   }
00302   else  {
00303     log << MSG::ERROR << "[No Reflection Type] Failed to install IOHandler for class " << cl_name << endmsg;
00304   }
00305   return false;
00306 }

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 }


Variable Documentation

int last_link_hint = -1 [static]

Definition at line 45 of file PoolDbIOHandler.cpp.

Referenced by popCurrentDataObject(), pushCurrentDataObject(), and PoolDbIOHandler< T >::put().

const DataObject* last_link_object = 0 [static]

Definition at line 44 of file PoolDbIOHandler.cpp.

Referenced by popCurrentDataObject(), pushCurrentDataObject(), and PoolDbIOHandler< T >::put().

DataObject** s_currObj = &s_objPtr [static]

Definition at line 43 of file PoolDbIOHandler.cpp.

Referenced by PoolDbIOHandler< T >::get(), popCurrentDataObject(), pushCurrentDataObject(), and PoolDbIOHandler< T >::put().

DataObject* s_objPtr = 0 [static]

Definition at line 42 of file PoolDbIOHandler.cpp.

Referenced by popCurrentDataObject(), and pushCurrentDataObject().


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