2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5/** @class AthCommonDataStore
6 * @file AthenaBaseComps/AthCommonDataStore.icc
7 * @author Charles Leggett
9 * @brief Templated class that provides access to Athena event stores
10 * and ability to set data dependencies via Properites.
11 * Implemented to reduce code duplication in AthAlgorithm,
12 * AthAlgTool, and AthReEntrantAlgorithm
15#ifndef ATHENABASECOMPS_ATHCOMMONDATASTORE_ICC
16#define ATHENABASECOMPS_ATHCOMMONDATASTORE_ICC
18#include "AthenaBaseComps/VHKASupport.h"
19#include "AthenaBaseComps/AthAlgStartVisitor.h"
22void AthCommonDataStore<PBASE>::extraDeps_update_handler( Gaudi::Details::PropertyBase& ExtraDeps )
24 DataObjIDColl newColl;
25 Gaudi::Property<DataObjIDColl> *prop = dynamic_cast<Gaudi::Property<DataObjIDColl>*> (&ExtraDeps);
27 for (auto id : prop->value()) {
28 SG::VarHandleKey vhk(id.clid(), id.key(), Gaudi::DataHandle::Reader);
29 id.updateKey( vhk.objKey() );
30 newColl.emplace( id );
32 if (newColl.size() != 0) prop->setValue( newColl );
34 ATH_MSG_ERROR("unable to dcast ExtraInput/Output Property");
39 * @brief Perform system initialization for an algorithm.
42StatusCode AthCommonDataStore<PBASE>::sysInitialize() {
43 ATH_CHECK( PBASE::sysInitialize() );
45 for ( SG::VarHandleKeyArray* a: m_vhka ) {
49 m_varHandleArraysDeclared = true;
51 return StatusCode::SUCCESS;
55 * @brief Handle START transition.
58StatusCode AthCommonDataStore<PBASE>::sysStart() {
59 ATH_CHECK( PBASE::sysStart() );
61 // Call start() on all input handles.
62 // This allows CondHandleKeys to cache pointers to their conditions containers.
63 // (CondInputLoader makes the containers that it creates during start(),
64 // so initialize() is too early for this.)
66 AthAlgStartVisitor visitor(this);
67 this->acceptDHVisitor (&visitor);
69 return StatusCode::SUCCESS;
73 * @brief Return this algorithm's input handles.
76std::vector<Gaudi::DataHandle*> AthCommonDataStore<PBASE>::inputHandles() const
78 std::vector<Gaudi::DataHandle*> v = PBASE::inputHandles();
80 if (!m_varHandleArraysDeclared) {
81 VHKASupport::insertInput( m_vhka, v );
88 * @brief Return this algorithm's output handles.
91std::vector<Gaudi::DataHandle*> AthCommonDataStore<PBASE>::outputHandles() const
93 std::vector<Gaudi::DataHandle*> v = PBASE::outputHandles();
95 if (!m_varHandleArraysDeclared) {
96 VHKASupport::insertOutput( m_vhka, v );