ATLAS Offline Software
Loading...
Searching...
No Matches
AthAlgStartVisitor.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4/*
5 */
6// $Id$
13
14
18#include "GaudiKernel/IAlgorithm.h"
19
27 // only do recursive traversal if we are called from a real Algorithm
28 IAlgorithm* ia = dynamic_cast<IAlgorithm*>(n);
29 if ( ia == nullptr) {
30 m_recursive = false;
31 } else if ( ia->isSequence() ) {
32 m_recursive = false;
33 m_ignore = true;
34 }
35}
36
37
42void AthAlgStartVisitor::visit (const IDataHandleHolder* holder)
43{
44 if (m_ignore) return;
45
46 // Make sure we process a component only once.
47 if (m_seen.insert (holder).second) {
48
49 // Check all input handles are initialised
50 for (Gaudi::DataHandle* h : holder->inputHandles()) {
51
52 auto vhk = dynamic_cast<SG::VarHandleKey*> (h);
53 if (!vhk) throw SG::ExcNullHandleKey();
54
55 if (!vhk->storeHandle().get() && !vhk->key().empty()) {
56 throw SG::ExcUninitKey (vhk->clid(), vhk->key(), vhk->storeHandle().name(), holder->name());
57 }
58
59 // Call start() on all read conditions handle keys.
60 if (h->isCondition()) {
61 vhk->start().ignore();
62 }
63 }
64
65 // Check all output handles are initialised
66 for (Gaudi::DataHandle* h : holder->outputHandles()) {
67
68 auto vhk = dynamic_cast< SG::VarHandleKey* > (h);
69 if (!vhk) throw SG::ExcNullHandleKey();
70
71 if (!vhk->storeHandle().get() && !vhk->key().empty()) {
72 throw SG::ExcUninitKey (vhk->clid(), vhk->key(), vhk->storeHandle().name(), holder->name());
73 }
74 }
75
76 if (m_recursive) {
77 holder->acceptDHVisitor (this);
78 }
79 }
80}
Exceptions that can be thrown from StoreGate.
A property holding a SG store/key/clid from which a VarHandle is made.
virtual void visit(const IDataHandleHolder *holder) override
Visit a component and start() any read conditions handles.
AthAlgStartVisitor()=default
std::unordered_set< const IDataHandleHolder * > m_seen
figure out where we're called from
bool m_ignore
process recursively (for Algs)
Header file for AthHistogramAlgorithm.
Exception — Attempt to dereference a Read/Write/UpdateHandle with a null key.
Exception — Tried to create a handle from an uninitialized key.
A property holding a SG store/key/clid from which a VarHandle is made.