SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | #include "parser_interface.hpp" |
| 3 | #include "types.hpp" |
| 4 | |
| 5 | namespace openpower |
| 6 | { |
| 7 | namespace vpd |
| 8 | { |
| 9 | namespace parser |
| 10 | { |
| 11 | namespace factory |
| 12 | { |
| 13 | /** @class ParserFactory |
| 14 | * @brief Factory calss to instantiate concrete parser class. |
| 15 | * |
| 16 | * This class should be used to instantiate an instance of parser class based |
| 17 | * on the typeof vpd file. |
| 18 | */ |
| 19 | |
| 20 | class ParserFactory |
| 21 | { |
| 22 | public: |
| 23 | ParserFactory() = delete; |
| 24 | ~ParserFactory() = delete; |
| 25 | ParserFactory(const ParserFactory&) = delete; |
| 26 | ParserFactory& operator=(const ParserFactory&) = delete; |
| 27 | ParserFactory(ParserFactory&&) = delete; |
| 28 | ParserFactory& operator=(ParserFactory&&) = delete; |
| 29 | |
| 30 | /** |
| 31 | * @brief A method to get object of concrete parser class. |
| 32 | * @param[in] - vpd file to check for the type. |
Sunny Srivastava | f31a91b | 2022-06-09 08:11:29 -0500 | [diff] [blame] | 33 | * @param[in] - InventoryPath to call out FRU in case PEL is logged. |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 34 | * @return - Pointer to concrete parser class object. |
| 35 | */ |
Sunny Srivastava | f31a91b | 2022-06-09 08:11:29 -0500 | [diff] [blame] | 36 | static interface::ParserInterface* |
| 37 | getParser(const Binary& vpdVector, const std::string& inventoryPath); |
SunnySrivastava1984 | e12b181 | 2020-05-26 02:23:11 -0500 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * @brief A method to delete the parser object. |
| 41 | * @param[in] - Pointer to the parser object. |
| 42 | */ |
| 43 | static void freeParser(interface::ParserInterface* parser); |
| 44 | }; // ParserFactory |
| 45 | |
| 46 | } // namespace factory |
| 47 | } // namespace parser |
| 48 | } // namespace vpd |
| 49 | } // namespace openpower |