From 7683dbb7233bc6e12bc20d701dcbb56072b7126e Mon Sep 17 00:00:00 2001
From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch>
Date: Thu, 6 Jun 2024 02:12:59 +0200
Subject: [PATCH] add warning message if node could not be published

---
 .../GeoModelKernel/GeoPublisher.tpp           | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPublisher.tpp b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPublisher.tpp
index cd040dbea..8114cebe7 100644
--- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPublisher.tpp
+++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPublisher.tpp
@@ -6,18 +6,26 @@ template<typename Iter> void GeoPublisher::printInsertionStatus(Iter it, bool su
       std::cout << "GeoModelKernel::GeoPublisher : Insertion of " << it->first << (success ? " succeeded\n" : " failed\n");
 }
 
-template<class N, typename T> void GeoPublisher::publishNode(N node,T keyT) 
+template <class N, typename T>
+void GeoPublisher::publishNode(N node, T keyT)
 {
     std::any key = keyT;
-    static_assert(std::is_same_v<GeoVFullPhysVol*, N> || std::is_same_v<GeoAlignableTransform*, N>,
+    static_assert(std::is_same_v<GeoVFullPhysVol *, N> || std::is_same_v<GeoAlignableTransform *, N>,
                   "ERROR!!! The node type is not currently supported by 'GeoPublisher'.\n If in doubt, please ask to `geomodel-developers@cern.ch'.\n");
-    if constexpr (std::is_same_v<GeoVFullPhysVol*, N>) {
-        const auto [iter, success] = m_publishedFPV.insert( {node, key} );
-        if(!success) printInsertionStatus(iter, success);
-    } else if constexpr (std::is_same_v<GeoAlignableTransform*, N>) {
-        const auto [iter, success] = m_publishedAXF.insert( {node, key} );
-        if(!success) printInsertionStatus(iter, success);
+    if constexpr (std::is_same_v<GeoVFullPhysVol *, N>)
+    {
+        const auto [iter, success] = m_publishedFPV.insert({node, key});
+        if (!success) {
+            std::cout << "WARNING! Publication of GeoVFullPhysVol node: " << node << ", key: " << keyT << " failed." << std::endl;
+            printInsertionStatus(iter, success);
+        }
+    }
+    else if constexpr (std::is_same_v<GeoAlignableTransform *, N>)
+    {
+        const auto [iter, success] = m_publishedAXF.insert({node, key});
+        if (!success) {
+            std::cout << "WARNING! Publication of AlignableTransform node: " << node << ", key: " << keyT << " failed." << std::endl;
+            printInsertionStatus(iter, success);
+        }
     }
 }
-
-
-- 
GitLab