martinzink commented on a change in pull request #1253:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1253#discussion_r805786146



##########
File path: libminifi/src/FlowController.cpp
##########
@@ -431,8 +431,9 @@ int16_t FlowController::clearConnection(const std::string 
&connection) {
   return -1;
 }
 
-std::shared_ptr<state::response::ResponseNode> 
FlowController::getAgentManifest() const {
+std::shared_ptr<state::response::ResponseNode> 
FlowController::getAgentManifest() {
   auto agentInfo = 
std::make_shared<state::response::AgentInformation>("agentInfo");
+  
agentInfo->setUpdatePolicyController(std::static_pointer_cast<controllers::UpdatePolicyControllerService>(getControllerService(c2::C2Agent::UPDATE_NAME)));

Review comment:
       Nonconst getters could  lead to some bad practices in my opinion.
   
   Since we only use this UpdatePolicyControllerService to call const functions 
(namely canUpdate()) I think these update_policy_controller_ members could be 
made into a `shared_ptr<const controllers::UpdatePolicyControllerService>`
   And if we were to create a bunch of boilerplate to enable getting a 
shared_ptr<const ControllerServiceNode> from a const FlowController, then we 
could keep getAgentManifest as a const function.




-- 
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]


Reply via email to