From b9db24bbcf43eaf293391b0c26a898453df7e7ec Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Mon, 28 Nov 2022 16:59:56 +0100 Subject: [PATCH] StoreGate: use std::string for key type in HandleKey Replace the `class K` template parameter in all auto-declaring HandleKey property constructors with plain `std::string`. We don't ever use anything else as SG key and this resolves ambiguities in case other constructor types are defined (see !58618 for discussion). --- Control/StoreGate/StoreGate/ReadCondHandleKey.h | 6 +++--- Control/StoreGate/StoreGate/ReadHandleKey.h | 10 +++++----- Control/StoreGate/StoreGate/ReadHandleKey.icc | 10 +++++----- Control/StoreGate/StoreGate/ReadMetaHandleKey.h | 5 ++--- Control/StoreGate/StoreGate/ThinningHandleKey.h | 6 +++--- Control/StoreGate/StoreGate/ThinningHandleKey.icc | 6 +++--- Control/StoreGate/StoreGate/TypelessWriteHandleKey.h | 6 +++--- Control/StoreGate/StoreGate/WriteCondHandleKey.h | 6 +++--- Control/StoreGate/StoreGate/WriteHandleKey.h | 6 +++--- Control/StoreGate/StoreGate/WriteHandleKey.icc | 6 +++--- 10 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Control/StoreGate/StoreGate/ReadCondHandleKey.h b/Control/StoreGate/StoreGate/ReadCondHandleKey.h index a6703869139d..4933ec53425b 100644 --- a/Control/StoreGate/StoreGate/ReadCondHandleKey.h +++ b/Control/StoreGate/StoreGate/ReadCondHandleKey.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef STOREGATE_READCONDHANDLEKEY_H @@ -39,11 +39,11 @@ namespace SG { * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> inline ReadCondHandleKey( OWNER* owner, std::string name, - const K& key={}, + const std::string& key={}, std::string doc="") : ReadCondHandleKey<T>( key ) { auto p = owner->declareProperty(std::move(name), *this, std::move(doc)); diff --git a/Control/StoreGate/StoreGate/ReadHandleKey.h b/Control/StoreGate/StoreGate/ReadHandleKey.h index 0abac517948b..14d713a7e1d4 100644 --- a/Control/StoreGate/StoreGate/ReadHandleKey.h +++ b/Control/StoreGate/StoreGate/ReadHandleKey.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** * @file StoreGate/ReadHandleKey.h @@ -64,11 +64,11 @@ public: * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> ReadHandleKey( OWNER* owner, const std::string& name, - const K& key = {}, + const std::string& key = {}, const std::string& doc = ""); @@ -109,12 +109,12 @@ protected: * This is meant to be used by @c ReadDecorHandleKey, to allow fixing the * CLID to a base class to avoid scheduler issues. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> ReadHandleKey( CLID clid, OWNER* owner, const std::string& name, - const K& key, + const std::string& key, const std::string& doc); }; diff --git a/Control/StoreGate/StoreGate/ReadHandleKey.icc b/Control/StoreGate/StoreGate/ReadHandleKey.icc index 8dca6e27be01..2d7c187d8aa1 100644 --- a/Control/StoreGate/StoreGate/ReadHandleKey.icc +++ b/Control/StoreGate/StoreGate/ReadHandleKey.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** * @file StoreGate/ReadHandleKey.icc @@ -61,12 +61,12 @@ ReadHandleKey<T>& ReadHandleKey<T>::operator= (const std::string& sgkey) * the store named by @c storeName is used. */ template <class T> -template <class OWNER, class K, +template <class OWNER, typename /*= typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type*/> inline ReadHandleKey<T>::ReadHandleKey( OWNER* owner, const std::string& name, - const K& key /* ={}*/, + const std::string& key /* ={}*/, const std::string& doc /*= ""*/) : ReadHandleKey<T>( key ) { @@ -106,13 +106,13 @@ ReadHandleKey<T>::ReadHandleKey (CLID clid, * CLID to a base class to avoid scheduler issues. */ template <class T> -template <class OWNER, class K, +template <class OWNER, typename /*= typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type*/> inline ReadHandleKey<T>::ReadHandleKey( CLID clid, OWNER* owner, const std::string& name, - const K& key, + const std::string& key, const std::string& doc) : ReadHandleKey<T>( clid, key, StoreID::storeName(StoreID::EVENT_STORE) ) { diff --git a/Control/StoreGate/StoreGate/ReadMetaHandleKey.h b/Control/StoreGate/StoreGate/ReadMetaHandleKey.h index 5a9f76915d6a..ac8c11a6feec 100644 --- a/Control/StoreGate/StoreGate/ReadMetaHandleKey.h +++ b/Control/StoreGate/StoreGate/ReadMetaHandleKey.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef STOREGATE_READMETAHANDLEKEY_H @@ -25,11 +25,10 @@ namespace SG { template < class OWNER - , class K , typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> inline ReadMetaHandleKey( OWNER* owner , std::string name - , const K& key={} + , const std::string& key={} , std::string doc="") : ReadMetaHandleKey<T>( key ) { auto p = owner->declareProperty(std::move(name), *this, std::move(doc)); diff --git a/Control/StoreGate/StoreGate/ThinningHandleKey.h b/Control/StoreGate/StoreGate/ThinningHandleKey.h index 5b45fc2ae954..0389bb2c46b5 100644 --- a/Control/StoreGate/StoreGate/ThinningHandleKey.h +++ b/Control/StoreGate/StoreGate/ThinningHandleKey.h @@ -1,6 +1,6 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** * @file StoreGate/ThinningHandleKey.h @@ -69,11 +69,11 @@ public: * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> ThinningHandleKey( OWNER* owner, const std::string& name, - const K& key, + const std::string& key, const std::string& doc); diff --git a/Control/StoreGate/StoreGate/ThinningHandleKey.icc b/Control/StoreGate/StoreGate/ThinningHandleKey.icc index 73381cf15689..6455e18c6892 100644 --- a/Control/StoreGate/StoreGate/ThinningHandleKey.icc +++ b/Control/StoreGate/StoreGate/ThinningHandleKey.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** * @file StoreGate/ThinningHandleKey.icc @@ -47,11 +47,11 @@ ThinningHandleKey<T>::ThinningHandleKey * the store named by @c storeName is used. */ template <class T> -template <class OWNER, class K, +template <class OWNER, typename /*= typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type*/> ThinningHandleKey<T>::ThinningHandleKey( OWNER* owner, const std::string& name, - const K& key, + const std::string& key, const std::string& doc) : Base (owner, name, key, doc) { diff --git a/Control/StoreGate/StoreGate/TypelessWriteHandleKey.h b/Control/StoreGate/StoreGate/TypelessWriteHandleKey.h index 160e0dfb40de..a991fe0b478e 100644 --- a/Control/StoreGate/StoreGate/TypelessWriteHandleKey.h +++ b/Control/StoreGate/StoreGate/TypelessWriteHandleKey.h @@ -1,6 +1,6 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration. */ /** * @file StoreGate/TypelessWriteHandleKey.h @@ -63,13 +63,13 @@ public: * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> inline TypelessWriteHandleKey( OWNER* owner, const std::string& name, CLID clid = CLID_NULL, - const K& key={}, + const std::string& key={}, const std::string& doc="") : TypelessWriteHandleKey(clid, key) { diff --git a/Control/StoreGate/StoreGate/WriteCondHandleKey.h b/Control/StoreGate/StoreGate/WriteCondHandleKey.h index 1d8d0b8dbb17..2c3b77e14aad 100644 --- a/Control/StoreGate/StoreGate/WriteCondHandleKey.h +++ b/Control/StoreGate/StoreGate/WriteCondHandleKey.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef STOREGATE_WRITECONDHANDLEKEY_H @@ -55,11 +55,11 @@ namespace SG { * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> inline WriteCondHandleKey( OWNER* owner, std::string name, - const K& key={}, + const std::string& key={}, std::string doc="") : WriteCondHandleKey<T>(key) { auto p = owner->declareProperty(std::move(name), *this, std::move(doc)); diff --git a/Control/StoreGate/StoreGate/WriteHandleKey.h b/Control/StoreGate/StoreGate/WriteHandleKey.h index 2f0dd4376766..1bdeb48f9e9b 100644 --- a/Control/StoreGate/StoreGate/WriteHandleKey.h +++ b/Control/StoreGate/StoreGate/WriteHandleKey.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -65,11 +65,11 @@ public: * separated by a "+": "MyStore+Obj". If no "+" is present * the store named by @c storeName is used. */ - template <class OWNER, class K, + template <class OWNER, typename = typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type> inline WriteHandleKey (OWNER* owner, std::string name, - const K& key={}, + const std::string& key={}, std::string doc=""); diff --git a/Control/StoreGate/StoreGate/WriteHandleKey.icc b/Control/StoreGate/StoreGate/WriteHandleKey.icc index 1814ed3a5111..077f163da24f 100644 --- a/Control/StoreGate/StoreGate/WriteHandleKey.icc +++ b/Control/StoreGate/StoreGate/WriteHandleKey.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -47,12 +47,12 @@ WriteHandleKey<T>::WriteHandleKey (const std::string& key /*= ""*/, * the store named by @c storeName is used. */ template <class T> -template <class OWNER, class K, +template <class OWNER, typename /*= typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>::type*/> inline WriteHandleKey<T>::WriteHandleKey( OWNER* owner, std::string name, - const K& key /*= {}*/, + const std::string& key /*= {}*/, std::string doc /*= ""*/) : WriteHandleKey<T> (key) { -- GitLab