#include <DataObjectCnv.h>
Inheritance diagram for DataObjectCnv:
This converter applies Daya Bay specific I/O policy, namely using RegistrationSequence to control what is written and read.
bv@bnl.gov Fri Jul 11 14:45:57 2008
Definition at line 22 of file DataObjectCnv.h.
DataObjectCnv::DataObjectCnv | ( | ISvcLocator * | svc | ) |
Definition at line 14 of file DataObjectCnv.cc.
00015 : Converter(ROOT_StorageType,CLID_DataObject,svc) 00016 00017 { 00018 }
DataObjectCnv::~DataObjectCnv | ( | ) | [virtual] |
static const CLID& DataObjectCnv::classID | ( | ) | [inline, static] |
static const unsigned char DataObjectCnv::storageType | ( | ) | [inline, static] |
virtual long DataObjectCnv::repSvcType | ( | ) | const [inline, virtual] |
Implements Converter.
Definition at line 30 of file DataObjectCnv.h.
00030 { 00031 return ROOT_StorageType; 00032 }
StatusCode DataObjectCnv::initialize | ( | ) | [virtual] |
Reimplemented from Converter.
Definition at line 24 of file DataObjectCnv.cc.
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 }
StatusCode DataObjectCnv::createObj | ( | IOpaqueAddress * | addr, | |
DataObject *& | dat | |||
) | [virtual] |
Convert the persistent object to transient.
Reimplemented from Converter.
Definition at line 51 of file DataObjectCnv.cc.
00053 { 00054 dat = new DataObject; 00055 return StatusCode::SUCCESS; 00056 }
StatusCode DataObjectCnv::fillObjRefs | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual] |
Resolve the references of the converted object.
Reimplemented from Converter.
Definition at line 59 of file DataObjectCnv.cc.
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 }
IRootIOSvc* DataObjectCnv::m_rioSvc [private] |