PEL: Add a flatten() to Section base class

To prepare for supporting PEL sections that can be in any order,
which will probably be stored in a std::vector<unique_ptr<Section>>,
add a pure virtual function in the Section base class so this list
of sections can just be iterated on and have every object in it
flattened.

This flatten() call replaces the operator<<(Stream&, <object>)
functions currently in use, so also convert the operator>> to
unflatten() to make things consistent.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id68f16fe4197b389a8495c21539a64f9f583c800
diff --git a/extensions/openpower-pels/user_header.hpp b/extensions/openpower-pels/user_header.hpp
index d2c6ffc..ae7a922 100644
--- a/extensions/openpower-pels/user_header.hpp
+++ b/extensions/openpower-pels/user_header.hpp
@@ -43,6 +43,13 @@
     explicit UserHeader(Stream& pel);
 
     /**
+     * @brief Flatten the section into the stream
+     *
+     * @param[in] stream - The stream to write to
+     */
+    void flatten(Stream& stream) override;
+
+    /**
      * @brief Returns the subsystem field.
      *
      * @return uint8_t& - the subsystem
@@ -126,11 +133,15 @@
                sizeof(_actionFlags) + sizeof(_reserved4Byte2);
     }
 
-    friend Stream& operator>>(Stream& s, UserHeader& ph);
-    friend Stream& operator<<(Stream& s, UserHeader& ph);
-
   private:
     /**
+     * @brief Fills in the object from the stream data
+     *
+     * @param[in] stream - The stream to read from
+     */
+    void unflatten(Stream& stream);
+
+    /**
      * @brief Validates the section contents
      *
      * Updates _valid (in Section) with the results.
@@ -183,21 +194,5 @@
     uint32_t _reserved4Byte2;
 };
 
-/**
- * @brief Stream extraction operator for the UserHeader
- *
- * @param[in] s - the stream
- * @param[out] uh - the UserHeader object
- */
-Stream& operator>>(Stream& s, UserHeader& uh);
-
-/**
- * @brief Stream insertion operator for the UserHeader
- *
- * @param[out] s - the stream
- * @param[in] uh - the UserHeader object
- */
-Stream& operator<<(Stream& s, UserHeader& uh);
-
 } // namespace pels
 } // namespace openpower