Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index f8af707..395d6a0 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -28,6 +28,9 @@
 #include <utils/hex_utils.hpp>
 #include <utils/json_utils.hpp>
 
+#include <array>
+#include <string_view>
+
 namespace redfish
 {
 
@@ -792,9 +795,11 @@
         asyncResp->res.jsonValue["@odata.id"] =
             "/redfish/v1/Systems/system/Memory";
 
+        constexpr std::array<std::string_view, 1> interfaces{
+            "xyz.openbmc_project.Inventory.Item.Dimm"};
         collection_util::getCollectionMembers(
             asyncResp, boost::urls::url("/redfish/v1/Systems/system/Memory"),
-            {"xyz.openbmc_project.Inventory.Item.Dimm"});
+            interfaces);
         });
 }