File indexing completed on 2025-01-18 09:27:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Utilities/detail/MPL/type_collector.hpp"
0012
0013 #include <utility>
0014
0015 namespace Acts::detail {
0016
0017 namespace {
0018
0019
0020
0021 template <bool has_result = true>
0022 struct abort_checker {
0023 template <typename aborter_t, typename propagator_state_t, typename stepper_t,
0024 typename navigator_t, typename... Args>
0025 static bool check(const aborter_t& aborter, propagator_state_t& state,
0026 const stepper_t& stepper, const navigator_t& navigator,
0027 Args&&... args) {
0028 using action_type = action_type_t<aborter_t>;
0029 using result_type = result_type_t<action_type>;
0030
0031 return aborter(state, stepper, navigator, state.template get<result_type>(),
0032 std::forward<Args>(args)...);
0033 }
0034 };
0035
0036
0037
0038 template <>
0039 struct abort_checker<false> {
0040 template <typename aborter_t, typename propagator_state_t, typename stepper_t,
0041 typename navigator_t, typename... Args>
0042 static bool check(const aborter_t& aborter, propagator_state_t& state,
0043 const stepper_t& stepper, const navigator_t& navigator,
0044 Args&&... args) {
0045 return aborter(state, stepper, navigator, std::forward<Args>(args)...);
0046 }
0047 };
0048 }
0049
0050 template <typename... conditions>
0051 struct abort_list_impl;
0052
0053
0054
0055 template <typename first, typename... others>
0056 struct abort_list_impl<first, others...> {
0057 template <typename T, typename propagator_state_t, typename stepper_t,
0058 typename navigator_t, typename... Args>
0059 static bool check(const T& aborters_tuple, propagator_state_t& state,
0060 const stepper_t& stepper, const navigator_t& navigator,
0061 Args&&... args) {
0062
0063 constexpr bool has_result = has_action_type_v<first>;
0064
0065
0066 const auto& this_aborter = std::get<first>(aborters_tuple);
0067
0068
0069
0070
0071 bool abort = abort_checker<has_result>::check(this_aborter, state, stepper,
0072 navigator, args...) ||
0073 abort_list_impl<others...>::check(aborters_tuple, state,
0074 stepper, navigator, args...);
0075
0076 return abort;
0077 }
0078 };
0079
0080
0081 template <typename last>
0082 struct abort_list_impl<last> {
0083 template <typename T, typename propagator_state_t, typename stepper_t,
0084 typename navigator_t, typename... Args>
0085 static bool check(const T& aborters_tuple, propagator_state_t& state,
0086 const stepper_t& stepper, const navigator_t& navigator,
0087 Args&&... args) {
0088
0089 constexpr bool has_result = has_action_type_v<last>;
0090 const auto& this_aborter = std::get<last>(aborters_tuple);
0091 return abort_checker<has_result>::check(
0092 this_aborter, state, stepper, navigator, std::forward<Args>(args)...);
0093 }
0094 };
0095
0096
0097 template <>
0098 struct abort_list_impl<> {
0099 template <typename T, typename propagator_state_t, typename stepper_t,
0100 typename navigator_t, typename... Args>
0101 static bool check(const T& , propagator_state_t& ,
0102 const stepper_t& ,
0103 const navigator_t& , Args&&... ) {
0104 return false;
0105 }
0106 };
0107
0108 }