/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DataObjectCnv.cc
Go to the documentation of this file.
00001 #include "PerBaseEvent/DataObjectCnv.h"
00002 #include "Event/RegistrationSequence.h"
00003 
00004 #include "RootIOSvc/IRootIOSvc.h"
00005 #include "RootIOSvc/RootIOAddress.h"
00006 
00007 #include "GaudiKernel/MsgStream.h"
00008 #include "GaudiKernel/IDataManagerSvc.h"
00009 #include "GaudiKernel/IDataProviderSvc.h"
00010 
00011 #include <string>
00012 using namespace std;
00013 
00014 DataObjectCnv::DataObjectCnv(ISvcLocator* svc)
00015     : Converter(ROOT_StorageType,CLID_DataObject,svc)
00016     
00017 {
00018 }
00019 
00020 DataObjectCnv::~DataObjectCnv()
00021 {
00022 }
00023 
00024 StatusCode DataObjectCnv::initialize()
00025 {
00026     StatusCode sc = Converter::initialize();
00027     if (sc.isFailure()) return sc;
00028 
00029     MsgStream log(msgSvc(), "DataObjectCnv::initialize()");
00030 
00031     IService* isvc=0;
00032     sc = serviceLocator()->service("RootIOCnvSvc", isvc, false);
00033     if (sc.isFailure()) {
00034         log << MSG::ERROR << "Conversion service RootIOCnvSvc"
00035             << " could not be retrieved" << endreq;
00036         return sc;
00037     }
00038     isvc->addRef();
00039 
00040     sc = isvc->queryInterface(IRootIOSvc::interfaceID(), (void**)&m_rioSvc);
00041     if (sc.isFailure()) {
00042         log << MSG::ERROR << "Conversion service RootIOCnvSvc"
00043             << " does not implement IRootIOCnvSvc" << endreq;
00044     }
00045 
00046     return sc;
00047 }
00048 
00049 // --- input --- //
00050 
00051 StatusCode DataObjectCnv::createObj(IOpaqueAddress* /*addr*/,
00052                                     DataObject*& dat)
00053 {
00054     dat = new DataObject;
00055     return StatusCode::SUCCESS;
00056 }
00057 
00058 
00059 StatusCode DataObjectCnv::fillObjRefs(IOpaqueAddress* addr,
00060                                       DataObject* /*pObject*/)
00061 {
00062     // check if everything looks kosher.  
00063 
00064     MsgStream log(msgSvc(), "DataObjectCnv::fillObjRefs()");
00065     RootInputAddress* ria = dynamic_cast<RootInputAddress*>(addr);
00066     if (!ria) return StatusCode::FAILURE;
00067 
00068     log << MSG::DEBUG
00069         << " addr is a RIA @ " << ria->tespath() 
00070         << " clID=" << ria->clID() << endreq;
00071 
00072     if (ria->clID() != CLID_DataObject) {
00073         log << MSG::WARNING << "given unexpected class ID "
00074             << ria->clID() << endreq;
00075         return StatusCode::SUCCESS;
00076     }
00077 
00078     string location = ria->registry()->identifier();
00079 
00080     if (location != "/Event") {
00081         log << MSG::WARNING << "fillObjRefs() called with unexpected location "
00082             << location << endreq;
00083         return StatusCode::SUCCESS;
00084     }
00085 
00086 
00087     // Register address for RegistrationSequence.
00088 
00089     // Fixme: needs to be configurable?
00090     string rsloc = DayaBay::RegistrationSequence::defaultLocation();
00091     int rsclid = DayaBay::RegistrationSequence::classID();
00092     RootInputAddress* rsria = 0;
00093     rsria = new RootInputAddress(rsclid,rsloc);
00094     rsria->setEntry(ria->entry());
00095     RootInputStream* rsris = m_rioSvc->inputStream(*rsria);
00096     rsria->setStream(rsris);
00097     m_rioSvc->dataMgrSvc()->registerAddress(rsloc,rsria);
00098 
00099     // Pull RegistrationSequence out of TES to trigger its converter
00100     DataObject* rsobj = 0;
00101     return m_rioSvc->dataSvc()->
00102         retrieveObject(DayaBay::RegistrationSequence::defaultLocation(),rsobj);
00103 }
00104 
00105 
00106 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:58:27 for PerBaseEvent by doxygen 1.7.4