| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

# InputCopyStream.cpp

Go to the documentation of this file.

    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),
    00022       m_leavesTool  ( NULL             ),
    00023       m_tesVetoList (                  )
    00024 {
    00025   m_doPreLoad      = false;
    00026   m_doPreLoadOpt   = false;
    00027   declareProperty( "TESVetoList", m_tesVetoList );
    00028 }
    00029
    00030 // Standard Destructor
    00031 InputCopyStream::~InputCopyStream() { }
    00032
    00033 // Initialize the instance.
    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 // Finalize the instance.
    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   // Get the objects in the same file as the root node
    00057   try
    00058   {
    00059     // Get all the leaves on the input stream
    00060     const IDataStoreLeaves::LeavesList & leaves = m_leavesTool->leaves();
    00061
    00062     // Do we need to veto anything ?
    00063     if ( UNLIKELY( !m_tesVetoList.empty() ) )
    00064     {
    00065       // Veto out locations
    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       // saved the veto'ed list
    00083       m_objects.assign( filteredLeaves.begin(), filteredLeaves.end() );
    00084
    00085     }
    00086     else
    00087     {
    00088       // no veto'ing, so save everything
    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   // Collect the other objects from the transient store (mandatory and optional)
    00100   return OutputStream::collectObjects();
    00101 }

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines