entity-manager: remove dead code
After the probe match refactor, some code is unused.
Change-Id: Ia2e2b708db17aa7a93e8a08a3260fe3af0f42b1f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/include/VariantVisitors.hpp b/include/VariantVisitors.hpp
index b8ce5b2..771d7d1 100644
--- a/include/VariantVisitors.hpp
+++ b/include/VariantVisitors.hpp
@@ -20,20 +20,6 @@
#include <string>
#include <variant>
-struct VariantToFloatVisitor
-{
-
- template <typename T>
- float operator()(const T& t) const
- {
- if constexpr (std::is_arithmetic_v<T>)
- {
- return static_cast<float>(t);
- }
- throw std::invalid_argument("Cannot translate type to float");
- }
-};
-
struct VariantToIntVisitor
{
template <typename T>
@@ -47,19 +33,6 @@
}
};
-struct VariantToUnsignedIntVisitor
-{
- template <typename T>
- unsigned int operator()(const T& t) const
- {
- if constexpr (std::is_arithmetic_v<T>)
- {
- return static_cast<unsigned int>(t);
- }
- throw std::invalid_argument("Cannot translate type to unsigned int");
- }
-};
-
struct VariantToStringVisitor
{
template <typename T>
@@ -76,16 +49,3 @@
throw std::invalid_argument("Cannot translate type to string");
}
};
-
-struct VariantToDoubleVisitor
-{
- template <typename T>
- double operator()(const T& t) const
- {
- if constexpr (std::is_arithmetic_v<T>)
- {
- return static_cast<double>(t);
- }
- throw std::invalid_argument("Cannot translate type to double");
- }
-};
diff --git a/src/Utils.cpp b/src/Utils.cpp
index d9ab4ed..45c42e8 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -460,67 +460,3 @@
{
return std::visit(MatchProbeForwarder(probe), dbusValue);
}
-
-bool matchProbeOld(const nlohmann::json& probe,
- const BasicVariantType& dbusValue)
-{
- bool deviceMatches = true;
-
- switch (probe.type())
- {
- case nlohmann::json::value_t::string:
- {
- std::regex search(probe.get<std::string>());
- std::smatch regMatch;
-
- // convert value to string respresentation
- std::string probeValue =
- std::visit(VariantToStringVisitor(), dbusValue);
- if (!std::regex_search(probeValue, regMatch, search))
- {
- deviceMatches = false;
- break;
- }
- break;
- }
- case nlohmann::json::value_t::boolean:
- case nlohmann::json::value_t::number_unsigned:
- {
- unsigned int probeValue =
- std::visit(VariantToUnsignedIntVisitor(), dbusValue);
-
- if (probeValue != probe.get<unsigned int>())
- {
- deviceMatches = false;
- }
- break;
- }
- case nlohmann::json::value_t::number_integer:
- {
- int probeValue = std::visit(VariantToIntVisitor(), dbusValue);
-
- if (probeValue != probe.get<int>())
- {
- deviceMatches = false;
- }
- break;
- }
- case nlohmann::json::value_t::number_float:
- {
- float probeValue = std::visit(VariantToFloatVisitor(), dbusValue);
-
- if (probeValue != probe.get<float>())
- {
- deviceMatches = false;
- }
- break;
- }
- default:
- {
- std::cerr << "unexpected dbus probe type " << probe.type_name()
- << "\n";
- deviceMatches = false;
- }
- }
- return deviceMatches;
-}