CORSIKA8  0.0.0
The framework to simulate particle cascades for astroparticle physics
InteractionProcess.hpp
1 /*
2  * (c) Copyright 2021 CORSIKA Project, corsika-project@lists.kit.edu
3  *
4  * This software is distributed under the terms of the GNU General Public
5  * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6  * the license.
7  */
8 
9 #pragma once
10 
13 
14 namespace corsika {
15 
20  template <class TProcess, typename TReturn, typename... TArgs>
21  struct has_method_doInteract : public detail::has_method_signature<TReturn, TArgs...> {
22 
24  using detail::has_method_signature<TReturn, TArgs...>::testSignature;
25 
27  template <class T>
28  static std::false_type test(...);
29 
31  template <class T>
32  static decltype(testSignature(&T::template doInteraction<TArgs...>)) test(
33  std::nullptr_t);
34 
36  template <class T>
37  static decltype(testSignature(&T::doInteraction)) test(std::nullptr_t);
38 
39  public:
44  using type = decltype(test<std::decay_t<TProcess>>(nullptr));
45  static const bool value = type::value;
47  };
48 
51  template <class TProcess, typename TReturn, typename... TArgs>
52  bool constexpr has_method_doInteract_v =
53  has_method_doInteract<TProcess, TReturn, TArgs...>::value;
54 
59  template <class TProcess, typename TReturn, typename... TArgs>
61  : public detail::has_method_signature<TReturn, TArgs...> {
62 
64  using detail::has_method_signature<TReturn, TArgs...>::testSignature;
65 
67  template <class T>
68  static std::false_type test(...);
69 
71  template <class T>
72  static decltype(testSignature(&T::template getInteractionLength<TArgs...>)) test(
73  std::nullptr_t);
74 
76  template <class T>
77  static decltype(testSignature(&T::getInteractionLength)) test(std::nullptr_t);
78 
79  public:
84  using type = decltype(test<std::decay_t<TProcess>>(nullptr));
85  static const bool value = type::value;
87  };
88 
91 
92  template <class TProcess, typename TReturn, typename... TArgs>
93  bool constexpr has_method_getInteractionLength_v =
94  has_method_getInteractionLength<TProcess, TReturn, TArgs...>::value;
95 
96 } // namespace corsika
static decltype(testSignature(&T::template getInteractionLength< TArgs... >)) test(std::nullptr_t)
templated parameter option
traits test for InteractionProcess::doInteraction method
static decltype(testSignature(&T::template doInteraction< TArgs... >)) test(std::nullptr_t)
signature of templated method
The cascade namespace assembles all objects needed to simulate full particles cascades.
traits test for InteractionProcess::getInteractionLength method
Helper traits class (partial) for static compile time checking.
static decltype(testSignature(&T::doInteraction)) test(std::nullptr_t)
signature of non-templated method
static decltype(testSignature(&T::getInteractionLength)) test(std::nullptr_t)
non templated parameter option