diff options
author | Dan Vrátil <dvratil@redhat.com> | 2015-05-18 15:20:35 +0200 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2015-05-18 15:20:35 +0200 |
commit | 5e580299e342bd77fc7479bbfd235f4446d7f05b (patch) | |
tree | 648aacd4de1f239d72be89ab9f2d4a97867d7920 /async/src/async_impl.h | |
parent | b43c0cf97615957e097daef29ff8febc1ec884c8 (diff) | |
download | sink-5e580299e342bd77fc7479bbfd235f4446d7f05b.tar.gz sink-5e580299e342bd77fc7479bbfd235f4446d7f05b.zip |
KAsync has moved to it's own kasync.git repository
Diffstat (limited to 'async/src/async_impl.h')
-rw-r--r-- | async/src/async_impl.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/async/src/async_impl.h b/async/src/async_impl.h deleted file mode 100644 index 5b4e393..0000000 --- a/async/src/async_impl.h +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2014 - 2015 Daniel Vrátil <dvratil@redhat.com> | ||
3 | * | ||
4 | * This library is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Library General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This library is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU Library General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Library General Public License | ||
15 | * along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef KASYNC_IMPL_H | ||
19 | #define KASYNC_IMPL_H | ||
20 | |||
21 | #include "async.h" | ||
22 | #include <type_traits> | ||
23 | |||
24 | namespace KAsync { | ||
25 | |||
26 | namespace detail { | ||
27 | |||
28 | template<typename T> | ||
29 | struct identity | ||
30 | { | ||
31 | typedef T type; | ||
32 | }; | ||
33 | |||
34 | template<typename T, typename Enable = void> | ||
35 | struct isIterable { | ||
36 | enum { value = 0 }; | ||
37 | }; | ||
38 | |||
39 | template<typename T> | ||
40 | struct isIterable<T, typename std::conditional<false, typename T::iterator, void>::type> { | ||
41 | enum { value = 1 }; | ||
42 | }; | ||
43 | |||
44 | template<typename ... T> | ||
45 | struct prevOut { | ||
46 | using type = typename std::tuple_element<0, std::tuple<T ..., void>>::type; | ||
47 | }; | ||
48 | |||
49 | template<typename T> | ||
50 | inline typename std::enable_if<!std::is_void<T>::value, void>::type | ||
51 | copyFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out) | ||
52 | { | ||
53 | out.setValue(in.value()); | ||
54 | } | ||
55 | |||
56 | template<typename T> | ||
57 | inline typename std::enable_if<std::is_void<T>::value, void>::type | ||
58 | copyFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out) | ||
59 | { | ||
60 | // noop | ||
61 | } | ||
62 | |||
63 | template<typename T> | ||
64 | inline typename std::enable_if<!std::is_void<T>::value, void>::type | ||
65 | aggregateFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out) | ||
66 | { | ||
67 | out.setValue(out.value() + in.value()); | ||
68 | } | ||
69 | |||
70 | template<typename T> | ||
71 | inline typename std::enable_if<std::is_void<T>::value, void>::type | ||
72 | aggregateFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out) | ||
73 | { | ||
74 | // noop | ||
75 | } | ||
76 | |||
77 | } // namespace Detail | ||
78 | |||
79 | } // namespace KAsync | ||
80 | |||
81 | #endif // KASYNC_IMPL_H | ||