![]() |
|
|
Generated: 18 Jul 2008 |
#include <PoolDb/PoolDbBaseCnv.h>
Inheritance diagram for PoolDbBaseCnv:


The generic data converter provides the infrastructure of all data converters. The templated class takes two arguments: The Transient and the Persistent object type.
For a detailed description of the overridden function see the the base class.
Definition at line 45 of file PoolDbBaseCnv.h.
Public Member Functions | |
| PoolDbBaseCnv (long typ, const CLID &clid, ISvcLocator *svc) | |
| Initializing Constructor. | |
| virtual | ~PoolDbBaseCnv () |
| Standard Destructor. | |
| virtual StatusCode | initialize () |
| Converter overrides: Initialize the Db converter. | |
| virtual StatusCode | finalize () |
| Converter overrides: Finalize the Db data converter. | |
| virtual long | repSvcType () const |
| Retrieve the class type of the data store the converter uses. | |
| virtual StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&refpObj) |
| Converter overrides: Create transient object from persistent data. | |
| virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Resolve the references of the created transient object. | |
| virtual StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update transient object from persistent data. | |
| virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update the references of an updated transient object. | |
| virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&refpAddr) |
| Converter overrides: Convert the transient object to the requested representation. | |
| virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Resolve the references of the converted object. | |
| virtual StatusCode | updateRep (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update the converted representation of a transient object. | |
| virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddr, DataObject *pObj) |
| Converter overrides: Update the references of an already converted object. | |
| virtual PoolDbLinkManager * | createReferences (DataObject *pObj) |
| virtual StatusCode | setReferences (PoolDbLinkManager *pMgr, LinkManager *pLinks, DataObject *pObj, IRegistry *pReg) |
| Set the references of a DataObject when reading. | |
| virtual StatusCode | dumpReferences (PoolDbLinkManager *pMgr, LinkManager *pLinks, DataObject *pObj, IRegistry *pReg) |
| Dump the references of a DataObject after writing. | |
Protected Member Functions | |
| StatusCode | makeError (const std::string &msg, bool rethrow=true) |
| Standard way to print errors. | |
| virtual const std::string | containerName (IRegistry *pReg) const |
| Retrieve the name of the container a given object is placed into. | |
Protected Attributes | |
| IPoolDbMgr * | m_dbMgr |
| Services needed for proper operation: POOL database manager. | |
| IDataManagerSvc * | m_dataMgr |
| Services needed for proper operation: Gaudi datastore manager. | |
| pool::Guid | m_objGuid |
| Object Guid. | |
| ROOT::Reflex::Type | m_class |
| Reference to seal reflection class. | |
| pool::DataCallBack * | m_call |
| Definition callback. | |
| std::set< std::string > | m_badFiles |
| Set with bad files/tables. | |
| PoolDbBaseCnv::PoolDbBaseCnv | ( | long | typ, | |
| const CLID & | clid, | |||
| ISvcLocator * | svc | |||
| ) |
Initializing Constructor.
| typ | [IN] Concrete storage type of the converter | |
| clid | [IN] Class identifier of the object | |
| svc | [IN] Pointer to service locator object |
Definition at line 230 of file PoolDbBaseCnv.cpp.
References pool::Guid::Data1, pool::DbInstanceCount::Counter::increment(), m_dbMgr, m_objGuid, and s_count.
00231 : Converter(typ, clid, svc), m_objGuid(pool::Guid::null()), m_call(0) 00232 { 00233 s_count->increment(); 00234 m_dbMgr = 0; 00235 m_objGuid.Data1 = clid; 00236 }
| PoolDbBaseCnv::~PoolDbBaseCnv | ( | ) | [virtual] |
Standard Destructor.
Definition at line 239 of file PoolDbBaseCnv.cpp.
References pool::DbInstanceCount::Counter::decrement(), m_dbMgr, pool::releasePtr(), and s_count.
00239 { 00240 pool::releasePtr(m_dbMgr); 00241 s_count->decrement(); 00242 }
| StatusCode PoolDbBaseCnv::makeError | ( | const std::string & | msg, | |
| bool | rethrow = true | |||
| ) | [protected] |
Standard way to print errors.
after the printout an exception is thrown.
| msg | [IN] Message string to be printed. | |
| rethrow | [IN] Flag to indicate if an exception must be thrown |
Definition at line 329 of file PoolDbBaseCnv.cpp.
References pool::debugBreak(), endmsg(), MSG::ERROR, StatusCode::FAILURE, m_class, m_objGuid, Converter::messageService(), and pool::Guid::toString().
Referenced by PoolDbNTupleCnv::createObj(), createObj(), createRep(), initialize(), setReferences(), PoolDbNTupleCnv::updateObj(), updateObj(), PoolDbDirectoryCnv::updateObjRefs(), updateObjRefs(), updateRep(), and updateRepRefs().
00330 { 00331 MsgStream log(messageService(),"PoolDbBaseCnv"); 00332 log << MSG::ERROR << "Trouble with class:" << m_objGuid.toString() << " "; 00333 if ( m_class ) log << "<" << m_class.Name(ROOT::Reflex::SCOPED) << "> "; 00334 log << endmsg; 00335 log << msg << endmsg; 00336 if ( rethrow ) { 00337 pool::debugBreak("Error:"+msg, "PoolDbBaseCnv", true); 00338 } 00339 return StatusCode::FAILURE; 00340 }
| const std::string PoolDbBaseCnv::containerName | ( | IRegistry * | pReg | ) | const [protected, virtual] |
Retrieve the name of the container a given object is placed into.
| pReg | [IN] Pointer to registry entry. |
Reimplemented in PoolDbDatabaseCnv, and PoolDbStatCnv.
Definition at line 322 of file PoolDbBaseCnv.cpp.
References IRegistry::identifier().
Referenced by createRep().
00322 { 00323 if ( 0 != pRegistry ) { 00324 return pRegistry->identifier(); 00325 } 00326 return ""; 00327 }
| StatusCode PoolDbBaseCnv::initialize | ( | ) | [virtual] |
Converter overrides: Initialize the Db converter.
Reimplemented from Converter.
Definition at line 245 of file PoolDbBaseCnv.cpp.
References c, Converter::conversionSvc(), pool::DbTypeInfo::create(), Converter::dataProvider(), MSG::DEBUG, endmsg(), MSG::ERROR, StatusCode::FAILURE, pool::DbReflex::forGuid(), pool::DbTransform::getShape(), IID_IDataManagerSvc, IID_IPoolDbMgr, Converter::initialize(), StatusCode::isSuccess(), m_call, m_class, m_dataMgr, m_dbMgr, m_objGuid, makeError(), Converter::msgSvc(), pool::DbColumn::POINTER, IInterface::queryInterface(), pool::DataCallBack::setShape(), pool::DbTypeInfo::toString(), and pool::Guid::toString().
00245 { 00246 StatusCode status = Converter::initialize(); 00247 MsgStream log(msgSvc(),"PoolDbBaseCnv"); 00248 if ( !status.isSuccess() ) { 00249 log << MSG::ERROR << "Cannot initialize base class \"Converter\"" << endmsg; 00250 return status; 00251 } 00252 IPoolDbMgr **ptr1 = &m_dbMgr; 00253 status = conversionSvc()->queryInterface(IID_IPoolDbMgr, (void**)ptr1); 00254 if ( !status.isSuccess() ) { 00255 log << MSG::ERROR << "Cannot connect to \"IPoolDbMgr\" interface." << endmsg; 00256 return status; 00257 } 00258 IDataManagerSvc **ptr2 = &m_dataMgr; 00259 status = dataProvider()->queryInterface(IID_IDataManagerSvc, (void**)ptr2); 00260 if ( !status.isSuccess() ) { 00261 log << MSG::ERROR << "Cannot connect to \"IDataManagerSvc\" interface." << endmsg; 00262 return status; 00263 } 00264 const pool::DbTypeInfo* shapeH = 0; 00265 const ROOT::Reflex::Type refH = ROOT::Reflex::Type::ByName("PoolDbLinkManager"); 00266 if ( !refH ) { 00267 log << MSG::ERROR << "Dictionary for class \"PoolDbLinkManager\" missing." << endmsg; 00268 return StatusCode::FAILURE; 00269 } 00270 const ROOT::Reflex::Type lnkH = ROOT::Reflex::Type::ByName("LinkManager"); 00271 if ( !lnkH ) { 00272 log << MSG::ERROR << "Dictionary for class \"LinkManager\" missing." << endmsg; 00273 return StatusCode::FAILURE; 00274 } 00275 m_class = pool::DbReflex::forGuid(m_objGuid); 00276 if ( !m_class ) { 00277 // This may fail if the dictionary is not yet loaded, therefore it is not going to report an ERROR 00278 log << MSG::DEBUG << "Dictionary for class with GUID:" << m_objGuid.toString() 00279 << " missing." << endmsg; 00280 return StatusCode::FAILURE; 00281 } 00282 if ( !pool::DbTransform::getShape(m_objGuid, shapeH).isSuccess() ) { 00283 std::vector<const pool::DbColumn*> c; 00284 c.push_back(new pool::DbColumn(m_class.Name(), 00285 m_class.Name(ROOT::Reflex::SCOPED), 00286 pool::DbColumn::POINTER, 00287 0)); 00288 c.push_back(new pool::DbColumn("Links", 00289 lnkH.Name(ROOT::Reflex::SCOPED), 00290 pool::DbColumn::POINTER, 00291 0)); 00292 c.push_back(new pool::DbColumn("Refs", 00293 refH.Name(ROOT::Reflex::SCOPED), 00294 pool::DbColumn::POINTER, 00295 0)); 00296 shapeH = pool::DbTypeInfo::create(m_objGuid, c); 00297 } 00298 if ( shapeH ) { 00299 log << MSG::DEBUG << "Created object shape for class:" 00300 << m_class.Name(ROOT::Reflex::SCOPED) << endmsg 00301 << shapeH->toString() << endmsg; 00302 m_call = new PoolDbDataObjectHandler(m_class); 00303 m_call->setShape(shapeH); 00304 } 00305 else { 00306 return makeError("Failed to create POOL shape information for GUID:"+ 00307 m_objGuid.toString(),false); 00308 } 00309 return status; 00310 }
| StatusCode PoolDbBaseCnv::finalize | ( | ) | [virtual] |
Converter overrides: Finalize the Db data converter.
Reimplemented from Converter.
Definition at line 313 of file PoolDbBaseCnv.cpp.
References Converter::finalize(), m_call, m_dataMgr, m_dbMgr, and pool::releasePtr().
00313 { 00314 pool::releasePtr(m_call); 00315 pool::releasePtr(m_dbMgr); 00316 pool::releasePtr(m_dataMgr); 00317 return Converter::finalize(); 00318 }
| virtual long PoolDbBaseCnv::repSvcType | ( | ) | const [inline, virtual] |
Retrieve the class type of the data store the converter uses.
Implements IConverter.
Definition at line 97 of file PoolDbBaseCnv.h.
References Converter::i_repSvcType().
Referenced by PoolDbDirectoryCnv::updateObjRefs().
00097 { 00098 return i_repSvcType(); 00099 }
| StatusCode PoolDbBaseCnv::createObj | ( | IOpaqueAddress * | pAddr, | |
| DataObject *& | refpObj | |||
| ) | [virtual] |
Converter overrides: Create transient object from persistent data.
| pAddr | [IN] Pointer to object address. | |
| refpObj | [OUT] Location to pointer to store data object |
Reimplemented from Converter.
Reimplemented in PoolDbDatabaseCnv, PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 469 of file PoolDbBaseCnv.cpp.
References IPoolDbMgr::BAD_DATA_CONNECTION, pool::DataCallBack::clone(), endreq(), MSG::ERROR, StatusCode::FAILURE, StatusCode::getCode(), StatusCode::isSuccess(), m_badFiles, m_call, m_dbMgr, makeError(), Converter::messageService(), PoolDbAddress::par(), IPoolDbMgr::read(), IOpaqueAddress::registry(), DataObject::release(), StatusCode::SUCCESS, and std::exception::what().
00470 { 00471 try { 00472 PoolDbAddress* pA = dynamic_cast<PoolDbAddress*>(pAddress); 00473 if ( pA ) { 00474 PoolDbObjectContext ctxt(this, pAddress->registry()); 00475 pool::DataCallBack* call = m_call->clone(); 00476 StatusCode sc = m_dbMgr->read(call, pA); 00477 if ( sc.isSuccess() ) { 00478 refpObject = (DataObject*)call->object(); 00479 call->release(); 00480 return StatusCode::SUCCESS; 00481 } 00482 call->release(); 00483 std::string tag = pA->par()[0]+":"+pA->par()[1]; 00484 if ( sc.getCode() == IPoolDbMgr::BAD_DATA_CONNECTION ) { 00485 if ( m_badFiles.find(tag) != m_badFiles.end() ) { 00486 return sc; // Let's save us the additional printout 00487 } 00488 m_badFiles.insert(tag); 00489 } 00490 MsgStream log(messageService(),"PoolDbBaseCnv"); 00491 log << MSG::ERROR << "createObj> Cannot access the object:"+tag << endreq; 00492 return StatusCode::FAILURE; 00493 } 00494 return makeError("createObj> Invalid object address.", false); 00495 } 00496 catch (std::exception& e) { 00497 return makeError(std::string("createObj> Caught exception:")+e.what(), false); 00498 } 00499 catch(...) { 00500 } 00501 return makeError("createObj> Unknown exception occurred.", false); 00502 }
| StatusCode PoolDbBaseCnv::fillObjRefs | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Resolve the references of the created transient object.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 506 of file PoolDbBaseCnv.cpp.
References updateObjRefs().
00507 { 00508 return updateObjRefs(pAddress, pObject); 00509 }
| StatusCode PoolDbBaseCnv::updateObj | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Update transient object from persistent data.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 513 of file PoolDbBaseCnv.cpp.
References makeError(), and std::exception::what().
00514 { 00515 try { 00516 PoolDbAddress* pA = dynamic_cast<PoolDbAddress*>(pAddr); 00517 if ( 0 != pA ) { 00518 return makeError("updateObj> Sorry folks, not yet implemented..."); 00519 } 00520 return makeError("updateObj> Invalid opaque object address."); 00521 } 00522 catch (std::exception& e) { 00523 return makeError(std::string("updateObj> Caught exception:")+e.what()); 00524 } 00525 catch (...) { 00526 } 00527 return makeError("updateObj> Unknown Error - exception was thrown."); 00528 }
| StatusCode PoolDbBaseCnv::updateObjRefs | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Update the references of an updated transient object.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, PoolDbKeyedContainerCnv, and PoolDbNTupleCnv.
Definition at line 532 of file PoolDbBaseCnv.cpp.
References MSG::ALWAYS, endmsg(), IRegistry::identifier(), LinkManager::link(), DataObject::linkMgr(), makeError(), Converter::msgSvc(), printLinks(), DataObject::registry(), LinkManager::size(), and StatusCode::SUCCESS.
Referenced by fillObjRefs(), and PoolDbKeyedContainerCnv::updateObjRefs().
00533 { 00534 if ( 0 != pObj ) { 00535 if ( printLinks() ) { 00536 MsgStream log(msgSvc(), "updateObjRefs"); 00537 LinkManager* mgr = pObj->linkMgr(); 00538 std::string id = pObj->registry()->identifier(); 00539 for ( int i = 0; i < mgr->size(); ++i) { 00540 LinkManager::Link* lnk = mgr->link(i); 00541 log << MSG::ALWAYS << "GET> " << id << "[" << i << "] = " << lnk->path() << endmsg; 00542 } 00543 } 00544 return StatusCode::SUCCESS; 00545 } 00546 return makeError("updateObjRefs> Invalid object reference."); 00547 }
| StatusCode PoolDbBaseCnv::createRep | ( | DataObject * | pObj, | |
| IOpaqueAddress *& | refpAddr | |||
| ) | [virtual] |
Converter overrides: Convert the transient object to the requested representation.
| pObj | [IN] Pointer to data object | |
| refpAddr | [OUT] Location to store pointer to object address. |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 551 of file PoolDbBaseCnv.cpp.
References pool::DataCallBack::clone(), containerName(), StatusCode::isSuccess(), m_call, m_dbMgr, makeError(), IPoolDbMgr::markWrite(), DataObject::registry(), and std::exception::what().
00552 { 00553 try { 00554 refpA = 0; 00555 if ( pObj ) { 00556 IRegistry* pReg = pObj->registry(); 00557 if ( pReg ) { 00558 PoolDbAddress* pA = 0; 00559 std::string cnt = containerName(pReg); 00560 PoolDbObjectContext ctxt(this, pObj->registry()); 00561 pool::DataCallBack* call = m_call->clone(); 00562 call->setObject(pObj); 00563 StatusCode sc = m_dbMgr->markWrite(call, cnt, &pA); 00564 if ( sc.isSuccess() ) { 00565 refpA = pA; 00566 return sc; 00567 } 00568 } 00569 return makeError("createRep> Invalid object registry entry."); 00570 } 00571 return makeError("createRep> Invalid object reference."); 00572 } 00573 catch (std::exception& e) { 00574 makeError(std::string("createRep> Caught exception:")+e.what()); 00575 } 00576 catch (...) { 00577 return makeError("createRep> Unknown Fatal Exception."); 00578 } 00579 return makeError("createRep> Fatal Error."); 00580 }
| StatusCode PoolDbBaseCnv::fillRepRefs | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Resolve the references of the converted object.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbNTupleCnv.
Definition at line 609 of file PoolDbBaseCnv.cpp.
References updateRepRefs().
00610 { 00611 return updateRepRefs(pAddr, pObj); 00612 }
| StatusCode PoolDbBaseCnv::updateRep | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Update the converted representation of a transient object.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 584 of file PoolDbBaseCnv.cpp.
References pool::DataCallBack::clone(), m_call, m_dbMgr, makeError(), IPoolDbMgr::markUpdate(), IOpaqueAddress::registry(), and std::exception::what().
00584 { 00585 try { 00586 PoolDbAddress* pA = dynamic_cast<PoolDbAddress*>(pAddr); 00587 if ( 0 != pA ) { 00588 if ( pObj ) { 00589 PoolDbObjectContext ctxt(this, pAddr->registry()); 00590 pool::DataCallBack* call = m_call->clone(); 00591 call->setObject(pObj); 00592 return m_dbMgr->markUpdate(call, pA); 00593 } 00594 return makeError("updateRep> Invalid object reference."); 00595 } 00596 return makeError("updateRep> Invalid opaque object address."); 00597 } 00598 catch (std::exception& e) { 00599 makeError(std::string("updateRep> Caught exception:")+e.what()); 00600 } 00601 catch (...) { 00602 return makeError("updateRep> Unknown Fatal Exception."); 00603 } 00604 return makeError("updateRep> Fatal Error."); 00605 }
| StatusCode PoolDbBaseCnv::updateRepRefs | ( | IOpaqueAddress * | pAddr, | |
| DataObject * | pObj | |||
| ) | [virtual] |
Converter overrides: Update the references of an already converted object.
| pAddr | [IN] Pointer to object address. | |
| pObj | [IN] Pointer to data object |
Reimplemented from Converter.
Reimplemented in PoolDbDirectoryCnv, and PoolDbNTupleCnv.
Definition at line 616 of file PoolDbBaseCnv.cpp.
References makeError(), and StatusCode::SUCCESS.
Referenced by fillRepRefs().
00617 { 00618 if ( pObj ) { 00619 return StatusCode::SUCCESS; 00620 } 00621 return makeError("updateRepRefs> Invalid object reference."); 00622 }
| PoolDbLinkManager * PoolDbBaseCnv::createReferences | ( | DataObject * | pObj | ) | [virtual] |
Definition at line 417 of file PoolDbBaseCnv.cpp.
References pool::Token::addRef(), IOpaqueAddress::clID(), pool::Guid::Data1, IOpaqueAddress::ipar(), StatusCode::isSuccess(), PoolDbLinkManager::links(), m_dataMgr, pool::Guid::null(), IDataManagerSvc::objectLeaves(), pool::Token::oid(), IOpaqueAddress::par(), std::vector< _Tp, _Alloc >::push_back(), PoolDbLinkManager::references(), pool::Token::setClassID(), pool::Token::setDb(), pool::Token::setTechnology(), IOpaqueAddress::svcType(), and PoolDbAddress::token().
Referenced by PoolDbDataObjectHandler::bind().
00418 { 00419 typedef std::vector<IRegistry*> Leaves; 00420 PoolDbLinkManager* refs = new PoolDbLinkManager; 00421 Leaves leaves; 00422 StatusCode status = m_dataMgr->objectLeaves(pObj, leaves); 00423 if ( status.isSuccess() ) { 00424 for(Leaves::iterator i=leaves.begin(), iend=leaves.end(); i != iend; ++i) { 00425 IRegistry* pR = *i; 00426 IOpaqueAddress* pA = pR->address(); 00427 if ( 0 != pA ) { 00428 PoolDbAddress* pdbA = dynamic_cast<PoolDbAddress*>(pA); 00429 if ( 0 != pdbA ) { 00430 pool::Token* tok = const_cast<pool::Token*>(pdbA->token()); 00431 if ( tok ) { 00432 tok->addRef(); 00433 refs->references().push_back(tok); 00434 refs->links().push_back(pR->name()); 00435 } 00436 else { 00437 // What should we do here ? 00438 // Not so clear... 00439 } 00440 } 00441 else { 00442 const std::string* spar = pA->par(); 00443 const unsigned long* ipar = pA->ipar(); 00444 pool::Guid guid(pool::Guid::null()); 00445 guid.Data1 = pA->clID(); 00446 pool::Token* tok = new pool::Token(); 00447 tok->setClassID(guid); 00448 tok->setTechnology(pA->svcType()); 00449 tok->setDb(spar[0]).setCont(spar[1]); 00450 tok->oid().first = ipar[0]; 00451 tok->oid().second = ipar[1]; 00452 refs->references().push_back(tok); 00453 refs->links().push_back(pR->name()); 00454 } 00455 } 00456 else { 00457 // This is not really an error, it only means that the object 00458 // pointed to is not persistent. Hence, this link cannot be followed 00459 // from the data written. 00460 } 00461 } 00462 } 00463 return refs; 00464 }
| StatusCode PoolDbBaseCnv::setReferences | ( | PoolDbLinkManager * | pMgr, | |
| LinkManager * | pLinks, | |||
| DataObject * | pObj, | |||
| IRegistry * | pReg | |||
| ) | [virtual] |
Set the references of a DataObject when reading.
| pMgr | [IN] Pointer to POOL Link manager object | |
| pLinks | [IN] Pointer to intermediate link manager | |
| pObj | [IN] Pointer to data object | |
| pReg | [IN] Pointer to registry entry |
Definition at line 360 of file PoolDbBaseCnv.cpp.
References LinkManager::addLink(), Converter::addressCreator(), pool::Token::classID(), pool::Token::contID(), IAddressCreator::createAddress(), pool::Token::dbID(), endmsg(), MSG::ERROR, pool::DbReflex::forGuid(), StatusCode::isSuccess(), LinkManager::link(), DataObject::linkMgr(), PoolDbLinkManager::links(), m_dataMgr, makeError(), Converter::msgSvc(), pool::Token::oid(), PoolDbLinkManager::references(), IDataManagerSvc::registerAddress(), std::basic_string< _CharT, _Traits, _Alloc >::rfind(), std::vector< _Tp, _Alloc >::size(), LinkManager::size(), std::basic_string< _CharT, _Traits, _Alloc >::substr(), StatusCode::SUCCESS, pool::Token::technology(), and pool::Token::toString().
Referenced by PoolDbDataObjectHandler::end().
00364 { 00365 std::string tmp; 00366 LinkManager* pmgr = pObj->linkMgr(); 00367 for(int i = 0; i < pLinks->size(); ++i) { 00368 LinkManager::Link* lnk = pLinks->link(i); 00369 pmgr->addLink(lnk->path(), 0); 00370 } 00371 size_t ref_size = mgr->references().size(); 00372 for(size_t j = 0; j < ref_size; ++j) { 00373 IOpaqueAddress* pA = 0; 00374 const pool::Token* token = mgr->references()[j]; 00375 std::string& location = mgr->links()[j]; 00376 long typ = token->technology(); 00377 CLID clid = token->classID().Data1; 00378 std::string spar[] = {token->dbID(), 00379 token->contID()}; 00380 unsigned long ipar[] = {token->oid().first, 00381 token->oid().second}; 00382 StatusCode sc = addressCreator()->createAddress(typ,clid,spar,ipar,pA); 00383 if ( sc.isSuccess() ) { 00384 // Temporary fix for all files written with previous release(s) 00385 // The fix should be removed when these files are obsolete 00386 if ( location.substr(0,7) == "/Event/" ) { 00387 size_t idx = location.rfind("/"); 00388 tmp = location.substr(idx); 00389 location = tmp; 00390 } 00391 sc = m_dataMgr->registerAddress(pReg, location, pA); 00392 if ( sc.isSuccess() ) { 00393 // MsgStream log(msgSvc(), "Reflection"); 00394 // log << MSG::ALWAYS << "Registered:" << pReg->identifier() << " as " << location << endmsg; 00395 continue; 00396 } 00397 pA->release(); 00398 ROOT::Reflex::Type classH = pool::DbReflex::forGuid(token->classID()); 00399 MsgStream err(msgSvc(), "Reflection"); 00400 if ( 0 == classH ) { 00401 err << MSG::ERROR << "No reflection information availible for class ID:" 00402 << token->classID().toString() << endmsg; 00403 } 00404 else { 00405 err << MSG::ERROR << "Reflection information availible for class ID:" 00406 << token->classID().toString() << endmsg 00407 << classH.Name(ROOT::Reflex::SCOPED) << endmsg; 00408 } 00409 makeError("setReferences> Failed to register opaque address:"+location+ 00410 "\n"+token->toString()); 00411 } 00412 } 00413 return StatusCode::SUCCESS; 00414 }
| StatusCode PoolDbBaseCnv::dumpReferences | ( | PoolDbLinkManager * | pMgr, | |
| LinkManager * | pLinks, | |||
| DataObject * | pObj, | |||
| IRegistry * | pReg | |||
| ) | [virtual] |
Dump the references of a DataObject after writing.
| pMgr | [IN] Pointer to POOL Link manager object | |
| pLinks | [IN] Pointer to intermediate link manager | |
| pObj | [IN] Pointer to data object | |
| pReg | [IN] Pointer to registry entry |
Definition at line 343 of file PoolDbBaseCnv.cpp.
References MSG::ALWAYS, endmsg(), IRegistry::identifier(), LinkManager::link(), DataObject::linkMgr(), Converter::msgSvc(), printLinks(), DataObject::registry(), LinkManager::size(), and StatusCode::SUCCESS.
Referenced by PoolDbDataObjectHandler::end().
00347 { 00348 if ( printLinks() ) { 00349 MsgStream log(msgSvc(), "dumpReferences"); 00350 LinkManager* mgr = pObj->linkMgr(); 00351 for ( int i = 0; i < mgr->size(); ++i) { 00352 LinkManager::Link* lnk = mgr->link(i); 00353 log << MSG::ALWAYS << "PUT> " << pObj->registry()->identifier() << "[" << i << "] = " << lnk->path() << endmsg; 00354 } 00355 } 00356 return StatusCode::SUCCESS; 00357 }
IPoolDbMgr* PoolDbBaseCnv::m_dbMgr [protected] |
Services needed for proper operation: POOL database manager.
Definition at line 48 of file PoolDbBaseCnv.h.
Referenced by PoolDbNTupleCnv::createObj(), createObj(), PoolDbNTupleCnv::createRep(), createRep(), PoolDbNTupleCnv::fillRepRefs(), finalize(), initialize(), PoolDbBaseCnv(), PoolDbStatCnv::saveDescription(), PoolDbNTupleCnv::updateObj(), PoolDbDirectoryCnv::updateObjRefs(), updateRep(), and ~PoolDbBaseCnv().
IDataManagerSvc* PoolDbBaseCnv::m_dataMgr [protected] |
Services needed for proper operation: Gaudi datastore manager.
Definition at line 50 of file PoolDbBaseCnv.h.
Referenced by createReferences(), finalize(), initialize(), setReferences(), and PoolDbDirectoryCnv::updateObjRefs().
pool::Guid PoolDbBaseCnv::m_objGuid [protected] |
Object Guid.
Definition at line 52 of file PoolDbBaseCnv.h.
Referenced by initialize(), makeError(), PoolDbBaseCnv(), and PoolDbKeyedContainerCnv::updateObjRefs().
ROOT::Reflex::Type PoolDbBaseCnv::m_class [protected] |
Reference to seal reflection class.
Definition at line 54 of file PoolDbBaseCnv.h.
Referenced by initialize(), makeError(), and PoolDbNTupleCnv::PoolDbNTupleCnv().
pool::DataCallBack* PoolDbBaseCnv::m_call [protected] |
Definition callback.
Definition at line 56 of file PoolDbBaseCnv.h.
Referenced by createObj(), createRep(), finalize(), initialize(), and updateRep().
std::set<std::string> PoolDbBaseCnv::m_badFiles [protected] |
Set with bad files/tables.
Definition at line 58 of file PoolDbBaseCnv.h.
Referenced by createObj().