Move RAS data support to RasDataParser class
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Ib6d604504cce4564c36fb2b461eb330e97811ee6
diff --git a/analyzer/ras-data/ras-data-parser.hpp b/analyzer/ras-data/ras-data-parser.hpp
new file mode 100644
index 0000000..e484167
--- /dev/null
+++ b/analyzer/ras-data/ras-data-parser.hpp
@@ -0,0 +1,46 @@
+#pragma once
+
+#include <analyzer/resolution.hpp>
+#include <hei_main.hpp>
+#include <nlohmann/json.hpp>
+
+#include <map>
+
+namespace analyzer
+{
+
+/**
+ * @brief Manages the RAS data files and resolves service actions required for
+ * error signatures.
+ */
+class RasDataParser
+{
+ public:
+ /** @brief Default constructor. */
+ RasDataParser()
+ {
+ initDataFiles();
+ }
+
+ private:
+ /** @brief The RAS data files. */
+ std::map<libhei::ChipType_t, nlohmann::json> iv_dataFiles;
+
+ public:
+ /**
+ * @brief Returns a resolution for all the RAS actions needed for the given
+ * signature.
+ * @param i_signature The target error signature.
+ */
+ std::shared_ptr<Resolution>
+ getResolution(const libhei::Signature& i_signature);
+
+ private:
+ /**
+ * @brief Parses all of the RAS data JSON files and validates them against
+ * the associated schema.
+ */
+ void initDataFiles();
+};
+
+} // namespace analyzer