From c247453e380ede2f53ac7aed805581096e00968a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:38:53 +0100 Subject: [PATCH] DPL: move TableConsumer support out of line in general This is now only included if one uses the Analysis framework. --- .../Core/include/Framework/AnalysisTask.h | 1 + .../Core/include/Framework/InputRecord.h | 22 +++++++++++-------- Framework/Core/src/AODReaderHelpers.cxx | 1 + Framework/Core/src/ArrowSupport.cxx | 1 + .../GUISupport/test/test_SimpleTracksED.cxx | 1 + 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Framework/Core/include/Framework/AnalysisTask.h b/Framework/Core/include/Framework/AnalysisTask.h index cf0bba20e74ea..0173da71702af 100644 --- a/Framework/Core/include/Framework/AnalysisTask.h +++ b/Framework/Core/include/Framework/AnalysisTask.h @@ -12,6 +12,7 @@ #ifndef FRAMEWORK_ANALYSIS_TASK_H_ #define FRAMEWORK_ANALYSIS_TASK_H_ +#include "Framework/TableConsumer.h" #include "Framework/AnalysisManagers.h" #include "Framework/AlgorithmSpec.h" #include "Framework/CallbackService.h" diff --git a/Framework/Core/include/Framework/InputRecord.h b/Framework/Core/include/Framework/InputRecord.h index 0c9f36d00c634..bdad9d91cb24d 100644 --- a/Framework/Core/include/Framework/InputRecord.h +++ b/Framework/Core/include/Framework/InputRecord.h @@ -15,7 +15,6 @@ #include "Framework/DataRefUtils.h" #include "Framework/InputRoute.h" #include "Framework/TypeTraits.h" -#include "Framework/TableConsumer.h" #include "Framework/Traits.h" #include "Framework/RuntimeError.h" #include "Framework/Logger.h" @@ -40,6 +39,9 @@ namespace o2::framework { +template +concept TableConsumerLike = requires (A a) { a. asArrowTable(); }; + // Wrapper class to get CCDB metadata struct CCDBMetadataExtractor { }; @@ -233,6 +235,16 @@ class InputRecord return ref; } + template + decltype(auto) get(R binding, int part = 0) const + { + DataRef ref = getRef(binding, part); + // substitution for TableConsumer + // For the moment this is dummy, as it requires proper support to + // create the RDataSource from the arrow buffer. + auto data = reinterpret_cast(ref.payload); + return std::make_unique(data, DataRefUtils::getPayloadSize(ref)); + } /// Get the object of specified type T for the binding R. /// If R is a string like object, we look up by name the InputSpec and /// return the data associated to the given label. @@ -272,14 +284,6 @@ class InputRecord return reinterpret_cast(ref.payload); // implementation (d) - } else if constexpr (std::is_same::value) { - // substitution for TableConsumer - // For the moment this is dummy, as it requires proper support to - // create the RDataSource from the arrow buffer. - auto data = reinterpret_cast(ref.payload); - return std::make_unique(data, DataRefUtils::getPayloadSize(ref)); - - // implementation (f) } else if constexpr (is_span::value) { // substitution for span of messageable objects // FIXME: there will be std::span in C++20 diff --git a/Framework/Core/src/AODReaderHelpers.cxx b/Framework/Core/src/AODReaderHelpers.cxx index f6513b5facea3..16eefe4444f70 100644 --- a/Framework/Core/src/AODReaderHelpers.cxx +++ b/Framework/Core/src/AODReaderHelpers.cxx @@ -25,6 +25,7 @@ #include "Framework/RawDeviceService.h" #include "Framework/DataSpecUtils.h" #include "Framework/SourceInfoHeader.h" +#include "Framework/TableConsumer.h" #include "Framework/ChannelInfo.h" #include "Framework/Logger.h" diff --git a/Framework/Core/src/ArrowSupport.cxx b/Framework/Core/src/ArrowSupport.cxx index 1dcc85c1d4f04..34f50e18513a9 100644 --- a/Framework/Core/src/ArrowSupport.cxx +++ b/Framework/Core/src/ArrowSupport.cxx @@ -28,6 +28,7 @@ #include "Framework/DevicesManager.h" #include "Framework/DeviceConfig.h" #include "Framework/ServiceMetricsInfo.h" +#include "Framework/TableConsumer.h" #include "WorkflowHelpers.h" #include "Framework/WorkflowSpecNode.h" #include "Framework/AnalysisSupportHelpers.h" diff --git a/Framework/GUISupport/test/test_SimpleTracksED.cxx b/Framework/GUISupport/test/test_SimpleTracksED.cxx index e0e0700a5186f..a98d20ec5fd8b 100644 --- a/Framework/GUISupport/test/test_SimpleTracksED.cxx +++ b/Framework/GUISupport/test/test_SimpleTracksED.cxx @@ -14,6 +14,7 @@ #include "Framework/DataProcessorSpec.h" #include "Framework/ParallelContext.h" #include "Framework/runDataProcessing.h" +#include "Framework/TableConsumer.h" #include "Framework/InputRecord.h" #include "Framework/Logger.h" #include "Framework/AnalysisDataModel.h"