Skip to content

Commit 1a44fa0

Browse files
committed
DPL: move TableConsumer support out of line in general
This is now only included if one uses the Analysis framework.
1 parent 92166c6 commit 1a44fa0

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef FRAMEWORK_ANALYSIS_TASK_H_
1313
#define FRAMEWORK_ANALYSIS_TASK_H_
1414

15+
#include "Framework/TableConsumer.h"
1516
#include "Framework/AnalysisManagers.h"
1617
#include "Framework/AlgorithmSpec.h"
1718
#include "Framework/CallbackService.h"

Framework/Core/include/Framework/InputRecord.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "Framework/DataRefUtils.h"
1616
#include "Framework/InputRoute.h"
1717
#include "Framework/TypeTraits.h"
18-
#include "Framework/TableConsumer.h"
1918
#include "Framework/Traits.h"
2019
#include "Framework/RuntimeError.h"
2120
#include "Framework/Logger.h"
@@ -40,6 +39,9 @@
4039
namespace o2::framework
4140
{
4241

42+
template <typename A>
43+
concept TableConsumerLike = requires (A a) { a. asArrowTable(); };
44+
4345
// Wrapper class to get CCDB metadata
4446
struct CCDBMetadataExtractor {
4547
};
@@ -233,6 +235,16 @@ class InputRecord
233235
return ref;
234236
}
235237

238+
template <TableConsumerLike T, typename R>
239+
decltype(auto) get(R binding, int part = 0) const
240+
{
241+
DataRef ref = getRef(binding, part);
242+
// substitution for TableConsumer
243+
// For the moment this is dummy, as it requires proper support to
244+
// create the RDataSource from the arrow buffer.
245+
auto data = reinterpret_cast<uint8_t const*>(ref.payload);
246+
return std::make_unique<T>(data, DataRefUtils::getPayloadSize(ref));
247+
}
236248
/// Get the object of specified type T for the binding R.
237249
/// If R is a string like object, we look up by name the InputSpec and
238250
/// return the data associated to the given label.
@@ -272,14 +284,6 @@ class InputRecord
272284
return reinterpret_cast<char const*>(ref.payload);
273285

274286
// implementation (d)
275-
} else if constexpr (std::is_same<T, TableConsumer>::value) {
276-
// substitution for TableConsumer
277-
// For the moment this is dummy, as it requires proper support to
278-
// create the RDataSource from the arrow buffer.
279-
auto data = reinterpret_cast<uint8_t const*>(ref.payload);
280-
return std::make_unique<TableConsumer>(data, DataRefUtils::getPayloadSize(ref));
281-
282-
// implementation (f)
283287
} else if constexpr (is_span<T>::value) {
284288
// substitution for span of messageable objects
285289
// FIXME: there will be std::span in C++20

Framework/Core/src/AODReaderHelpers.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "Framework/RawDeviceService.h"
2626
#include "Framework/DataSpecUtils.h"
2727
#include "Framework/SourceInfoHeader.h"
28+
#include "Framework/TableConsumer.h"
2829
#include "Framework/ChannelInfo.h"
2930
#include "Framework/Logger.h"
3031

Framework/Core/src/ArrowSupport.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "Framework/DevicesManager.h"
2929
#include "Framework/DeviceConfig.h"
3030
#include "Framework/ServiceMetricsInfo.h"
31+
#include "Framework/TableConsumer.h"
3132
#include "WorkflowHelpers.h"
3233
#include "Framework/WorkflowSpecNode.h"
3334
#include "Framework/AnalysisSupportHelpers.h"

0 commit comments

Comments
 (0)