Add version to BaseBiosTable to prevent data loss

The initial version of the Base BIOS table did not support Value Display
Names (VDN). Support for VDN was introduced in a commit [1]. A BMC image
created without VDN support stores data in the old BaseBiosTable format.
If a new BMC image (with VDN support) is flashed over an older image
(without VDN support), the BIOS manager attempts to read the binary
archive generated by the older BIOS settings manager. Since it doesn't
recognize the newly added property, it assumes the persisted file is
corrupted and ignores all the saved settings.

To prevent the loss of persisted BIOS data, the versioning support
provided by the Cereal library is used. This version information is
utilized to convert the persisted data into the current supported
format.

[1]: https://github.com/openbmc/bios-settings-mgr/commit/1a448ad88fdaec7e082b4a1c437f7f3c990402cd

Change-Id: If68be37e32ae31d7338d8933df945453a30c113a
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/include/manager.hpp b/include/manager.hpp
index 2b79ca9..41977ca 100644
--- a/include/manager.hpp
+++ b/include/manager.hpp
@@ -49,6 +49,14 @@
             std::vector<std::tuple<
                 BoundType, std::variant<int64_t, std::string>, std::string>>>>;
 
+    using oldBaseTable = std::map<
+        std::string,
+        std::tuple<AttributeType, bool, std::string, std::string, std::string,
+                   std::variant<int64_t, std::string>,
+                   std::variant<int64_t, std::string>,
+                   std::vector<std::tuple<
+                       BoundType, std::variant<int64_t, std::string>>>>>;
+
     using ResetFlag = std::map<std::string, ResetFlag>;
 
     using PendingAttributes =
@@ -124,6 +132,28 @@
      */
     PendingAttributes pendingAttributes(PendingAttributes value) override;
 
+    /** @brief Convert the previosuly supported Base BIOS table to newly
+     * supported Base BIOS table
+     *
+     *  @param[in] biosTbl - Old Base BIOS table (without VDN)
+     *  @param[in] baseTable - Recently supported Base BIOS table (with VDN)
+     *
+     *  @return void
+     *
+     */
+    void convertBiosDataToVersion1(Manager::oldBaseTable biosTbl,
+                                   Manager::BaseTable& baseTable);
+
+    /** @brief Convert the VDN supported Base BIOS table to old Base BIOS table
+     *
+     *  @param[in] biosTbl - Old Base BIOS table (without VDN)
+     *  @param[in] baseTable - Recently supported Base BIOS table (with VDN)
+     *
+     *  @return void
+     */
+    void convertBiosDataToVersion0(Manager::oldBaseTable& baseTable,
+                                   Manager::BaseTable& biosTbl);
+
   private:
     /** @enum Index into the fields in the BaseBIOSTable
      */