Matt Spinler | 433bead | 2018-04-23 11:08:03 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces.hpp" |
| 4 | #include "manager.hpp" |
| 5 | |
| 6 | namespace ibm |
| 7 | { |
| 8 | namespace logging |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @class Delete |
| 13 | * |
| 14 | * Implements the xyz.openbmc_project.Object.Delete interface |
| 15 | * to delete an IBM logging object. |
| 16 | */ |
| 17 | class Delete : public DeleteObject |
| 18 | { |
| 19 | public: |
| 20 | Delete() = delete; |
| 21 | Delete(const Delete&) = delete; |
| 22 | Delete& operator=(const Delete&) = delete; |
| 23 | Delete(Delete&&) = default; |
| 24 | Delete& operator=(Delete&&) = default; |
| 25 | virtual ~Delete() = default; |
| 26 | |
| 27 | /** |
| 28 | * Constructor |
| 29 | * |
| 30 | * @param[in] bus - the D-Bus bus object |
| 31 | * @param[in] path - the object path |
| 32 | * @param[in] manager - the Manager object |
| 33 | * @param[in] deferSignals - if the object creation signals |
| 34 | * should be deferred |
| 35 | */ |
| 36 | Delete(sdbusplus::bus::bus& bus, const std::string& path, Manager& manager, |
| 37 | bool deferSignals) : |
| 38 | DeleteObject(bus, path.c_str(), deferSignals), |
| 39 | path(path), manager(manager) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * The Delete D-Bus method |
| 45 | */ |
| 46 | inline void delete_() override |
| 47 | { |
| 48 | manager.erase(path); |
| 49 | } |
| 50 | |
| 51 | private: |
| 52 | /** |
| 53 | * The logging entry object path |
| 54 | */ |
| 55 | const std::string path; |
| 56 | |
| 57 | /** |
| 58 | * The Manager object |
| 59 | */ |
| 60 | Manager& manager; |
| 61 | }; |
| 62 | } |
| 63 | } |