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


##########
extensions/expression-language/ProcessContextExpr.h:
##########
@@ -50,24 +50,18 @@ class ProcessContextExpr final : public 
core::ProcessContextImpl {
 
   ~ProcessContextExpr() override = default;
 
-  bool getProperty(const Property& property, std::string &value, const 
FlowFile* const flow_file) override;
+  nonstd::expected<std::string, std::error_code> getProperty(std::string_view 
name, const FlowFile*) const override;
+  nonstd::expected<std::string, std::error_code> 
getDynamicProperty(std::string_view name, const FlowFile*) const override;
 
-  bool getProperty(const PropertyReference& property, std::string &value, 
const FlowFile* const flow_file) override;
+  nonstd::expected<void, std::error_code> setProperty(std::string_view name, 
std::string value) override;
+  nonstd::expected<void, std::error_code> setDynamicProperty(std::string name, 
std::string value) override;
 
-  bool getDynamicProperty(const Property &property, std::string &value, const 
FlowFile* const flow_file) override;
-
-  bool setProperty(const std::string& property, std::string value) override;
-
-  bool setDynamicProperty(const std::string& property, std::string value) 
override;
-
-  using ProcessContextImpl::getProperty;
+  std::map<std::string, std::string> getDynamicProperties(const FlowFile*) 
const override;
 
  private:
-  bool getProperty(bool supports_expression_language, std::string_view 
property_name, std::string& value, const FlowFile* const flow_file);
+  mutable std::unordered_map<std::string, expression::Expression, 
utils::string::transparent_string_hash, std::equal_to<>> cached_expressions_;
+  mutable std::unordered_map<std::string, expression::Expression, 
utils::string::transparent_string_hash, std::equal_to<>> 
cached_dynamic_expressions_;

Review Comment:
   I was worried about whether the hashes of `std::string{"abc"}` and 
`std::string_view{"abc"}` could be different, but now I see that they are 
guaranteed to be equal, so it's all good.



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