PEL: user header in JSON

The PELTool application is able to convert sections to JSON. This commit
takes care of converting the user header section to JSON.

user header section in JSON sample:

"User Header":[
 {"Section Version": "1"},
 {"Sub-section type": "0"},
 {"Log Committed by": "0x2000"},
 {"Subsystem": "bmc_firmware"},
 {"Event Scope": "entire_platform"},
 {"Event Severity":"unrecoverable"},
 {"Event Type": "na"}
]

Signed-off-by: Aatir Manzur <aatrapps@gmail.com>
Change-Id: I0dca1d87019b9e62d711ee6d034f2e8bc0574c2e
diff --git a/extensions/openpower-pels/user_header.hpp b/extensions/openpower-pels/user_header.hpp
index a1873f5..5689a1c 100644
--- a/extensions/openpower-pels/user_header.hpp
+++ b/extensions/openpower-pels/user_header.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "elog_entry.hpp"
+#include "pel_values.hpp"
 #include "registry.hpp"
 #include "section.hpp"
 #include "stream.hpp"
@@ -165,6 +166,13 @@
                sizeof(_actionFlags) + sizeof(_reserved4Byte2);
     }
 
+    /**
+     * @brief Get section in JSON.
+     * @return std::optional<std::string> - If a section comes with a JSON
+     * repressentation, this would return the string for it.
+     */
+    std::optional<std::string> getJSON() const override;
+
   private:
     /**
      * @brief Fills in the object from the stream data
@@ -224,6 +232,15 @@
      * @brief The second reserved word placeholder.
      */
     uint32_t _reserved4Byte2;
+
+    /**
+     * @brief Helper function to get values from lookup tables.
+     * @return std::string - the value
+     * @param[in] uint8_t - field to get value for
+     * @param[in] PELValues - lookup table
+     */
+    std::string getValue(const uint8_t field,
+                         const pel_values::PELValues& values) const;
 };
 
 } // namespace pels