More PDR refactor

- PDRs can be created not just by the platform monitoring and control
  handlers, but by other handlers (eg FRU) as well.
- For this purpose, create the PDR repo in the pldm daemon, and pass it
  to the handlers. This change warranted some refactor.

Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Change-Id: I4e789da9bae99dee1b535d92ce98ae5bb8eed62b
Signed-off-by: George Liu <liuxiwei@inspur.com>
diff --git a/libpldmresponder/pdr.hpp b/libpldmresponder/pdr.hpp
index 0cf9385..78925f7 100644
--- a/libpldmresponder/pdr.hpp
+++ b/libpldmresponder/pdr.hpp
@@ -1,27 +1,12 @@
 #pragma once
 
-#include "effecters.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
-#include "utils.hpp"
 
 #include <stdint.h>
 
-#include <filesystem>
-#include <fstream>
-#include <functional>
-#include <iostream>
-#include <map>
-#include <nlohmann/json.hpp>
 #include <string>
-#include <vector>
-#include <xyz/openbmc_project/Common/error.hpp>
 
 #include "libpldm/pdr.h"
-#include "libpldm/platform.h"
-
-using InternalFailure =
-    sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-namespace fs = std::filesystem;
 
 using namespace pldm::responder::pdr_utils;
 
@@ -33,20 +18,6 @@
 
 namespace pdr
 {
-/** @brief Parse PDR JSONs and build PDR repository
- *
- *  @param[in] dir - directory housing platform specific PDR JSON files
- *  @param[in] repo - instance of the concrete implementation of RepoInterface
- */
-void generate(const std::string& dir, RepoInterface& repo);
-
-/** @brief Build (if not built already) and retrieve PDR
- *
- *  @param[in] dir - directory housing platform specific PDR JSON files
- *
- *  @return RepoInterface& - Reference to instance of pdr::RepoInterface
- */
-RepoInterface& getRepo(const std::string& dir);
 
 /** @brief Build (if not built already) and retrieve PDR by the PDR types
  *
@@ -55,7 +26,7 @@
  *
  *  @return Repo - Instance of pdr::Repo
  */
-Repo getRepoByType(const std::string& dir, Type pdrType);
+void getRepoByType(const Repo& inRepo, Repo& outRepo, Type pdrType);
 
 /** @brief Get the record of PDR by the record handle
  *
@@ -66,7 +37,7 @@
  *
  *  @return pldm_pdr_record - Instance of pdr::RepoInterface
  */
-const pldm_pdr_record* getRecordByHandle(RepoInterface& pdrRepo,
+const pldm_pdr_record* getRecordByHandle(const RepoInterface& pdrRepo,
                                          RecordHandle recordHandle,
                                          PdrEntry& pdrEntry);