Add basic math support to template char replace
This adds basic math support, so we can modify entities
based on found properties.
Tested: Modified PSU config in follow-on commit, all sensors
still available.
Change-Id: I07286cf17b04b7e3acdbfdfa43454f17338bf56b
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/EntityManager.hpp b/include/EntityManager.hpp
index 74ba827..548cc5f 100644
--- a/include/EntityManager.hpp
+++ b/include/EntityManager.hpp
@@ -47,7 +47,15 @@
}
if (findSn != findAsset->end())
{
- sn = findSn->get<std::string>();
+ const std::string* getSn = findSn->get_ptr<const std::string*>();
+ if (getSn != nullptr)
+ {
+ sn = *getSn;
+ }
+ else
+ {
+ sn = findSn->dump();
+ }
}
}
@@ -81,7 +89,15 @@
}
if (findSn != findAsset->end())
{
- sn = findSn->get<std::string>();
+ const std::string* getSn = findSn->get_ptr<const std::string*>();
+ if (getSn != nullptr)
+ {
+ sn = *getSn;
+ }
+ else
+ {
+ sn = findSn->dump();
+ }
}
}
@@ -89,4 +105,13 @@
"REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.InventoryRemoved",
"REDFISH_MESSAGE_ARGS=%s,%s,%s", model.c_str(),
type.c_str(), sn.c_str(), NULL);
-}
\ No newline at end of file
+}
+
+enum class TemplateOperation
+{
+ addition,
+ division,
+ multiplication,
+ subtraction,
+ modulo,
+};
\ No newline at end of file