Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r7 (7f57a304)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataHandleHolderVisitor.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
12 #include "GaudiKernel/DataHandle.h"
13 #include "GaudiKernel/DataObjID.h"
15 #include <functional>
16 #include <tuple>
17 #include <typeinfo>
18 
19 namespace {
20  using std::make_tuple;
21 }
22 
23 DHHVisitor::DHHVisitor( DataObjIDColl& ido, DataObjIDColl& odo ) : m_ido( ido ), m_odo( odo ) {}
24 
26  if ( !v ) { return; }
27 
28  // Loop over inputs and outputs of handles, extra dependiencies and objects to
29  // collect all of them.
30  // Handles and extra dependencies are those of a specific algorith or tool, while
31  // the collection of data objects also contains those of the tree of tools and
32  // algorithms below it.
33 
34  // Loop over input handles and output handles and store those with with non-empty keys
35  // in the container of input objects passed to us and the others in a container of those
36  // we ignore for debug purposes. To avoid multiple for loops, make some tuples and loop
37  // over those.
38  for ( auto& hs : { make_tuple( v->inputHandles(), std::ref( m_ido ), std::ref( m_ign_i ) ),
39  make_tuple( v->outputHandles(), std::ref( m_odo ), std::ref( m_ign_o ) ) } ) {
40  for ( const auto& h : std::get<0>( hs ) ) {
41  if ( !h->objKey().empty() ) {
42  std::get<1>( hs ).emplace( h->fullKey() );
43  } else {
44  std::get<2>( hs ).emplace( h->fullKey() );
45  }
46  }
47  }
48 
49  // The containers of handles are a different type than the on of input deps and input
50  // objects, so we need another loop here.
51  // NOTE: perhaps a view from range v3 can be used to also avoid this second loop.
52  for ( auto& hs : { make_tuple( v->extraInputDeps(), std::ref( m_ido ), std::ref( m_ign_i ) ),
53  make_tuple( v->extraOutputDeps(), std::ref( m_odo ), std::ref( m_ign_o ) ),
54  make_tuple( v->inputDataObjs(), std::ref( m_ido ), std::ref( m_ign_i ) ),
55  make_tuple( v->outputDataObjs(), std::ref( m_odo ), std::ref( m_ign_o ) ) } ) {
56  for ( const auto& h : std::get<0>( hs ) ) {
57  if ( !h.key().empty() ) {
58  std::get<1>( hs ).emplace( h );
59  } else {
60  std::get<2>( hs ).emplace( h );
61  }
62  }
63  }
64 }
DHHVisitor::visit
void visit(const IDataHandleHolder *visitee) override
Definition: DataHandleHolderVisitor.cpp:25
IDataHandleHolder
Definition: IDataHandleHolder.h:24
DHHVisitor::m_ign_i
DataObjIDColl m_ign_i
Definition: DataHandleHolderVisitor.h:29
std::make_tuple
T make_tuple(T... args)
std::unordered_set< DataObjID, DataObjID_Hasher >
DHHVisitor::m_ido
DataObjIDColl & m_ido
Definition: DataHandleHolderVisitor.h:28
DataObjID.h
DHHVisitor::DHHVisitor
DHHVisitor(DataObjIDColl &ido, DataObjIDColl &odo)
Definition: DataHandleHolderVisitor.cpp:23
DHHVisitor::m_odo
DataObjIDColl & m_odo
Definition: DataHandleHolderVisitor.h:28
AlgSequencer.h
h
Definition: AlgSequencer.py:32
DataHandleHolderVisitor.h
HistoDumpEx.v
v
Definition: HistoDumpEx.py:27
DHHVisitor::m_ign_o
DataObjIDColl m_ign_o
Definition: DataHandleHolderVisitor.h:29
IDataHandleHolder.h
DataHandle.h
std::ref
T ref(T... args)