From c58af6d58c96f9b32c18f6de97ed70b462e48204 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Sun, 22 Nov 2020 22:22:54 -0500 Subject: [PATCH] MuonTGC_CnvTools: Clean up TgcPrepDataReplicationTool*. Clean up TgcPrepDataReplicationTool* classes. But need to declare them as not-thread-safe, due to their reliance on naughtyRetrieve. --- .../ITgcPrepDataReplicationTool.h | 14 +++++------ .../src/TgcPrepDataReplicationAlg.h | 5 ++-- .../src/TgcPrepDataReplicationTool.cxx | 25 ++++--------------- .../src/TgcPrepDataReplicationTool.h | 23 +++++++---------- .../TgcPrepDataReplicationTool3BCtoAllBC.cxx | 19 +++----------- .../TgcPrepDataReplicationTool3BCtoAllBC.h | 15 ++++------- .../TgcPrepDataReplicationToolAllBCto3BC.cxx | 23 +++-------------- .../TgcPrepDataReplicationToolAllBCto3BC.h | 15 ++++------- 8 files changed, 39 insertions(+), 100 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h index fdec76119752..599ea1022ecd 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h @@ -1,23 +1,21 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONTGC_CNVTOOL_ITGCPREPDATAREPLICATIONTOOL_H #define MUONTGC_CNVTOOL_ITGCPREPDATAREPLICATIONTOOL_H #include "GaudiKernel/IAlgTool.h" - -static const InterfaceID IID_ITgcPrepDataReplicationTool("Muon::ITgcPrepDataReplicationTool", 1, 0); +#include "CxxUtils/checker_macros.h" namespace Muon { - class ITgcPrepDataReplicationTool : virtual public IAlgTool { + class ATLAS_NOT_THREAD_SAFE ITgcPrepDataReplicationTool : virtual public IAlgTool { - public: - /** Provide interface ID of ITgcPrepDataReplicationTool */ - static const InterfaceID& interfaceID() { return IID_ITgcPrepDataReplicationTool; }; + public: + DeclareInterfaceID( ITgcPrepDataReplicationTool, 1, 0 ); - virtual StatusCode replicate()=0; + virtual StatusCode replicate() const = 0; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h index 513e6b2070b2..66976ee330eb 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TgcPrepDataReplicationAlg_h @@ -8,11 +8,12 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "CxxUtils/checker_macros.h" namespace Muon { - class TgcPrepDataReplicationAlg:public AthAlgorithm + class ATLAS_NOT_THREAD_SAFE TgcPrepDataReplicationAlg:public AthAlgorithm { public: TgcPrepDataReplicationAlg(const std::string& name, ISvcLocator* pSvcLocator); // Constructor diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx index 48d8d1a0b26c..7695ff270d6f 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx @@ -11,7 +11,7 @@ //================ Constructor ================================================= Muon::TgcPrepDataReplicationTool::TgcPrepDataReplicationTool (const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t, n, p) + : base_class(t, n, p) { for(int ibc = 0; ibc < BC_NUM; ibc++) m_tgcPrepDataContainer[ibc] = 0; } @@ -51,7 +51,7 @@ StatusCode Muon::TgcPrepDataReplicationTool::finalize() //================ Decoding ==================================================== -StatusCode Muon::TgcPrepDataReplicationTool::replicate() +StatusCode Muon::TgcPrepDataReplicationTool::replicate() const { bool hasContainer[BC_NUM] = {false}; ATH_MSG_VERBOSE("replicate"); @@ -82,7 +82,7 @@ StatusCode Muon::TgcPrepDataReplicationTool::replicate() } -StatusCode Muon::TgcPrepDataReplicationTool::convertAllBCto3BC() +StatusCode Muon::TgcPrepDataReplicationTool::convertAllBCto3BC() const { const Muon::TgcPrepDataContainer* tgcAll = 0; @@ -151,7 +151,7 @@ StatusCode Muon::TgcPrepDataReplicationTool::convertAllBCto3BC() } -StatusCode Muon::TgcPrepDataReplicationTool::convert3BCtoAllBC() +StatusCode Muon::TgcPrepDataReplicationTool::convert3BCtoAllBC() const { // cleanup m_tgcPrepDataContainer[BC_ALL]->cleanup(); @@ -226,7 +226,7 @@ StatusCode Muon::TgcPrepDataReplicationTool::convert3BCtoAllBC() Muon::TgcPrepData* -Muon::TgcPrepDataReplicationTool::makeTgcPrepData(Muon::TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap) +Muon::TgcPrepDataReplicationTool::makeTgcPrepData(Muon::TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap) const { Identifier channelId = (*itr)->identify(); IdentifierHash tgcHashId = (*itr)->collectionHash(); @@ -242,18 +242,3 @@ Muon::TgcPrepDataReplicationTool::makeTgcPrepData(Muon::TgcPrepDataCollection::c return newPrepData; } - - - - -StatusCode Muon::TgcPrepDataReplicationTool::queryInterface(const InterfaceID& riid, void** ppvIf) { - ATH_MSG_DEBUG("queryInterface()"); - if(ITgcPrepDataReplicationTool::interfaceID().versionMatch(riid)) { - *ppvIf = dynamic_cast<ITgcPrepDataReplicationTool*>(this); - addRef(); - ATH_MSG_DEBUG("InterfaceID successfully matched with ITgcPrepDataReplicationTool one."); - return StatusCode::SUCCESS; - } - - return AthAlgTool::queryInterface(riid, ppvIf); -} diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h index 99f0f0dc1db7..a55f00cb5704 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h @@ -11,11 +11,12 @@ #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "CxxUtils/checker_macros.h" namespace Muon { - class TgcPrepDataReplicationTool - : virtual public ITgcPrepDataReplicationTool, virtual public AthAlgTool + class ATLAS_NOT_THREAD_SAFE TgcPrepDataReplicationTool + : public extends<AthAlgTool, ITgcPrepDataReplicationTool> { public: /** Constructor */ @@ -24,17 +25,11 @@ namespace Muon /** Destructor */ virtual ~TgcPrepDataReplicationTool()=default; - /** Provide InterfaceID */ - static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; - - /** Query interface */ - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode replicate(); - virtual StatusCode convert3BCtoAllBC(); - virtual StatusCode convertAllBCto3BC(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode replicate() const override; + virtual StatusCode convert3BCtoAllBC() const; + virtual StatusCode convertAllBCto3BC() const; private: enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; @@ -45,7 +40,7 @@ namespace Muon TgcPrepDataContainer* m_tgcPrepDataContainer[BC_NUM]; /** Make new TgcPrepData */ - TgcPrepData* makeTgcPrepData(TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap); + TgcPrepData* makeTgcPrepData(TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap) const; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx index 41e840aa2b20..d9f1b69a44a3 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx @@ -12,7 +12,7 @@ //================ Constructor ================================================= Muon::TgcPrepDataReplicationTool3BCtoAllBC::TgcPrepDataReplicationTool3BCtoAllBC (const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t, n, p), + : base_class(t, n, p), m_3BCKeys{"dummy", "dummy", "dummy"}, m_AllBCKey("TGC_MeasurementsAllBCs") { @@ -40,12 +40,12 @@ StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::replicate() +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::replicate() const { return convert3BCtoAllBC(); } -StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() const { SG::WriteHandle<TgcPrepDataContainer> tgcPrepDataContainerAll(m_AllBCKey); @@ -107,16 +107,3 @@ StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() return StatusCode::SUCCESS; } -StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::queryInterface(const InterfaceID& riid, void** ppvIf) { - ATH_MSG_DEBUG("queryInterface()"); - if(ITgcPrepDataReplicationTool::interfaceID().versionMatch(riid)) { - *ppvIf = dynamic_cast<ITgcPrepDataReplicationTool*>(this); - addRef(); - ATH_MSG_DEBUG("InterfaceID successfully matched with ITgcPrepDataReplicationTool one."); - return StatusCode::SUCCESS; - } - - return AthAlgTool::queryInterface(riid, ppvIf); -} - - diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h index 34d5d3baf7a9..ef32e05dee35 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h @@ -11,11 +11,12 @@ #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "CxxUtils/checker_macros.h" namespace Muon { - class TgcPrepDataReplicationTool3BCtoAllBC - : virtual public ITgcPrepDataReplicationTool, virtual public AthAlgTool + class ATLAS_NOT_THREAD_SAFE TgcPrepDataReplicationTool3BCtoAllBC + : public extends<AthAlgTool, ITgcPrepDataReplicationTool> { public: /** Constructor */ @@ -24,15 +25,9 @@ namespace Muon /** Destructor */ virtual ~TgcPrepDataReplicationTool3BCtoAllBC()=default; - /** Provide InterfaceID */ - static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; - - /** Query interface */ - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override; - virtual StatusCode initialize() override; - virtual StatusCode replicate() override; - StatusCode convert3BCtoAllBC(); + virtual StatusCode replicate() const override; + StatusCode convert3BCtoAllBC() const; private: diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx index 0a78da92a2fe..5ef5a42173e8 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx @@ -13,7 +13,7 @@ //================ Constructor ================================================= Muon::TgcPrepDataReplicationToolAllBCto3BC::TgcPrepDataReplicationToolAllBCto3BC (const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t, n, p), + : base_class(t, n, p), m_3BCKeys{"dummy", "dummy", "dummy"}, m_AllBCKey("TGC_MeasurementsAllBCs") { @@ -41,12 +41,12 @@ StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::initialize() return StatusCode::SUCCESS; } -StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::replicate() +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::replicate() const { return convertAllBCto3BC(); } -StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC() +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC() const { SG::ReadHandle<TgcPrepDataContainer> tgcAll(m_AllBCKey); @@ -118,20 +118,3 @@ Muon::TgcPrepDataReplicationToolAllBCto3BC::makeTgcPrepData(Muon::TgcPrepDataCol return newPrepData; } - - - - -StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::queryInterface(const InterfaceID& riid, void** ppvIf) { - ATH_MSG_DEBUG("queryInterface()"); - if(ITgcPrepDataReplicationTool::interfaceID().versionMatch(riid)) { - *ppvIf = dynamic_cast<ITgcPrepDataReplicationTool*>(this); - addRef(); - ATH_MSG_DEBUG("InterfaceID successfully matched with ITgcPrepDataReplicationTool one."); - return StatusCode::SUCCESS; - } - - return AthAlgTool::queryInterface(riid, ppvIf); -} - - diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h index a3d6a0efc5a3..f2582e8e63ec 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h @@ -11,11 +11,12 @@ #include "MuonPrepRawData/TgcPrepDataContainer.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "CxxUtils/checker_macros.h" namespace Muon { - class TgcPrepDataReplicationToolAllBCto3BC - : virtual public ITgcPrepDataReplicationTool, virtual public AthAlgTool + class ATLAS_NOT_THREAD_SAFE TgcPrepDataReplicationToolAllBCto3BC + : public extends<AthAlgTool, ITgcPrepDataReplicationTool> { public: /** Constructor */ @@ -24,15 +25,9 @@ namespace Muon /** Destructor */ virtual ~TgcPrepDataReplicationToolAllBCto3BC()=default; - /** Provide InterfaceID */ - static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; - - /** Query interface */ - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override; - virtual StatusCode initialize() override; - virtual StatusCode replicate() override; - StatusCode convertAllBCto3BC(); + virtual StatusCode replicate() const override; + StatusCode convertAllBCto3BC() const; /** Make new TgcPrepData */ //Static to avoid code duplication with sister class static TgcPrepData* makeTgcPrepData(TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap); -- GitLab