HiPipe  0.7.0
C++17 data pipeline with Python bindings.
template_arguments.hpp
1 /****************************************************************************
2  * hipipe library
3  * Copyright (c) 2017, Cognexa Solutions s.r.o.
4  * Copyright (c) 2018, Iterait a.s.
5  * Author(s) Filip Matzner
6  *
7  * This file is distributed under the MIT License.
8  * See the accompanying file LICENSE.txt for the complete license agreement.
9  ****************************************************************************/
10 
11 #ifndef HIPIPE_CORE_STREAM_TEMPLATE_ARGUMENTS_HPP
12 #define HIPIPE_CORE_STREAM_TEMPLATE_ARGUMENTS_HPP
13 
14 #include <functional>
15 
16 namespace hipipe::stream {
17 
18 template <typename... Columns>
19 struct from_t {
20 };
21 
23 template <typename... Columns>
24 auto from = from_t<Columns...>{};
25 
26 template <typename... Columns>
27 struct to_t {
28 };
29 
31 template <typename... Columns>
32 auto to = to_t<Columns...>{};
33 
34 template <typename... Columns>
35 struct by_t {
36 };
37 
39 template <typename... Columns>
40 auto by = by_t<Columns...>{};
41 
42 template <typename... Columns>
43 struct cond_t {
44 };
45 
47 template <typename... Columns>
48 auto cond = cond_t<Columns...>{};
49 
50 template <int Dim>
51 struct dim_t {
52 };
53 
54 template <typename... Columns>
55 struct mask_t {
56 };
57 
60 template <typename... Columns>
61 auto mask = mask_t<Columns...>{};
62 
64 template <int Dim>
65 auto dim = dim_t<Dim>{};
66 
67 struct identity_t {
68  template <typename T>
69  constexpr T&& operator()(T&& val) const noexcept
70  {
71  return std::forward<T>(val);
72  }
73 };
74 
75 template<typename T>
76 T&& operator|(identity_t, T&& val)
77 {
78  return std::forward<T>(val);
79 }
80 
81 template<typename T>
82 T&& operator|(T&& val, identity_t)
83 {
84  return std::forward<T>(val);
85 }
86 
88 inline auto identity = identity_t{};
89 
90 } // namespace hipipe::stream
91 #endif