blob: 983b8fd13d928680410b188b6eddb7cc93a0ed84 [file] [log] [blame]
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05001#pragma once
2#include "parser_interface.hpp"
3#include "types.hpp"
4
5namespace openpower
6{
7namespace vpd
8{
9namespace parser
10{
11namespace 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
20class 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 Srivastavaf31a91b2022-06-09 08:11:29 -050033 * @param[in] - InventoryPath to call out FRU in case PEL is logged.
girik18bb9852022-11-16 05:48:13 -060034 * @param[in] - vpdFilePath for VPD HW path.
35 * @param[in] - vpdStartOffset for starting offset of VPD.
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050036 * @return - Pointer to concrete parser class object.
37 */
Sunny Srivastavaf31a91b2022-06-09 08:11:29 -050038 static interface::ParserInterface*
girik18bb9852022-11-16 05:48:13 -060039 getParser(const Binary& vpdVector, const std::string& inventoryPath,
40 const std::string& vpdFilePath, uint32_t vpdStartOffset);
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050041
42 /**
43 * @brief A method to delete the parser object.
44 * @param[in] - Pointer to the parser object.
45 */
46 static void freeParser(interface::ParserInterface* parser);
47}; // ParserFactory
48
49} // namespace factory
50} // namespace parser
51} // namespace vpd
52} // namespace openpower