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
rx-skip_while.hpp
Discards the first items fulfilling the predicate from this observable emit them from the new observa...
rx-buffer_time_count.hpp
Return an observable that emits connected, non-overlapping buffers of items from the source observabl...
rx-observable.hpp
rx-trace.hpp
rx-start_with.hpp
Start with the supplied values, then concatenate this observable.
rx-distinct_until_changed.hpp
For each item from this observable, filter out consequentially repeated values and emit only changes ...
rx-pairwise.hpp
Take values pairwise from this observable.
rx-util.hpp
rx-skip.hpp
Make new observable with skipped first count items from this observable.
rx-window_time.hpp
Return an observable that emits observables every period time interval and collects items from this o...
rx-coordination.hpp
rx-take_until.hpp
For each item from this observable until on_next occurs on the trigger observable or until the specif...
rx-merge.hpp
For each given observable subscribe. For each item emitted from all of the given observables,...
rx-on_error_resume_next.hpp
If an error occurs, take the result from the Selector and subscribe to that instead.
rx-amb.hpp
For each item from only the first of the given observables deliver from the new observable that is re...
rx-skip_until.hpp
Make new observable with items skipped until on_next occurs on the trigger observable or until the sp...
rx-replay.hpp
1) replay(optional Coordination, optional CompositeSubscription) Turn a cold observable hot,...
rx-merge_delay_error.hpp
rx-switch_if_empty.hpp
If the source Observable terminates without emitting any items, emits items from a backup Observable.
rx-scheduler.hpp
rx-finally.hpp
Add a new action at the end of the new observable that is returned.
rx-switch_on_next.hpp
Return observable that emits the items emitted by the observable most recently emitted by the source ...
rx-concat_map.hpp
For each item from this observable use the CollectionSelector to produce an observable and subscribe ...
rx-predef.hpp
rx-subscribe_on.hpp
Subscription and unsubscription are queued and delivered using the scheduler from the supplied coordi...
rx-timestamp.hpp
Returns an observable that attaches a timestamp to each item emitted by the source observable indicat...
rx-take_while.hpp
For the first items fulfilling the predicate from this observable emit them from the new observable t...
rx-sequence_equal.hpp
Determine whether two Observables emit the same sequence of items.
rx-sample_time.hpp
Return an Observable that emits the most recent items emitted by the source Observable within periodi...
rx-timeout.hpp
Return an observable that terminates with timeout_error if a particular timespan has passed without e...
rx-all.hpp
Returns an Observable that emits true if every item emitted by the source Observable satisfies a spec...
rx-connectable_observable.hpp
rx-combine_latest.hpp
For each item from all of the observables select a value to emit from the new observable that is retu...
rx-filter.hpp
For each item from this observable use Predicate to select which items to emit from the new observabl...
rx-connect_forever.hpp
takes a connectable_observable source and calls connect during the construction of the expression....
rx-subscription.hpp
rx-distinct.hpp
For each item from this observable, filter out repeated values and emit only items that have not alre...
rx-sources.hpp
rx-window_toggle.hpp
Return an observable that emits observables every period time interval and collects items from this o...
rx-subscriber.hpp
rx-group_by.hpp
Return an observable that emits grouped_observables, each of which corresponds to a unique key value ...
rx-take_last.hpp
Emit only the final t items emitted by the source Observable.
rx-ignore_elements.hpp
Do not emit any items from the source Observable, but allow termination notification (either onError ...
rx-time_interval.hpp
Returns an observable that emits indications of the amount of time lapsed between consecutive emissio...
rx-zip.hpp
Bring by one item from all given observables and select a value to emit from the new observable that ...
rx-operators.hpp
rx-window_time_count.hpp
Return an observable that emits connected, non-overlapping windows of items from the source observabl...
rx-retry.hpp
Retry this observable for the given number of times.
rx-observe_on.hpp
All values are queued and delivered using the scheduler from the supplied coordination.
rx-tap.hpp
inspect calls to on_next, on_error and on_completed.
rx-window.hpp
Return an observable that emits connected, non-overlapping windows, each containing at most count ite...
rx-buffer_count.hpp
Return an observable that emits connected, non-overlapping buffer, each containing at most count item...
rx-map.hpp
For each item from this observable use Selector to produce an item to emit from the new observable th...
rx-repeat.hpp
Repeat this observable for the given number of times or infinitely.
rx-flat_map.hpp
For each item from this observable use the CollectionSelector to produce an observable and subscribe ...
rx-scan.hpp
For each item from this observable use Accumulator to combine items into a value that will be emitted...
rx-buffer_time.hpp
Return an observable that emits buffers every period time interval and collects items from this obser...
rx-element_at.hpp
Pulls an item located at a specified index location in the sequence of items and emits that item as i...
rx-skip_last.hpp
Make new observable with skipped last count items from this observable.
rx-subjects.hpp
rx-delay.hpp
Return an observable that emits each item emitted by the source observable after the specified delay.
rx-reduce.hpp
For each item from this observable use Accumulator to combine items, when completed use ResultSelecto...
rx-debounce.hpp
Return an observable that emits an item if a particular timespan has passed without emitting another ...
rx-any.hpp
Returns an Observable that emits true if any item emitted by the source Observable satisfies a specif...
rx-grouped_observable.hpp
rx-with_latest_from.hpp
For each item from the first observable select the latest value from all the observables to emit from...
rx-concat.hpp
For each item from this observable subscribe to one at a time, in the order received....
rx-notification.hpp
rx-take.hpp
For the first count items from this observable emit them from the new observable that is returned.
rx-observer.hpp