Analysis Software
Documentation for sPHENIX simulation 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 
16 
17 #include <boost/hana/type.hpp>
18 #include <boost/hana/unpack.hpp>
19 
20 namespace hana = boost::hana;
21 
22 namespace Acts {
23 
25 
31 template <typename... actors_t>
32 struct ActionList : public detail::Extendable<actors_t...> {
33  private:
34  static_assert(not detail::has_duplicates_v<actors_t...>,
35  "same action type specified several times");
36 
37  using detail::Extendable<actors_t...>::tuple;
38 
39  public:
40  // This uses the type collector and unpacks using the `R` meta function
41  template <template <typename...> class R>
42  using result_type = typename decltype(hana::unpack(
43  detail::type_collector_t<detail::result_type_extractor, actors_t...>,
44  hana::template_<R>))::type;
45 
46  using detail::Extendable<actors_t...>::get;
47 
49  ActionList() = default;
50 
54  ActionList(const ActionList<actors_t...>& actors) = default;
55 
59  ActionList(ActionList<actors_t...>&& actors) = default;
60 
64  ActionList<actors_t...>& operator=(const ActionList<actors_t...>& actors) =
65  default;
66 
70  ActionList<actors_t...>& operator=(ActionList<actors_t...>&& actors) =
71  default;
72 
85  template <typename propagator_state_t, typename stepper_t,
86  typename navigator_t, typename result_t, typename... Args>
87  void operator()(propagator_state_t& state, const stepper_t& stepper,
88  const navigator_t& navigator, result_t& result,
89  Args&&... args) const {
90  using impl = detail::action_list_impl<actors_t...>;
91  impl::action(tuple(), state, stepper, navigator, result,
92  std::forward<Args>(args)...);
93  }
94 };
95 
97 
98 } // namespace Acts