PEL: peltool: Print all PELs into JSON array

Added -a option to display all PELS at once into a JSON array.

Read message registry once to parse SRC sections in PELs.

Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: I19690a866a3348cf2d8a9a89be38bc09e3eb7f9f
diff --git a/extensions/openpower-pels/section.hpp b/extensions/openpower-pels/section.hpp
index 6353e2d..96a1aad 100644
--- a/extensions/openpower-pels/section.hpp
+++ b/extensions/openpower-pels/section.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include "registry.hpp"
 #include "section_header.hpp"
 
 #include <optional>
@@ -51,13 +52,25 @@
     /**
      * @brief Get section in JSON. Derived classes to override when required to.
      * @return std::optional<std::string> - If a section comes with a JSON
-     * repressentation, this would return the string for it.
+     * representation, this would return the string for it.
      */
     virtual std::optional<std::string> getJSON() const
     {
         return std::nullopt;
     }
 
+    /**
+     * @brief Get section in JSON. Derived classes to override when required to.
+     * @param[in] registry - Registry object reference
+     * @return std::optional<std::string> - If a section comes with a JSON
+     * representation, this would return the string for it.
+     */
+    virtual std::optional<std::string>
+        getJSON(message::Registry& registry) const
+    {
+        return std::nullopt;
+    }
+
   protected:
     /**
      * @brief Returns the flattened size of the section header