SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "store.hpp" |
| 4 | #include "types.hpp" |
| 5 | |
| 6 | #include <variant> |
| 7 | |
| 8 | namespace openpower |
| 9 | { |
| 10 | namespace vpd |
| 11 | { |
| 12 | namespace parser |
| 13 | { |
| 14 | namespace interface |
| 15 | { |
| 16 | using kwdVpdMap = openpower::vpd::inventory::KeywordVpdMap; |
| 17 | |
| 18 | /** @class ParserInterface |
| 19 | * @brief Interface class for vpd parsers. |
| 20 | * |
| 21 | * Any concrete parser class, implementing the parser logic needs to |
| 22 | * derive from this interface class and ovverride the methods declared |
| 23 | * in this class. |
| 24 | */ |
| 25 | class ParserInterface |
| 26 | { |
| 27 | public: |
| 28 | /** |
| 29 | * @brief An api to implement parsing logic for VPD file. |
| 30 | * Needs to be implemented by all the class deriving from |
| 31 | * parser inerface. |
| 32 | * |
| 33 | * @return parsed format for vpd data, depending upon the |
| 34 | * parsing logic. |
| 35 | */ |
| 36 | virtual std::variant<kwdVpdMap, Store> parse() = 0; |
| 37 | |
| 38 | /** |
| 39 | * @brief An api to return interface name which will hold the |
| 40 | * data on cache. |
| 41 | * Needs to be implemented by all the class deriving fronm |
| 42 | * parser inerface |
| 43 | * |
| 44 | * @return - Interface name for that vpd type. |
| 45 | */ |
| 46 | virtual std::string getInterfaceName() const = 0; |
| 47 | // virtual void test() = 0; |
| 48 | |
| 49 | /** |
| 50 | * @brief Virtual destructor for the interface. |
| 51 | */ |
| 52 | virtual ~ParserInterface() |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | }; // class Parserinterface |
| 57 | } // namespace interface |
| 58 | } // namespace parser |
| 59 | } // namespace vpd |
| 60 | } // namespace openpower |