Interface & Factory implementation for VPD Parsers
This commit abstracts the implementation logic of different parser.
A parser factory is implemented to provide instance of required
parser based on the type of vpd file needed to be parsed.
The interface should be derived to implement any further parser logic
related to vpd.
Status: This does not add any new function, so basic testing of
VPD parsing, VPD tool and writes was performed.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I3ce1a2d6b7e8d8984fd7800132e78ab8a9a21e56
diff --git a/vpd-manager/editor_impl.hpp b/vpd-manager/editor_impl.hpp
index d4d5598..9cf3b8a 100644
--- a/vpd-manager/editor_impl.hpp
+++ b/vpd-manager/editor_impl.hpp
@@ -47,7 +47,9 @@
EditorImpl& operator=(const EditorImpl&) = delete;
EditorImpl(EditorImpl&&) = delete;
EditorImpl& operator=(EditorImpl&&) = delete;
- ~EditorImpl() = default;
+ ~EditorImpl()
+ {
+ }
/** @brief Construct EditorImpl class
*
@@ -55,8 +57,8 @@
*/
EditorImpl(const std::string& record, const std::string& kwd,
Binary&& vpd) :
- thisRecord(record, kwd),
- vpdFile(std::move(vpd))
+ startOffset(0),
+ thisRecord(record, kwd), vpdFile(std::move(vpd))
{
}
@@ -68,7 +70,8 @@
const std::string& record, const std::string& kwd,
const sdbusplus::message::object_path& inventoryPath) :
vpdFilePath(path),
- objPath(inventoryPath), jsonFile(json), thisRecord(record, kwd)
+ objPath(inventoryPath), startOffset(0), jsonFile(json),
+ thisRecord(record, kwd)
{
}
@@ -161,7 +164,7 @@
std::fstream vpdFileStream;
// offset to get vpd data from EEPROM
- uint32_t offset;
+ uint32_t startOffset;
// file to store parsed json
const nlohmann::json jsonFile;