fgerlits commented on code in PR #1316:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1316#discussion_r859555580


##########
libminifi/include/core/yaml/YamlConfiguration.h:
##########
@@ -277,6 +278,7 @@ class YamlConfiguration : public FlowConfiguration {
    * @return         the parsed or generated UUID string
    */
   std::string getOrGenerateId(const YAML::Node& yamlNode, const std::string& 
idField = "id");
+  std::string getRequiredIdField(const YAML::Node& yaml_node, std::string_view 
yaml_section = "", std::string error_message = "");

Review Comment:
   could the type of `error_message` be `const std::string&`, to avoid copying?



##########
libminifi/src/core/yaml/YamlConfiguration.cpp:
##########
@@ -908,6 +914,14 @@ YAML::Node YamlConfiguration::getOptionalField(const 
YAML::Node& yamlNode, const
   return result;
 }
 
+void YamlConfiguration::addNewId(const std::string& uuid) {
+  if (uuids_.find(uuid) != uuids_.end()) {
+    throw Exception(ExceptionType::GENERAL_EXCEPTION, "UUID " + uuid + " is 
duplicated in the flow configuration");
+  }
+
+  uuids_.insert(uuid);

Review Comment:
   minor, but `insert()` returns whether the insertion was successful, so we 
could avoid doing two lookups:
   ```suggestion
     const auto [_, success] = uuids_.insert(uuid);
     if (!success) {
       throw Exception(ExceptionType::GENERAL_EXCEPTION, "UUID " + uuid + " is 
duplicated in the flow configuration");
     }
   ```



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