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 
13 
14 #include <type_traits>
15 
16 namespace Acts {
17 
51 
52 namespace Concepts {
53 namespace detail_aborter {
54 
56 template <typename A, typename propagator_state_t, typename stepper_t>
57 using call_op_no_result_t = decltype(std::declval<const A>()(
58  std::declval<propagator_state_t&>(), std::declval<const stepper_t&>()));
59 
61 template <typename A, typename result_t, typename propagator_state_t,
62  typename stepper_t>
63 using call_op_with_result_t = decltype(std::declval<const A>()(
64  std::declval<propagator_state_t&>(), std::declval<const stepper_t&>(),
65  std::declval<const result_t&>()));
66 
67 // This is basically an if:
68 // if ( !Aborter.hasResult() ) { // has no result
69 template <typename T, typename propagator_state_t, typename stepper_t,
70  bool has_result = false>
72  // check the existence of the correct call operator
73  constexpr static bool value =
74  Acts::Concepts ::exists<call_op_no_result_t, T, propagator_state_t,
75  stepper_t>;
76 };
77 
78 // } else { // has a result
79 template <typename T, typename propagator_state_t, typename stepper_t>
80 struct ConceptConditional<T, propagator_state_t, stepper_t, true> {
81  // unpack the result type from the action contained in the aborter type
82  using result_type =
84  // check the existence of the correct call operator
85  constexpr static bool value =
87  propagator_state_t, stepper_t>;
88 };
89 // } // endif
90 
91 // Calls the 'if' above, depending on the value of `has_action_type_v`.
92 template <typename T, typename propagator_state_t, typename stepper_t>
93 struct Concept {
94  constexpr static bool value =
95  ConceptConditional<T, propagator_state_t, stepper_t,
96  Acts::detail::has_action_type_v<T>>::value;
97 };
98 
99 } // namespace detail_aborter
100 
102 template <typename T, typename propagator_state_t, typename stepper_t>
105 } // namespace Concepts
106 } // namespace Acts