EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbortList.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AbortList.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
16 
17 #include <boost/hana/type.hpp>
18 #include <boost/hana/unpack.hpp>
19 
20 namespace hana = boost::hana;
21 
22 namespace Acts {
23 
32 template <typename... aborters_t>
33 struct AbortList : public detail::Extendable<aborters_t...> {
34  private:
35  static_assert(not detail::has_duplicates_v<aborters_t...>,
36  "same aborter type specified several times");
37 
38  using detail::Extendable<aborters_t...>::tuple;
39 
40  public:
41  // This uses the type collector
42  using result_type = typename decltype(hana::unpack(
43  detail::type_collector_t<detail::action_type_extractor, aborters_t...>,
44  hana::template_<AbortList>))::type;
45 
46  using detail::Extendable<aborters_t...>::get;
47 
49  AbortList() = default;
50 
54  AbortList(const AbortList<aborters_t...>& aborters) = default;
55 
59  AbortList(AbortList<aborters_t...>&& aborters) = default;
60 
64  AbortList<aborters_t...>& operator=(
65  const AbortList<aborters_t...>& aborters) = default;
66 
70  AbortList<aborters_t...>& operator=(AbortList<aborters_t...>&& aborters) =
71  default;
72 
76  AbortList(const std::tuple<aborters_t...>& aborters)
77  : detail::Extendable<aborters_t...>(aborters) {}
78 
82  AbortList(std::tuple<aborters_t...>&& aborters)
83  : detail::Extendable<aborters_t...>(std::move(aborters)) {}
84 
86  template <typename... appendices_t>
87  AbortList<aborters_t..., appendices_t...> append(appendices_t... aps) const {
88  auto catTuple =
89  std::tuple_cat(tuple(), std::tuple<appendices_t...>(aps...));
90  return AbortList<aborters_t..., appendices_t...>(std::move(catTuple));
91  }
92 
103  template <typename result_t, typename propagator_state_t, typename stepper_t>
104  bool operator()(const result_t& result, propagator_state_t& state,
105  const stepper_t& stepper) const {
106  // clang-format off
108  aborters_t,
109  propagator_state_t, stepper_t>...>,
110  "not all aborters support the specified input");
111  // clang-format on
112 
113  return detail::abort_list_impl<aborters_t...>::check(tuple(), result, state,
114  stepper);
115  }
116 };
117 
118 } // namespace Acts