Skip to content

Commit 0a354a0

Browse files
committed
we only expect void process functions
1 parent 90e8fe5 commit 0a354a0

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,9 @@ struct ArrowHelpers {
12931293
template <typename T>
12941294
concept is_iterator = framework::base_of_template<TableIterator, T> || framework::specialization_of_template<TableIterator, T>;
12951295

1296+
template <typename T>
1297+
concept is_table_or_iterator = is_table<T> || is_iterator<T>;
1298+
12961299
template <typename T>
12971300
concept with_originals = requires {
12981301
T::originals.size();

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ static constexpr bool is_enumeration_v<Enumeration<BEGIN, END, STEP>> = true;
6262
template <typename T>
6363
concept is_enumeration = is_enumeration_v<std::decay_t<T>>;
6464

65+
template <typename T>
66+
concept is_table_iterator_or_enumeration = soa::is_table_or_iterator<T> || is_enumeration<T>;
67+
6568
// Helper struct which builds a DataProcessorSpec from
6669
// the contents of an AnalysisTask...
6770
namespace
@@ -167,46 +170,46 @@ struct AnalysisDataProcessorBuilder {
167170
return true;
168171
}
169172
/// 1. enumeration (must be the only argument)
170-
template <typename R, typename C, is_enumeration A>
171-
static void inputsFromArgs(R (C::*)(A), const char* /*name*/, bool /*value*/, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>&) //, Cache&, Cache&)
173+
template <typename C, is_enumeration A>
174+
static void inputsFromArgs(void (C::*)(A), const char* /*name*/, bool /*value*/, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>&) //, Cache&, Cache&)
172175
{
173176
std::vector<ConfigParamSpec> inputMetadata;
174177
// FIXME: for the moment we do not support begin, end and step.
175178
DataSpecUtils::updateInputList(inputs, InputSpec{"enumeration", "DPL", "ENUM", 0, Lifetime::Enumeration, inputMetadata});
176179
}
177180

178181
/// 2. 1st argument is an iterator
179-
template <typename R, typename C, soa::is_iterator A, soa::is_table... Args>
180-
static void inputsFromArgs(R (C::*)(A, Args...), const char* name, bool value, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>& eInfos) //, Cache& bk, Cache& bku)
182+
template <typename C, soa::is_iterator A, soa::is_table... Args>
183+
static void inputsFromArgs(void (C::*)(A, Args...), const char* name, bool value, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>& eInfos) //, Cache& bk, Cache& bku)
181184
requires(std::is_lvalue_reference_v<A> && (std::is_lvalue_reference_v<Args> && ...))
182185
{
183-
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<R (C::*)(A, Args...)>();
186+
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(A, Args...)>();
184187
addInputsAndExpressions<typename std::decay_t<A>::parent_t, Args...>(hash, name, value, inputs, eInfos);
185188
}
186189

187190
/// 3. generic case
188-
template <typename R, typename C, soa::is_table... Args>
189-
static void inputsFromArgs(R (C::*)(Args...), const char* name, bool value, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>& eInfos) //, Cache&, Cache&)
191+
template <typename C, soa::is_table... Args>
192+
static void inputsFromArgs(void (C::*)(Args...), const char* name, bool value, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>& eInfos) //, Cache&, Cache&)
190193
requires(std::is_lvalue_reference_v<Args> && ...)
191194
{
192-
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<R (C::*)(Args...)>();
195+
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(Args...)>();
193196
addInputsAndExpressions<Args...>(hash, name, value, inputs, eInfos);
194197
}
195198

196199
/// 1. enumeration (no grouping)
197-
template <typename R, typename C, is_enumeration A>
198-
static void cacheFromArgs(R (C::*)(A), bool, Cache&, Cache&)
200+
template <typename C, is_enumeration A>
201+
static void cacheFromArgs(void (C::*)(A), bool, Cache&, Cache&)
199202
{
200203
}
201204
/// 2. iterator (the only grouping case)
202-
template <typename R, typename C, soa::is_iterator A, soa::is_table... Args>
203-
static void cacheFromArgs(R (C::*)(A, Args...), bool value, Cache& bk, Cache& bku)
205+
template <typename C, soa::is_iterator A, soa::is_table... Args>
206+
static void cacheFromArgs(void (C::*)(A, Args...), bool value, Cache& bk, Cache& bku)
204207
{
205208
addGroupingCandidates<A, Args...>(bk, bku, value);
206209
}
207210
/// 3. generic case (no grouping)
208-
template <typename R, typename C, soa::is_table A, soa::is_table... Args>
209-
static void cacheFromArgs(R (C::*)(A, Args...), bool, Cache&, Cache&)
211+
template <typename C, soa::is_table A, soa::is_table... Args>
212+
static void cacheFromArgs(void (C::*)(A, Args...), bool, Cache&, Cache&)
210213
{
211214
}
212215

@@ -281,31 +284,31 @@ struct AnalysisDataProcessorBuilder {
281284
}
282285
}
283286

284-
template <typename R, typename C, typename Grouping, typename... Args>
285-
static auto bindGroupingTable(InputRecord& record, R (C::*)(Grouping, Args...), std::vector<ExpressionInfo>& infos)
287+
template <typename C, is_table_iterator_or_enumeration Grouping, soa::is_table... Args>
288+
static auto bindGroupingTable(InputRecord& record, void (C::*)(Grouping, Args...), std::vector<ExpressionInfo>& infos)
286289
requires(!std::same_as<Grouping, void>)
287290
{
288-
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<R (C::*)(Grouping, Args...)>();
291+
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(Grouping, Args...)>();
289292
return extract<std::decay_t<Grouping>, 0>(record, infos, hash);
290293
}
291294

292-
template <typename R, typename C, typename Grouping, typename... Args>
293-
static auto bindAssociatedTables(InputRecord& record, R (C::*)(Grouping, Args...), std::vector<ExpressionInfo>& infos)
295+
template <typename C, is_table_iterator_or_enumeration Grouping, soa::is_table... Args>
296+
static auto bindAssociatedTables(InputRecord& record, void (C::*)(Grouping, Args...), std::vector<ExpressionInfo>& infos)
294297
requires(!std::same_as<Grouping, void> && sizeof...(Args) > 0)
295298
{
296299
constexpr auto p = pack<Args...>{};
297-
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<R (C::*)(Grouping, Args...)>();
300+
constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(Grouping, Args...)>();
298301
return std::make_tuple(extract<std::decay_t<Args>, has_type_at_v<Args>(p) + 1>(record, infos, hash)...);
299302
}
300303

301-
template <typename... As>
304+
template <soa::is_table... As>
302305
static void overwriteInternalIndices(std::tuple<As...>& dest, std::tuple<As...> const& src)
303306
{
304307
(std::get<As>(dest).bindInternalIndicesTo(&std::get<As>(src)), ...);
305308
}
306309

307-
template <typename Task, typename R, typename C, typename Grouping, typename... Associated>
308-
static void invokeProcess(Task& task, InputRecord& inputs, R (C::*processingFunction)(Grouping, Associated...), std::vector<ExpressionInfo>& infos, ArrowTableSlicingCache& slices)
310+
template <typename Task, is_table_iterator_or_enumeration Grouping, soa::is_table... Associated>
311+
static void invokeProcess(Task& task, InputRecord& inputs, void (Task::*processingFunction)(Grouping, Associated...), std::vector<ExpressionInfo>& infos, ArrowTableSlicingCache& slices)
309312
{
310313
using G = std::decay_t<Grouping>;
311314
auto groupingTable = AnalysisDataProcessorBuilder::bindGroupingTable(inputs, processingFunction, infos);
@@ -411,7 +414,7 @@ struct AnalysisDataProcessorBuilder {
411414
}
412415
}
413416

414-
template <typename C, typename T, typename G, typename... A>
417+
template <typename C, typename T, is_table_iterator_or_enumeration G, soa::is_table... A>
415418
static void invokeProcessWithArgs(C& task, T processingFunction, G g, std::tuple<A...>& at)
416419
{
417420
std::invoke(processingFunction, task, g, std::get<A>(at)...);

0 commit comments

Comments
 (0)