Add vector package support
Use the exprtk::rtl::vecops::package<double> package so that expressions
can make use of vectors.
Vectors may be useful when needing to sort a list of sensors, for
example.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I0e63e2f9803e81d45e25efd119df5bb885066351
diff --git a/exprtkTools.hpp b/exprtkTools.hpp
index 394053f..d712ef9 100644
--- a/exprtkTools.hpp
+++ b/exprtkTools.hpp
@@ -31,7 +31,6 @@
#define exprtk_disable_string_capabilities
#define exprtk_disable_rtl_io_file
-#define exprtk_disable_rtl_vecops
#define exprtk_disable_return_statement
#define exprtk_disable_rtl_io
#define exprtk_disable_superscalar_unroll
diff --git a/virtualSensor.cpp b/virtualSensor.cpp
index ce429f6..25c127c 100644
--- a/virtualSensor.cpp
+++ b/virtualSensor.cpp
@@ -154,6 +154,7 @@
}
symbols.add_constants();
+ symbols.add_package(vecopsPackage);
expression.register_symbol_table(symbols);
/* parser from exprtk */
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index e39f8d9..a04a743 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -116,6 +116,8 @@
exprtk::symbol_table<double> symbols{};
/** @brief expression from exprtk to calculate sensor value */
exprtk::expression<double> expression{};
+ /** @brief The vecops package so the expression can use vectors */
+ exprtk::rtl::vecops::package<double> vecopsPackage;
/** @brief Read config from json object and initialize sensor data
* for each virtual sensor