From 99edb6c4b45cc58ec729247d689066af16ee500b Mon Sep 17 00:00:00 2001
From: Marco Clemencic <marco.clemencic@cern.ch>
Date: Sat, 1 Apr 2017 23:18:20 +0200
Subject: [PATCH] Dropped backward compatibility with XyzFactory classes

- require public constructor for components
- removed XyzFactory classes
- enabled warning for XyzFactory headers
- some clean up and modernization
---
 .../src/AlgExecStateSvc/AlgExecStateSvc.cpp   |  4 +--
 .../src/AlgExecStateSvc/AlgExecStateSvc.h     |  3 +-
 .../src/MessageSvc/InertMessageSvc.cpp        |  5 +---
 GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.cpp |  7 +----
 GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.h   |  1 -
 GaudiExamples/src/AlgTools/MyGaudiTool.h      |  1 -
 GaudiExamples/src/AlgTools/MyTool.h           |  1 -
 GaudiExamples/src/FileMgr/FileMgrTest.cpp     |  2 +-
 GaudiExamples/src/GSLTools/EqSolverGenAlg.cpp |  2 +-
 GaudiExamples/src/GSLTools/EqSolverGenAlg.h   |  1 -
 GaudiExamples/src/GSLTools/EqSolverIAlg.cpp   |  2 +-
 GaudiExamples/src/GSLTools/EqSolverIAlg.h     |  1 -
 GaudiExamples/src/GSLTools/EqSolverPAlg.cpp   |  4 +--
 GaudiExamples/src/GSLTools/EqSolverPAlg.h     |  1 -
 .../src/GSLTools/FuncMinimumGenAlg.cpp        |  4 +--
 .../src/GSLTools/FuncMinimumGenAlg.h          |  1 -
 .../src/GSLTools/FuncMinimumIAlg.cpp          |  2 +-
 GaudiExamples/src/GSLTools/FuncMinimumIAlg.h  |  1 -
 .../src/GSLTools/FuncMinimumPAlg.cpp          | 16 +---------
 GaudiExamples/src/GSLTools/FuncMinimumPAlg.h  |  6 +---
 GaudiExamples/src/IO/WriteHandleAlg.cpp       |  2 +-
 GaudiExamples/src/OpenCL/OpenCLAlg.cpp        |  8 +----
 GaudiExamples/src/PluginService/UseCases.cpp  | 26 -----------------
 GaudiHive/src/AlgResourcePool.cpp             |  6 +---
 GaudiHive/src/AvalancheSchedulerSvc.cpp       |  2 +-
 GaudiHive/src/ContextEventCounter.cpp         |  7 ++---
 GaudiHive/src/HLTEventLoopMgr.cpp             |  2 +-
 GaudiHive/src/HiveReadAlgorithm.cpp           | 13 +++++----
 GaudiHive/src/HiveSlimEventLoopMgr.cpp        |  3 +-
 GaudiHive/src/HiveTestAlgorithm.cpp           |  2 +-
 GaudiHive/src/HiveWhiteBoard.cpp              |  3 +-
 GaudiHive/src/IOBoundAlgSchedulerSvc.cpp      | 15 +---------
 GaudiHive/src/IOBoundAlgSchedulerSvc.h        |  8 ++---
 GaudiHive/src/PrecedenceSvc.cpp               |  9 +-----
 GaudiHive/src/PrecedenceSvc.h                 |  5 +---
 GaudiHive/src/ThreadPoolSvc.cpp               |  3 +-
 GaudiHive/src/ViewTester.h                    |  1 -
 GaudiKernel/GaudiKernel/AlgFactory.h          |  2 --
 GaudiKernel/GaudiKernel/AlgTool.h             | 22 --------------
 GaudiKernel/GaudiKernel/Algorithm.h           | 29 -------------------
 GaudiKernel/GaudiKernel/AudFactory.h          |  2 --
 GaudiKernel/GaudiKernel/Auditor.h             | 26 -----------------
 GaudiKernel/GaudiKernel/CnvFactory.h          |  2 --
 GaudiKernel/GaudiKernel/Converter.h           | 27 +----------------
 .../GaudiKernel/DeclareFactoryEntries.h       | 26 ++++++++---------
 GaudiKernel/GaudiKernel/Service.h             | 29 -------------------
 GaudiKernel/GaudiKernel/SvcFactory.h          |  2 --
 GaudiKernel/GaudiKernel/ToolFactory.h         |  2 --
 GaudiKernel/src/Lib/TsDataSvc.cpp             |  1 -
 GaudiMP/src/component/RecordOutputStream.cpp  |  2 +-
 GaudiMP/src/component/ReplayOutputStream.cpp  |  2 +-
 .../src/component/intel/IntelProfile.cpp      |  2 +-
 .../component/jemalloc/JemallocProfile.cpp    |  2 +-
 .../component/valgrind/CallgrindProfile.cpp   |  2 +-
 GaudiPython/src/Services/PythonScriptingSvc.h |  1 -
 GaudiSvc/src/FileMgr/FileMgr.cpp              |  2 +-
 GaudiSvc/src/THistSvc/THistSvc.h              |  3 --
 RootCnv/RootCnv/RootCnvSvc.h                  |  2 +-
 RootCnv/components/Components.cpp             | 11 ++-----
 RootCnv/src/RootCnvSvc.cpp                    |  1 -
 RootHistCnv/src/DirectoryCnv.cpp              |  2 +-
 RootHistCnv/src/RCWNTupleCnv.cpp              |  2 +-
 RootHistCnv/src/RDirectoryCnv.cpp             |  2 +-
 RootHistCnv/src/RFileCnv.cpp                  |  2 +-
 RootHistCnv/src/RHistogramCnv.cpp             | 10 +++----
 RootHistCnv/src/RRWNTupleCnv.cpp              |  2 +-
 66 files changed, 69 insertions(+), 331 deletions(-)
 delete mode 100644 GaudiExamples/src/PluginService/UseCases.cpp

diff --git a/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.cpp b/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.cpp
index 2c67cdde79..65b3725a2b 100644
--- a/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.cpp
+++ b/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.cpp
@@ -5,9 +5,7 @@
 #include "GaudiKernel/IHiveWhiteBoard.h"
 #include "GaudiKernel/ThreadLocalContext.h"
 
-#include "GaudiKernel/SvcFactory.h"
-
-DECLARE_SERVICE_FACTORY( AlgExecStateSvc )
+DECLARE_COMPONENT( AlgExecStateSvc )
 
 //=============================================================================
 
diff --git a/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h b/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h
index 3ad5ca7dff..bc155f04d3 100644
--- a/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h
+++ b/GaudiCoreSvc/src/AlgExecStateSvc/AlgExecStateSvc.h
@@ -11,12 +11,11 @@
 
 /** @class AlgExecStateSvc
   * @brief A service that keeps track of the execution state of Algorithm
-  *  *
+  *
   */
 class AlgExecStateSvc : public extends<Service, IAlgExecStateSvc>
 {
 public:
-  /// Constructor
   using extends::extends;
 
   typedef IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t;
diff --git a/GaudiCoreSvc/src/MessageSvc/InertMessageSvc.cpp b/GaudiCoreSvc/src/MessageSvc/InertMessageSvc.cpp
index fcd89d6641..6eee99334d 100644
--- a/GaudiCoreSvc/src/MessageSvc/InertMessageSvc.cpp
+++ b/GaudiCoreSvc/src/MessageSvc/InertMessageSvc.cpp
@@ -1,8 +1,5 @@
 // Include files
 
-// From Gaudi
-#include "GaudiKernel/SvcFactory.h"
-// local
 #include "InertMessageSvc.h"
 
 // ----------------------------------------------------------------------------
@@ -10,7 +7,7 @@
 //
 // 12/02/2013: Danilo Piparo
 // ----------------------------------------------------------------------------
-DECLARE_SERVICE_FACTORY( InertMessageSvc )
+DECLARE_COMPONENT( InertMessageSvc )
 
 //---------------------------------------------------------------------------
 
diff --git a/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.cpp b/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.cpp
index b925e72025..1ab0ee6167 100644
--- a/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.cpp
+++ b/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.cpp
@@ -1,8 +1,3 @@
-// Include files
-
-// From Gaudi
-#include "GaudiKernel/SvcFactory.h"
-// local
 #include "TBBMessageSvc.h"
 
 // ----------------------------------------------------------------------------
@@ -10,7 +5,7 @@
 //
 // 22/06/2012: Marco Clemencic
 // ----------------------------------------------------------------------------
-DECLARE_SERVICE_FACTORY( TBBMessageSvc )
+DECLARE_COMPONENT( TBBMessageSvc )
 
 void TBBMessageSvc::reportMessage( const Message& msg, int outputLevel )
 {
diff --git a/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.h b/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.h
index 6b9b04d3fb..8cbb366120 100644
--- a/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.h
+++ b/GaudiCoreSvc/src/MessageSvc/TBBMessageSvc.h
@@ -20,7 +20,6 @@
 class TBBMessageSvc : public MessageSvc
 {
 public:
-  /// Standard constructor
   using MessageSvc::MessageSvc;
 
   using MessageSvc::reportMessage;
diff --git a/GaudiExamples/src/AlgTools/MyGaudiTool.h b/GaudiExamples/src/AlgTools/MyGaudiTool.h
index 97a9fc98ea..d737348b3e 100644
--- a/GaudiExamples/src/AlgTools/MyGaudiTool.h
+++ b/GaudiExamples/src/AlgTools/MyGaudiTool.h
@@ -28,7 +28,6 @@ public:
   StatusCode initialize() override;
   StatusCode finalize() override;
 
-protected:
   /// Standard destructor
   ~MyGaudiTool() override;
 
diff --git a/GaudiExamples/src/AlgTools/MyTool.h b/GaudiExamples/src/AlgTools/MyTool.h
index 16c5f8f257..f1b32e702c 100644
--- a/GaudiExamples/src/AlgTools/MyTool.h
+++ b/GaudiExamples/src/AlgTools/MyTool.h
@@ -25,7 +25,6 @@ public:
   StatusCode initialize() override;
   StatusCode finalize() override;
 
-protected:
   /// Standard destructor
   ~MyTool() override;
 
diff --git a/GaudiExamples/src/FileMgr/FileMgrTest.cpp b/GaudiExamples/src/FileMgr/FileMgrTest.cpp
index 0b947d211e..8d964a6c22 100644
--- a/GaudiExamples/src/FileMgr/FileMgrTest.cpp
+++ b/GaudiExamples/src/FileMgr/FileMgrTest.cpp
@@ -13,7 +13,7 @@
 
 // Static Factory declaration
 
-DECLARE_ALGORITHM_FACTORY( FileMgrTest )
+DECLARE_COMPONENT( FileMgrTest )
 
 ///////////////////////////////////////////////////////////////////////////
 
diff --git a/GaudiExamples/src/GSLTools/EqSolverGenAlg.cpp b/GaudiExamples/src/GSLTools/EqSolverGenAlg.cpp
index e27e494774..7ec4396ad7 100644
--- a/GaudiExamples/src/GSLTools/EqSolverGenAlg.cpp
+++ b/GaudiExamples/src/GSLTools/EqSolverGenAlg.cpp
@@ -18,7 +18,7 @@
 using namespace Genfun;
 
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( EqSolverGenAlg )
+DECLARE_COMPONENT( EqSolverGenAlg )
 
 typedef Genfun::AbsFunction GenFunc;
 
diff --git a/GaudiExamples/src/GSLTools/EqSolverGenAlg.h b/GaudiExamples/src/GSLTools/EqSolverGenAlg.h
index a68e0e6c8d..78bef1314c 100644
--- a/GaudiExamples/src/GSLTools/EqSolverGenAlg.h
+++ b/GaudiExamples/src/GSLTools/EqSolverGenAlg.h
@@ -23,7 +23,6 @@ class EqSolverGenAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
   using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
diff --git a/GaudiExamples/src/GSLTools/EqSolverIAlg.cpp b/GaudiExamples/src/GSLTools/EqSolverIAlg.cpp
index 80353ad0c1..e16ad7b122 100644
--- a/GaudiExamples/src/GSLTools/EqSolverIAlg.cpp
+++ b/GaudiExamples/src/GSLTools/EqSolverIAlg.cpp
@@ -228,4 +228,4 @@ StatusCode EqSolverIAlg::finalize()
 
 //=============================================================================
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( EqSolverIAlg )
+DECLARE_COMPONENT( EqSolverIAlg )
diff --git a/GaudiExamples/src/GSLTools/EqSolverIAlg.h b/GaudiExamples/src/GSLTools/EqSolverIAlg.h
index 1471c3e97f..bea5929e15 100644
--- a/GaudiExamples/src/GSLTools/EqSolverIAlg.h
+++ b/GaudiExamples/src/GSLTools/EqSolverIAlg.h
@@ -24,7 +24,6 @@ class EqSolverIAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
   using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
diff --git a/GaudiExamples/src/GSLTools/EqSolverPAlg.cpp b/GaudiExamples/src/GSLTools/EqSolverPAlg.cpp
index f38c3a1507..31915f5224 100644
--- a/GaudiExamples/src/GSLTools/EqSolverPAlg.cpp
+++ b/GaudiExamples/src/GSLTools/EqSolverPAlg.cpp
@@ -1,5 +1,3 @@
-// $Id: EqSolverPAlg.cpp,v 1.4 2006/01/10 19:58:26 hmd Exp $
-
 // Include files
 
 // from Gaudi
@@ -21,7 +19,7 @@
 using namespace Genfun;
 
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( EqSolverPAlg )
+DECLARE_COMPONENT( EqSolverPAlg )
 
 //=============================================================================
 typedef Genfun::AbsFunction GenFunc;
diff --git a/GaudiExamples/src/GSLTools/EqSolverPAlg.h b/GaudiExamples/src/GSLTools/EqSolverPAlg.h
index 5ac309140a..ea99bb6fff 100644
--- a/GaudiExamples/src/GSLTools/EqSolverPAlg.h
+++ b/GaudiExamples/src/GSLTools/EqSolverPAlg.h
@@ -24,7 +24,6 @@ class EqSolverPAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
   using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.cpp b/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.cpp
index e9c8800c93..806f11ce63 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.cpp
+++ b/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.cpp
@@ -1,5 +1,3 @@
-// $Id: FuncMinimumGenAlg.cpp,v 1.3 2006/01/10 19:58:26 hmd Exp $
-
 // Include files
 // from Gaudi
 #include "GaudiGSL/IFuncMinimum.h"
@@ -155,4 +153,4 @@ StatusCode FuncMinimumGenAlg::finalize()
 
 //=============================================================================
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( FuncMinimumGenAlg )
+DECLARE_COMPONENT( FuncMinimumGenAlg )
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.h b/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.h
index 859a277860..4b20ff18b3 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.h
+++ b/GaudiExamples/src/GSLTools/FuncMinimumGenAlg.h
@@ -24,7 +24,6 @@ class FuncMinimumGenAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
   using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumIAlg.cpp b/GaudiExamples/src/GSLTools/FuncMinimumIAlg.cpp
index 292b8c32e4..09aad03437 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumIAlg.cpp
+++ b/GaudiExamples/src/GSLTools/FuncMinimumIAlg.cpp
@@ -188,4 +188,4 @@ StatusCode FuncMinimumIAlg::finalize()
 
 //=============================================================================
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( FuncMinimumIAlg )
+DECLARE_COMPONENT( FuncMinimumIAlg )
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumIAlg.h b/GaudiExamples/src/GSLTools/FuncMinimumIAlg.h
index 56a04aee96..43a96d38c4 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumIAlg.h
+++ b/GaudiExamples/src/GSLTools/FuncMinimumIAlg.h
@@ -24,7 +24,6 @@ class FuncMinimumIAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
   using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumPAlg.cpp b/GaudiExamples/src/GSLTools/FuncMinimumPAlg.cpp
index 58e9a110ef..974b7e16ce 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumPAlg.cpp
+++ b/GaudiExamples/src/GSLTools/FuncMinimumPAlg.cpp
@@ -1,5 +1,3 @@
-// $Id: FuncMinimumPAlg.cpp,v 1.4 2006/01/10 19:58:27 hmd Exp $
-
 // Include files
 // from Gaudi
 #include "GaudiGSL/IFuncMinimum.h"
@@ -25,18 +23,6 @@ using namespace CLHEP;
  */
 //-----------------------------------------------------------------------------
 
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-FuncMinimumPAlg::FuncMinimumPAlg( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator )
-{
-}
-
-//=============================================================================
-// Destructor
-//=============================================================================
-FuncMinimumPAlg::~FuncMinimumPAlg() {}
-
 //=============================================================================
 // Our function
 double function( const std::vector<double>& x ) { return 10 * x[0] * x[0] + 20 * x[1] * x[1] + 40; }
@@ -147,4 +133,4 @@ StatusCode FuncMinimumPAlg::finalize()
 
 //=============================================================================
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( FuncMinimumPAlg )
+DECLARE_COMPONENT( FuncMinimumPAlg )
diff --git a/GaudiExamples/src/GSLTools/FuncMinimumPAlg.h b/GaudiExamples/src/GSLTools/FuncMinimumPAlg.h
index 7cb37d363f..3e6a3c8c7f 100644
--- a/GaudiExamples/src/GSLTools/FuncMinimumPAlg.h
+++ b/GaudiExamples/src/GSLTools/FuncMinimumPAlg.h
@@ -24,16 +24,12 @@ class FuncMinimumPAlg : public Algorithm
 {
 
 public:
-  /// Standard constructor
-  FuncMinimumPAlg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  ~FuncMinimumPAlg() override; ///< Destructor
+  using Algorithm::Algorithm;
 
   StatusCode initialize() override; ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
   StatusCode finalize() override;   ///< Algorithm finalization
 
-protected:
 private:
   IFuncMinimum* m_privateTool;
   IFuncMinimum* m_publicTool;
diff --git a/GaudiExamples/src/IO/WriteHandleAlg.cpp b/GaudiExamples/src/IO/WriteHandleAlg.cpp
index ed9dba4f9c..8a177247e4 100644
--- a/GaudiExamples/src/IO/WriteHandleAlg.cpp
+++ b/GaudiExamples/src/IO/WriteHandleAlg.cpp
@@ -7,7 +7,7 @@
 
 #include "WriteHandleAlg.h"
 
-DECLARE_ALGORITHM_FACTORY( WriteHandleAlg )
+DECLARE_COMPONENT( WriteHandleAlg )
 
 StatusCode WriteHandleAlg::execute() // the execution of the algorithm
 {
diff --git a/GaudiExamples/src/OpenCL/OpenCLAlg.cpp b/GaudiExamples/src/OpenCL/OpenCLAlg.cpp
index a1cc425443..cdfad2b799 100644
--- a/GaudiExamples/src/OpenCL/OpenCLAlg.cpp
+++ b/GaudiExamples/src/OpenCL/OpenCLAlg.cpp
@@ -106,10 +106,4 @@ namespace Gaudi
   }
 }
 
-namespace Gaudi
-{
-  namespace Examples
-  {
-    DECLARE_COMPONENT( OpenCLAlg )
-  }
-}
+DECLARE_COMPONENT( Gaudi::Examples::OpenCLAlg )
diff --git a/GaudiExamples/src/PluginService/UseCases.cpp b/GaudiExamples/src/PluginService/UseCases.cpp
deleted file mode 100644
index 03f6cde289..0000000000
--- a/GaudiExamples/src/PluginService/UseCases.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/// Test file to ensure that the Plugin Service can work as a drop in
-/// replacement for the old one.
-
-#include "GaudiKernel/Algorithm.h"
-
-template <class T>
-class AlgFactory;
-
-namespace GaudiTesting
-{
-  namespace PluginService
-  {
-    class Algorithm1 : public Algorithm
-    {
-    private:
-      using Algorithm::Algorithm;
-      friend class AlgFactory<Algorithm1>;
-
-    public:
-      StatusCode execute() override { return StatusCode::SUCCESS; }
-    };
-
-    DECLARE_ALGORITHM_FACTORY( Algorithm1 )
-    DECLARE_NAMED_ALGORITHM_FACTORY( Algorithm1, Named1 )
-  }
-}
diff --git a/GaudiHive/src/AlgResourcePool.cpp b/GaudiHive/src/AlgResourcePool.cpp
index c05e611a91..09a2b2b003 100644
--- a/GaudiHive/src/AlgResourcePool.cpp
+++ b/GaudiHive/src/AlgResourcePool.cpp
@@ -1,10 +1,6 @@
-// Include Files
-
-// Framework
 #include "AlgResourcePool.h"
 #include "GaudiAlg/GaudiSequencer.h"
 #include "GaudiKernel/ISvcLocator.h"
-#include "GaudiKernel/SvcFactory.h"
 
 // C++
 #include <functional>
@@ -13,7 +9,7 @@
 // DP TODO: Manage smartifs and not pointers to algos
 
 // Instantiation of a static factory class used by clients to create instances of this service
-DECLARE_SERVICE_FACTORY( AlgResourcePool )
+DECLARE_COMPONENT( AlgResourcePool )
 
 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
 #define DEBUG_MSG ON_DEBUG debug()
diff --git a/GaudiHive/src/AvalancheSchedulerSvc.cpp b/GaudiHive/src/AvalancheSchedulerSvc.cpp
index 43e750c38e..dca764e22c 100644
--- a/GaudiHive/src/AvalancheSchedulerSvc.cpp
+++ b/GaudiHive/src/AvalancheSchedulerSvc.cpp
@@ -26,7 +26,7 @@
 #include "tbb/task_scheduler_init.h"
 
 // Instantiation of a static factory class used by clients to create instances of this service
-DECLARE_SERVICE_FACTORY( AvalancheSchedulerSvc )
+DECLARE_COMPONENT( AvalancheSchedulerSvc )
 
 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
diff --git a/GaudiHive/src/ContextEventCounter.cpp b/GaudiHive/src/ContextEventCounter.cpp
index 14cdfa73ee..310b06bba7 100644
--- a/GaudiHive/src/ContextEventCounter.cpp
+++ b/GaudiHive/src/ContextEventCounter.cpp
@@ -1,6 +1,3 @@
-// Include files
-
-// local
 #include "ContextEventCounter.h"
 
 // ----------------------------------------------------------------------------
@@ -8,8 +5,8 @@
 //
 // 27/10/2013: Marco Clemencic
 // ----------------------------------------------------------------------------
-DECLARE_ALGORITHM_FACTORY( ContextEventCounterPtr )
-DECLARE_ALGORITHM_FACTORY( ContextEventCounterData )
+DECLARE_COMPONENT( ContextEventCounterPtr )
+DECLARE_COMPONENT( ContextEventCounterData )
 
 // ============================================================================
 // Main execution
diff --git a/GaudiHive/src/HLTEventLoopMgr.cpp b/GaudiHive/src/HLTEventLoopMgr.cpp
index 5a12bd96c9..33236b4bc8 100644
--- a/GaudiHive/src/HLTEventLoopMgr.cpp
+++ b/GaudiHive/src/HLTEventLoopMgr.cpp
@@ -35,7 +35,7 @@
 #include "GaudiHive/HLTEventLoopMgr.h"
 
 // Instantiation of a static factory class used by clients to create instances of this service
-DECLARE_SERVICE_FACTORY( HLTEventLoopMgr )
+DECLARE_COMPONENT( HLTEventLoopMgr )
 
 namespace
 {
diff --git a/GaudiHive/src/HiveReadAlgorithm.cpp b/GaudiHive/src/HiveReadAlgorithm.cpp
index 5e67bb189c..9fa8876e7d 100644
--- a/GaudiHive/src/HiveReadAlgorithm.cpp
+++ b/GaudiHive/src/HiveReadAlgorithm.cpp
@@ -5,16 +5,19 @@
 class GAUDI_API HiveReadAlgorithm : public GaudiAlgorithm
 {
 public:
-  HiveReadAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) : GaudiAlgorithm( name, pSvcLocator ) {}
-  ~HiveReadAlgorithm() override {}
+  using GaudiAlgorithm::GaudiAlgorithm;
   StatusCode initialize() override;
   StatusCode execute() override;
-  StatusCode finalize() override { return StatusCode::SUCCESS; }
 };
 
-DECLARE_ALGORITHM_FACTORY( HiveReadAlgorithm )
+DECLARE_COMPONENT( HiveReadAlgorithm )
 
-StatusCode HiveReadAlgorithm::initialize() { return evtSvc()->addPreLoadItem( DataStoreItem( "/Event", 99 ) ); }
+StatusCode HiveReadAlgorithm::initialize()
+{
+  StatusCode sc = GaudiAlgorithm::initialize();
+  if ( !sc ) return sc;
+  return evtSvc()->addPreLoadItem( DataStoreItem( "/Event", 99 ) );
+}
 
 StatusCode HiveReadAlgorithm::execute()
 {
diff --git a/GaudiHive/src/HiveSlimEventLoopMgr.cpp b/GaudiHive/src/HiveSlimEventLoopMgr.cpp
index 2b42ea3fc0..8159b6345d 100644
--- a/GaudiHive/src/HiveSlimEventLoopMgr.cpp
+++ b/GaudiHive/src/HiveSlimEventLoopMgr.cpp
@@ -13,7 +13,6 @@
 #include "GaudiKernel/Incident.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/SmartIF.h"
-#include "GaudiKernel/SvcFactory.h"
 
 #include "HistogramAgent.h"
 
@@ -30,7 +29,7 @@
 #include <chrono>
 
 // Instantiation of a static factory class used by clients to create instances of this service
-DECLARE_SERVICE_FACTORY( HiveSlimEventLoopMgr )
+DECLARE_COMPONENT( HiveSlimEventLoopMgr )
 
 #define ON_DEBUG if ( UNLIKELY( outputLevel() <= MSG::DEBUG ) )
 #define ON_VERBOSE if ( UNLIKELY( outputLevel() <= MSG::VERBOSE ) )
diff --git a/GaudiHive/src/HiveTestAlgorithm.cpp b/GaudiHive/src/HiveTestAlgorithm.cpp
index 53a5d4d860..48eced70a8 100644
--- a/GaudiHive/src/HiveTestAlgorithm.cpp
+++ b/GaudiHive/src/HiveTestAlgorithm.cpp
@@ -4,7 +4,7 @@
 
 #include <atomic>
 
-DECLARE_ALGORITHM_FACTORY( HiveTestAlgorithm )
+DECLARE_COMPONENT( HiveTestAlgorithm )
 
 using namespace std;
 
diff --git a/GaudiHive/src/HiveWhiteBoard.cpp b/GaudiHive/src/HiveWhiteBoard.cpp
index ab566a0805..6be8762a7b 100644
--- a/GaudiHive/src/HiveWhiteBoard.cpp
+++ b/GaudiHive/src/HiveWhiteBoard.cpp
@@ -10,7 +10,6 @@
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/Service.h"
 #include "GaudiKernel/SmartIF.h"
-#include "GaudiKernel/SvcFactory.h"
 #include "GaudiKernel/TypeNameString.h"
 #include "Rtypes.h"
 #include "ThreadLocalStorage.h"
@@ -721,4 +720,4 @@ public:
 
 // Instantiation of a static factory class used by clients to create
 // instances of this service
-DECLARE_SERVICE_FACTORY( HiveWhiteBoard )
+DECLARE_COMPONENT( HiveWhiteBoard )
diff --git a/GaudiHive/src/IOBoundAlgSchedulerSvc.cpp b/GaudiHive/src/IOBoundAlgSchedulerSvc.cpp
index 7f35dbff1a..a9e204d3e9 100644
--- a/GaudiHive/src/IOBoundAlgSchedulerSvc.cpp
+++ b/GaudiHive/src/IOBoundAlgSchedulerSvc.cpp
@@ -10,25 +10,12 @@
 #include "GaudiKernel/Algorithm.h" // will be IAlgorithm if context getter promoted to interface
 #include "GaudiKernel/IAlgorithm.h"
 #include "GaudiKernel/IDataManagerSvc.h"
-#include "GaudiKernel/SvcFactory.h"
 
 // Local
 #include "IOBoundAlgSchedulerSvc.h"
 
 // Instantiation of a static factory class used by clients to create instances of this service
-DECLARE_SERVICE_FACTORY( IOBoundAlgSchedulerSvc )
-
-//===========================================================================
-// Infrastructure methods
-
-IOBoundAlgSchedulerSvc::IOBoundAlgSchedulerSvc( const std::string& name, ISvcLocator* svcLoc )
-    : base_class( name, svcLoc ), m_isActive( false )
-{
-}
-
-//---------------------------------------------------------------------------
-IOBoundAlgSchedulerSvc::~IOBoundAlgSchedulerSvc() {}
-//---------------------------------------------------------------------------
+DECLARE_COMPONENT( IOBoundAlgSchedulerSvc )
 
 /**
  * Here, among some "bureaucracy" operations, the scheduler is activated,
diff --git a/GaudiHive/src/IOBoundAlgSchedulerSvc.h b/GaudiHive/src/IOBoundAlgSchedulerSvc.h
index 65e7aadc2b..064e1957c1 100644
--- a/GaudiHive/src/IOBoundAlgSchedulerSvc.h
+++ b/GaudiHive/src/IOBoundAlgSchedulerSvc.h
@@ -22,14 +22,10 @@
  *  @author  Illya Shapoval
  *  @version 1.0
  */
-class IOBoundAlgSchedulerSvc : public extends1<Service, IAccelerator>
+class IOBoundAlgSchedulerSvc : public extends<Service, IAccelerator>
 {
 public:
-  /// Constructor
-  IOBoundAlgSchedulerSvc( const std::string& name, ISvcLocator* svc );
-
-  /// Destructor
-  ~IOBoundAlgSchedulerSvc() override;
+  using extends::extends;
 
   /// Initialise
   StatusCode initialize() override;
diff --git a/GaudiHive/src/PrecedenceSvc.cpp b/GaudiHive/src/PrecedenceSvc.cpp
index 5e0813df21..3bc7826a50 100644
--- a/GaudiHive/src/PrecedenceSvc.cpp
+++ b/GaudiHive/src/PrecedenceSvc.cpp
@@ -3,18 +3,11 @@
 #include "PRGraphVisitors.h"
 
 #include "GaudiKernel/Algorithm.h"
-#include "GaudiKernel/SvcFactory.h"
 
 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
 
-DECLARE_SERVICE_FACTORY( PrecedenceSvc )
-
-// ============================================================================
-// Standard constructor, initializes variables
-// ============================================================================
-
-PrecedenceSvc::PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
+DECLARE_COMPONENT( PrecedenceSvc )
 
 // ============================================================================
 // Initialization
diff --git a/GaudiHive/src/PrecedenceSvc.h b/GaudiHive/src/PrecedenceSvc.h
index 9bd7d57198..276274afbc 100644
--- a/GaudiHive/src/PrecedenceSvc.h
+++ b/GaudiHive/src/PrecedenceSvc.h
@@ -23,10 +23,7 @@ class PrecedenceSvc : public extends<Service, IPrecedenceSvc>
 
 public:
   /// Constructor
-  PrecedenceSvc( const std::string& name, ISvcLocator* svc );
-
-  /// Destructor
-  ~PrecedenceSvc() = default;
+  PrecedenceSvc( const std::string& name, ISvcLocator* svcLoc ) : base_class( name, svcLoc ) {}
 
   /// Initialize
   StatusCode initialize() override;
diff --git a/GaudiHive/src/ThreadPoolSvc.cpp b/GaudiHive/src/ThreadPoolSvc.cpp
index ebaccc74c8..b2413d1129 100644
--- a/GaudiHive/src/ThreadPoolSvc.cpp
+++ b/GaudiHive/src/ThreadPoolSvc.cpp
@@ -1,7 +1,6 @@
 #include "ThreadPoolSvc.h"
 
 #include "GaudiKernel/ConcurrencyFlags.h"
-#include "GaudiKernel/SvcFactory.h"
 #include "ThreadInitTask.h"
 
 #include "tbb/task.h"
@@ -12,7 +11,7 @@
 
 using namespace tbb;
 
-DECLARE_SERVICE_FACTORY( ThreadPoolSvc )
+DECLARE_COMPONENT( ThreadPoolSvc )
 
 //=============================================================================
 
diff --git a/GaudiHive/src/ViewTester.h b/GaudiHive/src/ViewTester.h
index c557ca24b2..bd513718de 100644
--- a/GaudiHive/src/ViewTester.h
+++ b/GaudiHive/src/ViewTester.h
@@ -1,6 +1,5 @@
 
 #include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/AlgFactory.h"
 #include "GaudiKernel/IScheduler.h"
 #include "GaudiKernel/RegistryEntry.h"
 #include "GaudiKernel/RndmGenerators.h"
diff --git a/GaudiKernel/GaudiKernel/AlgFactory.h b/GaudiKernel/GaudiKernel/AlgFactory.h
index c0cdc0888a..b5f6708a1c 100644
--- a/GaudiKernel/GaudiKernel/AlgFactory.h
+++ b/GaudiKernel/GaudiKernel/AlgFactory.h
@@ -1,8 +1,6 @@
 #ifndef GAUDIKERNEL_ALGFACTORY_H
 #define GAUDIKERNEL_ALGFACTORY_H
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif // GAUDIKERNEL_ALGFACTORY_H
diff --git a/GaudiKernel/GaudiKernel/AlgTool.h b/GaudiKernel/GaudiKernel/AlgTool.h
index 2a54bf9f50..0cdf7dbe6c 100644
--- a/GaudiKernel/GaudiKernel/AlgTool.h
+++ b/GaudiKernel/GaudiKernel/AlgTool.h
@@ -335,26 +335,4 @@ private:
   Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::CONFIGURED; ///< state of the Tool
 };
 
-#ifndef GAUDI_NEW_PLUGIN_SERVICE
-template <class T>
-struct ToolFactory {
-  template <typename S, typename... Args>
-  static typename S::ReturnType create( Args&&... args )
-  {
-    return new T( std::forward<Args>( args )... );
-  }
-};
-
-// Macros to declare component factories
-#define DECLARE_TOOL_FACTORY( x ) DECLARE_FACTORY_WITH_CREATOR( x, ToolFactory<x>, AlgTool::Factory )
-#define DECLARE_NAMESPACE_TOOL_FACTORY( n, x ) DECLARE_TOOL_FACTORY( n::x )
-
-#else
-
-// Macros to declare component factories
-#define DECLARE_TOOL_FACTORY( x ) DECLARE_COMPONENT( x )
-#define DECLARE_NAMESPACE_TOOL_FACTORY( n, x ) DECLARE_COMPONENT( n::x )
-
-#endif
-
 #endif // GAUDIKERNEL_ALGTOOL_H
diff --git a/GaudiKernel/GaudiKernel/Algorithm.h b/GaudiKernel/GaudiKernel/Algorithm.h
index 7fa208e0b0..da02d4876d 100644
--- a/GaudiKernel/GaudiKernel/Algorithm.h
+++ b/GaudiKernel/GaudiKernel/Algorithm.h
@@ -621,33 +621,4 @@ private:
   Algorithm& operator=( const Algorithm& rhs ) = delete;
 };
 
-#ifndef GAUDI_NEW_PLUGIN_SERVICE
-template <class T>
-class AlgFactory
-{
-public:
-#ifndef __REFLEX__
-  template <typename S, typename... Args>
-  static typename S::ReturnType create( Args&&... args )
-  {
-    return new T( std::forward<Args>( args )... );
-  }
-#endif
-};
-
-// Macros to declare component factories
-#define DECLARE_ALGORITHM_FACTORY( x ) DECLARE_FACTORY_WITH_CREATOR( x, AlgFactory<x>, Algorithm::Factory )
-#define DECLARE_NAMED_ALGORITHM_FACTORY( x, n )                                                                        \
-  DECLARE_FACTORY_WITH_CREATOR_AND_ID( x, AlgFactory<x>, #n, Algorithm::Factory )
-#define DECLARE_NAMESPACE_ALGORITHM_FACTORY( n, x ) DECLARE_ALGORITHM_FACTORY( n::x )
-
-#else
-
-// Macros to declare component factories
-#define DECLARE_ALGORITHM_FACTORY( x ) DECLARE_COMPONENT( x )
-#define DECLARE_NAMED_ALGORITHM_FACTORY( x, n ) DECLARE_COMPONENT_WITH_ID( x, #n )
-#define DECLARE_NAMESPACE_ALGORITHM_FACTORY( n, x ) DECLARE_COMPONENT( n::x )
-
-#endif
-
 #endif // GAUDIKERNEL_ALGORITHM_H
diff --git a/GaudiKernel/GaudiKernel/AudFactory.h b/GaudiKernel/GaudiKernel/AudFactory.h
index 851a31faa2..bf71e18ae0 100644
--- a/GaudiKernel/GaudiKernel/AudFactory.h
+++ b/GaudiKernel/GaudiKernel/AudFactory.h
@@ -1,8 +1,6 @@
 #ifndef GAUDIKERNEL_AUDFACTORY_H
 #define GAUDIKERNEL_AUDFACTORY_H
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif // GAUDIKERNEL_AUDFACTORY_H
diff --git a/GaudiKernel/GaudiKernel/Auditor.h b/GaudiKernel/GaudiKernel/Auditor.h
index 7b3a23c29b..b5a1ee7064 100644
--- a/GaudiKernel/GaudiKernel/Auditor.h
+++ b/GaudiKernel/GaudiKernel/Auditor.h
@@ -143,30 +143,4 @@ private:
   bool m_isFinalized   = false; ///< Auditor has been finalized flag
 };
 
-#ifndef GAUDI_NEW_PLUGIN_SERVICE
-template <class T>
-class AudFactory
-{
-public:
-#ifndef __REFLEX__
-  template <typename S, typename... Args>
-  static typename S::ReturnType create( Args&&... args )
-  {
-    return new T( std::forward<Args>( args )... );
-  }
-#endif
-};
-
-// Macros to declare component factories
-#define DECLARE_AUDITOR_FACTORY( x ) DECLARE_FACTORY_WITH_CREATOR( x, AudFactory<x>, Auditor::Factory )
-#define DECLARE_NAMESPACE_AUDITOR_FACTORY( n, x ) DECLARE_AUDITOR_FACTORY( n::x )
-
-#else
-
-// macros to declare factories
-#define DECLARE_AUDITOR_FACTORY( x ) DECLARE_COMPONENT( x )
-#define DECLARE_NAMESPACE_AUDITOR_FACTORY( n, x ) DECLARE_COMPONENT( n::x )
-
-#endif
-
 #endif // GAUDIKERNEL_AUDITOR_H
diff --git a/GaudiKernel/GaudiKernel/CnvFactory.h b/GaudiKernel/GaudiKernel/CnvFactory.h
index 57f254f73a..24640d1caa 100644
--- a/GaudiKernel/GaudiKernel/CnvFactory.h
+++ b/GaudiKernel/GaudiKernel/CnvFactory.h
@@ -1,8 +1,6 @@
 #ifndef GAUDIKERNEL_CNVFACTORY_H
 #define GAUDIKERNEL_CNVFACTORY_H
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif // GAUDIKERNEL_CNVFACTORY_H
diff --git a/GaudiKernel/GaudiKernel/Converter.h b/GaudiKernel/GaudiKernel/Converter.h
index 4b7c0479bc..a2ffebab04 100644
--- a/GaudiKernel/GaudiKernel/Converter.h
+++ b/GaudiKernel/GaudiKernel/Converter.h
@@ -153,32 +153,7 @@ inline std::ostream& operator<<( std::ostream& s, const ConverterID& id )
   return s << "CNV_" << id.m_stype << "_" << id.m_clid;
 }
 
-#ifndef GAUDI_NEW_PLUGIN_SERVICE
-template <class T>
-class CnvFactory final
-{
-public:
-#ifndef __REFLEX__
-  template <typename S, typename... Args>
-  static typename S::ReturnType create( Args&&... a1 )
-  {
-    return new T( std::forward<Args>( a1 )... );
-  }
-#endif
-};
-
-// Macro to declare component factories
-#define DECLARE_CONVERTER_FACTORY( x )                                                                                 \
-  DECLARE_FACTORY_WITH_CREATOR_AND_ID( x, CnvFactory<x>, ConverterID( x::storageType(), x::classID() ),                \
-                                       Converter::Factory )
-#define DECLARE_NAMESPACE_CONVERTER_FACTORY( n, x ) DECLARE_CONVERTER_FACTORY( n::x )
-
-#else
-
 // Macro to declare component factories
-#define DECLARE_CONVERTER_FACTORY( x ) DECLARE_COMPONENT_WITH_ID( x, ConverterID( x::storageType(), x::classID() ) )
-#define DECLARE_NAMESPACE_CONVERTER_FACTORY( n, x ) DECLARE_CONVERTER_FACTORY( n::x )
-
-#endif
+#define DECLARE_CONVERTER( x ) DECLARE_COMPONENT_WITH_ID( x, ConverterID( x::storageType(), x::classID() ) )
 
 #endif // GAUDIKERNEL_CONVERTER_H
diff --git a/GaudiKernel/GaudiKernel/DeclareFactoryEntries.h b/GaudiKernel/GaudiKernel/DeclareFactoryEntries.h
index 7120b94ef1..888ec5df25 100644
--- a/GaudiKernel/GaudiKernel/DeclareFactoryEntries.h
+++ b/GaudiKernel/GaudiKernel/DeclareFactoryEntries.h
@@ -4,32 +4,30 @@
 #ifdef ATLAS
 
 // Backwards compatibility dummies
-#define DECLARE_ALGORITHM( x )              /* dummy */
-#define DECLARE_NAMESPACE_ALGORITHM( n, x ) /* dummy */
+#define DECLARE_ALGORITHM( x )              /*dummy*/
+#define DECLARE_NAMESPACE_ALGORITHM( n, x ) /*dummy*/
 
-#define DECLARE_AUDITOR( x )              /* dummy */
-#define DECLARE_NAMESPACE_AUDITOR( n, x ) /* dummy */
+#define DECLARE_AUDITOR( x )              /*dummy*/
+#define DECLARE_NAMESPACE_AUDITOR( n, x ) /*dummy*/
 
 #define DECLARE_GENERIC_CONVERTER( x )              /* dummy */
 #define DECLARE_NAMESPACE_GENERIC_CONVERTER( n, x ) /* dummy */
-#define DECLARE_CONVERTER( x )                      /* dummy */
-#define DECLARE_NAMESPACE_CONVERTER( n, x )         /* dummy */
+#define DECLARE_CONVERTER( x )                      /*dummy*/
+#define DECLARE_NAMESPACE_CONVERTER( n, x )         /*dummy */
 
-#define DECLARE_SERVICE( x )              /* dummy */
-#define DECLARE_NAMESPACE_SERVICE( n, x ) /* dummy */
+#define DECLARE_SERVICE( x )              /*dummy*/
+#define DECLARE_NAMESPACE_SERVICE( n, x ) /*dummy*/
 
-#define DECLARE_ALGTOOL( x )              /* dummy */
-#define DECLARE_NAMESPACE_ALGTOOL( n, x ) /* dummy */
-#define DECLARE_TOOL( x )                 /* dummy */
-#define DECLARE_NAMESPACE_TOOL( n, x )    /* dummy */
+#define DECLARE_ALGTOOL( x )              /*dummy*/
+#define DECLARE_NAMESPACE_ALGTOOL( n, x ) /*dummy*/
+#define DECLARE_TOOL( x )                 /*dummy*/
+#define DECLARE_NAMESPACE_TOOL( n, x )    /*dummy*/
 
 #define DECLARE_FACTORY_ENTRIES( x ) void x##_load()
 
 #else
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif
 
diff --git a/GaudiKernel/GaudiKernel/Service.h b/GaudiKernel/GaudiKernel/Service.h
index 67e6bf4d8f..3028f4ff1a 100644
--- a/GaudiKernel/GaudiKernel/Service.h
+++ b/GaudiKernel/GaudiKernel/Service.h
@@ -193,33 +193,4 @@ protected:
   mutable SmartIF<IAuditorSvc> m_pAuditorSvc;
 };
 
-#ifndef GAUDI_NEW_PLUGIN_SERVICE
-template <class T>
-class SvcFactory
-{
-public:
-#ifndef __REFLEX__
-  template <typename S, typename... Args>
-  static typename S::ReturnType create( Args&&... args )
-  {
-    return new T( std::forward<Args>( args )... );
-  }
-#endif
-};
-
-// Macros to declare component factories
-#define DECLARE_SERVICE_FACTORY( x ) DECLARE_FACTORY_WITH_CREATOR( x, SvcFactory<x>, Service::Factory )
-#define DECLARE_NAMED_SERVICE_FACTORY( x, n )                                                                          \
-  DECLARE_FACTORY_WITH_CREATOR_AND_ID( x, SvcFactory<x>, #n, Service::Factory )
-#define DECLARE_NAMESPACE_SERVICE_FACTORY( n, x ) DECLARE_SERVICE_FACTORY( n::x )
-
-#else
-
-// macros to declare factories
-#define DECLARE_SERVICE_FACTORY( x ) DECLARE_COMPONENT( x )
-#define DECLARE_NAMED_SERVICE_FACTORY( x, n ) DECLARE_COMPONENT_WITH_ID( x, #n )
-#define DECLARE_NAMESPACE_SERVICE_FACTORY( n, x ) DECLARE_COMPONENT( n::x )
-
-#endif
-
 #endif // GAUDIKERNEL_SERVICE_H
diff --git a/GaudiKernel/GaudiKernel/SvcFactory.h b/GaudiKernel/GaudiKernel/SvcFactory.h
index 7a7da9d2cf..3262599306 100644
--- a/GaudiKernel/GaudiKernel/SvcFactory.h
+++ b/GaudiKernel/GaudiKernel/SvcFactory.h
@@ -1,8 +1,6 @@
 #ifndef KERNEL_SVCFACTORY_H
 #define KERNEL_SVCFACTORY_H
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif // GAUDIKERNEL_SVCFACTORY_H
diff --git a/GaudiKernel/GaudiKernel/ToolFactory.h b/GaudiKernel/GaudiKernel/ToolFactory.h
index 92ef362bf3..acda38fc75 100644
--- a/GaudiKernel/GaudiKernel/ToolFactory.h
+++ b/GaudiKernel/GaudiKernel/ToolFactory.h
@@ -1,8 +1,6 @@
 #ifndef GAUDI_KERNEL_TOOLFACTORY_H
 #define GAUDI_KERNEL_TOOLFACTORY_H
 
-#ifdef GAUDI_NEW_PLUGIN_SERVICE
 #warning "obsolete empty header, please remove it"
-#endif
 
 #endif // GAUDI_KERNEL_TOOLFACTORY_H
diff --git a/GaudiKernel/src/Lib/TsDataSvc.cpp b/GaudiKernel/src/Lib/TsDataSvc.cpp
index a2cd98a44f..161347c857 100644
--- a/GaudiKernel/src/Lib/TsDataSvc.cpp
+++ b/GaudiKernel/src/Lib/TsDataSvc.cpp
@@ -26,7 +26,6 @@
 
 #include "GaudiKernel/DataObject.h"
 #include "GaudiKernel/GaudiException.h"
-#include "GaudiKernel/SvcFactory.h"
 #include "GaudiKernel/xtoa.h"
 
 #include "GaudiKernel/DataIncident.h"
diff --git a/GaudiMP/src/component/RecordOutputStream.cpp b/GaudiMP/src/component/RecordOutputStream.cpp
index 2cdf8d325b..150ee967ce 100644
--- a/GaudiMP/src/component/RecordOutputStream.cpp
+++ b/GaudiMP/src/component/RecordOutputStream.cpp
@@ -8,7 +8,7 @@
 //
 // 30/08/2013: Marco Clemencic
 // ----------------------------------------------------------------------------
-DECLARE_ALGORITHM_FACTORY( RecordOutputStream )
+DECLARE_COMPONENT( RecordOutputStream )
 
 // ============================================================================
 // Initialization
diff --git a/GaudiMP/src/component/ReplayOutputStream.cpp b/GaudiMP/src/component/ReplayOutputStream.cpp
index d504d1ace2..ec844707df 100644
--- a/GaudiMP/src/component/ReplayOutputStream.cpp
+++ b/GaudiMP/src/component/ReplayOutputStream.cpp
@@ -17,7 +17,7 @@
 //
 // 30/08/2013: Marco Clemencic
 // ----------------------------------------------------------------------------
-DECLARE_ALGORITHM_FACTORY( ReplayOutputStream )
+DECLARE_COMPONENT( ReplayOutputStream )
 
 namespace
 {
diff --git a/GaudiProfiling/src/component/intel/IntelProfile.cpp b/GaudiProfiling/src/component/intel/IntelProfile.cpp
index 7f49afeed1..c8cfeed28e 100644
--- a/GaudiProfiling/src/component/intel/IntelProfile.cpp
+++ b/GaudiProfiling/src/component/intel/IntelProfile.cpp
@@ -9,7 +9,7 @@
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( IntelProfile )
+DECLARE_COMPONENT( IntelProfile )
 
 //=============================================================================
 // Main execution
diff --git a/GaudiProfiling/src/component/jemalloc/JemallocProfile.cpp b/GaudiProfiling/src/component/jemalloc/JemallocProfile.cpp
index be67cbf919..79cb049bb4 100644
--- a/GaudiProfiling/src/component/jemalloc/JemallocProfile.cpp
+++ b/GaudiProfiling/src/component/jemalloc/JemallocProfile.cpp
@@ -18,7 +18,7 @@ int mallctl( const char* name, void* oldp, size_t* oldlenp, void* newp, size_t n
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( JemallocProfile )
+DECLARE_COMPONENT( JemallocProfile )
 
 //=============================================================================
 // Initialization
diff --git a/GaudiProfiling/src/component/valgrind/CallgrindProfile.cpp b/GaudiProfiling/src/component/valgrind/CallgrindProfile.cpp
index 551e231e11..a77c339582 100644
--- a/GaudiProfiling/src/component/valgrind/CallgrindProfile.cpp
+++ b/GaudiProfiling/src/component/valgrind/CallgrindProfile.cpp
@@ -12,7 +12,7 @@
 //-----------------------------------------------------------------------------
 
 // Declaration of the Algorithm Factory
-DECLARE_ALGORITHM_FACTORY( CallgrindProfile )
+DECLARE_COMPONENT( CallgrindProfile )
 
 //=============================================================================
 // Main execution
diff --git a/GaudiPython/src/Services/PythonScriptingSvc.h b/GaudiPython/src/Services/PythonScriptingSvc.h
index e62f9ee21a..549bc9c5a6 100644
--- a/GaudiPython/src/Services/PythonScriptingSvc.h
+++ b/GaudiPython/src/Services/PythonScriptingSvc.h
@@ -28,7 +28,6 @@ public:
   /// Run the service by taking full control. [IRunable::run()]
   StatusCode run() override;
 
-protected:
   /// Destructor.
   ~PythonScriptingSvc() override;
 
diff --git a/GaudiSvc/src/FileMgr/FileMgr.cpp b/GaudiSvc/src/FileMgr/FileMgr.cpp
index 246af86240..92f0fa1fec 100644
--- a/GaudiSvc/src/FileMgr/FileMgr.cpp
+++ b/GaudiSvc/src/FileMgr/FileMgr.cpp
@@ -9,7 +9,7 @@
 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-DECLARE_SERVICE_FACTORY( FileMgr )
+DECLARE_COMPONENT( FileMgr )
 
 using namespace std;
 using namespace Io;
diff --git a/GaudiSvc/src/THistSvc/THistSvc.h b/GaudiSvc/src/THistSvc/THistSvc.h
index b89b219c1d..a2f799a741 100644
--- a/GaudiSvc/src/THistSvc/THistSvc.h
+++ b/GaudiSvc/src/THistSvc/THistSvc.h
@@ -161,9 +161,6 @@ public:
   // From IIoComponent
   StatusCode io_reinit() override;
 
-protected:
-  ~THistSvc() override = default;
-
 private:
   typedef std::recursive_mutex THistSvcMutex_t;
   typedef std::mutex histMut_t;
diff --git a/RootCnv/RootCnv/RootCnvSvc.h b/RootCnv/RootCnv/RootCnvSvc.h
index 20c31e51e4..b5680fcc34 100644
--- a/RootCnv/RootCnv/RootCnvSvc.h
+++ b/RootCnv/RootCnv/RootCnvSvc.h
@@ -11,6 +11,7 @@
 #include "GaudiKernel/ClassID.h"
 #include "GaudiKernel/ConversionSvc.h"
 #include "GaudiKernel/DataObject.h"
+#include "GaudiUtils/IIODataManager.h"
 
 // C++ include files
 #include <set>
@@ -35,7 +36,6 @@ namespace Gaudi
 {
 
   // Forward declarations
-  class IIODataManager;
   class IDataConnection;
   class RootDataConnection;
   class RootConnectionSetup;
diff --git a/RootCnv/components/Components.cpp b/RootCnv/components/Components.cpp
index c67533dc04..e256692820 100644
--- a/RootCnv/components/Components.cpp
+++ b/RootCnv/components/Components.cpp
@@ -2,11 +2,6 @@
 #include "RootCnv/RootEvtSelector.h"
 #include "RootCnv/RootPerfMonSvc.h"
 
-#ifndef DECLARE_COMPONENT
-#define DECLARE_COMPONENT( x ) DECLARE_SERVICE_FACTORY( x )
-#endif
-
-using namespace Gaudi;
-DECLARE_COMPONENT( RootCnvSvc )
-DECLARE_COMPONENT( RootEvtSelector )
-DECLARE_COMPONENT( RootPerfMonSvc )
+DECLARE_COMPONENT( Gaudi::RootCnvSvc )
+DECLARE_COMPONENT( Gaudi::RootEvtSelector )
+DECLARE_COMPONENT( Gaudi::RootPerfMonSvc )
diff --git a/RootCnv/src/RootCnvSvc.cpp b/RootCnv/src/RootCnvSvc.cpp
index 08100864d0..990efa3820 100644
--- a/RootCnv/src/RootCnvSvc.cpp
+++ b/RootCnv/src/RootCnvSvc.cpp
@@ -21,7 +21,6 @@
 #include "GaudiKernel/LinkManager.h"
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/System.h"
-#include "GaudiUtils/IIODataManager.h"
 #include "RootCnv/RootAddress.h"
 #include "RootCnv/RootConverter.h"
 #include "RootCnv/RootDataConnection.h"
diff --git a/RootHistCnv/src/DirectoryCnv.cpp b/RootHistCnv/src/DirectoryCnv.cpp
index e2c7522eea..c24bbf6ed1 100644
--- a/RootHistCnv/src/DirectoryCnv.cpp
+++ b/RootHistCnv/src/DirectoryCnv.cpp
@@ -7,7 +7,7 @@
 // Author :                   Charles Leggett
 //
 //------------------------------------------------------------------------------
-DECLARE_NAMESPACE_CONVERTER_FACTORY( RootHistCnv, DirectoryCnv )
+DECLARE_CONVERTER( RootHistCnv::DirectoryCnv )
 //------------------------------------------------------------------------------
 StatusCode RootHistCnv::DirectoryCnv::createObj( IOpaqueAddress* /* pAddress */, DataObject*& refpObject )
 {
diff --git a/RootHistCnv/src/RCWNTupleCnv.cpp b/RootHistCnv/src/RCWNTupleCnv.cpp
index 32f101d1d2..e2c8a72f89 100644
--- a/RootHistCnv/src/RCWNTupleCnv.cpp
+++ b/RootHistCnv/src/RCWNTupleCnv.cpp
@@ -582,4 +582,4 @@ StatusCode RootHistCnv::RCWNTupleCnv::load( TTree* tree, INTuple*& refpObject )
 
 // Instantiation of a static factory class used by clients to create
 // instances of this service
-DECLARE_NAMESPACE_CONVERTER_FACTORY( RootHistCnv, RCWNTupleCnv )
+DECLARE_CONVERTER( RootHistCnv::RCWNTupleCnv )
diff --git a/RootHistCnv/src/RDirectoryCnv.cpp b/RootHistCnv/src/RDirectoryCnv.cpp
index 0722cbf8fe..d720e5706c 100644
--- a/RootHistCnv/src/RDirectoryCnv.cpp
+++ b/RootHistCnv/src/RDirectoryCnv.cpp
@@ -34,7 +34,7 @@ namespace
   } maybe_stol{};
 }
 
-DECLARE_NAMESPACE_CONVERTER_FACTORY( RootHistCnv, RDirectoryCnv )
+DECLARE_CONVERTER( RootHistCnv::RDirectoryCnv )
 
 //-----------------------------------------------------------------------------
 StatusCode RootHistCnv::RDirectoryCnv::createObj( IOpaqueAddress* /* pAddress */, DataObject*& refpObject )
diff --git a/RootHistCnv/src/RFileCnv.cpp b/RootHistCnv/src/RFileCnv.cpp
index eaa9e3bd7e..6801f25549 100644
--- a/RootHistCnv/src/RFileCnv.cpp
+++ b/RootHistCnv/src/RFileCnv.cpp
@@ -19,7 +19,7 @@
 
 // Instantiation of a static factory class used by clients to create
 // instances of this service
-DECLARE_NAMESPACE_CONVERTER_FACTORY( RootHistCnv, RFileCnv )
+DECLARE_CONVERTER( RootHistCnv::RFileCnv )
 
 // Standard constructor
 RootHistCnv::RFileCnv::RFileCnv( ISvcLocator* svc ) : RDirectoryCnv( svc, classID() ) {}
diff --git a/RootHistCnv/src/RHistogramCnv.cpp b/RootHistCnv/src/RHistogramCnv.cpp
index 05fceab132..b88a426864 100644
--- a/RootHistCnv/src/RHistogramCnv.cpp
+++ b/RootHistCnv/src/RHistogramCnv.cpp
@@ -10,7 +10,7 @@ namespace RootHistCnv
   {
     return CLID_ProfileH;
   }
-  DECLARE_CONVERTER_FACTORY( RootHistCnvP1DCnv )
+  DECLARE_CONVERTER( RootHistCnvP1DCnv )
 }
 
 #include "AIDA/IProfile2D.h"
@@ -23,7 +23,7 @@ namespace RootHistCnv
   {
     return CLID_ProfileH2;
   }
-  DECLARE_CONVERTER_FACTORY( RootHistCnvP2DCnv )
+  DECLARE_CONVERTER( RootHistCnvP2DCnv )
 }
 
 #include "AIDA/IHistogram1D.h"
@@ -36,7 +36,7 @@ namespace RootHistCnv
   {
     return CLID_H1D;
   }
-  DECLARE_CONVERTER_FACTORY( RootHistCnvH1DCnv )
+  DECLARE_CONVERTER( RootHistCnvH1DCnv )
 }
 
 #include "AIDA/IHistogram2D.h"
@@ -49,7 +49,7 @@ namespace RootHistCnv
   {
     return CLID_H2D;
   }
-  DECLARE_CONVERTER_FACTORY( RootHistCnvH2DCnv )
+  DECLARE_CONVERTER( RootHistCnvH2DCnv )
 }
 
 #include "AIDA/IHistogram3D.h"
@@ -62,5 +62,5 @@ namespace RootHistCnv
   {
     return CLID_H3D;
   }
-  DECLARE_CONVERTER_FACTORY( RootHistCnvH3DCnv )
+  DECLARE_CONVERTER( RootHistCnvH3DCnv )
 }
diff --git a/RootHistCnv/src/RRWNTupleCnv.cpp b/RootHistCnv/src/RRWNTupleCnv.cpp
index 15b704793b..8561e31f71 100644
--- a/RootHistCnv/src/RRWNTupleCnv.cpp
+++ b/RootHistCnv/src/RRWNTupleCnv.cpp
@@ -10,7 +10,7 @@
 
 // Instantiation of a static factory class used by clients to create
 // instances of this service
-DECLARE_NAMESPACE_CONVERTER_FACTORY( RootHistCnv, RRWNTupleCnv )
+DECLARE_CONVERTER( RootHistCnv::RRWNTupleCnv )
 
 //------------------------------------------------------------------------------
 StatusCode RootHistCnv::RRWNTupleCnv::book( const std::string& desc, INTuple* nt, TTree*& rtree )
-- 
GitLab