1 #pragma once 2 3 #include "const.hpp" 4 #include "parser_interface.hpp" 5 #include "store.hpp" 6 #include "types.hpp" 7 8 #include <vector> 9 10 namespace openpower 11 { 12 namespace vpd 13 { 14 namespace ipz 15 { 16 namespace parser 17 { 18 19 using ParserInterface = openpower::vpd::parser::interface::ParserInterface; 20 using kwdVpdMap = openpower::vpd::inventory::KeywordVpdMap; 21 22 class IpzVpdParser : public ParserInterface 23 { 24 public: 25 IpzVpdParser() = delete; 26 IpzVpdParser(const IpzVpdParser&) = delete; 27 IpzVpdParser& operator=(const IpzVpdParser&) = delete; 28 IpzVpdParser(IpzVpdParser&&) = delete; 29 IpzVpdParser& operator=(IpzVpdParser&&) = delete; 30 ~IpzVpdParser() = default; 31 32 /** 33 * @brief Constructor 34 * @param[in] - VpdVector - vpd buffer 35 * @param[in] - path - Inventory Path 36 * @param[in] - vpdFilePath - VPD H/w path 37 * @param[in] - vpdStartOffset - VPD starting offset 38 */ 39 IpzVpdParser(const Binary& VpdVector, const std::string& path, 40 const std::string& vpdFilePath, uint32_t vpdStartOffset) : 41 vpd(VpdVector), 42 inventoryPath(path), vpdFilePath(vpdFilePath), 43 vpdStartOffset(vpdStartOffset) 44 {} 45 46 /** 47 * @brief Parse the memory VPD binary data. 48 * Collects and emplace the keyword-value pairs in map. 49 * 50 * @return map of keyword:value 51 */ 52 std::variant<kwdVpdMap, Store> parse(); 53 54 /** 55 * @brief An api to return interface name with respect to 56 * the parser selected. 57 * 58 * @return - Interface name for that vpd type. 59 */ 60 std::string getInterfaceName() const; 61 62 /** @brief API to check vpd header 63 * @param [in] vpd - VPDheader in binary format 64 */ 65 void processHeader(); 66 67 private: 68 const Binary& vpd; 69 70 /*Inventory path of the FRU */ 71 const std::string inventoryPath; 72 73 /* VPD Path */ 74 const std::string vpdFilePath; 75 76 /* Offset */ 77 uint32_t vpdStartOffset; 78 79 }; // class IpzVpdParser 80 81 } // namespace parser 82 } // namespace ipz 83 } // namespace vpd 84 } // namespace openpower 85