[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1553: MINIFICPP-2094 Change validators from shared to raw pointers

2023-04-12 Thread via GitHub


szaszm commented on code in PR #1553:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1553#discussion_r1163928065


##
libminifi/include/core/CachedValueValidator.h:
##
@@ -67,29 +67,21 @@ class CachedValueValidator {
 return *this;
   }
 
-  explicit CachedValueValidator(const std::shared_ptr& 
other) : validator_(other) {}
+  explicit CachedValueValidator(const gsl::not_null 
other) : validator_(other) {}

Review Comment:
   I'd change this and `setValidator` to const ref as well, but not the data 
member type.



##
libminifi/include/core/Property.h:
##
@@ -96,7 +96,7 @@ class Property {
   std::string getDisplayName() const;
   std::vector getAllowedTypes() const;
   std::string getDescription() const;
-  std::shared_ptr getValidator() const;
+  gsl::not_null getValidator() const;

Review Comment:
   I would return a `const PropertyValidator&` here, too, for simplicity.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1553: MINIFICPP-2094 Change validators from shared to raw pointers

2023-04-12 Thread via GitHub


szaszm commented on code in PR #1553:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1553#discussion_r1163707467


##
extensions/libarchive/BinFilesStaticDefinitions.cpp:
##
@@ -34,19 +34,19 @@ const core::Property BinFiles::MinSize(
 const core::Property BinFiles::MaxSize(
 core::PropertyBuilder::createProperty("Maximum Group Size")
 ->withDescription("The maximum size for the bundle. If not specified, 
there is no maximum.")
-
->withType(core::StandardValidators::get().UNSIGNED_LONG_VALIDATOR)->build());
+
->withType(gsl::make_not_null(&core::StandardValidators::UNSIGNED_LONG_VALIDATOR))->build());

Review Comment:
   I think it would make more sense to have the builder functions take a const 
ref to the validators, instead of a not_null pointer.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org