summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/stream.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/openpower-pels/stream.hpp')
-rw-r--r--extensions/openpower-pels/stream.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/extensions/openpower-pels/stream.hpp b/extensions/openpower-pels/stream.hpp
index 5c813b2..4922bc7 100644
--- a/extensions/openpower-pels/stream.hpp
+++ b/extensions/openpower-pels/stream.hpp
@@ -160,6 +160,23 @@ class Stream
}
/**
+ * @brief Extraction operator for a std::vector<char>
+ *
+ * The vector's size is the amount extracted.
+ *
+ * @param[out] value - filled in with the value
+ * @return Stream&
+ */
+ Stream& operator>>(std::vector<char>& value)
+ {
+ if (!value.empty())
+ {
+ read(value.data(), value.size());
+ }
+ return *this;
+ }
+
+ /**
* @brief Insert operator for a uint8_t
*
* @param[in] value - the value to write to the stream
@@ -240,6 +257,23 @@ class Stream
}
/**
+ * @brief Insert operator for a std::vector<char>
+ *
+ * The full vector is written to the stream.
+ *
+ * @param[in] value - the value to write to the stream
+ * @return Stream&
+ */
+ Stream& operator<<(const std::vector<char>& value)
+ {
+ if (!value.empty())
+ {
+ write(value.data(), value.size());
+ }
+ return *this;
+ }
+
+ /**
* @brief Sets the offset of the stream
*
* @param[in] newOffset - the new offset
OpenPOWER on IntegriCloud