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));
}
}
}