summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/private_header.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-09-05 12:58:53 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-09-10 20:18:56 +0000
commitcf5a8d0f219691c4508bff85af59167ed9a5d681 (patch)
treeb46181bd30416f6f4b008523aa2345c2fa35e883 /extensions/openpower-pels/private_header.hpp
parent5fa87f08fa9ae9a41acf7b5f3159d9916d97e40e (diff)
downloadphosphor-logging-cf5a8d0f219691c4508bff85af59167ed9a5d681.tar.gz
phosphor-logging-cf5a8d0f219691c4508bff85af59167ed9a5d681.zip
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
Diffstat (limited to 'extensions/openpower-pels/private_header.hpp')
-rw-r--r--extensions/openpower-pels/private_header.hpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/extensions/openpower-pels/private_header.hpp b/extensions/openpower-pels/private_header.hpp
index d9353ab..4a8b330 100644
--- a/extensions/openpower-pels/private_header.hpp
+++ b/extensions/openpower-pels/private_header.hpp
@@ -51,6 +51,13 @@ class PrivateHeader : public Section
explicit PrivateHeader(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 creation timestamp
*
* @return BCDTime& - the timestamp
@@ -157,11 +164,15 @@ class PrivateHeader : public Section
sizeof(_creatorVersion) + sizeof(_plid) + sizeof(_id);
}
- friend Stream& operator>>(Stream& s, PrivateHeader& ph);
- friend Stream& operator<<(Stream& s, PrivateHeader& 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.
@@ -221,22 +232,6 @@ class PrivateHeader : public Section
};
/**
- * @brief Stream extraction operator for the PrivateHeader
- *
- * @param[in] s - the stream
- * @param[out] ph - the PrivateHeader object
- */
-Stream& operator>>(Stream& s, PrivateHeader& ph);
-
-/**
- * @brief Stream insertion operator for the PrivateHeader
- *
- * @param[out] s - the stream
- * @param[in] ph - the PrivateHeader object
- */
-Stream& operator<<(Stream& s, PrivateHeader& ph);
-
-/**
* @brief Stream extraction operator for the CreatorVersion
*
* @param[in] s - the stream
OpenPOWER on IntegriCloud