blob: cb8c48907e601f9a6c9486c4272ba5d04559bc46 [file] [log] [blame]
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05001#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
10namespace openpower
11{
12namespace vpd
13{
14namespace ipz
15{
16namespace parser
17{
18
19using ParserInterface = openpower::vpd::parser::interface::ParserInterface;
20using kwdVpdMap = openpower::vpd::inventory::KeywordVpdMap;
21
22class 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 */
35 IpzVpdParser(Binary&& VpdVector) : vpd(std::move(VpdVector))
36 {
37 }
38
39 /**
40 * @brief Parse the memory VPD binary data.
41 * Collects and emplace the keyword-value pairs in map.
42 *
43 * @return map of keyword:value
44 */
45 std::variant<kwdVpdMap, Store> parse();
46
47 /**
48 * @brief An api to return interface name with respect to
49 * the parser selected.
50 *
51 * @return - Interface name for that vpd type.
52 */
53 std::string getInterfaceName() const;
54
55 /** @brief API to check vpd header
56 * @param [in] vpd - VPDheader in binary format
57 */
58 void processHeader();
59
60 private:
61 Binary vpd;
62}; // class IpzVpdParser
63
64} // namespace parser
65} // namespace ipz
66} // namespace vpd
67} // namespace openpower