summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-05-13 07:40:22 -0700
committerPatrick Venture <venture@google.com>2019-05-13 08:53:42 -0700
commit786a541caadfc0f05e6ff714881cde7b7f483c94 (patch)
tree8c3be9a1557e6a14888012c04e77e1c5e94fcdd8 /src
parent2fe4c652c5b49364e507677e43f2ac05ab8ce79a (diff)
downloadipmi-blob-tool-786a541caadfc0f05e6ff714881cde7b7f483c94.tar.gz
ipmi-blob-tool-786a541caadfc0f05e6ff714881cde7b7f483c94.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/ipmiblob/blob_handler.hpp13
1 files changed, 11 insertions, 2 deletions
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 @@ class BlobHandler : public BlobInterface
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 @@ class BlobHandler : public BlobInterface
StatResponse statGeneric(BlobOEMCommands command,
const std::vector<std::uint8_t>& request);
- IpmiInterface* ipmi;
+ std::unique_ptr<IpmiInterface> ipmi;
};
} // namespace ipmiblob
OpenPOWER on IntegriCloud