store: add API to check if VPD exists
Change-Id: Ife91241448b64b077a7187d5839953ab0eb990e7
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/store.hpp b/store.hpp
index 9da07f4..6b7f328 100644
--- a/store.hpp
+++ b/store.hpp
@@ -48,6 +48,20 @@
template<Record R, record::Keyword K>
inline const std::string& get() const;
+ /** @brief Checks if VPD exists in store
+ *
+ * @tparam R - VPD record
+ * @tparam K - VPD keyword
+ * @returns true if {R,K} exists
+ */
+ template<Record R, record::Keyword K>
+ bool exists() const
+ {
+ static const std::string record = getRecord<R>();
+ static const std::string keyword = record::getKeyword<K>();
+ return vpd.count(record) && vpd.at(record).count(keyword);
+ }
+
private:
/** @brief The store for parsed VPD */
Parsed vpd;