szaszm commented on a change in pull request #710: MINIFICPP - 1110,1111 - 
PublishKafka, OPC processors should config and
URL: https://github.com/apache/nifi-minifi-cpp/pull/710#discussion_r376419716
 
 

 ##########
 File path: libminifi/include/core/state/Value.h
 ##########
 @@ -115,6 +125,64 @@ class Value {
   std::type_index type_id;
 };
 
+class UInt32Value : public Value {
+ public:
+  explicit UInt32Value(uint32_t value)
+      : Value(std::to_string(value)),
+        value(value) {
+    setTypeId<uint32_t>();
+  }
+
+  explicit UInt32Value(const std::string &strvalue)
+      : Value(strvalue),
+        value(std::stoul(strvalue)) {
+    /**
+     * This is a fundamental change in that we would be changing where this 
error occurs.
+     * We should be prudent about breaking backwards compatibility, but since 
Uint32Value
+     * is only created with a validator and type, we **should** be okay.
+     */
+    const auto negative = strvalue.find_first_of('-') != std::string::npos;
+     if (negative){
+       throw std::out_of_range("negative value detected");
+     }
+    setTypeId<uint32_t>();
+  }
+
+  uint32_t getValue() const {
+    return value;
+  }
+ protected:
+
+  virtual bool getValue(uint32_t &ref) {
+    ref = value;
+    return true;
+  }
+
+  virtual bool getValue(int &ref) {
+    if (value <= (std::numeric_limits<int>::max)()) {
 
 Review comment:
   My bad, I confused `value` with `ref`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to