Analysis Software
Documentation for sPHENIX simulation 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 
15 
16 #include <boost/hana/type.hpp>
17 #include <boost/hana/unpack.hpp>
18 
19 namespace hana = boost::hana;
20 
21 namespace Acts {
22 
24 
33 template <typename... aborters_t>
34 struct AbortList : public detail::Extendable<aborters_t...> {
35  private:
36  static_assert(not detail::has_duplicates_v<aborters_t...>,
37  "same aborter type specified several times");
38 
39  using detail::Extendable<aborters_t...>::tuple;
40 
41  public:
42  // This uses the type collector
43  using result_type = typename decltype(hana::unpack(
44  detail::type_collector_t<detail::action_type_extractor, aborters_t...>,
45  hana::template_<AbortList>))::type;
46 
47  using detail::Extendable<aborters_t...>::get;
48 
50  AbortList() = default;
51 
55  AbortList(const AbortList<aborters_t...>& aborters) = default;
56 
60  AbortList(AbortList<aborters_t...>&& aborters) = default;
61 
65  AbortList<aborters_t...>& operator=(
66  const AbortList<aborters_t...>& aborters) = default;
67 
71  AbortList<aborters_t...>& operator=(AbortList<aborters_t...>&& aborters) =
72  default;
73 
77  AbortList(const std::tuple<aborters_t...>& aborters)
78  : detail::Extendable<aborters_t...>(aborters) {}
79 
83  AbortList(std::tuple<aborters_t...>&& aborters)
84  : detail::Extendable<aborters_t...>(std::move(aborters)) {}
85 
87  template <typename... appendices_t>
88  AbortList<aborters_t..., appendices_t...> append(appendices_t... aps) const {
89  auto catTuple =
90  std::tuple_cat(tuple(), std::tuple<appendices_t...>(aps...));
91  return AbortList<aborters_t..., appendices_t...>(std::move(catTuple));
92  }
93 
106  template <typename propagator_state_t, typename stepper_t,
107  typename navigator_t, typename result_t, typename... Args>
108  bool operator()(propagator_state_t& state, const stepper_t& stepper,
109  const navigator_t& navigator, const result_t& result,
110  Args&&... args) const {
111  using impl = detail::abort_list_impl<aborters_t...>;
112  return impl::check(tuple(), state, stepper, navigator, result,
113  std::forward<Args>(args)...);
114  }
115 };
116 
118 
119 } // namespace Acts