From 27c6cd71fe3d89a5437227f0152dfd7389dbb595 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 29 Jul 2024 16:26:22 -0400 Subject: [PATCH] drop PodioTypeMap --- src/examples/PodioExample/DatamodelGlue.h | 31 ------------------- src/libraries/JANA/Omni/JHasInputs.h | 10 +++--- src/libraries/JANA/Omni/JHasOutputs.h | 14 ++++----- src/libraries/JANA/Omni/JOmniFactory.h | 12 +++---- src/libraries/JANA/Podio/JFactoryPodioT.h | 9 ------ src/libraries/JANA/Podio/JPodioTypeHelpers.h | 13 -------- .../unit_tests/Components/PodioTests.cc | 15 --------- 7 files changed, 16 insertions(+), 88 deletions(-) diff --git a/src/examples/PodioExample/DatamodelGlue.h b/src/examples/PodioExample/DatamodelGlue.h index 741be3c8c..f0ae08426 100644 --- a/src/examples/PodioExample/DatamodelGlue.h +++ b/src/examples/PodioExample/DatamodelGlue.h @@ -6,42 +6,11 @@ #ifndef JANA2_DATAMODELGLUE_H #define JANA2_DATAMODELGLUE_H -#include - #include #include #include #include -/// Legacy PODIO support -template -struct PodioTypeMap { -}; - -template <> -struct PodioTypeMap { - using mutable_t = MutableExampleHit; - using collection_t = ExampleHitCollection; -}; - -template <> -struct PodioTypeMap { - using mutable_t = MutableExampleCluster; - using collection_t = ExampleClusterCollection; -}; - -template <> -struct PodioTypeMap { - using mutable_t = MutableEventInfo; - using collection_t = EventInfoCollection; -}; - -template <> -struct PodioTypeMap { - using mutable_t = MutableTimesliceInfo; - using collection_t = TimesliceInfoCollection; -}; - template struct Overload : Ts ... { diff --git a/src/libraries/JANA/Omni/JHasInputs.h b/src/libraries/JANA/Omni/JHasInputs.h index 71912b0fd..e4414fd6a 100644 --- a/src/libraries/JANA/Omni/JHasInputs.h +++ b/src/libraries/JANA/Omni/JHasInputs.h @@ -5,8 +5,6 @@ #pragma once #include -template struct PodioTypeMap; - namespace jana { namespace omni { @@ -131,7 +129,7 @@ struct JHasInputs { template class PodioInput : public InputBase { - const typename PodioTypeMap::collection_t* m_data; + const typename PodioT::collection_type* m_data; public: @@ -146,7 +144,7 @@ struct JHasInputs { Configure(options); } - const typename PodioTypeMap::collection_t* operator()() { + const typename PodioT::collection_type* operator()() { return m_data; } @@ -179,7 +177,7 @@ struct JHasInputs { template class VariadicPodioInput : public InputBase { - std::vector::collection_t*> m_data; + std::vector m_data; public: @@ -196,7 +194,7 @@ struct JHasInputs { ConfigureVariadic(options); } - const std::vector::collection_t*> operator()() { + const std::vector operator()() { return m_data; } diff --git a/src/libraries/JANA/Omni/JHasOutputs.h b/src/libraries/JANA/Omni/JHasOutputs.h index 27fc59cb9..3930682d6 100644 --- a/src/libraries/JANA/Omni/JHasOutputs.h +++ b/src/libraries/JANA/Omni/JHasOutputs.h @@ -6,8 +6,6 @@ #include -template struct PodioTypeMap; - namespace jana { namespace omni { @@ -55,7 +53,7 @@ struct JHasOutputs { template class PodioOutput : public OutputBase { - std::unique_ptr::collection_t> m_data; + std::unique_ptr m_data; public: @@ -65,14 +63,14 @@ struct JHasOutputs { this->type_name = JTypeInfo::demangle(); } - std::unique_ptr::collection_t>& operator()() { return m_data; } + std::unique_ptr& operator()() { return m_data; } protected: void InsertCollection(JEvent& event) override { event.InsertCollection(std::move(*m_data), this->collection_names[0]); } void Reset() override { - m_data = std::move(std::make_unique::collection_t>()); + m_data = std::move(std::make_unique()); } }; @@ -80,7 +78,7 @@ struct JHasOutputs { template class VariadicPodioOutput : public OutputBase { - std::vector::collection_t>> m_data; + std::vector> m_data; public: @@ -91,7 +89,7 @@ struct JHasOutputs { this->is_variadic = true; } - std::vector::collection_t>>& operator()() { return m_data; } + std::vector>& operator()() { return m_data; } protected: void InsertCollection(JEvent& event) override { @@ -108,7 +106,7 @@ struct JHasOutputs { void Reset() override { m_data.clear(); for (auto& coll_name : this->collection_names) { - m_data.push_back(std::make_unique::collection_t>()); + m_data.push_back(std::make_unique()); } } }; diff --git a/src/libraries/JANA/Omni/JOmniFactory.h b/src/libraries/JANA/Omni/JOmniFactory.h index e001910a7..a705ce460 100644 --- a/src/libraries/JANA/Omni/JOmniFactory.h +++ b/src/libraries/JANA/Omni/JOmniFactory.h @@ -74,7 +74,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { template class PodioOutput : public OutputBase { - std::unique_ptr::collection_t> m_data; + std::unique_ptr m_data; public: @@ -84,7 +84,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { this->type_name = JTypeInfo::demangle(); } - std::unique_ptr::collection_t>& operator()() { return m_data; } + std::unique_ptr& operator()() { return m_data; } private: friend class JOmniFactory; @@ -102,7 +102,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { } void Reset() override { - m_data = std::move(std::make_unique::collection_t>()); + m_data = std::move(std::make_unique()); } }; @@ -110,7 +110,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { template class VariadicPodioOutput : public OutputBase { - std::vector::collection_t>> m_data; + std::vector> m_data; public: @@ -121,7 +121,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { this->is_variadic = true; } - std::vector::collection_t>>& operator()() { return m_data; } + std::vector>& operator()() { return m_data; } private: friend class JOmniFactory; @@ -146,7 +146,7 @@ class JOmniFactory : public JMultifactory, public jana::omni::JHasInputs { void Reset() override { m_data.clear(); for (auto& coll_name : this->collection_names) { - m_data.push_back(std::make_unique::collection_t>()); + m_data.push_back(std::make_unique()); } } }; diff --git a/src/libraries/JANA/Podio/JFactoryPodioT.h b/src/libraries/JANA/Podio/JFactoryPodioT.h index ef09bc39c..9ff5a60ad 100644 --- a/src/libraries/JANA/Podio/JFactoryPodioT.h +++ b/src/libraries/JANA/Podio/JFactoryPodioT.h @@ -6,13 +6,8 @@ #pragma once #include -#include #include -#if podio_VERSION < PODIO_VERSION(0, 17, 0) -template struct PodioTypeMap; -#endif - /// The point of this additional base class is to allow us _untyped_ access to the underlying PODIO collection, /// at the cost of some weird multiple inheritance. The JEvent can trigger the untyped factory using Create(), then /// @@ -40,11 +35,7 @@ class JFactoryPodio { template class JFactoryPodioT : public JFactoryT, public JFactoryPodio { public: -#if podio_VERSION >= PODIO_VERSION(0, 17, 0) using CollectionT = typename T::collection_type; -#else - using CollectionT = typename PodioTypeMap::collection_t; -#endif private: // mCollection is owned by the frame. // mFrame is owned by the JFactoryT. diff --git a/src/libraries/JANA/Podio/JPodioTypeHelpers.h b/src/libraries/JANA/Podio/JPodioTypeHelpers.h index c5f3b05f0..665836804 100644 --- a/src/libraries/JANA/Podio/JPodioTypeHelpers.h +++ b/src/libraries/JANA/Podio/JPodioTypeHelpers.h @@ -6,7 +6,6 @@ #pragma once #include -#include #include /// These allow us to have both a PODIO-enabled and a PODIO-free definition of certain key structures and functions. @@ -14,23 +13,11 @@ #if JANA2_HAVE_PODIO // Sadly, this will only work with C++17 or higher, and for now JANA still supports C++14 (when not using PODIO) -template -struct PodioTypeMap; - template struct is_podio : std::false_type {}; template -#if podio_VERSION >= PODIO_VERSION(0, 17, 0) struct is_podio> : std::true_type {}; -#else -/// The user was expected to provide some datamodel glue which specializes PodioTypeMap like this: -/// template <> struct PodioTypeMap { -/// using collection_t = ExampleHitCollection; -/// using mutable_t = MutableExampleHit; -/// } -struct is_podio::collection_t>> : std::true_type {}; -#endif template static constexpr bool is_podio_v = is_podio::value; diff --git a/src/programs/unit_tests/Components/PodioTests.cc b/src/programs/unit_tests/Components/PodioTests.cc index 8e18f381c..184e596fb 100644 --- a/src/programs/unit_tests/Components/PodioTests.cc +++ b/src/programs/unit_tests/Components/PodioTests.cc @@ -53,15 +53,6 @@ struct MyWrapper { } }; -#if podio_VERSION < PODIO_VERSION(0, 17, 0) -template -struct MyWrapper::collection_t>> { - int x = 2; - bool have_podio() { - return true; - } -}; -#else template struct MyWrapper> { int x = 2; @@ -69,7 +60,6 @@ struct MyWrapper> { return true; } }; -#endif TEST_CASE("SFINAE for JFactoryT || JFactoryPodioT") { @@ -86,13 +76,8 @@ TEST_CASE("SFINAE for JFactoryT || JFactoryPodioT") { template struct is_podio : std::false_type {}; -#if podio_VERSION < PODIO_VERSION(0, 17, 0) -template -struct is_podio::collection_t>> : std::true_type {}; -#else template struct is_podio> : std::true_type {}; -#endif template static constexpr bool is_podio_v = is_podio::value;