RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
rx-includes.hpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2 
3 #pragma once
4 
5 #if !defined(RXCPP_RX_INCLUDES_HPP)
6 #define RXCPP_RX_INCLUDES_HPP
7 
8 #include "rx-trace.hpp"
9 
10 // some configuration macros
11 #if defined(_MSC_VER)
12 
13 #if _MSC_VER > 1600
14 #pragma warning(disable: 4348) // false positives on : redefinition of default parameter : parameter 2
15 #define RXCPP_USE_RVALUEREF 1
16 #endif
17 
18 #if _MSC_VER >= 1800
19 #define RXCPP_USE_VARIADIC_TEMPLATES 1
20 #endif
21 
22 #if _CPPRTTI
23 #define RXCPP_USE_RTTI 1
24 #endif
25 
26 #if _HAS_EXCEPTIONS
27 #define RXCPP_USE_EXCEPTIONS 1
28 #endif
29 
30 #define RXCPP_NORETURN __declspec(noreturn)
31 
32 #elif defined(__clang__)
33 
34 #if __has_feature(cxx_rvalue_references)
35 #define RXCPP_USE_RVALUEREF 1
36 #endif
37 #if __has_feature(cxx_rtti)
38 #define RXCPP_USE_RTTI 1
39 #endif
40 #if __has_feature(cxx_variadic_templates)
41 #define RXCPP_USE_VARIADIC_TEMPLATES 1
42 #endif
43 #if __has_feature(cxx_exceptions)
44 #define RXCPP_USE_EXCEPTIONS 1
45 #endif
46 
47 #if __has_feature(cxx_attributes)
48 #define RXCPP_NORETURN [[noreturn]]
49 #else
50 #define RXCPP_NORETURN __attribute__ ((noreturn))
51 #endif
52 
53 #elif defined(__GNUG__)
54 
55 #define GCC_VERSION (__GNUC__ * 10000 + \
56  __GNUC_MINOR__ * 100 + \
57  __GNUC_PATCHLEVEL__)
58 
59 #if GCC_VERSION >= 40801
60 #define RXCPP_USE_RVALUEREF 1
61 #endif
62 
63 #if GCC_VERSION >= 40400
64 #define RXCPP_USE_VARIADIC_TEMPLATES 1
65 #endif
66 
67 #if defined(__GXX_RTTI)
68 #define RXCPP_USE_RTTI 1
69 #endif
70 
71 #if defined(__EXCEPTIONS)
72 #define RXCPP_USE_EXCEPTIONS 1
73 #endif
74 
75 #define RXCPP_NORETURN __attribute__ ((noreturn))
76 
77 #endif
78 
79 //
80 // control std::hash<> of enum
81 // force with RXCPP_FORCE_HASH_ENUM & RXCPP_FORCE_HASH_ENUM_UNDERLYING
82 // in time use ifdef to detect library support for std::hash<> of enum
83 //
84 #define RXCPP_HASH_ENUM 0
85 #define RXCPP_HASH_ENUM_UNDERLYING 1
86 
87 #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
88 #define RXCPP_USE_WINRT 0
89 #else
90 #define RXCPP_USE_WINRT 1
91 #endif
92 
93 #if defined(__APPLE__) && defined(__MACH__)
94 #include <TargetConditionals.h>
95 #if (TARGET_OS_IPHONE == 1) || (TARGET_IPHONE_SIMULATOR == 1)
96 #define RXCPP_ON_IOS
97 #endif
98 #endif
99 
100 #if defined(__ANDROID__)
101 #define RXCPP_ON_ANDROID
102 #endif
103 
104 #if defined(RXCPP_FORCE_USE_VARIADIC_TEMPLATES)
105 #undef RXCPP_USE_VARIADIC_TEMPLATES
106 #define RXCPP_USE_VARIADIC_TEMPLATES RXCPP_FORCE_USE_VARIADIC_TEMPLATES
107 #endif
108 
109 #if defined(RXCPP_FORCE_USE_RVALUEREF)
110 #undef RXCPP_USE_RVALUEREF
111 #define RXCPP_USE_RVALUEREF RXCPP_FORCE_USE_RVALUEREF
112 #endif
113 
114 #if defined(RXCPP_FORCE_USE_RTTI)
115 #undef RXCPP_USE_RTTI
116 #define RXCPP_USE_RTTI RXCPP_FORCE_USE_RTTI
117 #endif
118 
119 #if defined(RXCPP_FORCE_USE_EXCEPTIONS)
120 #undef RXCPP_USE_EXCEPTIONS
121 #define RXCPP_USE_EXCEPTIONS RXCPP_FORCE_USE_EXCEPTIONS
122 #endif
123 
124 #if defined(RXCPP_FORCE_USE_WINRT)
125 #undef RXCPP_USE_WINRT
126 #define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT
127 #endif
128 
129 #if defined(RXCPP_FORCE_HASH_ENUM)
130 #undef RXCPP_HASH_ENUM
131 #define RXCPP_HASH_ENUM RXCPP_FORCE_HASH_ENUM
132 #endif
133 
134 #if defined(RXCPP_FORCE_HASH_ENUM_UNDERLYING)
135 #undef RXCPP_HASH_ENUM_UNDERLYING
136 #define RXCPP_HASH_ENUM_UNDERLYING RXCPP_FORCE_HASH_ENUM_UNDERLYING
137 #endif
138 
139 #if defined(RXCPP_FORCE_ON_IOS)
140 #undef RXCPP_ON_IOS
141 #define RXCPP_ON_IOS RXCPP_FORCE_ON_IOS
142 #endif
143 
144 #if defined(RXCPP_FORCE_ON_ANDROID)
145 #undef RXCPP_ON_ANDROID
146 #define RXCPP_ON_ANDROID RXCPP_FORCE_ON_ANDROID
147 #endif
148 
149 #if defined(_MSC_VER) && !RXCPP_USE_VARIADIC_TEMPLATES
150 // resolve args needs enough to store all the possible resolved args
151 #define _VARIADIC_MAX 10
152 #endif
153 
154 #if defined(_MSC_VER) && (_MSC_VER <= 1800)
155 #define RXCPP_NOEXCEPT
156 #else
157 #define RXCPP_NOEXCEPT noexcept
158 #endif
159 
160 #pragma push_macro("min")
161 #pragma push_macro("max")
162 #undef min
163 #undef max
164 
165 #include <stdlib.h>
166 
167 #include <cstddef>
168 
169 #include <iostream>
170 #include <iomanip>
171 
172 #include <exception>
173 #include <functional>
174 #include <memory>
175 #include <array>
176 #include <vector>
177 #include <algorithm>
178 #include <atomic>
179 #include <map>
180 #include <set>
181 #include <mutex>
182 #include <deque>
183 #include <thread>
184 #include <future>
185 #include <list>
186 #include <queue>
187 #include <chrono>
188 #include <condition_variable>
189 #include <initializer_list>
190 #include <typeinfo>
191 #include <tuple>
192 #include <unordered_set>
193 #include <type_traits>
194 #include <utility>
195 
196 #if defined(RXCPP_ON_IOS) || defined(RXCPP_ON_ANDROID)
197 #include <pthread.h>
198 #endif
199 
200 #include "rx-util.hpp"
201 #include "rx-predef.hpp"
202 #include "rx-subscription.hpp"
203 #include "rx-observer.hpp"
204 #include "rx-scheduler.hpp"
205 #include "rx-subscriber.hpp"
206 #include "rx-notification.hpp"
207 #include "rx-coordination.hpp"
208 #include "rx-sources.hpp"
209 #include "rx-subjects.hpp"
210 #include "rx-operators.hpp"
211 #include "rx-observable.hpp"
213 #include "rx-grouped_observable.hpp"
214 
215 #if !defined(RXCPP_LITE)
216 #include "operators/rx-all.hpp"
217 #include "operators/rx-amb.hpp"
218 #include "operators/rx-any.hpp"
223 #include "operators/rx-concat.hpp"
226 #include "operators/rx-debounce.hpp"
227 #include "operators/rx-delay.hpp"
228 #include "operators/rx-distinct.hpp"
231 #include "operators/rx-filter.hpp"
232 #include "operators/rx-finally.hpp"
233 #include "operators/rx-flat_map.hpp"
234 #include "operators/rx-group_by.hpp"
236 #include "operators/rx-map.hpp"
237 #include "operators/rx-merge.hpp"
241 #include "operators/rx-pairwise.hpp"
242 #include "operators/rx-reduce.hpp"
243 #include "operators/rx-repeat.hpp"
244 #include "operators/rx-replay.hpp"
245 #include "operators/rx-retry.hpp"
247 #include "operators/rx-scan.hpp"
249 #include "operators/rx-skip.hpp"
257 #include "operators/rx-take.hpp"
261 #include "operators/rx-tap.hpp"
263 #include "operators/rx-timeout.hpp"
265 #include "operators/rx-window.hpp"
270 #include "operators/rx-zip.hpp"
271 #endif
272 
273 #pragma pop_macro("min")
274 #pragma pop_macro("max")
275 
276 #endif
1) replay(optional Coordination, optional CompositeSubscription) Turn a cold observable hot...
For each item from this observable, filter out consequentially repeated values and emit only changes ...
Do not emit any items from the source Observable, but allow termination notification (either onError ...
Return an observable that terminates with timeout_error if a particular timespan has passed without e...
Return an observable that emits an item if a particular timespan has passed without emitting another ...
Returns an Observable that emits true if any item emitted by the source Observable satisfies a specif...
Returns an observable that attaches a timestamp to each item emitted by the source observable indicat...
Bring by one item from all given observables and select a value to emit from the new observable that ...
For each item from this observable, filter out repeated values and emit only items that have not alre...
Return an observable that emits connected, non-overlapping windows of items from the source observabl...
Retry this observable for the given number of times.
For the first count items from this observable emit them from the new observable that is returned...
For the first items fulfilling the predicate from this observable emit them from the new observable t...
Discards the first items fulfilling the predicate from this observable emit them from the new observa...
For each item from this observable use the CollectionSelector to produce an observable and subscribe ...
Return observable that emits the items emitted by the observable most recently emitted by the source ...
inspect calls to on_next, on_error and on_completed.
For each item from this observable use Selector to produce an item to emit from the new observable th...
Return an observable that emits observables every period time interval and collects items from this o...
Subscription and unsubscription are queued and delivered using the scheduler from the supplied coordi...
Return an Observable that emits the most recent items emitted by the source Observable within periodi...
All values are queued and delivered using the scheduler from the supplied coordination.
Returns an observable that emits indications of the amount of time lapsed between consecutive emissio...
Repeat this observable for the given number of times or infinitely.
Start with the supplied values, then concatenate this observable.
Emit only the final t items emitted by the source Observable.
For each item from all of the observables select a value to emit from the new observable that is retu...
Return an observable that emits buffers every period time interval and collects items from this obser...
Return an observable that emits connected, non-overlapping windows, each containing at most count ite...
Pulls an item located at a specified index location in the sequence of items and emits that item as i...
For each given observable subscribe. For each item emitted from all of the given observables, deliver from the new observable that is returned.
For each item from this observable use Predicate to select which items to emit from the new observabl...
For each item from this observable use the CollectionSelector to produce an observable and subscribe ...
If an error occurs, take the result from the Selector and subscribe to that instead.
Return an observable that emits observables every period time interval and collects items from this o...
For each item from the first observable select the latest value from all the observables to emit from...
takes a connectable_observable source and calls connect during the construction of the expression...
If the source Observable terminates without emitting any items, emits items from a backup Observable...
For each item from this observable use Accumulator to combine items into a value that will be emitted...
Return an observable that emits each item emitted by the source observable after the specified delay...
Return an observable that emits connected, non-overlapping buffer, each containing at most count item...
Take values pairwise from this observable.
Make new observable with skipped last count items from this observable.
Return an observable that emits grouped_observables, each of which corresponds to a unique key value ...
Return an observable that emits connected, non-overlapping buffers of items from the source observabl...
For each given observable subscribe. For each item emitted from all of the given observables, deliver from the new observable that is returned. The first error to occure is hold off until all of the given non-error-emitting observables have finished their emission.
Returns an Observable that emits true if every item emitted by the source Observable satisfies a spec...
Determine whether two Observables emit the same sequence of items.
Add a new action at the end of the new observable that is returned.
Make new observable with items skipped until on_next occurs on the trigger observable or until the sp...
For each item from this observable until on_next occurs on the trigger observable or until the specif...
For each item from this observable use Accumulator to combine items, when completed use ResultSelecto...
Make new observable with skipped first count items from this observable.
For each item from only the first of the given observables deliver from the new observable that is re...
For each item from this observable subscribe to one at a time, in the order received. For each item from all of the given observables deliver from the new observable that is returned.