PEL: Flatten PEL from objects

Now that the Generic section object has been introduced so there are
objects for every section, a flatten can be done by flattening every
object inside the PEL and the previous workaround to save the original
raw data can be removed.

This also adds a test case that uses a real PEL from a previous
generation of systems to flatten to give some better coverage than just
using hand coded PEL sections.

A side affect of this is that the PEL constructors that take the raw
data cannot take a const vector of data, as the Stream class that will
be used to read from the vector cannot take a const.  Testcases have
been updated to ensure this data is not modified.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I64ae1d1d4a742c80e14666d6b2a6e1e0efd5fd62
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index 8c9faae..56e356f 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -18,6 +18,7 @@
 TEST_F(PELTest, FlattenTest)
 {
     auto data = pelDataFactory(TestPelType::pelSimple);
+    auto origData = *data;
     auto pel = std::make_unique<PEL>(*data);
 
     // Check a few fields
@@ -29,7 +30,7 @@
 
     // Test that data in == data out
     auto flattenedData = pel->data();
-    ASSERT_EQ(*data, flattenedData);
+    ASSERT_EQ(origData, flattenedData);
 }
 
 TEST_F(PELTest, CommitTimeTest)
@@ -158,6 +159,7 @@
 
     // Increment the section count
     data->at(27) += 2;
+    auto origData = *data;
 
     PEL pel{*data};
 
@@ -183,6 +185,11 @@
 
     EXPECT_TRUE(foundXX);
     EXPECT_TRUE(foundYY);
+
+    // Now flatten and check
+    auto newData = pel.data();
+
+    EXPECT_EQ(origData, newData);
 }
 
 // Test that an invalid section will still get a Generic object