Implement the Delete interface

Implement the xyz.openbmc_project.Object.Delete interface
to delete an IBM logging object.

This is required because if someone calls Delete on an entry
in /xyz/openbmc_project/logging/, the REST server will also
call Delete on the corresponding object here.

Change-Id: I742320e49bcf1b371840dda4c7f5b1d0f572ad6a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/manager.cpp b/manager.cpp
index 276a5a5..d47b3ad 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 #include "config.h"
+#include "delete.hpp"
 #include "manager.hpp"
 #include "policy_find.hpp"
 
@@ -68,6 +69,19 @@
 #ifdef USE_POLICY_INTERFACE
     createPolicyInterface(objectPath, properties);
 #endif
+
+    // Emits the interfaces added signal.
+    createDeleteInterface(objectPath);
+}
+
+void Manager::erase(const std::string& objectPath)
+{
+    auto entry = entries.find(getEntryID(objectPath));
+
+    if (entry != entries.end())
+    {
+        entries.erase(entry);
+    }
 }
 
 void Manager::addInterface(const std::string& objectPath, InterfaceType type,
@@ -88,6 +102,14 @@
     }
 }
 
+void Manager::createDeleteInterface(const std::string& objectPath)
+{
+    std::experimental::any object =
+        std::make_shared<Delete>(bus, objectPath, *this, false);
+
+    addInterface(objectPath, InterfaceType::DELETE, object);
+}
+
 #ifdef USE_POLICY_INTERFACE
 void Manager::createPolicyInterface(const std::string& objectPath,
                                     const DbusPropertyMap& properties)
@@ -99,8 +121,6 @@
     object->eventID(std::get<policy::EIDField>(values));
     object->description(std::get<policy::MsgField>(values));
 
-    object->emit_object_added();
-
     std::experimental::any anyObject = object;
 
     addInterface(objectPath, InterfaceType::POLICY, anyObject);