|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
00001 // $Id: InputCopyStream.cpp,v 1.2 2006/01/10 20:09:27 hmd Exp $ 00002 #define GAUDISVC_PERSISTENCYSVC_INPUTCOPYSTREAM_CPP 00003 00004 // Framework include files 00005 #include "GaudiKernel/AlgFactory.h" 00006 #include "GaudiKernel/IRegistry.h" 00007 #include "GaudiKernel/IDataManagerSvc.h" 00008 #include "GaudiKernel/IDataProviderSvc.h" 00009 #include "GaudiKernel/IOpaqueAddress.h" 00010 #include "GaudiKernel/DataStoreItem.h" 00011 #include "GaudiKernel/DataObject.h" 00012 #include "GaudiKernel/IDataStoreLeaves.h" 00013 #include "GaudiKernel/MsgStream.h" 00014 #include "InputCopyStream.h" 00015 00016 // Define the algorithm factory for the standard output data writer 00017 DECLARE_ALGORITHM_FACTORY(InputCopyStream) 00018 00019 // Standard Constructor 00020 InputCopyStream::InputCopyStream(const std::string& name, ISvcLocator* pSvcLocator) 00021 : OutputStream(name, pSvcLocator), m_leavesTool(0) 00022 { 00023 m_doPreLoad = false; 00024 m_doPreLoadOpt = false; 00025 } 00026 00027 // Standard Destructor 00028 InputCopyStream::~InputCopyStream() { 00029 } 00030 00031 // Initialize the instance. 00032 StatusCode InputCopyStream::initialize() { 00033 StatusCode sc = OutputStream::initialize(); 00034 if (sc.isFailure()) return sc; 00035 00036 sc = toolSvc()->retrieveTool("DataSvcFileEntriesTool", "InputCopyStreamTool", 00037 m_leavesTool); 00038 if (sc.isFailure()) return sc; 00039 00040 return StatusCode::SUCCESS; 00041 } 00042 00043 // Finalize the instance. 00044 StatusCode InputCopyStream::finalize() { 00045 toolSvc()->releaseTool(m_leavesTool).ignore(); 00046 m_leavesTool = 0; 00047 00048 return OutputStream::finalize(); 00049 } 00050 00052 StatusCode InputCopyStream::collectObjects() { 00053 MsgStream log(msgSvc(), name()); 00054 00055 // Get the objects in the same file as the root node 00056 try { 00057 const IDataStoreLeaves::LeavesList & leaves = m_leavesTool->leaves(); 00058 m_objects.assign(leaves.begin(), leaves.end()); 00059 } catch (GaudiException &e) { 00060 log << MSG::ERROR << e.message() << endmsg; 00061 return StatusCode::FAILURE; 00062 } 00063 00064 // Collect the other objects from the transient store (mandatory and optional) 00065 return OutputStream::collectObjects(); 00066 }