COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
type_list.hpp
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
9 // General Public License as published by the Free Software Foundation, either version 3 of the License,
10 // or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
14 //
15 // The final product includes a software package for simulating all the critical subcomponents of AO,
16 // particularly in the context of the ELT and a real-time core based on several control approaches,
17 // with performances consistent with its integration into an instrument. Taking advantage of the specific
18 // hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to
19 // conduct large simulation campaigns called to the ELT.
20 //
21 // The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components
22 // of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and
23 // various systems configurations such as multi-conjugate AO.
24 //
25 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
26 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 // See the GNU Lesser General Public License for more details.
28 //
29 // You should have received a copy of the GNU Lesser General Public License along with COMPASS.
30 // If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
31 // -----------------------------------------------------------------------------
32 
40 
41 #ifndef CARMA_TYPE_LIST_H
42 #define CARMA_TYPE_LIST_H
43 
44 #include <utility>
45 
46 // Create instantiations for templated functions by keeping their addresses
47 // and therefore forcing the compiler to keep their object code
48 // attribute((unused)) silences the clang/gcc warning
49 template <typename T>
50 void force_keep(T t) {
51  static __attribute__((used)) T x = t;
52 }
53 
54 template <typename...>
56 
57 template <typename Type, typename... Types>
58 struct GenericTypeList<Type, Types...> {
59  using Head = Type;
60  using Tail = GenericTypeList<Types...>;
61 };
62 
63 template <>
64 struct GenericTypeList<> {};
65 
67 
68 template <typename Interfacer, typename TList>
69 struct TypeMap;
70 
71 template <typename Interfacer>
72 struct TypeMap<Interfacer, EmptyList> {
73  template <typename... Args>
74  static void apply(Args &&...) {}
75 };
76 
77 template <typename Interfacer, typename Type,
78  typename... Types //,
79  // typename TList = GenericTypeList<Type,
80  // Types...>, typename Head = typename TList::Head,
81  // typename Tail = typename TList::Tail
82  >
83 struct TypeMap<Interfacer, GenericTypeList<Type, Types...>>
84  : TypeMap<Interfacer, typename GenericTypeList<Type, Types...>::Tail> {
85  using TList = GenericTypeList<Type, Types...>;
86  using Head = typename TList::Head;
87  using Tail = typename TList::Tail;
88 
90 
91  template <typename... Args>
92  static void apply(Args &&... args) {
93  Interfacer::template call<Head>(std::forward<Args>(args)...);
94  Base::template apply(std::forward<Args>(args)...);
95  }
96 };
97 
98 template <typename Interfacer, typename TList, typename... Args>
99 void apply(Args &&... args) {
100  TypeMap<Interfacer, TList>::template apply(std::forward<Args>(args)...);
101 }
102 
103 // template< template <typename> class TemplateT, typename GenericTypeList>
104 // struct TypeMap;
105 
106 // template< template <typename> class TemplateT, typename... Types>
107 // struct TypeMap<TemplateT, GenericTypeList<Types...>> : TemplateT<Types>...
108 // {};
109 
110 #endif // CARMA_TYPE_LIST_H
GenericTypeList< Type, Types... >
Definition: type_list.hpp:58
GenericTypeList< Type, Types... >::Head
Type Head
Definition: type_list.hpp:59
TypeMap< Interfacer, EmptyList >::apply
static void apply(Args &&...)
Definition: type_list.hpp:74
TypeMap< Interfacer, GenericTypeList< Type, Types... > >::apply
static void apply(Args &&... args)
Definition: type_list.hpp:92
correlation_bokeh.x
x
Definition: correlation_bokeh.py:321
GenericTypeList
Definition: type_list.hpp:55
TypeMap< Interfacer, GenericTypeList< Type, Types... > >::Tail
typename TList::Tail Tail
Definition: type_list.hpp:87
TypeMap< Interfacer, GenericTypeList< Type, Types... > >::Head
typename TList::Head Head
Definition: type_list.hpp:86
GenericTypeList<>
Definition: type_list.hpp:64
TypeMap
Definition: type_list.hpp:69