Skip to content

Commit cfe60b9

Browse files
committed
std::find_if instead of a loop
1 parent f52b13d commit cfe60b9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Framework/Core/src/WorkflowHelpers.cxx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,13 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
281281
uint32_t hash = runtime_hash(processor.name.c_str());
282282
bool hasMatch = false;
283283
ConcreteDataMatcher summaryMatcher = ConcreteDataMatcher{"DPL", "SUMMARY", static_cast<DataAllocator::SubSpecificationType>(hash)};
284-
for (auto& output : processor.outputs) {
285-
if (DataSpecUtils::match(output, summaryMatcher)) {
286-
O2_SIGNPOST_EVENT_EMIT(workflow_helpers, sid, "output enumeration", "%{public}s already there in %{public}s",
287-
DataSpecUtils::describe(output).c_str(), processor.name.c_str());
288-
hasMatch = true;
289-
break;
290-
}
284+
auto summaryOutput = std::find_if(processor.outputs.begin(), processor.outputs.end(), [&summaryMatcher](auto const& output){ return DataSpecUtils::match(output, summaryMatcher); });
285+
if (summaryOutput != processor.outputs.end()) {
286+
O2_SIGNPOST_EVENT_EMIT(workflow_helpers, sid, "output enumeration", "%{public}s already there in %{public}s",
287+
DataSpecUtils::describe(*summaryOutput).c_str(), processor.name.c_str());
288+
hasMatch = true;
291289
}
290+
292291
if (!hasMatch) {
293292
O2_SIGNPOST_EVENT_EMIT(workflow_helpers, sid, "output enumeration", "Adding DPL/SUMMARY/%d to %{public}s", hash, processor.name.c_str());
294293
processor.outputs.push_back(OutputSpec{{"dpl-summary"}, ConcreteDataMatcher{"DPL", "SUMMARY", static_cast<DataAllocator::SubSpecificationType>(hash)}});

0 commit comments

Comments
 (0)