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/delete.hpp b/delete.hpp
new file mode 100644
index 0000000..22d9447
--- /dev/null
+++ b/delete.hpp
@@ -0,0 +1,63 @@
+#pragma once
+
+#include "interfaces.hpp"
+#include "manager.hpp"
+
+namespace ibm
+{
+namespace logging
+{
+
+/**
+ * @class Delete
+ *
+ * Implements the xyz.openbmc_project.Object.Delete interface
+ * to delete an IBM logging object.
+ */
+class Delete : public DeleteObject
+{
+ public:
+ Delete() = delete;
+ Delete(const Delete&) = delete;
+ Delete& operator=(const Delete&) = delete;
+ Delete(Delete&&) = default;
+ Delete& operator=(Delete&&) = default;
+ virtual ~Delete() = default;
+
+ /**
+ * Constructor
+ *
+ * @param[in] bus - the D-Bus bus object
+ * @param[in] path - the object path
+ * @param[in] manager - the Manager object
+ * @param[in] deferSignals - if the object creation signals
+ * should be deferred
+ */
+ Delete(sdbusplus::bus::bus& bus, const std::string& path, Manager& manager,
+ bool deferSignals) :
+ DeleteObject(bus, path.c_str(), deferSignals),
+ path(path), manager(manager)
+ {
+ }
+
+ /**
+ * The Delete D-Bus method
+ */
+ inline void delete_() override
+ {
+ manager.erase(path);
+ }
+
+ private:
+ /**
+ * The logging entry object path
+ */
+ const std::string path;
+
+ /**
+ * The Manager object
+ */
+ Manager& manager;
+};
+}
+}