|
15 | 15 | #include "Framework/DataRefUtils.h" |
16 | 16 | #include "Framework/InputRoute.h" |
17 | 17 | #include "Framework/TypeTraits.h" |
18 | | -#include "Framework/TableConsumer.h" |
19 | 18 | #include "Framework/Traits.h" |
20 | 19 | #include "Framework/RuntimeError.h" |
21 | 20 | #include "Framework/Logger.h" |
|
40 | 39 | namespace o2::framework |
41 | 40 | { |
42 | 41 |
|
| 42 | +template <typename A> |
| 43 | +concept TableConsumerLike = requires (A a) { a. asArrowTable(); }; |
| 44 | + |
43 | 45 | // Wrapper class to get CCDB metadata |
44 | 46 | struct CCDBMetadataExtractor { |
45 | 47 | }; |
@@ -233,6 +235,16 @@ class InputRecord |
233 | 235 | return ref; |
234 | 236 | } |
235 | 237 |
|
| 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 | + } |
236 | 248 | /// Get the object of specified type T for the binding R. |
237 | 249 | /// If R is a string like object, we look up by name the InputSpec and |
238 | 250 | /// return the data associated to the given label. |
@@ -272,14 +284,6 @@ class InputRecord |
272 | 284 | return reinterpret_cast<char const*>(ref.payload); |
273 | 285 |
|
274 | 286 | // 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) |
283 | 287 | } else if constexpr (is_span<T>::value) { |
284 | 288 | // substitution for span of messageable objects |
285 | 289 | // FIXME: there will be std::span in C++20 |
|
0 commit comments