From 3d84e7e4cf6e89f7a5d7e82c5576652dba23c07c Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Thu, 20 Apr 2017 16:36:23 +0200 Subject: [PATCH] AthenaPoolCnvSvc: Allow specifying name used for error messages. The MsgStream used for generating messages from AthenaPoolConverter had the name hardcoded as `AthenaPoolConverter'. In some cases, downstream code was using tricks to change this to something more meaningful. Add an optional argument to the converter constructors to allow overriding the default with a more appropriate name. --- .../AthenaPoolCnvSvc/AthenaPoolCnvSvc/AthenaPoolConverter.h | 3 ++- .../AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.h | 3 ++- .../AthenaPoolCnvSvc/T_AthenaPoolCnvBase.icc | 4 +++- .../AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.h | 3 ++- .../AthenaPoolCnvSvc/T_AthenaPoolCustCnv.icc | 4 +++- .../AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h | 4 +++- .../AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.icc | 3 ++- .../AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolConverter.cxx | 6 ++++-- 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/AthenaPoolConverter.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/AthenaPoolConverter.h index 7b16564fa98..70e85debb4f 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/AthenaPoolConverter.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/AthenaPoolConverter.h @@ -69,7 +69,8 @@ public: protected: /// Standard Service Constructor - AthenaPoolConverter(const CLID& id, ISvcLocator* pSvcLocator); + AthenaPoolConverter(const CLID& id, ISvcLocator* pSvcLocator, + const char* name = nullptr); /// Write an object into POOL. /// @param pObj [IN] pointer to the transient object. diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.h index 9db01715f53..89dbcb5435a 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.h @@ -25,7 +25,8 @@ class T_AthenaPoolCnvBase : public AthenaPoolConverter { protected: /// Constructor - T_AthenaPoolCnvBase(ISvcLocator* svcloc); + T_AthenaPoolCnvBase(ISvcLocator* svcloc, + const char* name = nullptr); /// Gaudi Service Interface method implementations: virtual StatusCode initialize(); diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.icc index b2a751d525c..54317ba9a02 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCnvBase.icc @@ -23,7 +23,9 @@ //__________________________________________________________________________ template <class T> -T_AthenaPoolCnvBase<T>::T_AthenaPoolCnvBase(ISvcLocator* svcloc) : AthenaPoolConverter(classID(), svcloc) { +T_AthenaPoolCnvBase<T>::T_AthenaPoolCnvBase(ISvcLocator* svcloc, + const char* name /*= nullptr*/) + : AthenaPoolConverter(classID(), svcloc, name) { } //______________________________________________________________________________ template <class T> diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.h index a9fe556da7b..feb3e8c37dc 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.h @@ -36,7 +36,8 @@ class T_AthenaPoolCustCnv : public T_AthenaPoolCnvBase<TRANS> { protected: /// Constructor - T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator); + T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator, + const char* name = nullptr); /// Gaudi Service Interface method implementations: virtual StatusCode initialize(); diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.icc index 58d0e2a53e5..b4527d2096e 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustCnv.icc @@ -23,7 +23,9 @@ //__________________________________________________________________________ template <class TRANS, class PERS> -T_AthenaPoolCustCnv<TRANS, PERS>::T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator) : T_AthenaPoolCnvBase<TRANS>(pSvcLocator) { +T_AthenaPoolCustCnv<TRANS, PERS>::T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator, + const char* name /*= nullptr*/) + : T_AthenaPoolCnvBase<TRANS>(pSvcLocator, name) { } //______________________________________________________________________________ template <class TRANS, class PERS> diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h index 706a632f1b7..b53031926fe 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h @@ -34,7 +34,9 @@ public: protected: /// Constructor /// @param svcloc [IN] Gaudi service locator - T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator); + /// @param name [IN] Optional name, for error reporting. + T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator, + const char* name = nullptr); // the 2 following methods are allowed to throw std::runtime_error diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.icc index 472e29d5269..513df695b3d 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.icc @@ -21,7 +21,8 @@ #include <stdexcept> template <class TRANS, class PERS> -T_AthenaPoolCustomCnv<TRANS, PERS>::T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator) : BaseType(pSvcLocator) { +T_AthenaPoolCustomCnv<TRANS, PERS>::T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator, + const char* name /*= nullptr*/) : BaseType(pSvcLocator, name) { } template <class TRANS, class PERS> diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolConverter.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolConverter.cxx index b22edf52c1e..e68d6bfdfa7 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolConverter.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolConverter.cxx @@ -129,9 +129,11 @@ long AthenaPoolConverter::storageType() { return(POOL_StorageType); } //__________________________________________________________________________ -AthenaPoolConverter::AthenaPoolConverter(const CLID& myCLID, ISvcLocator* pSvcLocator) : +AthenaPoolConverter::AthenaPoolConverter(const CLID& myCLID, ISvcLocator* pSvcLocator, + const char* name /*= nullptr*/) : ::Converter(POOL_StorageType, myCLID, pSvcLocator), - ::AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr), "AthenaPoolConverter"), + ::AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr), + name ? name : "AthenaPoolConverter"), m_athenaPoolCnvSvc("AthenaPoolCnvSvc", "AthenaPoolConverter"), m_placement(nullptr), m_placementHints(), -- GitLab