Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataHandleHolderVisitor.cpp
Go to the documentation of this file.
5 #include <functional>
6 #include <tuple>
7 #include <typeinfo>
8 
9 namespace {
10  using std::make_tuple;
11 }
12 
13 DHHVisitor::DHHVisitor( DataObjIDColl& ido, DataObjIDColl& odo ) : m_ido( ido ), m_odo( odo ) {}
14 
16  if ( !v ) { return; }
17 
18  // Loop over inputs and outputs of handles, extra dependiencies and objects to
19  // collect all of them.
20  // Handles and extra dependencies are those of a specific algorith or tool, while
21  // the collection of data objects also contains those of the tree of tools and
22  // algorithms below it.
23 
24  // Loop over input handles and output handles and store those with with non-empty keys
25  // in the container of input objects passed to us and the others in a container of those
26  // we ignore for debug purposes. To avoid multiple for loops, make some tuples and loop
27  // over those.
28  for ( auto& hs : {make_tuple( v->inputHandles(), std::ref( m_ido ), std::ref( m_ign_i ) ),
29  make_tuple( v->outputHandles(), std::ref( m_odo ), std::ref( m_ign_o ) )} ) {
30  for ( const auto& h : std::get<0>( hs ) ) {
31  if ( !h->objKey().empty() ) {
32  std::get<1>( hs ).emplace( h->fullKey() );
33  } else {
34  std::get<2>( hs ).emplace( h->fullKey() );
35  }
36  }
37  }
38 
39  // The containers of handles are a different type than the on of input deps and input
40  // objects, so we need another loop here.
41  // NOTE: perhaps a view from range v3 can be used to also avoid this second loop.
42  for ( auto& hs : {make_tuple( v->extraInputDeps(), std::ref( m_ido ), std::ref( m_ign_i ) ),
43  make_tuple( v->extraOutputDeps(), std::ref( m_odo ), std::ref( m_ign_o ) ),
44  make_tuple( v->inputDataObjs(), std::ref( m_ido ), std::ref( m_ign_i ) ),
45  make_tuple( v->outputDataObjs(), std::ref( m_odo ), std::ref( m_ign_o ) )} ) {
46  for ( const auto& h : std::get<0>( hs ) ) {
47  if ( !h.key().empty() ) {
48  std::get<1>( hs ).emplace( h );
49  } else {
50  std::get<2>( hs ).emplace( h );
51  }
52  }
53  }
54 }
void visit(const IDataHandleHolder *visitee) override
DataObjIDColl m_ign_o
T make_tuple(T...args)
DataObjIDColl m_ign_i
DataObjIDColl & m_ido
virtual std::vector< Gaudi::DataHandle * > inputHandles() const =0
virtual std::vector< Gaudi::DataHandle * > outputHandles() const =0
virtual const DataObjIDColl & extraOutputDeps() const =0
virtual const DataObjIDColl & extraInputDeps() const =0
virtual const DataObjIDColl & inputDataObjs() const =0
T ref(T...args)
DataObjIDColl & m_odo
DHHVisitor(DataObjIDColl &ido, DataObjIDColl &odo)
virtual const DataObjIDColl & outputDataObjs() const =0