types: Migrate to stdplus string maps
Trivial refactor to share more code.
Change-Id: I665bec386ef13a4665536457ab174e621ef64d14
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.hpp b/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.hpp
index 910fecd..087763f 100644
--- a/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.hpp
+++ b/src/ibm/hypervisor-network-mgr-src/hyp_network_manager.hpp
@@ -2,10 +2,10 @@
#include "hyp_ethernet_interface.hpp"
#include "hyp_sys_config.hpp"
-#include "types.hpp"
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
+#include <stdplus/str/maps.hpp>
namespace phosphor
{
@@ -47,7 +47,7 @@
};
using SystemConfPtr = std::unique_ptr<HypSysConfig>;
-using ethIntfMapType = string_umap<std::unique_ptr<HypEthInterface>>;
+using ethIntfMapType = stdplus::string_umap<std::unique_ptr<HypEthInterface>>;
/** @class Manager
* @brief Implementation for the
diff --git a/src/inventory_mac.cpp b/src/inventory_mac.cpp
index f865a78..c9769d1 100644
--- a/src/inventory_mac.cpp
+++ b/src/inventory_mac.cpp
@@ -10,6 +10,7 @@
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/bus/match.hpp>
+#include <stdplus/str/maps.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
#include <filesystem>
@@ -28,7 +29,8 @@
using DbusInterface = std::string;
using PropertyValue = std::string;
using DbusService = std::string;
-using ObjectTree = string_umap<string_umap<std::vector<std::string>>>;
+using ObjectTree =
+ stdplus::string_umap<stdplus::string_umap<std::vector<std::string>>>;
constexpr auto firstBootPath = "/var/lib/network/firstBoot_";
constexpr auto configFile = "/usr/share/network/config.json";
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index 2643d52..f37234c 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -10,6 +10,7 @@
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message/native_types.hpp>
#include <stdplus/pinned.hpp>
+#include <stdplus/str/maps.hpp>
#include <stdplus/zstring_view.hpp>
#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
@@ -111,7 +112,7 @@
/** @brief Persistent map of EthernetInterface dbus objects and their names
*/
- string_umap<std::unique_ptr<EthernetInterface>> interfaces;
+ stdplus::string_umap<std::unique_ptr<EthernetInterface>> interfaces;
std::unordered_map<unsigned, EthernetInterface*> interfacesByIdx;
std::unordered_set<unsigned> ignoredIntf;
diff --git a/src/types.hpp b/src/types.hpp
index 6351b24..45c15aa 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -134,16 +134,6 @@
}
};
-struct string_hash : public std::hash<std::string_view>
-{
- using is_transparent = void;
-};
-template <typename V>
-using string_umap =
- std::unordered_map<std::string, V, string_hash, std::equal_to<>>;
-using string_uset =
- std::unordered_set<std::string, string_hash, std::equal_to<>>;
-
constexpr std::size_t hash_multi() noexcept
{
return 0;