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



##########
File path: libminifi/include/core/state/Value.h
##########
@@ -380,9 +411,59 @@ class Int64Value : public Value {
     return false;
   }
 
+  virtual bool getValue(double& /*ref*/) {
+    return false;
+  }
+
   int64_t value;
 };
 
+class DoubleValue : public Value {
+ public:
+  explicit DoubleValue(double value)
+      : Value(std::to_string(value)),
+      value(value) {
+    setTypeId<double>();
+  }
+  explicit DoubleValue(const std::string &strvalue)
+      : Value(strvalue) {
+    utils::internal::ValueParser(strvalue).parse(value).parseEnd();
+    setTypeId<double>();
+  }
+
+  double getValue() {
+    return value;
+  }
+
+ protected:
+  virtual bool getValue(int&) {
+    return false;
+  }
+
+  virtual bool getValue(uint32_t&) {
+    return false;
+  }
+
+  virtual bool getValue(int64_t&) {
+    return false;

Review comment:
       Thanks, I've added this (extended to work with signed-unsigned casts) 
function and changed to use it where it makes sense in 
[d28d399](https://github.com/apache/nifi-minifi-cpp/pull/1032/commits/d28d3994fe633513158fb739edc49f69023b8a39)
   Also added a bunch more unit tests to verify the behaviour.




-- 
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:
[email protected]


Reply via email to