topology: class AssocName for association

Define a class AssocName to represent the association definition.

Since the association definition has a forward and reverse name, the
class has 2 members.

So we will always be able to reverse the association definition without
doing any further lookups.

Which removes some branches and optionals and simplifies the code.

Tested: Topology Unit Tests Pass.

Change-Id: I8805d6cb45ba07030d45fc3ca32625c8a6c1b03e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/topology.hpp b/src/entity_manager/topology.hpp
index 9fc3536..cab4533 100644
--- a/src/entity_manager/topology.hpp
+++ b/src/entity_manager/topology.hpp
@@ -10,6 +10,21 @@
 using BoardPathsView = decltype(std::views::keys(
     std::declval<std::map<std::string, std::string>&>()));
 
+class AssocName
+{
+  public:
+    std::string name;
+    std::string reverse;
+
+    AssocName(const std::string& name, const std::string& reverse);
+    AssocName() = delete;
+
+    AssocName getReverse() const;
+
+    bool operator==(const AssocName& other) const = default;
+    bool operator<(const AssocName& other) const;
+};
+
 class Topology
 {
   public:
@@ -30,9 +45,6 @@
 
     void addDownstreamPort(const Path& path, const nlohmann::json& exposesItem);
 
-    // e.g. contained_by, containing, powered_by, ...
-    using AssocName = std::string;
-
     // @brief: fill associations map with the associations for a port identifier
     // such as 'MB Upstream Port'
     void fillAssocsForPortId(
@@ -48,9 +60,6 @@
     void addPort(const PortType& port, const Path& path,
                  const AssocName& assocName);
 
-    static std::optional<std::string> getOppositeAssoc(
-        const AssocName& assocName);
-
     // Maps the port name to the participating paths.
     // each path also has their role(s) in the association.
     // For example a PSU path which is part of "MB Upstream Port"