Update keyword’s value on primary or backup path

This commit adds the stub API in BackupAndRestore, to update keyword’s
value on backup or primary path. The stub API is triggered when
vpd-manager’s interface method UpdateKeyword/WriteKeyword is triggered.

This commit also implements using shared pointer to hold the
BackupAndRestore object in manager, and changes are made to use same in
the manager.

Change-Id: I078d28d1bb3e2cc13ae38a75543c3208ffb5cf3f
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-manager/src/backup_restore.cpp b/vpd-manager/src/backup_restore.cpp
index e275ea2..d6a8a34 100644
--- a/vpd-manager/src/backup_restore.cpp
+++ b/vpd-manager/src/backup_restore.cpp
@@ -394,4 +394,40 @@
 {
     m_backupAndRestoreStatus = i_status;
 }
+
+int BackupAndRestore::updateKeywordOnPrimaryOrBackupPath(
+    const std::string& i_fruPath,
+    [[maybe_unused]] const types::WriteVpdParams& i_paramsToWriteData)
+    const noexcept
+{
+    if (i_fruPath.empty())
+    {
+        logging::logMessage("Given FRU path is empty.");
+        return constants::FAILURE;
+    }
+
+    if (m_backupAndRestoreCfgJsonObj.contains("source") &&
+        m_backupAndRestoreCfgJsonObj["source"].value("hardwarePath", "") ==
+            i_fruPath &&
+        m_backupAndRestoreCfgJsonObj.contains("destination") &&
+        !m_backupAndRestoreCfgJsonObj["destination"]
+             .value("hardwarePath", "")
+             .empty())
+    {
+        // ToDo implementation needs to be added
+    }
+    else if (m_backupAndRestoreCfgJsonObj.contains("destination") &&
+             m_backupAndRestoreCfgJsonObj["destination"].value(
+                 "hardwarePath", "") == i_fruPath &&
+             m_backupAndRestoreCfgJsonObj.contains("source") &&
+             !m_backupAndRestoreCfgJsonObj["source"]
+                  .value("hardwarePath", "")
+                  .empty())
+    {
+        // ToDo implementation needs to be added
+    }
+
+    return constants::SUCCESS;
+}
+
 } // namespace vpd