bmc: add utilty method to only add a blob id if not present
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I96f3335a1341bc29eeff398f200214f240861047
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index def20a8..3f2d21d 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -8,6 +8,7 @@
#include "util.hpp"
#include "verify.hpp"
+#include <algorithm>
#include <blobs-ipmid/blobs.hpp>
#include <cstdint>
#include <map>
@@ -176,6 +177,17 @@
};
private:
+ void addBlobId(const std::string& blob)
+ {
+ auto blobIdMatch =
+ std::find_if(blobIDs.begin(), blobIDs.end(),
+ [&blob](const auto& iter) { return (iter == blob); });
+ if (blobIdMatch == blobIDs.end())
+ {
+ blobIDs.push_back(blob);
+ }
+ }
+
/** List of handlers by type. */
std::vector<HandlerPack> handlers;