summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-09-11 23:32:01 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-09-11 23:32:28 -0500
commit7e7821c68cc4c693d1449da62fbbda840bcace24 (patch)
tree648efef59f3dd5a0d3bb85015f785c1311df7d03
parentd47f1030c1e77c7c2b40defe705be76c321c3464 (diff)
downloadopenpower-vpd-parser-7e7821c68cc4c693d1449da62fbbda840bcace24.tar.gz
openpower-vpd-parser-7e7821c68cc4c693d1449da62fbbda840bcace24.zip
store: add API to check if VPD exists
Change-Id: Ife91241448b64b077a7187d5839953ab0eb990e7 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
-rw-r--r--store.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/store.hpp b/store.hpp
index 9da07f4..6b7f328 100644
--- a/store.hpp
+++ b/store.hpp
@@ -48,6 +48,20 @@ class Store final
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;
OpenPOWER on IntegriCloud