summaryrefslogtreecommitdiffstats
path: root/include/ipmid/message/pack.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/ipmid/message/pack.hpp')
-rw-r--r--include/ipmid/message/pack.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 18863c4..598e650 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -20,6 +20,7 @@
#include <memory>
#include <optional>
#include <phosphor-logging/log.hpp>
+#include <string_view>
#include <tuple>
#include <utility>
#include <variant>
@@ -239,6 +240,26 @@ struct PackSingle<std::vector<uint8_t>>
{
static int op(Payload& p, const std::vector<uint8_t>& t)
{
+ if (p.bitCount != 0)
+ {
+ return 1;
+ }
+ p.raw.reserve(p.raw.size() + t.size());
+ p.raw.insert(p.raw.end(), t.begin(), t.end());
+ return 0;
+ }
+};
+
+/** @brief Specialization of PackSingle for std::string_view */
+template <>
+struct PackSingle<std::string_view>
+{
+ static int op(Payload& p, const std::string_view& t)
+ {
+ if (p.bitCount != 0)
+ {
+ return 1;
+ }
p.raw.reserve(p.raw.size() + t.size());
p.raw.insert(p.raw.end(), t.begin(), t.end());
return 0;
@@ -259,6 +280,22 @@ struct PackSingle<std::variant<T...>>
}
};
+/** @brief Specialization of PackSingle for Payload */
+template <>
+struct PackSingle<Payload>
+{
+ static int op(Payload& p, const Payload& t)
+ {
+ if (p.bitCount != 0 || t.bitCount != 0)
+ {
+ return 1;
+ }
+ p.raw.reserve(p.raw.size() + t.raw.size());
+ p.raw.insert(p.raw.end(), t.raw.begin(), t.raw.end());
+ return 0;
+ }
+};
+
} // namespace details
} // namespace message
OpenPOWER on IntegriCloud