Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:29

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_DATAHANDLEHOLDERVISTOR
0012 #define GAUDIKERNEL_DATAHANDLEHOLDERVISTOR 1
0013 
0014 #include "GaudiKernel/DataObjID.h"
0015 #include "GaudiKernel/IDataHandleHolder.h"
0016 #include <map>
0017 #include <set>
0018 #include <string>
0019 #include <vector>
0020 
0021 class DHHVisitor : public IDataHandleVisitor {
0022 public:
0023   using Owners = std::vector<const IDataHandleHolder*>;
0024 
0025   DHHVisitor( DataObjIDColl& ido, DataObjIDColl& odo );
0026 
0027   const DataObjIDColl& ignoredInpKeys() const { return m_ign_i; }
0028   const DataObjIDColl& ignoredOutKeys() const { return m_ign_o; }
0029 
0030   void visit( const IDataHandleHolder* visitee ) override;
0031 
0032   const std::map<DataObjID, std::set<const IDataHandleHolder*>>& owners() const { return m_owners; }
0033 
0034   std::vector<const IDataHandleHolder*> owners_of( const DataObjID& id ) const;
0035 
0036   std::vector<std::string> owners_names_of( const DataObjID& id, bool with_main = false ) const;
0037 
0038   /// return true if no DataHandle was found
0039   bool empty() const;
0040 
0041 private:
0042   DataObjIDColl &m_ido, &m_odo;
0043   DataObjIDColl  m_ign_i, m_ign_o;
0044 
0045   std::map<DataObjID, std::set<const IDataHandleHolder*>> m_owners;
0046 
0047   std::string m_initialName;
0048 
0049   MsgStream& report( MsgStream& stream ) const;
0050 
0051   friend MsgStream& operator<<( MsgStream& stream, const DHHVisitor& visitor ) { return visitor.report( stream ); }
0052 };
0053 
0054 #endif