blob_handler: move from raw to managed pointer
The blob handler object wants to explictly own its ipmi interface so
that it can't be shared. This was a good-behavior, but now this
codefies it.
Change-Id: Ie368721a58dc30573f37dc3824da230aca5328d3
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/src/ipmiblob/blob_handler.hpp b/src/ipmiblob/blob_handler.hpp
index bc3ebdc..6c4ba7a 100644
--- a/src/ipmiblob/blob_handler.hpp
+++ b/src/ipmiblob/blob_handler.hpp
@@ -3,6 +3,8 @@
#include "blob_interface.hpp"
#include "ipmi_interface.hpp"
+#include <memory>
+
namespace ipmiblob
{
@@ -24,7 +26,14 @@
bmcBlobWriteMeta = 10,
};
- explicit BlobHandler(IpmiInterface* ipmi) : ipmi(ipmi){};
+ explicit BlobHandler(std::unique_ptr<IpmiInterface> ipmi) :
+ ipmi(std::move(ipmi)){};
+
+ ~BlobHandler() = default;
+ BlobHandler(const BlobHandler&) = delete;
+ BlobHandler& operator=(const BlobHandler&) = delete;
+ BlobHandler(BlobHandler&&) = default;
+ BlobHandler& operator=(BlobHandler&&) = default;
/**
* Retrieve the blob count.
@@ -118,7 +127,7 @@
StatResponse statGeneric(BlobOEMCommands command,
const std::vector<std::uint8_t>& request);
- IpmiInterface* ipmi;
+ std::unique_ptr<IpmiInterface> ipmi;
};
} // namespace ipmiblob