Create an erase() function

This function is used to delete any objects associated
with an entry ID.

Tested: Erases still work

Change-Id: If80c54b502d64e5d5b3826b303ffe516def1fe8f
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/manager.cpp b/manager.cpp
index 276a5a5..94b4af1 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -70,6 +70,11 @@
 #endif
 }
 
+void Manager::erase(EntryID id)
+{
+    entries.erase(id);
+}
+
 void Manager::addInterface(const std::string& objectPath, InterfaceType type,
                            std::experimental::any& object)
 {
@@ -140,13 +145,7 @@
 
     if (i != interfaces.end())
     {
-        auto id = getEntryID(path);
-
-        auto entry = entries.find(id);
-        if (entry != entries.end())
-        {
-            entries.erase(entry);
-        }
+        erase(getEntryID(path));
     }
 }
 }
diff --git a/manager.hpp b/manager.hpp
index ca5e16b..b3891ac 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -43,6 +43,18 @@
     explicit Manager(sdbusplus::bus::bus& bus);
 
   private:
+    using EntryID = uint32_t;
+    using InterfaceMap = std::map<InterfaceType, std::experimental::any>;
+    using EntryMap = std::map<EntryID, InterfaceMap>;
+
+    /**
+     * Deletes the entry and any child entries with
+     * the specified ID.
+     *
+     * @param[in] id - the entry ID
+     */
+    void erase(EntryID id);
+
     /**
      * The callback for an interfaces added signal
      *
@@ -130,10 +142,6 @@
      */
     sdbusplus::bus::match_t removeMatch;
 
-    using EntryID = uint32_t;
-    using InterfaceMap = std::map<InterfaceType, std::experimental::any>;
-    using EntryMap = std::map<EntryID, InterfaceMap>;
-
     /**
      * A map of the error log IDs to their IBM interface objects.
      * There may be multiple interfaces per ID.