Add device-management infrastructure

We're moving toward having dbus-sensors take over sensor device
lifecycle management from entity-manager; this code (loosely based on
entity-manager's include/devices.hpp and src/overlay.cpp) provides some
general-purpose utilities for instantiating and destroying devices.

This also includes a variant of setupPropertiesChangedMatches() taking
an I2CDeviceTypeMap instead of a span of C strings, so that we can
support both existing sensor daemons and ones that get converted to use
that instead of the simple string arrays they currently employ.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I39fcd0de2c70cd58b4d132cdcae5f82319732dbb
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 7b33cb7..700b336 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -16,6 +16,7 @@
 
 #include "dbus-sensor_config.h"
 
+#include <DeviceMgmt.hpp>
 #include <Utils.hpp>
 #include <boost/container/flat_map.hpp>
 #include <sdbusplus/asio/connection.hpp>
@@ -713,3 +714,17 @@
     }
     return matches;
 }
+
+std::vector<std::unique_ptr<sdbusplus::bus::match_t>>
+    setupPropertiesChangedMatches(
+        sdbusplus::asio::connection& bus, const I2CDeviceTypeMap& typeMap,
+        const std::function<void(sdbusplus::message_t&)>& handler)
+{
+    std::vector<const char*> types;
+    types.reserve(typeMap.size());
+    for (const auto& [type, dt] : typeMap)
+    {
+        types.push_back(type.data());
+    }
+    return setupPropertiesChangedMatches(bus, {types}, handler);
+}