forked from Schroedi/cpp.react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeTraits.h
More file actions
140 lines (99 loc) · 5.32 KB
/
TypeTraits.h
File metadata and controls
140 lines (99 loc) · 5.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// Copyright Sebastian Jeckel 2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef REACT_TYPETRAITS_H_INCLUDED
#define REACT_TYPETRAITS_H_INCLUDED
#pragma once
#include "react/detail/Defs.h"
#include "react/Forward.h"
/*****************************************/ REACT_BEGIN /*****************************************/
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsSignal
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsSignal { static const bool value = false; };
template <typename D, typename T>
struct IsSignal<Signal<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsSignal<VarSignal<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsSignal<OpSignal<D,T,TOp>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsEvent
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsEvent { static const bool value = false; };
template <typename D, typename T>
struct IsEvent<Events<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsEvent<EventSource<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsEvent<TempEvents<D,T,TOp>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsObserver
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsObserver { static const bool value = false; };
template <typename D>
struct IsObserver<Observer<D>> { static const bool value = true; };
template <typename D>
struct IsObserver<ScopedObserver<D>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsContinuation
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsContinuation { static const bool value = false; };
template <typename D, typename D2>
struct IsContinuation<Continuation<D,D2>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsObservable
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsObservable { static const bool value = false; };
template <typename D, typename T>
struct IsObservable<Signal<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsObservable<VarSignal<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsObservable<OpSignal<D,T,TOp>> { static const bool value = true; };
template <typename D, typename T>
struct IsObservable<Events<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsObservable<EventSource<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsObservable<TempEvents<D,T,TOp>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// IsReactive
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct IsReactive { static const bool value = false; };
template <typename D, typename T>
struct IsReactive<Signal<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsReactive<VarSignal<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsReactive<OpSignal<D,T,TOp>> { static const bool value = true; };
template <typename D, typename T>
struct IsReactive<Events<D,T>> { static const bool value = true; };
template <typename D, typename T>
struct IsReactive<EventSource<D,T>> { static const bool value = true; };
template <typename D, typename T, typename TOp>
struct IsReactive<TempEvents<D,T,TOp>> { static const bool value = true; };
template <typename D>
struct IsReactive<Observer<D>> { static const bool value = true; };
template <typename D>
struct IsReactive<ScopedObserver<D>> { static const bool value = true; };
template <typename D, typename D2>
struct IsReactive<Continuation<D,D2>> { static const bool value = true; };
///////////////////////////////////////////////////////////////////////////////////////////////////
/// DecayInput
///////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
struct DecayInput { using Type = T; };
template <typename D, typename T>
struct DecayInput<VarSignal<D,T>> { using Type = Signal<D,T>; };
template <typename D, typename T>
struct DecayInput<EventSource<D,T>> { using Type = Events<D,T>; };
/******************************************/ REACT_END /******************************************/
#endif // REACT_TYPETRAITS_H_INCLUDED