SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 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 | */ |
Sunny Srivastava | f31a91b | 2022-06-09 08:11:29 -0500 | [diff] [blame] | 35 | IpzVpdParser(const Binary& VpdVector, const std::string& path) : |
| 36 | vpd(VpdVector), inventoryPath(path) |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 37 | { |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @brief Parse the memory VPD binary data. |
| 42 | * Collects and emplace the keyword-value pairs in map. |
| 43 | * |
| 44 | * @return map of keyword:value |
| 45 | */ |
| 46 | std::variant<kwdVpdMap, Store> parse(); |
| 47 | |
| 48 | /** |
| 49 | * @brief An api to return interface name with respect to |
| 50 | * the parser selected. |
| 51 | * |
| 52 | * @return - Interface name for that vpd type. |
| 53 | */ |
| 54 | std::string getInterfaceName() const; |
| 55 | |
| 56 | /** @brief API to check vpd header |
| 57 | * @param [in] vpd - VPDheader in binary format |
| 58 | */ |
| 59 | void processHeader(); |
| 60 | |
| 61 | private: |
PriyangaRamasamy | 33c61c2 | 2021-04-06 11:15:57 -0500 | [diff] [blame] | 62 | const Binary& vpd; |
Sunny Srivastava | f31a91b | 2022-06-09 08:11:29 -0500 | [diff] [blame] | 63 | |
| 64 | /*Inventory path of the FRU */ |
| 65 | const std::string inventoryPath; |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 66 | }; // class IpzVpdParser |
| 67 | |
| 68 | } // namespace parser |
| 69 | } // namespace ipz |
| 70 | } // namespace vpd |
| 71 | } // namespace openpower |