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.cpp b/extensions/openpower-pels/user_header.cpp
index 16d6212..117ade1 100644
--- a/extensions/openpower-pels/user_header.cpp
+++ b/extensions/openpower-pels/user_header.cpp
@@ -9,28 +9,25 @@
 
 using namespace phosphor::logging;
 
-Stream& operator>>(Stream& s, UserHeader& uh)
+void UserHeader::unflatten(Stream& stream)
 {
-    s >> uh._header >> uh._eventSubsystem >> uh._eventScope >>
-        uh._eventSeverity >> uh._eventType >> uh._reserved4Byte1 >>
-        uh._problemDomain >> uh._problemVector >> uh._actionFlags >>
-        uh._reserved4Byte2;
-    return s;
+    stream >> _header >> _eventSubsystem >> _eventScope >> _eventSeverity >>
+        _eventType >> _reserved4Byte1 >> _problemDomain >> _problemVector >>
+        _actionFlags >> _reserved4Byte2;
 }
 
-Stream& operator<<(Stream& s, UserHeader& uh)
+void UserHeader::flatten(Stream& stream)
 {
-    s << uh._header << uh._eventSubsystem << uh._eventScope << uh._eventSeverity
-      << uh._eventType << uh._reserved4Byte1 << uh._problemDomain
-      << uh._problemVector << uh._actionFlags << uh._reserved4Byte2;
-    return s;
+    stream << _header << _eventSubsystem << _eventScope << _eventSeverity
+           << _eventType << _reserved4Byte1 << _problemDomain << _problemVector
+           << _actionFlags << _reserved4Byte2;
 }
 
 UserHeader::UserHeader(Stream& pel)
 {
     try
     {
-        pel >> *this;
+        unflatten(pel);
         validate();
     }
     catch (const std::exception& e)