summaryrefslogtreecommitdiffstats
path: root/include/ipmid/message
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-04-08 10:01:33 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-04-09 17:42:38 +0000
commit508c457688e4be878f75f7951ac2e5e95e7de3a8 (patch)
tree28c79d0cbdebeb7e850cea7ae4a5ddd80505a784 /include/ipmid/message
parent336405b85e88fdc46896437cb02fe52b46079369 (diff)
downloadphosphor-host-ipmid-508c457688e4be878f75f7951ac2e5e95e7de3a8.tar.gz
phosphor-host-ipmid-508c457688e4be878f75f7951ac2e5e95e7de3a8.zip
Add a tuple type for packing
At the top level, payload had the ability to pack a tuple, but it did it by splitting it into its parts and packing those individually. But if one of those parts was a tuple, it would fail. This moves the tuple packing code into the packing templates so that it is possible to pack a nested tuple of tuples. Tested-by: newly written tuple unit tests pass Change-Id: Icd80926314072df78b0083a823dcfb46e944e365 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'include/ipmid/message')
-rw-r--r--include/ipmid/message/pack.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 8a9abe1..4314ac1 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -93,6 +93,17 @@ struct PackSingle
}
};
+/** @brief Specialization of PackSingle for std::tuple<T> */
+template <typename... T>
+struct PackSingle<std::tuple<T...>>
+{
+ static int op(Payload& p, const std::tuple<T...>& v)
+ {
+ return std::apply([&p](const T&... args) { return p.pack(args...); },
+ v);
+ }
+};
+
/** @brief Specialization of PackSingle for std::string
* represented as a UCSD-Pascal style string
*/
OpenPOWER on IntegriCloud