szaszm commented on a change in pull request #1284:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1284#discussion_r832050714
##########
File path: libminifi/src/FlowController.cpp
##########
@@ -438,6 +440,20 @@ std::shared_ptr<state::response::ResponseNode>
FlowController::getAgentManifest(
return agentInfo;
}
+void
FlowController::executeOnAllComponents(std::function<void(state::StateController*)>
func) {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ for (auto* component: getAllComponents()) {
+ func(component);
+ }
+}
+
+void FlowController::executeOnComponent(const std::string &name,
std::function<void(state::StateController*)> func) {
+ std::lock_guard<std::recursive_mutex> lock(mutex_);
+ if (auto* component = getComponent(name); component != nullptr) {
+ func(component);
+ }
Review comment:
You can even leave out the second part, and it means the same.
```
if (auto* const component = getComponent(name)) {
func(component);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]