Remove read_into_tuple
This function can be easily superseded by pack expressions, simplifying
the code.
Tested:
Boot up gb200 in qemu. Redfish service validator/login/logout all pass.
Change-Id: I999e0947c2ee124ca3dc8dc9718ddb13c2c52ea4
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/sdbusplus/asio/connection.hpp b/include/sdbusplus/asio/connection.hpp
index 76e03bf..0c9ba2f 100644
--- a/include/sdbusplus/asio/connection.hpp
+++ b/include/sdbusplus/asio/connection.hpp
@@ -34,7 +34,6 @@
#include <sdbusplus/asio/detail/async_send_handler.hpp>
#include <sdbusplus/message.hpp>
#include <sdbusplus/utility/make_dbus_args_tuple.hpp>
-#include <sdbusplus/utility/read_into_tuple.hpp>
#include <sdbusplus/utility/type_traits.hpp>
#include <chrono>
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 94f8f33..1a900b3 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -202,10 +202,12 @@
details::NonDbusArgsCount<InputTupleType>::size(), InputTupleType>;
DbusTupleType dbusArgs;
- if (!utility::read_into_tuple(dbusArgs, m))
+ if (m.is_method_error())
{
return -EINVAL;
}
+ std::apply([&m](auto&... x) { m.read(x...); }, dbusArgs);
+
auto ret = m.new_method_return();
if constexpr (callbackWantsMessage<CallbackType>)
{
@@ -256,7 +258,7 @@
DbusTupleType dbusArgs;
try
{
- utility::read_into_tuple(dbusArgs, b);
+ std::apply([&b](auto&... x) { b.read(x...); }, dbusArgs);
}
catch (const exception::SdBusError& e)
{
diff --git a/include/sdbusplus/utility/read_into_tuple.hpp b/include/sdbusplus/utility/read_into_tuple.hpp
deleted file mode 100644
index 7241ff1..0000000
--- a/include/sdbusplus/utility/read_into_tuple.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-// Copyright (c) 2018 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-
-#pragma once
-#include <sdbusplus/message.hpp>
-
-#include <tuple>
-
-namespace sdbusplus
-{
-namespace utility
-{
-
-namespace detail
-{
-template <class F, size_t... Is>
-constexpr auto index_apply_impl(F f, std::index_sequence<Is...>)
-{
- return f(std::integral_constant<size_t, Is>{}...);
-}
-template <size_t N, class F>
-constexpr auto index_apply(F f)
-{
- return index_apply_impl(f, std::make_index_sequence<N>{});
-}
-} // namespace detail
-template <class Tuple>
-constexpr bool read_into_tuple(Tuple& t, message_t& m)
-{
- return detail::index_apply<std::tuple_size<Tuple>{}>([&](auto... Is) {
- if (m.is_method_error())
- {
- return false;
- }
- m.read(std::get<Is>(t)...);
- return true;
- });
-}
-} // namespace utility
-} // namespace sdbusplus