summaryrefslogtreecommitdiffstats
path: root/async/src/async_impl.h
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-05-18 15:20:35 +0200
committerDan Vrátil <dvratil@redhat.com>2015-05-18 15:20:35 +0200
commit5e580299e342bd77fc7479bbfd235f4446d7f05b (patch)
tree648aacd4de1f239d72be89ab9f2d4a97867d7920 /async/src/async_impl.h
parentb43c0cf97615957e097daef29ff8febc1ec884c8 (diff)
downloadsink-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.h81
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
24namespace KAsync {
25
26namespace detail {
27
28template<typename T>
29struct identity
30{
31 typedef T type;
32};
33
34template<typename T, typename Enable = void>
35struct isIterable {
36 enum { value = 0 };
37};
38
39template<typename T>
40struct isIterable<T, typename std::conditional<false, typename T::iterator, void>::type> {
41 enum { value = 1 };
42};
43
44template<typename ... T>
45struct prevOut {
46 using type = typename std::tuple_element<0, std::tuple<T ..., void>>::type;
47};
48
49template<typename T>
50inline typename std::enable_if<!std::is_void<T>::value, void>::type
51copyFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out)
52{
53 out.setValue(in.value());
54}
55
56template<typename T>
57inline typename std::enable_if<std::is_void<T>::value, void>::type
58copyFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out)
59{
60 // noop
61}
62
63template<typename T>
64inline typename std::enable_if<!std::is_void<T>::value, void>::type
65aggregateFutureValue(const KAsync::Future<T> &in, KAsync::Future<T> &out)
66{
67 out.setValue(out.value() + in.value());
68}
69
70template<typename T>
71inline typename std::enable_if<std::is_void<T>::value, void>::type
72aggregateFutureValue(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