ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
abort_condition_signature_check.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file abort_condition_signature_check.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 
11 #include <type_traits>
14 
15 namespace Acts {
16 
50 
51 namespace concept {
52  namespace detail_aborter {
53 
55  template <typename A, typename propagator_state_t, typename stepper_t>
56  using call_op_no_result_t = decltype(std::declval<const A>()(
57  std::declval<propagator_state_t&>(), std::declval<const stepper_t&>()));
58 
60  template <typename A, typename result_t, typename propagator_state_t,
61  typename stepper_t>
62  using call_op_with_result_t = decltype(std::declval<const A>()(
63  std::declval<propagator_state_t&>(), std::declval<const stepper_t&>(),
64  std::declval<const result_t&>()));
65 
66  // This is basically an if:
67  // if ( !Aborter.hasResult() ) { // has no result
68  template <typename T, typename propagator_state_t, typename stepper_t,
69  bool has_result = false>
71  // check the existence of the correct call operator
72  constexpr static bool value =
73  Acts::concept ::exists<call_op_no_result_t, T, propagator_state_t,
74  stepper_t>;
75  };
76 
77  // } else { // has a result
78  template <typename T, typename propagator_state_t, typename stepper_t>
79  struct ConceptConditional<T, propagator_state_t, stepper_t, true> {
80  // unpack the result type from the action contained in the aborter type
81  using result_type =
83  // check the existence of the correct call operator
84  constexpr static bool value =
86  propagator_state_t, stepper_t>;
87  };
88  // } // endif
89 
90  // Calls the 'if' above, depending on the value of `has_action_type_v`.
91  template <typename T, typename propagator_state_t, typename stepper_t>
92  struct Concept {
93  constexpr static bool value =
94  ConceptConditional<T, propagator_state_t, stepper_t,
95  Acts::detail::has_action_type_v<T>>::value;
96  };
97 
98  } // namespace detail_aborter
99 
101  template <typename T, typename propagator_state_t, typename stepper_t>
104 } // namespace concept
105 } // namespace Acts