Skip to content

Commit c914279

Browse files
committed
Extract updateInputInfos helper
Move the input infos out of AnalysisDataProcessorBuilder so that it can be reused outside of it.
1 parent 93e2a54 commit c914279

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

‎Framework/Core/include/Framework/AnalysisHelpers.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct InputInfo {
3737
uint32_t hash;
3838
std::vector<std::pair<int, ConcreteDataMatcher>> matchers;
3939
};
40+
41+
void updateInputInfos(std::vector<InputInfo>& iInfos, ConcreteDataMatcher&& matcher, uint32_t hash, int ai);
4042
} // namespace o2::framework
4143

4244
namespace o2::soa

‎Framework/Core/include/Framework/AnalysisTask.h‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,7 @@ struct AnalysisDataProcessorBuilder {
105105
spec.metadata.emplace_back(ConfigParamSpec{std::string{"control:"} + name, VariantType::Bool, value, {"\"\""}});
106106
auto matcher = DataSpecUtils::asConcreteDataMatcher(spec);
107107
DataSpecUtils::updateInputList(inputs, std::move(spec));
108-
auto locate = std::ranges::find_if(iInfos, [&hash](auto const& info) { return info.hash == hash; });
109-
if (locate == iInfos.end()) {
110-
iInfos.emplace_back(hash, std::vector{std::pair{ai, matcher}});
111-
} else {
112-
if (std::ranges::none_of(locate->matchers, [&ai, &matcher](auto const& match) { return (match.first == ai) && (match.second == matcher); })) {
113-
locate->matchers.emplace_back(std::pair{ai, matcher});
114-
}
115-
}
108+
updateInputInfos(iInfos, std::move(matcher), hash, ai);
116109
}
117110

118111
/// helpers to append expression information for a single argument

‎Framework/Core/src/AnalysisHelpers.cxx‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
#include "ExpressionJSONHelpers.h"
1515
#include "IndexJSONHelpers.h"
1616

17+
namespace o2::framework {
18+
void updateInputInfos(std::vector<InputInfo>& iInfos, ConcreteDataMatcher&& matcher, uint32_t hash, int ai)
19+
{
20+
auto locate = std::ranges::find_if(iInfos, [&hash](auto const& info) { return info.hash == hash; });
21+
if (locate == iInfos.end()) {
22+
iInfos.emplace_back(hash, std::vector{std::pair{ai, matcher}});
23+
} else {
24+
if (std::ranges::none_of(locate->matchers, [&ai, &matcher](auto const& match) { return (match.first == ai) && (match.second == matcher); })) {
25+
locate->matchers.emplace_back(std::pair{ai, matcher});
26+
}
27+
}
28+
}
29+
} // namespace o2::framework
30+
1731
namespace o2::soa
1832
{
1933
std::vector<framework::IndexColumnBuilder> IndexBuilder::makeBuilders(std::vector<std::shared_ptr<arrow::Table>>&& tables, std::vector<soa::IndexRecord> const& records)

0 commit comments

Comments
 (0)