Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <type_traits>
7 :
8 : #include "Utilities/TMPL.hpp"
9 :
10 : namespace Parallel::Algorithm_detail {
11 :
12 : template <typename Action, typename enable = std::void_t<>>
13 : struct optional_simple_tags {
14 : using type = tmpl::list<>;
15 : };
16 :
17 : template <typename Action>
18 : struct optional_simple_tags<Action, std::void_t<typename Action::simple_tags>> {
19 : using type = typename Action::simple_tags;
20 : };
21 :
22 : template <typename Action, typename enable = std::void_t<>>
23 : struct optional_compute_tags {
24 : using type = tmpl::list<>;
25 : };
26 :
27 : template <typename Action>
28 : struct optional_compute_tags<Action,
29 : std::void_t<typename Action::compute_tags>> {
30 : using type = typename Action::compute_tags;
31 : };
32 :
33 : template <typename ActionList>
34 : struct get_action_list_simple_tags {
35 : using type = tmpl::flatten<tmpl::transform<typename ActionList::action_list,
36 : optional_simple_tags<tmpl::_1>>>;
37 : };
38 :
39 : template <typename ActionList>
40 : struct get_action_list_compute_tags {
41 : using type = tmpl::flatten<tmpl::transform<typename ActionList::action_list,
42 : optional_compute_tags<tmpl::_1>>>;
43 : };
44 :
45 : template <typename Pdal>
46 : using get_pdal_simple_tags = tmpl::remove_duplicates<tmpl::flatten<
47 : tmpl::transform<Pdal, get_action_list_simple_tags<tmpl::_1>>>>;
48 :
49 : template <typename Pdal>
50 : using get_pdal_compute_tags = tmpl::remove_duplicates<tmpl::flatten<
51 : tmpl::transform<Pdal, get_action_list_compute_tags<tmpl::_1>>>>;
52 :
53 : template <typename ParallelComponent>
54 : using action_list_simple_tags = get_pdal_simple_tags<
55 : typename ParallelComponent::phase_dependent_action_list>;
56 :
57 : template <typename ParallelComponent>
58 : using action_list_compute_tags = tmpl::remove_duplicates<get_pdal_compute_tags<
59 : typename ParallelComponent::phase_dependent_action_list>>;
60 : } // namespace Parallel::Algorithm_detail
|