PEL: Allow adding to AdditionalData

Add an interface to add a key/value pair to the data stored in
the AdditionalData class.  Also add an interface to get to the
raw underlying map of data.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I61200f92b45be8e86992d3f4888698d6a5bbe251
diff --git a/extensions/openpower-pels/additional_data.hpp b/extensions/openpower-pels/additional_data.hpp
index f133e0f..ca4a47d 100644
--- a/extensions/openpower-pels/additional_data.hpp
+++ b/extensions/openpower-pels/additional_data.hpp
@@ -37,7 +37,7 @@
      * @param[in] ad - the AdditionalData property vector with
      *                 entries of "KEY=VALUE"
      */
-    AdditionalData(const std::vector<std::string>& ad)
+    explicit AdditionalData(const std::vector<std::string>& ad)
     {
         for (auto& item : ad)
         {
@@ -101,6 +101,27 @@
         return j;
     }
 
+    /**
+     * @brief Returns the underlying map of data
+     *
+     * @return const std::map<std::string, std::string>& - The data
+     */
+    const std::map<std::string, std::string>& getData() const
+    {
+        return _data;
+    }
+
+    /**
+     * @brief Adds a key/value pair to the object
+     *
+     * @param[in] key - The key
+     * @param[in] value - The value
+     */
+    void add(const std::string& key, const std::string& value)
+    {
+        _data.emplace(key, value);
+    }
+
   private:
     /**
      * @brief a map of keys to values
diff --git a/test/openpower-pels/additional_data_test.cpp b/test/openpower-pels/additional_data_test.cpp
index f3f9824..c93fdf2 100644
--- a/test/openpower-pels/additional_data_test.cpp
+++ b/test/openpower-pels/additional_data_test.cpp
@@ -47,3 +47,19 @@
     ad.remove("KEY1");
     EXPECT_FALSE(ad.getValue("KEY1"));
 }
+
+TEST(AdditionalDataTest, AddData)
+{
+    AdditionalData ad;
+
+    ad.add("KEY1", "VALUE1");
+    EXPECT_EQ(*(ad.getValue("KEY1")), "VALUE1");
+
+    ad.add("KEY2", "VALUE2");
+    EXPECT_EQ(*(ad.getValue("KEY2")), "VALUE2");
+
+    std::map<std::string, std::string> expected{{"KEY1", "VALUE1"},
+                                                {"KEY2", "VALUE2"}};
+
+    EXPECT_EQ(expected, ad.getData());
+}