EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActionList.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ActionList.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 
17 
18 #include <boost/hana/type.hpp>
19 #include <boost/hana/unpack.hpp>
20 
21 namespace hana = boost::hana;
22 
23 namespace Acts {
24 
30 template <typename... actors_t>
31 struct ActionList : public detail::Extendable<actors_t...> {
32  private:
33  static_assert(not detail::has_duplicates_v<actors_t...>,
34  "same action type specified several times");
35 
36  using detail::Extendable<actors_t...>::tuple;
37 
38  public:
39  // This uses the type collector and unpacks using the `R` meta funciton
40  template <template <typename...> class R>
41  using result_type = typename decltype(hana::unpack(
42  detail::type_collector_t<detail::result_type_extractor, actors_t...>,
43  hana::template_<R>))::type;
44 
45  using detail::Extendable<actors_t...>::get;
46 
48  ActionList() = default;
49 
53  ActionList(const ActionList<actors_t...>& actors) = default;
54 
58  ActionList(ActionList<actors_t...>&& actors) = default;
59 
63  ActionList<actors_t...>& operator=(const ActionList<actors_t...>& actors) =
64  default;
65 
69  ActionList<actors_t...>& operator=(ActionList<actors_t...>&& actors) =
70  default;
71 
84  template <typename propagator_state_t, typename stepper_t, typename result_t>
85  void operator()(propagator_state_t& state, const stepper_t& stepper,
86  result_t& result) const {
87  // clang-format off
88  static_assert(detail::all_of_v<detail::action_signature_check_v<actors_t,
89  propagator_state_t, stepper_t>...>,
90  "not all actors support the method signature");
91  // clang-format on
92 
93  using impl = detail::action_list_impl<actors_t...>;
94  impl::action(tuple(), state, stepper, result);
95  }
96 };
97 
98 } // namespace Acts