Go to the documentation of this file.00001
00002 #define GAUDISVC_PERSISTENCYSVC_INPUTCOPYSTREAM_CPP
00003
00004
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
00017 DECLARE_ALGORITHM_FACTORY(InputCopyStream)
00018
00019
00020 InputCopyStream::InputCopyStream(const std::string& name, ISvcLocator* pSvcLocator)
00021 : OutputStream ( name, pSvcLocator),
00022 m_leavesTool ( NULL ),
00023 m_tesVetoList ( )
00024 {
00025 m_doPreLoad = false;
00026 m_doPreLoadOpt = false;
00027 declareProperty( "TESVetoList", m_tesVetoList );
00028 }
00029
00030
00031 InputCopyStream::~InputCopyStream() { }
00032
00033
00034 StatusCode InputCopyStream::initialize()
00035 {
00036 StatusCode sc = OutputStream::initialize();
00037 if ( sc.isFailure() ) return sc;
00038
00039 sc = toolSvc()->retrieveTool("DataSvcFileEntriesTool", "InputCopyStreamTool",
00040 m_leavesTool);
00041
00042 return sc;
00043 }
00044
00045
00046 StatusCode InputCopyStream::finalize()
00047 {
00048 toolSvc()->releaseTool(m_leavesTool).ignore();
00049 m_leavesTool = NULL;
00050 return OutputStream::finalize();
00051 }
00052
00054 StatusCode InputCopyStream::collectObjects()
00055 {
00056
00057 try
00058 {
00059
00060 const IDataStoreLeaves::LeavesList & leaves = m_leavesTool->leaves();
00061
00062
00063 if ( UNLIKELY( !m_tesVetoList.empty() ) )
00064 {
00065
00066 IDataStoreLeaves::LeavesList filteredLeaves;
00067 filteredLeaves.reserve( leaves.size() );
00068 for ( IDataStoreLeaves::LeavesList::const_iterator iL = leaves.begin();
00069 iL != leaves.end(); ++iL )
00070 {
00071 if ( *iL && (*iL)->registry() )
00072 {
00073 if ( std::find( m_tesVetoList.begin(),
00074 m_tesVetoList.end(),
00075 (*iL)->registry()->identifier() ) == m_tesVetoList.end() )
00076 {
00077 filteredLeaves.push_back( (*iL) );
00078 }
00079 }
00080 }
00081
00082
00083 m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
00084
00085 }
00086 else
00087 {
00088
00089 m_objects.assign( leaves.begin(), leaves.end() );
00090 }
00091 }
00092 catch ( const GaudiException & e )
00093 {
00094 MsgStream log(msgSvc(), name());
00095 log << MSG::ERROR << e.message() << endmsg;
00096 return StatusCode::FAILURE;
00097 }
00098
00099
00100 return OutputStream::collectObjects();
00101 }