File size: 1,203 Bytes
d1be154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 2020/08/28 - Created by netcan: https://github.com/netcan
#pragma once
#include "connection.hpp"
#include "type_list.hpp"
#include <type_traits>

namespace tf {
namespace dsl {
template <typename... Links> class TaskAnalyzer {
  template <typename FROMs, typename TOs, typename = void>
  struct BuildOneToOneLink;

  template <typename... Fs, typename Ts>
  struct BuildOneToOneLink<TypeList<Fs...>, Ts> {
    using type = Concat_t<typename BuildOneToOneLink<Fs, Ts>::type...>;
  };

  template <typename F, typename... Ts>
  struct BuildOneToOneLink<F, TypeList<Ts...>,
                           std::enable_if_t<!IsTypeList_v<F>>> {
    using type = TypeList<OneToOneLink<F, Ts>...>;
  };

  template <typename Link> class OneToOneLinkSetF {
    using FromTaskList = typename Link::FromTaskList;
    using ToTaskList = typename Link::ToTaskList;

  public:
    using type = typename BuildOneToOneLink<FromTaskList, ToTaskList>::type;
  };

public:
  using AllTasks = Unique_t<
      Concat_t<typename Links::FromTaskList..., typename Links::ToTaskList...>>;
  using OneToOneLinkSet =
      Unique_t<Flatten_t<Map_t<TypeList<Links...>, OneToOneLinkSetF>>>;
};

} // namespace dsl
} // namespace tf