summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2022-09-01 14:59:27 +0000
committerElliott Hughes <enh@google.com>2022-09-01 15:00:13 +0000
commita6661d2cf339b71de3e25f80fb927e029468c603 (patch)
treec0b1aac3621dd301e9fb7add9170d8879cc97cbe
parentde986f59e99bd585280a061f545150ee1268f012 (diff)
downloadRxCpp-a6661d2cf339b71de3e25f80fb927e029468c603.tar.gz
Remove RxCpp, which is no longer used.HEADmastermain
Do not necromance this without going through the go/android-3p process again. Test: treehugger Change-Id: Id813d74d7d2597e0636b925430117c94bea3fa5a
-rw-r--r--AUTHORS.txt41
-rw-r--r--Android.bp67
-rw-r--r--CMakeLists.txt5
-rw-r--r--DeveloperManual.md32
-rw-r--r--Ix/CPP/.gitignore114
-rw-r--r--Ix/CPP/license.txt15
-rw-r--r--Ix/CPP/projects/CppLinq.vpj156
-rw-r--r--Ix/CPP/projects/CppLinq.vpw7
-rw-r--r--Ix/CPP/projects/Unittest.CppLinq.vpj137
-rw-r--r--Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp128
-rw-r--r--Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln20
-rw-r--r--Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj92
-rw-r--r--Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters25
-rw-r--r--Ix/CPP/samples/SampleCppLinq/data.txt655
-rw-r--r--Ix/CPP/src/IxCpp.vcxproj65
-rw-r--r--Ix/CPP/src/IxCpp.vcxproj.filters55
-rw-r--r--Ix/CPP/src/cpplinq/linq.hpp584
-rw-r--r--Ix/CPP/src/cpplinq/linq_cursor.hpp342
-rw-r--r--Ix/CPP/src/cpplinq/linq_groupby.hpp195
-rw-r--r--Ix/CPP/src/cpplinq/linq_iterators.hpp196
-rw-r--r--Ix/CPP/src/cpplinq/linq_last.hpp85
-rw-r--r--Ix/CPP/src/cpplinq/linq_select.hpp54
-rw-r--r--Ix/CPP/src/cpplinq/linq_selectmany.hpp164
-rw-r--r--Ix/CPP/src/cpplinq/linq_skip.hpp37
-rw-r--r--Ix/CPP/src/cpplinq/linq_take.hpp98
-rw-r--r--Ix/CPP/src/cpplinq/linq_where.hpp69
-rw-r--r--Ix/CPP/src/cpplinq/util.hpp232
-rw-r--r--Ix/CPP/unittest/makefile37
-rw-r--r--Ix/CPP/unittest/testbench.cpp610
-rw-r--r--Ix/CPP/unittest/testbench.hpp88
l---------LICENSE1
-rw-r--r--METADATA18
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--OWNERS4
-rw-r--r--README.md238
-rw-r--r--Readme.html308
-rw-r--r--Rx/v2/examples/awaitable/CMakeLists.txt36
-rw-r--r--Rx/v2/examples/awaitable/main.cpp58
-rw-r--r--Rx/v2/examples/cep/CMakeLists.txt38
-rw-r--r--Rx/v2/examples/cep/main.cpp43
-rw-r--r--Rx/v2/examples/doxygen/CMakeLists.txt32
-rw-r--r--Rx/v2/examples/doxygen/all.cpp29
-rw-r--r--Rx/v2/examples/doxygen/amb.cpp84
-rw-r--r--Rx/v2/examples/doxygen/any.cpp29
-rw-r--r--Rx/v2/examples/doxygen/as_dynamic.cpp21
-rw-r--r--Rx/v2/examples/doxygen/blocking_observable.cpp229
-rw-r--r--Rx/v2/examples/doxygen/buffer.cpp202
-rw-r--r--Rx/v2/examples/doxygen/combine_latest.cpp85
-rw-r--r--Rx/v2/examples/doxygen/composite_exception.cpp33
-rw-r--r--Rx/v2/examples/doxygen/concat.cpp60
-rw-r--r--Rx/v2/examples/doxygen/concat_map.cpp50
-rw-r--r--Rx/v2/examples/doxygen/contains.cpp29
-rw-r--r--Rx/v2/examples/doxygen/create.cpp100
-rw-r--r--Rx/v2/examples/doxygen/debounce.cpp20
-rw-r--r--Rx/v2/examples/doxygen/default_if_empty.cpp17
-rw-r--r--Rx/v2/examples/doxygen/defer.cpp16
-rw-r--r--Rx/v2/examples/doxygen/delay.cpp53
-rw-r--r--Rx/v2/examples/doxygen/distinct.cpp15
-rw-r--r--Rx/v2/examples/doxygen/distinct_until_changed.cpp15
-rw-r--r--Rx/v2/examples/doxygen/element_at.cpp14
-rw-r--r--Rx/v2/examples/doxygen/empty.cpp37
-rw-r--r--Rx/v2/examples/doxygen/error.cpp31
-rw-r--r--Rx/v2/examples/doxygen/exists.cpp29
-rw-r--r--Rx/v2/examples/doxygen/filter.cpp17
-rw-r--r--Rx/v2/examples/doxygen/finally.cpp34
-rw-r--r--Rx/v2/examples/doxygen/flat_map.cpp50
-rw-r--r--Rx/v2/examples/doxygen/from.cpp33
-rw-r--r--Rx/v2/examples/doxygen/group_by.cpp56
-rw-r--r--Rx/v2/examples/doxygen/ignore_elements.cpp15
-rw-r--r--Rx/v2/examples/doxygen/interval.cpp56
-rw-r--r--Rx/v2/examples/doxygen/is_empty.cpp14
-rw-r--r--Rx/v2/examples/doxygen/iterate.cpp27
-rw-r--r--Rx/v2/examples/doxygen/just.cpp25
-rw-r--r--Rx/v2/examples/doxygen/main.cpp14
-rw-r--r--Rx/v2/examples/doxygen/main.hpp3
-rw-r--r--Rx/v2/examples/doxygen/map.cpp17
-rw-r--r--Rx/v2/examples/doxygen/math.cpp274
-rw-r--r--Rx/v2/examples/doxygen/merge.cpp84
-rw-r--r--Rx/v2/examples/doxygen/merge_delay_error.cpp99
-rw-r--r--Rx/v2/examples/doxygen/never.cpp15
-rw-r--r--Rx/v2/examples/doxygen/observe_on.cpp24
-rw-r--r--Rx/v2/examples/doxygen/on_error_resume_next.cpp23
-rw-r--r--Rx/v2/examples/doxygen/pairwise.cpp51
-rw-r--r--Rx/v2/examples/doxygen/publish.cpp192
-rw-r--r--Rx/v2/examples/doxygen/range.cpp152
-rw-r--r--Rx/v2/examples/doxygen/reduce.cpp85
-rw-r--r--Rx/v2/examples/doxygen/ref_count.cpp55
-rw-r--r--Rx/v2/examples/doxygen/repeat.cpp44
-rw-r--r--Rx/v2/examples/doxygen/replay.cpp234
-rw-r--r--Rx/v2/examples/doxygen/retry.cpp84
-rw-r--r--Rx/v2/examples/doxygen/sample.cpp18
-rw-r--r--Rx/v2/examples/doxygen/scan.cpp19
-rw-r--r--Rx/v2/examples/doxygen/scope.cpp17
-rw-r--r--Rx/v2/examples/doxygen/sequence_equal.cpp15
-rw-r--r--Rx/v2/examples/doxygen/skip.cpp14
-rw-r--r--Rx/v2/examples/doxygen/skip_last.cpp14
-rw-r--r--Rx/v2/examples/doxygen/skip_until.cpp39
-rw-r--r--Rx/v2/examples/doxygen/skip_while.cpp17
-rw-r--r--Rx/v2/examples/doxygen/start_with.cpp26
-rw-r--r--Rx/v2/examples/doxygen/subscribe.cpp101
-rw-r--r--Rx/v2/examples/doxygen/subscribe_on.cpp24
-rw-r--r--Rx/v2/examples/doxygen/switch_if_empty.cpp33
-rw-r--r--Rx/v2/examples/doxygen/switch_on_next.cpp35
-rw-r--r--Rx/v2/examples/doxygen/take.cpp15
-rw-r--r--Rx/v2/examples/doxygen/take_last.cpp15
-rw-r--r--Rx/v2/examples/doxygen/take_until.cpp68
-rw-r--r--Rx/v2/examples/doxygen/take_while.cpp17
-rw-r--r--Rx/v2/examples/doxygen/tap.cpp38
-rw-r--r--Rx/v2/examples/doxygen/time_interval.cpp59
-rw-r--r--Rx/v2/examples/doxygen/timeout.cpp26
-rw-r--r--Rx/v2/examples/doxygen/timer.cpp52
-rw-r--r--Rx/v2/examples/doxygen/timestamp.cpp61
-rw-r--r--Rx/v2/examples/doxygen/window.cpp240
-rw-r--r--Rx/v2/examples/doxygen/with_latest_from.cpp85
-rw-r--r--Rx/v2/examples/doxygen/zip.cpp85
-rw-r--r--Rx/v2/examples/linesfrombytes/CMakeLists.txt36
-rw-r--r--Rx/v2/examples/linesfrombytes/main.cpp110
-rw-r--r--Rx/v2/examples/println/CMakeLists.txt36
-rw-r--r--Rx/v2/examples/println/main.cpp69
-rw-r--r--Rx/v2/examples/pythagorian/CMakeLists.txt36
-rw-r--r--Rx/v2/examples/pythagorian/main.cpp149
-rw-r--r--Rx/v2/examples/stop/CMakeLists.txt36
-rw-r--r--Rx/v2/examples/stop/main.cpp54
-rw-r--r--Rx/v2/examples/tests/CMakeLists.txt37
-rw-r--r--Rx/v2/examples/tests/main.cpp2
-rw-r--r--Rx/v2/examples/tests/take.cpp105
-rw-r--r--Rx/v2/examples/win_text/CMakeLists.txt54
-rw-r--r--Rx/v2/examples/win_text/main.cpp244
-rw-r--r--Rx/v2/examples/win_text/rx_windows_user.h117
-rw-r--r--Rx/v2/examples/win_text/unwinder.h54
-rw-r--r--Rx/v2/examples/win_text/windows_user.h118
-rw-r--r--Rx/v2/license.txt15
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-all.hpp182
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-amb.hpp298
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-any.hpp225
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp178
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp326
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp275
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp312
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-concat.hpp309
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-concat_map.hpp373
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp90
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-debounce.hpp268
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-delay.hpp237
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-distinct.hpp119
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp142
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-element_at.hpp137
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-filter.hpp134
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-finally.hpp134
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-flat_map.hpp340
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-group_by.hpp402
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp114
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-lift.hpp110
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-map.hpp145
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-merge.hpp290
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp304
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-multicast.hpp123
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-observe_on.hpp335
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp147
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-pairwise.hpp126
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-publish.hpp164
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-reduce.hpp687
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-ref_count.hpp221
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-repeat.hpp122
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-replay.hpp234
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp153
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-retry.hpp121
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-sample_time.hpp256
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-scan.hpp141
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp282
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-skip.hpp162
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-skip_last.hpp153
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-skip_until.hpp276
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-skip_while.hpp131
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-start_with.hpp84
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-subscribe.hpp154
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp182
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp178
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp247
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-take.hpp165
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-take_last.hpp155
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-take_until.hpp284
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-take_while.hpp129
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-tap.hpp151
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-time_interval.hpp154
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-timeout.hpp284
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-timestamp.hpp150
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-window.hpp180
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-window_time.hpp322
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp281
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp324
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp312
-rw-r--r--Rx/v2/src/rxcpp/operators/rx-zip.hpp344
-rw-r--r--Rx/v2/src/rxcpp/rx-composite_exception.hpp34
-rw-r--r--Rx/v2/src/rxcpp/rx-connectable_observable.hpp211
-rw-r--r--Rx/v2/src/rxcpp/rx-coordination.hpp316
-rw-r--r--Rx/v2/src/rxcpp/rx-coroutine.hpp198
-rw-r--r--Rx/v2/src/rxcpp/rx-grouped_observable.hpp193
-rw-r--r--Rx/v2/src/rxcpp/rx-includes.hpp276
-rw-r--r--Rx/v2/src/rxcpp/rx-lite.hpp11
-rw-r--r--Rx/v2/src/rxcpp/rx-notification.hpp281
-rw-r--r--Rx/v2/src/rxcpp/rx-observable.hpp1811
-rw-r--r--Rx/v2/src/rxcpp/rx-observer.hpp665
-rw-r--r--Rx/v2/src/rxcpp/rx-operators.hpp534
-rw-r--r--Rx/v2/src/rxcpp/rx-predef.hpp328
-rw-r--r--Rx/v2/src/rxcpp/rx-scheduler.hpp961
-rw-r--r--Rx/v2/src/rxcpp/rx-sources.hpp49
-rw-r--r--Rx/v2/src/rxcpp/rx-subjects.hpp24
-rw-r--r--Rx/v2/src/rxcpp/rx-subscriber.hpp835
-rw-r--r--Rx/v2/src/rxcpp/rx-subscription.hpp613
-rw-r--r--Rx/v2/src/rxcpp/rx-test.hpp137
-rw-r--r--Rx/v2/src/rxcpp/rx-trace.hpp114
-rw-r--r--Rx/v2/src/rxcpp/rx-util.hpp1031
-rw-r--r--Rx/v2/src/rxcpp/rx.hpp10
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp272
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp118
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp84
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp185
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-runloop.hpp212
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp52
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-test.hpp617
-rw-r--r--Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp230
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-create.hpp92
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-defer.hpp83
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-empty.hpp53
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-error.hpp133
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-interval.hpp154
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-iterate.hpp325
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-never.hpp51
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-range.hpp155
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-scope.hpp124
-rw-r--r--Rx/v2/src/rxcpp/sources/rx-timer.hpp135
-rw-r--r--Rx/v2/src/rxcpp/subjects/rx-behavior.hpp107
-rw-r--r--Rx/v2/src/rxcpp/subjects/rx-replaysubject.hpp186
-rw-r--r--Rx/v2/src/rxcpp/subjects/rx-subject.hpp277
-rw-r--r--Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp262
-rw-r--r--Rx/v2/test/CMakeLists.txt135
-rw-r--r--Rx/v2/test/operators/all.cpp217
-rw-r--r--Rx/v2/test/operators/amb.cpp953
-rw-r--r--Rx/v2/test/operators/amb_variadic.cpp590
-rw-r--r--Rx/v2/test/operators/any.cpp214
-rw-r--r--Rx/v2/test/operators/buffer.cpp1231
-rw-r--r--Rx/v2/test/operators/combine_latest.cpp1666
-rw-r--r--Rx/v2/test/operators/concat.cpp201
-rw-r--r--Rx/v2/test/operators/concat_map.cpp535
-rw-r--r--Rx/v2/test/operators/contains.cpp213
-rw-r--r--Rx/v2/test/operators/debounce.cpp213
-rw-r--r--Rx/v2/test/operators/default_if_empty.cpp167
-rw-r--r--Rx/v2/test/operators/delay.cpp166
-rw-r--r--Rx/v2/test/operators/distinct.cpp699
-rw-r--r--Rx/v2/test/operators/distinct_until_changed.cpp417
-rw-r--r--Rx/v2/test/operators/element_at.cpp293
-rw-r--r--Rx/v2/test/operators/exists.cpp216
-rw-r--r--Rx/v2/test/operators/filter.cpp363
-rw-r--r--Rx/v2/test/operators/finally.cpp200
-rw-r--r--Rx/v2/test/operators/flat_map.cpp788
-rw-r--r--Rx/v2/test/operators/group_by.cpp432
-rw-r--r--Rx/v2/test/operators/ignore_elements.cpp160
-rw-r--r--Rx/v2/test/operators/is_empty.cpp171
-rw-r--r--Rx/v2/test/operators/lift.cpp287
-rw-r--r--Rx/v2/test/operators/map.cpp240
-rw-r--r--Rx/v2/test/operators/merge.cpp294
-rw-r--r--Rx/v2/test/operators/merge_delay_error.cpp304
-rw-r--r--Rx/v2/test/operators/observe_on.cpp193
-rw-r--r--Rx/v2/test/operators/on_error_resume_next.cpp219
-rw-r--r--Rx/v2/test/operators/pairwise.cpp80
-rw-r--r--Rx/v2/test/operators/publish.cpp465
-rw-r--r--Rx/v2/test/operators/reduce.cpp455
-rw-r--r--Rx/v2/test/operators/repeat.cpp385
-rw-r--r--Rx/v2/test/operators/replay.cpp698
-rw-r--r--Rx/v2/test/operators/retry.cpp185
-rw-r--r--Rx/v2/test/operators/sample.cpp159
-rw-r--r--Rx/v2/test/operators/scan.cpp310
-rw-r--r--Rx/v2/test/operators/sequence_equal.cpp862
-rw-r--r--Rx/v2/test/operators/skip.cpp633
-rw-r--r--Rx/v2/test/operators/skip_last.cpp279
-rw-r--r--Rx/v2/test/operators/skip_until.cpp610
-rw-r--r--Rx/v2/test/operators/skip_while.cpp434
-rw-r--r--Rx/v2/test/operators/start_with.cpp221
-rw-r--r--Rx/v2/test/operators/subscribe_on.cpp180
-rw-r--r--Rx/v2/test/operators/switch_if_empty.cpp268
-rw-r--r--Rx/v2/test/operators/switch_on_next.cpp384
-rw-r--r--Rx/v2/test/operators/take.cpp618
-rw-r--r--Rx/v2/test/operators/take_last.cpp277
-rw-r--r--Rx/v2/test/operators/take_until.cpp794
-rw-r--r--Rx/v2/test/operators/take_while.cpp550
-rw-r--r--Rx/v2/test/operators/tap.cpp121
-rw-r--r--Rx/v2/test/operators/time_interval.cpp183
-rw-r--r--Rx/v2/test/operators/timeout.cpp218
-rw-r--r--Rx/v2/test/operators/timestamp.cpp183
-rw-r--r--Rx/v2/test/operators/window.cpp1042
-rw-r--r--Rx/v2/test/operators/window_toggle.cpp321
-rw-r--r--Rx/v2/test/operators/with_latest_from.cpp1645
-rw-r--r--Rx/v2/test/operators/zip.cpp1881
-rw-r--r--Rx/v2/test/sources/create.cpp84
-rw-r--r--Rx/v2/test/sources/defer.cpp59
-rw-r--r--Rx/v2/test/sources/empty.cpp58
-rw-r--r--Rx/v2/test/sources/interval.cpp90
-rw-r--r--Rx/v2/test/sources/scope.cpp424
-rw-r--r--Rx/v2/test/sources/timer.cpp24
-rw-r--r--Rx/v2/test/subjects/subject.cpp745
-rw-r--r--Rx/v2/test/subscriptions/coroutine.cpp125
-rw-r--r--Rx/v2/test/subscriptions/observer.cpp181
-rw-r--r--Rx/v2/test/subscriptions/subscription.cpp461
-rw-r--r--Rx/v2/test/test.cpp11
-rw-r--r--Rx/v2/test/test.h22
-rw-r--r--appveyor.yml59
-rw-r--r--license.md201
-rw-r--r--projects/CMake/CMakeLists.txt148
-rw-r--r--projects/CMake/shared.cmake71
-rw-r--r--projects/doxygen/CMakeLists.txt142
-rw-r--r--projects/doxygen/doxygen.conf.in2434
-rw-r--r--projects/doxygen/footer.html31
-rw-r--r--projects/doxygen/mainpage.dox25
-rw-r--r--projects/nuget/release.txt2
-rw-r--r--projects/nuget/rxcpp.autoconfig32
-rw-r--r--projects/scripts/install_libcxx.sh12
-rw-r--r--projects/scripts/travis-doxygen.sh13
-rwxr-xr-xprojects/scripts/travis-install.sh30
319 files changed, 1 insertions, 68159 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
deleted file mode 100644
index 7da61e0..0000000
--- a/AUTHORS.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-List of contributors to the Rx libraries
-
-Rx and Ix.NET:
-Wes Dyer
-Jeffrey van Gogh
-Matthew Podwysocki
-Bart de Smet
-Danny van Velzen
-Erik Meijer
-Brian Beckman
-Aaron Lahman
-Georgi Chkodrov
-Arthur Watson
-Gert Drapers
-Mark Shields
-
-Rx.js and Ix.js:
-Matthew Podwysocki
-Jeffrey van Gogh
-Bart de Smet
-Brian Beckman
-Wes Dyer
-Erik Meijer
-
-Tx:
-Georgi Chkodrov
-Bart de Smet
-Aaron Lahman
-Erik Meijer
-Brian Grunkemeyer
-Beysim Sezgin
-Tiho Tarnavski
-Collin Meek
-Sajay Anthony
-Karen Albrecht
-John Allen
-Zach Kramer
-
-Rx++ and Ix++:
-Aaron Lahman
-Kirk Shoop
diff --git a/Android.bp b/Android.bp
deleted file mode 100644
index 1ba32ca..0000000
--- a/Android.bp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2018 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package {
- default_applicable_licenses: ["external_Reactive-Extensions_RxCpp_license"],
-}
-
-// Added automatically by a large-scale-change
-// See: http://go/android-license-faq
-license {
- name: "external_Reactive-Extensions_RxCpp_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- ],
- license_text: [
- "license.md",
- ],
-}
-
-cc_library_headers {
- name: "librxcpp",
- host_supported: true,
- export_include_dirs: ["Rx/v2/src"]
-}
-
-cc_defaults {
- name: "librxcpp-tests-defaults",
- host_supported: true,
- srcs: [
- "Rx/v2/test/**/*.cpp",
- ],
- header_libs: ["librxcpp"],
- gtest: false,
- shared_libs: ["liblog"],
-}
-
-cc_test {
- // "Upstream" config. Use exceptions.
- // Ensure that if we update from upstream later that the merged code
- // is still working on Android.
- name: "librxcpp-tests-upstream",
- defaults: ["librxcpp-tests-defaults"],
- whole_static_libs: ["libcatch2-upstream"],
- // Allow exceptions for all the use of try/catch/throw in rxcpp.
- cflags: ["-fexceptions"],
-}
-
-cc_test {
- // "AOSP" config. Disable exceptions.
- // Anything in AOSP using librxcpp will use it as this config, so
- // that's what we really care about testing.
- name: "librxcpp-tests",
- defaults: ["librxcpp-tests-defaults"],
- whole_static_libs: ["libcatch2"],
-}
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index ae61a35..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-# define some folders
-
-add_subdirectory(projects/CMake build)
diff --git a/DeveloperManual.md b/DeveloperManual.md
deleted file mode 100644
index 3ce4c28..0000000
--- a/DeveloperManual.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Developer Manual
-
-## Some comments on the scheduler system
-
-The scheduler in rxcpp v2 is based on the scheduler and worker constructs that *RxJava* uses (Eric Meijer was involved) The docs for *RxJava* will have an explanation for ```scheduler``` and ```worker```. RxCpp adds ```schedulable```, ```coordination``` and ```coordinator```.
-
-```scheduler``` owns a timeline that is exposed by the ```now()``` method. ```scheduler``` is also a factory for workers in that timeline. Since a scheduler owns a timeline it is possible to build schedulers that time-travel. The virtual-scheduler is a base for the test-scheduler that uses this to make multi-second tests complete in ms.
-
-```worker``` owns a queue of pending ```schedulable```s for the timeline and has a lifetime. When the time for an ```schedulable``` is reached the ```schedulable``` is run. The queue maintains insertion order so that when N ```schedulable```s have the same target time they are run in the order that they were inserted into the queue. The ```worker``` guarantees that each ```schedulable``` completes before the next ```schedulable``` is started. when the ```worker```'s lifetime is unsubscribed all pending ```schedulable```s are discarded.
-
-```schedulable``` owns a function and has a ```worker``` and a ```lifetime```. When the ```schedulable```'s ```lifetime``` is unsubscribed the ```schedulable``` function will not be called. The ```schedulable``` is passed to the function and allows the function to reschedule itself or schedule something else on the same worker.
-
-The new concepts are ```coordination``` and ```coordinator```. I added these to simplify operator implementations and to introduce pay-for-use in operator implementations. Specifically, in Rx.NET and RxJava, the operators use atomic operations and synchronization primitives to coordinate messages from multiple streams even when all the streams are on the same thread (like UI events). The ```identity_...``` coordinations in RxCpp are used by default and have no overhead. The ```syncronize_...``` and ```observe_on_...``` coordinations use mutex and queue-onto-a-worker respectively, to interleave multiple streams safely.
-
-```coordination``` is a factory for ```coordinator```s and has a scheduler.
-
-```coordinator``` has a ```worker```, and is a factory for coordinated observables, subscribers and schedulable functions.
-
-All the operators that take multiple streams or deal in time (even ```subscribe_on``` and ```observe_on```) take a coordination parameter, not scheduler.
-
-Here are some supplied functions that will produce a coordination using a particular scheduler.
-
-* ```identity_immediate()```
-* ```identity_current_thread()```
-* ```identity_same_worker(worker w)```
-* ```serialize_event_loop()```
-* ```serialize_new_thread()```
-* ```serialize_same_worker(worker w)```
-* ```observe_on_event_loop()```
-* ```observe_on_new_thread()```
-
-There is no thread-pool scheduler yet. A thread-pool scheduler requires taking a dependency on a thread-pool implementation since I do not wish to write a thread-pool. My plan is to make a scheduler for the windows thread-pool and the apple thread-pool and the boost asio executor pool.. One question to answer is whether these platform specific constructs should live in the rxcpp repo or have platform specific repos.
diff --git a/Ix/CPP/.gitignore b/Ix/CPP/.gitignore
deleted file mode 100644
index 579772e..0000000
--- a/Ix/CPP/.gitignore
+++ /dev/null
@@ -1,114 +0,0 @@
-# Custom
-*.vtg
-*.vpwhist
-
-# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
-[Bb]in/
-[Oo]bj/
-
-# mstest test results
-TestResults
-
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.sln.docstates
-
-# Build results
-[Dd]ebug/
-[Rr]elease/
-x64/
-*_i.c
-*_p.c
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.log
-*.vspscc
-*.vssscc
-.builds
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opensdf
-*.sdf
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*
-
-# NCrunch
-*.ncrunch*
-.*crunch*.local.xml
-
-# Installshield output folder
-[Ee]xpress
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish
-
-# Publish Web Output
-*.Publish.xml
-
-# NuGet Packages Directory
-packages
-
-# Windows Azure Build Output
-csx
-*.build.csdef
-
-# Others
-[Bb]in
-[Oo]bj
-sql
-TestResults
-[Tt]est[Rr]esult*
-*.Cache
-ClientBin
-[Ss]tyle[Cc]op.*
-~$*
-*.dbmdl
-Generated_Code #added for RIA/Silverlight projects
-
-# Backup & report files from converting an old project file to a newer
-# Visual Studio version. Backup files are not needed, because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-
-# Mac crap
-.DS_Store
-
-a.out
diff --git a/Ix/CPP/license.txt b/Ix/CPP/license.txt
deleted file mode 100644
index 5b47fbd..0000000
--- a/Ix/CPP/license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
-Microsoft Open Technologies would like to thank its contributors, a list
-of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you
-may not use this file except in compliance with the License. You may
-obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-implied. See the License for the specific language governing permissions
-and limitations under the License. \ No newline at end of file
diff --git a/Ix/CPP/projects/CppLinq.vpj b/Ix/CPP/projects/CppLinq.vpj
deleted file mode 100644
index 209f42c..0000000
--- a/Ix/CPP/projects/CppLinq.vpj
+++ /dev/null
@@ -1,156 +0,0 @@
-<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
-<Project
- Version="10.0"
- VendorName="SlickEdit"
- WorkingDir=".">
- <Config
- Name="Release"
- OutputFile=""
- CompilerConfigName="Default Compiler"
- ObjectDir="Release">
- <Menu>
- <Target
- Name="Compile"
- MenuCaption="&amp;Compile"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveCurrent"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Build"
- MenuCaption="&amp;Build"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Set
- Name="OutDir"
- Value="%rw\%bn"/>
- <Exec CmdLine="nmake O=%bn runtests"/>
- </Target>
- <Target
- Name="Rebuild"
- MenuCaption="&amp;Rebuild"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake O=%bn clean all"/>
- </Target>
- <Target
- Name="Debug"
- MenuCaption="&amp;Debug"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Execute"
- MenuCaption="E&amp;xecute"
- SaveOption="SaveNone"
- RunFromDir="%rw"
- BuildFirst="1"
- CaptureOutputWith="ProcessBuffer"
- ClearProcessBuffer="1">
- <Exec CmdLine='"%bn\testbench.exe"'/>
- </Target>
- </Menu>
- <Includes>
- </Includes>
- </Config>
- <Config
- Name="Debug"
- OutputFile=""
- CompilerConfigName="Default Compiler"
- ObjectDir="Debug">
- <Menu>
- <Target
- Name="Compile"
- MenuCaption="&amp;Compile"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveCurrent"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Build"
- MenuCaption="&amp;Build"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Set
- Name="OutDir"
- Value="%rw\%bn"/>
- <Exec CmdLine="nmake O=%bn runtests"/>
- </Target>
- <Target
- Name="Rebuild"
- MenuCaption="&amp;Rebuild"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake O=%bn clean all"/>
- </Target>
- <Target
- Name="Debug"
- MenuCaption="&amp;Debug"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Execute"
- MenuCaption="E&amp;xecute"
- SaveOption="SaveNone"
- RunFromDir="%rw"
- BuildFirst="1"
- CaptureOutputWith="ProcessBuffer"
- ClearProcessBuffer="1">
- <Exec CmdLine='"%bn\testbench.exe"'/>
- </Target>
- </Menu>
- <Includes>
- </Includes>
- </Config>
- <CustomFolders>
- <Folder
- Name="Source Files"
- Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
- </Folder>
- <Folder
- Name="Header Files"
- Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
- </Folder>
- <Folder
- Name="Resource Files"
- Filters="*.ico;*.cur;*.dlg"/>
- <Folder
- Name="Bitmaps"
- Filters="*.bmp"/>
- <Folder
- Name="Other Files"
- Filters="">
- </Folder>
- </CustomFolders>
- <Files AutoFolders="PackageView">
- <F
- N="*.cpp"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="*.h"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="*.hpp"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="*.inl"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- </Files>
-</Project>
diff --git a/Ix/CPP/projects/CppLinq.vpw b/Ix/CPP/projects/CppLinq.vpw
deleted file mode 100644
index 105f982..0000000
--- a/Ix/CPP/projects/CppLinq.vpw
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">
-<Workspace Version="10.0" VendorName="SlickEdit">
- <Projects>
- <Project File="cpplinq/CppLinq.vpj"/>
- <Project File="unittest/Unittest.CppLinq.vpj"/>
- </Projects>
-</Workspace>
diff --git a/Ix/CPP/projects/Unittest.CppLinq.vpj b/Ix/CPP/projects/Unittest.CppLinq.vpj
deleted file mode 100644
index 7bbb967..0000000
--- a/Ix/CPP/projects/Unittest.CppLinq.vpj
+++ /dev/null
@@ -1,137 +0,0 @@
-<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
-<Project
- Version="10.0"
- VendorName="SlickEdit"
- TemplateName="(Other)"
- WorkingDir=".">
- <Config
- Name="Release"
- OutputFile=""
- CompilerConfigName="">
- <Menu>
- <Target
- Name="Compile"
- MenuCaption="&amp;Compile"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveCurrent"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Build"
- MenuCaption="&amp;Build"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake Config=%bn runtests"/>
- </Target>
- <Target
- Name="Rebuild"
- MenuCaption="&amp;Rebuild"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake Config=%bn clean all"/>
- </Target>
- <Target
- Name="Debug"
- MenuCaption="&amp;Debug"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Execute"
- MenuCaption="E&amp;xecute"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec CmdLine='".exe"'/>
- </Target>
- </Menu>
- </Config>
- <Config
- Name="Debug"
- OutputFile=""
- CompilerConfigName="">
- <Menu>
- <Target
- Name="Compile"
- MenuCaption="&amp;Compile"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveCurrent"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Build"
- MenuCaption="&amp;Build"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake Config=%bn runtests"/>
- </Target>
- <Target
- Name="Rebuild"
- MenuCaption="&amp;Rebuild"
- CaptureOutputWith="ProcessBuffer"
- SaveOption="SaveWorkspaceFiles"
- RunFromDir="%rw">
- <Exec CmdLine="nmake Config=%bn clean all"/>
- </Target>
- <Target
- Name="Debug"
- MenuCaption="&amp;Debug"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec/>
- </Target>
- <Target
- Name="Execute"
- MenuCaption="E&amp;xecute"
- SaveOption="SaveNone"
- RunFromDir="%rw">
- <Exec CmdLine='".exe"'/>
- </Target>
- </Menu>
- </Config>
- <CustomFolders>
- <Folder
- Name="Source Files"
- Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
- </Folder>
- <Folder
- Name="Header Files"
- Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
- </Folder>
- <Folder
- Name="Resource Files"
- Filters="*.ico;*.cur;*.dlg"/>
- <Folder
- Name="Bitmaps"
- Filters="*.bmp"/>
- <Folder
- Name="Other Files"
- Filters="">
- </Folder>
- </CustomFolders>
- <Files AutoFolders="PackageView">
- <F
- N="*.cpp"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="*.h"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="*.hpp"
- Recurse="1"
- Refilter="0"
- Excludes=""/>
- <F
- N="makefile"
- Type="Makefile"/>
- </Files>
-</Project>
diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp
deleted file mode 100644
index 4a1b499..0000000
--- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-// SampleCppLinq.cpp : Defines the entry point for the console application.
-//
-
-#include <cpplinq/linq.hpp>
-
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <string>
-#include <vector>
-#include <exception>
-#include <regex>
-#include <cmath>
-#include <algorithm>
-#include <numeric>
-
-using namespace std;
-
-vector<string> load_data();
-string extract_value(const string& input, const string& key);
-
-
-void run()
-{
- using namespace cpplinq;
-
- struct item {
- string args;
- int concurrency;
- double time;
-
- item(const string& input) {
- args = extract_value(input, "args");
- concurrency = atoi( extract_value(input, "concurrency").c_str() );
- time = atof( extract_value(input, "time").c_str() );
- }
- };
-
- auto data_unparsed = load_data();
- auto data_parsed =
- from(data_unparsed)
- .select([](const string& line) { return item(line); })
- .to_vector();
-
- cout << "data loaded" << endl;
-
- auto data =
- from(data_parsed)
- .groupby([](const item& i) { return i.args; });
-
- for (auto giter = data.begin(), end = data.end(); giter != end; ++giter)
- {
- const auto& g = *giter;
-
- cout << "arguments: " << g.key << endl;
-
- cout << "concurrency, mean, |, raw_data," << endl;
- auto seq =
- from(g)
- .groupby([](const item& i) { return i.concurrency; });
-
- for (auto giter = seq.begin(), end = seq.end(); giter != end; ++giter)
- {
- const auto& g = *giter;
-
- cout << g.key << ", ";
-
- auto times = from(g).select([](const item& i) { return i.time; });
-
- auto n = from(g).count();
- auto sum = std::accumulate(times.begin(), times.end(), 0.0);
-
- cout << (sum / n) << ", |";
-
- for (auto timeIter = times.begin(), end = times.end();
- timeIter != end;
- ++timeIter)
- {
- cout << ", " << *timeIter;
- }
- cout << endl;
- }
- }
-}
-
-
-int main()
-{
- try {
- run();
- } catch (exception& e) {
- cerr << "exception: " << e.what() << endl;
- }
-}
-
-vector<string> load_data()
-{
- ifstream datafile("data.txt");
- vector<string> v;
- string line;
-
- if (datafile.fail())
- throw logic_error("could not find file");
-
- while(getline(datafile, line))
- v.push_back(line);
-
- return v;
-}
-
-regex key_value_pair("'([^\']*)'\\s*[:,]\\s*(\\d+(?:\\.\\d+)?|'[^']*')");
-
-string extract_value(const string& input, const string& key)
-{
- const std::sregex_iterator end;
- for (std::sregex_iterator i(input.cbegin(), input.cend(), key_value_pair);
- i != end;
- ++i)
- {
- if ((*i)[1] == key)
- {
- return (*i)[2];
- }
- }
- throw std::range_error("search key not found");
-}
diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln
deleted file mode 100644
index 32769e0..0000000
--- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 11
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleCppLinq", "SampleCppLinq.vcxproj", "{B65551BA-E1BA-4735-BA51-FFA83D64823E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B65551BA-E1BA-4735-BA51-FFA83D64823E}.Debug|Win32.ActiveCfg = Debug|Win32
- {B65551BA-E1BA-4735-BA51-FFA83D64823E}.Debug|Win32.Build.0 = Debug|Win32
- {B65551BA-E1BA-4735-BA51-FFA83D64823E}.Release|Win32.ActiveCfg = Release|Win32
- {B65551BA-E1BA-4735-BA51-FFA83D64823E}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj
deleted file mode 100644
index 83dd175..0000000
--- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
- </PropertyGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B65551BA-E1BA-4735-BA51-FFA83D64823E}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>SampleCppLinq</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <IncludePath>d:\work\CppLinq Project\src;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <IncludePath>d:\work\CppLinq Project\src;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="SampleCppLinq.cpp" />
- </ItemGroup>
- <ItemGroup>
- <Text Include="data.txt" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters
deleted file mode 100644
index 3e3685f..0000000
--- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="SampleCppLinq.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <Text Include="data.txt" />
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/Ix/CPP/samples/SampleCppLinq/data.txt b/Ix/CPP/samples/SampleCppLinq/data.txt
deleted file mode 100644
index b16aea6..0000000
--- a/Ix/CPP/samples/SampleCppLinq/data.txt
+++ /dev/null
@@ -1,655 +0,0 @@
-{'var': [('concurrency', 1), ('args', '-test async-gated')], 'result': {'workingset': 22437888.0, 'privatemem': 25964544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 71.9785421875}}
-{'var': [('concurrency', 1), ('args', '-test async-gated')], 'result': {'workingset': 22626304.0, 'privatemem': 26136576.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 71.956228125}}
-{'var': [('concurrency', 1), ('args', '-test async-gated')], 'result': {'workingset': 22503424.0, 'privatemem': 25968640.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 71.741975}}
-{'var': [('concurrency', 1), ('args', '-test async-gated')], 'result': {'workingset': 22667264.0, 'privatemem': 26177536.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 71.189240625}}
-{'var': [('concurrency', 1), ('args', '-test async-gated')], 'result': {'workingset': 22323200.0, 'privatemem': 25808896.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 71.7897296875}}
-{'var': [('concurrency', 1), ('args', '-test ums-gated')], 'result': {'workingset': 14917632.0, 'privatemem': 20385792.0, 'nonpaged': 26784.0, 'virtualmem': 577224704.0, 'time': 45.734965625}}
-{'var': [('concurrency', 1), ('args', '-test ums-gated')], 'result': {'workingset': 15060992.0, 'privatemem': 20545536.0, 'nonpaged': 26784.0, 'virtualmem': 577224704.0, 'time': 45.028878125}}
-{'var': [('concurrency', 1), ('args', '-test ums-gated')], 'result': {'workingset': 15052800.0, 'privatemem': 20529152.0, 'nonpaged': 26768.0, 'virtualmem': 577224704.0, 'time': 45.5304375}}
-{'var': [('concurrency', 1), ('args', '-test ums-gated')], 'result': {'workingset': 14934016.0, 'privatemem': 20406272.0, 'nonpaged': 26784.0, 'virtualmem': 577224704.0, 'time': 45.898271875}}
-{'var': [('concurrency', 1), ('args', '-test ums-gated')], 'result': {'workingset': 14991360.0, 'privatemem': 20447232.0, 'nonpaged': 26784.0, 'virtualmem': 577224704.0, 'time': 45.425371875}}
-{'var': [('concurrency', 2), ('args', '-test async-gated')], 'result': {'workingset': 22626304.0, 'privatemem': 26013696.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 32.748084375}}
-{'var': [('concurrency', 2), ('args', '-test async-gated')], 'result': {'workingset': 22806528.0, 'privatemem': 26202112.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 33.5510765625}}
-{'var': [('concurrency', 2), ('args', '-test async-gated')], 'result': {'workingset': 22556672.0, 'privatemem': 26021888.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 33.0404453125}}
-{'var': [('concurrency', 2), ('args', '-test async-gated')], 'result': {'workingset': 22609920.0, 'privatemem': 26038272.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 34.0872890625}}
-{'var': [('concurrency', 2), ('args', '-test async-gated')], 'result': {'workingset': 22573056.0, 'privatemem': 25976832.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 33.026740625}}
-{'var': [('concurrency', 2), ('args', '-test ums-gated')], 'result': {'workingset': 15093760.0, 'privatemem': 21082112.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 23.0056984375}}
-{'var': [('concurrency', 2), ('args', '-test ums-gated')], 'result': {'workingset': 15208448.0, 'privatemem': 20918272.0, 'nonpaged': 27264.0, 'virtualmem': 585613312.0, 'time': 23.2537171875}}
-{'var': [('concurrency', 2), ('args', '-test ums-gated')], 'result': {'workingset': 15208448.0, 'privatemem': 20905984.0, 'nonpaged': 27264.0, 'virtualmem': 585613312.0, 'time': 23.2316484375}}
-{'var': [('concurrency', 2), ('args', '-test ums-gated')], 'result': {'workingset': 15192064.0, 'privatemem': 20910080.0, 'nonpaged': 27264.0, 'virtualmem': 585613312.0, 'time': 23.259509375}}
-{'var': [('concurrency', 2), ('args', '-test ums-gated')], 'result': {'workingset': 15273984.0, 'privatemem': 20979712.0, 'nonpaged': 27264.0, 'virtualmem': 585613312.0, 'time': 23.3385359375}}
-{'var': [('concurrency', 3), ('args', '-test async-gated')], 'result': {'workingset': 22581248.0, 'privatemem': 25952256.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 20.2717265625}}
-{'var': [('concurrency', 3), ('args', '-test async-gated')], 'result': {'workingset': 22667264.0, 'privatemem': 26046464.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 20.2175609375}}
-{'var': [('concurrency', 3), ('args', '-test async-gated')], 'result': {'workingset': 22732800.0, 'privatemem': 26042368.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 20.07530625}}
-{'var': [('concurrency', 3), ('args', '-test async-gated')], 'result': {'workingset': 22589440.0, 'privatemem': 26013696.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 20.281884375}}
-{'var': [('concurrency', 3), ('args', '-test async-gated')], 'result': {'workingset': 22831104.0, 'privatemem': 26185728.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 20.05386875}}
-{'var': [('concurrency', 3), ('args', '-test ums-gated')], 'result': {'workingset': 15245312.0, 'privatemem': 21233664.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 15.3586671875}}
-{'var': [('concurrency', 3), ('args', '-test ums-gated')], 'result': {'workingset': 15310848.0, 'privatemem': 21250048.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 15.70775625}}
-{'var': [('concurrency', 3), ('args', '-test ums-gated')], 'result': {'workingset': 15347712.0, 'privatemem': 21254144.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 15.6456703125}}
-{'var': [('concurrency', 3), ('args', '-test ums-gated')], 'result': {'workingset': 15273984.0, 'privatemem': 21180416.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 15.303421875}}
-{'var': [('concurrency', 3), ('args', '-test ums-gated')], 'result': {'workingset': 15335424.0, 'privatemem': 21299200.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 15.4817796875}}
-{'var': [('concurrency', 4), ('args', '-test async-gated')], 'result': {'workingset': 22630400.0, 'privatemem': 25980928.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7404328125}}
-{'var': [('concurrency', 4), ('args', '-test async-gated')], 'result': {'workingset': 22482944.0, 'privatemem': 25964544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.2058328125}}
-{'var': [('concurrency', 4), ('args', '-test async-gated')], 'result': {'workingset': 22646784.0, 'privatemem': 25972736.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 17.3264390625}}
-{'var': [('concurrency', 4), ('args', '-test async-gated')], 'result': {'workingset': 22634496.0, 'privatemem': 26091520.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 16.233396875}}
-{'var': [('concurrency', 4), ('args', '-test async-gated')], 'result': {'workingset': 22749184.0, 'privatemem': 26120192.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.4778453125}}
-{'var': [('concurrency', 4), ('args', '-test ums-gated')], 'result': {'workingset': 15200256.0, 'privatemem': 21196800.0, 'nonpaged': 27744.0, 'virtualmem': 594001920.0, 'time': 12.3187859375}}
-{'var': [('concurrency', 4), ('args', '-test ums-gated')], 'result': {'workingset': 15474688.0, 'privatemem': 21725184.0, 'nonpaged': 28224.0, 'virtualmem': 602390528.0, 'time': 11.6904421875}}
-{'var': [('concurrency', 4), ('args', '-test ums-gated')], 'result': {'workingset': 15384576.0, 'privatemem': 21630976.0, 'nonpaged': 28224.0, 'virtualmem': 602390528.0, 'time': 10.795390625}}
-{'var': [('concurrency', 4), ('args', '-test ums-gated')], 'result': {'workingset': 15364096.0, 'privatemem': 21606400.0, 'nonpaged': 28224.0, 'virtualmem': 602390528.0, 'time': 10.5224484375}}
-{'var': [('concurrency', 4), ('args', '-test ums-gated')], 'result': {'workingset': 15343616.0, 'privatemem': 21590016.0, 'nonpaged': 28224.0, 'virtualmem': 602390528.0, 'time': 10.4604203125}}
-{'var': [('concurrency', 5), ('args', '-test async-gated')], 'result': {'workingset': 22536192.0, 'privatemem': 25972736.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.291790625}}
-{'var': [('concurrency', 5), ('args', '-test async-gated')], 'result': {'workingset': 22753280.0, 'privatemem': 26103808.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.8192703125}}
-{'var': [('concurrency', 5), ('args', '-test async-gated')], 'result': {'workingset': 22585344.0, 'privatemem': 25919488.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.1479078125}}
-{'var': [('concurrency', 5), ('args', '-test async-gated')], 'result': {'workingset': 22728704.0, 'privatemem': 26058752.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7772765625}}
-{'var': [('concurrency', 5), ('args', '-test async-gated')], 'result': {'workingset': 22691840.0, 'privatemem': 26103808.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.4325453125}}
-{'var': [('concurrency', 5), ('args', '-test ums-gated')], 'result': {'workingset': 15458304.0, 'privatemem': 21950464.0, 'nonpaged': 28704.0, 'virtualmem': 610779136.0, 'time': 11.653565625}}
-{'var': [('concurrency', 5), ('args', '-test ums-gated')], 'result': {'workingset': 15622144.0, 'privatemem': 22114304.0, 'nonpaged': 28688.0, 'virtualmem': 610779136.0, 'time': 11.60025}}
-{'var': [('concurrency', 5), ('args', '-test ums-gated')], 'result': {'workingset': 15491072.0, 'privatemem': 21975040.0, 'nonpaged': 28704.0, 'virtualmem': 610779136.0, 'time': 15.956359375}}
-{'var': [('concurrency', 5), ('args', '-test ums-gated')], 'result': {'workingset': 15429632.0, 'privatemem': 21938176.0, 'nonpaged': 28704.0, 'virtualmem': 610779136.0, 'time': 16.7639015625}}
-{'var': [('concurrency', 5), ('args', '-test ums-gated')], 'result': {'workingset': 15560704.0, 'privatemem': 22102016.0, 'nonpaged': 28704.0, 'virtualmem': 610779136.0, 'time': 12.432678125}}
-{'var': [('concurrency', 6), ('args', '-test async-gated')], 'result': {'workingset': 22630400.0, 'privatemem': 26091520.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.482378125}}
-{'var': [('concurrency', 6), ('args', '-test async-gated')], 'result': {'workingset': 22724608.0, 'privatemem': 26005504.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.6995578125}}
-{'var': [('concurrency', 6), ('args', '-test async-gated')], 'result': {'workingset': 22601728.0, 'privatemem': 25972736.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7111109375}}
-{'var': [('concurrency', 6), ('args', '-test async-gated')], 'result': {'workingset': 22675456.0, 'privatemem': 26017792.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.24071875}}
-{'var': [('concurrency', 6), ('args', '-test async-gated')], 'result': {'workingset': 22822912.0, 'privatemem': 26206208.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.1442453125}}
-{'var': [('concurrency', 6), ('args', '-test ums-gated')], 'result': {'workingset': 15446016.0, 'privatemem': 22118400.0, 'nonpaged': 28944.0, 'virtualmem': 614973440.0, 'time': 11.3196953125}}
-{'var': [('concurrency', 6), ('args', '-test ums-gated')], 'result': {'workingset': 15351808.0, 'privatemem': 21860352.0, 'nonpaged': 28704.0, 'virtualmem': 610779136.0, 'time': 13.8507890625}}
-{'var': [('concurrency', 6), ('args', '-test ums-gated')], 'result': {'workingset': 15536128.0, 'privatemem': 22384640.0, 'nonpaged': 29184.0, 'virtualmem': 619167744.0, 'time': 11.411578125}}
-{'var': [('concurrency', 6), ('args', '-test ums-gated')], 'result': {'workingset': 15728640.0, 'privatemem': 22585344.0, 'nonpaged': 29184.0, 'virtualmem': 619167744.0, 'time': 11.3764765625}}
-{'var': [('concurrency', 6), ('args', '-test ums-gated')], 'result': {'workingset': 15695872.0, 'privatemem': 22331392.0, 'nonpaged': 28944.0, 'virtualmem': 614973440.0, 'time': 11.253040625}}
-{'var': [('concurrency', 7), ('args', '-test async-gated')], 'result': {'workingset': 22650880.0, 'privatemem': 25956352.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.1586765625}}
-{'var': [('concurrency', 7), ('args', '-test async-gated')], 'result': {'workingset': 22700032.0, 'privatemem': 26046464.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.2853515625}}
-{'var': [('concurrency', 7), ('args', '-test async-gated')], 'result': {'workingset': 22663168.0, 'privatemem': 25964544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.9393859375}}
-{'var': [('concurrency', 7), ('args', '-test async-gated')], 'result': {'workingset': 22597632.0, 'privatemem': 25968640.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.95501875}}
-{'var': [('concurrency', 7), ('args', '-test async-gated')], 'result': {'workingset': 22794240.0, 'privatemem': 26148864.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.9703578125}}
-{'var': [('concurrency', 7), ('args', '-test ums-gated')], 'result': {'workingset': 15720448.0, 'privatemem': 22822912.0, 'nonpaged': 29648.0, 'virtualmem': 627556352.0, 'time': 9.88916875}}
-{'var': [('concurrency', 7), ('args', '-test ums-gated')], 'result': {'workingset': 15872000.0, 'privatemem': 22978560.0, 'nonpaged': 29648.0, 'virtualmem': 627556352.0, 'time': 9.7966875}}
-{'var': [('concurrency', 7), ('args', '-test ums-gated')], 'result': {'workingset': 15642624.0, 'privatemem': 22474752.0, 'nonpaged': 29184.0, 'virtualmem': 619167744.0, 'time': 10.072915625}}
-{'var': [('concurrency', 7), ('args', '-test ums-gated')], 'result': {'workingset': 15605760.0, 'privatemem': 22548480.0, 'nonpaged': 29424.0, 'virtualmem': 623362048.0, 'time': 10.3262265625}}
-{'var': [('concurrency', 7), ('args', '-test ums-gated')], 'result': {'workingset': 15503360.0, 'privatemem': 22335488.0, 'nonpaged': 29184.0, 'virtualmem': 619167744.0, 'time': 10.3073703125}}
-{'var': [('concurrency', 8), ('args', '-test async-gated')], 'result': {'workingset': 22671360.0, 'privatemem': 26075136.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7767140625}}
-{'var': [('concurrency', 8), ('args', '-test async-gated')], 'result': {'workingset': 22683648.0, 'privatemem': 26046464.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.6023046875}}
-{'var': [('concurrency', 8), ('args', '-test async-gated')], 'result': {'workingset': 22581248.0, 'privatemem': 25968640.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.590659375}}
-{'var': [('concurrency', 8), ('args', '-test async-gated')], 'result': {'workingset': 22671360.0, 'privatemem': 26128384.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.797509375}}
-{'var': [('concurrency', 8), ('args', '-test async-gated')], 'result': {'workingset': 22626304.0, 'privatemem': 26001408.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.114903125}}
-{'var': [('concurrency', 8), ('args', '-test ums-gated')], 'result': {'workingset': 15843328.0, 'privatemem': 23093248.0, 'nonpaged': 29904.0, 'virtualmem': 631750656.0, 'time': 10.8031640625}}
-{'var': [('concurrency', 8), ('args', '-test ums-gated')], 'result': {'workingset': 15695872.0, 'privatemem': 22933504.0, 'nonpaged': 29904.0, 'virtualmem': 631750656.0, 'time': 10.78183125}}
-{'var': [('concurrency', 8), ('args', '-test ums-gated')], 'result': {'workingset': 15626240.0, 'privatemem': 22466560.0, 'nonpaged': 29184.0, 'virtualmem': 619167744.0, 'time': 10.79186875}}
-{'var': [('concurrency', 8), ('args', '-test ums-gated')], 'result': {'workingset': 15998976.0, 'privatemem': 23089152.0, 'nonpaged': 29664.0, 'virtualmem': 627556352.0, 'time': 10.6507984375}}
-{'var': [('concurrency', 8), ('args', '-test ums-gated')], 'result': {'workingset': 15769600.0, 'privatemem': 22892544.0, 'nonpaged': 29664.0, 'virtualmem': 627556352.0, 'time': 10.7464046875}}
-{'var': [('concurrency', 10), ('args', '-test async-gated')], 'result': {'workingset': 22761472.0, 'privatemem': 26107904.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5812421875}}
-{'var': [('concurrency', 10), ('args', '-test async-gated')], 'result': {'workingset': 22626304.0, 'privatemem': 26030080.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.8055078125}}
-{'var': [('concurrency', 10), ('args', '-test async-gated')], 'result': {'workingset': 23019520.0, 'privatemem': 26374144.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.661046875}}
-{'var': [('concurrency', 10), ('args', '-test async-gated')], 'result': {'workingset': 22810624.0, 'privatemem': 26165248.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.8447890625}}
-{'var': [('concurrency', 10), ('args', '-test async-gated')], 'result': {'workingset': 22786048.0, 'privatemem': 26157056.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7037859375}}
-{'var': [('concurrency', 10), ('args', '-test ums-gated')], 'result': {'workingset': 15937536.0, 'privatemem': 23482368.0, 'nonpaged': 30384.0, 'virtualmem': 640139264.0, 'time': 9.9560078125}}
-{'var': [('concurrency', 10), ('args', '-test ums-gated')], 'result': {'workingset': 15732736.0, 'privatemem': 22953984.0, 'nonpaged': 29888.0, 'virtualmem': 631750656.0, 'time': 9.9779875}}
-{'var': [('concurrency', 10), ('args', '-test ums-gated')], 'result': {'workingset': 15806464.0, 'privatemem': 23216128.0, 'nonpaged': 30144.0, 'virtualmem': 635944960.0, 'time': 10.0446703125}}
-{'var': [('concurrency', 10), ('args', '-test ums-gated')], 'result': {'workingset': 15765504.0, 'privatemem': 23171072.0, 'nonpaged': 30128.0, 'virtualmem': 635944960.0, 'time': 9.8954875}}
-{'var': [('concurrency', 10), ('args', '-test ums-gated')], 'result': {'workingset': 15732736.0, 'privatemem': 22679552.0, 'nonpaged': 29424.0, 'virtualmem': 623362048.0, 'time': 10.1007609375}}
-{'var': [('concurrency', 12), ('args', '-test async-gated')], 'result': {'workingset': 22589440.0, 'privatemem': 25964544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.4936453125}}
-{'var': [('concurrency', 12), ('args', '-test async-gated')], 'result': {'workingset': 22732800.0, 'privatemem': 26148864.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.54201875}}
-{'var': [('concurrency', 12), ('args', '-test async-gated')], 'result': {'workingset': 22609920.0, 'privatemem': 25964544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.8461453125}}
-{'var': [('concurrency', 12), ('args', '-test async-gated')], 'result': {'workingset': 22749184.0, 'privatemem': 26103808.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5201171875}}
-{'var': [('concurrency', 12), ('args', '-test async-gated')], 'result': {'workingset': 22740992.0, 'privatemem': 26173440.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.7564125}}
-{'var': [('concurrency', 12), ('args', '-test ums-gated')], 'result': {'workingset': 16015360.0, 'privatemem': 23687168.0, 'nonpaged': 30512.0, 'virtualmem': 644333568.0, 'time': 10.308821875}}
-{'var': [('concurrency', 12), ('args', '-test ums-gated')], 'result': {'workingset': 15978496.0, 'privatemem': 23896064.0, 'nonpaged': 30992.0, 'virtualmem': 652722176.0, 'time': 10.3545609375}}
-{'var': [('concurrency', 12), ('args', '-test ums-gated')], 'result': {'workingset': 16105472.0, 'privatemem': 23773184.0, 'nonpaged': 30512.0, 'virtualmem': 644333568.0, 'time': 10.39604375}}
-{'var': [('concurrency', 12), ('args', '-test ums-gated')], 'result': {'workingset': 16003072.0, 'privatemem': 23670784.0, 'nonpaged': 30512.0, 'virtualmem': 644333568.0, 'time': 11.3077953125}}
-{'var': [('concurrency', 12), ('args', '-test ums-gated')], 'result': {'workingset': 15835136.0, 'privatemem': 23347200.0, 'nonpaged': 30272.0, 'virtualmem': 640139264.0, 'time': 11.2470921875}}
-{'var': [('concurrency', 14), ('args', '-test async-gated')], 'result': {'workingset': 22630400.0, 'privatemem': 26017792.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 14.5840734375}}
-{'var': [('concurrency', 14), ('args', '-test async-gated')], 'result': {'workingset': 22843392.0, 'privatemem': 26238976.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 14.7056515625}}
-{'var': [('concurrency', 14), ('args', '-test async-gated')], 'result': {'workingset': 22765568.0, 'privatemem': 26152960.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 14.4621296875}}
-{'var': [('concurrency', 14), ('args', '-test async-gated')], 'result': {'workingset': 22626304.0, 'privatemem': 26009600.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.7261640625}}
-{'var': [('concurrency', 14), ('args', '-test async-gated')], 'result': {'workingset': 22659072.0, 'privatemem': 26132480.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.43949375}}
-{'var': [('concurrency', 14), ('args', '-test ums-gated')], 'result': {'workingset': 16134144.0, 'privatemem': 24227840.0, 'nonpaged': 31232.0, 'virtualmem': 656916480.0, 'time': 10.1509875}}
-{'var': [('concurrency', 14), ('args', '-test ums-gated')], 'result': {'workingset': 15835136.0, 'privatemem': 23486464.0, 'nonpaged': 30512.0, 'virtualmem': 644333568.0, 'time': 10.4571375}}
-{'var': [('concurrency', 14), ('args', '-test ums-gated')], 'result': {'workingset': 15953920.0, 'privatemem': 23937024.0, 'nonpaged': 30992.0, 'virtualmem': 652722176.0, 'time': 10.21300625}}
-{'var': [('concurrency', 14), ('args', '-test ums-gated')], 'result': {'workingset': 16056320.0, 'privatemem': 24068096.0, 'nonpaged': 30992.0, 'virtualmem': 652722176.0, 'time': 10.3364984375}}
-{'var': [('concurrency', 14), ('args', '-test ums-gated')], 'result': {'workingset': 15851520.0, 'privatemem': 23621632.0, 'nonpaged': 30752.0, 'virtualmem': 648527872.0, 'time': 10.205690625}}
-{'var': [('concurrency', 16), ('args', '-test async-gated')], 'result': {'workingset': 22704128.0, 'privatemem': 26152960.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4346625}}
-{'var': [('concurrency', 16), ('args', '-test async-gated')], 'result': {'workingset': 22941696.0, 'privatemem': 26288128.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.588709375}}
-{'var': [('concurrency', 16), ('args', '-test async-gated')], 'result': {'workingset': 22573056.0, 'privatemem': 25997312.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.383815625}}
-{'var': [('concurrency', 16), ('args', '-test async-gated')], 'result': {'workingset': 22818816.0, 'privatemem': 26148864.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.60400625}}
-{'var': [('concurrency', 16), ('args', '-test async-gated')], 'result': {'workingset': 22716416.0, 'privatemem': 26120192.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.3768921875}}
-{'var': [('concurrency', 16), ('args', '-test ums-gated')], 'result': {'workingset': 16101376.0, 'privatemem': 24428544.0, 'nonpaged': 31712.0, 'virtualmem': 665305088.0, 'time': 9.846940625}}
-{'var': [('concurrency', 16), ('args', '-test ums-gated')], 'result': {'workingset': 16089088.0, 'privatemem': 24199168.0, 'nonpaged': 31232.0, 'virtualmem': 656916480.0, 'time': 11.1524609375}}
-{'var': [('concurrency', 16), ('args', '-test ums-gated')], 'result': {'workingset': 16199680.0, 'privatemem': 24178688.0, 'nonpaged': 30992.0, 'virtualmem': 652722176.0, 'time': 9.9980328125}}
-{'var': [('concurrency', 16), ('args', '-test ums-gated')], 'result': {'workingset': 16023552.0, 'privatemem': 23977984.0, 'nonpaged': 30992.0, 'virtualmem': 652722176.0, 'time': 11.2873078125}}
-{'var': [('concurrency', 16), ('args', '-test ums-gated')], 'result': {'workingset': 16134144.0, 'privatemem': 24387584.0, 'nonpaged': 31472.0, 'virtualmem': 661110784.0, 'time': 9.934396875}}
-{'var': [('concurrency', 20), ('args', '-test async-gated')], 'result': {'workingset': 22781952.0, 'privatemem': 26120192.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4010015625}}
-{'var': [('concurrency', 20), ('args', '-test async-gated')], 'result': {'workingset': 22585344.0, 'privatemem': 25985024.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.2167890625}}
-{'var': [('concurrency', 20), ('args', '-test async-gated')], 'result': {'workingset': 22740992.0, 'privatemem': 26152960.0, 'nonpaged': 25768.0, 'virtualmem': 564969472.0, 'time': 13.4800796875}}
-{'var': [('concurrency', 20), ('args', '-test async-gated')], 'result': {'workingset': 22671360.0, 'privatemem': 26050560.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.449178125}}
-{'var': [('concurrency', 20), ('args', '-test async-gated')], 'result': {'workingset': 22671360.0, 'privatemem': 26058752.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2931078125}}
-{'var': [('concurrency', 20), ('args', '-test ums-gated')], 'result': {'workingset': 16310272.0, 'privatemem': 25399296.0, 'nonpaged': 32912.0, 'virtualmem': 686276608.0, 'time': 10.06823125}}
-{'var': [('concurrency', 20), ('args', '-test ums-gated')], 'result': {'workingset': 16154624.0, 'privatemem': 24883200.0, 'nonpaged': 32432.0, 'virtualmem': 677888000.0, 'time': 10.0306984375}}
-{'var': [('concurrency', 20), ('args', '-test ums-gated')], 'result': {'workingset': 16171008.0, 'privatemem': 25038848.0, 'nonpaged': 32672.0, 'virtualmem': 682082304.0, 'time': 10.06961875}}
-{'var': [('concurrency', 20), ('args', '-test ums-gated')], 'result': {'workingset': 16216064.0, 'privatemem': 24817664.0, 'nonpaged': 32192.0, 'virtualmem': 673693696.0, 'time': 10.0746796875}}
-{'var': [('concurrency', 20), ('args', '-test ums-gated')], 'result': {'workingset': 16375808.0, 'privatemem': 25542656.0, 'nonpaged': 33152.0, 'virtualmem': 690470912.0, 'time': 10.037271875}}
-{'var': [('concurrency', 24), ('args', '-test async-gated')], 'result': {'workingset': 22589440.0, 'privatemem': 25985024.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4086859375}}
-{'var': [('concurrency', 24), ('args', '-test async-gated')], 'result': {'workingset': 22634496.0, 'privatemem': 26005504.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3663890625}}
-{'var': [('concurrency', 24), ('args', '-test async-gated')], 'result': {'workingset': 22691840.0, 'privatemem': 26034176.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3019828125}}
-{'var': [('concurrency', 24), ('args', '-test async-gated')], 'result': {'workingset': 22786048.0, 'privatemem': 26144768.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.389559375}}
-{'var': [('concurrency', 24), ('args', '-test async-gated')], 'result': {'workingset': 22593536.0, 'privatemem': 26005504.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2155328125}}
-{'var': [('concurrency', 24), ('args', '-test ums-gated')], 'result': {'workingset': 16252928.0, 'privatemem': 25710592.0, 'nonpaged': 33632.0, 'virtualmem': 698859520.0, 'time': 9.93735}}
-{'var': [('concurrency', 24), ('args', '-test ums-gated')], 'result': {'workingset': 16265216.0, 'privatemem': 25427968.0, 'nonpaged': 33152.0, 'virtualmem': 690470912.0, 'time': 9.9944796875}}
-{'var': [('concurrency', 24), ('args', '-test ums-gated')], 'result': {'workingset': 16236544.0, 'privatemem': 25595904.0, 'nonpaged': 33392.0, 'virtualmem': 694665216.0, 'time': 9.94461875}}
-{'var': [('concurrency', 24), ('args', '-test ums-gated')], 'result': {'workingset': 16257024.0, 'privatemem': 25403392.0, 'nonpaged': 33152.0, 'virtualmem': 690470912.0, 'time': 9.94913125}}
-{'var': [('concurrency', 24), ('args', '-test ums-gated')], 'result': {'workingset': 16424960.0, 'privatemem': 26009600.0, 'nonpaged': 33872.0, 'virtualmem': 703053824.0, 'time': 9.9931234375}}
-{'var': [('concurrency', 28), ('args', '-test async-gated')], 'result': {'workingset': 22814720.0, 'privatemem': 26169344.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.376209375}}
-{'var': [('concurrency', 28), ('args', '-test async-gated')], 'result': {'workingset': 22528000.0, 'privatemem': 25866240.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2378046875}}
-{'var': [('concurrency', 28), ('args', '-test async-gated')], 'result': {'workingset': 22761472.0, 'privatemem': 26128384.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.225084375}}
-{'var': [('concurrency', 28), ('args', '-test async-gated')], 'result': {'workingset': 22663168.0, 'privatemem': 26038272.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.23915625}}
-{'var': [('concurrency', 28), ('args', '-test async-gated')], 'result': {'workingset': 22831104.0, 'privatemem': 26140672.0, 'nonpaged': 25768.0, 'virtualmem': 564969472.0, 'time': 13.35693125}}
-{'var': [('concurrency', 28), ('args', '-test ums-gated')], 'result': {'workingset': 16650240.0, 'privatemem': 26861568.0, 'nonpaged': 34832.0, 'virtualmem': 719831040.0, 'time': 9.7327859375}}
-{'var': [('concurrency', 28), ('args', '-test ums-gated')], 'result': {'workingset': 16547840.0, 'privatemem': 26378240.0, 'nonpaged': 34352.0, 'virtualmem': 711442432.0, 'time': 9.775103125}}
-{'var': [('concurrency', 28), ('args', '-test ums-gated')], 'result': {'workingset': 16654336.0, 'privatemem': 26513408.0, 'nonpaged': 34472.0, 'virtualmem': 713539584.0, 'time': 9.8092875}}
-{'var': [('concurrency', 28), ('args', '-test ums-gated')], 'result': {'workingset': 16445440.0, 'privatemem': 26304512.0, 'nonpaged': 34352.0, 'virtualmem': 711442432.0, 'time': 9.834784375}}
-{'var': [('concurrency', 28), ('args', '-test ums-gated')], 'result': {'workingset': 16510976.0, 'privatemem': 26243072.0, 'nonpaged': 34112.0, 'virtualmem': 707248128.0, 'time': 9.9615171875}}
-{'var': [('concurrency', 32), ('args', '-test async-gated')], 'result': {'workingset': 22589440.0, 'privatemem': 26005504.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.234246875}}
-{'var': [('concurrency', 32), ('args', '-test async-gated')], 'result': {'workingset': 22814720.0, 'privatemem': 26140672.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1942140625}}
-{'var': [('concurrency', 32), ('args', '-test async-gated')], 'result': {'workingset': 22704128.0, 'privatemem': 26079232.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3161734375}}
-{'var': [('concurrency', 32), ('args', '-test async-gated')], 'result': {'workingset': 22708224.0, 'privatemem': 26030080.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2072671875}}
-{'var': [('concurrency', 32), ('args', '-test async-gated')], 'result': {'workingset': 22691840.0, 'privatemem': 26120192.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2228828125}}
-{'var': [('concurrency', 32), ('args', '-test ums-gated')], 'result': {'workingset': 16568320.0, 'privatemem': 27033600.0, 'nonpaged': 35312.0, 'virtualmem': 728219648.0, 'time': 9.8727921875}}
-{'var': [('concurrency', 32), ('args', '-test ums-gated')], 'result': {'workingset': 16764928.0, 'privatemem': 27238400.0, 'nonpaged': 35312.0, 'virtualmem': 728219648.0, 'time': 9.8168890625}}
-{'var': [('concurrency', 32), ('args', '-test ums-gated')], 'result': {'workingset': 16842752.0, 'privatemem': 27193344.0, 'nonpaged': 35192.0, 'virtualmem': 726122496.0, 'time': 9.8725515625}}
-{'var': [('concurrency', 32), ('args', '-test ums-gated')], 'result': {'workingset': 16732160.0, 'privatemem': 27230208.0, 'nonpaged': 35312.0, 'virtualmem': 728219648.0, 'time': 9.8796578125}}
-{'var': [('concurrency', 32), ('args', '-test ums-gated')], 'result': {'workingset': 16576512.0, 'privatemem': 26882048.0, 'nonpaged': 35072.0, 'virtualmem': 724025344.0, 'time': 9.851103125}}
-{'var': [('concurrency', 40), ('args', '-test async-gated')], 'result': {'workingset': 22679552.0, 'privatemem': 25993216.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.183775}}
-{'var': [('concurrency', 40), ('args', '-test async-gated')], 'result': {'workingset': 22642688.0, 'privatemem': 26030080.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1523140625}}
-{'var': [('concurrency', 40), ('args', '-test async-gated')], 'result': {'workingset': 22642688.0, 'privatemem': 26009600.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2646}}
-{'var': [('concurrency', 40), ('args', '-test async-gated')], 'result': {'workingset': 22609920.0, 'privatemem': 26025984.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.190975}}
-{'var': [('concurrency', 40), ('args', '-test async-gated')], 'result': {'workingset': 22806528.0, 'privatemem': 26173440.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.290859375}}
-{'var': [('concurrency', 40), ('args', '-test ums-gated')], 'result': {'workingset': 17313792.0, 'privatemem': 29270016.0, 'nonpaged': 38312.0, 'virtualmem': 780648448.0, 'time': 9.8081125}}
-{'var': [('concurrency', 40), ('args', '-test ums-gated')], 'result': {'workingset': 17297408.0, 'privatemem': 29560832.0, 'nonpaged': 38672.0, 'virtualmem': 786939904.0, 'time': 9.803896875}}
-{'var': [('concurrency', 40), ('args', '-test ums-gated')], 'result': {'workingset': 17514496.0, 'privatemem': 29667328.0, 'nonpaged': 38552.0, 'virtualmem': 784842752.0, 'time': 10.44371875}}
-{'var': [('concurrency', 40), ('args', '-test ums-gated')], 'result': {'workingset': 17350656.0, 'privatemem': 29356032.0, 'nonpaged': 38312.0, 'virtualmem': 780648448.0, 'time': 10.5586140625}}
-{'var': [('concurrency', 40), ('args', '-test ums-gated')], 'result': {'workingset': 17219584.0, 'privatemem': 29265920.0, 'nonpaged': 38072.0, 'virtualmem': 776454144.0, 'time': 11.02230625}}
-{'var': [('concurrency', 48), ('args', '-test async-gated')], 'result': {'workingset': 29392896.0, 'privatemem': 32837632.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 14.5534375}}
-{'var': [('concurrency', 48), ('args', '-test async-gated')], 'result': {'workingset': 29511680.0, 'privatemem': 32817152.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.04296875}}
-{'var': [('concurrency', 48), ('args', '-test async-gated')], 'result': {'workingset': 29323264.0, 'privatemem': 32690176.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.5768078125}}
-{'var': [('concurrency', 48), ('args', '-test async-gated')], 'result': {'workingset': 29327360.0, 'privatemem': 32718848.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1712328125}}
-{'var': [('concurrency', 48), ('args', '-test async-gated')], 'result': {'workingset': 22704128.0, 'privatemem': 26030080.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.193025}}
-{'var': [('concurrency', 48), ('args', '-test ums-gated')], 'result': {'workingset': 17764352.0, 'privatemem': 30863360.0, 'nonpaged': 40232.0, 'virtualmem': 814202880.0, 'time': 9.7636984375}}
-{'var': [('concurrency', 48), ('args', '-test ums-gated')], 'result': {'workingset': 17707008.0, 'privatemem': 30818304.0, 'nonpaged': 40232.0, 'virtualmem': 814202880.0, 'time': 9.7707}}
-{'var': [('concurrency', 48), ('args', '-test ums-gated')], 'result': {'workingset': 17625088.0, 'privatemem': 30760960.0, 'nonpaged': 40232.0, 'virtualmem': 814202880.0, 'time': 9.812396875}}
-{'var': [('concurrency', 48), ('args', '-test ums-gated')], 'result': {'workingset': 17649664.0, 'privatemem': 30711808.0, 'nonpaged': 40232.0, 'virtualmem': 814202880.0, 'time': 10.313584375}}
-{'var': [('concurrency', 48), ('args', '-test ums-gated')], 'result': {'workingset': 17674240.0, 'privatemem': 30810112.0, 'nonpaged': 40232.0, 'virtualmem': 814202880.0, 'time': 9.8304125}}
-{'var': [('concurrency', 56), ('args', '-test async-gated')], 'result': {'workingset': 29548544.0, 'privatemem': 32927744.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1279546875}}
-{'var': [('concurrency', 56), ('args', '-test async-gated')], 'result': {'workingset': 29532160.0, 'privatemem': 32894976.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1256796875}}
-{'var': [('concurrency', 56), ('args', '-test async-gated')], 'result': {'workingset': 29585408.0, 'privatemem': 32956416.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.14424375}}
-{'var': [('concurrency', 56), ('args', '-test async-gated')], 'result': {'workingset': 29421568.0, 'privatemem': 32800768.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1787703125}}
-{'var': [('concurrency', 56), ('args', '-test async-gated')], 'result': {'workingset': 29347840.0, 'privatemem': 32718848.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.121146875}}
-{'var': [('concurrency', 56), ('args', '-test ums-gated')], 'result': {'workingset': 17829888.0, 'privatemem': 32083968.0, 'nonpaged': 42152.0, 'virtualmem': 847757312.0, 'time': 9.7840515625}}
-{'var': [('concurrency', 56), ('args', '-test ums-gated')], 'result': {'workingset': 17981440.0, 'privatemem': 32190464.0, 'nonpaged': 42152.0, 'virtualmem': 847757312.0, 'time': 9.774884375}}
-{'var': [('concurrency', 56), ('args', '-test ums-gated')], 'result': {'workingset': 17907712.0, 'privatemem': 32178176.0, 'nonpaged': 42152.0, 'virtualmem': 847757312.0, 'time': 9.7712421875}}
-{'var': [('concurrency', 56), ('args', '-test ums-gated')], 'result': {'workingset': 17809408.0, 'privatemem': 32092160.0, 'nonpaged': 42152.0, 'virtualmem': 847757312.0, 'time': 9.883371875}}
-{'var': [('concurrency', 56), ('args', '-test ums-gated')], 'result': {'workingset': 18104320.0, 'privatemem': 32366592.0, 'nonpaged': 42152.0, 'virtualmem': 847757312.0, 'time': 9.8319875}}
-{'var': [('concurrency', 64), ('args', '-test async-gated')], 'result': {'workingset': 29380608.0, 'privatemem': 32731136.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.139365625}}
-{'var': [('concurrency', 64), ('args', '-test async-gated')], 'result': {'workingset': 29401088.0, 'privatemem': 32792576.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1221734375}}
-{'var': [('concurrency', 64), ('args', '-test async-gated')], 'result': {'workingset': 29298688.0, 'privatemem': 32735232.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.3343921875}}
-{'var': [('concurrency', 64), ('args', '-test async-gated')], 'result': {'workingset': 29564928.0, 'privatemem': 32948224.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.144190625}}
-{'var': [('concurrency', 64), ('args', '-test async-gated')], 'result': {'workingset': 29511680.0, 'privatemem': 32894976.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.147003125}}
-{'var': [('concurrency', 64), ('args', '-test ums-gated')], 'result': {'workingset': 18358272.0, 'privatemem': 34308096.0, 'nonpaged': 45032.0, 'virtualmem': 898088960.0, 'time': 9.80116875}}
-{'var': [('concurrency', 64), ('args', '-test ums-gated')], 'result': {'workingset': 18325504.0, 'privatemem': 33714176.0, 'nonpaged': 44072.0, 'virtualmem': 881311744.0, 'time': 9.898659375}}
-{'var': [('concurrency', 64), ('args', '-test ums-gated')], 'result': {'workingset': 18300928.0, 'privatemem': 33689600.0, 'nonpaged': 44072.0, 'virtualmem': 881311744.0, 'time': 9.7784}}
-{'var': [('concurrency', 64), ('args', '-test ums-gated')], 'result': {'workingset': 18210816.0, 'privatemem': 33574912.0, 'nonpaged': 44072.0, 'virtualmem': 881311744.0, 'time': 9.9189640625}}
-{'var': [('concurrency', 64), ('args', '-test ums-gated')], 'result': {'workingset': 18202624.0, 'privatemem': 33566720.0, 'nonpaged': 44072.0, 'virtualmem': 881311744.0, 'time': 9.7934265625}}
-{'var': [('concurrency', 80), ('args', '-test async-gated')], 'result': {'workingset': 29495296.0, 'privatemem': 32886784.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.111571875}}
-{'var': [('concurrency', 80), ('args', '-test async-gated')], 'result': {'workingset': 29429760.0, 'privatemem': 32776192.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.199890625}}
-{'var': [('concurrency', 80), ('args', '-test async-gated')], 'result': {'workingset': 29442048.0, 'privatemem': 32886784.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.11831875}}
-{'var': [('concurrency', 80), ('args', '-test async-gated')], 'result': {'workingset': 29597696.0, 'privatemem': 32931840.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1347890625}}
-{'var': [('concurrency', 80), ('args', '-test async-gated')], 'result': {'workingset': 29417472.0, 'privatemem': 32739328.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.171440625}}
-{'var': [('concurrency', 80), ('args', '-test ums-gated')], 'result': {'workingset': 19292160.0, 'privatemem': 38002688.0, 'nonpaged': 49832.0, 'virtualmem': 981975040.0, 'time': 9.7851578125}}
-{'var': [('concurrency', 80), ('args', '-test ums-gated')], 'result': {'workingset': 19222528.0, 'privatemem': 37990400.0, 'nonpaged': 49832.0, 'virtualmem': 981975040.0, 'time': 9.759603125}}
-{'var': [('concurrency', 80), ('args', '-test ums-gated')], 'result': {'workingset': 19308544.0, 'privatemem': 38092800.0, 'nonpaged': 49928.0, 'virtualmem': 981975040.0, 'time': 9.73698125}}
-{'var': [('concurrency', 80), ('args', '-test ums-gated')], 'result': {'workingset': 19214336.0, 'privatemem': 38002688.0, 'nonpaged': 49832.0, 'virtualmem': 981975040.0, 'time': 9.7582359375}}
-{'var': [('concurrency', 80), ('args', '-test ums-gated')], 'result': {'workingset': 19324928.0, 'privatemem': 38129664.0, 'nonpaged': 49832.0, 'virtualmem': 981975040.0, 'time': 9.7412640625}}
-{'var': [('concurrency', 96), ('args', '-test async-gated')], 'result': {'workingset': 29474816.0, 'privatemem': 32837632.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.169203125}}
-{'var': [('concurrency', 96), ('args', '-test async-gated')], 'result': {'workingset': 29614080.0, 'privatemem': 32976896.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.1191375}}
-{'var': [('concurrency', 96), ('args', '-test async-gated')], 'result': {'workingset': 29626368.0, 'privatemem': 32968704.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1113484375}}
-{'var': [('concurrency', 96), ('args', '-test async-gated')], 'result': {'workingset': 29511680.0, 'privatemem': 33058816.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.1464140625}}
-{'var': [('concurrency', 96), ('args', '-test async-gated')], 'result': {'workingset': 29458432.0, 'privatemem': 32747520.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1111234375}}
-{'var': [('concurrency', 96), ('args', '-test ums-gated')], 'result': {'workingset': 20041728.0, 'privatemem': 41103360.0, 'nonpaged': 53672.0, 'virtualmem': 1049083904.0, 'time': 9.7898}}
-{'var': [('concurrency', 96), ('args', '-test ums-gated')], 'result': {'workingset': 19968000.0, 'privatemem': 41009152.0, 'nonpaged': 53672.0, 'virtualmem': 1049083904.0, 'time': 9.855309375}}
-{'var': [('concurrency', 96), ('args', '-test ums-gated')], 'result': {'workingset': 19824640.0, 'privatemem': 40890368.0, 'nonpaged': 53672.0, 'virtualmem': 1049083904.0, 'time': 9.9260921875}}
-{'var': [('concurrency', 96), ('args', '-test ums-gated')], 'result': {'workingset': 19947520.0, 'privatemem': 41054208.0, 'nonpaged': 53672.0, 'virtualmem': 1049083904.0, 'time': 9.9416703125}}
-{'var': [('concurrency', 96), ('args', '-test ums-gated')], 'result': {'workingset': 19808256.0, 'privatemem': 40882176.0, 'nonpaged': 53672.0, 'virtualmem': 1049083904.0, 'time': 9.8916515625}}
-{'var': [('concurrency', 112), ('args', '-test async-gated')], 'result': {'workingset': 29691904.0, 'privatemem': 33034240.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 15.11079375}}
-{'var': [('concurrency', 112), ('args', '-test async-gated')], 'result': {'workingset': 29458432.0, 'privatemem': 32755712.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1449734375}}
-{'var': [('concurrency', 112), ('args', '-test async-gated')], 'result': {'workingset': 29315072.0, 'privatemem': 32628736.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.13280625}}
-{'var': [('concurrency', 112), ('args', '-test async-gated')], 'result': {'workingset': 29417472.0, 'privatemem': 32788480.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1016015625}}
-{'var': [('concurrency', 112), ('args', '-test async-gated')], 'result': {'workingset': 29417472.0, 'privatemem': 32735232.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.1100125}}
-{'var': [('concurrency', 112), ('args', '-test ums-gated')], 'result': {'workingset': 20836352.0, 'privatemem': 44212224.0, 'nonpaged': 57512.0, 'virtualmem': 1116192768.0, 'time': 10.02668125}}
-{'var': [('concurrency', 112), ('args', '-test ums-gated')], 'result': {'workingset': 20934656.0, 'privatemem': 44322816.0, 'nonpaged': 57512.0, 'virtualmem': 1116192768.0, 'time': 9.9877078125}}
-{'var': [('concurrency', 112), ('args', '-test ums-gated')], 'result': {'workingset': 21037056.0, 'privatemem': 45981696.0, 'nonpaged': 60152.0, 'virtualmem': 1162330112.0, 'time': 9.9358015625}}
-{'var': [('concurrency', 112), ('args', '-test ums-gated')], 'result': {'workingset': 20824064.0, 'privatemem': 44150784.0, 'nonpaged': 57512.0, 'virtualmem': 1116192768.0, 'time': 9.98304375}}
-{'var': [('concurrency', 112), ('args', '-test ums-gated')], 'result': {'workingset': 20856832.0, 'privatemem': 44257280.0, 'nonpaged': 57512.0, 'virtualmem': 1116192768.0, 'time': 10.009546875}}
-{'var': [('concurrency', 128), ('args', '-test async-gated')], 'result': {'workingset': 29589504.0, 'privatemem': 33009664.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.0923984375}}
-{'var': [('concurrency', 128), ('args', '-test async-gated')], 'result': {'workingset': 29470720.0, 'privatemem': 32874496.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.163709375}}
-{'var': [('concurrency', 128), ('args', '-test async-gated')], 'result': {'workingset': 29483008.0, 'privatemem': 32849920.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1063703125}}
-{'var': [('concurrency', 128), ('args', '-test async-gated')], 'result': {'workingset': 29450240.0, 'privatemem': 32800768.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.0826171875}}
-{'var': [('concurrency', 128), ('args', '-test async-gated')], 'result': {'workingset': 29528064.0, 'privatemem': 32833536.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.086065625}}
-{'var': [('concurrency', 128), ('args', '-test ums-gated')], 'result': {'workingset': 21835776.0, 'privatemem': 48500736.0, 'nonpaged': 63032.0, 'virtualmem': 1212661760.0, 'time': 10.0842015625}}
-{'var': [('concurrency', 128), ('args', '-test ums-gated')], 'result': {'workingset': 21663744.0, 'privatemem': 47255552.0, 'nonpaged': 61352.0, 'virtualmem': 1183301632.0, 'time': 10.0181609375}}
-{'var': [('concurrency', 128), ('args', '-test ums-gated')], 'result': {'workingset': 21577728.0, 'privatemem': 47198208.0, 'nonpaged': 61352.0, 'virtualmem': 1183301632.0, 'time': 10.846165625}}
-{'var': [('concurrency', 128), ('args', '-test ums-gated')], 'result': {'workingset': 21389312.0, 'privatemem': 46759936.0, 'nonpaged': 61112.0, 'virtualmem': 1179107328.0, 'time': 11.5423390625}}
-{'var': [('concurrency', 128), ('args', '-test ums-gated')], 'result': {'workingset': 21254144.0, 'privatemem': 46899200.0, 'nonpaged': 61352.0, 'virtualmem': 1183301632.0, 'time': 11.306240625}}
-{'var': [('concurrency', 160), ('args', '-test async-gated')], 'result': {'workingset': 29491200.0, 'privatemem': 32927744.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.85168125}}
-{'var': [('concurrency', 160), ('args', '-test async-gated')], 'result': {'workingset': 29646848.0, 'privatemem': 33005568.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 14.58709375}}
-{'var': [('concurrency', 160), ('args', '-test async-gated')], 'result': {'workingset': 29536256.0, 'privatemem': 32862208.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5917140625}}
-{'var': [('concurrency', 160), ('args', '-test async-gated')], 'result': {'workingset': 29532160.0, 'privatemem': 32821248.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1530390625}}
-{'var': [('concurrency', 160), ('args', '-test async-gated')], 'result': {'workingset': 29405184.0, 'privatemem': 32788480.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.08974375}}
-{'var': [('concurrency', 160), ('args', '-test ums-gated')], 'result': {'workingset': 23420928.0, 'privatemem': 55808000.0, 'nonpaged': 72872.0, 'virtualmem': 1384628224.0, 'time': 10.2232734375}}
-{'var': [('concurrency', 160), ('args', '-test ums-gated')], 'result': {'workingset': 23494656.0, 'privatemem': 55554048.0, 'nonpaged': 72392.0, 'virtualmem': 1376239616.0, 'time': 10.3183484375}}
-{'var': [('concurrency', 160), ('args', '-test ums-gated')], 'result': {'workingset': 23584768.0, 'privatemem': 55844864.0, 'nonpaged': 72872.0, 'virtualmem': 1384628224.0, 'time': 10.3544203125}}
-{'var': [('concurrency', 160), ('args', '-test ums-gated')], 'result': {'workingset': 23617536.0, 'privatemem': 55844864.0, 'nonpaged': 72872.0, 'virtualmem': 1384628224.0, 'time': 10.2523703125}}
-{'var': [('concurrency', 160), ('args', '-test ums-gated')], 'result': {'workingset': 23609344.0, 'privatemem': 55885824.0, 'nonpaged': 72872.0, 'virtualmem': 1384628224.0, 'time': 10.154103125}}
-{'var': [('concurrency', 192), ('args', '-test async-gated')], 'result': {'workingset': 29544448.0, 'privatemem': 32878592.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.0866078125}}
-{'var': [('concurrency', 192), ('args', '-test async-gated')], 'result': {'workingset': 29507584.0, 'privatemem': 32878592.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.0993953125}}
-{'var': [('concurrency', 192), ('args', '-test async-gated')], 'result': {'workingset': 29483008.0, 'privatemem': 32841728.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.10189375}}
-{'var': [('concurrency', 192), ('args', '-test async-gated')], 'result': {'workingset': 29470720.0, 'privatemem': 32874496.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.0977}}
-{'var': [('concurrency', 192), ('args', '-test async-gated')], 'result': {'workingset': 29581312.0, 'privatemem': 32894976.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.0975171875}}
-{'var': [('concurrency', 192), ('args', '-test ums-gated')], 'result': {'workingset': 24719360.0, 'privatemem': 61693952.0, 'nonpaged': 80792.0, 'virtualmem': 1523040256.0, 'time': 10.415759375}}
-{'var': [('concurrency', 192), ('args', '-test ums-gated')], 'result': {'workingset': 24862720.0, 'privatemem': 61919232.0, 'nonpaged': 80792.0, 'virtualmem': 1523040256.0, 'time': 10.2971765625}}
-{'var': [('concurrency', 192), ('args', '-test ums-gated')], 'result': {'workingset': 24784896.0, 'privatemem': 61628416.0, 'nonpaged': 80552.0, 'virtualmem': 1518845952.0, 'time': 10.34406875}}
-{'var': [('concurrency', 192), ('args', '-test ums-gated')], 'result': {'workingset': 24969216.0, 'privatemem': 61984768.0, 'nonpaged': 80792.0, 'virtualmem': 1523040256.0, 'time': 10.2925640625}}
-{'var': [('concurrency', 192), ('args', '-test ums-gated')], 'result': {'workingset': 24752128.0, 'privatemem': 61415424.0, 'nonpaged': 80312.0, 'virtualmem': 1514651648.0, 'time': 10.284221875}}
-{'var': [('concurrency', 224), ('args', '-test async-gated')], 'result': {'workingset': 29650944.0, 'privatemem': 33046528.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.15705625}}
-{'var': [('concurrency', 224), ('args', '-test async-gated')], 'result': {'workingset': 29700096.0, 'privatemem': 33017856.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.122590625}}
-{'var': [('concurrency', 224), ('args', '-test async-gated')], 'result': {'workingset': 29659136.0, 'privatemem': 33026048.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.08970625}}
-{'var': [('concurrency', 224), ('args', '-test async-gated')], 'result': {'workingset': 29491200.0, 'privatemem': 32915456.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1275171875}}
-{'var': [('concurrency', 224), ('args', '-test async-gated')], 'result': {'workingset': 29532160.0, 'privatemem': 32882688.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.14285}}
-{'var': [('concurrency', 224), ('args', '-test ums-gated')], 'result': {'workingset': 26378240.0, 'privatemem': 67780608.0, 'nonpaged': 88352.0, 'virtualmem': 1657257984.0, 'time': 10.4648703125}}
-{'var': [('concurrency', 224), ('args', '-test ums-gated')], 'result': {'workingset': 26124288.0, 'privatemem': 67293184.0, 'nonpaged': 88112.0, 'virtualmem': 1653063680.0, 'time': 10.5292671875}}
-{'var': [('concurrency', 224), ('args', '-test ums-gated')], 'result': {'workingset': 26046464.0, 'privatemem': 67276800.0, 'nonpaged': 87992.0, 'virtualmem': 1648869376.0, 'time': 10.491190625}}
-{'var': [('concurrency', 224), ('args', '-test ums-gated')], 'result': {'workingset': 26034176.0, 'privatemem': 67489792.0, 'nonpaged': 88232.0, 'virtualmem': 1653063680.0, 'time': 10.5243890625}}
-{'var': [('concurrency', 224), ('args', '-test ums-gated')], 'result': {'workingset': 26234880.0, 'privatemem': 67649536.0, 'nonpaged': 88352.0, 'virtualmem': 1657257984.0, 'time': 10.5925109375}}
-{'var': [('concurrency', 256), ('args', '-test async-gated')], 'result': {'workingset': 29548544.0, 'privatemem': 32944128.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.150478125}}
-{'var': [('concurrency', 256), ('args', '-test async-gated')], 'result': {'workingset': 29741056.0, 'privatemem': 33099776.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1190796875}}
-{'var': [('concurrency', 256), ('args', '-test async-gated')], 'result': {'workingset': 29720576.0, 'privatemem': 33005568.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.178025}}
-{'var': [('concurrency', 256), ('args', '-test async-gated')], 'result': {'workingset': 29536256.0, 'privatemem': 32948224.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1318578125}}
-{'var': [('concurrency', 256), ('args', '-test async-gated')], 'result': {'workingset': 29933568.0, 'privatemem': 33325056.0, 'nonpaged': 26120.0, 'virtualmem': 569163776.0, 'time': 13.130896875}}
-{'var': [('concurrency', 256), ('args', '-test ums-gated')], 'result': {'workingset': 27303936.0, 'privatemem': 73404416.0, 'nonpaged': 96272.0, 'virtualmem': 1795670016.0, 'time': 10.5394765625}}
-{'var': [('concurrency', 256), ('args', '-test ums-gated')], 'result': {'workingset': 27607040.0, 'privatemem': 73625600.0, 'nonpaged': 96032.0, 'virtualmem': 1791475712.0, 'time': 10.565934375}}
-{'var': [('concurrency', 256), ('args', '-test ums-gated')], 'result': {'workingset': 27287552.0, 'privatemem': 72835072.0, 'nonpaged': 95552.0, 'virtualmem': 1783087104.0, 'time': 10.6236890625}}
-{'var': [('concurrency', 256), ('args', '-test ums-gated')], 'result': {'workingset': 27480064.0, 'privatemem': 73379840.0, 'nonpaged': 96032.0, 'virtualmem': 1791475712.0, 'time': 10.57548125}}
-{'var': [('concurrency', 256), ('args', '-test ums-gated')], 'result': {'workingset': 27201536.0, 'privatemem': 73240576.0, 'nonpaged': 96032.0, 'virtualmem': 1791475712.0, 'time': 10.68160625}}
-{'var': [('concurrency', 320), ('args', '-test async-gated')], 'result': {'workingset': 29671424.0, 'privatemem': 33038336.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.175703125}}
-{'var': [('concurrency', 320), ('args', '-test async-gated')], 'result': {'workingset': 29827072.0, 'privatemem': 33165312.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1375234375}}
-{'var': [('concurrency', 320), ('args', '-test async-gated')], 'result': {'workingset': 29777920.0, 'privatemem': 33116160.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.121140625}}
-{'var': [('concurrency', 320), ('args', '-test async-gated')], 'result': {'workingset': 29589504.0, 'privatemem': 32870400.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1075078125}}
-{'var': [('concurrency', 320), ('args', '-test async-gated')], 'result': {'workingset': 29704192.0, 'privatemem': 33001472.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.150696875}}
-{'var': [('concurrency', 320), ('args', '-test ums-gated')], 'result': {'workingset': 29577216.0, 'privatemem': 84500480.0, 'nonpaged': 111152.0, 'virtualmem': 2055716864.0, 'time': 10.8671703125}}
-{'var': [('concurrency', 320), ('args', '-test ums-gated')], 'result': {'workingset': 29835264.0, 'privatemem': 84918272.0, 'nonpaged': 111392.0, 'virtualmem': 2059911168.0, 'time': 10.893078125}}
-{'var': [('concurrency', 320), ('args', '-test ums-gated')], 'result': {'workingset': 29667328.0, 'privatemem': 84197376.0, 'nonpaged': 110672.0, 'virtualmem': 2047328256.0, 'time': 10.899709375}}
-{'var': [('concurrency', 320), ('args', '-test ums-gated')], 'result': {'workingset': 29663232.0, 'privatemem': 84520960.0, 'nonpaged': 111152.0, 'virtualmem': 2055716864.0, 'time': 10.9027828125}}
-{'var': [('concurrency', 320), ('args', '-test ums-gated')], 'result': {'workingset': 29720576.0, 'privatemem': 84615168.0, 'nonpaged': 111152.0, 'virtualmem': 2055716864.0, 'time': 10.904421875}}
-{'var': [('concurrency', 384), ('args', '-test async-gated')], 'result': {'workingset': 29646848.0, 'privatemem': 32960512.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.132984375}}
-{'var': [('concurrency', 384), ('args', '-test async-gated')], 'result': {'workingset': 29839360.0, 'privatemem': 33132544.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.13160625}}
-{'var': [('concurrency', 384), ('args', '-test async-gated')], 'result': {'workingset': 29978624.0, 'privatemem': 33378304.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 13.1281796875}}
-{'var': [('concurrency', 384), ('args', '-test async-gated')], 'result': {'workingset': 29798400.0, 'privatemem': 33095680.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1194140625}}
-{'var': [('concurrency', 384), ('args', '-test async-gated')], 'result': {'workingset': 29880320.0, 'privatemem': 33148928.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.140121875}}
-{'var': [('concurrency', 384), ('args', '-test ums-gated')], 'result': {'workingset': 32329728.0, 'privatemem': 96473088.0, 'nonpaged': 126752.0, 'virtualmem': 2328346624.0, 'time': 11.03265625}}
-{'var': [('concurrency', 384), ('args', '-test ums-gated')], 'result': {'workingset': 32165888.0, 'privatemem': 96047104.0, 'nonpaged': 126272.0, 'virtualmem': 2319958016.0, 'time': 11.1066328125}}
-{'var': [('concurrency', 384), ('args', '-test ums-gated')], 'result': {'workingset': 32178176.0, 'privatemem': 96284672.0, 'nonpaged': 126512.0, 'virtualmem': 2324152320.0, 'time': 11.0177765625}}
-{'var': [('concurrency', 384), ('args', '-test ums-gated')], 'result': {'workingset': 32161792.0, 'privatemem': 96284672.0, 'nonpaged': 126752.0, 'virtualmem': 2328346624.0, 'time': 11.15135}}
-{'var': [('concurrency', 384), ('args', '-test ums-gated')], 'result': {'workingset': 32096256.0, 'privatemem': 96309248.0, 'nonpaged': 126752.0, 'virtualmem': 2328346624.0, 'time': 11.1041015625}}
-{'var': [('concurrency', 448), ('args', '-test async-gated')], 'result': {'workingset': 29798400.0, 'privatemem': 33148928.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.127125}}
-{'var': [('concurrency', 448), ('args', '-test async-gated')], 'result': {'workingset': 29913088.0, 'privatemem': 33284096.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1395265625}}
-{'var': [('concurrency', 448), ('args', '-test async-gated')], 'result': {'workingset': 29921280.0, 'privatemem': 33263616.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.136646875}}
-{'var': [('concurrency', 448), ('args', '-test async-gated')], 'result': {'workingset': 29761536.0, 'privatemem': 33140736.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1379828125}}
-{'var': [('concurrency', 448), ('args', '-test async-gated')], 'result': {'workingset': 29818880.0, 'privatemem': 33173504.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.7975015625}}
-{'var': [('concurrency', 448), ('args', '-test ums-gated')], 'result': {'workingset': 34549760.0, 'privatemem': 107462656.0, 'nonpaged': 141632.0, 'virtualmem': 2588393472.0, 'time': 12.9889609375}}
-{'var': [('concurrency', 448), ('args', '-test ums-gated')], 'result': {'workingset': 34643968.0, 'privatemem': 108085248.0, 'nonpaged': 142352.0, 'virtualmem': 2600976384.0, 'time': 13.0880796875}}
-{'var': [('concurrency', 448), ('args', '-test ums-gated')], 'result': {'workingset': 34697216.0, 'privatemem': 107810816.0, 'nonpaged': 141872.0, 'virtualmem': 2592587776.0, 'time': 13.2690765625}}
-{'var': [('concurrency', 448), ('args', '-test ums-gated')], 'result': {'workingset': 34508800.0, 'privatemem': 107683840.0, 'nonpaged': 141872.0, 'virtualmem': 2592587776.0, 'time': 12.4901671875}}
-{'var': [('concurrency', 448), ('args', '-test ums-gated')], 'result': {'workingset': 34443264.0, 'privatemem': 107638784.0, 'nonpaged': 141872.0, 'virtualmem': 2592587776.0, 'time': 11.23786875}}
-{'var': [('concurrency', 512), ('args', '-test async-gated')], 'result': {'workingset': 29847552.0, 'privatemem': 33222656.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.127740625}}
-{'var': [('concurrency', 512), ('args', '-test async-gated')], 'result': {'workingset': 29859840.0, 'privatemem': 33206272.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.22630625}}
-{'var': [('concurrency', 512), ('args', '-test async-gated')], 'result': {'workingset': 29896704.0, 'privatemem': 33259520.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1849640625}}
-{'var': [('concurrency', 512), ('args', '-test async-gated')], 'result': {'workingset': 29884416.0, 'privatemem': 33206272.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.13985}}
-{'var': [('concurrency', 512), ('args', '-test async-gated')], 'result': {'workingset': 30007296.0, 'privatemem': 33333248.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1424328125}}
-{'var': [('concurrency', 512), ('args', '-test ums-gated')], 'result': {'workingset': 37142528.0, 'privatemem': 119185408.0, 'nonpaged': 156992.0, 'virtualmem': 2856828928.0, 'time': 11.397996875}}
-{'var': [('concurrency', 512), ('args', '-test ums-gated')], 'result': {'workingset': 37056512.0, 'privatemem': 119328768.0, 'nonpaged': 157232.0, 'virtualmem': 2861023232.0, 'time': 11.38355}}
-{'var': [('concurrency', 512), ('args', '-test ums-gated')], 'result': {'workingset': 37068800.0, 'privatemem': 119164928.0, 'nonpaged': 156992.0, 'virtualmem': 2856828928.0, 'time': 11.4034015625}}
-{'var': [('concurrency', 512), ('args', '-test ums-gated')], 'result': {'workingset': 37187584.0, 'privatemem': 119382016.0, 'nonpaged': 157232.0, 'virtualmem': 2861023232.0, 'time': 11.341525}}
-{'var': [('concurrency', 512), ('args', '-test ums-gated')], 'result': {'workingset': 37076992.0, 'privatemem': 119296000.0, 'nonpaged': 157232.0, 'virtualmem': 2861023232.0, 'time': 11.373334375}}
-{'var': [('concurrency', 640), ('args', '-test async-gated')], 'result': {'workingset': 30105600.0, 'privatemem': 33378304.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.18291875}}
-{'var': [('concurrency', 640), ('args', '-test async-gated')], 'result': {'workingset': 30064640.0, 'privatemem': 33406976.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.201753125}}
-{'var': [('concurrency', 640), ('args', '-test async-gated')], 'result': {'workingset': 30154752.0, 'privatemem': 33447936.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1939015625}}
-{'var': [('concurrency', 640), ('args', '-test async-gated')], 'result': {'workingset': 30044160.0, 'privatemem': 33349632.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2285859375}}
-{'var': [('concurrency', 640), ('args', '-test async-gated')], 'result': {'workingset': 30068736.0, 'privatemem': 33341440.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1834984375}}
-{'var': [('concurrency', 640), ('args', '-test ums-gated')], 'result': {'workingset': 47366144.0, 'privatemem': 141705216.0, 'nonpaged': 188192.0, 'virtualmem': 3402088448.0, 'time': 11.7742625}}
-{'var': [('concurrency', 640), ('args', '-test ums-gated')], 'result': {'workingset': 47321088.0, 'privatemem': 141434880.0, 'nonpaged': 187712.0, 'virtualmem': 3393699840.0, 'time': 11.8519890625}}
-{'var': [('concurrency', 640), ('args', '-test ums-gated')], 'result': {'workingset': 47198208.0, 'privatemem': 141729792.0, 'nonpaged': 188432.0, 'virtualmem': 3406282752.0, 'time': 11.8748625}}
-{'var': [('concurrency', 640), ('args', '-test ums-gated')], 'result': {'workingset': 47349760.0, 'privatemem': 141578240.0, 'nonpaged': 187952.0, 'virtualmem': 3397894144.0, 'time': 11.80855625}}
-{'var': [('concurrency', 640), ('args', '-test ums-gated')], 'result': {'workingset': 47333376.0, 'privatemem': 141635584.0, 'nonpaged': 188192.0, 'virtualmem': 3402088448.0, 'time': 11.8793171875}}
-{'var': [('concurrency', 768), ('args', '-test async-gated')], 'result': {'workingset': 30441472.0, 'privatemem': 33677312.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1907140625}}
-{'var': [('concurrency', 768), ('args', '-test async-gated')], 'result': {'workingset': 30380032.0, 'privatemem': 33607680.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.224996875}}
-{'var': [('concurrency', 768), ('args', '-test async-gated')], 'result': {'workingset': 30326784.0, 'privatemem': 33628160.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.1955234375}}
-{'var': [('concurrency', 768), ('args', '-test async-gated')], 'result': {'workingset': 30355456.0, 'privatemem': 33726464.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 13.1947671875}}
-{'var': [('concurrency', 768), ('args', '-test async-gated')], 'result': {'workingset': 30322688.0, 'privatemem': 33738752.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2064796875}}
-{'var': [('concurrency', 768), ('args', '-test ums-gated')], 'result': {'workingset': 52543488.0, 'privatemem': 163958784.0, 'nonpaged': 219032.0, 'virtualmem': 3947347968.0, 'time': 11.974178125}}
-{'var': [('concurrency', 768), ('args', '-test ums-gated')], 'result': {'workingset': 52502528.0, 'privatemem': 164315136.0, 'nonpaged': 219512.0, 'virtualmem': 3955736576.0, 'time': 11.9167046875}}
-{'var': [('concurrency', 768), ('args', '-test ums-gated')], 'result': {'workingset': 52707328.0, 'privatemem': 164122624.0, 'nonpaged': 219032.0, 'virtualmem': 3947347968.0, 'time': 12.118128125}}
-{'var': [('concurrency', 768), ('args', '-test ums-gated')], 'result': {'workingset': 52293632.0, 'privatemem': 163651584.0, 'nonpaged': 218792.0, 'virtualmem': 3943153664.0, 'time': 12.049109375}}
-{'var': [('concurrency', 768), ('args', '-test ums-gated')], 'result': {'workingset': 52748288.0, 'privatemem': 163999744.0, 'nonpaged': 219032.0, 'virtualmem': 3947347968.0, 'time': 12.0723515625}}
-{'var': [('concurrency', 896), ('args', '-test async-gated')], 'result': {'workingset': 30642176.0, 'privatemem': 33882112.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1681703125}}
-{'var': [('concurrency', 896), ('args', '-test async-gated')], 'result': {'workingset': 30302208.0, 'privatemem': 33697792.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.1825015625}}
-{'var': [('concurrency', 896), ('args', '-test async-gated')], 'result': {'workingset': 30408704.0, 'privatemem': 33726464.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.2253203125}}
-{'var': [('concurrency', 896), ('args', '-test async-gated')], 'result': {'workingset': 30486528.0, 'privatemem': 33800192.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.250696875}}
-{'var': [('concurrency', 896), ('args', '-test async-gated')], 'result': {'workingset': 30560256.0, 'privatemem': 33894400.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.174471875}}
-{'var': [('concurrency', 896), ('args', '-test ums-gated')], 'result': {'workingset': 58105856.0, 'privatemem': 186347520.0, 'nonpaged': 249512.0, 'virtualmem': 4480024576.0, 'time': 12.09041875}}
-{'var': [('concurrency', 896), ('args', '-test ums-gated')], 'result': {'workingset': 57851904.0, 'privatemem': 186142720.0, 'nonpaged': 249752.0, 'virtualmem': 4484218880.0, 'time': 11.9983140625}}
-{'var': [('concurrency', 896), ('args', '-test ums-gated')], 'result': {'workingset': 57663488.0, 'privatemem': 185761792.0, 'nonpaged': 249512.0, 'virtualmem': 4480024576.0, 'time': 12.26386875}}
-{'var': [('concurrency', 896), ('args', '-test ums-gated')], 'result': {'workingset': 57929728.0, 'privatemem': 186257408.0, 'nonpaged': 249752.0, 'virtualmem': 4484218880.0, 'time': 11.9970984375}}
-{'var': [('concurrency', 896), ('args', '-test ums-gated')], 'result': {'workingset': 58085376.0, 'privatemem': 186654720.0, 'nonpaged': 249752.0, 'virtualmem': 4484218880.0, 'time': 12.0862875}}
-{'var': [('concurrency', 1024), ('args', '-test async-gated')], 'result': {'workingset': 30867456.0, 'privatemem': 34107392.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.2160328125}}
-{'var': [('concurrency', 1024), ('args', '-test async-gated')], 'result': {'workingset': 30945280.0, 'privatemem': 34258944.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.2101375}}
-{'var': [('concurrency', 1024), ('args', '-test async-gated')], 'result': {'workingset': 31059968.0, 'privatemem': 34291712.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.3171546875}}
-{'var': [('concurrency', 1024), ('args', '-test async-gated')], 'result': {'workingset': 31064064.0, 'privatemem': 34279424.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.2282890625}}
-{'var': [('concurrency', 1024), ('args', '-test async-gated')], 'result': {'workingset': 31006720.0, 'privatemem': 34263040.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.209078125}}
-{'var': [('concurrency', 1024), ('args', '-test ums-gated')], 'result': {'workingset': 63021056.0, 'privatemem': 208171008.0, 'nonpaged': 280232.0, 'virtualmem': 5016895488.0, 'time': 13.048375}}
-{'var': [('concurrency', 1024), ('args', '-test ums-gated')], 'result': {'workingset': 63369216.0, 'privatemem': 208424960.0, 'nonpaged': 280232.0, 'virtualmem': 5016895488.0, 'time': 12.2770109375}}
-{'var': [('concurrency', 1024), ('args', '-test ums-gated')], 'result': {'workingset': 63447040.0, 'privatemem': 208539648.0, 'nonpaged': 279992.0, 'virtualmem': 5012701184.0, 'time': 12.228196875}}
-{'var': [('concurrency', 1024), ('args', '-test ums-gated')], 'result': {'workingset': 63488000.0, 'privatemem': 208715776.0, 'nonpaged': 280232.0, 'virtualmem': 5016895488.0, 'time': 12.670853125}}
-{'var': [('concurrency', 1024), ('args', '-test ums-gated')], 'result': {'workingset': 63070208.0, 'privatemem': 208207872.0, 'nonpaged': 279992.0, 'virtualmem': 5012701184.0, 'time': 12.4422}}
-{'var': [('concurrency', 1280), ('args', '-test async-gated')], 'result': {'workingset': 31617024.0, 'privatemem': 34848768.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.2811921875}}
-{'var': [('concurrency', 1280), ('args', '-test async-gated')], 'result': {'workingset': 31719424.0, 'privatemem': 34897920.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.22355625}}
-{'var': [('concurrency', 1280), ('args', '-test async-gated')], 'result': {'workingset': 31494144.0, 'privatemem': 34746368.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.22349375}}
-{'var': [('concurrency', 1280), ('args', '-test async-gated')], 'result': {'workingset': 31694848.0, 'privatemem': 34947072.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.2325609375}}
-{'var': [('concurrency', 1280), ('args', '-test async-gated')], 'result': {'workingset': 31547392.0, 'privatemem': 34807808.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.767953125}}
-{'var': [('concurrency', 1280), ('args', '-test ums-gated')], 'result': {'workingset': 73158656.0, 'privatemem': 252420096.0, 'nonpaged': 341912.0, 'virtualmem': 6094831616.0, 'time': 15.0598109375}}
-{'var': [('concurrency', 1280), ('args', '-test ums-gated')], 'result': {'workingset': 65974272.0, 'privatemem': 252903424.0, 'nonpaged': 342152.0, 'virtualmem': 6099025920.0, 'time': 13.8913953125}}
-{'var': [('concurrency', 1280), ('args', '-test ums-gated')], 'result': {'workingset': 66895872.0, 'privatemem': 253501440.0, 'nonpaged': 342632.0, 'virtualmem': 6107414528.0, 'time': 13.2943546875}}
-{'var': [('concurrency', 1280), ('args', '-test ums-gated')], 'result': {'workingset': 67772416.0, 'privatemem': 252964864.0, 'nonpaged': 341912.0, 'virtualmem': 6094831616.0, 'time': 12.7788609375}}
-{'var': [('concurrency', 1280), ('args', '-test ums-gated')], 'result': {'workingset': 66498560.0, 'privatemem': 252874752.0, 'nonpaged': 341912.0, 'virtualmem': 6094831616.0, 'time': 12.8031625}}
-{'var': [('concurrency', 1536), ('args', '-test async-gated')], 'result': {'workingset': 24178688.0, 'privatemem': 27402240.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.357275}}
-{'var': [('concurrency', 1536), ('args', '-test async-gated')], 'result': {'workingset': 23916544.0, 'privatemem': 27070464.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3384296875}}
-{'var': [('concurrency', 1536), ('args', '-test async-gated')], 'result': {'workingset': 24154112.0, 'privatemem': 27303936.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.3860484375}}
-{'var': [('concurrency', 1536), ('args', '-test async-gated')], 'result': {'workingset': 24080384.0, 'privatemem': 27303936.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.40868125}}
-{'var': [('concurrency', 1536), ('args', '-test async-gated')], 'result': {'workingset': 23764992.0, 'privatemem': 26914816.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3454890625}}
-{'var': [('concurrency', 1536), ('args', '-test ums-gated')], 'result': {'workingset': 74870784.0, 'privatemem': 296960000.0, 'nonpaged': 403512.0, 'virtualmem': 7172767744.0, 'time': 13.6358265625}}
-{'var': [('concurrency', 1536), ('args', '-test ums-gated')], 'result': {'workingset': 84811776.0, 'privatemem': 298262528.0, 'nonpaged': 403832.0, 'virtualmem': 7176962048.0, 'time': 14.18599375}}
-{'var': [('concurrency', 1536), ('args', '-test ums-gated')], 'result': {'workingset': 75407360.0, 'privatemem': 296779776.0, 'nonpaged': 403592.0, 'virtualmem': 7172767744.0, 'time': 13.6721390625}}
-{'var': [('concurrency', 1536), ('args', '-test ums-gated')], 'result': {'workingset': 75026432.0, 'privatemem': 296505344.0, 'nonpaged': 403112.0, 'virtualmem': 7164379136.0, 'time': 13.3102890625}}
-{'var': [('concurrency', 1536), ('args', '-test ums-gated')], 'result': {'workingset': 74461184.0, 'privatemem': 296538112.0, 'nonpaged': 403272.0, 'virtualmem': 7168573440.0, 'time': 14.0042234375}}
-{'var': [('concurrency', 1792), ('args', '-test async-gated')], 'result': {'workingset': 24694784.0, 'privatemem': 27824128.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.3436484375}}
-{'var': [('concurrency', 1792), ('args', '-test async-gated')], 'result': {'workingset': 24739840.0, 'privatemem': 27815936.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3563359375}}
-{'var': [('concurrency', 1792), ('args', '-test async-gated')], 'result': {'workingset': 24772608.0, 'privatemem': 27918336.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4315375}}
-{'var': [('concurrency', 1792), ('args', '-test async-gated')], 'result': {'workingset': 24756224.0, 'privatemem': 27865088.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.345803125}}
-{'var': [('concurrency', 1792), ('args', '-test async-gated')], 'result': {'workingset': 24608768.0, 'privatemem': 27750400.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.402634375}}
-{'var': [('concurrency', 1792), ('args', '-test ums-gated')], 'result': {'workingset': 95748096.0, 'privatemem': 343252992.0, 'nonpaged': 465312.0, 'virtualmem': 8267284480.0, 'time': 14.8233890625}}
-{'var': [('concurrency', 1792), ('args', '-test ums-gated')], 'result': {'workingset': 96260096.0, 'privatemem': 343367680.0, 'nonpaged': 465072.0, 'virtualmem': 8263090176.0, 'time': 14.9048890625}}
-{'var': [('concurrency', 1792), ('args', '-test ums-gated')], 'result': {'workingset': 95764480.0, 'privatemem': 342867968.0, 'nonpaged': 465072.0, 'virtualmem': 8263090176.0, 'time': 14.65851875}}
-{'var': [('concurrency', 1792), ('args', '-test ums-gated')], 'result': {'workingset': 95637504.0, 'privatemem': 342515712.0, 'nonpaged': 464832.0, 'virtualmem': 8258895872.0, 'time': 14.7174265625}}
-{'var': [('concurrency', 1792), ('args', '-test ums-gated')], 'result': {'workingset': 95924224.0, 'privatemem': 342884352.0, 'nonpaged': 464832.0, 'virtualmem': 8258895872.0, 'time': 14.8882921875}}
-{'var': [('concurrency', 2048), ('args', '-test async-gated')], 'result': {'workingset': 25047040.0, 'privatemem': 28094464.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3807953125}}
-{'var': [('concurrency', 2048), ('args', '-test async-gated')], 'result': {'workingset': 24981504.0, 'privatemem': 28151808.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.398909375}}
-{'var': [('concurrency', 2048), ('args', '-test async-gated')], 'result': {'workingset': 25075712.0, 'privatemem': 28147712.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.359221875}}
-{'var': [('concurrency', 2048), ('args', '-test async-gated')], 'result': {'workingset': 25006080.0, 'privatemem': 28098560.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3784}}
-{'var': [('concurrency', 2048), ('args', '-test async-gated')], 'result': {'workingset': 24997888.0, 'privatemem': 28069888.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.3560390625}}
-{'var': [('concurrency', 2048), ('args', '-test ums-gated')], 'result': {'workingset': 105529344.0, 'privatemem': 386404352.0, 'nonpaged': 526512.0, 'virtualmem': 9336832000.0, 'time': 15.17243125}}
-{'var': [('concurrency', 2048), ('args', '-test ums-gated')], 'result': {'workingset': 106209280.0, 'privatemem': 387317760.0, 'nonpaged': 526992.0, 'virtualmem': 9345220608.0, 'time': 15.41375625}}
-{'var': [('concurrency', 2048), ('args', '-test ums-gated')], 'result': {'workingset': 107094016.0, 'privatemem': 388059136.0, 'nonpaged': 526752.0, 'virtualmem': 9341026304.0, 'time': 15.4270546875}}
-{'var': [('concurrency', 2048), ('args', '-test ums-gated')], 'result': {'workingset': 106483712.0, 'privatemem': 387428352.0, 'nonpaged': 526272.0, 'virtualmem': 9332637696.0, 'time': 15.0365046875}}
-{'var': [('concurrency', 2048), ('args', '-test ums-gated')], 'result': {'workingset': 106057728.0, 'privatemem': 386617344.0, 'nonpaged': 526272.0, 'virtualmem': 9332637696.0, 'time': 15.11465}}
-{'var': [('concurrency', 2560), ('args', '-test async-gated')], 'result': {'workingset': 25714688.0, 'privatemem': 28733440.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4772109375}}
-{'var': [('concurrency', 2560), ('args', '-test async-gated')], 'result': {'workingset': 29986816.0, 'privatemem': 33038336.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.39680625}}
-{'var': [('concurrency', 2560), ('args', '-test async-gated')], 'result': {'workingset': 30007296.0, 'privatemem': 33005568.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.43141875}}
-{'var': [('concurrency', 2560), ('args', '-test async-gated')], 'result': {'workingset': 25714688.0, 'privatemem': 28782592.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.4375484375}}
-{'var': [('concurrency', 2560), ('args', '-test async-gated')], 'result': {'workingset': 29941760.0, 'privatemem': 33050624.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 13.40918125}}
-{'var': [('concurrency', 2560), ('args', '-test ums-gated')], 'result': {'workingset': 124895232.0, 'privatemem': 473268224.0, 'nonpaged': 649152.0, 'virtualmem': 11480121344.0, 'time': 15.8352921875}}
-{'var': [('concurrency', 2560), ('args', '-test ums-gated')], 'result': {'workingset': 125243392.0, 'privatemem': 474202112.0, 'nonpaged': 649152.0, 'virtualmem': 11480121344.0, 'time': 15.9860609375}}
-{'var': [('concurrency', 2560), ('args', '-test ums-gated')], 'result': {'workingset': 126054400.0, 'privatemem': 474787840.0, 'nonpaged': 648912.0, 'virtualmem': 11475927040.0, 'time': 15.8798015625}}
-{'var': [('concurrency', 2560), ('args', '-test ums-gated')], 'result': {'workingset': 125100032.0, 'privatemem': 473649152.0, 'nonpaged': 648912.0, 'virtualmem': 11475927040.0, 'time': 15.90209375}}
-{'var': [('concurrency', 2560), ('args', '-test ums-gated')], 'result': {'workingset': 127406080.0, 'privatemem': 482037760.0, 'nonpaged': 658512.0, 'virtualmem': 11643699200.0, 'time': 16.0772640625}}
-{'var': [('concurrency', 3072), ('args', '-test async-gated')], 'result': {'workingset': 30760960.0, 'privatemem': 33771520.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.4638640625}}
-{'var': [('concurrency', 3072), ('args', '-test async-gated')], 'result': {'workingset': 30720000.0, 'privatemem': 33730560.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.4992015625}}
-{'var': [('concurrency', 3072), ('args', '-test async-gated')], 'result': {'workingset': 30593024.0, 'privatemem': 33632256.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.460190625}}
-{'var': [('concurrency', 3072), ('args', '-test async-gated')], 'result': {'workingset': 30691328.0, 'privatemem': 33710080.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.584534375}}
-{'var': [('concurrency', 3072), ('args', '-test async-gated')], 'result': {'workingset': 30756864.0, 'privatemem': 33738752.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.8325828125}}
-{'var': [('concurrency', 3072), ('args', '-test ums-gated')], 'result': {'workingset': 145821696.0, 'privatemem': 562421760.0, 'nonpaged': 772032.0, 'virtualmem': 13627604992.0, 'time': 18.0121359375}}
-{'var': [('concurrency', 3072), ('args', '-test ums-gated')], 'result': {'workingset': 145391616.0, 'privatemem': 562782208.0, 'nonpaged': 772416.0, 'virtualmem': 13635993600.0, 'time': 16.273371875}}
-{'var': [('concurrency', 3072), ('args', '-test ums-gated')], 'result': {'workingset': 145211392.0, 'privatemem': 561577984.0, 'nonpaged': 771936.0, 'virtualmem': 13627604992.0, 'time': 16.684478125}}
-{'var': [('concurrency', 3072), ('args', '-test ums-gated')], 'result': {'workingset': 145367040.0, 'privatemem': 561598464.0, 'nonpaged': 771936.0, 'virtualmem': 13627604992.0, 'time': 16.70395}}
-{'var': [('concurrency', 3072), ('args', '-test ums-gated')], 'result': {'workingset': 145969152.0, 'privatemem': 562495488.0, 'nonpaged': 771936.0, 'virtualmem': 13627604992.0, 'time': 16.7380234375}}
-{'var': [('concurrency', 3584), ('args', '-test async-gated')], 'result': {'workingset': 31399936.0, 'privatemem': 34484224.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5152703125}}
-{'var': [('concurrency', 3584), ('args', '-test async-gated')], 'result': {'workingset': 31645696.0, 'privatemem': 34541568.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.5179421875}}
-{'var': [('concurrency', 3584), ('args', '-test async-gated')], 'result': {'workingset': 31395840.0, 'privatemem': 34435072.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.486846875}}
-{'var': [('concurrency', 3584), ('args', '-test async-gated')], 'result': {'workingset': 31571968.0, 'privatemem': 34500608.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.5053265625}}
-{'var': [('concurrency', 3584), ('args', '-test async-gated')], 'result': {'workingset': 31473664.0, 'privatemem': 34447360.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.506196875}}
-{'var': [('concurrency', 3584), ('args', '-test ums-gated')], 'result': {'workingset': 166944768.0, 'privatemem': 650125312.0, 'nonpaged': 895176.0, 'virtualmem': 15795929088.0, 'time': 17.12616875}}
-{'var': [('concurrency', 3584), ('args', '-test ums-gated')], 'result': {'workingset': 166453248.0, 'privatemem': 650084352.0, 'nonpaged': 895656.0, 'virtualmem': 15804317696.0, 'time': 17.1012453125}}
-{'var': [('concurrency', 3584), ('args', '-test ums-gated')], 'result': {'workingset': 166957056.0, 'privatemem': 650522624.0, 'nonpaged': 895416.0, 'virtualmem': 15800123392.0, 'time': 17.041084375}}
-{'var': [('concurrency', 3584), ('args', '-test ums-gated')], 'result': {'workingset': 166461440.0, 'privatemem': 651186176.0, 'nonpaged': 896136.0, 'virtualmem': 15812706304.0, 'time': 17.265559375}}
-{'var': [('concurrency', 3584), ('args', '-test ums-gated')], 'result': {'workingset': 166281216.0, 'privatemem': 650743808.0, 'nonpaged': 895416.0, 'virtualmem': 15800123392.0, 'time': 17.20788125}}
-{'var': [('concurrency', 4096), ('args', '-test async-gated')], 'result': {'workingset': 33193984.0, 'privatemem': 36044800.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.543359375}}
-{'var': [('concurrency', 4096), ('args', '-test async-gated')], 'result': {'workingset': 33120256.0, 'privatemem': 35979264.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5913015625}}
-{'var': [('concurrency', 4096), ('args', '-test async-gated')], 'result': {'workingset': 32976896.0, 'privatemem': 35794944.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.5597421875}}
-{'var': [('concurrency', 4096), ('args', '-test async-gated')], 'result': {'workingset': 32976896.0, 'privatemem': 35885056.0, 'nonpaged': 25288.0, 'virtualmem': 556580864.0, 'time': 13.561975}}
-{'var': [('concurrency', 4096), ('args', '-test async-gated')], 'result': {'workingset': 33013760.0, 'privatemem': 35872768.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.552240625}}
-{'var': [('concurrency', 4096), ('args', '-test ums-gated')], 'result': {'workingset': 188612608.0, 'privatemem': 740990976.0, 'nonpaged': 1019232.0, 'virtualmem': 17964384256.0, 'time': 18.23205}}
-{'var': [('concurrency', 4096), ('args', '-test ums-gated')], 'result': {'workingset': 190369792.0, 'privatemem': 742092800.0, 'nonpaged': 1018176.0, 'virtualmem': 17947607040.0, 'time': 18.1267921875}}
-{'var': [('concurrency', 4096), ('args', '-test ums-gated')], 'result': {'workingset': 190291968.0, 'privatemem': 751833088.0, 'nonpaged': 1034976.0, 'virtualmem': 18241208320.0, 'time': 18.278765625}}
-{'var': [('concurrency', 4096), ('args', '-test ums-gated')], 'result': {'workingset': 187871232.0, 'privatemem': 739778560.0, 'nonpaged': 1018512.0, 'virtualmem': 17951801344.0, 'time': 18.356121875}}
-{'var': [('concurrency', 4096), ('args', '-test ums-gated')], 'result': {'workingset': 188469248.0, 'privatemem': 739135488.0, 'nonpaged': 1018512.0, 'virtualmem': 17951801344.0, 'time': 17.9174328125}}
-{'var': [('concurrency', 5120), ('args', '-test async-gated')], 'result': {'workingset': 34922496.0, 'privatemem': 37539840.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.705434375}}
-{'var': [('concurrency', 5120), ('args', '-test async-gated')], 'result': {'workingset': 34988032.0, 'privatemem': 37617664.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 13.677278125}}
-{'var': [('concurrency', 5120), ('args', '-test async-gated')], 'result': {'workingset': 34988032.0, 'privatemem': 37523456.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.64224375}}
-{'var': [('concurrency', 5120), ('args', '-test async-gated')], 'result': {'workingset': 35012608.0, 'privatemem': 37642240.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.65468125}}
-{'var': [('concurrency', 5120), ('args', '-test async-gated')], 'result': {'workingset': 35115008.0, 'privatemem': 37711872.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.70276875}}
-{'var': [('concurrency', 5120), ('args', '-test ums-gated')], 'result': {'workingset': 228339712.0, 'privatemem': 915566592.0, 'nonpaged': 1264176.0, 'virtualmem': 22246768640.0, 'time': 19.006409375}}
-{'var': [('concurrency', 5120), ('args', '-test ums-gated')], 'result': {'workingset': 229093376.0, 'privatemem': 916045824.0, 'nonpaged': 1264296.0, 'virtualmem': 22263349248.0, 'time': 19.33424375}}
-{'var': [('concurrency', 5120), ('args', '-test ums-gated')], 'result': {'workingset': 228802560.0, 'privatemem': 915972096.0, 'nonpaged': 1264184.0, 'virtualmem': 22263349248.0, 'time': 19.201040625}}
-{'var': [('concurrency', 5120), ('args', '-test ums-gated')], 'result': {'workingset': 228282368.0, 'privatemem': 915853312.0, 'nonpaged': 1263936.0, 'virtualmem': 22242574336.0, 'time': 19.1797125}}
-{'var': [('concurrency', 5120), ('args', '-test ums-gated')], 'result': {'workingset': 227971072.0, 'privatemem': 915865600.0, 'nonpaged': 1264896.0, 'virtualmem': 22259351552.0, 'time': 20.5840234375}}
-{'var': [('concurrency', 6144), ('args', '-test async-gated')], 'result': {'workingset': 36610048.0, 'privatemem': 39178240.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 15.2996234375}}
-{'var': [('concurrency', 6144), ('args', '-test async-gated')], 'result': {'workingset': 36446208.0, 'privatemem': 39006208.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 15.2134390625}}
-{'var': [('concurrency', 6144), ('args', '-test async-gated')], 'result': {'workingset': 36413440.0, 'privatemem': 39055360.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 14.35226875}}
-{'var': [('concurrency', 6144), ('args', '-test async-gated')], 'result': {'workingset': 36429824.0, 'privatemem': 39075840.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.8014796875}}
-{'var': [('concurrency', 6144), ('args', '-test async-gated')], 'result': {'workingset': 36474880.0, 'privatemem': 39116800.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.7755546875}}
-{'var': [('concurrency', 6144), ('args', '-test ums-gated')], 'result': {'workingset': 267964416.0, 'privatemem': 1090080768.0, 'nonpaged': 1509464.0, 'virtualmem': 26549927936.0, 'time': 19.5823140625}}
-{'var': [('concurrency', 6144), ('args', '-test ums-gated')], 'result': {'workingset': 268500992.0, 'privatemem': 1091354624.0, 'nonpaged': 1509816.0, 'virtualmem': 26554122240.0, 'time': 19.5744}}
-{'var': [('concurrency', 6144), ('args', '-test ums-gated')], 'result': {'workingset': 269398016.0, 'privatemem': 1090744320.0, 'nonpaged': 1509576.0, 'virtualmem': 26549927936.0, 'time': 19.7508015625}}
-{'var': [('concurrency', 6144), ('args', '-test ums-gated')], 'result': {'workingset': 269123584.0, 'privatemem': 1093181440.0, 'nonpaged': 1514664.0, 'virtualmem': 26642202624.0, 'time': 19.75071875}}
-{'var': [('concurrency', 6144), ('args', '-test ums-gated')], 'result': {'workingset': 269733888.0, 'privatemem': 1091674112.0, 'nonpaged': 1511384.0, 'virtualmem': 26583482368.0, 'time': 19.5216640625}}
-{'var': [('concurrency', 7168), ('args', '-test async-gated')], 'result': {'workingset': 36532224.0, 'privatemem': 39153664.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 13.9015625}}
-{'var': [('concurrency', 7168), ('args', '-test async-gated')], 'result': {'workingset': 36720640.0, 'privatemem': 39264256.0, 'nonpaged': 25864.0, 'virtualmem': 564969472.0, 'time': 13.90245}}
-{'var': [('concurrency', 7168), ('args', '-test async-gated')], 'result': {'workingset': 31596544.0, 'privatemem': 34111488.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.8932265625}}
-{'var': [('concurrency', 7168), ('args', '-test async-gated')], 'result': {'workingset': 31571968.0, 'privatemem': 34131968.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 13.9260484375}}
-{'var': [('concurrency', 7168), ('args', '-test async-gated')], 'result': {'workingset': 31571968.0, 'privatemem': 34066432.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 13.954315625}}
-{'var': [('concurrency', 7168), ('args', '-test ums-gated')], 'result': {'workingset': 315875328.0, 'privatemem': 1271836672.0, 'nonpaged': 1755264.0, 'virtualmem': 30861475840.0, 'time': 19.696196875}}
-{'var': [('concurrency', 7168), ('args', '-test ums-gated')], 'result': {'workingset': 312127488.0, 'privatemem': 1268944896.0, 'nonpaged': 1755944.0, 'virtualmem': 30869929984.0, 'time': 19.7884125}}
-{'var': [('concurrency', 7168), ('args', '-test ums-gated')], 'result': {'workingset': 313524224.0, 'privatemem': 1270001664.0, 'nonpaged': 1755344.0, 'virtualmem': 30861475840.0, 'time': 19.5355734375}}
-{'var': [('concurrency', 7168), ('args', '-test ums-gated')], 'result': {'workingset': 313815040.0, 'privatemem': 1271222272.0, 'nonpaged': 1756064.0, 'virtualmem': 30874058752.0, 'time': 19.61661875}}
-{'var': [('concurrency', 7168), ('args', '-test ums-gated')], 'result': {'workingset': 314990592.0, 'privatemem': 1271472128.0, 'nonpaged': 1755624.0, 'virtualmem': 30865735680.0, 'time': 20.050821875}}
-{'var': [('concurrency', 8192), ('args', '-test async-gated')], 'result': {'workingset': 38105088.0, 'privatemem': 40636416.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 14.0955625}}
-{'var': [('concurrency', 8192), ('args', '-test async-gated')], 'result': {'workingset': 37982208.0, 'privatemem': 40583168.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 14.040196875}}
-{'var': [('concurrency', 8192), ('args', '-test async-gated')], 'result': {'workingset': 38129664.0, 'privatemem': 40685568.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.042221875}}
-{'var': [('concurrency', 8192), ('args', '-test async-gated')], 'result': {'workingset': 38043648.0, 'privatemem': 40665088.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 14.1191921875}}
-{'var': [('concurrency', 8192), ('args', '-test async-gated')], 'result': {'workingset': 37933056.0, 'privatemem': 40538112.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.0314734375}}
-{'var': [('concurrency', 8192), ('args', '-test ums-gated')], 'result': {'workingset': 356925440.0, 'privatemem': 1448673280.0, 'nonpaged': 2001264.0, 'virtualmem': 35157557248.0, 'time': 20.15775}}
-{'var': [('concurrency', 8192), ('args', '-test ums-gated')], 'result': {'workingset': 354324480.0, 'privatemem': 1447530496.0, 'nonpaged': 2001984.0, 'virtualmem': 35170140160.0, 'time': 19.9642671875}}
-{'var': [('concurrency', 8192), ('args', '-test ums-gated')], 'result': {'workingset': 355999744.0, 'privatemem': 1446727680.0, 'nonpaged': 2001984.0, 'virtualmem': 35170140160.0, 'time': 19.937840625}}
-{'var': [('concurrency', 8192), ('args', '-test ums-gated')], 'result': {'workingset': 355708928.0, 'privatemem': 1447718912.0, 'nonpaged': 2001984.0, 'virtualmem': 35170140160.0, 'time': 21.3836453125}}
-{'var': [('concurrency', 8192), ('args', '-test ums-gated')], 'result': {'workingset': 355086336.0, 'privatemem': 1448427520.0, 'nonpaged': 2001984.0, 'virtualmem': 35170140160.0, 'time': 20.5806625}}
-{'var': [('concurrency', 10240), ('args', '-test async-gated')], 'result': {'workingset': 40574976.0, 'privatemem': 42999808.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.212690625}}
-{'var': [('concurrency', 10240), ('args', '-test async-gated')], 'result': {'workingset': 40849408.0, 'privatemem': 43442176.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 14.26136875}}
-{'var': [('concurrency', 10240), ('args', '-test async-gated')], 'result': {'workingset': 40611840.0, 'privatemem': 43065344.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.2927234375}}
-{'var': [('concurrency', 10240), ('args', '-test async-gated')], 'result': {'workingset': 35049472.0, 'privatemem': 37515264.0, 'nonpaged': 25768.0, 'virtualmem': 564969472.0, 'time': 14.2932515625}}
-{'var': [('concurrency', 10240), ('args', '-test async-gated')], 'result': {'workingset': 40902656.0, 'privatemem': 43450368.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 14.29265625}}
-{'var': [('concurrency', 10240), ('args', '-test ums-gated')], 'result': {'workingset': 437157888.0, 'privatemem': 1799569408.0, 'nonpaged': 2493704.0, 'virtualmem': 43789238272.0, 'time': 22.39598125}}
-{'var': [('concurrency', 10240), ('args', '-test ums-gated')], 'result': {'workingset': 438943744.0, 'privatemem': 1800122368.0, 'nonpaged': 2493624.0, 'virtualmem': 43789238272.0, 'time': 22.3933875}}
-{'var': [('concurrency', 10240), ('args', '-test ums-gated')], 'result': {'workingset': 454443008.0, 'privatemem': 1816186880.0, 'nonpaged': 2493264.0, 'virtualmem': 43797430272.0, 'time': 22.156965625}}
-{'var': [('concurrency', 10240), ('args', '-test ums-gated')], 'result': {'workingset': 441925632.0, 'privatemem': 1810481152.0, 'nonpaged': 2503344.0, 'virtualmem': 43973591040.0, 'time': 22.4793375}}
-{'var': [('concurrency', 10240), ('args', '-test ums-gated')], 'result': {'workingset': 437071872.0, 'privatemem': 1798299648.0, 'nonpaged': 2493624.0, 'virtualmem': 43789238272.0, 'time': 22.3045375}}
-{'var': [('concurrency', 12288), ('args', '-test async-gated')], 'result': {'workingset': 43515904.0, 'privatemem': 45961216.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.59280625}}
-{'var': [('concurrency', 12288), ('args', '-test async-gated')], 'result': {'workingset': 43683840.0, 'privatemem': 46112768.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 14.596046875}}
-{'var': [('concurrency', 12288), ('args', '-test async-gated')], 'result': {'workingset': 43720704.0, 'privatemem': 46157824.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.590865625}}
-{'var': [('concurrency', 12288), ('args', '-test async-gated')], 'result': {'workingset': 43683840.0, 'privatemem': 46100480.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 14.609971875}}
-{'var': [('concurrency', 12288), ('args', '-test async-gated')], 'result': {'workingset': 43429888.0, 'privatemem': 45940736.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 14.6273390625}}
-{'var': [('concurrency', 12288), ('args', '-test ums-gated')], 'result': {'workingset': 516640768.0, 'privatemem': 2149273600.0, 'nonpaged': 2984784.0, 'virtualmem': 52399816704.0, 'time': 26.321934375}}
-{'var': [('concurrency', 12288), ('args', '-test ums-gated')], 'result': {'workingset': 517148672.0, 'privatemem': 2152136704.0, 'nonpaged': 2986944.0, 'virtualmem': 52437565440.0, 'time': 26.177103125}}
-{'var': [('concurrency', 12288), ('args', '-test ums-gated')], 'result': {'workingset': 523063296.0, 'privatemem': 2156064768.0, 'nonpaged': 2985504.0, 'virtualmem': 52412399616.0, 'time': 26.05946875}}
-{'var': [('concurrency', 12288), ('args', '-test ums-gated')], 'result': {'workingset': 518561792.0, 'privatemem': 2162417664.0, 'nonpaged': 2994864.0, 'virtualmem': 52575977472.0, 'time': 28.18605}}
-{'var': [('concurrency', 12288), ('args', '-test ums-gated')], 'result': {'workingset': 525058048.0, 'privatemem': 2157924352.0, 'nonpaged': 2985264.0, 'virtualmem': 52408205312.0, 'time': 26.42195625}}
-{'var': [('concurrency', 14336), ('args', '-test async-gated')], 'result': {'workingset': 40148992.0, 'privatemem': 42582016.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 15.0295875}}
-{'var': [('concurrency', 14336), ('args', '-test async-gated')], 'result': {'workingset': 40206336.0, 'privatemem': 42512384.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.990478125}}
-{'var': [('concurrency', 14336), ('args', '-test async-gated')], 'result': {'workingset': 45486080.0, 'privatemem': 47845376.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 14.9103515625}}
-{'var': [('concurrency', 14336), ('args', '-test async-gated')], 'result': {'workingset': 44941312.0, 'privatemem': 47333376.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 14.9739078125}}
-{'var': [('concurrency', 14336), ('args', '-test async-gated')], 'result': {'workingset': 46559232.0, 'privatemem': 49074176.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 14.99918125}}
-{'var': [('concurrency', 14336), ('args', '-test ums-gated')], 'result': {'workingset': 601858048.0, 'privatemem': 2509008896.0, 'nonpaged': 3485304.0, 'virtualmem': 61158797312.0, 'time': 28.8111328125}}
-{'var': [('concurrency', 14336), ('args', '-test ums-gated')], 'result': {'workingset': 604540928.0, 'privatemem': 2506592256.0, 'nonpaged': 3477504.0, 'virtualmem': 61023174656.0, 'time': 28.554359375}}
-{'var': [('concurrency', 14336), ('args', '-test ums-gated')], 'result': {'workingset': 607997952.0, 'privatemem': 2508111872.0, 'nonpaged': 3477024.0, 'virtualmem': 61014786048.0, 'time': 29.05818125}}
-{'var': [('concurrency', 14336), ('args', '-test ums-gated')], 'result': {'workingset': 606982144.0, 'privatemem': 2510180352.0, 'nonpaged': 3477024.0, 'virtualmem': 61014786048.0, 'time': 29.6098046875}}
-{'var': [('concurrency', 14336), ('args', '-test ums-gated')], 'result': {'workingset': 603512832.0, 'privatemem': 2506928128.0, 'nonpaged': 3478584.0, 'virtualmem': 61041356800.0, 'time': 30.173225}}
-{'var': [('concurrency', 16384), ('args', '-test async-gated')], 'result': {'workingset': 42070016.0, 'privatemem': 44314624.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 16.2156484375}}
-{'var': [('concurrency', 16384), ('args', '-test async-gated')], 'result': {'workingset': 42672128.0, 'privatemem': 44982272.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 16.160125}}
-{'var': [('concurrency', 16384), ('args', '-test async-gated')], 'result': {'workingset': 42905600.0, 'privatemem': 45236224.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.2525890625}}
-{'var': [('concurrency', 16384), ('args', '-test async-gated')], 'result': {'workingset': 43896832.0, 'privatemem': 46153728.0, 'nonpaged': 25384.0, 'virtualmem': 556580864.0, 'time': 15.3214}}
-{'var': [('concurrency', 16384), ('args', '-test async-gated')], 'result': {'workingset': 42004480.0, 'privatemem': 44298240.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.23181875}}
-{'var': [('concurrency', 16384), ('args', '-test ums-gated')], 'result': {'workingset': 689721344.0, 'privatemem': 2865324032.0, 'nonpaged': 3968784.0, 'virtualmem': 69622706176.0, 'time': 31.0380265625}}
-{'var': [('concurrency', 16384), ('args', '-test ums-gated')], 'result': {'workingset': 701034496.0, 'privatemem': 2882179072.0, 'nonpaged': 3982704.0, 'virtualmem': 69865975808.0, 'time': 31.334315625}}
-{'var': [('concurrency', 16384), ('args', '-test ums-gated')], 'result': {'workingset': 685584384.0, 'privatemem': 2856980480.0, 'nonpaged': 3968664.0, 'virtualmem': 69621301248.0, 'time': 33.5692328125}}
-{'var': [('concurrency', 16384), ('args', '-test ums-gated')], 'result': {'workingset': 697085952.0, 'privatemem': 2868523008.0, 'nonpaged': 3968784.0, 'virtualmem': 69637881856.0, 'time': 30.9457953125}}
-{'var': [('concurrency', 16384), ('args', '-test ums-gated')], 'result': {'workingset': 690245632.0, 'privatemem': 2862125056.0, 'nonpaged': 3970344.0, 'virtualmem': 69650661376.0, 'time': 33.4727609375}}
-{'var': [('concurrency', 20480), ('args', '-test async-gated')], 'result': {'workingset': 55869440.0, 'privatemem': 58114048.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.7086890625}}
-{'var': [('concurrency', 20480), ('args', '-test async-gated')], 'result': {'workingset': 56160256.0, 'privatemem': 58540032.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 15.7096078125}}
-{'var': [('concurrency', 20480), ('args', '-test async-gated')], 'result': {'workingset': 49836032.0, 'privatemem': 52043776.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 16.2957859375}}
-{'var': [('concurrency', 20480), ('args', '-test async-gated')], 'result': {'workingset': 55492608.0, 'privatemem': 57851904.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 16.5145359375}}
-{'var': [('concurrency', 20480), ('args', '-test async-gated')], 'result': {'workingset': 47857664.0, 'privatemem': 50147328.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 16.8469078125}}
-{'var': [('concurrency', 20480), ('args', '-test ums-gated')], 'result': {'workingset': 862195712.0, 'privatemem': 3575685120.0, 'nonpaged': 4952784.0, 'virtualmem': 86889738240.0, 'time': 40.3810609375}}
-{'var': [('concurrency', 20480), ('args', '-test ums-gated')], 'result': {'workingset': 865746944.0, 'privatemem': 3578298368.0, 'nonpaged': 4952304.0, 'virtualmem': 86881349632.0, 'time': 36.3784328125}}
-{'var': [('concurrency', 20480), ('args', '-test ums-gated')], 'result': {'workingset': 869675008.0, 'privatemem': 3581808640.0, 'nonpaged': 4952544.0, 'virtualmem': 86885543936.0, 'time': 38.871209375}}
-{'var': [('concurrency', 20480), ('args', '-test ums-gated')], 'result': {'workingset': 860774400.0, 'privatemem': 3582889984.0, 'nonpaged': 4966464.0, 'virtualmem': 87128813568.0, 'time': 43.21194375}}
-{'var': [('concurrency', 20480), ('args', '-test ums-gated')], 'result': {'workingset': 855191552.0, 'privatemem': 3567927296.0, 'nonpaged': 4952904.0, 'virtualmem': 86877351936.0, 'time': 38.48225625}}
-{'var': [('concurrency', 24576), ('args', '-test async-gated')], 'result': {'workingset': 57565184.0, 'privatemem': 59461632.0, 'nonpaged': 25880.0, 'virtualmem': 564969472.0, 'time': 16.1426484375}}
-{'var': [('concurrency', 24576), ('args', '-test async-gated')], 'result': {'workingset': 54370304.0, 'privatemem': 56492032.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 16.101009375}}
-{'var': [('concurrency', 24576), ('args', '-test async-gated')], 'result': {'workingset': 62488576.0, 'privatemem': 64598016.0, 'nonpaged': 25400.0, 'virtualmem': 556580864.0, 'time': 15.84624375}}
-{'var': [('concurrency', 24576), ('args', '-test async-gated')], 'result': {'workingset': 57757696.0, 'privatemem': 59613184.0, 'nonpaged': 25640.0, 'virtualmem': 569163776.0, 'time': 15.9433421875}}
-{'var': [('concurrency', 24576), ('args', '-test async-gated')], 'result': {'workingset': 67629056.0, 'privatemem': 69304320.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 16.0379890625}}
-{'var': [('concurrency', 24576), ('args', '-test ums-gated')], 'result': {'workingset': 1028907008.0, 'privatemem': 4283650048.0, 'nonpaged': 5936184.0, 'virtualmem': 104104235008.0, 'time': 53.8624046875}}
-{'var': [('concurrency', 24576), ('args', '-test ums-gated')], 'result': {'workingset': 1037115392.0, 'privatemem': 4290715648.0, 'nonpaged': 5936304.0, 'virtualmem': 104120815616.0, 'time': 53.877346875}}
-{'var': [('concurrency', 24576), ('args', '-test ums-gated')], 'result': {'workingset': 1037705216.0, 'privatemem': 4291125248.0, 'nonpaged': 5935824.0, 'virtualmem': 104112427008.0, 'time': 54.8691671875}}
-{'var': [('concurrency', 24576), ('args', '-test ums-gated')], 'result': {'workingset': 1043337216.0, 'privatemem': 4301135872.0, 'nonpaged': 5935824.0, 'virtualmem': 104111026176.0, 'time': 46.317490625}}
-{'var': [('concurrency', 24576), ('args', '-test ums-gated')], 'result': {'workingset': 1028558848.0, 'privatemem': 4282368000.0, 'nonpaged': 5936424.0, 'virtualmem': 104108429312.0, 'time': 53.502359375}}
-{'var': [('concurrency', 28672), ('args', '-test async-gated')], 'result': {'workingset': 73793536.0, 'privatemem': 75640832.0, 'nonpaged': 26600.0, 'virtualmem': 577552384.0, 'time': 16.6419671875}}
-{'var': [('concurrency', 28672), ('args', '-test async-gated')], 'result': {'workingset': 74006528.0, 'privatemem': 75755520.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 16.59216875}}
-{'var': [('concurrency', 28672), ('args', '-test async-gated')], 'result': {'workingset': 74121216.0, 'privatemem': 75894784.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 16.6399796875}}
-{'var': [('concurrency', 28672), ('args', '-test async-gated')], 'result': {'workingset': 75317248.0, 'privatemem': 77017088.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 16.6508421875}}
-{'var': [('concurrency', 28672), ('args', '-test async-gated')], 'result': {'workingset': 73236480.0, 'privatemem': 75030528.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 16.776903125}}
-{'var': [('concurrency', 28672), ('args', '-test ums-gated')], 'result': {'workingset': 1193185280.0, 'privatemem': 4992319488.0, 'nonpaged': 6919104.0, 'virtualmem': 121308942336.0, 'time': 59.2310265625}}
-{'var': [('concurrency', 28672), ('args', '-test ums-gated')], 'result': {'workingset': 1186713600.0, 'privatemem': 4982370304.0, 'nonpaged': 6919584.0, 'virtualmem': 121317330944.0, 'time': 62.308228125}}
-{'var': [('concurrency', 28672), ('args', '-test ums-gated')], 'result': {'workingset': 1204101120.0, 'privatemem': 5004546048.0, 'nonpaged': 6919704.0, 'virtualmem': 121333911552.0, 'time': 59.4607328125}}
-{'var': [('concurrency', 28672), ('args', '-test ums-gated')], 'result': {'workingset': 1186025472.0, 'privatemem': 4979195904.0, 'nonpaged': 6919824.0, 'virtualmem': 121321525248.0, 'time': 68.2966625}}
-{'var': [('concurrency', 28672), ('args', '-test ums-gated')], 'result': {'workingset': 1190494208.0, 'privatemem': 4990369792.0, 'nonpaged': 6919104.0, 'virtualmem': 121308942336.0, 'time': 65.9037140625}}
-{'var': [('concurrency', 32768), ('args', '-test async-gated')], 'result': {'workingset': 69914624.0, 'privatemem': 71544832.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 17.5821546875}}
-{'var': [('concurrency', 32768), ('args', '-test async-gated')], 'result': {'workingset': 82804736.0, 'privatemem': 84516864.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 17.4147265625}}
-{'var': [('concurrency', 32768), ('args', '-test async-gated')], 'result': {'workingset': 80211968.0, 'privatemem': 81952768.0, 'nonpaged': 26120.0, 'virtualmem': 569163776.0, 'time': 17.2119453125}}
-{'var': [('concurrency', 32768), ('args', '-test async-gated')], 'result': {'workingset': 72941568.0, 'privatemem': 74739712.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 17.0826671875}}
-{'var': [('concurrency', 32768), ('args', '-test async-gated')], 'result': {'workingset': 57122816.0, 'privatemem': 59056128.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 15.8496921875}}
-{'var': [('concurrency', 32768), ('args', '-test ums-gated')], 'result': {'workingset': 1363570688.0, 'privatemem': 5696401408.0, 'nonpaged': 7902864.0, 'virtualmem': 138542813184.0, 'time': 77.319371875}}
-{'var': [('concurrency', 32768), ('args', '-test ums-gated')], 'result': {'workingset': 1359228928.0, 'privatemem': 5693067264.0, 'nonpaged': 7902504.0, 'virtualmem': 138522038272.0, 'time': 75.611196875}}
-{'var': [('concurrency', 32768), ('args', '-test ums-gated')], 'result': {'workingset': 1382010880.0, 'privatemem': 5722746880.0, 'nonpaged': 7903224.0, 'virtualmem': 138563588096.0, 'time': 75.43135625}}
-{'var': [('concurrency', 32768), ('args', '-test ums-gated')], 'result': {'workingset': 1366474752.0, 'privatemem': 5719846912.0, 'nonpaged': 7935264.0, 'virtualmem': 139092529152.0, 'time': 77.2984921875}}
-{'var': [('concurrency', 32768), ('args', '-test ums-gated')], 'result': {'workingset': 1380454400.0, 'privatemem': 5713457152.0, 'nonpaged': 7902744.0, 'virtualmem': 138555199488.0, 'time': 72.9519984375}}
-{'var': [('concurrency', 40960), ('args', '-test async-gated')], 'result': {'workingset': 82169856.0, 'privatemem': 84209664.0, 'nonpaged': 25768.0, 'virtualmem': 564969472.0, 'time': 18.2689421875}}
-{'var': [('concurrency', 40960), ('args', '-test async-gated')], 'result': {'workingset': 86765568.0, 'privatemem': 88666112.0, 'nonpaged': 25768.0, 'virtualmem': 564969472.0, 'time': 17.703690625}}
-{'var': [('concurrency', 40960), ('args', '-test async-gated')], 'result': {'workingset': 89808896.0, 'privatemem': 91951104.0, 'nonpaged': 25744.0, 'virtualmem': 562872320.0, 'time': 17.698275}}
-{'var': [('concurrency', 40960), ('args', '-test async-gated')], 'result': {'workingset': 83464192.0, 'privatemem': 84893696.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 17.8156953125}}
-{'var': [('concurrency', 40960), ('args', '-test async-gated')], 'result': {'workingset': 89182208.0, 'privatemem': 91365376.0, 'nonpaged': 25888.0, 'virtualmem': 567066624.0, 'time': 17.637353125}}
-{'var': [('concurrency', 40960), ('args', '-test ums-gated')], 'result': {'workingset': 1688113152.0, 'privatemem': 7102902272.0, 'nonpaged': 9870744.0, 'virtualmem': 172987879424.0, 'time': 109.5945375}}
-{'var': [('concurrency', 40960), ('args', '-test ums-gated')], 'result': {'workingset': 1681657856.0, 'privatemem': 7097241600.0, 'nonpaged': 9870264.0, 'virtualmem': 172979490816.0, 'time': 112.0583734375}}
-{'var': [('concurrency', 40960), ('args', '-test ums-gated')], 'result': {'workingset': 1701982208.0, 'privatemem': 7125585920.0, 'nonpaged': 9876984.0, 'virtualmem': 173109383168.0, 'time': 108.868828125}}
-{'var': [('concurrency', 40960), ('args', '-test ums-gated')], 'result': {'workingset': 1696256000.0, 'privatemem': 7110664192.0, 'nonpaged': 9870384.0, 'virtualmem': 172979556352.0, 'time': 100.987990625}}
-{'var': [('concurrency', 40960), ('args', '-test ums-gated')], 'result': {'workingset': 1681092608.0, 'privatemem': 7102992384.0, 'nonpaged': 9881424.0, 'virtualmem': 173160042496.0, 'time': 103.1147171875}}
-{'var': [('concurrency', 49152), ('args', '-test async-gated')], 'result': {'workingset': 88752128.0, 'privatemem': 90644480.0, 'nonpaged': 26368.0, 'virtualmem': 575455232.0, 'time': 19.194690625}}
-{'var': [('concurrency', 49152), ('args', '-test async-gated')], 'result': {'workingset': 91697152.0, 'privatemem': 93396992.0, 'nonpaged': 26240.0, 'virtualmem': 571260928.0, 'time': 19.1130046875}}
-{'var': [('concurrency', 49152), ('args', '-test async-gated')], 'result': {'workingset': 70430720.0, 'privatemem': 72364032.0, 'nonpaged': 26240.0, 'virtualmem': 571260928.0, 'time': 17.7690265625}}
-{'var': [('concurrency', 49152), ('args', '-test async-gated')], 'result': {'workingset': 85979136.0, 'privatemem': 87822336.0, 'nonpaged': 26120.0, 'virtualmem': 569163776.0, 'time': 19.166028125}}
-{'var': [('concurrency', 49152), ('args', '-test async-gated')], 'result': {'workingset': 87728128.0, 'privatemem': 89387008.0, 'nonpaged': 26000.0, 'virtualmem': 567066624.0, 'time': 19.178809375}}
-{'var': [('concurrency', 49152), ('args', '-test ums-gated')], 'result': {'workingset': 2026475520.0, 'privatemem': 8518123520.0, 'nonpaged': 11837784.0, 'virtualmem': 207459684352.0, 'time': 140.7092328125}}
-{'var': [('concurrency', 49152), ('args', '-test ums-gated')], 'result': {'workingset': 2036518912.0, 'privatemem': 8542306304.0, 'nonpaged': 11840544.0, 'virtualmem': 207512752128.0, 'time': 147.6286140625}}
-{'var': [('concurrency', 49152), ('args', '-test ums-gated')], 'result': {'workingset': 2027098112.0, 'privatemem': 8528797696.0, 'nonpaged': 11837424.0, 'virtualmem': 207455424512.0, 'time': 157.0997796875}}
-{'var': [('concurrency', 49152), ('args', '-test ums-gated')], 'result': {'workingset': 2029830144.0, 'privatemem': 8523378688.0, 'nonpaged': 11838144.0, 'virtualmem': 207470809088.0, 'time': 149.35805}}
-{'var': [('concurrency', 49152), ('args', '-test ums-gated')], 'result': {'workingset': 2018607104.0, 'privatemem': 8512258048.0, 'nonpaged': 11837544.0, 'virtualmem': 207443038208.0, 'time': 156.43776875}}
-{'var': [('concurrency', 57344), ('args', '-test async-gated')], 'result': {'workingset': 110104576.0, 'privatemem': 112001024.0, 'nonpaged': 25888.0, 'virtualmem': 567066624.0, 'time': 19.1979890625}}
-{'var': [('concurrency', 57344), ('args', '-test async-gated')], 'result': {'workingset': 117399552.0, 'privatemem': 118956032.0, 'nonpaged': 26368.0, 'virtualmem': 575455232.0, 'time': 19.72220625}}
-{'var': [('concurrency', 57344), ('args', '-test async-gated')], 'result': {'workingset': 102563840.0, 'privatemem': 104300544.0, 'nonpaged': 26000.0, 'virtualmem': 567066624.0, 'time': 19.6945328125}}
-{'var': [('concurrency', 57344), ('args', '-test async-gated')], 'result': {'workingset': 105697280.0, 'privatemem': 107380736.0, 'nonpaged': 26368.0, 'virtualmem': 575455232.0, 'time': 19.43420625}}
-{'var': [('concurrency', 57344), ('args', '-test async-gated')], 'result': {'workingset': 106532864.0, 'privatemem': 108306432.0, 'nonpaged': 26000.0, 'virtualmem': 567066624.0, 'time': 19.3152046875}}
-{'var': [('concurrency', 57344), ('args', '-test ums-gated')], 'result': {'workingset': 2363232256.0, 'privatemem': 9939460096.0, 'nonpaged': 13804464.0, 'virtualmem': 241888612352.0, 'time': 184.053434375}}
-{'var': [('concurrency', 57344), ('args', '-test ums-gated')], 'result': {'workingset': 2365878272.0, 'privatemem': 9953259520.0, 'nonpaged': 13804344.0, 'virtualmem': 241900998656.0, 'time': 192.2616015625}}
-{'var': [('concurrency', 57344), ('args', '-test ums-gated')], 'result': {'workingset': 2358566912.0, 'privatemem': 9937661952.0, 'nonpaged': 13806264.0, 'virtualmem': 241918038016.0, 'time': 189.8282234375}}
-{'var': [('concurrency', 57344), ('args', '-test ums-gated')], 'result': {'workingset': 2342895616.0, 'privatemem': 9925849088.0, 'nonpaged': 13804224.0, 'virtualmem': 241884418048.0, 'time': 182.3936078125}}
-{'var': [('concurrency', 57344), ('args', '-test ums-gated')], 'result': {'workingset': 2347986944.0, 'privatemem': 9933496320.0, 'nonpaged': 13804824.0, 'virtualmem': 241892872192.0, 'time': 186.212921875}}
-{'var': [('concurrency', 65536), ('args', '-test async-gated')], 'result': {'workingset': 130637824.0, 'privatemem': 132468736.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 20.00561875}}
-{'var': [('concurrency', 65536), ('args', '-test async-gated')], 'result': {'workingset': 115064832.0, 'privatemem': 116396032.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 20.3946609375}}
-{'var': [('concurrency', 65536), ('args', '-test async-gated')], 'result': {'workingset': 72556544.0, 'privatemem': 74584064.0, 'nonpaged': 26720.0, 'virtualmem': 579649536.0, 'time': 17.1177015625}}
-{'var': [('concurrency', 65536), ('args', '-test async-gated')], 'result': {'workingset': 112943104.0, 'privatemem': 114147328.0, 'nonpaged': 26120.0, 'virtualmem': 569163776.0, 'time': 20.2790203125}}
-{'var': [('concurrency', 65536), ('args', '-test async-gated')], 'result': {'workingset': 129822720.0, 'privatemem': 131096576.0, 'nonpaged': 26128.0, 'virtualmem': 571260928.0, 'time': 20.95596875}}
-{'var': [('concurrency', 65536), ('args', '-test ums-gated')], 'result': {'workingset': 2690383872.0, 'privatemem': 11338743808.0, 'nonpaged': 15772944.0, 'virtualmem': 276378443776.0, 'time': 247.372325}}
-{'var': [('concurrency', 65536), ('args', '-test ums-gated')], 'result': {'workingset': 2684055552.0, 'privatemem': 11335376896.0, 'nonpaged': 15771504.0, 'virtualmem': 276344889344.0, 'time': 240.684809375}}
-{'var': [('concurrency', 65536), ('args', '-test ums-gated')], 'result': {'workingset': 2701897728.0, 'privatemem': 11360075776.0, 'nonpaged': 15772344.0, 'virtualmem': 276374052864.0, 'time': 235.606675}}
-{'var': [('concurrency', 65536), ('args', '-test ums-gated')], 'result': {'workingset': 2961162240.0, 'privatemem': 11630002176.0, 'nonpaged': 15773904.0, 'virtualmem': 276618567680.0, 'time': 277.3269875}}
-{'var': [('concurrency', 65536), ('args', '-test ums-gated')], 'result': {'workingset': 2682052608.0, 'privatemem': 11340992512.0, 'nonpaged': 15776304.0, 'virtualmem': 276428775424.0, 'time': 244.7224234375}}
-{'var': [('concurrency', 81920), ('args', '-test async-gated')], 'result': {'workingset': 138235904.0, 'privatemem': 139558912.0, 'nonpaged': 25648.0, 'virtualmem': 562872320.0, 'time': 21.6494125}}
-{'var': [('concurrency', 81920), ('args', '-test async-gated')], 'result': {'workingset': 89427968.0, 'privatemem': 90931200.0, 'nonpaged': 25528.0, 'virtualmem': 560775168.0, 'time': 17.4579984375}}
-{'var': [('concurrency', 81920), ('args', '-test async-gated')], 'result': {'workingset': 130588672.0, 'privatemem': 131649536.0, 'nonpaged': 26008.0, 'virtualmem': 569163776.0, 'time': 21.278078125}}
-{'var': [('concurrency', 81920), ('args', '-test async-gated')], 'result': {'workingset': 135176192.0, 'privatemem': 136491008.0, 'nonpaged': 25640.0, 'virtualmem': 560775168.0, 'time': 21.5131796875}}
-{'var': [('concurrency', 81920), ('args', '-test async-gated')], 'result': {'workingset': 127688704.0, 'privatemem': 129499136.0, 'nonpaged': 26728.0, 'virtualmem': 581746688.0, 'time': 19.93003125}}
-{'var': [('concurrency', 81920), ('args', '-test ums-gated')], 'result': {'workingset': 3732779008.0, 'privatemem': 14553665536.0, 'nonpaged': 19709064.0, 'virtualmem': 345628565504.0, 'time': 353.601725}}
-{'var': [('concurrency', 81920), ('args', '-test ums-gated')], 'result': {'workingset': 3335438336.0, 'privatemem': 14157639680.0, 'nonpaged': 19704744.0, 'virtualmem': 345205465088.0, 'time': 356.084828125}}
-{'var': [('concurrency', 81920), ('args', '-test ums-gated')], 'result': {'workingset': 3416276992.0, 'privatemem': 14252584960.0, 'nonpaged': 19705824.0, 'virtualmem': 345296756736.0, 'time': 364.665215625}}
-{'var': [('concurrency', 81920), ('args', '-test ums-gated')], 'result': {'workingset': 3340185600.0, 'privatemem': 14166282240.0, 'nonpaged': 19705344.0, 'virtualmem': 345218048000.0, 'time': 330.89671875}}
-{'var': [('concurrency', 81920), ('args', '-test ums-gated')], 'result': {'workingset': 3341864960.0, 'privatemem': 14169149440.0, 'nonpaged': 19707504.0, 'virtualmem': 345255796736.0, 'time': 352.603725}}
-{'var': [('concurrency', 98304), ('args', '-test async-gated')], 'result': {'workingset': 119099392.0, 'privatemem': 120713216.0, 'nonpaged': 26368.0, 'virtualmem': 575455232.0, 'time': 21.3428921875}}
-{'var': [('concurrency', 98304), ('args', '-test async-gated')], 'result': {'workingset': 139829248.0, 'privatemem': 141701120.0, 'nonpaged': 27088.0, 'virtualmem': 588038144.0, 'time': 23.1737}}
-{'var': [('concurrency', 98304), ('args', '-test async-gated')], 'result': {'workingset': 151707648.0, 'privatemem': 153325568.0, 'nonpaged': 26488.0, 'virtualmem': 577552384.0, 'time': 22.1648703125}}
-{'var': [('concurrency', 98304), ('args', '-test async-gated')], 'result': {'workingset': 139603968.0, 'privatemem': 141705216.0, 'nonpaged': 26720.0, 'virtualmem': 579649536.0, 'time': 24.3582796875}}
-{'var': [('concurrency', 98304), ('args', '-test async-gated')], 'result': {'workingset': 126025728.0, 'privatemem': 128827392.0, 'nonpaged': 27568.0, 'virtualmem': 596426752.0, 'time': 21.027715625}}
-{'var': [('concurrency', 98304), ('args', '-test ums-gated')], 'result': {'workingset': 3993194496.0, 'privatemem': 16967299072.0, 'nonpaged': 23638824.0, 'virtualmem': 414117388288.0, 'time': 480.1536890625}}
-{'var': [('concurrency', 98304), ('args', '-test ums-gated')], 'result': {'workingset': 3999387648.0, 'privatemem': 16987381760.0, 'nonpaged': 23638824.0, 'virtualmem': 414117388288.0, 'time': 516.035265625}}
-{'var': [('concurrency', 98304), ('args', '-test ums-gated')], 'result': {'workingset': 4001804288.0, 'privatemem': 17038946304.0, 'nonpaged': 23718144.0, 'virtualmem': 415501574144.0, 'time': 483.755525}}
-{'var': [('concurrency', 98304), ('args', '-test ums-gated')], 'result': {'workingset': 4013903872.0, 'privatemem': 17002704896.0, 'nonpaged': 23639544.0, 'virtualmem': 414158938112.0, 'time': 503.345384375}}
-{'var': [('concurrency', 98304), ('args', '-test ums-gated')], 'result': {'workingset': 4039008256.0, 'privatemem': 17174925312.0, 'nonpaged': 23918784.0, 'virtualmem': 419020464128.0, 'time': 505.355275}}
-{'var': [('concurrency', 114688), ('args', '-test async-gated')], 'result': {'workingset': 164077568.0, 'privatemem': 165376000.0, 'nonpaged': 25648.0, 'virtualmem': 562872320.0, 'time': 23.6242703125}}
-{'var': [('concurrency', 114688), ('args', '-test async-gated')], 'result': {'workingset': 136712192.0, 'privatemem': 138002432.0, 'nonpaged': 26608.0, 'virtualmem': 579649536.0, 'time': 23.1367515625}}
-{'var': [('concurrency', 114688), ('args', '-test async-gated')], 'result': {'workingset': 118976512.0, 'privatemem': 120524800.0, 'nonpaged': 26720.0, 'virtualmem': 579649536.0, 'time': 23.2383796875}}
-{'var': [('concurrency', 114688), ('args', '-test async-gated')], 'result': {'workingset': 127246336.0, 'privatemem': 128696320.0, 'nonpaged': 26608.0, 'virtualmem': 579649536.0, 'time': 23.4868671875}}
-{'var': [('concurrency', 114688), ('args', '-test async-gated')], 'result': {'workingset': 201854976.0, 'privatemem': 202383360.0, 'nonpaged': 26128.0, 'virtualmem': 571260928.0, 'time': 26.734434375}}
-{'var': [('concurrency', 114688), ('args', '-test ums-gated')], 'result': {'workingset': 4636082176.0, 'privatemem': 19810603008.0, 'nonpaged': 27575064.0, 'virtualmem': 483073843200.0, 'time': 602.0996375}}
-{'var': [('concurrency', 114688), ('args', '-test ums-gated')], 'result': {'workingset': 4602040320.0, 'privatemem': 19810873344.0, 'nonpaged': 27579744.0, 'virtualmem': 483141148672.0, 'time': 659.99125625}}
-{'var': [('concurrency', 114688), ('args', '-test ums-gated')], 'result': {'workingset': 4591165440.0, 'privatemem': 19790200832.0, 'nonpaged': 27573024.0, 'virtualmem': 483023708160.0, 'time': 583.1214046875}}
-{'var': [('concurrency', 114688), ('args', '-test ums-gated')], 'result': {'workingset': 4639674368.0, 'privatemem': 19800694784.0, 'nonpaged': 27572544.0, 'virtualmem': 483015319552.0, 'time': 595.6076765625}}
-{'var': [('concurrency', 114688), ('args', '-test ums-gated')], 'result': {'workingset': 4615213056.0, 'privatemem': 19768594432.0, 'nonpaged': 27572304.0, 'virtualmem': 483011125248.0, 'time': 585.95591875}}
-{'var': [('concurrency', 131072), ('args', '-test async-gated')], 'result': {'workingset': 122953728.0, 'privatemem': 124391424.0, 'nonpaged': 26608.0, 'virtualmem': 579649536.0, 'time': 22.2635234375}}
-{'var': [('concurrency', 131072), ('args', '-test async-gated')], 'result': {'workingset': 128253952.0, 'privatemem': 129671168.0, 'nonpaged': 26128.0, 'virtualmem': 571260928.0, 'time': 22.54289375}}
-{'var': [('concurrency', 131072), ('args', '-test async-gated')], 'result': {'workingset': 130244608.0, 'privatemem': 131567616.0, 'nonpaged': 26248.0, 'virtualmem': 573358080.0, 'time': 21.3423078125}}
-{'var': [('concurrency', 131072), ('args', '-test async-gated')], 'result': {'workingset': 120819712.0, 'privatemem': 121860096.0, 'nonpaged': 26128.0, 'virtualmem': 571260928.0, 'time': 22.1759359375}}
-{'var': [('concurrency', 131072), ('args', '-test async-gated')], 'result': {'workingset': 197222400.0, 'privatemem': 197992448.0, 'nonpaged': 26128.0, 'virtualmem': 571260928.0, 'time': 26.0388765625}}
-{'var': [('concurrency', 131072), ('args', '-test ums-gated')], 'result': {'workingset': 5291032576.0, 'privatemem': 22605094912.0, 'nonpaged': 31506624.0, 'virtualmem': 551903141888.0, 'time': 769.2572203125}}
-{'var': [('concurrency', 131072), ('args', '-test ums-gated')], 'result': {'workingset': 5268750336.0, 'privatemem': 22580580352.0, 'nonpaged': 31506624.0, 'virtualmem': 551903141888.0, 'time': 715.4761953125}}
-{'var': [('concurrency', 131072), ('args', '-test ums-gated')], 'result': {'workingset': 5275197440.0, 'privatemem': 22597181440.0, 'nonpaged': 31506504.0, 'virtualmem': 551886561280.0, 'time': 743.6708078125}}
-{'var': [('concurrency', 131072), ('args', '-test ums-gated')], 'result': {'workingset': 5559996416.0, 'privatemem': 22927003648.0, 'nonpaged': 31508664.0, 'virtualmem': 552185012224.0, 'time': 777.7286765625}}
-{'var': [('concurrency', 131072), ('args', '-test ums-gated')], 'result': {'workingset': 5265473536.0, 'privatemem': 22609494016.0, 'nonpaged': 31506384.0, 'virtualmem': 551898947584.0, 'time': 774.769990625}}
-{'var': [('concurrency', 163840), ('args', '-test async-gated')], 'result': {'workingset': 161509376.0, 'privatemem': 163639296.0, 'nonpaged': 26720.0, 'virtualmem': 579649536.0, 'time': 29.432303125}}
-{'var': [('concurrency', 163840), ('args', '-test async-gated')], 'result': {'workingset': 152326144.0, 'privatemem': 153423872.0, 'nonpaged': 27088.0, 'virtualmem': 588038144.0, 'time': 24.661028125}}
-{'var': [('concurrency', 163840), ('args', '-test async-gated')], 'result': {'workingset': 148279296.0, 'privatemem': 150319104.0, 'nonpaged': 26368.0, 'virtualmem': 575455232.0, 'time': 25.9785390625}}
-{'var': [('concurrency', 163840), ('args', '-test async-gated')], 'result': {'workingset': 153616384.0, 'privatemem': 154677248.0, 'nonpaged': 26248.0, 'virtualmem': 573358080.0, 'time': 25.02185}}
-{'var': [('concurrency', 163840), ('args', '-test async-gated')], 'result': {'workingset': 154402816.0, 'privatemem': 155430912.0, 'nonpaged': 26360.0, 'virtualmem': 573358080.0, 'time': 25.0472640625}}
-{'var': [('concurrency', 163840), ('args', '-test ums-gated')], 'result': {'workingset': 6044577792.0, 'privatemem': 28556054528.0, 'nonpaged': 39377064.0, 'virtualmem': 690026848256.0, 'time': 238880.438532812}}
-{'var': [('concurrency', 163840), ('args', '-test ums-gated')], 'result': {'workingset': 6581481472.0, 'privatemem': 28245975040.0, 'nonpaged': 39374664.0, 'virtualmem': 689695236096.0, 'time': 1124.5557}}
-{'var': [('concurrency', 163840), ('args', '-test ums-gated')], 'result': {'workingset': 5939179520.0, 'privatemem': 28300779520.0, 'nonpaged': 39375144.0, 'virtualmem': 689703624704.0, 'time': 61740.7140578125}}
-{'var': [('concurrency', 163840), ('args', '-test ums-gated')], 'result': {'workingset': 6597120000.0, 'privatemem': 28281757696.0, 'nonpaged': 39374904.0, 'virtualmem': 689728397312.0, 'time': 1146.400846875}}
-{'var': [('concurrency', 163840), ('args', '-test ums-gated')], 'result': {'workingset': 6597758976.0, 'privatemem': 28234469376.0, 'nonpaged': 39375264.0, 'virtualmem': 689703690240.0, 'time': 1061.4835671875}}
-{'var': [('concurrency', 196608), ('args', '-test async-gated')], 'result': {'workingset': 187748352.0, 'privatemem': 191131648.0, 'nonpaged': 26840.0, 'virtualmem': 581292032.0, 'time': 28.6244015625}}
-{'var': [('concurrency', 196608), ('args', '-test async-gated')], 'result': {'workingset': 186040320.0, 'privatemem': 189222912.0, 'nonpaged': 27448.0, 'virtualmem': 593874944.0, 'time': 27.09115625}}
-{'var': [('concurrency', 196608), ('args', '-test async-gated')], 'result': {'workingset': 191225856.0, 'privatemem': 192925696.0, 'nonpaged': 27088.0, 'virtualmem': 588038144.0, 'time': 27.2597046875}}
-{'var': [('concurrency', 196608), ('args', '-test async-gated')], 'result': {'workingset': 182910976.0, 'privatemem': 184160256.0, 'nonpaged': 25760.0, 'virtualmem': 562872320.0, 'time': 26.3374671875}}
-{'var': [('concurrency', 196608), ('args', '-test async-gated')], 'result': {'workingset': 178884608.0, 'privatemem': 179732480.0, 'nonpaged': 26608.0, 'virtualmem': 579649536.0, 'time': 26.914534375}}
diff --git a/Ix/CPP/src/IxCpp.vcxproj b/Ix/CPP/src/IxCpp.vcxproj
deleted file mode 100644
index 9367080..0000000
--- a/Ix/CPP/src/IxCpp.vcxproj
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{65483A0D-1D72-47CC-B147-27415FFC1FC3}</ProjectGuid>
- <Keyword>MakeFileProj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Makefile</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Makefile</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
- </PropertyGroup>
- <ItemDefinitionGroup>
- </ItemDefinitionGroup>
- <ItemGroup>
- <Text Include="readme.txt" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="cpplinq\linq.hpp" />
- <ClInclude Include="cpplinq\linq_cursor.hpp" />
- <ClInclude Include="cpplinq\linq_groupby.hpp" />
- <ClInclude Include="cpplinq\linq_iterators.hpp" />
- <ClInclude Include="cpplinq\linq_last.hpp" />
- <ClInclude Include="cpplinq\linq_select.hpp" />
- <ClInclude Include="cpplinq\linq_selectmany.hpp" />
- <ClInclude Include="cpplinq\linq_skip.hpp" />
- <ClInclude Include="cpplinq\linq_take.hpp" />
- <ClInclude Include="cpplinq\linq_where.hpp" />
- <ClInclude Include="cpplinq\util.hpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/Ix/CPP/src/IxCpp.vcxproj.filters b/Ix/CPP/src/IxCpp.vcxproj.filters
deleted file mode 100644
index dd7d5bc..0000000
--- a/Ix/CPP/src/IxCpp.vcxproj.filters
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <Text Include="readme.txt" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="cpplinq\linq.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_cursor.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_groupby.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_iterators.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_last.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_select.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_selectmany.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_skip.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_take.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\linq_where.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="cpplinq\util.hpp">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/Ix/CPP/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp
deleted file mode 100644
index 6552f79..0000000
--- a/Ix/CPP/src/cpplinq/linq.hpp
+++ /dev/null
@@ -1,584 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-///
-/// namespace cpplinq
-/// -----------------
-///
-/// Defines a number of range-based composable operators for enumerating and modifying collections
-///
-/// The general design philosophy is to
-/// (1) emulate the composable query patterns introduced in C# Linq
-/// (2) preserve iterator category and writability where possible
-/// For instance, like C# Linq we have a select operator to project one sequence into a new one.
-/// Unlike Linq, invoking Select on a random access sequence will yield you a _random_ access sequence.
-///
-/// The general workflow begins with 'from()' which normally only takes a reference
-/// the the collection in question. However, from that point on, all operators function
-/// by value, so that the range can store any necessary state, rather than duplicating it
-/// onto iterator pairs.
-///
-/// In subsequent documentation, "powers" lists which powers that the operator attempts to preserve if
-/// available on on the input sequence. Some iterator powers may be skipped - in such a case, round down
-/// to the next supported power (e.g. if 'fwd' and 'rnd', an input of 'bidi' will round down to a 'fwd' result).
-///
-///
-///
-/// class linq_query
-/// ----------------
-///
-/// from(container&)
-/// ================
-/// - Result: Query
-///
-/// Construct a new query, from an lvalue reference to a collection. Does not copy the collection
-///
-///
-///
-/// from(iter, iter)
-/// ================
-/// - Result: Query
-///
-/// Construct a new query, from an iterator pair.
-///
-///
-///
-/// query.select(map)
-/// ==========================
-/// - Result: Query
-/// - Powers: input, forward, bidirectional, random access
-///
-/// For each element `x` in the input sequences, computes `map(x)` for the result sequence.
-///
-///
-///
-/// query.where(pred) -> query
-/// ==========================
-/// - Result: Query
-/// - Powers: input, forward, bidirectional
-///
-/// Each element `x` in the input appears in the output if `pred(x)` is true.
-///
-/// The expression `pred(x)` is evaluated only when moving iterators (op++, op--).
-/// Dereferencing (op*) does not invoke the predicate.
-///
-///
-///
-/// query.groupby(keymap [, keyequal])
-/// ====================================
-/// Result: Query of groups. Each group has a 'key' field, and is a query of elements from the input.
-/// Powers: forward
-///
-///
-///
-/// query.any([pred])
-/// =================
-/// - Result: bool
-///
-/// (No argument) Returns true if sequence is non-empty. Equivalent to `query.begin()!=query.end()`
-///
-/// (One argument) Returns true if the sequence contains any elements for which `pred(element)` is true.
-/// Equivalent to `query.where(pred).any()`.
-///
-///
-///
-/// query.all(pred)
-/// ===============
-/// - Result: bool
-///
-/// Returns true if `pred` holds for all elements in the sequence. Equivalent to `!query.any(std::not1(pred))`
-///
-///
-///
-/// query.take(n)
-/// =============
-/// - Result: query
-/// - Powers: input, forward, random access (not bidirectional)
-///
-/// Returns a sequence that contains up to `n` items from the original sequence.
-///
-///
-///
-/// query.skip(n)
-/// =============
-/// - Result: query
-/// - Powers: input, forward, random access (not bidirectional)
-///
-/// Returns a sequence that skips the first `n` items from the original sequence, or an empty sequence if
-/// fewer than `n` were available on input.
-///
-/// Note: begin() takes O(n) time when input iteration power is weaker than random access.
-///
-///
-///
-/// query.count([pred])
-/// ===================
-/// - Result: std::size_t
-///
-/// _TODO: should use inner container's iterator distance type instead._
-///
-/// (Zero-argument) Returns the number of elements in the range.
-/// Equivalent to `std::distance(query.begin(), query.end())`
-///
-/// (One-argument) Returns the number of elements for whicht `pred(element)` is true.
-/// Equivalent to `query.where(pred).count()`
-///
-
-
-
-#if !defined(CPPLINQ_LINQ_HPP)
-#define CPPLINQ_LINQ_HPP
-#pragma once
-
-#pragma push_macro("min")
-#pragma push_macro("max")
-#undef min
-#undef max
-
-#include <functional>
-#include <iterator>
-#include <algorithm>
-#include <numeric>
-#include <list>
-#include <map>
-#include <set>
-#include <memory>
-#include <utility>
-#include <type_traits>
-#include <vector>
-#include <cstddef>
-
-
-
-// some configuration macros
-#if _MSC_VER > 1600 || __cplusplus > 199711L
-#define LINQ_USE_RVALUEREF 1
-#endif
-
-#if (defined(_MSC_VER) && _CPPRTTI) || !defined(_MSC_VER)
-#define LINQ_USE_RTTI 1
-#endif
-
-#if defined(__clang__)
-#if __has_feature(cxx_rvalue_references)
-#define LINQ_USE_RVALUEREF 1
-#endif
-#if __has_feature(cxx_rtti)
-#define LINQ_USE_RTTI 1
-#endif
-#endif
-
-
-// individual features
-#include "util.hpp"
-#include "linq_cursor.hpp"
-#include "linq_iterators.hpp"
-#include "linq_select.hpp"
-#include "linq_take.hpp"
-#include "linq_skip.hpp"
-#include "linq_groupby.hpp"
-#include "linq_where.hpp"
-#include "linq_last.hpp"
-#include "linq_selectmany.hpp"
-
-
-
-
-namespace cpplinq
-{
-
-namespace detail
-{
- template<class Pred>
- struct not1_{
- Pred pred;
- not1_(Pred p) : pred(p)
- {}
- template<class T>
- bool operator()(const T& value)
- {
- return !pred(value);
- }
- };
- // note: VC2010's std::not1 doesn't support lambda expressions. provide our own.
- template<class Pred>
- not1_<Pred> not1(Pred p) { return not1_<Pred>(p); }
-}
-
-namespace detail {
- template <class U>
- struct cast_to {
- template <class T>
- U operator()(const T& value) const {
- return static_cast<U>(value);
- }
- };
-}
-
-template <class Collection>
-class linq_driver
-{
- typedef typename Collection::cursor::element_type
- element_type;
- typedef typename Collection::cursor::reference_type
- reference_type;
-public:
- typedef cursor_iterator<typename Collection::cursor>
- iterator;
-
- linq_driver(Collection c) : c(c) {}
-
-
- // -------------------- linq core methods --------------------
-
- template <class KeyFn>
- linq_driver< linq_groupby<Collection, KeyFn> > groupby(KeyFn fn)
- {
- return linq_groupby<Collection, KeyFn>(c, std::move(fn) );
- }
-
- // TODO: groupby(keyfn, eq)
-
- // TODO: join...
-
- template <class Selector>
- linq_driver< linq_select<Collection, Selector> > select(Selector sel) const {
- return linq_select<Collection, Selector>(c, std::move(sel) );
- }
-
- template <class Fn>
- linq_driver< linq_select_many<Collection, Fn, detail::default_select_many_selector> >
- select_many(Fn fn) const
- {
- return linq_select_many<Collection, Fn, detail::default_select_many_selector>(c, fn, detail::default_select_many_selector());
- }
-
- template <class Fn, class Fn2>
- linq_driver< linq_select_many<Collection, Fn, Fn2> > select_many(Fn fn, Fn2 fn2) const
- {
- return linq_select_many<Collection, Fn, Fn2>(c, fn, fn2);
- }
-
- template <class Predicate>
- linq_driver< linq_where<Collection, Predicate> > where(Predicate p) const {
- return linq_where<Collection, Predicate>(c, std::move(p) );
- }
-
-
- // -------------------- linq peripheral methods --------------------
-
- template <class Fn>
- element_type aggregate(Fn fn) const
- {
- auto it = begin();
- if (it == end()) {
- return element_type();
- }
-
- reference_type first = *it;
- return std::accumulate(++it, end(), first, fn);
- }
-
- template <class T, class Fn>
- T aggregate(T initialValue, Fn fn) const
- {
- return std::accumulate(begin(), end(), initialValue, fn);
- }
-
- bool any() const { auto cur = c.get_cursor(); return !cur.empty(); }
-
- template <class Predicate>
- bool any(Predicate p) const {
- auto it = std::find_if(begin(), end(), p);
- return it != end();
- }
-
- template <class Predicate>
- bool all(Predicate p) const {
- auto it = std::find_if(begin(), end(), detail::not1(p));
- return it == end();
- }
-
- // TODO: average
-
-#if !defined(__clang__)
- // Clang complains that linq_driver is not complete until the closing brace
- // so (linq_driver*)->select() cannot be resolved.
- template <class U>
- auto cast()
- -> decltype(static_cast<linq_driver*>(0)->select(detail::cast_to<U>()))
- {
- return this->select(detail::cast_to<U>());
- }
-#endif
-
- // TODO: concat
-
- bool contains(const typename Collection::cursor::element_type& value) const {
- return std::find(begin(), end(), value) != end();
- }
-
- typename std::iterator_traits<iterator>::difference_type count() const {
- return std::distance(begin(), end());
- }
-
- template <class Predicate>
- typename std::iterator_traits<iterator>::difference_type count(Predicate p) const {
- auto filtered = this->where(p);
- return std::distance(begin(filtered), end(filtered));
- }
-
- // TODO: default_if_empty
-
- // TODO: distinct()
- // TODO: distinct(cmp)
-
- reference_type element_at(std::size_t ix) const {
- auto cur = c.get_cursor();
- while(ix && !cur.empty()) {
- cur.inc();
- --ix;
- }
- if (cur.empty()) { throw std::logic_error("index out of bounds"); }
- else { return cur.get(); }
- }
-
- element_type element_at_or_default(std::size_t ix) const {
- auto cur = c.get_cursor();
- while(ix && !cur.empty()) {
- cur.inc();
- -- ix;
- }
- if (cur.empty()) { return element_type(); }
- else { return cur.get(); }
- }
-
- bool empty() const {
- return !this->any();
- }
-
- // TODO: except(second)
- // TODO: except(second, eq)
-
- reference_type first() const {
- auto cur = c.get_cursor();
- if (cur.empty()) { throw std::logic_error("index out of bounds"); }
- else { return cur.get(); }
- }
-
- template <class Predicate>
- reference_type first(Predicate pred) const {
- auto cur = c.get_cursor();
- while (!cur.empty() && !pred(cur.get())) {
- cur.inc();
- }
- if (cur.empty()) { throw std::logic_error("index out of bounds"); }
- else { return cur.get(); }
- }
-
- element_type first_or_default() const {
- auto cur = c.get_cursor();
- if (cur.empty()) { return element_type(); }
- else { return cur.get(); }
- }
-
- template <class Predicate>
- element_type first_or_default(Predicate pred) const {
- auto cur = c.get_cursor();
- while (!cur.empty() && !pred(cur.get())) {
- cur.inc();
- }
- if (cur.empty()) { return element_type(); }
- else { return cur.get(); }
- }
-
- // TODO: intersect(second)
- // TODO: intersect(second, eq)
-
- // note: forward cursors and beyond can provide a clone, so we can refer to the element directly
- typename std::conditional<
- std::is_convertible<
- typename Collection::cursor::cursor_category,
- forward_cursor_tag>::value,
- reference_type,
- element_type>::type
- last() const
- {
- return linq_last_(c.get_cursor(), typename Collection::cursor::cursor_category());
- }
-
- template <class Predicate>
- reference_type last(Predicate pred) const
- {
- auto cur = c.where(pred).get_cursor();
- return linq_last_(cur, typename decltype(cur)::cursor_category());
- }
-
- element_type last_or_default() const
- {
- return linq_last_or_default_(c.get_cursor(), typename Collection::cursor::cursor_category());
- }
-
- template <class Predicate>
- element_type last_or_default(Predicate pred) const
- {
- auto cur = c.where(pred).get_cursor();
- return linq_last_or_default_(cur, typename decltype(cur)::cursor_category());
- }
-
- reference_type max() const
- {
- return max(std::less<element_type>());
- }
-
- template <class Compare>
- reference_type max(Compare less) const
- {
- auto it = std::max_element(begin(), end(), less);
- if (it == end())
- throw std::logic_error("max performed on empty range");
-
- return *it;
- }
-
- reference_type min() const
- {
- return min(std::less<element_type>());
- }
-
- template <class Compare>
- reference_type min(Compare less) const
- {
- auto it = std::min_element(begin(), end(), less);
- if (it == end())
- throw std::logic_error("max performed on empty range");
-
- return *it;
- }
-
- // TODO: order_by(sel)
- // TODO: order_by(sel, less)
- // TODO: order_by_descending(sel)
- // TODO: order_by_descending(sel, less)
-
- // TODO: sequence_equal(second)
- // TODO: sequence_equal(second, eq)
-
- // TODO: single / single_or_default
-
- linq_driver<linq_skip<Collection>> skip(std::size_t n) const {
- return linq_skip<Collection>(c, n);
- }
-
- // TODO: skip_while(pred)
-
- template<typename ITEM = element_type>
- typename std::enable_if<std::is_default_constructible<ITEM>::value, ITEM>::type sum() const {
- ITEM seed{};
- return sum(seed);
- }
-
- element_type sum(element_type seed) const {
- return std::accumulate(begin(), end(), seed);
- }
-
- template <typename Selector, typename Result = typename std::result_of<Selector(element_type)>::type>
- typename std::enable_if<std::is_default_constructible<Result>::value, Result>::type sum(Selector sel) const {
- return from(begin(), end()).select(sel).sum();
- }
-
- template <typename Selector, typename Result = typename std::result_of<Selector(element_type)>::type>
- Result sum(Selector sel, Result seed) const {
- return from(begin(), end()).select(sel).sum(seed);
- }
-
- linq_driver<linq_take<Collection>> take(std::size_t n) const {
- return linq_take<Collection>(c, n);
- }
-
- // TODO: take_while
-
- // TODO: then_by / then_by_descending ?
-
- // TODO: to_...
-
- // TODO: union(second)
- // TODO: union(eq)
-
- // TODO: zip
-
- // -------------------- conversion methods --------------------
-
- std::vector<typename Collection::cursor::element_type> to_vector() const
- {
- return std::vector<typename Collection::cursor::element_type>(begin(), end());
- }
-
- std::list<typename Collection::cursor::element_type> to_list() const
- {
- return std::list<typename Collection::cursor::element_type>(begin(), end());
- }
-
- std::set<typename Collection::cursor::element_type> to_set() const
- {
- return std::set<typename Collection::cursor::element_type>(begin(), end());
- }
-
- // -------------------- container/range methods --------------------
-
- iterator begin() const { auto cur = c.get_cursor(); return !cur.empty() ? iterator(cur) : iterator(); }
- iterator end() const { return iterator(); }
- linq_driver& operator=(const linq_driver& other) { c = other.c; return *this; }
- template <class TC2>
- linq_driver& operator=(const linq_driver<TC2>& other) { c = other.c; return *this; }
-
- typename std::iterator_traits<iterator>::reference
- operator[](std::size_t ix) const {
- return *(begin()+=ix);
- }
-
- // -------------------- collection methods (leaky abstraction) --------------------
-
- typedef typename Collection::cursor cursor;
- cursor get_cursor() { return c.get_cursor(); }
-
- linq_driver< dynamic_collection<typename Collection::cursor::reference_type> >
- late_bind() const
- {
- return dynamic_collection<typename Collection::cursor::reference_type>(c);
- }
-
-private:
- Collection c;
-};
-
-// TODO: should probably use reference-wrapper instead?
-template <class TContainer>
-linq_driver<iter_cursor<typename util::container_traits<TContainer>::iterator>> from(TContainer& c)
-{
- auto cur = iter_cursor<typename util::container_traits<TContainer>::iterator>(std::begin(c), std::end(c));
- return cur;
-}
-template <class T>
-const linq_driver<T>& from(const linq_driver<T>& c)
-{
- return c;
-}
-template <class Iter>
-linq_driver<iter_cursor<Iter>> from(Iter start, Iter finish)
-{
- return iter_cursor<Iter>(start, finish);
-}
-
-template <class TContainer>
-linq_driver<TContainer> from_value(const TContainer& c)
-{
- return linq_driver<TContainer>(c);
-}
-
-}
-
-#pragma pop_macro("min")
-#pragma pop_macro("max")
-
-#endif // defined(CPPLINQ_LINQ_HPP)
-
diff --git a/Ix/CPP/src/cpplinq/linq_cursor.hpp b/Ix/CPP/src/cpplinq/linq_cursor.hpp
deleted file mode 100644
index 4c5f5b5..0000000
--- a/Ix/CPP/src/cpplinq/linq_cursor.hpp
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_CURSOR_HPP)
-#define CPPLINQ_LINQ_CURSOR_HPP
-#pragma once
-
-#include <cstddef>
-
-/// cursors
-/// ----------
-/// It should be noted that CppLinq uses a slightly different iterator concept, one where iterators
-/// know their extents. This sacrificed some generality, but it adds convenience and improves
-/// some performance in some cases. Notably, captures need only be stored once instead of twice in
-/// most use cases.
-///
-/// Cursors and Ranges are always classes.
-///
-/// To get a cursor from a range:
-///
-/// get_cursor(range) -> cur
-///
-/// Unlike boost ranges, CppLinq cursors are mutated directly, and may "shed state" as they are
-/// mutated. For example, a GroupBy range will drop references to earlier groups, possibly
-/// permitting freeing them.
-///
-/// Onepass cursor
-/// ===========
-/// - empty(cur) -> bool : at end of sequence
-/// - inc(cur)
-/// - get(cur) -> T
-/// - copy ctor : duplicate reference to seek position
-///
-/// Forward cursor
-/// =============
-/// - copy ctor : true duplicate of seek position
-///
-/// Bidirectional cursor
-/// ====================
-/// - forget() : notes the current element as the new 'begin' point
-/// - atbegin(cur) -> bool
-/// - dec(cur)
-///
-/// Random access cursor
-/// ====================
-/// - skip(cur, n)
-/// - position(cur) -> n
-/// - size(cur) -> n
-/// - truncate(n) : keep only n more elements
-///
-/// As well, cursors must define the appropriate type/typedefs:
-/// - cursor_category :: { onepass_cursor_tag, forward_cursor_tag, bidirectional_cursor_tag, random_access_cursor_tag }
-/// - element_type
-/// - reference_type : if writable, element_type& or such. else, == element_type
-/// -
-
-
-
-namespace cpplinq {
-
- // used to identify cursor-based collections
- struct collection_tag {};
-
- struct onepass_cursor_tag {};
- struct forward_cursor_tag : onepass_cursor_tag {};
- struct bidirectional_cursor_tag : forward_cursor_tag {};
- struct random_access_cursor_tag : bidirectional_cursor_tag {};
-
- struct noread_cursor_tag {}; // TODO: remove if not used
- struct readonly_cursor_tag : noread_cursor_tag {};
- struct readwrite_cursor_tag : readonly_cursor_tag {};
-
-
-
- // standard cursor adaptors
-
- namespace util
- {
- namespace detail
- {
- template <std::size_t n> struct type_to_size { char value[n]; };
-
- type_to_size<1> get_category_from_iterator(std::input_iterator_tag);
- type_to_size<2> get_category_from_iterator(std::forward_iterator_tag);
- type_to_size<3> get_category_from_iterator(std::bidirectional_iterator_tag);
- type_to_size<4> get_category_from_iterator(std::random_access_iterator_tag);
- }
-
- template <std::size_t>
- struct iter_to_cursor_category_;
-
- template <class Iter>
- struct iter_to_cursor_category
- {
- static const std::size_t catIx = sizeof(detail::get_category_from_iterator(typename std::iterator_traits<Iter>::iterator_category()) /*.value*/ );
- typedef typename iter_to_cursor_category_<catIx>::type type;
- };
-
- template <> struct iter_to_cursor_category_<1> { typedef onepass_cursor_tag type; };
- template <> struct iter_to_cursor_category_<2> { typedef forward_cursor_tag type; };
- template <> struct iter_to_cursor_category_<3> { typedef bidirectional_cursor_tag type; };
- template <> struct iter_to_cursor_category_<4> { typedef random_access_cursor_tag type; };
-
-
- // Note: returns false if no partial order exists between two
- // particular iterator categories, such as with some of the boost categories
- template <class Cat1, class Cat2>
- struct less_or_equal_cursor_category
- {
- private:
- typedef char yes;
- typedef struct { char c1,c2; } no;
- static yes invoke(Cat1);
- static no invoke(...);
- public:
- enum { value = (sizeof(invoke(Cat2())) == sizeof(yes)) };
- };
-
- // Return the weaker of the two iterator categories. Make sure
- // a non-standard category is in the second argument position, as
- // this metafunction will default to the first value if the order is undefined
- template <class Cat1, class Cat2, class Cat3 = void>
- struct min_cursor_category : min_cursor_category<typename min_cursor_category<Cat1, Cat2>::type, Cat3>
- {
- };
-
- template <class Cat1, class Cat2>
- struct min_cursor_category<Cat1, Cat2>
- : std::conditional<
- less_or_equal_cursor_category<Cat2, Cat1>::value,
- Cat2,
- Cat1>
- {
- };
-
- template <class Collection>
- struct cursor_type {
- typedef decltype(cursor(*static_cast<Collection*>(0))) type;
- };
- }
-
- // simultaniously models a cursor and a cursor-collection
- template <class Iterator>
- class iter_cursor : collection_tag {
- public:
-
- typedef iter_cursor cursor;
-
- typedef typename std::remove_reference<typename std::iterator_traits<Iterator>::value_type>::type
- element_type;
- typedef typename std::iterator_traits<Iterator>::reference
- reference_type;
- typedef typename util::iter_to_cursor_category<Iterator>::type
- cursor_category;
-
- void forget() { start = current; }
- bool empty() const { return current == fin; }
- void inc() {
- if (current == fin)
- throw std::logic_error("inc past end");
- ++current;
- }
- typename std::iterator_traits<Iterator>::reference get() const { return *current; }
-
- bool atbegin() const { return current == start; }
- void dec() {
- if (current == start)
- throw std::logic_error("dec past begin");
- --current;
- }
-
- void skip(std::ptrdiff_t n) { current += n; }
- std::size_t size() { return fin-start; }
- void position() { return current-start; }
- void truncate(std::size_t n) {
- if (n > fin-current) {
- fin = current + n;
- }
- }
-
-
- iter_cursor(Iterator start, Iterator fin)
- : current(start)
- , start(start)
- , fin(std::move(fin))
- {
- }
-
- iter_cursor(Iterator start, Iterator fin, Iterator current)
- : current(std::move(current))
- , start(std::move(start))
- , fin(std::move(fin))
- {
- }
-
- iter_cursor get_cursor() const { return *this; }
-
- private:
- Iterator current;
- Iterator start, fin;
- };
-
-
- template <class T>
- struct cursor_interface
- {
- virtual bool empty() const = 0;
- virtual void inc() = 0;
- virtual cursor_interface* copy() const = 0;
-
- virtual T get() const = 0;
-
- virtual ~cursor_interface() {}
- };
-
- template <class T>
- class dynamic_cursor : collection_tag
- {
- template <class Cur>
- struct instance : cursor_interface<T>
- {
- Cur innerCursor;
-
- instance(Cur cursor) : innerCursor(std::move(cursor))
- {
- }
- virtual bool empty() const
- {
- return innerCursor.empty();
- }
- virtual void inc()
- {
- innerCursor.inc();
- }
- virtual T get() const
- {
- return innerCursor.get();
- }
- virtual cursor_interface<T>* copy() const
- {
- return new instance(*this);
- }
- };
-
- std::unique_ptr<cursor_interface<T>> myCur;
-
- public:
- typedef forward_cursor_tag cursor_category; // TODO: not strictly true!
- typedef typename std::remove_reference<T>::type element_type;
- typedef T reference_type;
-
- dynamic_cursor() {}
-
- dynamic_cursor(const dynamic_cursor& other)
- : myCur(other.myCur ? other.myCur->copy() : nullptr)
- {
- }
-
- dynamic_cursor(dynamic_cursor&& other)
- : myCur(other.myCur.release())
- {
- }
-
- template <class Cursor>
- dynamic_cursor(Cursor cursor)
- : myCur(new instance<Cursor>(std::move(cursor)))
- {
- }
-
- template <class Iterator>
- dynamic_cursor(Iterator start, Iterator end)
- {
- *this = iter_cursor<Iterator>(start, end);
- }
-
- bool empty() const { return !myCur || myCur->empty(); }
- void inc() { myCur->inc(); }
- T get() const { return myCur->get(); }
-
- dynamic_cursor& operator=(dynamic_cursor other)
- {
- std::swap(myCur, other.myCur);
- return *this;
- }
- };
-
- template <class T>
- struct container_interface
- {
- virtual dynamic_cursor<T> get_cursor() const = 0;
- };
-
- template <class T>
- class dynamic_collection
- {
- std::shared_ptr< container_interface<T> > container;
-
- template <class Container>
- struct instance : container_interface<T>
- {
- Container c;
-
- instance(Container c) : c(c)
- {
- }
-
- dynamic_cursor<T> get_cursor() const
- {
- return c.get_cursor();
- }
- };
-
- public:
- typedef dynamic_cursor<T> cursor;
-
- dynamic_collection() {}
-
- dynamic_collection(const dynamic_collection& other)
- : container(other.container)
- {
- }
-
- // container or query
- template <class Container>
- dynamic_collection(Container c)
- : container(new instance<Container>(c))
- {
- }
-
- // container or query
- template <class Iterator>
- dynamic_collection(Iterator begin, Iterator end)
- : container(new instance< iter_cursor<Iterator> >(iter_cursor<Iterator>(begin, end)))
- {
- }
-
- dynamic_cursor<T> get_cursor() const {
- return container ? container->get_cursor() : dynamic_cursor<T>();
- }
- };
-}
-
-#endif // !defined(CPPLINQ_LINQ_CURSOR_HPP
diff --git a/Ix/CPP/src/cpplinq/linq_groupby.hpp b/Ix/CPP/src/cpplinq/linq_groupby.hpp
deleted file mode 100644
index c521e5e..0000000
--- a/Ix/CPP/src/cpplinq/linq_groupby.hpp
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_GROUPBY_HPP)
-#define CPPLINQ_LINQ_GROUPBY_HPP
-#pragma once
-
-namespace cpplinq
-{
-
-template <class Iter, class Key>
-struct group
-{
- Key key;
- Iter start;
- Iter fin;
-
- typedef Iter iterator;
- typedef Iter const_iterator;
-
- group(){}
-
- group(const Key& key) : key(key)
- {
- }
-
- Iter begin() const { return start; }
- Iter end() const { return fin; }
-};
-
-struct default_equality
-{
- template <class T>
- bool operator()(const T& a, const T& b) const {
- return a == b;
- }
-};
-struct default_less
-{
- template<class T>
- bool operator()(const T& a, const T& b) const {
- return a < b;
- }
-};
-
-// progressively constructs grouping as user iterates over groups and elements
-// within each group. Performs this task by building a std::list of element
-// iterators with equal elements within each group.
-//
-// invariants:
-// - relative order of groups corresponds to relative order of each group's first
-// element, as they appeared in the input sequence.
-// - relative order of elements within a group correspond to relative order
-// as they appeared in the input sequence.
-//
-// requires:
-// Iter must be a forward iterator.
-template <class Collection, class KeyFn, class Compare = default_less>
-class linq_groupby
-{
- typedef typename Collection::cursor
- inner_cursor;
-
- typedef typename util::result_of<KeyFn(typename inner_cursor::element_type)>::type
- key_type;
-
- typedef std::list<typename inner_cursor::element_type>
- element_list_type;
-
- typedef group<typename element_list_type::iterator, key_type>
- group_type;
-
- typedef std::list<group_type>
- group_list_type;
-
-private:
- struct impl_t
- {
- // TODO: would be faster to use a chunked list, where
- // pointers are invalidated but iterators are not. Need
- // benchmarks first
-
- element_list_type elements;
- std::list<group_type> groups;
- std::map<key_type, group_type*, Compare> groupIndex;
-
-
-
- KeyFn keySelector;
- Compare comp;
-
- impl_t(inner_cursor cur,
- KeyFn keySelector,
- Compare comp = Compare())
- : keySelector(keySelector)
- , groupIndex(comp)
- {
- // TODO: make lazy
- insert_all(std::move(cur));
- }
-
- void insert_all(inner_cursor cur)
- {
- while(!cur.empty()) {
- insert(cur.get());
- cur.inc();
- }
- }
- void insert(typename inner_cursor::reference_type element)
- {
- key_type key = keySelector(element);
- auto groupPos = groupIndex.find(key);
- if(groupPos == groupIndex.end()) {
- // new group
- bool firstGroup = groups.empty();
-
- elements.push_back(element);
- if(!firstGroup) {
- // pop new element out of previous group
- --groups.back().fin;
- }
-
- // build new group
- groups.push_back(group_type(key));
- group_type& newGroup = groups.back();
-
- groupIndex.insert( std::make_pair(key, &newGroup) );
-
- newGroup.fin = elements.end();
- --(newGroup.start = newGroup.fin);
- } else {
- // add to existing group at end
- elements.insert(groupPos->second->end(), element);
- }
- }
- };
-
-public:
- struct cursor {
- typedef group_type
- element_type;
-
- typedef element_type
- reference_type;
-
- typedef forward_cursor_tag
- cursor_category;
-
- cursor(inner_cursor cur,
- KeyFn keyFn,
- Compare comp = Compare())
- {
- impl.reset(new impl_t(cur, keyFn, comp));
- inner = impl->groups.begin();
- fin = impl->groups.end();
- }
-
- void forget() { } // nop on forward-only cursors
- bool empty() const {
- return inner == fin;
- }
- void inc() {
- if (inner == fin) {
- throw std::logic_error("attempt to iterate past end of range");
- }
- ++inner;
- }
- reference_type get() const {
- return *inner;
- }
-
- private:
- std::shared_ptr<impl_t> impl;
- typename std::list<group_type>::iterator inner;
- typename std::list<group_type>::iterator fin;
- };
-
- linq_groupby(Collection c,
- KeyFn keyFn,
- Compare comp = Compare())
- : c(c), keyFn(keyFn), comp(comp)
- {
- }
-
- cursor get_cursor() const { return cursor(c.get_cursor(), keyFn, comp); }
-
-private:
- Collection c;
- KeyFn keyFn;
- Compare comp;
-};
-
-}
-
-#endif // !defined(CPPLINQ_LINQ_GROUPBY_HPP)
-
diff --git a/Ix/CPP/src/cpplinq/linq_iterators.hpp b/Ix/CPP/src/cpplinq/linq_iterators.hpp
deleted file mode 100644
index 3472281..0000000
--- a/Ix/CPP/src/cpplinq/linq_iterators.hpp
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_ITERATORS_HPP)
-#define CPPLINQ_LINQ_ITERATORS_HPP
-#pragma once
-
-#include <cstddef>
-
-namespace cpplinq {
-
- // if a member, provides the straightforward implementation of various redundant operators. For example,
- // providing -> for any iterator providing *, and so forth.
- struct use_default_iterator_operators {};
-
- #define CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS \
- operator ::cpplinq::use_default_iterator_operators() const { return ::cpplinq::use_default_iterator_operators(); }
-
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- Iter
- >::type
- operator+(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
- return it += n;
- }
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- Iter
- >::type
- operator-(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
- return it -= n;
- }
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- Iter
- >::type
- operator-=(const Iter& it, typename std::iterator_traits<Iter>::distance_type n) {
- return it += (-n);
- }
-
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- bool
- >::type
- operator!=(const Iter& it, const Iter& it2) {
- return !(it == it2);
- }
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- bool
- >::type
- operator>(const Iter& it, const Iter& it2) {
- return it2 < it;
- }
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- bool
- >::type
- operator<=(const Iter& it, const Iter& it2) {
- return !(it2 < it);
- }
- template <class Iter>
- typename std::enable_if<
- std::is_convertible<Iter, use_default_iterator_operators>::value,
- bool
- >::type
- operator>=(const Iter& it, const Iter& it2) {
- return !(it < it2);
- }
-
- namespace util {
- template <class Iter, class T>
- typename std::iterator_traits<Iter>::pointer deref_iterator(const Iter& it) {
- return deref_iterator(it, util::identity<typename std::iterator_traits<Iter>::reference>());
- }
-
- template <class Iter, class T>
- T* deref_iterator(const Iter& it, util::identity<T&>) {
- return &*it;
- }
-
- template <class Iter, class T>
- util::value_ptr<T> deref_iterator(const Iter& it, util::identity<T>) {
- return util::value_ptr<T>(*it);
- }
- }
-
-
- template <class Iter>
- class iter_range
- {
- Iter start, finish;
- public:
-
- CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS
-
- typedef Iter iterator;
- typedef typename iterator::value_type value_type;
-
- explicit iter_range(Iter start, Iter finish) : start(start), finish(finish) {}
- iterator begin() const { return start; }
- iterator end() const { return finish; }
- };
- template <class Iter>
- iter_range<Iter> make_range(Iter start, Iter finish) {
- return iter_range<Iter>(start, finish);
- }
-
- // decays into a onepass/forward iterator
- template <class Cursor>
- class cursor_iterator
- : public std::iterator<std::forward_iterator_tag,
- typename Cursor::element_type,
- std::ptrdiff_t,
- typename std::conditional<std::is_reference<typename Cursor::reference_type>::value,
- typename std::add_pointer<typename Cursor::element_type>::type,
- util::value_ptr<typename Cursor::element_type>>::type,
- typename Cursor::reference_type>
- {
- public:
- CPPLINQ_USE_DEFAULT_ITERATOR_OPERATORS;
-
- cursor_iterator(Cursor cur) : cur(cur) {
- }
-
- cursor_iterator() : cur() {
- }
-
- bool operator==(const cursor_iterator& other) const {
- return !cur && !other.cur;
- }
-
- typename Cursor::reference_type operator*() const {
- return cur->get();
- }
-
- typename cursor_iterator::pointer operator->() const {
- auto& v = **this;
- return &v;
- }
-
- cursor_iterator& operator++() {
- cur->inc();
-
- if (cur->empty()) { cur.reset(); }
- return *this;
- }
-
- cursor_iterator& operator+=(std::ptrdiff_t n) {
- cur->skip(n);
-
- if (cur->empty()) { cur.reset(); }
- return *this;
- }
-
-
-
- private:
- bool empty() const {
- !cur || cur->empty();
- }
-
- util::maybe<Cursor> cur;
- };
-
- template <class Container>
- class container_range
- {
- Container c;
-
- public:
- typedef cursor_iterator<typename Container::cursor> iterator;
-
- container_range(Container c) : c(c)
- {
- }
-
- iterator begin() const
- {
- return iterator(c.get_cursor());
- }
-
- iterator end() const
- {
- return iterator();
- }
- };
-
-}
-
-#endif
diff --git a/Ix/CPP/src/cpplinq/linq_last.hpp b/Ix/CPP/src/cpplinq/linq_last.hpp
deleted file mode 100644
index cb2bf76..0000000
--- a/Ix/CPP/src/cpplinq/linq_last.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_LAST_HPP)
-#define CPPLINQ_LINQ_LAST_HPP
-#pragma once
-
-namespace cpplinq {
-
- template <class Cursor>
- typename Cursor::element_type
- linq_last_(Cursor c, onepass_cursor_tag)
- {
- if (c.empty()) { throw std::logic_error("last() out of bounds"); }
- typename Cursor::element_type elem = c.get();
- for(;;) {
- c.inc();
- if (c.empty()) break;
- elem = c.get();
- }
- return elem;
- }
-
- // TODO: bidirectional iterator in constant time
-
- template <class Cursor>
- typename Cursor::reference_type
- linq_last_(Cursor c, forward_cursor_tag)
- {
- if (c.empty()) { throw std::logic_error("last() out of bounds"); }
- Cursor best = c;
- for(;;) {
- c.inc();
- if (c.empty()) break;
- best = c;
- }
- return best.get();
- }
-
- template <class Cursor>
- typename Cursor::reference_type
- linq_last_(Cursor c, random_access_cursor_tag)
- {
- if (c.empty()) { throw std::logic_error("last() out of bounds"); }
- c.skip(c.size()-1);
- return c.get();
- }
-
- template <class Cursor>
- typename Cursor::element_type
- linq_last_or_default_(Cursor c, onepass_cursor_tag)
- {
- typename Cursor::element_type elem;
- while(!c.empty()) {
- elem = c.get();
- c.inc();
- }
- return elem;
- }
-
- template <class Cursor>
- typename Cursor::element_type
- linq_last_or_default_(Cursor c, forward_cursor_tag)
- {
- if (c.empty()) { throw std::logic_error("last() out of bounds"); }
- Cursor best = c;
- for(;;) {
- c.inc();
- if (c.empty()) break;
- best = c;
- }
- return best.get();
- }
-
- template <class Cursor>
- typename Cursor::element_type
- linq_last_or_default_(Cursor c, random_access_cursor_tag)
- {
- if (c.empty()) { return typename Cursor::element_type(); }
- c.skip(c.size()-1);
- return c.get();
- }
-
-}
-
-#endif // CPPLINQ_LINQ_LAST_HPP
diff --git a/Ix/CPP/src/cpplinq/linq_select.hpp b/Ix/CPP/src/cpplinq/linq_select.hpp
deleted file mode 100644
index d505284..0000000
--- a/Ix/CPP/src/cpplinq/linq_select.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_SELECT_HPP)
-#define CPPLINQ_LINQ_SELECT_HPP
-#pragma once
-
-#include <cstddef>
-
-namespace cpplinq
-{
- template <class Collection, class Selector>
- class linq_select
- {
- typedef typename Collection::cursor
- inner_cursor;
- public:
- struct cursor {
- typedef typename util::result_of<Selector(typename inner_cursor::element_type)>::type
- reference_type;
- typedef typename std::remove_reference<reference_type>::type
- element_type;
- typedef typename inner_cursor::cursor_category
- cursor_category;
-
- cursor(const inner_cursor& cur, Selector sel) : cur(cur), sel(std::move(sel)) {}
-
- void forget() { cur.forget(); }
- bool empty() const { return cur.empty(); }
- void inc() { cur.inc(); }
- reference_type get() const { return sel(cur.get()); }
-
- bool atbegin() const { return cur.atbegin(); }
- void dec() { cur.dec(); }
-
- void skip(std::size_t n) { cur.skip(n); }
- std::size_t position() const { return cur.position(); }
- std::size_t size() const { return cur.size(); }
- private:
- inner_cursor cur;
- Selector sel;
- };
-
- linq_select(const Collection& c, Selector sel) : c(c), sel(sel) {}
-
- cursor get_cursor() const { return cursor(c.get_cursor(), sel); }
-
- private:
- Collection c;
- Selector sel;
- };
-
-}
-
-#endif // defined(CPPLINQ_LINQ_SELECT_HPP)
diff --git a/Ix/CPP/src/cpplinq/linq_selectmany.hpp b/Ix/CPP/src/cpplinq/linq_selectmany.hpp
deleted file mode 100644
index 85f0d42..0000000
--- a/Ix/CPP/src/cpplinq/linq_selectmany.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#include "util.hpp"
-#include "linq_cursor.hpp"
-
-#include <type_traits>
-
-namespace cpplinq
-{
- namespace detail
- {
- struct default_select_many_selector
- {
- template <class T1, class T2>
- auto operator()(T1&& t1, T2&& t2) const
- -> decltype(std::forward<T2>(t2))
- {
- return std::forward<T2>(t2);
- }
- };
- }
-
- namespace detail
- {
- template <typename Fn, typename Arg>
- struct resolve_select_many_fn_return_type
- {
- typedef decltype(std::declval<Fn>()(std::declval<Arg>())) value;
- };
-
- template <typename TCol>
- struct value_collection_adapter
- {
- value_collection_adapter(const TCol& col)
- : _collection(col){}
-
- value_collection_adapter(const value_collection_adapter& src)
- : _collection(src._collection) {}
-
- value_collection_adapter(value_collection_adapter && src)
- : _collection(std::move(src._collection)) {}
-
- const TCol& get() const
- {
- return _collection;
- }
-
- TCol& get()
- {
- return _collection;
- }
-
- private:
- TCol _collection;
- };
-
- template<typename TCol>
- struct collection_store_type
- {
- typedef typename std::remove_reference<TCol>::type collection_type;
- typedef std::reference_wrapper<collection_type> reference_store_type;
- typedef value_collection_adapter<collection_type> value_store_type;
-
- typedef typename std::conditional<std::is_reference<TCol>::value, reference_store_type, value_store_type>::type store;
- };
- }
-
- // cur<T> -> (T -> cur<element_type>) -> cur<element_type>
- template <class Container1, class Fn, class Fn2>
- class linq_select_many
- {
- template <class T> static T instance(); // for type inference
-
- Container1 c1;
- Fn fn;
- Fn2 fn2;
-
- typedef typename Container1::cursor Cur1;
- typedef decltype(from(instance<Fn>()(instance<Cur1>().get()))) Container2;
- typedef typename Container2::cursor Cur2;
-
- typedef typename detail::resolve_select_many_fn_return_type<Fn, typename Cur1::element_type>::value inner_collection;
-
- public:
- class cursor
- {
- public:
- typedef typename util::min_cursor_category<typename Cur1::cursor_category,
- typename Cur2::cursor_category,
- forward_cursor_tag>::type
- cursor_category;
- typedef typename Cur2::reference_type reference_type;
- typedef typename Cur2::element_type element_type;
-
- typedef detail::collection_store_type<inner_collection> collection_store_type;
- typedef typename collection_store_type::store collection_store;
- typedef std::shared_ptr<collection_store> collection_store_ptr;
-
- private:
- // TODO: we need to lazy eval somehow, but this feels wrong.
- Cur1 cur1;
- dynamic_cursor<reference_type> cur2;
- Fn fn;
- Fn2 fn2;
- collection_store_ptr store;
-
- public:
- cursor(Cur1 cur1, const Fn& fn, const Fn2& fn2)
- : cur1(std::move(cur1)), fn(fn), fn2(fn2)
- {
- if (!cur1.empty())
- {
- store = std::make_shared<collection_store>(fn(cur1.get()));
- cur2 = from(store->get()).get_cursor();
- }
- }
-
- bool empty() const
- {
- return cur2.empty();
- }
-
- void inc()
- {
- cur2.inc();
- thunk();
- }
-
- reference_type get() const
- {
- return fn2(cur1.get(), cur2.get());
- }
-
- private:
- void thunk()
- {
- // refill cur2
- while (cur2.empty() && !cur1.empty()) {
- cur1.inc();
- if (cur1.empty())
- break;
-
- store = std::make_shared<collection_store>(fn(cur1.get()));
- cur2 = from(store->get()).get_cursor();
- }
- }
- };
-
- linq_select_many(Container1 c1, Fn fn, Fn2 fn2)
- : c1(std::move(c1)), fn(std::move(fn)), fn2(std::move(fn2))
- {
- }
-
- cursor get_cursor() const
- {
- return cursor(c1.get_cursor(), fn, fn2);
- }
- };
-}
-
-
-
diff --git a/Ix/CPP/src/cpplinq/linq_skip.hpp b/Ix/CPP/src/cpplinq/linq_skip.hpp
deleted file mode 100644
index 5b1624f..0000000
--- a/Ix/CPP/src/cpplinq/linq_skip.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_SKIP_HPP)
-#define CPPLINQ_LINQ_SKIP_HPP
-#pragma once
-
-#include <cstddef>
-
-namespace cpplinq
-{
- template <class Collection>
- struct linq_skip
- {
- public:
- typedef typename Collection::cursor cursor;
-
- linq_skip(const Collection& c, std::size_t n) : c(c), n(n) {}
-
- cursor get_cursor() const {
- std::size_t rem = n;
-
- auto cur = c.get_cursor();
- while(rem-- && !cur.empty()) {
- cur.inc();
- }
- cur.forget();
- return cur;
- }
-
- private:
- Collection c;
- std::size_t n;
- };
-}
-#endif // !defined(CPPLINQ_LINQ_SKIP_HPP)
-
-
diff --git a/Ix/CPP/src/cpplinq/linq_take.hpp b/Ix/CPP/src/cpplinq/linq_take.hpp
deleted file mode 100644
index a7093ef..0000000
--- a/Ix/CPP/src/cpplinq/linq_take.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_TAKE_HPP)
-#define CPPLINQ_LINQ_TAKE_HPP
-#pragma once
-
-#include <cstddef>
-
-namespace cpplinq
-{
- template <class InnerCursor>
- struct linq_take_cursor
- {
- typedef typename InnerCursor::element_type element_type;
- typedef typename InnerCursor::reference_type reference_type;
- typedef typename InnerCursor::cursor_category cursor_category;
-
- linq_take_cursor(const InnerCursor& cur, std::size_t rem) : cur(cur), rem(rem) {}
-
- void forget() { cur.forget(); }
- bool empty() const { return cur.empty() || rem == 0; }
- void inc() { cur.inc(); --rem; }
- reference_type get() const { return cur.get(); }
-
- bool atbegin() const { return cur.atbegin(); }
- void dec() { cur.dec(); --rem; }
-
- void skip(std::size_t n) { cur.skip(n); rem -= n; }
- std::size_t position() const { return cur.position(); }
- std::size_t size() const { return cur.size(); }
-
- private:
- InnerCursor cur;
- std::size_t rem;
- };
-
- namespace detail {
- template <class Collection>
- linq_take_cursor<typename Collection::cursor>
- take_get_cursor_(
- const Collection& c,
- std::size_t n,
- onepass_cursor_tag
- )
- {
- return linq_take_cursor<typename Collection::cursor>(c.get_cursor(), n);
- }
-
- template <class Collection>
- typename Collection::cursor
- take_get_cursor_(
- const Collection& c,
- std::size_t n,
- random_access_cursor_tag
- )
- {
- auto cur = c.get_cursor();
- if (cur.size() > n) {
- cur.truncate(n);
- }
- return cur;
- }
- }
-
- template <class Collection>
- struct linq_take
- {
- typedef typename std::conditional<
- util::less_or_equal_cursor_category<
- random_access_cursor_tag,
- typename Collection::cursor::cursor_category>::value,
- typename Collection::cursor,
- linq_take_cursor<typename Collection::cursor>>::type
- cursor;
-
- linq_take(const Collection& c, std::size_t n) : c(c), n(n) {}
-
- cursor get_cursor() const {
- return detail::take_get_cursor_(c, n, typename Collection::cursor::cursor_category());
- }
-
- Collection c;
- std::size_t n;
- };
-
- template <class Collection>
- auto get_cursor(
- const linq_take<Collection>& take
- )
- -> decltype(get_cursor_(take, typename Collection::cursor::cursor_category()))
- {
- return get_cursor_(take, typename Collection::cursor::cursor_category());
- }
-
-
-}
-#endif // !defined(CPPLINQ_LINQ_TAKE_HPP)
-
diff --git a/Ix/CPP/src/cpplinq/linq_where.hpp b/Ix/CPP/src/cpplinq/linq_where.hpp
deleted file mode 100644
index 9b3d936..0000000
--- a/Ix/CPP/src/cpplinq/linq_where.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_WHERE_HPP)
-#define CPPLINQ_LINQ_WHERE_HPP
-#pragma once
-
-namespace cpplinq
-{
- template <class Collection, class Predicate>
- class linq_where
- {
- typedef typename Collection::cursor
- inner_cursor;
- public:
- struct cursor {
- typedef typename util::min_iterator_category<
- bidirectional_cursor_tag,
- typename inner_cursor::cursor_category>::type
- cursor_category;
- typedef typename inner_cursor::element_type
- element_type;
- typedef typename inner_cursor::reference_type
- reference_type;
-
- cursor(const inner_cursor& cur, const Predicate& p) : cur(cur), pred(p)
- {
- if (!cur.empty() && !pred(cur.get())) {
- this->inc();
- }
- }
-
- void forget() { cur.forget(); }
- bool empty() const { return cur.empty(); }
- void inc() {
- for (;;) {
- cur.inc();
- if (cur.empty() || pred(cur.get())) break;
- }
- }
- reference_type get() const {
- return cur.get();
- }
-
- bool atbegin() const { return atbegin(cur); }
- void dec() {
- for (;;) {
- cur.dec();
- if (pred(cur.get())) break;
- }
- }
- private:
- inner_cursor cur;
- Predicate pred;
- };
-
- linq_where(const Collection& c, Predicate pred) : c(c), pred(pred) {}
-
- cursor get_cursor() const {
- return cursor(c.get_cursor(), pred);
- }
-
- private:
- Collection c;
- Predicate pred;
- };
-}
-
-#endif // !defined(CPPLINQ_LINQ_WHERE_HPP)
-
diff --git a/Ix/CPP/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp
deleted file mode 100644
index ee3d7eb..0000000
--- a/Ix/CPP/src/cpplinq/util.hpp
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#if !defined(CPPLINQ_LINQ_UTIL_HPP)
-#define CPPLINQ_LINQ_UTIL_HPP
-#pragma once
-
-namespace cpplinq { namespace util {
-
- template <class Container>
- struct container_traits {
- typedef typename Container::iterator iterator;
- typedef typename std::iterator_traits<iterator>::value_type value_type;
- typedef typename std::iterator_traits<iterator>::iterator_category iterator_category;
-
- // TODO: conservative definition for now.
- enum { is_writable_iterator =
- std::is_reference<typename std::iterator_traits<iterator>::reference>::value
- && std::is_same<typename std::remove_cv<value_type>::type,
- typename std::remove_cv<typename std::remove_reference<typename std::iterator_traits<iterator>::reference>::type>::type>::value
- };
- };
-
- template <>
- struct container_traits<int>;
-
- template <class Container>
- struct container_traits<Container&>
- : container_traits<Container>
- {};
- template <class Container>
- struct container_traits<const Container>
- : container_traits<Container>
- {
- typedef typename Container::const_iterator iterator;
- };
-
- // Note: returns false if no partial order exists between two
- // particular iterator categories, such as with some of the boost categories
- template <class Cat1, class Cat2>
- struct less_or_equal_iterator_category
- {
- private:
- typedef char yes;
- typedef struct { char c1,c2; } no;
- static yes invoke(Cat1);
- static no invoke(...);
- public:
- enum { value = (sizeof(invoke(Cat2())) == sizeof(yes)) };
- };
-
- // Return the weaker of the two iterator categories. Make sure
- // a non-standard category is in the second argument position, as
- // this metafunction will default to the first value if the order is undefined
- template <class Cat1, class Cat2>
- struct min_iterator_category
- : std::conditional<
- less_or_equal_iterator_category<Cat2, Cat1>::value,
- Cat2,
- Cat1>
- {
- };
-
-#if 0
-#define CppLinq_GET_ITERATOR_TYPE(TContainer) \
- decltype(begin(static_cast<TContainer*>(0)))
-#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \
- decltype(begin(static_cast<const TContainer*>(0)))
-#else
-#define CppLinq_GET_ITERATOR_TYPE(TContainer) \
- typename ::cpplinq::util::container_traits<TContainer>::iterator
-#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \
- typename ::cpplinq::util::container_traits<TContainer>::const_iterator
-#endif
-
- // VC10's std::tr1::result_of is busted with lambdas. use decltype instead on vc10 and later
-#if defined(_MSC_VER) && _MSC_VER >= 1600
- namespace detail {
- template <class T> T instance();
- };
- template <class Fn> struct result_of;
- template <class Fn>
- struct result_of<Fn()> {
- typedef decltype(detail::instance<Fn>()()) type;
- };
- template <class Fn, class A0>
- struct result_of<Fn(A0)> {
- typedef decltype(detail::instance<Fn>()(detail::instance<A0>())) type;
- };
- template <class Fn, class A0, class A1>
- struct result_of<Fn(A0,A1)> {
- typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
- detail::instance<A1>())) type;
- };
- template <class Fn, class A0, class A1, class A2>
- struct result_of<Fn(A0,A1,A2)> {
- typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
- detail::instance<A1>(),
- detail::instance<A2>())) type;
- };
- template <class Fn, class A0, class A1, class A2, class A3>
- struct result_of<Fn(A0,A1,A2,A3)> {
- typedef decltype(detail::instance<Fn>()(detail::instance<A0>(),
- detail::instance<A1>(),
- detail::instance<A2>(),
- detail::instance<A3>())) type;
- };
-#elif defined(_MSC_VER)
- template <class T>
- struct result_of<T> : std::tr1::result_of<T> {};
-#else
- using std::result_of;
-#endif
-
- template<class Type>
- struct identity
- {
- typedef Type type;
- Type operator()(const Type& left) const {return left;}
- };
-
- // faux pointer proxy for iterators that dereference to a value rather than reference, such as selectors
- template <class T>
- struct value_ptr
- {
- T value;
- value_ptr(const T& value) : value(value)
- {}
- value_ptr(const T* pvalue) : value(*pvalue)
- {}
- const T* operator->()
- {
- return &value;
- }
- };
-
-
- template <class T>
- class maybe
- {
- bool is_set;
- typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type
- storage;
- public:
- maybe()
- : is_set(false)
- {
- }
-
- maybe(T value)
- : is_set(false)
- {
- new (reinterpret_cast<T*>(&storage)) T(value);
- is_set = true;
- }
-
- maybe(const maybe& other)
- : is_set(false)
- {
- if (other.is_set) {
- new (reinterpret_cast<T*>(&storage)) T(*other.get());
- is_set = true;
- }
- }
- maybe(maybe&& other)
- : is_set(false)
- {
- if (other.is_set) {
- new (reinterpret_cast<T*>(&storage)) T(std::move(*other.get()));
- is_set = true;
- other.reset();
- }
- }
-
- ~maybe()
- {
- reset();
- }
-
- void reset()
- {
- if (is_set) {
- is_set = false;
- reinterpret_cast<T*>(&storage)->~T();
- }
- }
-
- T* get() {
- return is_set ? reinterpret_cast<T*>(&storage) : 0;
- }
-
- const T* get() const {
- return is_set ? reinterpret_cast<const T*>(&storage) : 0;
- }
-
- void set(T value) {
- if (is_set) {
- *reinterpret_cast<T*>(&storage) = std::move(value);
- } else {
- new (reinterpret_cast<T*>(&storage)) T(std::move(value));
- is_set = true;
- }
- }
-
- T& operator*() { return *get(); }
- const T& operator*() const { return *get(); }
- T* operator->() { return get(); }
- const T* operator->() const { return get(); }
-
- maybe& operator=(const T& other) {
- set(other);
- }
- maybe& operator=(const maybe& other) {
- if (const T* pother = other.get()) {
- set(*pother);
- } else {
- reset();
- }
- return *this;
- }
-
- // boolean-like operators
- operator T*() { return get(); }
- operator const T*() const { return get(); }
-
- private:
-
- };
-}}
-
-
-#endif //CPPLINQ_UTIL_HPP
-
diff --git a/Ix/CPP/unittest/makefile b/Ix/CPP/unittest/makefile
deleted file mode 100644
index 4fea142..0000000
--- a/Ix/CPP/unittest/makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-!ifndef Config
-Config=Debug
-!endif
-
-O=..\..\bin\$(Config)
-
-!message Building ===== $(Config) =====
-
-program=testbench.exe
-INCLUDE=$(INCLUDE);../src
-
-!if "$(Config)"=="Debug"
-OPTIONS=/Od
-!else
-OPTIONS=/Ox
-!endif
-OPTIONS=$(OPTIONS) /Zi /I$(BOOST) /DBOOST_RESULT_OF_USE_DECLTYPE
-
-runtests : "$O/$(program)"
- "$O/$(program)"
-
-
-all : "$O/$(program)"
-
-$O :
- mkdir $O
-
-"$O/$(program)" : testbench.cpp testbench.hpp ../src/cpplinq/*.hpp $O
- $(CPP) $(OPTIONS) /EHsc /Zi /Fe"$@" /Fo$O/ testbench.cpp
-
-clean :
- del /Q $O\*.exe
- del /Q $O\*.pdb
- del /Q $O\*.obj
- del /Q $O\*.ilk
diff --git a/Ix/CPP/unittest/testbench.cpp b/Ix/CPP/unittest/testbench.cpp
deleted file mode 100644
index f8a7899..0000000
--- a/Ix/CPP/unittest/testbench.cpp
+++ /dev/null
@@ -1,610 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#include <iostream>
-#include <iomanip>
-#include <vector>
-#include <functional>
-#include <algorithm>
-#include <numeric>
-#include <iterator>
-#include <string>
-#include <complex>
-
-#include <ctime>
-#include <cstddef>
-
-#include <boost/lambda/core.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/iterator.hpp>
-
-#include "cpplinq/linq.hpp"
-
-#include "testbench.hpp"
-
-using namespace std;
-using namespace cpplinq;
-
-struct int_iter
- : std::iterator<std::random_access_iterator_tag, int, std::ptrdiff_t, int*, int>
-{
- int_iter(value_type i = 0, value_type step = 1) : value(i), step(step)
- {}
-
- value_type operator*() const {
- return value;
- }
- int_iter& operator++() {
- value+=step; return *this;
- }
- int_iter& operator--() {
- value-=step; return *this;
- }
- int_iter& operator+=(std::ptrdiff_t offset) {
- value += step*offset; return *this;
- }
- int_iter& operator-=(std::ptrdiff_t offset) {
- value -= step*offset; return *this;
- }
- std::ptrdiff_t operator-(int_iter rhs) const {
- return std::ptrdiff_t((value - rhs.value)/step);
- }
- bool operator==(int_iter other) const {
- return value == other.value;
- }
- bool operator!=(int_iter other) const {
- return !(*this == other);
- }
- bool operator<(int_iter other) const { return (*this - other) < 0; }
- bool operator>(int_iter other) const { return (*this - other) > 0; }
- bool operator<=(int_iter other) const { return (*this - other) <= 0; }
- bool operator>=(int_iter other) const { return (*this - other) >= 0; }
-
- value_type value;
- value_type step;
-};
-int_iter operator+(int_iter lhs, std::ptrdiff_t rhs) {
- return lhs+=rhs;
-}
-int_iter operator+(std::ptrdiff_t lhs, int_iter rhs) {
- return rhs+=lhs;
-}
-int_iter operator-(int_iter lhs, std::ptrdiff_t rhs) {
- return lhs-=rhs;
-}
-struct int_range
-{
- typedef int_iter iterator;
- typedef int_iter::value_type value_type;
- int_range(value_type begin, value_type end, value_type step = 1)
- : b(begin, step), e(end, step)
- {
- if (step == 0) {
- throw std::logic_error("bad step");
- }
- if (abs(end - begin) % abs(step) != 0) {
- end -= (end-begin)%abs(step);
- }
- }
- int_iter begin() const { return int_iter(b);}
- int_iter end() const { return int_iter(e); }
-
- iterator b, e;
-};
-
-vector<int> vector_range(int start, int end)
-{
- vector<int> v;
- for (int i = start; i < end; ++i)
- v.push_back(i);
- return v;
-}
-
-TEST(test_selection)
-{
- vector<int> v = vector_range(0, 10);
-
- auto v2 = from(v)
- .select([](int x) { return x*2; });
-
- auto result = accumulate(begin(v2), end(v2), int(0));
-
- VERIFY_EQ(90, result);
-}
-
-TEST(test_where)
-{
- vector<int> v = vector_range(0, 10);
- auto v2 = from(v)
- .where([](int x) { return x % 2;});
-
- VERIFY_EQ(1, *v2.begin());
-
- auto result = accumulate(begin(v2), end(v2), int(0));
-
- VERIFY_EQ(25, result);
-}
-
-
-bool is_prime(int x) {
- if (x < 2) {return false;}
- if (x == 2) {return true;}
- for (int i = x/2; i >= 2; --i) {
- if (x % i == 0) { return false;}
- }
- return true;
-};
-
-template <class It>
-void display(It start, It end)
-{
- int i = 0;
- for_each(start, end, [&](typename iterator_traits<It>::value_type x){
- if (++i % 10 == 0) {
- cout << endl;
- }
- cout << x << " ";
- });
- cout << endl;
-}
-
-TEST(test_whereselect)
-{
- auto xs = int_range(0,100);
- auto ys = from(xs)
- .where(is_prime)
- .select([](int x){ return x*x; });
- auto result = accumulate(begin(ys), end(ys), int(0));
-
- //display(begin(ys), end(ys));
-
- // primes < 100
- VERIFY_EQ(65796, result);
-}
-TEST(test_where_modification)
-{
- vector<int> xs = vector_range(0, 100);
-
- auto ys = from(xs)
- .where(is_prime);
- std::fill(begin(ys), end(ys), int(0));
-
- auto result = accumulate(begin(xs), end(xs), int(0));
-
- //display(begin(ys), end(ys));
-
- // non-primes < 100
- VERIFY_EQ(3890, result);
-}
-
-TEST(test_where_any)
-{
- using namespace boost::lambda;
-
- vector<int> xs(200);
- fill(begin(xs), end(xs), int(0));
- auto it = xs.begin();
- *it = 2;
-
- for(;;) {
- auto last = *it++;
- auto primes = from(int_range(last+1, -1))
- .where([&](int x){
- return from(begin(xs), it)
- //.all([&](int d){return x%d;});
- .all(x % boost::lambda::_1);
- });
- *it = *primes.begin();
- if ((*it)>=100) {
- break;
- }
- };
- xs.erase(it, xs.end());
-
- auto result = accumulate(begin(xs), end(xs), int(0));
-
- //display(begin(xs), end(xs));
-
- // primes < 100
- VERIFY_EQ(1060, result);
-}
-
-TEST(test_take)
-{
- auto zero_one = from(int_range(0, -1))
- .take(2);
-
- VERIFY_EQ(0, zero_one[0]);
- VERIFY_EQ(1, zero_one[1]);
-
- auto ten = from(int_range(0, -1))
- .skip(10);
-
- VERIFY_EQ(10, ten[0]);
- VERIFY_EQ(11, ten[1]);
-}
-
-vector<int> some_primes(std::size_t howMany)
-{
- auto xs = from(int_range(0, -1))
- .where(is_prime)
- .take(howMany);
- auto v = vector<int>(begin(xs), end(xs));
- return v;
-}
-
-TEST(test_groupby)
-{
- auto xs = some_primes(40);
- //display(begin(xs), end(xs));
-
- auto grouped =
- from(xs)
- .groupby([](int i){return i % 10; });
-
- VERIFY_EQ(6, from(grouped).count());
- for(auto group = begin(grouped); group != end(grouped); ++group) {
- //cout << "key = " << group->key << endl
- // << "| ";
- for (auto elem = group->begin(); elem != group->end(); ++elem) {
- //cout << *elem << " ";
- }
- //cout << endl;
-
- switch(group->key) {
- case 2: VERIFY_EQ(1, from(*group).count()); break;
- case 3: VERIFY_EQ(11, from(*group).count()); break;
- case 5: VERIFY_EQ(1, from(*group).count()); break;
- case 7: VERIFY_EQ(11, from(*group).count()); break;
- case 1: VERIFY_EQ(8, from(*group).count()); break;
- case 9: VERIFY_EQ(8, from(*group).count()); break;
- }
- }
-}
-
-TEST(test_symbolname)
-{
- auto complexQuery =
- from(int_range(0,100000))
- .select([](int x){ return x*2;})
- .where([](int x){ return x%7; })
- .skip(20);
-
- //cout << " type name: " << typeid(complexQuery1).name() << endl;
-
-
- //auto complexQuery =
- // complexQuery1.groupby([](int x) { return x%5; })
- // .take(3)
- // ;
-
-
- cout << "type name: " << typeid(complexQuery).name() << endl;
- cout << "type name length: " << strlen(typeid(complexQuery).name()) << endl;
-
- auto iter = complexQuery.begin();
- cout << "iterator name: " << typeid(iter).name() << endl;
- cout << "iterator name length: " << strlen(typeid(iter).name()) << endl;
-}
-
-TEST(test_cast)
-{
- auto q = from(int_range(0,10))
- .cast<bool>();
- VERIFY_EQ(false, q[0]);
- VERIFY_EQ(true, q[1]);
- VERIFY_EQ(true, q[2]);
- VERIFY((std::is_same<decltype(q[0]), bool>::value));
-}
-
-TEST(test_contains)
-{
- auto q = from(int_range(0,10))
- .select([](int x){return x*2;});
- VERIFY(q.contains(4));
- VERIFY(!q.contains(5));
-}
-
-TEST(test_element_accessors)
-{
- vector<int> v(int_iter(0), int_iter(10));
- auto q = from(v)
- .where([](int x){return x%2==0;});
-
- VERIFY_EQ(0, q.first());
- VERIFY_EQ(8, q.last());
- VERIFY_EQ(6, q.element_at(3));
-
- bool thrown = false;
- try { q.element_at(5); } catch (std::logic_error&) { thrown = true; }
- VERIFY(thrown);
-
- q.first() = 1;
- q.last() = 42;
-
- // note: because the vector now contains { 1, 1, 2, 3, ... 7, 8, 42 }, the first
- // even number is now '2'
- VERIFY_EQ(2, q.first());
- VERIFY_EQ(42, q.last());
-}
-
-//////////////////// New style cursors ////////////////////
-
-TEST(test_cursor_dynamic)
-{
- dynamic_cursor<int> dc(int_iter(0), int_iter(2));
-
- VERIFY(!dc.empty());
- VERIFY_EQ(0, dc.get());
- dc.inc();
- VERIFY_EQ(1, dc.get());
- dc.inc();
- VERIFY(dc.empty());
-}
-
-TEST(test_selectmany)
-{
- int_range range1(0, 3);
- auto range2 =
-
- from(range1)
- .select_many(
- [](int x)
- {
- return int_range(0, x+1);
- });
-
- auto cur = range2.get_cursor();
-
- // expected: 0, 0, 1, 0, 1, 2.
- VERIFY(!cur.empty());
-
- VERIFY_EQ(0, cur.get());
- cur.inc();
- VERIFY(!cur.empty());
-
- VERIFY_EQ(0, cur.get());
- cur.inc();
- VERIFY(!cur.empty());
-
- VERIFY_EQ(1, cur.get());
- cur.inc();
- VERIFY(!cur.empty());
-
- VERIFY_EQ(0, cur.get());
- cur.inc();
- VERIFY(!cur.empty());
-
- VERIFY_EQ(1, cur.get());
- cur.inc();
- VERIFY(!cur.empty());
-
- VERIFY_EQ(2, cur.get());
- cur.inc();
- VERIFY(cur.empty());
-}
-
-TEST(test_cursor_selectmany2)
-{
- int_range range1(0, 3);
- auto range2 = from(range1)
- .select_many(
- [](int x)
- {
- return int_range(0, x+1);
- });
-
- // expected: 0, 0, 1, 0, 1, 2.
- int expect[] = { 0, 0, 1, 0, 1, 2 };
-
- VERIFY_EQ(_countof(expect), std::distance(range2.begin(), range2.end()));
- VERIFY_EQ(_countof(expect), std::distance(range2.begin(), range2.end()));
-
- auto result = std::mismatch(expect, expect + _countof(expect), range2.begin());
- if (result.second != range2.end()) {
- cout << "mismatch: " << *result.first << " != " << *result.second << endl;
- }
- VERIFY( result.second == range2.end());
-}
-
-TEST(test_late_bind)
-{
- int_range range1(0, 100);
- linq_driver<dynamic_collection<int>> range2 = from(range1).late_bind();
-
- VERIFY_EQ(1, range2.element_at(1));
-
- auto q1 = from(range1).select([](int x){ return x*2; }).where([](int x){ return x%10!=0; });
-
- cout << "typeof q1 ==> " << typeid(q1).name() << endl;
- cout << "typeof q1.late_bind() ==> " << typeid(q1.late_bind()).name() << endl;
-}
-
-struct stopwatch
-{
- time_t t0, t1;
- void start() {
- t1 = t0 = clock();
- }
- void stop() {
- t1 = clock();
- }
- double value() const {
- return double(t1-t0)/CLOCKS_PER_SEC;
- }
-};
-
-template <class Fn>
-void test_perf(Fn fn)
-{
- // warmup
- fn(10);
-
- int n = 100;
- stopwatch sw;
- for(;;)
- {
- cout << "trying n=" << n << endl;
- sw.start();
- fn(n);
- sw.stop();
- if (sw.value() > 2.0) {
- break;
- }
- n *= 2;
- }
- cout << "time = " << sw.value() << " s\n";
- cout << "steps = " << n << "\n";
- cout << "t/step = " << (sw.value() * 1e9 / n) << " ns\n";
- cout << "step/t = " << (n / sw.value()) << " Hz\n";
-}
-
-TEST(test_performance)
-{
- // http://projecteuler.net/problem=8
- //
- // Find the greatest product of five consecutive digits in the 1000-digit number.
- //
-
- static const char num[] =
- "73167176531330624919225119674426574742355349194934"
- "96983520312774506326239578318016984801869478851843"
- "85861560789112949495459501737958331952853208805511"
- "12540698747158523863050715693290963295227443043557"
- "66896648950445244523161731856403098711121722383113"
- "62229893423380308135336276614282806444486645238749"
- "30358907296290491560440772390713810515859307960866"
- "70172427121883998797908792274921901699720888093776"
- "65727333001053367881220235421809751254540594752243"
- "52584907711670556013604839586446706324415722155397"
- "53697817977846174064955149290862569321978468622482"
- "83972241375657056057490261407972968652414535100474"
- "82166370484403199890008895243450658541227588666881"
- "16427171479924442928230863465674813919123162824586"
- "17866458359124566529476545682848912883142607690042"
- "24219022671055626321111109370544217506941658960408"
- "07198403850962455444362981230987879927244284909188"
- "84580156166097919133875499200524063689912560717606"
- "05886116467109405077541002256983155200055935729725"
- "71636269561882670428252483600823257530420752963450";
-
- auto task = [&](int n){
- for (int i = 0; i < n; ++i) {
- auto range1 = int_range(0, _countof(num)-5); // 5 digit numbers, plus null terminator
-
- auto products = from(range1)
- .select([&](int i){ return num+i;})
- .where([&](const char* s){ return !from(s, s+5).contains('0'); })
- .select([&](const char* s) { return from(s, s+5).select([](char c){ return c - '0'; })
- .aggregate(std::multiplies<int>()); });
-
- auto result = products.max();
- if (n == 1) {
- cout << "result = " << result << endl;
- }
- }
- };
- cout << "length of input: " << (_countof(num)-1) << endl;
-
- task(1);
- cout << endl;
-
-#ifdef PERF
- test_perf(task);
- cout << endl;
-#endif
-}
-
-// SUM TESTS
-
-TEST(test_sum_ints)
-{
- vector<int> numbers{1, 2, 3, 4, 5};
-
- auto result = cpplinq::from(numbers);
- auto r2 = result.sum();
-
- VERIFY_EQ(15, r2);
-}
-
-TEST(test_sum_ints_with_seed)
-{
- vector<int> numbers{1, 2, 3, 4, 5};
-
- auto result = cpplinq::from(numbers).sum(10);
-
- VERIFY_EQ(25, result);
-}
-
-TEST(test_sum_floats) {
- vector<float> numbers{ 1.0f,2.0f,3.0f,4.0f,5.0f };
-
- auto result = cpplinq::from(numbers).sum();
-
- VERIFY_EQ(15.0f, result);
-}
-
-TEST(test_sum_doubles) {
- vector<double> numbers { 1.0,2.0,3.0,4.0,5.0 };
-
- auto result = cpplinq::from(numbers).sum();
-
- VERIFY_EQ(15.0, result);
-}
-
-TEST(test_sum_complex) {
- using namespace std::complex_literals;
-
- vector<complex<double>> numbers{ 1i, 1.0 + 2i, 2.0 + 3i };
-
- auto sum = cpplinq::from(numbers).sum();
-
- VERIFY_EQ(3.0, sum.real());
- VERIFY_EQ(6.0, sum.imag());
-}
-
-TEST(test_sum_with_projection_lambda) {
- vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
-
- auto result = cpplinq::from(numbers).sum([](std::tuple<int>& x){
- return std::get<0>(x);
- });
-
- VERIFY_EQ(3.0, result);
-}
-
-TEST(test_sum_with_projection_lambda_and_seed) {
- vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
-
- auto result = cpplinq::from(numbers).sum([](std::tuple<int>& x){
- return std::get<0>(x);
- }, 10);
-
- VERIFY_EQ(13.0, result);
-}
-
-int getValue(std::tuple<int> x)
-{
- return std::get<0>(x);
-}
-
-TEST(test_sum_with_projection_function_pointer) {
- vector<tuple<int>> numbers { std::tuple<int>(0), std::tuple<int>(1), std::tuple<int>(2) };
-
- auto result = cpplinq::from(numbers).sum(getValue);
-
- VERIFY_EQ(3.0, result);
-}
-
-int main(int argc, char** argv)
-{
- std::size_t pass = 0, fail = 0;
- testrange<0,__LINE__>().run(pass, fail);
-
-
- cout << "pass: " << pass << ", fail: " << fail << endl;
- if (fail){
- cerr << "ERRORS PRESENT." << endl;
- } else if (!pass) {
- cerr << "ERROR, no tests run" << endl;
- }
-}
diff --git a/Ix/CPP/unittest/testbench.hpp b/Ix/CPP/unittest/testbench.hpp
deleted file mode 100644
index b2b8cfd..0000000
--- a/Ix/CPP/unittest/testbench.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#include <iostream>
-#include <iomanip>
-#include <exception>
-#include <sstream>
-#include <utility>
-#include <memory>
-#include <cstddef>
-
-struct empty_testcase{ void run(){} const char* name(){return 0;} };
-
-template <std::size_t offset>
-struct testcase : empty_testcase{};
-
-
-template <std::size_t begin, std::size_t end>
-struct testrange {
- void run(std::size_t& pass, std::size_t& fail)
- {
- using namespace std;
- { testcase<begin> a_case;
- if (a_case.name()) {
- std::size_t p=0, f=0;
- cout << "TEST: Running " << a_case.name() << endl;
- try {
- a_case.run();
- ++p;
- } catch (logic_error& e) {
- cerr << "ERRORS:" << endl;
- cerr << " " << e.what() << endl;
- ++f;
- }
- pass += p; fail += f;
- }
- }
- const std::size_t rem = (end-begin-1);
- testrange<begin+1, begin+1+rem/2>().run(pass, fail);
- testrange<begin+1+rem/2, end>().run(pass, fail);
- }
-};
-
-template <std::size_t begin>
-struct testrange<begin,begin> {
- void run(std::size_t& pass, std::size_t& fail) {};
-};
-
-#define TEST(fun_name) \
-void fun_name (); \
-template <> \
-struct testcase<__LINE__> { \
- const char* name() { return(#fun_name); } \
- void run() { fun_name(); } \
-}; \
-void fun_name()
-
-#define Q_(e) #e
-#define Q(e) Q_(e)
-#define TASSERT(expr) \
- { auto e = (expr); if (!e) { throw std::logic_error(__FILE__ "(" Q(__LINE__) "): TASSERT("#expr")"); } }
-
-struct errmsg
-{
- std::shared_ptr<std::stringstream> msg;
- errmsg() : msg(new std::stringstream)
- {}
-
- template <class T>
- errmsg& operator<<(T value)
- {
- (*msg) << value;
- return *this;
- }
- std::string str() { return msg->str(); }
-};
-
-#define TEST_WHERE __FILE__ "(" Q(__LINE__) "): "
-#define VERIFY(expr) \
- { auto e = (expr); if (!e) { throw std::logic_error(TEST_WHERE "VERIFY("#expr")"); } }
-#define VERIFY_EQ(expected, actual) \
- { auto e = (expected); auto a = (actual); \
- if (!(e == a)) { \
- throw std::logic_error( \
- (errmsg() << TEST_WHERE << "(" << e << ")!=(" << a << ") in VERIFY_EQ("#expected","#actual")").str() );}}
-
-
diff --git a/LICENSE b/LICENSE
deleted file mode 120000
index 31178b7..0000000
--- a/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-license.md \ No newline at end of file
diff --git a/METADATA b/METADATA
deleted file mode 100644
index daf68f9..0000000
--- a/METADATA
+++ /dev/null
@@ -1,18 +0,0 @@
-name: "RxCpp"
-description:
- "The Reactive Extensions for C++ (RxCpp) is a library of algorithms for "
- "values-distributed-in-time."
-
-third_party {
- url {
- type: HOMEPAGE
- value: "https://github.com/ReactiveX/RxCpp/"
- }
- url {
- type: GIT
- value: "https://github.com/ReactiveX/RxCpp.git"
- }
- version: "aac2fc97bc5fe680446afb5ae81bef0a9c0fbf8a"
- last_upgrade_date { year: 2019 month: 2 day: 20 }
- license_type: NOTICE
-}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/OWNERS b/OWNERS
index 5778e28..7529cb9 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,3 +1 @@
-# Default code reviewers picked from top 3 or more developers.
-# Please update this list if you find better candidates.
-iam@google.com
+include platform/system/core:/janitors/OWNERS
diff --git a/README.md b/README.md
deleted file mode 100644
index 228121e..0000000
--- a/README.md
+++ /dev/null
@@ -1,238 +0,0 @@
-The Reactive Extensions for C++ (__RxCpp__) is a library of algorithms for values-distributed-in-time. The [__Range-v3__](https://github.com/ericniebler/range-v3) library does the same for values-distributed-in-space.
-
-Platform | Status |
------------ | :------------ |
-Windows | [![Windows Status](http://img.shields.io/appveyor/ci/kirkshoop/RxCpp-446.svg?style=flat-square)](https://ci.appveyor.com/project/kirkshoop/rxcpp-446)
-Linux & OSX | [![Linux & Osx Status](http://img.shields.io/travis/ReactiveX/RxCpp.svg?style=flat-square)](https://travis-ci.org/ReactiveX/RxCpp)
-
-Source | Badges |
-------------- | :--------------- |
-Github | [![GitHub license](https://img.shields.io/github/license/ReactiveX/RxCpp.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp) <br/> [![GitHub release](https://img.shields.io/github/release/ReactiveX/RxCpp.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp/releases) <br/> [![GitHub commits](https://img.shields.io/github/commits-since/ReactiveX/RxCpp/4.1.0.svg?style=flat-square)](https://github.com/ReactiveX/RxCpp)
-Gitter.im | [![Join in on gitter.im](https://img.shields.io/gitter/room/Reactive-Extensions/RxCpp.svg?style=flat-square)](https://gitter.im/ReactiveX/RxCpp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-Packages | [![NuGet version](http://img.shields.io/nuget/v/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) [![vcpkg port](https://img.shields.io/badge/vcpkg-port-blue.svg?style=flat-square)](https://github.com/Microsoft/vcpkg/tree/master/ports/rxcpp)
-Documentation | [![rxcpp doxygen documentation](https://img.shields.io/badge/rxcpp-latest-brightgreen.svg?style=flat-square)](http://reactivex.github.io/RxCpp) <br/> [![reactivex intro](https://img.shields.io/badge/reactivex.io-intro-brightgreen.svg?style=flat-square)](http://reactivex.io/intro.html) [![rx marble diagrams](https://img.shields.io/badge/rxmarbles-diagrams-brightgreen.svg?style=flat-square)](http://rxmarbles.com/)
-
-# Usage
-
-__RxCpp__ is a header-only C++ library that only depends on the standard library. The CMake build generates documentation and unit tests. The unit tests depend on a git submodule for the [Catch](https://github.com/philsquared/Catch) library.
-
-# Example
-Add `Rx/v2/src` to the include paths
-
-[![lines from bytes](https://img.shields.io/badge/blog%20post-lines%20from%20bytes-blue.svg?style=flat-square)](http://kirkshoop.github.io/async/rxcpp/c++/2015/07/07/rxcpp_-_parsing_bytes_to_lines_of_text.html)
-
-```cpp
-#include "rxcpp/rx.hpp"
-namespace Rx {
-using namespace rxcpp;
-using namespace rxcpp::sources;
-using namespace rxcpp::operators;
-using namespace rxcpp::util;
-}
-using namespace Rx;
-
-#include <regex>
-#include <random>
-using namespace std;
-using namespace std::chrono;
-
-int main()
-{
- random_device rd; // non-deterministic generator
- mt19937 gen(rd());
- uniform_int_distribution<> dist(4, 18);
-
- // for testing purposes, produce byte stream that from lines of text
- auto bytes = range(0, 10) |
- flat_map([&](int i){
- auto body = from((uint8_t)('A' + i)) |
- repeat(dist(gen)) |
- as_dynamic();
- auto delim = from((uint8_t)'\r');
- return from(body, delim) | concat();
- }) |
- window(17) |
- flat_map([](observable<uint8_t> w){
- return w |
- reduce(
- vector<uint8_t>(),
- [](vector<uint8_t> v, uint8_t b){
- v.push_back(b);
- return v;
- }) |
- as_dynamic();
- }) |
- tap([](vector<uint8_t>& v){
- // print input packet of bytes
- copy(v.begin(), v.end(), ostream_iterator<long>(cout, " "));
- cout << endl;
- });
-
- //
- // recover lines of text from byte stream
- //
-
- auto removespaces = [](string s){
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
- return s;
- };
-
- // create strings split on \r
- auto strings = bytes |
- concat_map([](vector<uint8_t> v){
- string s(v.begin(), v.end());
- regex delim(R"/(\r)/");
- cregex_token_iterator cursor(&s[0], &s[0] + s.size(), delim, {-1, 0});
- cregex_token_iterator end;
- vector<string> splits(cursor, end);
- return iterate(move(splits));
- }) |
- filter([](const string& s){
- return !s.empty();
- }) |
- publish() |
- ref_count();
-
- // filter to last string in each line
- auto closes = strings |
- filter(
- [](const string& s){
- return s.back() == '\r';
- }) |
- Rx::map([](const string&){return 0;});
-
- // group strings by line
- auto linewindows = strings |
- window_toggle(closes | start_with(0), [=](int){return closes;});
-
- // reduce the strings for a line into one string
- auto lines = linewindows |
- flat_map([&](observable<string> w) {
- return w | start_with<string>("") | sum() | Rx::map(removespaces);
- });
-
- // print result
- lines |
- subscribe<string>(println(cout));
-
- return 0;
-}
-```
-
-# Reactive Extensions
-
->The ReactiveX Observable model allows you to treat streams of asynchronous events with the same sort of simple, composable operations that you use for collections of data items like arrays. It frees you from tangled webs of callbacks, and thereby makes your code more readable and less prone to bugs.
-
-Credit [ReactiveX.io](http://reactivex.io/intro.html)
-
-### Other language implementations
-
-* Java: [RxJava](https://github.com/ReactiveX/RxJava)
-* JavaScript: [rxjs](https://github.com/ReactiveX/rxjs)
-* C#: [Rx.NET](https://github.com/Reactive-Extensions/Rx.NET)
-* [More..](http://reactivex.io/languages.html)
-
-### Resources
-
-* [Intro](http://reactivex.io/intro.html)
-* [Tutorials](http://reactivex.io/tutorials.html)
-* [Marble Diagrams](http://rxmarbles.com/)
-* [twitter stream analysis app](https://github.com/kirkshoop/twitter)
- * [![baldwin pass to wilson](https://img.youtube.com/vi/QkvCzShHyVU/0.jpg)](https://www.youtube.com/watch?v=QkvCzShHyVU)
-* _Algorithm Design For Values Distributed In Time_
- * [![C++ Russia 2016](https://img.youtube.com/vi/Re6DS5Ff0uE/0.jpg)](https://www.youtube.com/watch?v=Re6DS5Ff0uE)
- * [![CppCon 2016](https://img.youtube.com/vi/FcQURwM806o/0.jpg)](https://www.youtube.com/watch?v=FcQURwM806o)
-
-# Cloning RxCpp
-
-RxCpp uses a git submodule (in `ext/catch`) for the excellent [Catch](https://github.com/philsquared/Catch) library. The easiest way to ensure that the submodules are included in the clone is to add `--recursive` in the clone command.
-
-```shell
-git clone --recursive https://github.com/ReactiveX/RxCpp.git
-cd RxCpp
-```
-
-# Building RxCpp Unit Tests
-
-* RxCpp is regularly tested on OSX and Windows.
-* RxCpp is regularly built with Clang, Gcc and VC
-* RxCpp depends on the latest compiler releases.
-
-RxCpp uses CMake to create build files for several platforms and IDE's
-
-### ide builds
-
-#### XCode
-```shell
-mkdir projects/build
-cd projects/build
-cmake -G"Xcode" ../CMake -B.
-```
-
-#### Visual Studio 2017
-```batch
-mkdir projects\build
-cd projects\build
-cmake -G "Visual Studio 15" ..\CMake\
-msbuild Project.sln
-```
-
-### makefile builds
-
-#### OSX
-```shell
-mkdir projects/build
-cd projects/build
-cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
-make
-```
-
-#### Linux --- Clang
-```shell
-mkdir projects/build
-cd projects/build
-cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" -B. ../CMake
-make
-```
-
-#### Linux --- GCC
-```shell
-mkdir projects/build
-cd projects/build
-cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
-make
-```
-
-#### Windows
-```batch
-mkdir projects\build
-cd projects\build
-cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ..\CMake
-nmake
-```
-
-The build only produces test and example binaries.
-
-# Running tests
-
-* You can use the CMake test runner `ctest`
-* You can run the test binaries directly `rxcpp_test_*`
-* Tests can be selected by name or tag
-Example of by-tag
-
-`rxcpp_test_subscription [perf]`
-
-# Documentation
-
-RxCpp uses Doxygen to generate project [documentation](http://reactivex.github.io/RxCpp).
-
-When Doxygen+Graphviz is installed, CMake creates a special build task named `doc`. It creates actual documentation and puts it to `projects/doxygen/html/` folder, which can be published to the `gh-pages` branch. Each merged pull request will build the docs and publish them.
-
-[Developers Material](DeveloperManual.md)
-
-# Contributing Code
-
-Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed and tested by the Rx Team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.
-
-# Microsoft Open Source Code of Conduct
-This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
diff --git a/Readme.html b/Readme.html
deleted file mode 100644
index 0623bd0..0000000
--- a/Readme.html
+++ /dev/null
@@ -1,308 +0,0 @@
-<h1>Reactive Extensions</h1>
-
-<p>Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.</p>
-<p>Data sequences can take many forms, such as a stream of data from a file or web service, web services requests, system notifications, or a series of events such as user input. </p>
-<p>Reactive Extensions represents all these data sequences as observable sequences. An application can subscribe to these observable sequences to receive asynchronous notifications as new data arrives. The Rx library is available for application development in C++, .NET, Ruby, Python, Silverlight, Windows Phone 7 and JavaScript. For more information on these different platforms, see Differences Between Versions of Rx topic.</p>
-
-<h2>Pulling vs. Pushing Data</h2>
-<p>In interactive programming, the application actively polls a data source for more information by pulling data from a sequence that represents the source. The iterator allows us to get the current item by returning the current property, and determines whether there are more items to iterate (by calling some on_next method). </p>
-<p>The application is active in the data retrieval process, controlling the pace of the retrieval by calling on_next at its own convenience. This pattern is synchronous, which means that the application might be blocked while polling the data source. Such pulling pattern is similar to visiting your library and checking out a book. After you are done with the book, you pay another visit to check out another one.</p>
-<p>On the other hand, in reactive programming, the application is offered more information by subscribing to a data stream (called observable sequence in Rx), and any update is handed to it from the source. The application is passive in the data retrieval process: apart from subscribing to the observable source, it does not actively poll the source, but merely reacts to the data being pushed to it. When the stream has no more data to offer, or when it errs, the source will send a notice to the subscriber. In this way, the application will not be blocked by waiting for the source to update. </p>
-<p>This is the push pattern employed by Reactive Extensions. It is similar to joining a book club in which you register your interest in a particular genre, and books that match your interest are automatically sent to you as they are published. You do not need to stand in line to acquire something that you want. Employing a push pattern is helpful in many scenarios, especially in a UI-heavy environment in which the UI thread cannot be blocked while the application is waiting for some events. In summary, by using Rx, you can make your application more responsive.</p>
-<p>The push model implemented by Rx is represented by the observable pattern of Rx.Observable/Observer. The Rx.Observable will notify all the observers automatically of any state changes. To register an interest through a subscription, you use the subscribe method of Rx.Observable, which takes on an Observer and returns a disposable. This gives you the ability to track and dispose of the subscription. In addition, Rx’s LINQ implementation over observable sequences allows developers to compose complex event processing queries over push-based sequences such as events, APM-based (“AsyncResult”) computations, Task-based computations, and asynchronous workflows. For more information on the Observable/Observer classes, see Exploring The Major Classes in Rx. For tutorials on using the different features in Rx, see Using Rx.</p>
-
-<h1>Getting Started with Rx</h1>
-<p>This section describes in general what Reactive Extensions (Rx) is, and how it can benefit programmers who are creating asynchronous applications.</p>
-
-<h3>In This Section</h3>
-<p>1. When Will You Use Rx<br />
-2. Installing Rx<br />
-3. Differences Between Versions of Rx</p>
-
-<h3>Related Sections</h3>
-<p>Using Rx<br />
-Reactive Extensions on MSDN Developer Center</p>
-
-<h1>When Will You Use Rx</h1>
-<p>This topic describes the advantage of using Rx for users who are currently using the .NET event model for asynchronous programming.</p>
-
-<h2>Advantages of using Rx</h2>
-<p>Whether you are authoring a traditional desktop or web-based application, you have to deal with asynchronous programming from time to time. Desktop applications have I/O or UI threads that might take a long time to complete and potentially block all other active threads. However, a user of the modern asynchronous programming model has to manage exceptions and cancellation of events manually. To compose or filter events, he has to write custom code that is hard to decipher and maintain.</p>
-<p>In addition, if your application interacts with multiple sources of data, the conventional way to manage all of these interactions is to implement separate methods as event handlers for each of these data streams. For example, as soon as a user types a character, a keydown event is pushed to your keydown event handler method. Inside this keydown event handler, you have to provide code to react to this event, or to coordinate between all of the different data streams and process this data into a useable form.</p>
-<p>Using Rx, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc.), and subscribe to the event stream using the Observer class. The Observable class maintains a list of dependent Observer threads and notifies them automatically of any state changes. You can query observable sequences using standard LINQ query operators implemented by the Rx.Observable type. Thus you can filter, aggregate, and compose on multiple events easily by using these LINQ operators. Cancellation and exceptions can also be handled gracefully by using extension methods provided by Rx.</p>
-<p>The following example shows how easy it is to implement an observable in C++.</p>
-<pre><code>
- auto ints = rxcpp::observable&lt;>::create<int>(
- [](rxcpp::subscriber&lt;int> s){
- s.on_next(1);
- s.on_next(2);
- s.on_completed();
- });
-
- ints.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
-</code></pre>
-<p>You can also use schedulers to control when the subscription starts, and when notifications are pushed to subscribers. For more information on this, see Using Schedulers for Concurrency Control.</p>
-
-<h2>Filtering</h2>
-<p>One drawback of the C++ event model is that your event handler is always called every time an event is raised, and events arrive exactly as they were sent out by the source. To filter out events that you are not interested in, or transform data before your handler is called, you have to add custom filter logic to your handler.</p>
-<p>Take an application that detects mouse-down as an example. In the current event programming model, the application can react to the event raised by displaying a message. In Rx, such mouse-down events are treated as a stream of information about clicks. Whenever you click the mouse, information (e.g., cursor position) about this click appears in a stream, ready to be processed. In this paradigm, events (or event streams) are very similar to lists or other collections. This means that we can use techniques for working with collections to process events. For example, you can filter out those clicks that appear outside a specific area, and only display a message when the user clicks inside an area. Or you can wait a specific period of time, and inform the user the number of “valid” clicks during this period. Similarly, you can capture a stream of stock ticks and only respond to those ticks that have changed for a specific range during a particular time window. All these can be done easily by using LINQ-query style operators provided by Rx. </p>
-<p>In this way, a function can take an event, process it, and then pass out the processed stream to an application. This gives you flexibility that is not available in the current programming model. Moreover, as Rx is performing all the plumbing work at the background for filtering, synchronizing, and transforming the data, your handler can just react to the data it receives and do something with it. This results in cleaner code that is easier to read and maintain. For more information on filtering, see Querying Observable Collections using LINQ Operators.</p>
-
-<h2>Manipulating Events</h2>
-<p>Rx represents events as a collection of objects: e.g., a OnMouseMove event contains a collection of Point values. Due to the first-class object nature of observables, they can be passed around as function parameters and returns, or stored in a variable.</p>
-
-<h1>Installing Rx</h1>
-<p>This topic describes where you can download the Reactive Extensions (Rx) SDK.</p>
-
-<h2>To download Rx</h2>
-<p>Reactive Extensions is available for different platforms such as C++, Javascript, .NET Framework 3.5, 4.0, 4.5, Silverlight 3 and 4, as well as Windows Phone 7 & 8. You can download the libraries, as well as learn about their prerequisites at the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center.</a></p>
-
-<h1>Differences Between Versions of Rx</h1>
-<p>The following topic describes the various platforms for which you can develop solutions using Reactive Extensions.</p>
-<p>To get the latest release of Rx, as well as learn about its prerequisites, please visit the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a>. </p>
-
-<h2>C++</h2>
-<p>The Reactive Extensions for C++ (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in C++.</p>
-
-<h2>Javascript</h2>
-<p>Rx for Javascript (RxJS) allows you to use LINQ operators in JavaScript. It provides easy-to-use conversions from existing DOM, XmlHttpRequest (AJAX), and jQuery events to push-based observable collections, allowing users to seamlessly integrate Rx into their existing JavaScript-based websites. </p>
-<p>RxJS brings similar capabilities to client script and integrates with jQuery events (Rx.Observable.FromJQueryEvent). It also supports Script#.</p>
-
-<h2>Ruby</h2>
-<p>Rx for Ruby (Rx.rb) allows you to use Linq operators to create push-based observable collections in Ruby.</p>
-
-<h2>Python</h2>
-<p>RX for Python (Rx.py) allows you to use Linq operators in Python. Rx.py allows you to implement push-based observable collections, allowing users to seamlessly integrate Rx into their existing Python applications.</p>
-
-<h2>.NET Framework</h2>
-<p>The core Rx interfaces, IObservable<T> and IObserver<T>, ship as part of .NET Framework 4. If you are running on .NET Framework 3.5 SP1, or if you want to take advantage of the LINQ operators implemented in Observable type, as well as many other features such as schedulers, you can download the Rx header-only library in the <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a>.</p>
-
-<h2>Silverlight </h2>
-<p>Silverlight disallows you from making cross-threading calls, thus you cannot use a background thread to update the UI. Instead of writing verbose code using the Dispatcher.BeginInvoke call to explicitly execute code on the main UI thread, you can use the factory Observable.Start method provided by the Rx header-only library to invoke an action asynchronously. Cross-threading is taken care of transparently by Rx under the hood.</p>
-<p>You can also use the various Observable operator overloads that take in a Scheduler, and specify the System.Reactive.Concurrency.DispatcherScheduler to be used.</p>
-
-<h2>Windows Phone</h2>
-<p>Windows Phone 7 ships with a version of the Reactive Extensions baked into the ROM of the device. For more information, see <a href="http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx">Reactive Extensions for .NET Overview for Windows Phone</a>. Documentation for this version of the Reactive Extensions can be found in Windows Phone API library at <a href="http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx">Microsoft.Phone.Reactive Namespace</a>. </p>
-<p>The <a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">Rx MSDN Developer Center</a> also contains an updated version of Rx for WP7, which has new definitions in the System.Reactive.Linq namespace. Note that the new APIs will not clash with the library built in to the phone (nor do they replace the version in the ROM). For more information on the differences of these 2 versions, see this <a href="http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx">Rx team blog post</a>.</p>
-<p>Rx is available for Windows Phone 8 as well as Windows Phone 7. A .NET portable library is available using Nuget that is useful for developing libraries that work on Windows Phone, Windows Store apps, and in classic Windows desktop or server applications.</p>
-
-<h1>Using Rx</h1>
-<p>This section includes topics that explain how you use Rx to create and subscribe to sequences, bridge existing events and existing asynchronous patterns, as well as using schedulers. It also describes more advanced tasks such as implementing your own operators.</p>
-
-<h3>In This Section</h3>
-<p>1. Exploring The Major Interfaces in Rx<br />
-2. Creating and Querying Event Streams<br />
-3. Subjects<br />
-6. Implementing your own operators for IObservable<br />
-7. Using Observable Providers</p>
-
-<h1>Exploring The Major Interfaces in Rx</h1>
-<p>This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them. </p>
-
-<h2>Observable/Observer</h2>
-<p>Rx exposes asynchronous and event-based data sources as push-based, observable sequences. This Observable class represents a data source that can be observed, meaning that it can send data to anyone who is interested. It maintains a list of dependent Observer implementations representing such interested listeners, and notifies them automatically of any state changes.</p>
-<p>As described in What is Rx, the other half of the push model is represented by the Observer class, which represents an observer who registers an interest through a subscription. Items are subsequently handed to the observer from the observable sequence to which it subscribes. </p>
-<p>In order to receive notifications from an observable collection, you use the subscribe method of Observable to hand it an Observer object. In return for this observer, the subscribe method returns a disposable object that acts as a handle for the subscription. This allows you to clean up the subscription after you are done. Calling dispose on this object detaches the observer from the source so that notifications are no longer delivered. As you can infer, in Rx you do not need to explicitly unsubscribe from an event. </p>
-<p>Observers support three publication events, reflected by the interface’s methods. OnNext can be called zero or more times, when the observable data source has data available. For example, an observable data source used for mouse move events can send out a Point object every time the mouse has moved. The other two methods are used to indicate completion or errors.</p>
-<p>The following lists the Observable/Observer definitions.</p>
-<pre><code>
-namespace rxcpp {
- template &lt;class T>
- struct subscriber
- {
- // observer&lt;T>
- void on_next(T);
- void on_error(std::exception_ptr);
- void on_completed();
-
- // composite_subscription
- bool is_subscribed();
- void unsubscribe();
- };
-
- template &lt;class T>
- struct observable
- {
- composite_subscription subscribe(subscriber&lt;T> out);
- };
-}
-</code></pre>
-<p>Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function.</p>
-<p>You can treat the observable sequence (such as a sequence of mouse-over events) as if it were a normal collection. Thus you can write LINQ queries over the collection to do things like filtering, grouping, composing, etc. To make observable sequences more useful, the Rx header-only library provides many factory LINQ operators so that you do not need to implement any of these on your own. This will be covered in the Querying Observable Collections using LINQ Operators topic.</p>
-
-<h3>See Also</h3>
-Creating and Subscribing to Simple Observable Sequences
-Querying Observable Collections using LINQ Operators
-
-<h1>Creating and Querying Observable Sequences</h1>
-<p>This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it. </p>
-
-<h3>In This Section</h3>
-<p>Creating and Subscribing to Simple Observable Sequences<br />
-Querying Observable Collections using LINQ Operators</p>
-
-<h1>Creating and Subscribing to Simple Observable Sequences</h1>
-<p>You do not need to implement the Observable interface manually to create an observable sequences. Similarly, you do not need to implement Observer either to subscribe to a sequence. By installing the Reactive Extension header-only library, you can take advantage of the Observable type which provides many LINQ operators for you to create a simple sequence with zero, one or more elements. In addition, Rx provides Subscribe methods that take various combinations of OnNext, OnError and OnCompleted handlers in terms of delegates.</p>
-
-<h2>Creating and subscribing to a simple sequence</h2>
-<p>The following sample uses the range operator of the Observable type to create a simple observable collection of numbers. The observer subscribes to this collection using the Subscribe method of the Observable class, and provides actions that are delegates which handle OnNext, OnCompleted and OnError. </p>
-<p>The range operator has several overloads. In our example, it creates a sequence of integers that starts with x and produces y sequential numbers afterwards. </p>
-<p>As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values.</p>
-<pre><code>
- auto values1 = rxcpp::observable&lt;>::range(1, 5);
- values1.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
-</code></pre>
-<p>When an observer subscribes to an observable sequence, the thread calling the subscribe method can be different from the thread in which the sequence runs till completion. Therefore, the subscribe call is asynchronous in that the caller is not blocked until the observation of the sequence completes. This will be covered in more details in the Using Schedulers topic.</p>
-<p>Notice that the subscribe method returns a Disposable, so that you can unsubscribe to a sequence and dispose of it easily. When you invoke the Dispose method on the observable sequence, the observer will stop listening to the observable for data. Normally, you do not need to explicitly call Dispose unless you need to unsubscribe early, or when the source observable sequence has a longer life span than the observer. Subscriptions in Rx are designed for fire-and-forget scenarios without the usage of a finalizer. When the Disposable instance is collected by the garbage collector, Rx does not automatically dispose of the subscription. However, note that the default behavior of the Observable operators is to dispose of the subscription as soon as possible (i.e, when an OnCompleted or OnError messages is published). </p>
-<p>In addition to creating an observable sequence from scratch, you can convert existing enumerators, C++ events and asynchronous patterns into observable sequences. The other topics in this section will show you how to do this. </p>
-<p>Notice that this topic only shows you a few operators that can create an observable sequence from scratch. To learn more about other LINQ operators, see Query Observable Collections using LINQ Operators.</p>
-
-<h2>Converting an Enumerable Collection to an Observable Sequence</h2>
-<p>Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it. </p>
-<pre><code>
- std::array&lt; int, 3 > a={{1, 2, 3}};
- auto values1 = rxcpp::observable&lt;>::iterate(a);
- values1.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
-</code></pre>
-
-<h3>See Also</h3>
-Query Observable Collections using LINQ Operators
-
-<h1>Querying Observable Sequences using LINQ Operators</h1>
-<p>We have converted existing C++ events into observable sequences to subscribe to them. In this topic, we will look at the first-class nature of observable sequences as Observable objects, in which generic LINQ operators are supplied by the Rx header-only library to manipulate these objects. Most operators take an observable sequence and perform some logic on it and output another observable sequence. In addition, as you can see from our code samples, you can even chain multiple operators on a source sequence to tweak the resulting sequence to your exact requirement. </p>
-
-<h2>Using Different Operators</h2>
-<p>We have already used the Create and Generate operators in previous topics to create and return simple sequences. In this topic, we will use other LINQ operators of the Observable type so that you can filter, group and transform data. Such operators take observable sequence(s) as input, and produce observable sequence(s) as output.</p>
-
-<h2>Combining different sequences</h2>
-<p>In this section, we will examine some of the operators that combine various observable sequences into a single observable sequence. Notice that data are not transformed when we combine sequences. </p>
-<p>In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it. </p>
-<pre><code>
- auto values = rxcpp::observable&lt;>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- take(3).
- map([](int prime) { return std::make_tuple("1:", prime);});
-
- auto s2 = values.
- take(3).
- map([](int prime) { return std::make_tuple("2:", prime);});
-
- s1.
- concat(s2).
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
-</code></pre>
-<p>Notice that the resultant sequence is </p>
-<pre>
-1: 1
-1: 2
-1: 3
-2: 1
-2: 2
-2: 3
-</pre>
-<p>This is because when you use the concat operator, the 2nd sequence (source2) will not be active until after the 1st sequence (source1) has finished pushing all its values. It is only after source1 has completed, then source2 will start to push values to the resultant sequence. The subscriber will then get all the values from the resultant sequence. </p>
-<p>Compare this with the merge operator. If you run the following sample code, you will get </p>
-<pre>
-1: 1
-2: 1
-1: 2
-2: 2
-1: 3
-2: 3
-</pre>
-<p>This is because the two sequences are active at the same time and values are pushed out as they occur in the sources. The resultant sequence only completes when the last source sequence has finished pushing values. </p>
-<p>Notice that for Merge to work, all the source observable sequences need to be of the same type of Observable. The resultant sequence will be of the type Observable. If source1 produces an OnError in the middle of the sequence, then the resultant sequence will complete immediately.</p>
-<pre><code>
- auto values = rxcpp::observable&lt;>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- map([](int prime) { return std::make_tuple("1:", prime);});
-
- auto s2 = values.
- map([](int prime) { return std::make_tuple("2:", prime);});
-
- s1.
- merge(s2).
- take(6).
- as_blocking().
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
-</code></pre>
-
-<h1>Subjects</h1>
-<p>This section describes the Subject type implemented by Reactive Extensions. It also describes various implementations of Subject which serves different purposes. </p>
-<h3>In This Section</h3>
-<p>1. Using Subjects</p>
-
-<h1>Using Subjects</h1>
-<p>The Subject type implements both Observable and Observer, in the sense that it is both an observer and an observable. You can use a subject to subscribe all the observers, and then subscribe the subject to a backend data source. In this way, the subject can act as a proxy for a group of subscribers and a source. You can use subjects to implement a custom observable with caching, buffering and time shifting. In addition, you can use subjects to broadcast data to multiple subscribers. </p>
-<p>By default, subjects do not perform any synchronization across threads. They do not take a scheduler but rather assume that all serialization and grammatical correctness are handled by the caller of the subject. A subject simply broadcasts to all subscribed observers in the thread-safe list of subscribers. Doing so has the advantage of reducing overhead and improving performance. If, however, you want to synchronize outgoing calls to observers using a scheduler, you can use the Synchronize method to do so.</p>
-
-<h2>Different types of Subjects</h2>
-<p>The Subject type in the Rx library is a basic implementation of the Subject interface (you can also implement the Subject interface to create your own subject types). There are other implementations of Subject that offer different functionalities. All of these types store some (or all of) values pushed to them via OnNext, and broadcast it back to its observers. This means that if you subscribe to any of these more than once (i.e. subscribe -> unsubscribe -> subscribe again), you will see at least one of the same value again. </p>
-
-<h1>Scheduling and Concurrency</h1>
-<p>This section describes how you can use a scheduler to control when to start a sequence or subscribe to an event. </p>
-
-<h1>Scheduler Types</h1>
-<p>The various Scheduler types provided by Rx are:</p>
-<p>ImmediateScheduler: Default scheduler, pushes notifications as they are recieved.</p>
-<p>EventLoopScheduler: Used when creating a separate thread for Rx sequences.</p>
-
-<h1>Using Schedulers</h1>
-<p>A scheduler controls when a subscription starts and when notifications are published. It consists of three components. It is first a data structure. When you schedule for tasks to be completed, they are put into the scheduler for queueing based on priority or other criteria. It also offers an execution context which denotes where the task is executed (e.g., in the thread pool, current thread, or in another app domain). Lastly, it has a clock which provides a notion of time for itself (by accessing the Now property of a scheduler). Tasks being scheduled on a particular scheduler will adhere to the time denoted by that clock only.</p>
-
-<h2>Using Schedulers</h2>
-<p>You may have already used schedulers in your Rx code without explicitly stating the type of schedulers to be used. This is because all Observable operators that deal with concurrency have multiple overloads. If you do not use the overload which takes a scheduler as an argument, Rx will pick a default scheduler by using the principle of least concurrency. This means that the scheduler which introduces the least amount of concurrency that satisfies the needs of the operator is chosen. For example, for operators returning an observable with a finite and small number of messages, Rx calls ImmediateScheduler. For operators returning a potentially large or infinite number of messages, CurrentThread is called.</p>
-<p>In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler.</p>
-<pre><code>
- auto threads = rxcpp::observe_on_event_loop();
-
- auto values = rxcpp::observable&lt;>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- subscribe_on(threads).
- map([](int prime) { std::this_thread::yield(); return std::make_tuple("1:", prime);});
-
- auto s2 = values.
- subscribe_on(threads).
- map([](int prime) { std::this_thread::yield(); return std::make_tuple("2:", prime);});
-
- s1.
- merge(s2).
- take(6).
- observe_on(threads).
- as_blocking().
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
-</code></pre>
-<p>This will queue up on the observer quickly. This code by uses the observe_on operator, which allows you to specify the context that you want to use to send pushed notifications (OnNext) to observers. By default, the observe_on operator ensures that OnNext will be called as many times as possible on the current thread. You can use its overloads and redirect the OnNext outputs to a different context. In addition, you can use the subscribe_on operator to return a proxy observable that delegates actions to a specific scheduler. For example, for a UI-intensive application, you can delegate all background operations to be performed on a scheduler running in the background by using subscribe_on and passing to it a Concurrency.EventLoopScheduler. </p>
-<p>You should also note that by using the observe_on operator, an action is scheduled for each message that comes through the original observable sequence. This potentially changes timing information as well as puts additional stress on the system. If you have a query that composes various observable sequences running on many different execution contexts, and you are doing filtering in the query, it is best to place observe_on later in the query. This is because a query will potentially filter out a lot of messages, and placing the observe_on operator earlier in the query would do extra work on messages that would be filtered out anyway. Calling the observe_on operator at the end of the query will create the least performance impact.</p>
-
-<h1>Implementing Your Own Operators for Observable</h1>
-<p>You can extend Rx by adding new operators for operations that are not provided by the LINQ library, or by creating your own implementation of standard query operators to improve readability and performance. Writing a customized version of a standard LINQ operator is useful when you want to operate with in-memory objects and when the intended customization does not require a comprehensive view of the query.</p>
-
-<h2>Creating New Operators</h2>
-<p>LINQ offers a full set of operators that cover most of the possible operations on a set of entities. However, you might need an operator to add a particular semantic meaning to your query—especially if you can reuse that same operator several times in your code. </p>
-<p>By reusing existing LINQ operators when you build a new one, you can take advantage of the existing performance or exception handling capabilities implemented in the Rx libraries.</p>
-<p>When writing a custom operator, it is good practice not to leave any disposables unused; otherwise, you may find that resources could actually be leaked and cancellation may not work correctly.</p>
-
-<h2>Customizing Existing Operators</h2>
-<p>Adding new operators to LINQ is a way to extend its capabilities. However, you can also improve code readability by wrapping existing operators into more specialized and meaningful ones.</p>
diff --git a/Rx/v2/examples/awaitable/CMakeLists.txt b/Rx/v2/examples/awaitable/CMakeLists.txt
deleted file mode 100644
index 8d919b0..0000000
--- a/Rx/v2/examples/awaitable/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS} /await)
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/awaitable/main.cpp b/Rx/v2/examples/awaitable/main.cpp
deleted file mode 100644
index 475fd23..0000000
--- a/Rx/v2/examples/awaitable/main.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include <rxcpp/rx-lite.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-
-#include <rxcpp/rx-coroutine.hpp>
-
-using namespace rxcpp;
-using namespace rxcpp::sources;
-using namespace rxcpp::operators;
-using namespace rxcpp::util;
-
-using namespace std;
-using namespace std::chrono;
-
-future<void> intervals(){
-
- {
- printf("early exit from interval on thread\n");
- for co_await (auto c : interval(seconds(1), observe_on_event_loop())) {
- printf("%d\n", c);
- break;
- }
- }
-
- {
- printf("interval on thread\n");
- for co_await (auto c : interval(seconds(1), observe_on_event_loop()) | take(3)) {
- printf("%d\n", c);
- }
- }
-
- {
- printf("current thread\n");
- int last = 0;
- for co_await (auto c : range(1, 100000)) {
- last = c;
- }
- printf("reached %d\n", last);
- }
-
- try {
- printf("error in observable\n");
- for co_await (auto c : error<long>(runtime_error("stopped by error"))) {
- printf("%d\n", c);
- }
- printf("not reachable\n");
- terminate();
- }
- catch(const exception& e) {
- printf("%s\n", e.what());
- }
-}
-
-int main()
-{
- intervals().get();
- return 0;
-}
diff --git a/Rx/v2/examples/cep/CMakeLists.txt b/Rx/v2/examples/cep/CMakeLists.txt
deleted file mode 100644
index c99c723..0000000
--- a/Rx/v2/examples/cep/CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT}
- PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
- )
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/cep/main.cpp b/Rx/v2/examples/cep/main.cpp
deleted file mode 100644
index 587595f..0000000
--- a/Rx/v2/examples/cep/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-#include "rxcpp/rx.hpp"
-// create alias' to simplify code
-// these are owned by the user so that
-// conflicts can be managed by the user.
-namespace rx=rxcpp;
-namespace rxsub=rxcpp::subjects;
-namespace rxu=rxcpp::util;
-
-#include <cctype>
-#include <clocale>
-
-// At this time, RxCpp will fail to compile if the contents
-// of the std namespace are merged into the global namespace
-// DO NOT USE: 'using namespace std;'
-
-int main()
-{
- auto keys = rx::observable<>::create<int>(
- [](rx::subscriber<int> dest){
- for (;;) {
- int key = std::cin.get();
- dest.on_next(key);
- }
- }).
- publish();
-
- auto a = keys.
- filter([](int key){return std::tolower(key) == 'a';});
-
- auto g = keys.
- filter([](int key){return std::tolower(key) == 'g';});
-
- a.merge(g).
- subscribe([](int key){
- std::cout << key << std::endl;
- });
-
- // run the loop in create
- keys.connect();
-
- return 0;
-}
diff --git a/Rx/v2/examples/doxygen/CMakeLists.txt b/Rx/v2/examples/doxygen/CMakeLists.txt
deleted file mode 100644
index d89b175..0000000
--- a/Rx/v2/examples/doxygen/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-file(GLOB SAMPLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/doxygen/all.cpp b/Rx/v2/examples/doxygen/all.cpp
deleted file mode 100644
index a5adb30..0000000
--- a/Rx/v2/examples/doxygen/all.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("all sample") {
- printf("//! [all sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).all([](int n) { return n < 6; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [all sample]\n");
-}
-
-SCENARIO("all - operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
-
- printf("//! [all - operator syntax sample]\n");
- auto values = range(1, 10)
- | all([](int n) { return n < 100; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [all - operator syntax sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/amb.cpp b/Rx/v2/examples/doxygen/amb.cpp
deleted file mode 100644
index eab7f7e..0000000
--- a/Rx/v2/examples/doxygen/amb.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("amb sample"){
- printf("//! [amb sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto values = o1.amb(o2, o3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [amb sample]\n");
-}
-
-SCENARIO("implicit amb sample"){
- printf("//! [implicit amb sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.amb();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [implicit amb sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded amb sample"){
- printf("//! [threaded amb sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
- printf("[thread %s] Timer2 fired\n", get_pid().c_str());
- return 2;
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto values = o1.amb(rxcpp::observe_on_new_thread(), o2, o3);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded amb sample]\n");
-}
-
-SCENARIO("threaded implicit amb sample"){
- printf("//! [threaded implicit amb sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
- printf("[thread %s] Timer2 fired\n", get_pid().c_str());
- return 2;
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.amb(rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded implicit amb sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/any.cpp b/Rx/v2/examples/doxygen/any.cpp
deleted file mode 100644
index 6530426..0000000
--- a/Rx/v2/examples/doxygen/any.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("any sample") {
- printf("//! [any sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).any([](int n) { return n > 3; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [any sample]\n");
-}
-
-SCENARIO("any - operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
-
- printf("//! [any - operator syntax sample]\n");
- auto values = range(1, 10)
- | any([](int n) { return n == 1; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [any - operator syntax sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/as_dynamic.cpp b/Rx/v2/examples/doxygen/as_dynamic.cpp
deleted file mode 100644
index 363ae57..0000000
--- a/Rx/v2/examples/doxygen/as_dynamic.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("as_dynamic sample"){
- printf("//! [as_dynamic sample]\n");
- auto o1 = rxcpp::observable<>::range(1, 3);
- auto o2 = rxcpp::observable<>::just(4);
- auto o3 = rxcpp::observable<>::empty<int>();
- auto values = o1.concat(o2, o3);
- printf("type of o1: %s\n", typeid(o1).name());
- printf("type of o1.as_dynamic(): %s\n", typeid(o1.as_dynamic()).name());
- printf("type of o2: %s\n", typeid(o2).name());
- printf("type of o2.as_dynamic(): %s\n", typeid(o2.as_dynamic()).name());
- printf("type of o3: %s\n", typeid(o3).name());
- printf("type of o3.as_dynamic(): %s\n", typeid(o3.as_dynamic()).name());
- printf("type of values: %s\n", typeid(values).name());
- printf("type of values.as_dynamic(): %s\n", typeid(values.as_dynamic()).name());
- printf("//! [as_dynamic sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/blocking_observable.cpp b/Rx/v2/examples/doxygen/blocking_observable.cpp
deleted file mode 100644
index eb9633f..0000000
--- a/Rx/v2/examples/doxygen/blocking_observable.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("blocking first sample"){
- printf("//! [blocking first sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).as_blocking();
- auto first = values.first();
- printf("first = %d\n", first);
- printf("//! [blocking first sample]\n");
-}
-
-SCENARIO("blocking first empty sample"){
- printf("//! [blocking first empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto first = values.first();
- printf("first = %d\n", first);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking first empty sample]\n");
-}
-
-SCENARIO("blocking first error sample"){
- printf("//! [blocking first error sample]\n");
- auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source")).
- as_blocking();
- try {
- auto first = values.first();
- printf("first = %d\n", first);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking first error sample]\n");
-}
-
-SCENARIO("blocking last sample"){
- printf("//! [blocking last sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).as_blocking();
- auto last = values.last();
- printf("last = %d\n", last);
- printf("//! [blocking last sample]\n");
-}
-
-SCENARIO("blocking last empty sample"){
- printf("//! [blocking last empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto last = values.last();
- printf("last = %d\n", last);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking last empty sample]\n");
-}
-
-SCENARIO("blocking last error sample"){
- printf("//! [blocking last error sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto last = values.last();
- printf("last = %d\n", last);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking last error sample]\n");
-}
-
-SCENARIO("blocking count sample"){
- printf("//! [blocking count sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).as_blocking();
- auto count = values.count();
- printf("count = %d\n", count);
- printf("//! [blocking count sample]\n");
-}
-
-SCENARIO("blocking count error sample"){
- printf("//! [blocking count error sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto count = values.count();
- printf("count = %d\n", count);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking count error sample]\n");
-}
-
-SCENARIO("blocking sum sample"){
- printf("//! [blocking sum sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).as_blocking();
- auto sum = values.sum();
- printf("sum = %d\n", sum);
- printf("//! [blocking sum sample]\n");
-}
-
-SCENARIO("blocking sum empty sample"){
- printf("//! [blocking sum empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto sum = values.sum();
- printf("sum = %d\n", sum);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking sum empty sample]\n");
-}
-
-SCENARIO("blocking sum error sample"){
- printf("//! [blocking sum error sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto sum = values.sum();
- printf("sum = %d\n", sum);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking sum error sample]\n");
-}
-
-SCENARIO("blocking average sample"){
- printf("//! [blocking average sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).as_blocking();
- auto average = values.average();
- printf("average = %lf\n", average);
- printf("//! [blocking average sample]\n");
-}
-
-SCENARIO("blocking average empty sample"){
- printf("//! [blocking average empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto average = values.average();
- printf("average = %lf\n", average);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking average empty sample]\n");
-}
-
-SCENARIO("blocking average error sample"){
- printf("//! [blocking average error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto average = values.average();
- printf("average = %lf\n", average);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking average error sample]\n");
-}
-
-SCENARIO("blocking max sample"){
- printf("//! [blocking max sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).as_blocking();
- auto max = values.max();
- printf("max = %d\n", max);
- printf("//! [blocking max sample]\n");
-}
-
-SCENARIO("blocking max empty sample"){
- printf("//! [blocking max empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto max = values.max();
- printf("max = %d\n", max);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking max empty sample]\n");
-}
-
-SCENARIO("blocking max error sample"){
- printf("//! [blocking max error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto max = values.max();
- printf("max = %d\n", max);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking max error sample]\n");
-}
-
-SCENARIO("blocking min sample"){
- printf("//! [blocking min sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).as_blocking();
- auto min = values.min();
- printf("min = %d\n", min);
- printf("//! [blocking min sample]\n");
-}
-
-SCENARIO("blocking min empty sample"){
- printf("//! [blocking min empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().as_blocking();
- try {
- auto min = values.min();
- printf("min = %d\n", min);
- } catch (const rxcpp::empty_error& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking min empty sample]\n");
-}
-
-SCENARIO("blocking min error sample"){
- printf("//! [blocking min error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- as_blocking();
- try {
- auto min = values.min();
- printf("min = %d\n", min);
- } catch (const std::exception& ex) {
- printf("Exception: %s\n", ex.what());
- }
- printf("//! [blocking min error sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/buffer.cpp b/Rx/v2/examples/doxygen/buffer.cpp
deleted file mode 100644
index 503db12..0000000
--- a/Rx/v2/examples/doxygen/buffer.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("buffer count sample"){
- printf("//! [buffer count sample]\n");
- auto values = rxcpp::observable<>::range(1, 5).buffer(2);
- values.
- subscribe(
- [](std::vector<int> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](int a){
- printf(" %d", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer count sample]\n");
-}
-
-SCENARIO("buffer count+skip sample"){
- printf("//! [buffer count+skip sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).buffer(2, 3);
- values.
- subscribe(
- [](std::vector<int> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](int a){
- printf(" %d", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer count+skip sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("buffer period+skip+coordination sample"){
- printf("//! [buffer period+skip+coordination sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto period = std::chrono::milliseconds(4);
- auto skip = std::chrono::milliseconds(6);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- map([](long v){
- printf("[thread %s] Interval OnNext: %ld\n", get_pid().c_str(), v);
- return v;
- }).
- take(7).
- buffer_with_time(period, skip, rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](std::vector<long> v){
- printf("[thread %s] OnNext:", get_pid().c_str());
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [buffer period+skip+coordination sample]\n");
-}
-
-SCENARIO("buffer period+skip sample"){
- printf("//! [buffer period+skip sample]\n");
- auto period = std::chrono::milliseconds(4);
- auto skip = std::chrono::milliseconds(6);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- buffer_with_time(period, skip);
- values.
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+skip sample]\n");
-}
-
-SCENARIO("buffer period+skip overlapping sample"){
- printf("//! [buffer period+skip overlapping sample]\n");
- auto period = std::chrono::milliseconds(6);
- auto skip = std::chrono::milliseconds(4);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- buffer_with_time(period, skip);
- values.
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+skip overlapping sample]\n");
-}
-
-SCENARIO("buffer period+skip empty sample"){
- printf("//! [buffer period+skip empty sample]\n");
- auto period = std::chrono::milliseconds(2);
- auto skip = std::chrono::milliseconds(4);
- auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
- buffer_with_time(period, skip);
- values.
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+skip empty sample]\n");
-}
-
-SCENARIO("buffer period+coordination sample"){
- printf("//! [buffer period+coordination sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- buffer_with_time(std::chrono::milliseconds(4), rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+coordination sample]\n");
-}
-
-SCENARIO("buffer period sample"){
- printf("//! [buffer period sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- buffer_with_time(std::chrono::milliseconds(4));
- values.
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period sample]\n");
-}
-
-SCENARIO("buffer period+count+coordination sample"){
- printf("//! [buffer period+count+coordination sample]\n");
- auto int1 = rxcpp::observable<>::range(1L, 3L);
- auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
- auto values = int1.
- concat(int2).
- buffer_with_time_or_count(std::chrono::milliseconds(20), 2, rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+count+coordination sample]\n");
-}
-
-SCENARIO("buffer period+count sample"){
- printf("//! [buffer period+count sample]\n");
- auto int1 = rxcpp::observable<>::range(1L, 3L);
- auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
- auto values = int1.
- concat(int2).
- buffer_with_time_or_count(std::chrono::milliseconds(20), 2);
- values.
- subscribe(
- [](std::vector<long> v){
- printf("OnNext:");
- std::for_each(v.begin(), v.end(), [](long a){
- printf(" %ld", a);
- });
- printf("\n");
- },
- [](){printf("OnCompleted\n");});
- printf("//! [buffer period+count sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/combine_latest.cpp b/Rx/v2/examples/doxygen/combine_latest.cpp
deleted file mode 100644
index 5f2168b..0000000
--- a/Rx/v2/examples/doxygen/combine_latest.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("combine_latest sample"){
- printf("//! [combine_latest sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.combine_latest(o2, o3);
- values.
- take(5).
- subscribe(
- [](std::tuple<int, int, int> v){printf("OnNext: %d, %d, %d\n", std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [combine_latest sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("Coordination combine_latest sample"){
- printf("//! [Coordination combine_latest sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto thr = rxcpp::synchronize_event_loop();
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).map([](int v) {
- printf("[thread %s] Source1 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3)).map([](int v) {
- printf("[thread %s] Source2 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5)).map([](int v) {
- printf("[thread %s] Source3 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto values = o1.combine_latest(thr, o2, o3);
- values.
- take(5).
- as_blocking().
- subscribe(
- [](std::tuple<int, int, int> v){printf("[thread %s] OnNext: %d, %d, %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [Coordination combine_latest sample]\n");
-}
-
-SCENARIO("Selector combine_latest sample"){
- printf("//! [Selector combine_latest sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.combine_latest(
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(5).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Selector combine_latest sample]\n");
-}
-
-SCENARIO("Coordination+Selector combine_latest sample"){
- printf("//! [Coordination+Selector combine_latest sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.combine_latest(
- rxcpp::observe_on_new_thread(),
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(5).
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Coordination+Selector combine_latest sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/composite_exception.cpp b/Rx/v2/examples/doxygen/composite_exception.cpp
deleted file mode 100644
index 00f351d..0000000
--- a/Rx/v2/examples/doxygen/composite_exception.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("composite_exception sample"){
- printf("//! [composite_exception sample]\n");
- auto o1 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source o1\n"));
- auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source o2\n"));
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto values = o1.merge_delay_error(o2, o3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr composite_e) {
- printf("OnError %s\n", rxu::what(composite_e).c_str());
- try { std::rethrow_exception(composite_e); }
- catch(rxcpp::composite_exception const &ce) {
- for(std::exception_ptr particular_e : ce.exceptions) {
-
- try{ std::rethrow_exception(particular_e); }
- catch(std::runtime_error const &error) { printf(" *** %s\n", error.what()); }
-
- }
- }
- },
- [](){printf("OnCompleted\n");}
- );
- printf("//! [composite_exception sample]\n");
-}
-#endif
diff --git a/Rx/v2/examples/doxygen/concat.cpp b/Rx/v2/examples/doxygen/concat.cpp
deleted file mode 100644
index 3c34868..0000000
--- a/Rx/v2/examples/doxygen/concat.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("concat sample"){
- printf("//! [concat sample]\n");
- auto o1 = rxcpp::observable<>::range(1, 3);
- auto o2 = rxcpp::observable<>::just(4);
- auto o3 = rxcpp::observable<>::from(5, 6);
- auto values = o1.concat(o2, o3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [concat sample]\n");
-}
-
-SCENARIO("implicit concat sample"){
- printf("//! [implicit concat sample]\n");
- auto o1 = rxcpp::observable<>::range(1, 3);
- auto o2 = rxcpp::observable<>::just(4);
- auto o3 = rxcpp::observable<>::from(5, 6);
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.concat();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [implicit concat sample]\n");
-}
-
-SCENARIO("threaded concat sample"){
- printf("//! [threaded concat sample]\n");
- auto o1 = rxcpp::observable<>::range(1, 3);
- auto o2 = rxcpp::observable<>::just(4);
- auto o3 = rxcpp::observable<>::from(5, 6);
- auto values = o1.concat(rxcpp::observe_on_new_thread(), o2, o3);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded concat sample]\n");
-}
-
-SCENARIO("threaded implicit concat sample"){
- printf("//! [threaded implicit concat sample]\n");
- auto o1 = rxcpp::observable<>::range(1, 3);
- auto o2 = rxcpp::observable<>::just(4);
- auto o3 = rxcpp::observable<>::from(5, 6);
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.concat(rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded implicit concat sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/concat_map.cpp b/Rx/v2/examples/doxygen/concat_map.cpp
deleted file mode 100644
index a087431..0000000
--- a/Rx/v2/examples/doxygen/concat_map.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("concat_map sample"){
- printf("//! [concat_map sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat_map(
- [](int v){
- return
- rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
- take(3);
- },
- [](int v_main, long v_sub){
- return std::make_tuple(v_main, v_sub);
- });
- values.
- subscribe(
- [](std::tuple<int, long> v){printf("OnNext: %d - %ld\n", std::get<0>(v), std::get<1>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [concat_map sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded concat_map sample"){
- printf("//! [threaded concat_map sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3).
- concat_map(
- [](int v){
- printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
- return
- rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
- take(3);
- },
- [](int v_main, long v_sub){
- printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %ld)\n", get_pid().c_str(), v_main, v_sub);
- return std::make_tuple(v_main, v_sub);
- },
- rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %ld\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded concat_map sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/contains.cpp b/Rx/v2/examples/doxygen/contains.cpp
deleted file mode 100644
index 6e59649..0000000
--- a/Rx/v2/examples/doxygen/contains.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("contains sample") {
- printf("//! [contains sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).contains(3);
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [contains sample]\n");
-}
-
-SCENARIO("contains - operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
-
- printf("//! [contains - operator syntax sample]\n");
- auto values = range(1, 10)
- | contains(2);
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [contains - operator syntax sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/create.cpp b/Rx/v2/examples/doxygen/create.cpp
deleted file mode 100644
index 1f707c6..0000000
--- a/Rx/v2/examples/doxygen/create.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("Create sample"){
- printf("//! [Create sample]\n");
- auto ints = rxcpp::observable<>::create<int>(
- [](rxcpp::subscriber<int> s){
- s.on_next(1);
- s.on_next(2);
- s.on_completed();
- });
-
- ints.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Create sample]\n");
-}
-
-SCENARIO("Create bad code"){
- printf("//! [Create bad code]\n");
- auto subscription = rxcpp::composite_subscription();
- auto subscriber = rxcpp::make_subscriber<int>(
- subscription,
- [&](int v){
- printf("OnNext: %d\n", v);
- if (v == 2)
- subscription.unsubscribe();
- },
- [](){
- printf("OnCompleted\n");
- });
- rxcpp::observable<>::create<int>(
- [](rxcpp::subscriber<int> s){
- for (int i = 0; i < 5; ++i) {
- s.on_next(i);
- printf("Just sent: OnNext(%d)\n", i);
- }
- s.on_completed();
- printf("Just sent: OnCompleted()\n");
- }).subscribe(subscriber);
- printf("//! [Create bad code]\n");
-}
-
-SCENARIO("Create good code"){
- printf("//! [Create good code]\n");
- auto subscription = rxcpp::composite_subscription();
- auto subscriber = rxcpp::make_subscriber<int>(
- subscription,
- [&](int v){
- printf("OnNext: %d\n", v);
- if (v == 2)
- subscription.unsubscribe();
- },
- [](){
- printf("OnCompleted\n");
- });
- rxcpp::observable<>::create<int>(
- [](rxcpp::subscriber<int> s){
- for (int i = 0; i < 5; ++i) {
- if (!s.is_subscribed()) // Stop emitting if nobody is listening
- break;
- s.on_next(i);
- printf("Just sent: OnNext(%d)\n", i);
- }
- s.on_completed();
- printf("Just sent: OnCompleted()\n");
- }).subscribe(subscriber);
- printf("//! [Create good code]\n");
-}
-
-SCENARIO("Create great code"){
- printf("//! [Create great code]\n");
- auto ints = rxcpp::observable<>::create<int>(
- [](rxcpp::subscriber<int> s){
- for (int i = 0; i < 5; ++i) {
- if (!s.is_subscribed()) // Stop emitting if nobody is listening
- break;
- s.on_next(i);
- printf("Just sent: OnNext(%d)\n", i);
- }
- s.on_completed();
- printf("Just sent: OnCompleted()\n");
- });
- ints.
- take(2).
- subscribe(
- [](int v){
- printf("OnNext: %d\n", v);
- },
- [](rxcpp::util::error_ptr ep){
- printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
- },
- [](){
- printf("OnCompleted\n");
- });
- printf("//! [Create great code]\n");
-}
diff --git a/Rx/v2/examples/doxygen/debounce.cpp b/Rx/v2/examples/doxygen/debounce.cpp
deleted file mode 100644
index b90183d..0000000
--- a/Rx/v2/examples/doxygen/debounce.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("debounce sample"){
- printf("//! [debounce sample]\n");
- using namespace std::chrono;
- auto scheduler = rxcpp::identity_current_thread();
- auto start = scheduler.now();
- auto period = milliseconds(10);
- auto values = rxcpp::observable<>::interval(start, period, scheduler).
- take(4).
- debounce(period);
- values.
- subscribe(
- [](long v) { printf("OnNext: %ld\n", v); },
- []() { printf("OnCompleted\n"); });
- printf("//! [debounce sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/default_if_empty.cpp b/Rx/v2/examples/doxygen/default_if_empty.cpp
deleted file mode 100644
index 9ac8e64..0000000
--- a/Rx/v2/examples/doxygen/default_if_empty.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("default_if_empty sample"){
- printf("//! [default_if_empty sample]\n");
-
- auto values = rxcpp::observable<>::empty<int>()
- .default_if_empty(42);
-
- values.subscribe(
- [](int v) { printf("OnNext: %d\n", v); },
- []() { printf("OnCompleted\n"); } );
-
- printf("//! [default_if_empty sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/defer.cpp b/Rx/v2/examples/doxygen/defer.cpp
deleted file mode 100644
index 395661b..0000000
--- a/Rx/v2/examples/doxygen/defer.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("defer sample"){
- printf("//! [defer sample]\n");
- auto observable_factory = [](){return rxcpp::observable<>::range(1, 3);};
- auto values = rxcpp::observable<>::defer(observable_factory);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [defer sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/delay.cpp b/Rx/v2/examples/doxygen/delay.cpp
deleted file mode 100644
index 0dd97a5..0000000
--- a/Rx/v2/examples/doxygen/delay.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("delay period+coordination sample"){
- printf("//! [delay period+coordination sample]\n");
- using namespace std::chrono;
- auto scheduler = rxcpp::identity_current_thread();
- auto start = scheduler.now();
- auto period = milliseconds(10);
- const auto next = [=](const char* s) {
- return [=](long v){
- auto t = duration_cast<milliseconds>(scheduler.now() - start);
- long long int ms = t.count();
- printf("[%s @ %lld] OnNext: %ld\n", s, ms, v);
- };
- };
- auto values = rxcpp::observable<>::interval(start, period, scheduler).
- take(4).
- tap(next("interval")).
- delay(period, rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- next(" delayed"),
- [](){printf("OnCompleted\n");});
- printf("//! [delay period+coordination sample]\n");
-}
-
-SCENARIO("delay period sample"){
- printf("//! [delay period sample]\n");
- using namespace std::chrono;
- auto scheduler = rxcpp::identity_current_thread();
- auto start = scheduler.now();
- auto period = milliseconds(10);
- const auto next = [=](const char* s) {
- return [=](long v){
- auto t = duration_cast<milliseconds>(scheduler.now() - start);
- long long int ms = t.count();
- printf("[%s @ %lld] OnNext: %ld\n", s, ms, v);
- };
- };
- auto values = rxcpp::observable<>::interval(start, period, scheduler).
- take(4).
- tap(next("interval")).
- delay(period);
- values.
- subscribe(
- next(" delayed"),
- [](){printf("OnCompleted\n");});
- printf("//! [delay period sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/distinct.cpp b/Rx/v2/examples/doxygen/distinct.cpp
deleted file mode 100644
index 20443fb..0000000
--- a/Rx/v2/examples/doxygen/distinct.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("distinct sample"){
- printf("//! [distinct sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 2, 3, 3, 3, 4, 5, 5).distinct();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [distinct sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/distinct_until_changed.cpp b/Rx/v2/examples/doxygen/distinct_until_changed.cpp
deleted file mode 100644
index 9422b21..0000000
--- a/Rx/v2/examples/doxygen/distinct_until_changed.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("distinct_until_changed sample"){
- printf("//! [distinct_until_changed sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 2, 3, 3, 3, 4, 5, 5).distinct_until_changed();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [distinct_until_changed sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/element_at.cpp b/Rx/v2/examples/doxygen/element_at.cpp
deleted file mode 100644
index 0b52776..0000000
--- a/Rx/v2/examples/doxygen/element_at.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("element_at sample"){
- printf("//! [element_at sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).element_at(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [element_at sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/empty.cpp b/Rx/v2/examples/doxygen/empty.cpp
deleted file mode 100644
index 1ace4eb..0000000
--- a/Rx/v2/examples/doxygen/empty.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("empty sample"){
- printf("//! [empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [empty sample]\n");
-}
-
-SCENARIO("threaded empty sample"){
- printf("//! [threaded empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>(rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded empty sample]\n");
-}
-
-SCENARIO("empty operator syntax sample"){
- using namespace rxcpp::sources;
-
- printf("//! [empty operator syntax sample]\n");
- auto values = empty<int>();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [empty operator syntax sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/error.cpp b/Rx/v2/examples/doxygen/error.cpp
deleted file mode 100644
index 87b5b78..0000000
--- a/Rx/v2/examples/doxygen/error.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("error sample"){
- printf("//! [error sample]\n");
- auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"));
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](rxcpp::util::error_ptr ep){
- printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
- },
- [](){printf("OnCompleted\n");});
- printf("//! [error sample]\n");
-}
-
-SCENARIO("threaded error sample"){
- printf("//! [threaded error sample]\n");
- auto values = rxcpp::observable<>::error<int>(std::runtime_error("Error from source"), rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](rxcpp::util::error_ptr ep){
- printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
- },
- [](){printf("OnCompleted\n");});
- printf("//! [threaded error sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/exists.cpp b/Rx/v2/examples/doxygen/exists.cpp
deleted file mode 100644
index 6e4d249..0000000
--- a/Rx/v2/examples/doxygen/exists.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("exists sample") {
- printf("//! [exists sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).exists([](int n) { return n > 3; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [exists sample]\n");
-}
-
-SCENARIO("exists - operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
-
- printf("//! [exists - operator syntax sample]\n");
- auto values = range(1, 10)
- | exists([](int n) { return n == 1; });
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [exists - operator syntax sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/filter.cpp b/Rx/v2/examples/doxygen/filter.cpp
deleted file mode 100644
index 36a1f49..0000000
--- a/Rx/v2/examples/doxygen/filter.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("filter sample"){
- printf("//! [filter sample]\n");
- auto values = rxcpp::observable<>::range(1, 6).
- filter([](int v){
- return v % 2;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [filter sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/finally.cpp b/Rx/v2/examples/doxygen/finally.cpp
deleted file mode 100644
index 253d3a9..0000000
--- a/Rx/v2/examples/doxygen/finally.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("finally sample"){
- printf("//! [finally sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- finally([](){
- printf("The final action\n");
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [finally sample]\n");
-}
-
-SCENARIO("error finally sample"){
- printf("//! [error finally sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- finally([](){
- printf("The final action\n");
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](rxcpp::util::error_ptr ep){
- printf("OnError: %s\n", rxcpp::util::what(ep).c_str());
- },
- [](){printf("OnCompleted\n");});
- printf("//! [error finally sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/flat_map.cpp b/Rx/v2/examples/doxygen/flat_map.cpp
deleted file mode 100644
index 3e0a09f..0000000
--- a/Rx/v2/examples/doxygen/flat_map.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("flat_map sample"){
- printf("//! [flat_map sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- flat_map(
- [](int v){
- return
- rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
- take(3);
- },
- [](int v_main, long v_sub){
- return std::make_tuple(v_main, v_sub);
- });
- values.
- subscribe(
- [](std::tuple<int, long> v){printf("OnNext: %d - %ld\n", std::get<0>(v), std::get<1>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [flat_map sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded flat_map sample"){
- printf("//! [threaded flat_map sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3).
- flat_map(
- [](int v){
- printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
- return
- rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
- take(3);
- },
- [](int v_main, int v_sub){
- printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %d)\n", get_pid().c_str(), v_main, v_sub);
- return std::make_tuple(v_main, v_sub);
- },
- rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %ld\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded flat_map sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/from.cpp b/Rx/v2/examples/doxygen/from.cpp
deleted file mode 100644
index 7cc2276..0000000
--- a/Rx/v2/examples/doxygen/from.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("from sample"){
- printf("//! [from sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [from sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded from sample"){
- printf("//! [threaded from sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::from(rxcpp::observe_on_new_thread(), 1, 2, 3).map([](int v){
- printf("[thread %s] Emit value: %d\n", get_pid().c_str(), v);
- return v;
- });
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded from sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/group_by.cpp b/Rx/v2/examples/doxygen/group_by.cpp
deleted file mode 100644
index 74ef859..0000000
--- a/Rx/v2/examples/doxygen/group_by.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include <sstream>
-
-SCENARIO("group_by sample"){
- printf("//! [group_by sample]\n");
- auto values = rxcpp::observable<>::range(0, 8).
- group_by(
- [](int v){return v % 3;},
- [](int v){return 10 * v;});
- values.
- subscribe(
- [](rxcpp::grouped_observable<int, int> g){
- auto key = g.get_key();
- printf("OnNext: key = %d\n", key);
- g.subscribe(
- [key](int v){printf("[key %d] OnNext: %d\n", key, v);},
- [key](){printf("[key %d] OnCompleted\n", key);});
- },
- [](){printf("OnCompleted\n");});
- printf("//! [group_by sample]\n");
-}
-
-//! [group_by full intro]
-static bool less(int v1, int v2){
- return v1 < v2;
-}
-//! [group_by full intro]
-
-SCENARIO("group_by full sample"){
- printf("//! [group_by full sample]\n");
- auto data = rxcpp::observable<>::range(0, 8).
- map([](int v){
- std::stringstream s;
- s << "Value " << v;
- return std::make_pair(v % 3, s.str());
- });
- auto values = data.group_by(
- [](std::pair<int, std::string> v){return v.first;},
- [](std::pair<int, std::string> v){return v.second;},
- less);
- values.
- subscribe(
- [](rxcpp::grouped_observable<int, std::string> g){
- auto key = g.get_key();
- printf("OnNext: key = %d\n", key);
- g.subscribe(
- [key](const std::string& v){printf("[key %d] OnNext: %s\n", key, v.c_str());},
- [key](){printf("[key %d] OnCompleted\n", key);});
- },
- [](){printf("OnCompleted\n");});
- printf("//! [group_by full sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/ignore_elements.cpp b/Rx/v2/examples/doxygen/ignore_elements.cpp
deleted file mode 100644
index 86fc2df..0000000
--- a/Rx/v2/examples/doxygen/ignore_elements.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("ignore_elements sample"){
- printf("//! [ignore_elements sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).ignore_elements();
- values.
- subscribe(
- [](int v) { printf("OnNext: %d\n", v); },
- []() { printf("OnCompleted\n"); });
- printf("//! [ignore_elements sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/interval.cpp b/Rx/v2/examples/doxygen/interval.cpp
deleted file mode 100644
index c7a87dd..0000000
--- a/Rx/v2/examples/doxygen/interval.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("immediate interval sample"){
- printf("//! [immediate interval sample]\n");
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::interval(period);
- values.
- take(3).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [immediate interval sample]\n");
-}
-
-SCENARIO("threaded immediate interval sample"){
- printf("//! [threaded immediate interval sample]\n");
- auto scheduler = rxcpp::identity_current_thread();
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::interval(period, scheduler);
- values.
- take(3).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded immediate interval sample]\n");
-}
-
-SCENARIO("interval sample"){
- printf("//! [interval sample]\n");
- auto start = std::chrono::steady_clock::now() + std::chrono::milliseconds(1);
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::interval(start, period);
- values.
- take(3).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [interval sample]\n");
-}
-
-SCENARIO("threaded interval sample"){
- printf("//! [threaded interval sample]\n");
- auto scheduler = rxcpp::identity_current_thread();
- auto start = scheduler.now() + std::chrono::milliseconds(1);
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::interval(start, period, scheduler);
- values.
- take(3).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded interval sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/is_empty.cpp b/Rx/v2/examples/doxygen/is_empty.cpp
deleted file mode 100644
index 813fff5..0000000
--- a/Rx/v2/examples/doxygen/is_empty.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("is_empty sample") {
- printf("//! [is_empty sample]\n");
- auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).is_empty();
- values.
- subscribe(
- [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
- []() { printf("OnCompleted\n"); });
- printf("//! [is_empty sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/iterate.cpp b/Rx/v2/examples/doxygen/iterate.cpp
deleted file mode 100644
index 889820f..0000000
--- a/Rx/v2/examples/doxygen/iterate.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("iterate sample"){
- printf("//! [iterate sample]\n");
- std::array< int, 3 > a={{1, 2, 3}};
- auto values = rxcpp::observable<>::iterate(a);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [iterate sample]\n");
-}
-
-SCENARIO("threaded iterate sample"){
- printf("//! [threaded iterate sample]\n");
- std::array< int, 3 > a={{1, 2, 3}};
- auto values = rxcpp::observable<>::iterate(a, rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded iterate sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/just.cpp b/Rx/v2/examples/doxygen/just.cpp
deleted file mode 100644
index 115f6be..0000000
--- a/Rx/v2/examples/doxygen/just.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("just sample"){
- printf("//! [just sample]\n");
- auto values = rxcpp::observable<>::just(1);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [just sample]\n");
-}
-
-SCENARIO("threaded just sample"){
- printf("//! [threaded just sample]\n");
- auto values = rxcpp::observable<>::just(1, rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded just sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/main.cpp b/Rx/v2/examples/doxygen/main.cpp
deleted file mode 100644
index 4da59c5..0000000
--- a/Rx/v2/examples/doxygen/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
-
-#include <iostream>
-#include <thread>
-#include <string>
-
-#include "main.hpp"
-
-std::string get_pid() {
- std::stringstream s;
- s << std::this_thread::get_id();
- return s.str();
-}
diff --git a/Rx/v2/examples/doxygen/main.hpp b/Rx/v2/examples/doxygen/main.hpp
deleted file mode 100644
index 7439c6a..0000000
--- a/Rx/v2/examples/doxygen/main.hpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-std::string get_pid();
diff --git a/Rx/v2/examples/doxygen/map.cpp b/Rx/v2/examples/doxygen/map.cpp
deleted file mode 100644
index 8db5030..0000000
--- a/Rx/v2/examples/doxygen/map.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("map sample"){
- printf("//! [map sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- map([](int v){
- return 2 * v;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [map sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/math.cpp b/Rx/v2/examples/doxygen/math.cpp
deleted file mode 100644
index d430953..0000000
--- a/Rx/v2/examples/doxygen/math.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("first sample"){
- printf("//! [first sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).first();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [first sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("first empty sample"){
- printf("//! [first empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().first();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [first empty sample]\n");
-}
-#endif
-
-SCENARIO("last sample"){
- printf("//! [last sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).last();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [last sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("last empty sample"){
- printf("//! [last empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().last();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [last empty sample]\n");
-}
-#endif
-
-SCENARIO("count sample"){
- printf("//! [count sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).count();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [count sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("count error sample"){
- printf("//! [count error sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- count();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::runtime_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [count error sample]\n");
-}
-#endif
-
-SCENARIO("sum sample"){
- printf("//! [sum sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).sum();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [sum sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("sum empty sample"){
- printf("//! [sum empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().sum();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [sum empty sample]\n");
-}
-#endif
-
-SCENARIO("sum error sample"){
- printf("//! [sum error sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- sum();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::runtime_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [sum error sample]\n");
-}
-
-SCENARIO("average sample"){
- printf("//! [average sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).average();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [average sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("average empty sample"){
- printf("//! [average empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().average();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [average empty sample]\n");
-}
-#endif
-
-SCENARIO("average error sample"){
- printf("//! [average error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- average();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::runtime_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [average error sample]\n");
-}
-
-SCENARIO("max sample"){
- printf("//! [max sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).max();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [max sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("max empty sample"){
- printf("//! [max empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().max();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [max empty sample]\n");
-}
-#endif
-
-SCENARIO("max error sample"){
- printf("//! [max error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- max();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::runtime_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [max error sample]\n");
-}
-
-SCENARIO("min sample"){
- printf("//! [min sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).min();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [min sample]\n");
-}
-
-#if RXCPP_USE_EXCEPTIONS
-SCENARIO("min empty sample"){
- printf("//! [min empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().min();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const rxcpp::empty_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [min empty sample]\n");
-}
-#endif
-
-SCENARIO("min error sample"){
- printf("//! [min error sample]\n");
- auto values = rxcpp::observable<>::range(1, 4).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- min();
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::runtime_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [min error sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/merge.cpp b/Rx/v2/examples/doxygen/merge.cpp
deleted file mode 100644
index 008c378..0000000
--- a/Rx/v2/examples/doxygen/merge.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("merge sample"){
- printf("//! [merge sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto values = o1.merge(o2, o3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [merge sample]\n");
-}
-
-SCENARIO("implicit merge sample"){
- printf("//! [implicit merge sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {return 2;});
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.merge();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [implicit merge sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded merge sample"){
- printf("//! [threaded merge sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).map([](int) {
- printf("[thread %s] Timer2 fired\n", get_pid().c_str());
- return 2;
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](int) {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto values = o1.merge(rxcpp::observe_on_new_thread(), o2, o3);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded merge sample]\n");
-}
-
-SCENARIO("threaded implicit merge sample"){
- printf("//! [threaded implicit merge sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](int) {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).map([](int) {
- printf("[thread %s] Timer2 fired\n", get_pid().c_str());
- return 2;
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](int) {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.merge(rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded implicit merge sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/merge_delay_error.cpp b/Rx/v2/examples/doxygen/merge_delay_error.cpp
deleted file mode 100644
index ae75926..0000000
--- a/Rx/v2/examples/doxygen/merge_delay_error.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include <sstream>
-
-SCENARIO("merge_delay_error sample"){
- printf("//! [merge_delay_error sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source\n"));
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto values = o1.merge_delay_error(o2, o3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr eptr) { printf("OnError %s\n", rxu::what(eptr).c_str()); },
- [](){printf("OnCompleted\n");});
- printf("//! [merge_delay_error sample]\n");
-}
-
-SCENARIO("implicit merge_delay_error sample"){
- printf("//! [implicit merge_delay_error sample]\n");
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(15)).map([](int) {return 1;});
- auto o2 = rxcpp::observable<>::error<int>(std::runtime_error("Error from source\n"));
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(5)).map([](int) {return 3;});
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.merge();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr eptr) { printf("OnError %s\n", rxu::what(eptr).c_str()); },
- [](){printf("OnCompleted\n");});
- printf("//! [implicit merge_delay_error sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded merge_delay_error sample"){
- printf("//! [threaded merge_delay_error sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](long) -> long {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).flat_map([](long) -> rxcpp::observable<long> {
- std::stringstream ss;
- ss << "[thread " << get_pid().c_str() << "] Timer2 failed\n";
- printf("%s\n", ss.str().c_str());
- ss.str(std::string());
- ss << "(Error from thread: " << get_pid().c_str() << ")\n";
- return rxcpp::observable<>::error<long>(std::runtime_error(ss.str()));
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](long) -> long {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto values = o1.merge(rxcpp::observe_on_new_thread(), o2, o3);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](std::exception_ptr eptr) { printf("[thread %s] OnError %s\n", get_pid().c_str(), rxu::what(eptr).c_str()); },
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded merge_delay_error sample]\n");
-}
-
-SCENARIO("threaded implicit merge_delay_error sample"){
- printf("//! [threaded implicit merge_delay_error sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto o1 = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).map([](long) -> long {
- printf("[thread %s] Timer1 fired\n", get_pid().c_str());
- return 1;
- });
- auto o2 = rxcpp::observable<>::timer(std::chrono::milliseconds(20)).flat_map([](long) -> rxcpp::observable<long> {
- std::stringstream ss;
- ss << "[thread " << get_pid().c_str() << "] Timer2 failed\n";
- printf("%s\n", ss.str().c_str());
- ss.str(std::string());
- ss << "(Error from thread: " << get_pid().c_str() << ")\n";
- return rxcpp::observable<>::error<long>(std::runtime_error(ss.str()));
- });
- auto o3 = rxcpp::observable<>::timer(std::chrono::milliseconds(30)).map([](long) -> long {
- printf("[thread %s] Timer3 fired\n", get_pid().c_str());
- return 3;
- });
- auto base = rxcpp::observable<>::from(o1.as_dynamic(), o2, o3);
- auto values = base.merge(rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
- [](std::exception_ptr eptr) { printf("[thread %s] OnError %s\n", get_pid().c_str(), rxu::what(eptr).c_str()); },
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded implicit merge_delay_error sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/never.cpp b/Rx/v2/examples/doxygen/never.cpp
deleted file mode 100644
index b6d7681..0000000
--- a/Rx/v2/examples/doxygen/never.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("never sample"){
- printf("//! [never sample]\n");
- auto values = rxcpp::observable<>::never<int>();
- values.
- take_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(10)).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [never sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/observe_on.cpp b/Rx/v2/examples/doxygen/observe_on.cpp
deleted file mode 100644
index 9046999..0000000
--- a/Rx/v2/examples/doxygen/observe_on.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include "main.hpp"
-
-SCENARIO("observe_on sample"){
- printf("//! [observe_on sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3).
- map([](int v){
- printf("[thread %s] Emit value %d\n", get_pid().c_str(), v);
- return v;
- });
- values.
- observe_on(rxcpp::synchronize_new_thread()).
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [observe_on sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/on_error_resume_next.cpp b/Rx/v2/examples/doxygen/on_error_resume_next.cpp
deleted file mode 100644
index 0c9873b..0000000
--- a/Rx/v2/examples/doxygen/on_error_resume_next.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("on_error_resume_next sample"){
- printf("//! [on_error_resume_next sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- on_error_resume_next([](std::exception_ptr ep){
- printf("Resuming after: %s\n", rxu::what(ep).c_str());
- return rxcpp::observable<>::just(-1);
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- printf("OnError: %s\n", rxu::what(ep).c_str());
- },
- [](){printf("OnCompleted\n");});
- printf("//! [on_error_resume_next sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/pairwise.cpp b/Rx/v2/examples/doxygen/pairwise.cpp
deleted file mode 100644
index 3133679..0000000
--- a/Rx/v2/examples/doxygen/pairwise.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("pairwise sample"){
- printf("//! [pairwise sample]\n");
- auto values = rxcpp::observable<>::range(1, 5).pairwise();
- values.
- subscribe(
- [](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [pairwise sample]\n");
-}
-
-SCENARIO("pairwise short sample"){
- printf("//! [pairwise short sample]\n");
- auto values = rxcpp::observable<>::just(1).pairwise();
- values.
- subscribe(
- [](std::tuple<int, int> v){printf("OnNext: %d, %d\n", std::get<0>(v), std::get<1>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [pairwise short sample]\n");
-}
-
-//#include "main.hpp"
-//
-//SCENARIO("threaded flat_map sample"){
-// printf("//! [threaded flat_map sample]\n");
-// printf("[thread %s] Start task\n", get_pid().c_str());
-// auto values = rxcpp::observable<>::range(1, 3).
-// flat_map(
-// [](int v){
-// printf("[thread %s] Call CollectionSelector(v = %d)\n", get_pid().c_str(), v);
-// return
-// rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(10 * v), std::chrono::milliseconds(50)).
-// take(3);
-// },
-// [](int v_main, int v_sub){
-// printf("[thread %s] Call ResultSelector(v_main = %d, v_sub = %d)\n", get_pid().c_str(), v_main, v_sub);
-// return std::make_tuple(v_main, v_sub);
-// },
-// rxcpp::observe_on_new_thread());
-// values.
-// as_blocking().
-// subscribe(
-// [](std::tuple<int, long> v){printf("[thread %s] OnNext: %d - %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v));},
-// [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
-// printf("[thread %s] Finish task\n", get_pid().c_str());
-// printf("//! [threaded flat_map sample]\n");
-//}
diff --git a/Rx/v2/examples/doxygen/publish.cpp b/Rx/v2/examples/doxygen/publish.cpp
deleted file mode 100644
index 6c348a2..0000000
--- a/Rx/v2/examples/doxygen/publish.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include <atomic>
-#include <array>
-
-SCENARIO("publish_synchronized sample"){
- printf("//! [publish_synchronized sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
- take(5).
- publish_synchronized(rxcpp::observe_on_new_thread());
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Another subscription from the beginning
- values.subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
- values.subscribe(
- [](long v){printf("[3] OnNext: %ld\n", v);},
- [](){printf("[3] OnCompleted\n");});
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("//! [publish_synchronized sample]\n");
-}
-
-SCENARIO("publish subject sample"){
- printf("//! [publish subject sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- publish();
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Another subscription from the beginning
- values.subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
- values.subscribe(
- [](long v){printf("[3] OnNext: %ld\n", v);},
- [](){printf("[3] OnCompleted\n");});
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("//! [publish subject sample]\n");
-}
-
-SCENARIO("publish behavior sample"){
- printf("//! [publish behavior sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- publish(0L);
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Another subscription from the beginning
- values.subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(75)).subscribe([&](long){
- values.subscribe(
- [](long v){printf("[3] OnNext: %ld\n", v);},
- [](){printf("[3] OnCompleted\n");});
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("//! [publish behavior sample]\n");
-}
-
-SCENARIO("publish diamond bgthread sample"){
- printf("//! [publish diamond bgthread sample]\n");
-
- /*
- * Implements the following diamond graph chain with publish+connect on a background thread.
- *
- * Values
- * / \
- * *2 *100
- * \ /
- * Merge
- */
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- publish();
-
- // Left side multiplies by 2.
- auto left = values.map(
- [](long v){printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2;} );
-
- // Right side multiplies by 100.
- auto right = values.map(
- [](long v){printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100; });
-
- // Merge the left,right sides together.
- // The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
- auto merged = left.merge(right);
-
- std::atomic<bool> completed{false};
-
- // Add subscription to see results
- merged.subscribe(
- [](long v) { printf("[3] OnNext: %ld\n", v); },
- [&]() { printf("[3] OnCompleted:\n"); completed = true; });
-
- // Start emitting
- values.connect();
-
- // Block until subscription terminates.
- while (!completed) {}
-
- // Note: consider using ref_count(other) in real code, it's more composable.
-
- printf("//! [publish diamond bgthread sample]\n");
-}
-
-SCENARIO("publish diamond samethread sample"){
- printf("//! [publish diamond samethread sample]\n");
-
- /*
- * Implements the following diamond graph chain with publish+connect diamond without using threads.
- *
- * Values
- * / \
- * *2 *100
- * \ /
- * Merge
- */
-
- std::array<int, 5> a={{1, 2, 3, 4, 5}};
- auto values = rxcpp::observable<>::iterate(a).
- publish();
-
- // Left side multiplies by 2.
- auto left = values.map(
- [](long v){printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2;} );
-
- // Right side multiplies by 100.
- auto right = values.map(
- [](long v){printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100; });
-
- // Merge the left,right sides together.
- // The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
- auto merged = left.merge(right);
-
- // Add subscription to see results
- merged.subscribe(
- [](long v) { printf("[3] OnNext: %ld\n", v); },
- [&]() { printf("[3] OnCompleted:\n"); });
-
- // Start emitting
- // - because there are no other threads here, the connect call blocks until the source
- // calls on_completed.
- values.connect();
-
- // Note: consider using ref_count(other) in real code, it's more composable.
-
- printf("//! [publish diamond samethread sample]\n");
-}
-
-// see also examples/doxygen/ref_count.cpp for more diamond examples
diff --git a/Rx/v2/examples/doxygen/range.cpp b/Rx/v2/examples/doxygen/range.cpp
deleted file mode 100644
index 3abb0ec..0000000
--- a/Rx/v2/examples/doxygen/range.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("range sample"){
- printf("//! [range sample]\n");
- auto values1 = rxcpp::observable<>::range(1, 5);
- values1.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [range sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded range sample"){
- printf("//! [threaded range sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3, rxcpp::observe_on_new_thread());
- auto s = values.
- map([](int v) { return std::make_tuple(get_pid(), v);});
- s.
- as_blocking().
- subscribe(
- rxcpp::util::apply_to(
- [](const std::string pid, int v) {
- printf("[thread %s] OnNext: %d\n", pid.c_str(), v);
- }),
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded range sample]\n");
-}
-
-SCENARIO("subscribe_on range sample"){
- printf("//! [subscribe_on range sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3);
- auto s = values.
- subscribe_on(rxcpp::observe_on_new_thread()).
- map([](int v) { return std::make_tuple(get_pid(), v);});
- s.
- as_blocking().
- subscribe(
- rxcpp::util::apply_to(
- [](const std::string pid, int v) {
- printf("[thread %s] OnNext: %d\n", pid.c_str(), v);
- }),
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [subscribe_on range sample]\n");
-}
-
-
-SCENARIO("range concat sample"){
- printf("//! [range concat sample]\n");
-
- auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- take(3).
- map([](int v) { return std::make_tuple("1:", v);});
-
- auto s2 = values.
- take(3).
- map([](int v) { return std::make_tuple("2:", v);});
-
- s1.
- concat(s2).
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
- printf("//! [range concat sample]\n");
-}
-
-SCENARIO("range merge sample"){
- printf("//! [range merge sample]\n");
-
- auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- map([](int v) { return std::make_tuple("1:", v);});
-
- auto s2 = values.
- map([](int v) { return std::make_tuple("2:", v);});
-
- s1.
- merge(s2).
- take(6).
- as_blocking().
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
- printf("//! [range merge sample]\n");
-}
-
-SCENARIO("threaded range concat sample"){
- printf("//! [threaded range concat sample]\n");
- auto threads = rxcpp::observe_on_event_loop();
-
- auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- subscribe_on(threads).
- take(3).
- map([](int v) { std::this_thread::yield(); return std::make_tuple("1:", v);});
-
- auto s2 = values.
- subscribe_on(threads).
- take(3).
- map([](int v) { std::this_thread::yield(); return std::make_tuple("2:", v);});
-
- s1.
- concat(s2).
- observe_on(threads).
- as_blocking().
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
- printf("//! [threaded range concat sample]\n");
-}
-
-SCENARIO("threaded range merge sample"){
- printf("//! [threaded range merge sample]\n");
- auto threads = rxcpp::observe_on_event_loop();
-
- auto values = rxcpp::observable<>::range(1); // infinite (until overflow) stream of integers
-
- auto s1 = values.
- subscribe_on(threads).
- map([](int v) { std::this_thread::yield(); return std::make_tuple("1:", v);});
-
- auto s2 = values.
- subscribe_on(threads).
- map([](int v) { std::this_thread::yield(); return std::make_tuple("2:", v);});
-
- s1.
- merge(s2).
- take(6).
- observe_on(threads).
- as_blocking().
- subscribe(rxcpp::util::apply_to(
- [](const char* s, int p) {
- printf("%s %d\n", s, p);
- }));
- printf("//! [threaded range merge sample]\n");
-}
-
diff --git a/Rx/v2/examples/doxygen/reduce.cpp b/Rx/v2/examples/doxygen/reduce.cpp
deleted file mode 100644
index 4cd8619..0000000
--- a/Rx/v2/examples/doxygen/reduce.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("reduce sample"){
- printf("//! [reduce sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).
- reduce(
- std::make_pair(0, 1.0),
- [](std::pair<int, double> seed, int v){
- seed.first += 1;
- seed.second *= v;
- return seed;
- },
- [](std::pair<int, double> res){
- return std::pow(res.second, 1.0 / res.first);
- });
- values.
- subscribe(
- [](double v){printf("OnNext: %lf\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [reduce sample]\n");
-}
-
-SCENARIO("reduce empty sample"){
- printf("//! [reduce empty sample]\n");
- auto values = rxcpp::observable<>::empty<int>().
- reduce(
- 1,
- [](int,int){return 0;},
- [](int res){return res;});
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [reduce empty sample]\n");
-}
-
-SCENARIO("reduce exception from accumulator sample"){
- printf("//! [reduce exception from accumulator sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- reduce(
- 0,
- [](int seed, int v){
- if (v == 2)
- throw std::runtime_error("Exception from accumulator");
- return seed;
- },
- [](int res){return res;});
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [reduce exception from accumulator sample]\n");
-}
-
-SCENARIO("reduce exception from result selector sample"){
- printf("//! [reduce exception from result selector sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- reduce(
- 0,
- [](int seed, int v){return seed + v;},
- [](int res){
- throw std::runtime_error("Exception from result selector");
- return res;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [reduce exception from result selector sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/ref_count.cpp b/Rx/v2/examples/doxygen/ref_count.cpp
deleted file mode 100644
index d056274..0000000
--- a/Rx/v2/examples/doxygen/ref_count.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include <array>
-
-SCENARIO("ref_count other diamond sample"){
- printf("//! [ref_count other diamond sample]\n");
-
- /*
- * Implements the following diamond graph chain with publish+ref_count without using threads.
- * This version is composable because it does not use connect explicitly.
- *
- * Values
- * / \
- * *2 *100
- * \ /
- * Merge
- * |
- * RefCount
- */
-
- std::array<double, 5> a={{1.0, 2.0, 3.0, 4.0, 5.0}};
- auto values = rxcpp::observable<>::iterate(a)
- // The root of the chain is only subscribed to once.
- .tap([](double v) { printf("[0] OnNext: %lf\n", v); })
- .publish();
-
- auto values_to_long = values.map([](double v) { return (long) v; });
-
- // Left side multiplies by 2.
- auto left = values_to_long.map(
- [](long v) -> long {printf("[1] OnNext: %ld -> %ld\n", v, v*2); return v * 2L;} );
-
- // Right side multiplies by 100.
- auto right = values_to_long.map(
- [](long v) -> long {printf("[2] OnNext: %ld -> %ld\n", v, v*100); return v * 100L; });
-
- // Merge the left,right sides together.
- // The items are emitted interleaved ... [left1, right1, left2, right2, left3, right3, ...].
- auto merged = left.merge(right);
-
- // When this value is subscribed to, it calls connect on values.
- auto connect_on_subscribe = merged.ref_count(values);
-
- // This immediately starts emitting all values and blocks until they are completed.
- connect_on_subscribe.subscribe(
- [](long v) { printf("[3] OnNext: %ld\n", v); },
- [&]() { printf("[3] OnCompleted:\n"); });
-
- printf("//! [ref_count other diamond sample]\n");
-}
-
-// see also examples/doxygen/publish.cpp for non-ref_count diamonds
diff --git a/Rx/v2/examples/doxygen/repeat.cpp b/Rx/v2/examples/doxygen/repeat.cpp
deleted file mode 100644
index 9cd8d43..0000000
--- a/Rx/v2/examples/doxygen/repeat.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("repeat sample"){
- printf("//! [repeat sample]\n");
- auto values = rxcpp::observable<>::from(1, 2).
- repeat().
- take(5);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [repeat sample]\n");
-}
-
-SCENARIO("repeat count sample"){
- printf("//! [repeat count sample]\n");
- auto values = rxcpp::observable<>::from(1, 2).repeat(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [repeat count sample]\n");
-}
-
-SCENARIO("repeat error sample"){
- printf("//! [repeat error sample]\n");
- auto values = rxcpp::observable<>::from(1, 2).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- repeat();
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [repeat error sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/replay.cpp b/Rx/v2/examples/doxygen/replay.cpp
deleted file mode 100644
index 2340851..0000000
--- a/Rx/v2/examples/doxygen/replay.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include "main.hpp"
-
-SCENARIO("replay sample"){
- printf("//! [replay sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- replay();
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(125)).subscribe([&](long){
- values.as_blocking().subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
- });
- printf("//! [replay sample]\n");
-}
-
-SCENARIO("threaded replay sample"){
- printf("//! [threaded replay sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto coordination = rxcpp::serialize_new_thread();
- auto worker = coordination.create_coordinator().get_worker();
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
- take(5).
- replay(coordination);
-
- // Subscribe from the beginning
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
- });
-
- // Wait before subscribing
- worker.schedule(coordination.now() + std::chrono::milliseconds(125), [&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
- });
-
- // Start emitting
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.connect();
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded replay sample]\n");
-}
-
-SCENARIO("replay count sample"){
- printf("//! [replay count sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- replay(2);
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(125)).subscribe([&](long){
- values.as_blocking().subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
- });
- printf("//! [replay count sample]\n");
-}
-
-SCENARIO("threaded replay count sample"){
- printf("//! [threaded replay count sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto coordination = rxcpp::serialize_new_thread();
- auto worker = coordination.create_coordinator().get_worker();
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
- take(5).
- replay(2, coordination);
-
- // Subscribe from the beginning
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
- });
-
- // Wait before subscribing
- worker.schedule(coordination.now() + std::chrono::milliseconds(125), [&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
- });
-
- // Start emitting
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.connect();
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded replay count sample]\n");
-}
-
-SCENARIO("replay period sample"){
- printf("//! [replay period sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- replay(std::chrono::milliseconds(125));
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(175)).subscribe([&](long){
- values.as_blocking().subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
- });
- printf("//! [replay period sample]\n");
-}
-
-SCENARIO("threaded replay period sample"){
- printf("//! [threaded replay period sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto coordination = rxcpp::serialize_new_thread();
- auto worker = coordination.create_coordinator().get_worker();
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
- take(5).
- replay(std::chrono::milliseconds(125), coordination);
-
- // Subscribe from the beginning
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
- });
-
- // Wait before subscribing
- worker.schedule(coordination.now() + std::chrono::milliseconds(175), [&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
- });
-
- // Start emitting
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.connect();
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded replay period sample]\n");
-}
-
-SCENARIO("replay count+period sample"){
- printf("//! [replay count+period sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50), rxcpp::observe_on_new_thread()).
- take(5).
- replay(2, std::chrono::milliseconds(125));
-
- // Subscribe from the beginning
- values.subscribe(
- [](long v){printf("[1] OnNext: %ld\n", v);},
- [](){printf("[1] OnCompleted\n");});
-
- // Start emitting
- values.connect();
-
- // Wait before subscribing
- rxcpp::observable<>::timer(std::chrono::milliseconds(175)).subscribe([&](long){
- values.as_blocking().subscribe(
- [](long v){printf("[2] OnNext: %ld\n", v);},
- [](){printf("[2] OnCompleted\n");});
- });
- printf("//! [replay count+period sample]\n");
-}
-
-SCENARIO("threaded replay count+period sample"){
- printf("//! [threaded replay count+period sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto coordination = rxcpp::serialize_new_thread();
- auto worker = coordination.create_coordinator().get_worker();
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(50)).
- take(5).
- replay(2, std::chrono::milliseconds(125), coordination);
-
- // Subscribe from the beginning
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][1] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][1] OnCompleted\n", get_pid().c_str());});
- });
-
- // Wait before subscribing
- worker.schedule(coordination.now() + std::chrono::milliseconds(175), [&](const rxcpp::schedulers::schedulable&){
- values.subscribe(
- [](long v){printf("[thread %s][2] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s][2] OnCompleted\n", get_pid().c_str());});
- });
-
- // Start emitting
- worker.schedule([&](const rxcpp::schedulers::schedulable&){
- values.connect();
- });
-
- // Add blocking subscription to see results
- values.as_blocking().subscribe();
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded replay count+period sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/retry.cpp b/Rx/v2/examples/doxygen/retry.cpp
deleted file mode 100644
index efcfb23..0000000
--- a/Rx/v2/examples/doxygen/retry.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("retry sample"){
- printf("//! [retry sample]\n");
- auto values = rxcpp::observable<>::from(1, 2).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- retry().
- take(5);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [retry sample]\n");
-}
-
-SCENARIO("retry count sample"){
- printf("//! [retry count sample]\n");
- auto source = rxcpp::observable<>::from(1, 2).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
- auto values = source.retry(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [retry count sample]\n");
-}
-
-//SCENARIO("retry hot sample"){
-// printf("//! [retry hot sample]\n");
-// auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
-// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error1 from source"))).
-// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
-// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error2 from source"))).
-// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
-// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error3 from source"))).
-// concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
-// concat(rxcpp::observable<>::error<long>(std::runtime_error("Error4 from source"))).
-// retry(3);
-// values.
-// subscribe(
-// [](long v){printf("OnNext: %d\n", v);},
-// [](std::exception_ptr ep){
-// try {std::rethrow_exception(ep);}
-// catch (const std::exception& ex) {
-// printf("OnError: %s\n", ex.what());
-// }
-// },
-// [](){printf("OnCompleted\n");});
-// printf("//! [retry hot sample]\n");
-//}
-//
-//SCENARIO("retry completed sample"){
-// printf("//! [retry completed sample <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]\n");
-// auto source = rxcpp::observable<>::from(1, 2).
-// concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
-// publish();
-// auto values = source.retry();
-// //auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
-// // concat(rxcpp::observable<>::error<long>(std::runtime_error("Error1 from source"))).
-// // concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
-// // concat(rxcpp::observable<>::error<long>(std::runtime_error("Error2 from source"))).
-// // concat(rxcpp::observable<>::timer(std::chrono::milliseconds(10))).
-// // retry(3);
-// values.
-// subscribe(
-// [](long v){printf("OnNext: %d\n", v);},
-// [](std::exception_ptr ep){
-// try {std::rethrow_exception(ep);}
-// catch (const std::exception& ex) {
-// printf("OnError: %s\n", ex.what());
-// }
-// },
-// [](){printf("OnCompleted\n");});
-// printf("//! [retry completed sample]\n");
-//}
diff --git a/Rx/v2/examples/doxygen/sample.cpp b/Rx/v2/examples/doxygen/sample.cpp
deleted file mode 100644
index 1782af2..0000000
--- a/Rx/v2/examples/doxygen/sample.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("sample period sample") {
- printf("//! [sample period sample]\n");
- auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).
- take(7).
- sample_with_time(std::chrono::milliseconds(4));
- values.
- subscribe(
- [](long v) {
- printf("OnNext: %ld\n", v);
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [sample period sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/scan.cpp b/Rx/v2/examples/doxygen/scan.cpp
deleted file mode 100644
index 2a49efd..0000000
--- a/Rx/v2/examples/doxygen/scan.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("scan sample"){
- printf("//! [scan sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).
- scan(
- 0,
- [](int seed, int v){
- return seed + v;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [scan sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/scope.cpp b/Rx/v2/examples/doxygen/scope.cpp
deleted file mode 100644
index ae6521b..0000000
--- a/Rx/v2/examples/doxygen/scope.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("scope sample"){
- printf("//! [scope sample]\n");
- typedef rxcpp::resource<std::vector<int>> resource;
- auto resource_factory = [](){return resource(rxcpp::util::to_vector({1, 2, 3, 4, 5}));};
- auto observable_factory = [](resource res){return rxcpp::observable<>::iterate(res.get());};
- auto values = rxcpp::observable<>::scope(resource_factory, observable_factory);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [scope sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/sequence_equal.cpp b/Rx/v2/examples/doxygen/sequence_equal.cpp
deleted file mode 100644
index f62f88d..0000000
--- a/Rx/v2/examples/doxygen/sequence_equal.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("sequence_equal sample"){
- printf("//! [sequence_equal sample]\n");
- auto source = rxcpp::observable<>::range(1, 3);
- auto values = source.sequence_equal(rxcpp::observable<>::range(1, 3));
- values.
- subscribe(
- [](bool v){ printf("OnNext: %s\n", v ? "true" : "false"); },
- [](){ printf("OnCompleted\n");} );
- printf("//! [sequence_equal sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/skip.cpp b/Rx/v2/examples/doxygen/skip.cpp
deleted file mode 100644
index e5b5979..0000000
--- a/Rx/v2/examples/doxygen/skip.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("skip sample"){
- printf("//! [skip sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).skip(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [skip sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/skip_last.cpp b/Rx/v2/examples/doxygen/skip_last.cpp
deleted file mode 100644
index 29d6aad..0000000
--- a/Rx/v2/examples/doxygen/skip_last.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("skip_last sample"){
- printf("//! [skip_last sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).skip_last(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [skip_last sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/skip_until.cpp b/Rx/v2/examples/doxygen/skip_until.cpp
deleted file mode 100644
index d99cb6e..0000000
--- a/Rx/v2/examples/doxygen/skip_until.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("skip_until sample"){
- printf("//! [skip_until sample]\n");
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
- auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25));
- auto values = source.skip_until(trigger);
- values.
- subscribe(
- [](long v){printf("OnNext: %ld\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [skip_until sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded skip_until sample"){
- printf("//! [threaded skip_until sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
- printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
- return v;
- });
- auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25)).map([](long v){
- printf("[thread %s] Trigger emits, value = %ld\n", get_pid().c_str(), v);
- return v;
- });
- auto values = source.skip_until(trigger, rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded skip_until sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/skip_while.cpp b/Rx/v2/examples/doxygen/skip_while.cpp
deleted file mode 100644
index a98ce18..0000000
--- a/Rx/v2/examples/doxygen/skip_while.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("skip_while sample"){
- printf("//! [skip_while sample]\n");
- auto values = rxcpp::observable<>::range(1, 8).
- skip_while([](int v){
- return v <= 4;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [skip_while sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/start_with.cpp b/Rx/v2/examples/doxygen/start_with.cpp
deleted file mode 100644
index 6a40142..0000000
--- a/Rx/v2/examples/doxygen/start_with.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("full start_with sample"){
- printf("//! [full start_with sample]\n");
- auto observable = rxcpp::observable<>::range(10, 12);
- auto values = rxcpp::observable<>::start_with(observable, 1, 2, 3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [full start_with sample]\n");
-}
-
-SCENARIO("short start_with sample"){
- printf("//! [short start_with sample]\n");
- auto values = rxcpp::observable<>::range(10, 12).
- start_with(1, 2, 3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [short start_with sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/subscribe.cpp b/Rx/v2/examples/doxygen/subscribe.cpp
deleted file mode 100644
index e7c3435..0000000
--- a/Rx/v2/examples/doxygen/subscribe.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("subscribe by subscriber"){
- printf("//! [subscribe by subscriber]\n");
- auto subscriber = rxcpp::make_subscriber<int>(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- auto values = rxcpp::observable<>::range(1, 3);
- values.subscribe(subscriber);
- printf("//! [subscribe by subscriber]\n");
-}
-
-SCENARIO("subscribe by observer"){
- printf("//! [subscribe by observer]\n");
- auto subscriber = rxcpp::make_subscriber<int>(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- auto values1 = rxcpp::observable<>::range(1, 3);
- auto values2 = rxcpp::observable<>::range(4, 6);
- values1.subscribe(subscriber.get_observer());
- values2.subscribe(subscriber.get_observer());
- printf("//! [subscribe by observer]\n");
-}
-
-SCENARIO("subscribe by on_next"){
- printf("//! [subscribe by on_next]\n");
- auto values = rxcpp::observable<>::range(1, 3);
- values.subscribe(
- [](int v){printf("OnNext: %d\n", v);});
- printf("//! [subscribe by on_next]\n");
-}
-
-SCENARIO("subscribe by on_next and on_error"){
- printf("//! [subscribe by on_next and on_error]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
- values.subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- });
- printf("//! [subscribe by on_next and on_error]\n");
-}
-
-SCENARIO("subscribe by on_next and on_completed"){
- printf("//! [subscribe by on_next and on_completed]\n");
- auto values = rxcpp::observable<>::range(1, 3);
- values.subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [subscribe by on_next and on_completed]\n");
-}
-
-SCENARIO("subscribe by subscription, on_next, and on_completed"){
- printf("//! [subscribe by subscription, on_next, and on_completed]\n");
- auto subscription = rxcpp::composite_subscription();
- auto values = rxcpp::observable<>::range(1, 5);
- values.subscribe(
- subscription,
- [&subscription](int v){
- printf("OnNext: %d\n", v);
- if (v == 3)
- subscription.unsubscribe();
- },
- [](){printf("OnCompleted\n");});
- printf("//! [subscribe by subscription, on_next, and on_completed]\n");
-}
-
-SCENARIO("subscribe by on_next, on_error, and on_completed"){
- printf("//! [subscribe by on_next, on_error, and on_completed]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source")));
- values.subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- [](){printf("OnCompleted\n");});
- printf("//! [subscribe by on_next, on_error, and on_completed]\n");
-}
-
-SCENARIO("subscribe unsubscribe"){
- printf("//! [subscribe unsubscribe]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::never<int>()).
- finally([](){printf("The final action\n");});
- auto subscription = values.subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- subscription.unsubscribe();
- printf("//! [subscribe unsubscribe]\n");
-}
diff --git a/Rx/v2/examples/doxygen/subscribe_on.cpp b/Rx/v2/examples/doxygen/subscribe_on.cpp
deleted file mode 100644
index 7a9da50..0000000
--- a/Rx/v2/examples/doxygen/subscribe_on.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-#include "main.hpp"
-
-SCENARIO("subscribe_on sample"){
- printf("//! [subscribe_on sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto values = rxcpp::observable<>::range(1, 3).
- map([](int v){
- printf("[thread %s] Emit value %d\n", get_pid().c_str(), v);
- return v;
- });
- values.
- subscribe_on(rxcpp::synchronize_new_thread()).
- as_blocking().
- subscribe(
- [](int v){printf("[thread %s] OnNext: %d\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [subscribe_on sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/switch_if_empty.cpp b/Rx/v2/examples/doxygen/switch_if_empty.cpp
deleted file mode 100644
index 51faad7..0000000
--- a/Rx/v2/examples/doxygen/switch_if_empty.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("switch_if_empty sample"){
- printf("//! [switch_if_empty sample]\n");
-
- auto values = rxcpp::observable<>::empty<int>()
- .switch_if_empty(rxcpp::observable<>::range(1, 5));
-
- values.subscribe(
- [](int v) { printf("OnNext: %d\n", v); },
- []() { printf("OnCompleted\n"); } );
-
- printf("//! [switch_if_empty sample]\n");
-}
-
-SCENARIO("switch_if_empty - operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
-
- printf("//! [switch_if_empty - operator syntax sample]\n");
- auto values = empty<int>()
- | switch_if_empty(range(1, 5));
-
- values.subscribe(
- [](int v) { printf("OnNext: %d\n", v); },
- []() { printf("OnCompleted\n"); } );
-
- printf("//! [switch_if_empty - operator syntax sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/switch_on_next.cpp b/Rx/v2/examples/doxygen/switch_on_next.cpp
deleted file mode 100644
index 72469c8..0000000
--- a/Rx/v2/examples/doxygen/switch_on_next.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("switch_on_next sample"){
- printf("//! [switch_on_next sample]\n");
- auto base = rxcpp::observable<>::interval(std::chrono::milliseconds(30)).
- take(3).
- map([](long){
- return rxcpp::observable<>::interval(std::chrono::milliseconds(10)).as_dynamic();
- });
- auto values = base.switch_on_next().take(10);
- values.
- subscribe(
- [](long v){printf("OnNext: %ld\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [switch_on_next sample]\n");
-}
-
-SCENARIO("threaded switch_on_next sample"){
- printf("//! [threaded switch_on_next sample]\n");
- auto base = rxcpp::observable<>::interval(std::chrono::milliseconds(30)).
- take(3).
- map([](long){
- return rxcpp::observable<>::interval(std::chrono::milliseconds(10), rxcpp::observe_on_event_loop()).as_dynamic();
- });
- auto values = base.switch_on_next(rxcpp::observe_on_new_thread()).take(10);
- values.
- as_blocking().
- subscribe(
- [](long v){printf("OnNext: %ld\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded switch_on_next sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/take.cpp b/Rx/v2/examples/doxygen/take.cpp
deleted file mode 100644
index be3be24..0000000
--- a/Rx/v2/examples/doxygen/take.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-
-SCENARIO("take sample"){
- printf("//! [take sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).take(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [take sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/take_last.cpp b/Rx/v2/examples/doxygen/take_last.cpp
deleted file mode 100644
index eb3cdfc..0000000
--- a/Rx/v2/examples/doxygen/take_last.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-
-SCENARIO("take_last sample"){
- printf("//! [take_last sample]\n");
- auto values = rxcpp::observable<>::range(1, 7).take_last(3);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [take_last sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/take_until.cpp b/Rx/v2/examples/doxygen/take_until.cpp
deleted file mode 100644
index 082171b..0000000
--- a/Rx/v2/examples/doxygen/take_until.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("take_until sample"){
- printf("//! [take_until sample]\n");
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
- auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25));
- auto values = source.take_until(trigger);
- values.
- subscribe(
- [](long v){printf("OnNext: %ld\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [take_until sample]\n");
-}
-
-SCENARIO("take_until time sample"){
- printf("//! [take_until time sample]\n");
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
- auto values = source.take_until(std::chrono::steady_clock::now() + std::chrono::milliseconds(25));
- values.
- subscribe(
- [](long v){printf("OnNext: %ld\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [take_until time sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("threaded take_until sample"){
- printf("//! [threaded take_until sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
- printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
- return v;
- });
- auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25)).map([](long v){
- printf("[thread %s] Trigger emits, value = %ld\n", get_pid().c_str(), v);
- return v;
- });
- auto values = source.take_until(trigger, rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded take_until sample]\n");
-}
-
-SCENARIO("threaded take_until time sample"){
- printf("//! [threaded take_until time sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
- printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
- return v;
- });
- auto scheduler = rxcpp::observe_on_new_thread();
- auto values = source.take_until(scheduler.now() + std::chrono::milliseconds(25), scheduler);
- values.
- as_blocking().
- subscribe(
- [](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [threaded take_until time sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/take_while.cpp b/Rx/v2/examples/doxygen/take_while.cpp
deleted file mode 100644
index ea92826..0000000
--- a/Rx/v2/examples/doxygen/take_while.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("take_while sample"){
- printf("//! [take_while sample]\n");
- auto values = rxcpp::observable<>::range(1, 8).
- take_while([](int v){
- return v <= 4;
- });
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [take_while sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/tap.cpp b/Rx/v2/examples/doxygen/tap.cpp
deleted file mode 100644
index ad9d4e4..0000000
--- a/Rx/v2/examples/doxygen/tap.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rxu=rxcpp::util;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("tap sample"){
- printf("//! [tap sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- tap(
- [](int v){printf("Tap - OnNext: %d\n", v);},
- [](){printf("Tap - OnCompleted\n");});
- values.
- subscribe(
- [](int v){printf("Subscribe - OnNext: %d\n", v);},
- [](){printf("Subscribe - OnCompleted\n");});
- printf("//! [tap sample]\n");
-}
-
-SCENARIO("error tap sample"){
- printf("//! [error tap sample]\n");
- auto values = rxcpp::observable<>::range(1, 3).
- concat(rxcpp::observable<>::error<int>(std::runtime_error("Error from source"))).
- tap(
- [](int v){printf("Tap - OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- printf("Tap - OnError: %s\n", rxu::what(ep).c_str());
- },
- [](){printf("Tap - OnCompleted\n");});
- values.
- subscribe(
- [](int v){printf("Subscribe - OnNext: %d\n", v);},
- [](std::exception_ptr ep){
- printf("Subscribe - OnError: %s\n", rxu::what(ep).c_str());
- },
- [](){printf("Subscribe - OnCompleted\n");});
- printf("//! [error tap sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/time_interval.cpp b/Rx/v2/examples/doxygen/time_interval.cpp
deleted file mode 100644
index 6706a6a..0000000
--- a/Rx/v2/examples/doxygen/time_interval.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("time_interval sample") {
- printf("//! [time_interval sample]\n");
-
- typedef rxcpp::schedulers::scheduler::clock_type::time_point::duration duration_type;
-
- using namespace std::chrono;
- auto values = rxcpp::observable<>::interval(milliseconds(100))
- .time_interval()
- .take(3);
- values.
- subscribe(
- [&](duration_type v) {
- long long int ms = duration_cast<milliseconds>(v).count();
- printf("OnNext: @%lldms\n", ms);
- },
- [](std::exception_ptr ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [time_interval sample]\n");
-}
-
-SCENARIO("time_interval operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
- using namespace std::chrono;
-
- typedef rxcpp::schedulers::scheduler::clock_type::time_point::duration duration_type;
-
- printf("//! [time_interval operator syntax sample]\n");
- auto values = interval(milliseconds(100))
- | time_interval()
- | take(3);
- values.
- subscribe(
- [&](duration_type v) {
- long long int ms = duration_cast<milliseconds>(v).count();
- printf("OnNext: @%lldms\n", ms);
- },
- [](std::exception_ptr ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [time_interval operator syntax sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/timeout.cpp b/Rx/v2/examples/doxygen/timeout.cpp
deleted file mode 100644
index c61d519..0000000
--- a/Rx/v2/examples/doxygen/timeout.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("timeout sample"){
- printf("//! [timeout sample]\n");
-
- using namespace std::chrono;
- auto values = rxcpp::observable<>::interval(milliseconds(100))
- .take(3)
- .concat(rxcpp::observable<>::interval(milliseconds(500)))
- .timeout(milliseconds(200));
- values.
- subscribe(
- [](long v) { printf("OnNext: %ld\n", v); },
- [](std::exception_ptr ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const rxcpp::timeout_error& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [timeout sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/timer.cpp b/Rx/v2/examples/doxygen/timer.cpp
deleted file mode 100644
index 635b283..0000000
--- a/Rx/v2/examples/doxygen/timer.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("timepoint timer sample"){
- printf("//! [timepoint timer sample]\n");
- auto start = std::chrono::steady_clock::now() + std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::timer(start);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [timepoint timer sample]\n");
-}
-
-SCENARIO("duration timer sample"){
- printf("//! [duration timer sample]\n");
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::timer(period);
- values.
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [duration timer sample]\n");
-}
-
-SCENARIO("threaded timepoint timer sample"){
- printf("//! [threaded timepoint timer sample]\n");
- auto scheduler = rxcpp::observe_on_new_thread();
- auto start = scheduler.now() + std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::timer(start, scheduler);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded timepoint timer sample]\n");
-}
-
-SCENARIO("threaded duration timer sample"){
- printf("//! [threaded duration timer sample]\n");
- auto scheduler = rxcpp::observe_on_new_thread();
- auto period = std::chrono::milliseconds(1);
- auto values = rxcpp::observable<>::timer(period, scheduler);
- values.
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [threaded duration timer sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/timestamp.cpp b/Rx/v2/examples/doxygen/timestamp.cpp
deleted file mode 100644
index 2c394d3..0000000
--- a/Rx/v2/examples/doxygen/timestamp.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("timestamp sample") {
- printf("//! [timestamp sample]\n");
-
- typedef rxcpp::schedulers::scheduler::clock_type::time_point time_point;
-
- using namespace std::chrono;
- auto values = rxcpp::observable<>::interval(milliseconds(100))
- .timestamp()
- .take(3);
- time_point start = rxcpp::identity_current_thread().now();
- values.
- subscribe(
- [&](std::pair<long, time_point> v) {
- long long int ms = duration_cast<milliseconds>(v.second - start).count();
- printf("OnNext: %ld @%lldms\n", v.first, ms);
- },
- [](std::exception_ptr ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [timestamp sample]\n");
-}
-
-SCENARIO("timestamp operator syntax sample") {
- using namespace rxcpp;
- using namespace rxcpp::sources;
- using namespace rxcpp::operators;
- using namespace std::chrono;
-
- typedef rxcpp::schedulers::scheduler::clock_type::time_point time_point;
-
- printf("//! [timestamp operator syntax sample]\n");
- auto values = interval(milliseconds(100))
- | timestamp()
- | take(3);
- time_point start = rxcpp::identity_current_thread().now();
- values.
- subscribe(
- [&](std::pair<long, time_point> v) {
- long long int ms = duration_cast<milliseconds>(v.second - start).count();
- printf("OnNext: %ld @%lldms\n", v.first, ms);
- },
- [](std::exception_ptr ep) {
- try {
- std::rethrow_exception(ep);
- } catch (const std::exception& ex) {
- printf("OnError: %s\n", ex.what());
- }
- },
- []() { printf("OnCompleted\n"); });
- printf("//! [timestamp operator syntax sample]\n");
-} \ No newline at end of file
diff --git a/Rx/v2/examples/doxygen/window.cpp b/Rx/v2/examples/doxygen/window.cpp
deleted file mode 100644
index 9443ecb..0000000
--- a/Rx/v2/examples/doxygen/window.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("window count sample"){
- printf("//! [window count sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::range(1, 5).window(2);
- values.
- subscribe(
- [&counter](rxcpp::observable<int> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](int v){printf("[window %d] OnNext: %d\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window count sample]\n");
-}
-
-SCENARIO("window count+skip sample"){
- printf("//! [window count+skip sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::range(1, 7).window(2, 3);
- values.
- subscribe(
- [&counter](rxcpp::observable<int> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](int v){printf("[window %d] OnNext: %d\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window count+skip sample]\n");
-}
-
-SCENARIO("window period+skip+coordination sample"){
- printf("//! [window period+skip+coordination sample]\n");
- int counter = 0;
- auto period = std::chrono::milliseconds(4);
- auto skip = std::chrono::milliseconds(6);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_with_time(period, skip, rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+skip+coordination sample]\n");
-}
-
-SCENARIO("window period+skip sample"){
- printf("//! [window period+skip sample]\n");
- int counter = 0;
- auto period = std::chrono::milliseconds(4);
- auto skip = std::chrono::milliseconds(6);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_with_time(period, skip);
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+skip sample]\n");
-}
-
-SCENARIO("window period+skip overlapping sample"){
- printf("//! [window period+skip overlapping sample]\n");
- int counter = 0;
- auto period = std::chrono::milliseconds(6);
- auto skip = std::chrono::milliseconds(4);
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_with_time(period, skip);
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+skip overlapping sample]\n");
-}
-
-SCENARIO("window period+skip empty sample"){
- printf("//! [window period+skip empty sample]\n");
- int counter = 0;
- auto period = std::chrono::milliseconds(2);
- auto skip = std::chrono::milliseconds(4);
- auto values = rxcpp::observable<>::timer(std::chrono::milliseconds(10)).
- window_with_time(period, skip);
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+skip empty sample]\n");
-}
-
-SCENARIO("window period+coordination sample"){
- printf("//! [window period+coordination sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_with_time(std::chrono::milliseconds(4), rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+coordination sample]\n");
-}
-
-SCENARIO("window period sample"){
- printf("//! [window period sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_with_time(std::chrono::milliseconds(4));
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period sample]\n");
-}
-
-SCENARIO("window period+count+coordination sample"){
- printf("//! [window period+count+coordination sample]\n");
- int counter = 0;
- auto int1 = rxcpp::observable<>::range(1L, 3L);
- auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
- auto values = int1.
- concat(int2).
- window_with_time_or_count(std::chrono::milliseconds(20), 2, rxcpp::observe_on_event_loop());
- values.
- as_blocking().
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+count+coordination sample]\n");
-}
-
-SCENARIO("window period+count sample"){
- printf("//! [window period+count sample]\n");
- int counter = 0;
- auto int1 = rxcpp::observable<>::range(1L, 3L);
- auto int2 = rxcpp::observable<>::timer(std::chrono::milliseconds(50));
- auto values = int1.
- concat(int2).
- window_with_time_or_count(std::chrono::milliseconds(20), 2);
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window period+count sample]\n");
-}
-
-SCENARIO("window toggle+coordination sample"){
- printf("//! [window toggle+coordination sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_toggle(
- rxcpp::observable<>::interval(std::chrono::milliseconds(4)),
- [](long){
- return rxcpp::observable<>::interval(std::chrono::milliseconds(4)).skip(1);
- },
- rxcpp::observe_on_new_thread());
- values.
- as_blocking().
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window toggle+coordination sample]\n");
-}
-
-SCENARIO("window toggle sample"){
- printf("//! [window toggle sample]\n");
- int counter = 0;
- auto values = rxcpp::observable<>::interval(std::chrono::steady_clock::now() + std::chrono::milliseconds(1), std::chrono::milliseconds(2)).
- take(7).
- window_toggle(
- rxcpp::observable<>::interval(std::chrono::milliseconds(4)),
- [](long){
- return rxcpp::observable<>::interval(std::chrono::milliseconds(4)).skip(1);
- });
- values.
- subscribe(
- [&counter](rxcpp::observable<long> v){
- int id = counter++;
- printf("[window %d] Create window\n", id);
- v.subscribe(
- [id](long v){printf("[window %d] OnNext: %ld\n", id, v);},
- [id](){printf("[window %d] OnCompleted\n", id);});
- });
- printf("//! [window toggle sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/with_latest_from.cpp b/Rx/v2/examples/doxygen/with_latest_from.cpp
deleted file mode 100644
index cf0a422..0000000
--- a/Rx/v2/examples/doxygen/with_latest_from.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("with_latest_from sample"){
- printf("//! [with_latest_from sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.with_latest_from(o2, o3);
- values.
- take(5).
- subscribe(
- [](std::tuple<int, int, int> v){printf("OnNext: %d, %d, %d\n", std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [with_latest_from sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("Coordination with_latest_from sample"){
- printf("//! [Coordination with_latest_from sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto thr = rxcpp::synchronize_event_loop();
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).map([](int v) {
- printf("[thread %s] Source1 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3)).map([](int v) {
- printf("[thread %s] Source2 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5)).map([](int v) {
- printf("[thread %s] Source3 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto values = o1.with_latest_from(thr, o2, o3);
- values.
- take(5).
- as_blocking().
- subscribe(
- [](std::tuple<int, int, int> v){printf("[thread %s] OnNext: %d, %d, %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [Coordination with_latest_from sample]\n");
-}
-
-SCENARIO("Selector with_latest_from sample"){
- printf("//! [Selector with_latest_from sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.with_latest_from(
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(5).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Selector with_latest_from sample]\n");
-}
-
-SCENARIO("Coordination+Selector with_latest_from sample"){
- printf("//! [Coordination+Selector with_latest_from sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(5));
- auto values = o1.with_latest_from(
- rxcpp::observe_on_new_thread(),
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(5).
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Coordination+Selector with_latest_from sample]\n");
-}
diff --git a/Rx/v2/examples/doxygen/zip.cpp b/Rx/v2/examples/doxygen/zip.cpp
deleted file mode 100644
index 6bd295b..0000000
--- a/Rx/v2/examples/doxygen/zip.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "rxcpp/rx.hpp"
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("zip sample"){
- printf("//! [zip sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(1));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto values = o1.zip(o2, o3);
- values.
- take(3).
- subscribe(
- [](std::tuple<int, int, int> v){printf("OnNext: %d, %d, %d\n", std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("OnCompleted\n");});
- printf("//! [zip sample]\n");
-}
-
-#include "main.hpp"
-
-SCENARIO("Coordination zip sample"){
- printf("//! [Coordination zip sample]\n");
- printf("[thread %s] Start task\n", get_pid().c_str());
- auto thr = rxcpp::synchronize_event_loop();
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(1)).map([](int v) {
- printf("[thread %s] Source1 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(2)).map([](int v) {
- printf("[thread %s] Source2 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(3)).map([](int v) {
- printf("[thread %s] Source3 OnNext: %d\n", get_pid().c_str(), v);
- return v;
- });
- auto values = o1.zip(thr, o2, o3);
- values.
- take(3).
- as_blocking().
- subscribe(
- [](std::tuple<int, int, int> v){printf("[thread %s] OnNext: %d, %d, %d\n", get_pid().c_str(), std::get<0>(v), std::get<1>(v), std::get<2>(v));},
- [](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
- printf("[thread %s] Finish task\n", get_pid().c_str());
- printf("//! [Coordination zip sample]\n");
-}
-
-SCENARIO("Selector zip sample"){
- printf("//! [Selector zip sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(1));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto values = o1 | rxcpp::operators::zip(
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(3).
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Selector zip sample]\n");
-}
-
-SCENARIO("Coordination+Selector zip sample"){
- printf("//! [Coordination+Selector zip sample]\n");
- auto o1 = rxcpp::observable<>::interval(std::chrono::milliseconds(1));
- auto o2 = rxcpp::observable<>::interval(std::chrono::milliseconds(2));
- auto o3 = rxcpp::observable<>::interval(std::chrono::milliseconds(3));
- auto values = o1.zip(
- rxcpp::observe_on_new_thread(),
- [](int v1, int v2, int v3) {
- return 100 * v1 + 10 * v2 + v3;
- },
- o2, o3);
- values.
- take(3).
- as_blocking().
- subscribe(
- [](int v){printf("OnNext: %d\n", v);},
- [](){printf("OnCompleted\n");});
- printf("//! [Coordination+Selector zip sample]\n");
-}
diff --git a/Rx/v2/examples/linesfrombytes/CMakeLists.txt b/Rx/v2/examples/linesfrombytes/CMakeLists.txt
deleted file mode 100644
index 3bf2979..0000000
--- a/Rx/v2/examples/linesfrombytes/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/linesfrombytes/main.cpp b/Rx/v2/examples/linesfrombytes/main.cpp
deleted file mode 100644
index f5e9482..0000000
--- a/Rx/v2/examples/linesfrombytes/main.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <rxcpp/rx-lite.hpp>
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-filter.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-tap.hpp>
-#include <rxcpp/operators/rx-concat_map.hpp>
-#include <rxcpp/operators/rx-flat_map.hpp>
-#include <rxcpp/operators/rx-concat.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-#include <rxcpp/operators/rx-repeat.hpp>
-#include <rxcpp/operators/rx-publish.hpp>
-#include <rxcpp/operators/rx-ref_count.hpp>
-#include <rxcpp/operators/rx-window.hpp>
-#include <rxcpp/operators/rx-window_toggle.hpp>
-#include <rxcpp/operators/rx-start_with.hpp>
-namespace Rx {
-using namespace rxcpp;
-using namespace rxcpp::sources;
-using namespace rxcpp::operators;
-using namespace rxcpp::util;
-}
-using namespace Rx;
-
-#include <regex>
-#include <random>
-using namespace std;
-using namespace std::chrono;
-
-int main()
-{
- random_device rd; // non-deterministic generator
- mt19937 gen(rd());
- uniform_int_distribution<> dist(4, 18);
-
- // for testing purposes, produce byte stream that from lines of text
- auto bytes = range(0, 10) |
- flat_map([&](int i){
- auto body = from((uint8_t)('A' + i)) |
- repeat(dist(gen)) |
- as_dynamic();
- auto delim = from((uint8_t)'\r');
- return from(body, delim) | concat();
- }) |
- window(17) |
- flat_map([](observable<uint8_t> w){
- return w |
- reduce(
- vector<uint8_t>(),
- [](vector<uint8_t> v, uint8_t b){
- v.push_back(b);
- return v;
- }) |
- as_dynamic();
- }) |
- tap([](vector<uint8_t>& v){
- // print input packet of bytes
- copy(v.begin(), v.end(), ostream_iterator<long>(cout, " "));
- cout << endl;
- });
-
- //
- // recover lines of text from byte stream
- //
-
- auto removespaces = [](string s){
- s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
- return s;
- };
-
- // create strings split on \r
- auto strings = bytes |
- concat_map([](vector<uint8_t> v){
- string s(v.begin(), v.end());
- regex delim(R"/(\r)/");
- cregex_token_iterator cursor(&s[0], &s[0] + s.size(), delim, {-1, 0});
- cregex_token_iterator end;
- vector<string> splits(cursor, end);
- return iterate(move(splits));
- }) |
- filter([](const string& s){
- return !s.empty();
- }) |
- publish() |
- ref_count();
-
- // filter to last string in each line
- auto closes = strings |
- filter(
- [](const string& s){
- return s.back() == '\r';
- }) |
- Rx::map([](const string&){return 0;});
-
- // group strings by line
- auto linewindows = strings |
- window_toggle(closes | start_with(0), [=](int){return closes;});
-
- // reduce the strings for a line into one string
- auto lines = linewindows |
- flat_map([&](observable<string> w) {
- return w | start_with<string>("") | sum() | Rx::map(removespaces);
- });
-
- // print result
- lines |
- subscribe<string>(println(cout));
-
- return 0;
-}
diff --git a/Rx/v2/examples/println/CMakeLists.txt b/Rx/v2/examples/println/CMakeLists.txt
deleted file mode 100644
index 3bf2979..0000000
--- a/Rx/v2/examples/println/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp
deleted file mode 100644
index e41a8c3..0000000
--- a/Rx/v2/examples/println/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "rxcpp/rx.hpp"
-// create alias' to simplify code
-// these are owned by the user so that
-// conflicts can be managed by the user.
-namespace rx=rxcpp;
-namespace rxu=rxcpp::util;
-
-#include<string>
-
-// At this time, RxCpp will fail to compile if the contents
-// of the std namespace are merged into the global namespace
-// DO NOT USE: 'using namespace std;'
-
-#if 0
-//
-// println will insert values into the specified stream
-//
-template<class OStream>
-struct println_function
-{
- OStream& os;
- println_function(OStream& os) : os(os) {}
-
- template<class... TN>
- void operator()(const TN&... tn) const {
- bool inserts[] = {(os << tn, true)...};
- os << std::endl;
- }
-
- template<class... TN>
- void operator()(const std::tuple<TN...>& tpl) const {
- apply(tpl, *this);
- }
-};
-template<class OStream>
-auto println(OStream& os)
- -> println_function<OStream> {
- return println_function<OStream>(os);
-}
-#endif
-
-#ifdef UNICODE
-int wmain()
-#else
-int main()
-#endif
-{
- auto get_names = [](){return rx::observable<>::from<std::string>(
- "Matthew",
- "Aaron"
- );};
-
- std::cout << "===== println stream of std::string =====" << std::endl;
- auto hello_str = [&](){return get_names().map([](std::string n){
- return "Hello, " + n + "!";
- }).as_dynamic();};
-
- hello_str().subscribe(rxu::println(std::cout));
-
- std::cout << "===== println stream of std::tuple =====" << std::endl;
- auto hello_tpl = [&](){return get_names().map([](std::string n){
- return std::make_tuple("Hello, ", n, "! (", n.size(), ")");
- }).as_dynamic();};
-
- hello_tpl().subscribe(rxu::println(std::cout));
-
- hello_tpl().subscribe(rxu::print_followed_by(std::cout, " and "), rxu::endline(std::cout));
- return 0;
-}
diff --git a/Rx/v2/examples/pythagorian/CMakeLists.txt b/Rx/v2/examples/pythagorian/CMakeLists.txt
deleted file mode 100644
index 3bf2979..0000000
--- a/Rx/v2/examples/pythagorian/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/pythagorian/main.cpp b/Rx/v2/examples/pythagorian/main.cpp
deleted file mode 100644
index 309b16d..0000000
--- a/Rx/v2/examples/pythagorian/main.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-
-#include "rxcpp/rx-trace.hpp"
-
-struct trace_calls : rxcpp::trace_noop
-{
- trace_calls()
- : onnexts(0)
- , onerrors(0)
- , oncompleteds(0)
- , subscribes(0)
- , lifts(0)
- , unsubscribes(0)
- , adds(0)
- , removes(0)
- , actions(0)
- , recurses(0)
- , schedules(0)
- , schedulewhens(0)
- {}
-
- template<class Worker>
- inline void schedule_return(const Worker&) {
- schedules++;
- }
-
- template<class Worker>
- inline void schedule_when_return(const Worker&) {
- schedulewhens++;
- }
-
- template<class Schedulable>
- inline void action_return(const Schedulable&) {
- actions++;
- }
-
- template<class Schedulable>
- inline void action_recurse(const Schedulable&) {
- recurses++;
- }
-
- template<class Observable>
- inline void subscribe_return(const Observable&) {
- subscribes++;
- }
-
- template<class OperatorSource, class OperatorChain>
- inline void lift_return(const OperatorSource&, const OperatorChain&) {
- lifts++;
- }
-
- template<class SubscriptionState>
- inline void unsubscribe_return(const SubscriptionState&) {
- unsubscribes++;
- }
-
- template<class SubscriptionState>
- inline void subscription_add_return(const SubscriptionState&) {
- adds++;
- }
-
- template<class SubscriptionState>
- inline void subscription_remove_return(const SubscriptionState&) {
- removes++;
- }
-
- template<class Observer>
- inline void on_next_return(const Observer&) {
- onnexts++;
- }
-
- template<class Observer>
- inline void on_error_return(const Observer&) {
- onerrors++;
- }
-
- template<class Observer>
- inline void on_completed_return(const Observer&) {
- oncompleteds++;
- }
-
- int onnexts;
- int onerrors;
- int oncompleteds;
- int subscribes;
- int lifts;
- int unsubscribes;
- int adds;
- int removes;
- int actions;
- int recurses;
- int schedules;
- int schedulewhens;
-};
-
-auto rxcpp_trace_activity(rxcpp::trace_tag) -> trace_calls;
-
-#include "rxcpp/rx.hpp"
-// create alias' to simplify code
-// these are owned by the user so that
-// conflicts can be managed by the user.
-namespace rx=rxcpp;
-namespace rxu=rxcpp::util;
-
-// At this time, RxCpp will fail to compile if the contents
-// of the std namespace are merged into the global namespace
-// DO NOT USE: 'using namespace std;'
-
-#ifdef UNICODE
-int wmain()
-#else
-int main()
-#endif
-{
- int c = 0;
-
- auto triples =
- rx::observable<>::range(1)
- .concat_map(
- [&c](int z){
- return rx::observable<>::range(1, z)
- .concat_map(
- [=, &c](int x){
- return rx::observable<>::range(x, z)
- .filter([=, &c](int y){++c; return x*x + y*y == z*z;})
- .map([=](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;});
-
- int ct = 0;
-
- triples
- .take(100)
- .subscribe(rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){
- ++ct;
- }));
-
- std::cout << "concat_map pythagorian range : " << c << " filtered to, " << ct << " triplets." << std::endl;
- std::cout << "onnexts: " << rxcpp::trace_activity().onnexts << ", onerrors: " << rxcpp::trace_activity().onerrors << ", oncompleteds: " << rxcpp::trace_activity().oncompleteds << std::endl;
- std::cout << "subscribes: " << rxcpp::trace_activity().subscribes << ", lifts: " << rxcpp::trace_activity().lifts << std::endl;
- std::cout << "unsubscribes: " << rxcpp::trace_activity().unsubscribes << ", adds: " << rxcpp::trace_activity().adds << ", removes: " << rxcpp::trace_activity().removes << std::endl;
- std::cout << "schedules: " << rxcpp::trace_activity().schedules << ", schedulewhens: " << rxcpp::trace_activity().schedulewhens << std::endl;
- std::cout << "actions: " << rxcpp::trace_activity().actions << ", recurses: " << rxcpp::trace_activity().recurses << std::endl;
-
- return 0;
-}
diff --git a/Rx/v2/examples/stop/CMakeLists.txt b/Rx/v2/examples/stop/CMakeLists.txt
deleted file mode 100644
index 3bf2979..0000000
--- a/Rx/v2/examples/stop/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/stop/main.cpp b/Rx/v2/examples/stop/main.cpp
deleted file mode 100644
index 62bd5d7..0000000
--- a/Rx/v2/examples/stop/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-#include "rxcpp/rx.hpp"
-// create alias' to simplify code
-// these are owned by the user so that
-// conflicts can be managed by the user.
-namespace rx=rxcpp;
-namespace rxsub=rxcpp::subjects;
-namespace rxu=rxcpp::util;
-
-// At this time, RxCpp will fail to compile if the contents
-// of the std namespace are merged into the global namespace
-// DO NOT USE: 'using namespace std;'
-
-int main()
-{
- // works
- {
- auto published_observable =
- rx::observable<>::range(1)
- .filter([](int i)
- {
- std::cout << i << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(300));
- return true;
- })
- .subscribe_on(rx::observe_on_new_thread())
- .publish();
-
- auto subscription = published_observable.connect();
- std::this_thread::sleep_for(std::chrono::seconds(1));
- subscription.unsubscribe();
- std::cout << "unsubscribed" << std::endl << std::endl;
- }
-
- // idiomatic (prefer operators)
- {
- auto published_observable =
- rx::observable<>::interval(std::chrono::milliseconds(300))
- .subscribe_on(rx::observe_on_new_thread())
- .publish();
-
- published_observable.
- ref_count().
- take_until(rx::observable<>::timer(std::chrono::seconds(1))).
- finally([](){
- std::cout << "unsubscribed" << std::endl << std::endl;
- }).
- subscribe([](int i){
- std::cout << i << std::endl;
- });
- }
-
- return 0;
-}
diff --git a/Rx/v2/examples/tests/CMakeLists.txt b/Rx/v2/examples/tests/CMakeLists.txt
deleted file mode 100644
index 690930d..0000000
--- a/Rx/v2/examples/tests/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT} LANGUAGES C CXX)
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/take.cpp
-)
-add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES})
-add_executable(rxcpp::examples::${SAMPLE_PROJECT} ALIAS ${SAMPLE_PROJECT})
-target_compile_options(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(${SAMPLE_PROJECT} PUBLIC ${RX_COMPILE_FEATURES})
-target_include_directories(${SAMPLE_PROJECT} PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR})
-target_link_libraries(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-set_target_properties(${SAMPLE_PROJECT} PROPERTIES FOLDER "Examples")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})
diff --git a/Rx/v2/examples/tests/main.cpp b/Rx/v2/examples/tests/main.cpp
deleted file mode 100644
index 0c7c351..0000000
--- a/Rx/v2/examples/tests/main.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
diff --git a/Rx/v2/examples/tests/take.cpp b/Rx/v2/examples/tests/take.cpp
deleted file mode 100644
index 41ec184..0000000
--- a/Rx/v2/examples/tests/take.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "rxcpp/rx.hpp"
-namespace rx=rxcpp;
-namespace rxu=rxcpp::util;
-namespace rxsc=rxcpp::schedulers;
-
-#include "rxcpp/rx-test.hpp"
-#include "catch.hpp"
-
-SCENARIO("take 2 - passes", "[take][passes][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("2 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take 2 - fails", "[take][fails][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("2 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
-// TYPO START
- .skip(2)
-// TYPO END
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/examples/win_text/CMakeLists.txt b/Rx/v2/examples/win_text/CMakeLists.txt
deleted file mode 100644
index 8aabd25..0000000
--- a/Rx/v2/examples/win_text/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
-
-project(${SAMPLE_PROJECT})
-
-FIND_PACKAGE(Threads)
-
-MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} )
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- MESSAGE( STATUS "using clang settings" )
- add_compile_options( -Wall -Wextra -Werror )
- add_compile_options( -std=c++11 -stdlib=libc++ )
- add_compile_options( -ftemplate-depth=1024 ) # sometimes you just do what the compiler tells you
-elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- MESSAGE( STATUS "using gnu settings" )
- add_compile_options( -Wall -Wextra -Werror )
- add_compile_options( -std=c++11 )
-elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- MESSAGE( STATUS "using msvc settings" )
- add_compile_options( /W4 /WX )
- add_compile_options( /wd4503 ) # truncated symbol
- add_compile_options( /wd4702 ) # unreachable code
- add_compile_options( /wd4091 ) # typedef ignored on left when no variable is declared
- add_compile_options( /bigobj )
- add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium
-endif()
-
-
-# define some folders
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include_directories(SYSTEM ${RXCPP_DIR}/ext/catch/include)
-include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src)
-
-# define the sources
-set(SAMPLE_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
-)
-add_executable(${SAMPLE_PROJECT} WIN32 ${SAMPLE_SOURCES})
-TARGET_LINK_LIBRARIES(${SAMPLE_PROJECT} ${CMAKE_THREAD_LIBS_INIT})
-
-# configure unit tests via CTest
-enable_testing()
-set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
-
-add_test(NAME RunTests
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
- COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS}) \ No newline at end of file
diff --git a/Rx/v2/examples/win_text/main.cpp b/Rx/v2/examples/win_text/main.cpp
deleted file mode 100644
index 709cc2f..0000000
--- a/Rx/v2/examples/win_text/main.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-
-// win_text.cpp : Defines the entry point for the application.
-//
-//
-
-#define STRICT
-#define WIN32_LEAN_AND_MEAN
-#define NOMINMAX
-
-#include <windows.h>
-#include <windowsx.h>
-#include <ole2.h>
-#include <commctrl.h>
-#include <shlwapi.h>
-#include <shlobj.h>
-#include <shellapi.h>
-
-#pragma comment(lib, "user32.lib")
-#pragma comment(lib, "gdi32.lib")
-#pragma comment(lib, "Comctl32.lib")
-#pragma comment(lib, "Ole32.lib")
-
-#include <new>
-#include <utility>
-#include <memory>
-#include <type_traits>
-#include <tuple>
-#include <list>
-
-#include "rxcpp/rx.hpp"
-// create alias' to simplify code
-// these are owned by the user so that
-// conflicts can be managed by the user.
-namespace rx=rxcpp;
-namespace rxsub=rxcpp::subjects;
-namespace rxu=rxcpp::util;
-
-// At this time, RxCpp will fail to compile if the contents
-// of the std namespace are merged into the global namespace
-// DO NOT USE: 'using namespace std;'
-
-#include "unwinder.h"
-
-#include "windows_user.h"
-namespace wu = windows_user;
-
-#include "rx_windows_user.h"
-namespace rxwu = rxcpp::windows_user;
-
-struct RootWindow : public rxwu::rx_messages, public rxwu::enable_send_call<RootWindow, WM_USER+1>
-{
- // window class
- using window_class = wu::window_class<RootWindow>;
- static LPCWSTR class_name() {return L"Scratch";}
- static void change_class(WNDCLASSEX&) {}
-
- // createstruct parameter type
- using param_type = std::wstring;
-
- // public methods
-
- // static methods use a window message per call
-
- static LRESULT set_title(HWND w, const std::wstring& t) {
- return send_call(w, [&](RootWindow& r){
- r.set_title(t);
- return 0;
- });
- }
- static std::wstring get_title(HWND w) {
- std::wstring t;
- send_call(w, [&](RootWindow& r){
- t = r.get_title();
- return 0;
- });
- return t;
- }
-
- // instance methods are accessed using static send_call(hwnd, [](RootWindow& r){. . .});
- // send_call uses one window message, the lambda can call many instance methods.
-
- void set_title(const std::wstring& t) {
- title = t;
- }
- const std::wstring& get_title() {
- return title;
- }
-
- // lifetime
-
- // called during WM_NCDESTROY
- ~RootWindow() {
- PostQuitMessage(0);
- }
-
- // called during WM_NCCREATE
- RootWindow(HWND w, LPCREATESTRUCT, param_type* title)
- : window(w)
- , title(title ? *title : L"RootWindow")
- , position{40, 10} {
- // listen for the following messages
- OnPaint();
- OnPrintClient();
- OnKeyDown();
- OnMovesWhileLButtonDown();
- }
-
-private:
- // implementation
-
- HWND window;
- std::wstring title;
- POINTS position;
-
- void PaintContent(PAINTSTRUCT& ps) {
- RECT rect;
- GetClientRect (window, &rect) ;
- SetTextColor(ps.hdc, 0x00000000);
- SetBkMode(ps.hdc,TRANSPARENT);
- rect.left=position.x;
- rect.top=position.y;
- DrawText( ps.hdc, title.c_str(), -1, &rect, DT_SINGLELINE | DT_NOCLIP ) ;
- }
-
- void OnKeyDown() {
- messages<WM_KEYDOWN>().
- subscribe([this](auto m) {
- m.handled(); // skip DefWindowProc
-
- MessageBox(window, L"KeyDown", L"RootWindow", MB_OK);
- // NOTE: MessageBox pumps messages, but this subscription only
- // receives messages if it is suspended by 'for await', so any
- // WM_KEYDOWN arriving while the message box is up is not delivered.
- // the other subscriptions will receive messages.
- });
- }
-
- void OnMovesWhileLButtonDown() {
-
- auto moves_while_lbutton_down = messages<WM_LBUTTONDOWN>().
- map(
- [this](auto m) {
- m.handled(); // skip DefWindowProc
-
- return this->messages<WM_MOUSEMOVE>().
- take_until(this->messages<WM_LBUTTONUP>());
- }).
- merge();
-
- moves_while_lbutton_down.
- subscribe([this](auto m) {
- m.handled(); // skip DefWindowProc
-
- position = MAKEPOINTS(m.lParam);
- InvalidateRect(window, nullptr, true);
- });
- }
-
- void OnPaint() {
- messages<WM_PAINT>().
- subscribe([this](auto m) {
- m.handled(); // skip DefWindowProc
-
- PAINTSTRUCT ps;
- BeginPaint(window, &ps);
- PaintContent(ps);
- EndPaint(window, &ps);
- });
- }
-
- void OnPrintClient() {
- messages<WM_PRINTCLIENT, HDC>().
- subscribe([this](auto m) {
- m.handled(); // skip DefWindowProc
-
- PAINTSTRUCT ps;
- ps.hdc = m.wParam;
- GetClientRect(window, &ps.rcPaint);
- PaintContent(ps);
- });
- }
-};
-
-int PASCAL
-wWinMain(HINSTANCE hinst, HINSTANCE, LPWSTR, int nShowCmd)
-{
- HRESULT hr = S_OK;
-
- hr = CoInitialize(NULL);
- if (FAILED(hr))
- {
- return FALSE;
- }
- ON_UNWIND_AUTO([&]{CoUninitialize();});
-
- InitCommonControls();
-
- RootWindow::window_class::Register();
-
- LONG winerror = ERROR_SUCCESS;
-
- std::wstring title{L"Scratch App - RootWindow"};
-
- // normal create window call, just takes the class name and optional create parameters
- HWND window = CreateWindow(
- RootWindow::window_class::Name(), title.c_str(),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL,
- hinst,
- &title);
- if (!window) {winerror = GetLastError();}
-
- if (!!winerror || !window)
- {
- return winerror;
- }
-
- ShowWindow(window, nShowCmd);
-
- // interact with window safely on the UI thread from another thread
- auto settitle = std::async([window](){
-
- // by static method (two SendMessage)
- RootWindow::set_title(window, L"SET_TITLE! " + RootWindow::get_title(window));
-
- // or multiple instance methods (one SendMessage)
- RootWindow::send_call(window, [](RootWindow& r){
- r.set_title(L"SEND_CALL! " + r.get_title());
- return 0;
- });
- });
-
- MSG msg = {};
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-
- settitle.get();
-
- return 0;
-}
diff --git a/Rx/v2/examples/win_text/rx_windows_user.h b/Rx/v2/examples/win_text/rx_windows_user.h
deleted file mode 100644
index 708eaf6..0000000
--- a/Rx/v2/examples/win_text/rx_windows_user.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#pragma once
-
-namespace rxcpp { namespace windows_user {
-
- struct rx_messages
- {
- struct Result
- {
- LRESULT lres = 0;
- bool handled = false;
- };
-
- struct Message
- {
- template<UINT WM>
- static auto is() { return [](Message m){ return m.message == WM; }; }
-
- HWND hWnd;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
- Result* result;
-
- void handled() { result->handled = true; }
- void lresult(LRESULT lres) {result->lres = lres; }
-
- template<class T>
- T wparam_cast(){
- return *reinterpret_cast<T*>(std::addressof(wParam));
- }
-
- template<class T>
- T lparam_cast(){
- return *reinterpret_cast<T*>(std::addressof(lParam));
- }
- };
-
- template<class WPARAM_t = WPARAM, class LPARAM_t = LPARAM>
- struct TypedMessage
- {
- static auto as() { return [](Message m){return TypedMessage{m}; }; }
-
- TypedMessage(Message m)
- : hWnd(m.hWnd)
- , message(m.message)
- , wParam(m.wparam_cast<WPARAM_t>())
- , lParam(m.lparam_cast<LPARAM_t>())
- , result(m.result)
- {}
-
- HWND hWnd;
- UINT message;
- WPARAM_t wParam;
- LPARAM_t lParam;
- Result* result;
-
- void handled() { result->handled = true; }
- void lresult(LRESULT lres) {result->lres = lres; }
- };
-
- subjects::subject<Message> subject;
- subscriber<Message> sub;
-
- ~rx_messages() {
- sub.on_completed();
- }
- rx_messages() : sub(subject.get_subscriber()) {}
-
- std::tuple<bool, LRESULT> message(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
- Result result;
- auto m = Message{hWnd, message, wParam, lParam, &result};
- try {
- sub.on_next(m);
- } catch(...) {
- sub.on_error(std::current_exception());
- }
- return std::make_tuple(result.handled, result.lres);
- }
-
- observable<Message> messages() {
- return subject.get_observable();
- }
-
- template<UINT WM>
- observable<Message> messages() {
- return messages().filter(Message::is<WM>());
- }
-
- template<UINT WM, class WPARAM_t, class LPARAM_t = LPARAM>
- observable<TypedMessage<WPARAM_t, LPARAM_t>> messages() {
- return messages<WM>().map(TypedMessage<WPARAM_t, LPARAM_t>::as());
- }
-
- };
-
- template<class Derived, UINT WM>
- struct enable_send_call
- {
- static LRESULT send_call(HWND w, std::function<LRESULT(Derived&)> f) {
- auto fp = reinterpret_cast<LPARAM>(std::addressof(f));
- return SendMessage(w, WM, 0, fp);
- }
-
- void OnSendCall() {
- auto derived = static_cast<Derived*>(this);
- derived->messages<WM, WPARAM, std::function<LRESULT(Derived&)>*>().
- subscribe([=](auto m) {
- m.handled(); // skip DefWindowProc
- m.lresult((*m.lParam)(*derived));
- });
- }
-
- enable_send_call() {
- OnSendCall();
- }
- };
-} }
diff --git a/Rx/v2/examples/win_text/unwinder.h b/Rx/v2/examples/win_text/unwinder.h
deleted file mode 100644
index a01a170..0000000
--- a/Rx/v2/examples/win_text/unwinder.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#pragma once
-
-namespace unwinder { namespace detail {
-
- template<typename Function>
- class unwinder
- {
- public:
- ~unwinder() noexcept
- {
- if (!!function)
- {
- (*function)();
- }
- }
-
- explicit unwinder(Function* functionArg)
- : function(functionArg)
- {
- }
-
- void dismiss()
- {
- function = nullptr;
- }
-
- unwinder& operator=(nullptr_t) {
- dismiss();
- return *this;
- }
-
- private:
- unwinder();
- unwinder(const unwinder&);
- unwinder& operator=(const unwinder&);
-
- Function* function;
- };
-} }
-
-#define UNWIND_MAKE_IDENTIFIER_EXPLICIT_PASTER(Prefix, Suffix) Prefix ## Suffix
-#define UNWIND_MAKE_IDENTIFIER_EXPLICIT(Prefix, Suffix) UNWIND_MAKE_IDENTIFIER_EXPLICIT_PASTER(Prefix, Suffix)
-
-#define UNWIND_MAKE_IDENTIFIER(Prefix) UNWIND_MAKE_IDENTIFIER_EXPLICIT(Prefix, __LINE__)
-
-#define ON_UNWIND(Name, Function) \
- ON_UNWIND_EXPLICIT(uwfunc_ ## Name, Name, Function)
-
-#define ON_UNWIND_AUTO(Function) \
- ON_UNWIND_EXPLICIT(UNWIND_MAKE_IDENTIFIER(uwfunc_), UNWIND_MAKE_IDENTIFIER(unwind_), Function)
-
-#define ON_UNWIND_EXPLICIT(FunctionName, UnwinderName, Function) \
- auto FunctionName = (Function); \
- ::unwinder::detail::unwinder<decltype(FunctionName)> UnwinderName(std::addressof(FunctionName))
diff --git a/Rx/v2/examples/win_text/windows_user.h b/Rx/v2/examples/win_text/windows_user.h
deleted file mode 100644
index 418f73f..0000000
--- a/Rx/v2/examples/win_text/windows_user.h
+++ /dev/null
@@ -1,118 +0,0 @@
-#pragma once
-
-namespace windows_user {
-
- EXTERN_C IMAGE_DOS_HEADER __ImageBase;
- inline HINSTANCE GetCurrentInstance(){ return ((HINSTANCE)&__ImageBase); }
-
- template<typename Type>
- LRESULT CALLBACK WindowCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept;
-
- template<typename Type>
- class window_class
- {
- public:
- static LPCWSTR Name() {
- return Type::class_name();
- }
-
- static ATOM Register() {
- WNDCLASSEX wcex = {};
- wcex.cbSize = sizeof(WNDCLASSEX);
-
- // defaults that can be overriden
- wcex.style = CS_HREDRAW | CS_VREDRAW;
- wcex.hInstance = GetCurrentInstance();
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wcex.style = 0;
- wcex.hIcon = NULL;
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.lpszMenuName = NULL;
-
- Type::change_class(wcex);
-
- // not overridable
- wcex.lpszClassName = Name();
- wcex.lpfnWndProc = WindowCallback<Type>;
-
- return RegisterClassEx(&wcex);
- }
-
- private:
- ~window_class();
- window_class();
- window_class(window_class&);
- window_class& operator=(window_class&);
- };
-
- namespace detail {
- template<typename Type>
- std::unique_ptr<Type> find(HWND hwnd) {
- return std::unique_ptr<Type>(reinterpret_cast<Type*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)));
- }
-
- void erase(HWND hwnd) {
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- }
-
- template<typename Type>
- std::unique_ptr<Type> insert(HWND hwnd, std::unique_ptr<Type> type) {
- if (!type) {
- return nullptr;
- }
-
- SetLastError(0);
-
- ON_UNWIND(unwind_userdata, [&](){erase(hwnd);});
- auto result = SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(type.get()));
-
- LONG winerror = !result ? GetLastError() : ERROR_SUCCESS;
-
- if (!!winerror || !!result) {
- return nullptr;
- }
-
- unwind_userdata.dismiss();
- return type;
- }
- }
-
- template<typename Type>
- LRESULT CALLBACK WindowCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept {
- auto type = detail::find<Type>(hWnd);
- // don't delete type
- ON_UNWIND(unwind_type, [&](){type.release();});
-
- if (message == WM_NCCREATE) {
- if (type) {
- // the slot where we would store our type instance is full. abort.
- return FALSE;
- }
- auto cs = reinterpret_cast<LPCREATESTRUCT>(lParam);
- auto param = reinterpret_cast<Type::param_type*>(cs->lpCreateParams);
- type = detail::insert(hWnd, std::unique_ptr<Type>(new (std::nothrow) Type(hWnd, cs, param)));
- if (!type) {
- return FALSE;
- }
- }
-
- LRESULT lResult = 0;
- bool handled = false;
-
- if (type) {
- std::tie(handled, lResult) = type->message(hWnd, message, wParam, lParam);
- }
-
- if (!handled) {
- lResult = DefWindowProc(hWnd, message, wParam, lParam);
- }
-
- if (message == WM_NCDESTROY) {
- detail::erase(hWnd);
- // let type destruct
- unwind_type.dismiss();
- }
-
- return lResult;
- }
-}
diff --git a/Rx/v2/license.txt b/Rx/v2/license.txt
deleted file mode 100644
index 5b47fbd..0000000
--- a/Rx/v2/license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
-Microsoft Open Technologies would like to thank its contributors, a list
-of whom are at http://rx.codeplex.com/wikipage?title=Contributors.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you
-may not use this file except in compliance with the License. You may
-obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-implied. See the License for the specific language governing permissions
-and limitations under the License. \ No newline at end of file
diff --git a/Rx/v2/src/rxcpp/operators/rx-all.hpp b/Rx/v2/src/rxcpp/operators/rx-all.hpp
deleted file mode 100644
index a0f6a3e..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-all.hpp
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-all.hpp
-
- \brief Returns an Observable that emits true if every item emitted by the source Observable satisfies a specified condition, otherwise false.
- Emits true if the source Observable terminates without emitting any item.
-
- \tparam Predicate the type of the test function.
-
- \param p the test function to test items emitted by the source Observable.
-
- \return Observable that emits true if every item emitted by the source observable satisfies a specified condition, otherwise false.
-
- \sample
- \snippet all.cpp all sample
- \snippet output.txt all sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_ALL_HPP)
-#define RXCPP_OPERATORS_RX_ALL_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct all_invalid_arguments {};
-
-template<class... AN>
-struct all_invalid : public rxo::operator_base<all_invalid_arguments<AN...>> {
- using type = observable<all_invalid_arguments<AN...>, all_invalid<AN...>>;
-};
-template<class... AN>
-using all_invalid_t = typename all_invalid<AN...>::type;
-
-template<class T, class Predicate>
-struct all
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Predicate> test_type;
- test_type test;
-
- typedef bool value_type;
-
- all(test_type t)
- : test(std::move(t))
- {
- }
-
- template<class Subscriber>
- struct all_observer
- {
- typedef all_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- test_type test;
- mutable bool done;
-
- all_observer(dest_type d, test_type t)
- : dest(std::move(d))
- , test(std::move(t)),
- done(false)
- {
- }
- void on_next(source_value_type v) const {
- auto filtered = on_exception([&]() {
- return !this->test(v); },
- dest);
- if (filtered.empty()) {
- return;
- }
- if (filtered.get() && !done) {
- done = true;
- dest.on_next(false);
- dest.on_completed();
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- if(!done) {
- done = true;
- dest.on_next(true);
- dest.on_completed();
- }
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
- return make_subscriber<value_type>(d, this_type(d, std::move(t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(all_observer<Subscriber>::make(std::move(dest), test)) {
- return all_observer<Subscriber>::make(std::move(dest), test);
- }
-};
-
-}
-
-/*! @copydoc rx-all.hpp
-*/
-template<class... AN>
-auto all(AN&&... an)
- -> operator_factory<all_tag, AN...> {
- return operator_factory<all_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief Returns an Observable that emits true if the source Observable is empty, otherwise false.
-
- \return An observable that emits a boolean value.
-
- \sample
- \snippet is_empty.cpp is_empty sample
- \snippet output.txt is_empty sample
-*/
-template<class... AN>
-auto is_empty(AN&&... an)
--> operator_factory<is_empty_tag, AN...> {
- return operator_factory<is_empty_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<all_tag>
-{
- template<class Observable, class Predicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class All = rxo::detail::all<SourceValue, rxu::decay_t<Predicate>>,
- class Value = rxu::value_type_t<All>>
- static auto member(Observable&& o, Predicate&& p)
- -> decltype(o.template lift<Value>(All(std::forward<Predicate>(p)))) {
- return o.template lift<Value>(All(std::forward<Predicate>(p)));
- }
-
- template<class... AN>
- static operators::detail::all_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "all takes (Predicate)");
- }
-};
-
-template<>
-struct member_overload<is_empty_tag>
-{
- template<class Observable,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class Predicate = std::function<bool(SourceValue)>,
- class IsEmpty = rxo::detail::all<SourceValue, rxu::decay_t<Predicate>>,
- class Value = rxu::value_type_t<IsEmpty>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<Value>(IsEmpty(nullptr))) {
- return o.template lift<Value>(IsEmpty([](SourceValue) { return false; }));
- }
-
- template<class... AN>
- static operators::detail::all_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "is_empty takes no arguments");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-amb.hpp b/Rx/v2/src/rxcpp/operators/rx-amb.hpp
deleted file mode 100644
index 56bfbe9..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-amb.hpp
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-amb.hpp
-
- \brief For each item from only the first of the given observables deliver from the new observable that is returned, on the specified scheduler.
-
- There are 2 variants of the operator:
- - The source observable emits nested observables, one of the nested observables is selected.
- - The source observable and the arguments v0...vn are used to provide the observables to select from.
-
- \tparam Coordination the type of the scheduler (optional).
- \tparam Value0 ... (optional).
- \tparam ValueN types of source observables (optional).
-
- \param cn the scheduler to synchronize sources from different contexts (optional).
- \param v0 ... (optional).
- \param vn source observables (optional).
-
- \return Observable that emits the same sequence as whichever of the source observables first emitted an item or sent a termination notification.
-
- If scheduler is omitted, identity_current_thread is used.
-
- \sample
- \snippet amb.cpp threaded implicit amb sample
- \snippet output.txt threaded implicit amb sample
-
- \snippet amb.cpp implicit amb sample
- \snippet output.txt implicit amb sample
-
- \snippet amb.cpp amb sample
- \snippet output.txt amb sample
-
- \snippet amb.cpp threaded amb sample
- \snippet output.txt threaded amb sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_AMB_HPP)
-#define RXCPP_OPERATORS_RX_AMB_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct amb_invalid_arguments {};
-
-template<class... AN>
-struct amb_invalid : public rxo::operator_base<amb_invalid_arguments<AN...>> {
- using type = observable<amb_invalid_arguments<AN...>, amb_invalid<AN...>>;
-};
-template<class... AN>
-using amb_invalid_t = typename amb_invalid<AN...>::type;
-
-template<class T, class Observable, class Coordination>
-struct amb
- : public operator_base<rxu::value_type_t<T>>
-{
- //static_assert(is_observable<Observable>::value, "amb requires an observable");
- //static_assert(is_observable<T>::value, "amb requires an observable that contains observables");
-
- typedef amb<T, Observable, Coordination> this_type;
-
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Observable> source_type;
-
- typedef typename source_type::source_operator_type source_operator_type;
- typedef typename source_value_type::value_type value_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_operator_type o, coordination_type sf)
- : source_operator(std::move(o))
- , coordination(std::move(sf))
- {
- }
- source_operator_type source_operator;
- coordination_type coordination;
- };
- values initial;
-
- amb(const source_type& o, coordination_type sf)
- : initial(o.source_operator, std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct amb_state_type
- : public std::enable_shared_from_this<amb_state_type>
- , public values
- {
- amb_state_type(values i, coordinator_type coor, output_type oarg)
- : values(i)
- , source(i.source_operator)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- , pendingObservables(0)
- , firstEmitted(false)
- {
- }
- observable<source_value_type, source_operator_type> source;
- coordinator_type coordinator;
- output_type out;
- int pendingObservables;
- bool firstEmitted;
- std::vector<composite_subscription> innerSubscriptions;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<amb_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- composite_subscription outercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(outercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- outercs,
- // on_next
- [state](source_value_type st) {
-
- if (state->firstEmitted)
- return;
-
- composite_subscription innercs;
-
- state->innerSubscriptions.push_back(innercs);
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(innercs);
-
- innercs.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedSource = state->coordinator.in(st);
-
- auto current_id = state->pendingObservables++;
-
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<value_type>(
- state->out,
- innercs,
- // on_next
- [state, st, current_id](value_type ct) {
- state->out.on_next(std::move(ct));
- if (!state->firstEmitted) {
- state->firstEmitted = true;
- auto do_unsubscribe = [](composite_subscription cs) {
- cs.unsubscribe();
- };
- std::for_each(state->innerSubscriptions.begin(), state->innerSubscriptions.begin() + current_id, do_unsubscribe);
- std::for_each(state->innerSubscriptions.begin() + current_id + 1, state->innerSubscriptions.end(), do_unsubscribe);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- state->out.on_completed();
- }
- );
-
- auto selectedSinkInner = state->coordinator.out(sinkInner);
- selectedSource.subscribe(std::move(selectedSinkInner));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (state->pendingObservables == 0) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
-};
-
-}
-
-/*! @copydoc rx-amb.hpp
-*/
-template<class... AN>
-auto amb(AN&&... an)
- -> operator_factory<amb_tag, AN...> {
- return operator_factory<amb_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<amb_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Amb = rxo::detail::amb<SourceValue, rxu::decay_t<Observable>, identity_one_worker>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Amb>
- >
- static Result member(Observable&& o) {
- return Result(Amb(std::forward<Observable>(o), identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Amb = rxo::detail::amb<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Amb>
- >
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(Amb(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Amb = typename rxu::defer_type<rxo::detail::amb, SourceValue, ObservableObservable, identity_one_worker>::type,
- class Value = rxu::value_type_t<Amb>,
- class Result = observable<Value, Amb>
- >
- static Result member(Observable&& o, Value0&& v0, ValueN&&... vn) {
- return Result(Amb(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>,
- is_coordination<Coordination>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Amb = typename rxu::defer_type<rxo::detail::amb, SourceValue, ObservableObservable, rxu::decay_t<Coordination>>::type,
- class Value = rxu::value_type_t<Amb>,
- class Result = observable<Value, Amb>
- >
- static Result member(Observable&& o, Coordination&& cn, Value0&& v0, ValueN&&... vn) {
- return Result(Amb(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::amb_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "amb takes (optional Coordination, optional Value0, optional ValueN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-any.hpp b/Rx/v2/src/rxcpp/operators/rx-any.hpp
deleted file mode 100644
index 19fca6e..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-any.hpp
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-any.hpp
-
- \brief Returns an Observable that emits true if any item emitted by the source Observable satisfies a specified condition, otherwise false. Emits false if the source Observable terminates without emitting any item.
-
- \tparam Predicate the type of the test function.
-
- \param p the test function to test items emitted by the source Observable.
-
- \return An observable that emits true if any item emitted by the source observable satisfies a specified condition, otherwise false.
-
- Some basic any- operators have already been implemented:
- - rxcpp::operators::exists
- - rxcpp::operators::contains
-
- \sample
- \snippet exists.cpp exists sample
- \snippet output.txt exists sample
-
- \sample
- \snippet contains.cpp contains sample
- \snippet output.txt contains sample
-*/
-
-
-#if !defined(RXCPP_OPERATORS_RX_ANY_HPP)
-#define RXCPP_OPERATORS_RX_ANY_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct any_invalid_arguments {};
-
-template<class... AN>
-struct any_invalid : public rxo::operator_base<any_invalid_arguments<AN...>> {
- using type = observable<any_invalid_arguments<AN...>, any_invalid<AN...>>;
-};
-template<class... AN>
-using any_invalid_t = typename any_invalid<AN...>::type;
-
-template<class T, class Predicate>
-struct any
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef bool value_type;
- typedef rxu::decay_t<Predicate> test_type;
- test_type test;
-
- any(test_type t)
- : test(std::move(t))
- {
- }
-
- template<class Subscriber>
- struct any_observer
- {
- typedef any_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- test_type test;
- mutable bool done;
-
- any_observer(dest_type d, test_type t)
- : dest(std::move(d))
- , test(std::move(t)),
- done(false)
- {
- }
- void on_next(source_value_type v) const {
- auto filtered = on_exception([&]() {
- return !this->test(v); },
- dest);
- if (filtered.empty()) {
- return;
- }
- if (!filtered.get() && !done) {
- done = true;
- dest.on_next(true);
- dest.on_completed();
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- if(!done) {
- done = true;
- dest.on_next(false);
- dest.on_completed();
- }
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
- return make_subscriber<value_type>(d, this_type(d, std::move(t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(any_observer<Subscriber>::make(std::move(dest), test)) {
- return any_observer<Subscriber>::make(std::move(dest), test);
- }
-};
-
-}
-
-/*! @copydoc rx-any.hpp
-*/
-template<class... AN>
-auto any(AN&&... an)
- -> operator_factory<any_tag, AN...> {
- return operator_factory<any_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief Returns an Observable that emits true if any item emitted by the source Observable satisfies a specified condition, otherwise false. Emits false if the source Observable terminates without emitting any item.
-
- \tparam Predicate the type of the test function.
-
- \param p the test function to test items emitted by the source Observable.
-
- \return An observable that emits true if any item emitted by the source observable satisfies a specified condition, otherwise false.
-
- \sample
- \snippet exists.cpp exists sample
- \snippet output.txt exists sample
-*/
-template<class... AN>
-auto exists(AN&&... an)
- -> operator_factory<exists_tag, AN...> {
- return operator_factory<exists_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief Returns an Observable that emits true if the source Observable emitted a specified item, otherwise false. Emits false if the source Observable terminates without emitting any item.
-
- \tparam T the type of the item to search for.
-
- \param value the item to search for.
-
- \return An observable that emits true if the source Observable emitted a specified item, otherwise false.
-
- \sample
- \snippet contains.cpp contains sample
- \snippet output.txt contains sample
-*/
-template<class... AN>
-auto contains(AN&&... an)
--> operator_factory<contains_tag, AN...> {
- return operator_factory<contains_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<any_tag>
-{
- template<class Observable, class Predicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class Any = rxo::detail::any<SourceValue, rxu::decay_t<Predicate>>,
- class Value = rxu::value_type_t<Any>>
- static auto member(Observable&& o, Predicate&& p)
- -> decltype(o.template lift<Value>(Any(std::forward<Predicate>(p)))) {
- return o.template lift<Value>(Any(std::forward<Predicate>(p)));
- }
-
- template<class... AN>
- static operators::detail::any_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "any takes (Predicate)");
- }
-};
-
-template<>
-struct member_overload<exists_tag>
- : member_overload<any_tag>
-{
- using member_overload<any_tag>::member;
-
- template<class... AN>
- static operators::detail::any_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "exists takes (Predicate)");
- }
-};
-
-template<>
-struct member_overload<contains_tag>
-{
- template<class Observable, class T,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class Predicate = std::function<bool(T)>,
- class Any = rxo::detail::any<SourceValue, rxu::decay_t<Predicate>>,
- class Value = rxu::value_type_t<Any>>
- static auto member(Observable&& o, T&& value)
- -> decltype(o.template lift<Value>(Any(nullptr))) {
- return o.template lift<Value>(Any([value](T n) { return n == value; }));
- }
-
- template<class... AN>
- static operators::detail::any_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "contains takes (T)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp
deleted file mode 100644
index 79eb30e..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-buffer_count.hpp
-
- \brief Return an observable that emits connected, non-overlapping buffer, each containing at most count items from the source observable.
- If the skip parameter is set, return an observable that emits buffers every skip items containing at most count items from the source observable.
-
- \param count the maximum size of each buffers before it should be emitted.
- \param skip how many items need to be skipped before starting a new buffers (optional).
-
- \return Observable that emits connected, non-overlapping buffers, each containing at most count items from the source observable.
- If the skip parameter is set, return an Observable that emits buffers every skip items containing at most count items from the source observable.
-
- \sample
- \snippet buffer.cpp buffer count sample
- \snippet output.txt buffer count sample
-
- \sample
- \snippet buffer.cpp buffer count+skip sample
- \snippet output.txt buffer count+skip sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_BUFFER_COUNT_HPP)
-#define RXCPP_OPERATORS_RX_BUFFER_COUNT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct buffer_count_invalid_arguments {};
-
-template<class... AN>
-struct buffer_count_invalid : public rxo::operator_base<buffer_count_invalid_arguments<AN...>> {
- using type = observable<buffer_count_invalid_arguments<AN...>, buffer_count_invalid<AN...>>;
-};
-template<class... AN>
-using buffer_count_invalid_t = typename buffer_count_invalid<AN...>::type;
-
-template<class T>
-struct buffer_count
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef std::vector<source_value_type> value_type;
-
- struct buffer_count_values
- {
- buffer_count_values(int c, int s)
- : count(c)
- , skip(s)
- {
- }
- int count;
- int skip;
- };
-
- buffer_count_values initial;
-
- buffer_count(int count, int skip)
- : initial(count, skip)
- {
- }
-
- template<class Subscriber>
- struct buffer_count_observer : public buffer_count_values
- {
- typedef buffer_count_observer<Subscriber> this_type;
- typedef std::vector<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- mutable int cursor;
- mutable std::deque<value_type> chunks;
-
- buffer_count_observer(dest_type d, buffer_count_values v)
- : buffer_count_values(v)
- , dest(std::move(d))
- , cursor(0)
- {
- }
- void on_next(T v) const {
- if (cursor++ % this->skip == 0) {
- chunks.emplace_back();
- }
- for(auto& chunk : chunks) {
- chunk.push_back(v);
- }
- while (!chunks.empty() && int(chunks.front().size()) == this->count) {
- dest.on_next(std::move(chunks.front()));
- chunks.pop_front();
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- auto done = on_exception(
- [&](){
- while (!chunks.empty()) {
- dest.on_next(std::move(chunks.front()));
- chunks.pop_front();
- }
- return true;
- },
- dest);
- if (done.empty()) {
- return;
- }
- dest.on_completed();
- }
-
- static subscriber<T, observer<T, this_type>> make(dest_type d, buffer_count_values v) {
- auto cs = d.get_subscription();
- return make_subscriber<T>(std::move(cs), this_type(std::move(d), std::move(v)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(buffer_count_observer<Subscriber>::make(std::move(dest), initial)) {
- return buffer_count_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-buffer_count.hpp
-*/
-template<class... AN>
-auto buffer(AN&&... an)
- -> operator_factory<buffer_count_tag, AN...> {
- return operator_factory<buffer_count_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<buffer_count_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferCount = rxo::detail::buffer_count<SourceValue>,
- class Value = rxu::value_type_t<BufferCount>>
- static auto member(Observable&& o, int count, int skip)
- -> decltype(o.template lift<Value>(BufferCount(count, skip))) {
- return o.template lift<Value>(BufferCount(count, skip));
- }
-
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferCount = rxo::detail::buffer_count<SourceValue>,
- class Value = rxu::value_type_t<BufferCount>>
- static auto member(Observable&& o, int count)
- -> decltype(o.template lift<Value>(BufferCount(count, count))) {
- return o.template lift<Value>(BufferCount(count, count));
- }
-
- template<class... AN>
- static operators::detail::buffer_count_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "buffer takes (Count, optional Skip)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp
deleted file mode 100644
index aa94f7b..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp
+++ /dev/null
@@ -1,326 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-buffer_time.hpp
-
- \brief Return an observable that emits buffers every period time interval and collects items from this observable for period of time into each produced buffer.
- If the skip parameter is set, Return an observable that emits buffers every skip time interval and collects items from this observable for period of time into each produced buffer, on the specified scheduler.
-
- \tparam Duration the type of the time interval
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time each buffer collects items before it is emitted.
- \param skip the period of time after which a new buffer will be created (optional).
- \param coordination the scheduler for the buffers (optional).
-
- \return Observable that emits buffers every period time interval and collect items from this observable for period of time into each produced buffer.
- If the skip parameter is set, return an Observable that emits buffers every skip time interval and collect items from this observable for period of time into each produced buffer.
-
- \sample
- \snippet buffer.cpp buffer period+skip+coordination sample
- \snippet output.txt buffer period+skip+coordination sample
-
- \sample
- \snippet buffer.cpp buffer period+skip sample
- \snippet output.txt buffer period+skip sample
-
- Overlapping buffers are allowed:
- \snippet buffer.cpp buffer period+skip overlapping sample
- \snippet output.txt buffer period+skip overlapping sample
-
- If no items are emitted, an empty buffer is returned:
- \snippet buffer.cpp buffer period+skip empty sample
- \snippet output.txt buffer period+skip empty sample
-
- \sample
- \snippet buffer.cpp buffer period+coordination sample
- \snippet output.txt buffer period+coordination sample
-
- \sample
- \snippet buffer.cpp buffer period sample
- \snippet output.txt buffer period sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_BUFFER_WITH_TIME_HPP)
-#define RXCPP_OPERATORS_RX_BUFFER_WITH_TIME_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct buffer_with_time_invalid_arguments {};
-
-template<class... AN>
-struct buffer_with_time_invalid : public rxo::operator_base<buffer_with_time_invalid_arguments<AN...>> {
- using type = observable<buffer_with_time_invalid_arguments<AN...>, buffer_with_time_invalid<AN...>>;
-};
-template<class... AN>
-using buffer_with_time_invalid_t = typename buffer_with_time_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct buffer_with_time
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef std::vector<source_value_type> value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct buffer_with_time_values
- {
- buffer_with_time_values(duration_type p, duration_type s, coordination_type c)
- : period(p)
- , skip(s)
- , coordination(c)
- {
- }
- duration_type period;
- duration_type skip;
- coordination_type coordination;
- };
- buffer_with_time_values initial;
-
- buffer_with_time(duration_type period, duration_type skip, coordination_type coordination)
- : initial(period, skip, coordination)
- {
- }
-
- template<class Subscriber>
- struct buffer_with_time_observer
- {
- typedef buffer_with_time_observer<Subscriber> this_type;
- typedef std::vector<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- struct buffer_with_time_subscriber_values : public buffer_with_time_values
- {
- buffer_with_time_subscriber_values(composite_subscription cs, dest_type d, buffer_with_time_values v, coordinator_type c)
- : buffer_with_time_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , expected(worker.now())
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable std::deque<value_type> chunks;
- rxsc::scheduler::clock_type::time_point expected;
- };
- std::shared_ptr<buffer_with_time_subscriber_values> state;
-
- buffer_with_time_observer(composite_subscription cs, dest_type d, buffer_with_time_values v, coordinator_type c)
- : state(std::make_shared<buffer_with_time_subscriber_values>(buffer_with_time_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return localState->coordinator.act(disposer);},
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- //
- // The scheduler is FIFO for any time T. Since the observer is scheduling
- // on_next/on_error/oncompleted the timed schedule calls must be resheduled
- // when they occur to ensure that production happens after on_next/on_error/oncompleted
- //
-
- auto produce_buffer = [localState](const rxsc::schedulable&) {
- localState->dest.on_next(std::move(localState->chunks.front()));
- localState->chunks.pop_front();
- };
- auto selectedProduce = on_exception(
- [&](){return localState->coordinator.act(produce_buffer);},
- localState->dest);
- if (selectedProduce.empty()) {
- return;
- }
-
- auto create_buffer = [localState, selectedProduce](const rxsc::schedulable&) {
- localState->chunks.emplace_back();
- auto produce_at = localState->expected + localState->period;
- localState->expected += localState->skip;
- localState->worker.schedule(produce_at, [localState, selectedProduce](const rxsc::schedulable&) {
- localState->worker.schedule(selectedProduce.get());
- });
- };
- auto selectedCreate = on_exception(
- [&](){return localState->coordinator.act(create_buffer);},
- localState->dest);
- if (selectedCreate.empty()) {
- return;
- }
-
- state->worker.schedule_periodically(
- state->expected,
- state->skip,
- [localState, selectedCreate](const rxsc::schedulable&) {
- localState->worker.schedule(selectedCreate.get());
- });
- }
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&){
- for(auto& chunk : localState->chunks) {
- chunk.push_back(v);
- }
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- on_exception(
- [&](){
- while (!localState->chunks.empty()) {
- localState->dest.on_next(std::move(localState->chunks.front()));
- localState->chunks.pop_front();
- }
- return true;
- },
- localState->dest);
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer<T, this_type>> make(dest_type d, buffer_with_time_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, this_type(cs, std::move(d), std::move(v), std::move(coordinator)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(buffer_with_time_observer<Subscriber>::make(std::move(dest), initial)) {
- return buffer_with_time_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-buffer_time.hpp
-*/
-template<class... AN>
-auto buffer_with_time(AN&&... an)
- -> operator_factory<buffer_with_time_tag, AN...> {
- return operator_factory<buffer_with_time_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<buffer_with_time_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferWithTime = rxo::detail::buffer_with_time<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<BufferWithTime>>
- static auto member(Observable&& o, Duration period)
- -> decltype(o.template lift<Value>(BufferWithTime(period, period, identity_current_thread()))) {
- return o.template lift<Value>(BufferWithTime(period, period, identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferWithTime = rxo::detail::buffer_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<BufferWithTime>>
- static auto member(Observable&& o, Duration period, Coordination&& cn)
- -> decltype(o.template lift<Value>(BufferWithTime(period, period, std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(BufferWithTime(period, period, std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferWithTime = rxo::detail::buffer_with_time<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<BufferWithTime>>
- static auto member(Observable&& o, Duration&& period, Duration&& skip)
- -> decltype(o.template lift<Value>(BufferWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), identity_current_thread()))) {
- return o.template lift<Value>(BufferWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferWithTime = rxo::detail::buffer_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<BufferWithTime>>
- static auto member(Observable&& o, Duration&& period, Duration&& skip, Coordination&& cn)
- -> decltype(o.template lift<Value>(BufferWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(BufferWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::buffer_with_time_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "buffer_with_time takes (Duration, optional Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp
deleted file mode 100644
index 6d4b9a4..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-buffer_time_count.hpp
-
- \brief Return an observable that emits connected, non-overlapping buffers of items from the source observable that were emitted during a fixed duration of time or when the buffer has reached maximum capacity (whichever occurs first), on the specified scheduler.
-
- \tparam Duration the type of the time interval.
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time each buffer collects items before it is emitted and replaced with a new buffer.
- \param count the maximum size of each buffer before it is emitted and new buffer is created.
- \param coordination the scheduler for the buffers (optional).
-
- \return Observable that emits connected, non-overlapping buffers of items from the source observable that were emitted during a fixed duration of time or when the buffer has reached maximum capacity (whichever occurs first).
-
- \sample
- \snippet buffer.cpp buffer period+count+coordination sample
- \snippet output.txt buffer period+count+coordination sample
-
- \sample
- \snippet buffer.cpp buffer period+count sample
- \snippet output.txt buffer period+count sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_BUFFER_WITH_TIME_OR_COUNT_HPP)
-#define RXCPP_OPERATORS_RX_BUFFER_WITH_TIME_OR_COUNT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct buffer_with_time_or_count_invalid_arguments {};
-
-template<class... AN>
-struct buffer_with_time_or_count_invalid : public rxo::operator_base<buffer_with_time_or_count_invalid_arguments<AN...>> {
- using type = observable<buffer_with_time_or_count_invalid_arguments<AN...>, buffer_with_time_or_count_invalid<AN...>>;
-};
-template<class... AN>
-using buffer_with_time_or_count_invalid_t = typename buffer_with_time_or_count_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct buffer_with_time_or_count
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef std::vector<source_value_type> value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct buffer_with_time_or_count_values
- {
- buffer_with_time_or_count_values(duration_type p, int n, coordination_type c)
- : period(p)
- , count(n)
- , coordination(c)
- {
- }
- duration_type period;
- int count;
- coordination_type coordination;
- };
- buffer_with_time_or_count_values initial;
-
- buffer_with_time_or_count(duration_type period, int count, coordination_type coordination)
- : initial(period, count, coordination)
- {
- }
-
- template<class Subscriber>
- struct buffer_with_time_or_count_observer
- {
- typedef buffer_with_time_or_count_observer<Subscriber> this_type;
- typedef std::vector<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- struct buffer_with_time_or_count_subscriber_values : public buffer_with_time_or_count_values
- {
- buffer_with_time_or_count_subscriber_values(composite_subscription cs, dest_type d, buffer_with_time_or_count_values v, coordinator_type c)
- : buffer_with_time_or_count_values(std::move(v))
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , chunk_id(0)
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable int chunk_id;
- mutable value_type chunk;
- };
- typedef std::shared_ptr<buffer_with_time_or_count_subscriber_values> state_type;
- state_type state;
-
- buffer_with_time_or_count_observer(composite_subscription cs, dest_type d, buffer_with_time_or_count_values v, coordinator_type c)
- : state(std::make_shared<buffer_with_time_or_count_subscriber_values>(buffer_with_time_or_count_subscriber_values(std::move(cs), std::move(d), std::move(v), std::move(c))))
- {
- auto new_id = state->chunk_id;
- auto produce_time = state->worker.now() + state->period;
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return localState->coordinator.act(disposer);},
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- //
- // The scheduler is FIFO for any time T. Since the observer is scheduling
- // on_next/on_error/oncompleted the timed schedule calls must be resheduled
- // when they occur to ensure that production happens after on_next/on_error/oncompleted
- //
-
- localState->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){
- localState->worker.schedule(produce_buffer(new_id, produce_time, localState));
- });
- }
-
- static std::function<void(const rxsc::schedulable&)> produce_buffer(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) {
- auto produce = [id, expected, state](const rxsc::schedulable&) {
- if (id != state->chunk_id)
- return;
-
- state->dest.on_next(state->chunk);
- state->chunk.resize(0);
- auto new_id = ++state->chunk_id;
- auto produce_time = expected + state->period;
- state->worker.schedule(produce_time, [new_id, produce_time, state](const rxsc::schedulable&){
- state->worker.schedule(produce_buffer(new_id, produce_time, state));
- });
- };
-
- auto selectedProduce = on_exception(
- [&](){return state->coordinator.act(produce);},
- state->dest);
- if (selectedProduce.empty()) {
- return std::function<void(const rxsc::schedulable&)>();
- }
-
- return std::function<void(const rxsc::schedulable&)>(selectedProduce.get());
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable& self){
- localState->chunk.push_back(v);
- if (int(localState->chunk.size()) == localState->count) {
- produce_buffer(localState->chunk_id, localState->worker.now(), localState)(self);
- }
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- localState->dest.on_next(localState->chunk);
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer<T, this_type>> make(dest_type d, buffer_with_time_or_count_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, this_type(cs, std::move(d), std::move(v), std::move(coordinator)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(buffer_with_time_or_count_observer<Subscriber>::make(std::move(dest), initial)) {
- return buffer_with_time_or_count_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-buffer_time_count.hpp
-*/
-template<class... AN>
-auto buffer_with_time_or_count(AN&&... an)
- -> operator_factory<buffer_with_time_or_count_tag, AN...> {
- return operator_factory<buffer_with_time_or_count_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<buffer_with_time_or_count_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferTimeCount = rxo::detail::buffer_with_time_or_count<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<BufferTimeCount>>
- static auto member(Observable&& o, Duration&& period, int count)
- -> decltype(o.template lift<Value>(BufferTimeCount(std::forward<Duration>(period), count, identity_current_thread()))) {
- return o.template lift<Value>(BufferTimeCount(std::forward<Duration>(period), count, identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BufferTimeCount = rxo::detail::buffer_with_time_or_count<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<BufferTimeCount>>
- static auto member(Observable&& o, Duration&& period, int count, Coordination&& cn)
- -> decltype(o.template lift<Value>(BufferTimeCount(std::forward<Duration>(period), count, std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(BufferTimeCount(std::forward<Duration>(period), count, std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::buffer_with_time_or_count_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "buffer_with_time_or_count takes (Duration, Count, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp
deleted file mode 100644
index 06ff3d1..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-combine_latest.hpp
-
- \brief For each item from all of the observables select a value to emit from the new observable that is returned.
-
- \tparam AN types of scheduler (optional), aggregate function (optional), and source observables
-
- \param an scheduler (optional), aggregation function (optional), and source observables
-
- \return Observable that emits items that are the result of combining the items emitted by the source observables.
-
- If scheduler is omitted, identity_current_thread is used.
-
- If aggregation function is omitted, the resulting observable returns tuples of emitted items.
-
- \sample
-
- Neither scheduler nor aggregation function are present:
- \snippet combine_latest.cpp combine_latest sample
- \snippet output.txt combine_latest sample
-
- Only scheduler is present:
- \snippet combine_latest.cpp Coordination combine_latest sample
- \snippet output.txt Coordination combine_latest sample
-
- Only aggregation function is present:
- \snippet combine_latest.cpp Selector combine_latest sample
- \snippet output.txt Selector combine_latest sample
-
- Both scheduler and aggregation function are present:
- \snippet combine_latest.cpp Coordination+Selector combine_latest sample
- \snippet output.txt Coordination+Selector combine_latest sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_COMBINE_LATEST_HPP)
-#define RXCPP_OPERATORS_RX_COMBINE_LATEST_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct combine_latest_invalid_arguments {};
-
-template<class... AN>
-struct combine_latest_invalid : public rxo::operator_base<combine_latest_invalid_arguments<AN...>> {
- using type = observable<combine_latest_invalid_arguments<AN...>, combine_latest_invalid<AN...>>;
-};
-template<class... AN>
-using combine_latest_invalid_t = typename combine_latest_invalid<AN...>::type;
-
-template<class Selector, class... ObservableN>
-struct is_combine_latest_selector_check {
- typedef rxu::decay_t<Selector> selector_type;
-
- struct tag_not_valid;
- template<class CS, class... CON>
- static auto check(int) -> decltype((*(CS*)nullptr)((*(typename CON::value_type*)nullptr)...));
- template<class CS, class... CON>
- static tag_not_valid check(...);
-
- using type = decltype(check<selector_type, rxu::decay_t<ObservableN>...>(0));
-
- static const bool value = !std::is_same<type, tag_not_valid>::value;
-};
-
-template<class Selector, class... ObservableN>
-struct invalid_combine_latest_selector {
- static const bool value = false;
-};
-
-template<class Selector, class... ObservableN>
-struct is_combine_latest_selector : public std::conditional<
- is_combine_latest_selector_check<Selector, ObservableN...>::value,
- is_combine_latest_selector_check<Selector, ObservableN...>,
- invalid_combine_latest_selector<Selector, ObservableN...>>::type {
-};
-
-template<class Selector, class... ON>
-using result_combine_latest_selector_t = typename is_combine_latest_selector<Selector, ON...>::type;
-
-template<class Coordination, class Selector, class... ObservableN>
-struct combine_latest_traits {
-
- typedef std::tuple<ObservableN...> tuple_source_type;
- typedef std::tuple<rxu::detail::maybe<typename ObservableN::value_type>...> tuple_source_value_type;
-
- typedef rxu::decay_t<Selector> selector_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename is_combine_latest_selector<selector_type, ObservableN...>::type value_type;
-};
-
-template<class Coordination, class Selector, class... ObservableN>
-struct combine_latest : public operator_base<rxu::value_type_t<combine_latest_traits<Coordination, Selector, ObservableN...>>>
-{
- typedef combine_latest<Coordination, Selector, ObservableN...> this_type;
-
- typedef combine_latest_traits<Coordination, Selector, ObservableN...> traits;
-
- typedef typename traits::tuple_source_type tuple_source_type;
- typedef typename traits::tuple_source_value_type tuple_source_value_type;
-
- typedef typename traits::selector_type selector_type;
-
- typedef typename traits::coordination_type coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(tuple_source_type o, selector_type s, coordination_type sf)
- : source(std::move(o))
- , selector(std::move(s))
- , coordination(std::move(sf))
- {
- }
- tuple_source_type source;
- selector_type selector;
- coordination_type coordination;
- };
- values initial;
-
- combine_latest(coordination_type sf, selector_type s, tuple_source_type ts)
- : initial(std::move(ts), std::move(s), std::move(sf))
- {
- }
-
- template<int Index, class State>
- void subscribe_one(std::shared_ptr<State> state) const {
-
- typedef typename std::tuple_element<Index, tuple_source_type>::type::value_type source_value_type;
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(innercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(std::get<Index>(state->source));},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- innercs,
- // on_next
- [state](source_value_type st) {
- auto& value = std::get<Index>(state->latest);
-
- if (value.empty()) {
- ++state->valuesSet;
- }
-
- value.reset(st);
-
- if (state->valuesSet == sizeof... (ObservableN)) {
- auto values = rxu::surely(state->latest);
- auto selectedResult = rxu::apply(values, state->selector);
- state->out.on_next(selectedResult);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
- template<class State, int... IndexN>
- void subscribe_all(std::shared_ptr<State> state, rxu::values<int, IndexN...>) const {
- bool subscribed[] = {(subscribe_one<IndexN>(state), true)...};
- subscribed[0] = (*subscribed); // silence warning
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct combine_latest_state_type
- : public std::enable_shared_from_this<combine_latest_state_type>
- , public values
- {
- combine_latest_state_type(values i, coordinator_type coor, output_type oarg)
- : values(std::move(i))
- , pendingCompletions(sizeof... (ObservableN))
- , valuesSet(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
-
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- mutable int pendingCompletions;
- mutable int valuesSet;
- mutable tuple_source_value_type latest;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<combine_latest_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- subscribe_all(state, typename rxu::values_from<int, sizeof...(ObservableN)>::type());
- }
-};
-
-}
-
-/*! @copydoc rx-combine_latest.hpp
-*/
-template<class... AN>
-auto combine_latest(AN&&... an)
- -> operator_factory<combine_latest_tag, AN...> {
- return operator_factory<combine_latest_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<combine_latest_tag>
-{
- template<class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, ObservableN...>>,
- class combine_latest = rxo::detail::combine_latest<identity_one_worker, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<combine_latest>,
- class Result = observable<Value, combine_latest>>
- static Result member(Observable&& o, ObservableN&&... on)
- {
- return Result(combine_latest(identity_current_thread(), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Observable, class Selector, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- operators::detail::is_combine_latest_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class combine_latest = rxo::detail::combine_latest<identity_one_worker, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<combine_latest>,
- class Result = observable<Value, combine_latest>>
- static Result member(Observable&& o, Selector&& s, ObservableN&&... on)
- {
- return Result(combine_latest(identity_current_thread(), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- all_observables<Observable, ObservableN...>>,
- class combine_latest = rxo::detail::combine_latest<Coordination, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<combine_latest>,
- class Result = observable<Value, combine_latest>>
- static Result member(Observable&& o, Coordination&& cn, ObservableN&&... on)
- {
- return Result(combine_latest(std::forward<Coordination>(cn), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Selector, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- operators::detail::is_combine_latest_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class combine_latest = rxo::detail::combine_latest<Coordination, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<combine_latest>,
- class Result = observable<Value, combine_latest>>
- static Result member(Observable&& o, Coordination&& cn, Selector&& s, ObservableN&&... on)
- {
- return Result(combine_latest(std::forward<Coordination>(cn), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class... AN>
- static operators::detail::combine_latest_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "combine_latest takes (optional Coordination, optional Selector, required Observable, optional Observable...), Selector takes (Observable::value_type...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp
deleted file mode 100644
index 457b9cf..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-concat.hpp
-
- \brief 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.
-
- There are 2 variants of the operator:
- - The source observable emits nested observables, nested observables are concatenated.
- - The source observable and the arguments v0...vn are used to provide the observables to concatenate.
-
- \tparam Coordination the type of the scheduler (optional).
- \tparam Value0 ... (optional).
- \tparam ValueN types of source observables (optional).
-
- \param cn the scheduler to synchronize sources from different contexts (optional).
- \param v0 ... (optional).
- \param vn source observables (optional).
-
- \return Observable that emits the items emitted by each of the Observables emitted by the source observable, one after the other, without interleaving them.
-
- \sample
- \snippet concat.cpp implicit concat sample
- \snippet output.txt implicit concat sample
-
- \sample
- \snippet concat.cpp threaded implicit concat sample
- \snippet output.txt threaded implicit concat sample
-
- \sample
- \snippet concat.cpp concat sample
- \snippet output.txt concat sample
-
- \sample
- \snippet concat.cpp threaded concat sample
- \snippet output.txt threaded concat sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_CONCAT_HPP)
-#define RXCPP_OPERATORS_RX_CONCAT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct concat_invalid_arguments {};
-
-template<class... AN>
-struct concat_invalid : public rxo::operator_base<concat_invalid_arguments<AN...>> {
- using type = observable<concat_invalid_arguments<AN...>, concat_invalid<AN...>>;
-};
-template<class... AN>
-using concat_invalid_t = typename concat_invalid<AN...>::type;
-
-template<class T, class Observable, class Coordination>
-struct concat
- : public operator_base<rxu::value_type_t<rxu::decay_t<T>>>
-{
- typedef concat<T, Observable, Coordination> this_type;
-
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- typedef typename source_type::source_operator_type source_operator_type;
- typedef source_value_type collection_type;
- typedef typename collection_type::value_type value_type;
-
- struct values
- {
- values(source_operator_type o, coordination_type sf)
- : source_operator(std::move(o))
- , coordination(std::move(sf))
- {
- }
- source_operator_type source_operator;
- coordination_type coordination;
- };
- values initial;
-
- concat(const source_type& o, coordination_type sf)
- : initial(o.source_operator, std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct concat_state_type
- : public std::enable_shared_from_this<concat_state_type>
- , public values
- {
- concat_state_type(values i, coordinator_type coor, output_type oarg)
- : values(i)
- , source(i.source_operator)
- , sourceLifetime(composite_subscription::empty())
- , collectionLifetime(composite_subscription::empty())
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
-
- void subscribe_to(collection_type st)
- {
- auto state = this->shared_from_this();
-
- collectionLifetime = composite_subscription();
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(collectionLifetime);
-
- collectionLifetime.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedSource = on_exception(
- [&](){return state->coordinator.in(std::move(st));},
- state->out);
- if (selectedSource.empty()) {
- return;
- }
-
- // this subscribe does not share the out subscription
- // so that when it is unsubscribed the out will continue
- auto sinkInner = make_subscriber<value_type>(
- state->out,
- collectionLifetime,
- // on_next
- [state, st](value_type ct) {
- state->out.on_next(ct);
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- if (!state->selectedCollections.empty()) {
- auto value = state->selectedCollections.front();
- state->selectedCollections.pop_front();
- state->collectionLifetime.unsubscribe();
- state->subscribe_to(value);
- } else if (!state->sourceLifetime.is_subscribed()) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSinkInner = on_exception(
- [&](){return state->coordinator.out(sinkInner);},
- state->out);
- if (selectedSinkInner.empty()) {
- return;
- }
- selectedSource->subscribe(std::move(selectedSinkInner.get()));
- }
- observable<source_value_type, source_operator_type> source;
- composite_subscription sourceLifetime;
- composite_subscription collectionLifetime;
- std::deque<collection_type> selectedCollections;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<concat_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- state->sourceLifetime = composite_subscription();
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(state->sourceLifetime);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<collection_type>(
- state->out,
- state->sourceLifetime,
- // on_next
- [state](collection_type st) {
- if (state->collectionLifetime.is_subscribed()) {
- state->selectedCollections.push_back(st);
- } else if (state->selectedCollections.empty()) {
- state->subscribe_to(st);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (!state->collectionLifetime.is_subscribed() && state->selectedCollections.empty()) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
-};
-
-}
-
-/*! @copydoc rx-concat.hpp
-*/
-template<class... AN>
-auto concat(AN&&... an)
- -> operator_factory<concat_tag, AN...> {
- return operator_factory<concat_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<concat_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Concat = rxo::detail::concat<SourceValue, rxu::decay_t<Observable>, identity_one_worker>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Concat>
- >
- static Result member(Observable&& o) {
- return Result(Concat(std::forward<Observable>(o), identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Concat = rxo::detail::concat<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Concat>
- >
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(Concat(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Concat = typename rxu::defer_type<rxo::detail::concat, SourceValue, ObservableObservable, identity_one_worker>::type,
- class Value = rxu::value_type_t<Concat>,
- class Result = observable<Value, Concat>
- >
- static Result member(Observable&& o, Value0&& v0, ValueN&&... vn) {
- return Result(Concat(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>,
- is_coordination<Coordination>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Concat = typename rxu::defer_type<rxo::detail::concat, SourceValue, ObservableObservable, rxu::decay_t<Coordination>>::type,
- class Value = rxu::value_type_t<Concat>,
- class Result = observable<Value, Concat>
- >
- static Result member(Observable&& o, Coordination&& cn, Value0&& v0, ValueN&&... vn) {
- return Result(Concat(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::concat_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "concat takes (optional Coordination, optional Value0, optional ValueN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp
deleted file mode 100644
index 546c1eb..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-concat_map.hpp
-
- \brief For each item from this observable use the CollectionSelector to produce an observable and subscribe to that observable.
- For each item from all of the produced observables use the ResultSelector to produce a value to emit from the new observable that is returned.
-
- \tparam CollectionSelector the type of the observable producing function. CollectionSelector must be a function with the signature: observable(concat_map::source_value_type)
- \tparam ResultSelector the type of the aggregation function (optional). ResultSelector must be a function with the signature: concat_map::value_type(concat_map::source_value_type, concat_map::collection_value_type)
- \tparam Coordination the type of the scheduler (optional).
-
- \param s a function that returns an observable for each item emitted by the source observable.
- \param rs a function that combines one item emitted by each of the source and collection observables and returns an item to be emitted by the resulting observable (optional).
- \param cn the scheduler to synchronize sources from different contexts. (optional).
-
- \return Observable that emits the results of applying a function to a pair of values emitted by the source observable and the collection observable.
-
- Observables, produced by the CollectionSelector, are concatenated. There is another operator rxcpp::observable<T,SourceType>::flat_map that works similar but merges the observables.
-
- \sample
- \snippet concat_map.cpp concat_map sample
- \snippet output.txt concat_map sample
-
- \sample
- \snippet concat_map.cpp threaded concat_map sample
- \snippet output.txt threaded concat_map sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_CONCATMAP_HPP)
-#define RXCPP_OPERATORS_RX_CONCATMAP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct concat_map_invalid_arguments {};
-
-template<class... AN>
-struct concat_map_invalid : public rxo::operator_base<concat_map_invalid_arguments<AN...>> {
- using type = observable<concat_map_invalid_arguments<AN...>, concat_map_invalid<AN...>>;
-};
-template<class... AN>
-using concat_map_invalid_t = typename concat_map_invalid<AN...>::type;
-
-template<class Observable, class CollectionSelector, class ResultSelector, class Coordination>
-struct concat_traits {
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<CollectionSelector> collection_selector_type;
- typedef rxu::decay_t<ResultSelector> result_selector_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename source_type::value_type source_value_type;
-
- struct tag_not_valid {};
- template<class CV, class CCS>
- static auto collection_check(int) -> decltype((*(CCS*)nullptr)(*(CV*)nullptr));
- template<class CV, class CCS>
- static tag_not_valid collection_check(...);
-
- static_assert(!std::is_same<decltype(collection_check<source_value_type, collection_selector_type>(0)), tag_not_valid>::value, "concat_map CollectionSelector must be a function with the signature observable(concat_map::source_value_type)");
-
- typedef decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr))) collection_type;
-
-//#if _MSC_VER >= 1900
- static_assert(is_observable<collection_type>::value, "concat_map CollectionSelector must return an observable");
-//#endif
-
- typedef typename collection_type::value_type collection_value_type;
-
- template<class CV, class CCV, class CRS>
- static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CV*)nullptr, *(CCV*)nullptr));
- template<class CV, class CCV, class CRS>
- static tag_not_valid result_check(...);
-
- static_assert(!std::is_same<decltype(result_check<source_value_type, collection_value_type, result_selector_type>(0)), tag_not_valid>::value, "concat_map ResultSelector must be a function with the signature concat_map::value_type(concat_map::source_value_type, concat_map::collection_value_type)");
-
- typedef rxu::decay_t<decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr))> value_type;
-};
-
-template<class Observable, class CollectionSelector, class ResultSelector, class Coordination>
-struct concat_map
- : public operator_base<rxu::value_type_t<concat_traits<Observable, CollectionSelector, ResultSelector, Coordination>>>
-{
- typedef concat_map<Observable, CollectionSelector, ResultSelector, Coordination> this_type;
- typedef concat_traits<Observable, CollectionSelector, ResultSelector, Coordination> traits;
-
- typedef typename traits::source_type source_type;
- typedef typename traits::collection_selector_type collection_selector_type;
- typedef typename traits::result_selector_type result_selector_type;
-
- typedef typename traits::source_value_type source_value_type;
- typedef typename traits::collection_type collection_type;
- typedef typename traits::collection_value_type collection_value_type;
-
- typedef typename traits::coordination_type coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_type o, collection_selector_type s, result_selector_type rs, coordination_type sf)
- : source(std::move(o))
- , selectCollection(std::move(s))
- , selectResult(std::move(rs))
- , coordination(std::move(sf))
- {
- }
- source_type source;
- collection_selector_type selectCollection;
- result_selector_type selectResult;
- coordination_type coordination;
- private:
- values& operator=(const values&) RXCPP_DELETE;
- };
- values initial;
-
- concat_map(source_type o, collection_selector_type s, result_selector_type rs, coordination_type sf)
- : initial(std::move(o), std::move(s), std::move(rs), std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct concat_map_state_type
- : public std::enable_shared_from_this<concat_map_state_type>
- , public values
- {
- concat_map_state_type(values i, coordinator_type coor, output_type oarg)
- : values(std::move(i))
- , sourceLifetime(composite_subscription::empty())
- , collectionLifetime(composite_subscription::empty())
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
-
- void subscribe_to(source_value_type st)
- {
- auto state = this->shared_from_this();
-
- auto selectedCollection = on_exception(
- [&](){return state->selectCollection(st);},
- state->out);
- if (selectedCollection.empty()) {
- return;
- }
-
- collectionLifetime = composite_subscription();
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(collectionLifetime);
-
- collectionLifetime.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedSource = on_exception(
- [&](){return state->coordinator.in(selectedCollection.get());},
- state->out);
- if (selectedSource.empty()) {
- return;
- }
-
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<collection_value_type>(
- state->out,
- collectionLifetime,
- // on_next
- [state, st](collection_value_type ct) {
- auto selectedResult = state->selectResult(st, std::move(ct));
- state->out.on_next(std::move(selectedResult));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- if (!state->selectedCollections.empty()) {
- auto value = state->selectedCollections.front();
- state->selectedCollections.pop_front();
- state->collectionLifetime.unsubscribe();
- state->subscribe_to(value);
- } else if (!state->sourceLifetime.is_subscribed()) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSinkInner = on_exception(
- [&](){return state->coordinator.out(sinkInner);},
- state->out);
- if (selectedSinkInner.empty()) {
- return;
- }
- selectedSource->subscribe(std::move(selectedSinkInner.get()));
- }
- composite_subscription sourceLifetime;
- composite_subscription collectionLifetime;
- std::deque<source_value_type> selectedCollections;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<concat_map_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- state->sourceLifetime = composite_subscription();
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(state->sourceLifetime);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- state->sourceLifetime,
- // on_next
- [state](source_value_type st) {
- if (state->collectionLifetime.is_subscribed()) {
- state->selectedCollections.push_back(st);
- } else if (state->selectedCollections.empty()) {
- state->subscribe_to(st);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (!state->collectionLifetime.is_subscribed() && state->selectedCollections.empty()) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
-
- }
-private:
- concat_map& operator=(const concat_map&) RXCPP_DELETE;
-};
-
-}
-
-/*! @copydoc rx-concat_map.hpp
-*/
-template<class... AN>
-auto concat_map(AN&&... an)
--> operator_factory<concat_map_tag, AN...> {
- return operator_factory<concat_map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! @copydoc rx-concat_map.hpp
-*/
-template<class... AN>
-auto concat_transform(AN&&... an)
--> operator_factory<concat_map_tag, AN...> {
- return operator_factory<concat_map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<concat_map_tag>
-{
- template<class Observable, class CollectionSelector,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class ResultSelectorType = rxu::detail::take_at<1>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>>,
- class ConcatMap = rxo::detail::concat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, ResultSelectorType, identity_one_worker>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, ConcatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s) {
- return Result(ConcatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), ResultSelectorType(), identity_current_thread()));
- }
-
- template<class Observable, class CollectionSelector, class Coordination,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class ResultSelectorType = rxu::detail::take_at<1>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- is_coordination<Coordination>>,
- class ConcatMap = rxo::detail::concat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, ResultSelectorType, rxu::decay_t<Coordination>>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, ConcatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, Coordination&& cn) {
- return Result(ConcatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), ResultSelectorType(), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class CollectionSelector, class ResultSelector,
- class IsCoordination = is_coordination<ResultSelector>,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- rxu::negation<IsCoordination>>,
- class ConcatMap = rxo::detail::concat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, rxu::decay_t<ResultSelector>, identity_one_worker>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class ResultSelectorType = rxu::decay_t<ResultSelector>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, ConcatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, ResultSelector&& rs) {
- return Result(ConcatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), std::forward<ResultSelector>(rs), identity_current_thread()));
- }
-
- template<class Observable, class CollectionSelector, class ResultSelector, class Coordination,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- is_coordination<Coordination>>,
- class ConcatMap = rxo::detail::concat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, rxu::decay_t<ResultSelector>, rxu::decay_t<Coordination>>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class ResultSelectorType = rxu::decay_t<ResultSelector>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, ConcatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, ResultSelector&& rs, Coordination&& cn) {
- return Result(ConcatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), std::forward<ResultSelector>(rs), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::concat_map_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "concat_map takes (CollectionSelector, optional ResultSelector, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp
deleted file mode 100644
index bcbe830..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-connect_forever.hpp
-
- \brief takes a connectable_observable source and calls connect during the construction of the expression.
- This means that the source starts running without any subscribers and continues running after all subscriptions have been unsubscribed.
-
- \return An observable that emitting the items from its source.
- */
-
-#if !defined(RXCPP_OPERATORS_RX_CONNECT_FOREVER_HPP)
-#define RXCPP_OPERATORS_RX_CONNECT_FOREVER_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct connect_forever_invalid_arguments {};
-
-template<class... AN>
-struct connect_forever_invalid : public rxo::operator_base<connect_forever_invalid_arguments<AN...>> {
- using type = observable<connect_forever_invalid_arguments<AN...>, connect_forever_invalid<AN...>>;
-};
-template<class... AN>
-using connect_forever_invalid_t = typename connect_forever_invalid<AN...>::type;
-
-template<class T, class ConnectableObservable>
-struct connect_forever : public operator_base<T>
-{
- typedef rxu::decay_t<ConnectableObservable> source_type;
-
- source_type source;
-
- explicit connect_forever(source_type o)
- : source(std::move(o))
- {
- source.connect();
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber&& o) const {
- source.subscribe(std::forward<Subscriber>(o));
- }
-};
-
-}
-
-/*! @copydoc rx-connect_forever.hpp
-*/
-template<class... AN>
-auto connect_forever(AN&&... an)
--> operator_factory<connect_forever_tag, AN...> {
- return operator_factory<connect_forever_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<connect_forever_tag>
-{
- template<class ConnectableObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_connectable_observable<ConnectableObservable>>,
- class SourceValue = rxu::value_type_t<ConnectableObservable>,
- class ConnectForever = rxo::detail::connect_forever<SourceValue, rxu::decay_t<ConnectableObservable>>,
- class Value = rxu::value_type_t<ConnectForever>,
- class Result = observable<Value, ConnectForever>
- >
- static Result member(ConnectableObservable&& o) {
- return Result(ConnectForever(std::forward<ConnectableObservable>(o)));
- }
-
- template<class... AN>
- static operators::detail::connect_forever_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "connect_forever takes no arguments");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-debounce.hpp b/Rx/v2/src/rxcpp/operators/rx-debounce.hpp
deleted file mode 100644
index 6fbedd7..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-debounce.hpp
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-debounce.hpp
-
- \brief Return an observable that emits an item if a particular timespan has passed without emitting another item from the source observable.
-
- \tparam Duration the type of the time interval
- \tparam Coordination the type of the scheduler
-
- \param period the period of time to suppress any emitted items
- \param coordination the scheduler to manage timeout for each event
-
- \return Observable that emits an item if a particular timespan has passed without emitting another item from the source observable.
-
- \sample
- \snippet debounce.cpp debounce sample
- \snippet output.txt debounce sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_DEBOUNCE_HPP)
-#define RXCPP_OPERATORS_RX_DEBOUNCE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct debounce_invalid_arguments {};
-
-template<class... AN>
-struct debounce_invalid : public rxo::operator_base<debounce_invalid_arguments<AN...>> {
- using type = observable<debounce_invalid_arguments<AN...>, debounce_invalid<AN...>>;
-};
-template<class... AN>
-using debounce_invalid_t = typename debounce_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct debounce
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct debounce_values
- {
- debounce_values(duration_type p, coordination_type c)
- : period(p)
- , coordination(c)
- {
- }
-
- duration_type period;
- coordination_type coordination;
- };
- debounce_values initial;
-
- debounce(duration_type period, coordination_type coordination)
- : initial(period, coordination)
- {
- }
-
- template<class Subscriber>
- struct debounce_observer
- {
- typedef debounce_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct debounce_subscriber_values : public debounce_values
- {
- debounce_subscriber_values(composite_subscription cs, dest_type d, debounce_values v, coordinator_type c)
- : debounce_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , index(0)
- {
- }
-
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable std::size_t index;
- mutable rxu::maybe<value_type> value;
- };
- typedef std::shared_ptr<debounce_subscriber_values> state_type;
- state_type state;
-
- debounce_observer(composite_subscription cs, dest_type d, debounce_values v, coordinator_type c)
- : state(std::make_shared<debounce_subscriber_values>(debounce_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){ return localState->coordinator.act(disposer); },
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- }
-
- static std::function<void(const rxsc::schedulable&)> produce_item(std::size_t id, state_type state) {
- auto produce = [id, state](const rxsc::schedulable&) {
- if(id != state->index)
- return;
-
- state->dest.on_next(*state->value);
- state->value.reset();
- };
-
- auto selectedProduce = on_exception(
- [&](){ return state->coordinator.act(produce); },
- state->dest);
- if (selectedProduce.empty()) {
- return std::function<void(const rxsc::schedulable&)>();
- }
-
- return std::function<void(const rxsc::schedulable&)>(selectedProduce.get());
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&) {
- auto new_id = ++localState->index;
- auto produce_time = localState->worker.now() + localState->period;
-
- localState->value.reset(v);
- localState->worker.schedule(produce_time, produce_item(new_id, localState));
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&) {
- localState->dest.on_error(e);
- localState->value.reset();
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&) {
- if(!localState->value.empty()) {
- localState->dest.on_next(*localState->value);
- }
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, debounce_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(debounce_observer<Subscriber>::make(std::move(dest), initial)) {
- return debounce_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-debounce.hpp
-*/
-template<class... AN>
-auto debounce(AN&&... an)
- -> operator_factory<debounce_tag, AN...> {
- return operator_factory<debounce_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<debounce_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Debounce = rxo::detail::debounce<SourceValue, rxu::decay_t<Duration>, identity_one_worker>>
- static auto member(Observable&& o, Duration&& d)
- -> decltype(o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), identity_current_thread()))) {
- return o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Debounce = rxo::detail::debounce<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Coordination&& cn, Duration&& d)
- -> decltype(o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Debounce = rxo::detail::debounce<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Duration&& d, Coordination&& cn)
- -> decltype(o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(Debounce(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::debounce_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "debounce takes (optional Coordination, required Duration) or (required Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-delay.hpp b/Rx/v2/src/rxcpp/operators/rx-delay.hpp
deleted file mode 100644
index 5986f79..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-delay.hpp
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-delay.hpp
-
- \brief Return an observable that emits each item emitted by the source observable after the specified delay.
-
- \tparam Duration the type of time interval
- \tparam Coordination the type of the scheduler
-
- \param period the period of time each item is delayed
- \param coordination the scheduler for the delays
-
- \return Observable that emits each item emitted by the source observable after the specified delay.
-
- \sample
- \snippet delay.cpp delay period+coordination sample
- \snippet output.txt delay period+coordination sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_DELAY_HPP)
-#define RXCPP_OPERATORS_RX_DELAY_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct delay_invalid_arguments {};
-
-template<class... AN>
-struct delay_invalid : public rxo::operator_base<delay_invalid_arguments<AN...>> {
- using type = observable<delay_invalid_arguments<AN...>, delay_invalid<AN...>>;
-};
-template<class... AN>
-using delay_invalid_t = typename delay_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct delay
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct delay_values
- {
- delay_values(duration_type p, coordination_type c)
- : period(p)
- , coordination(c)
- {
- }
- duration_type period;
- coordination_type coordination;
- };
- delay_values initial;
-
- delay(duration_type period, coordination_type coordination)
- : initial(period, coordination)
- {
- }
-
- template<class Subscriber>
- struct delay_observer
- {
- typedef delay_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct delay_subscriber_values : public delay_values
- {
- delay_subscriber_values(composite_subscription cs, dest_type d, delay_values v, coordinator_type c)
- : delay_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , expected(worker.now())
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- rxsc::scheduler::clock_type::time_point expected;
- };
- std::shared_ptr<delay_subscriber_values> state;
-
- delay_observer(composite_subscription cs, dest_type d, delay_values v, coordinator_type c)
- : state(std::make_shared<delay_subscriber_values>(delay_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return localState->coordinator.act(disposer);},
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(localState->worker.now() + localState->period, selectedDisposer.get());
- });
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&){
- localState->dest.on_next(v);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(localState->worker.now() + localState->period, selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(localState->worker.now() + localState->period, selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, delay_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(delay_observer<Subscriber>::make(std::move(dest), initial)) {
- return delay_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-delay.hpp
-*/
-template<class... AN>
-auto delay(AN&&... an)
- -> operator_factory<delay_tag, AN...> {
- return operator_factory<delay_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<delay_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class delay = rxo::detail::delay<SourceValue, rxu::decay_t<Duration>, identity_one_worker>>
- static auto member(Observable&& o, Duration&& d)
- -> decltype(o.template lift<SourceValue>(delay(std::forward<Duration>(d), identity_current_thread()))) {
- return o.template lift<SourceValue>(delay(std::forward<Duration>(d), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class delay = rxo::detail::delay<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Coordination&& cn, Duration&& d)
- -> decltype(o.template lift<SourceValue>(delay(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(delay(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class delay = rxo::detail::delay<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Duration&& d, Coordination&& cn)
- -> decltype(o.template lift<SourceValue>(delay(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(delay(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::delay_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "delay takes (optional Coordination, required Duration) or (required Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct.hpp
deleted file mode 100644
index c90ebdb..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-distinct.hpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-distinct.hpp
-
- \brief For each item from this observable, filter out repeated values and emit only items that have not already been emitted.
-
- \return Observable that emits those items from the source observable that are distinct.
-
- \note istinct keeps an unordered_set<T> of past values. Due to an issue in multiple implementations of std::hash<T>, rxcpp maintains a whitelist of hashable types. new types can be added by specializing rxcpp::filtered_hash<T>
-
- \sample
- \snippet distinct.cpp distinct sample
- \snippet output.txt distinct sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_DISTINCT_HPP)
-#define RXCPP_OPERATORS_RX_DISTINCT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct distinct_invalid_arguments {};
-
-template<class... AN>
-struct distinct_invalid : public rxo::operator_base<distinct_invalid_arguments<AN...>> {
- using type = observable<distinct_invalid_arguments<AN...>, distinct_invalid<AN...>>;
-};
-template<class... AN>
-using distinct_invalid_t = typename distinct_invalid<AN...>::type;
-
-template<class T>
-struct distinct
-{
- typedef rxu::decay_t<T> source_value_type;
-
- template<class Subscriber>
- struct distinct_observer
- {
- typedef distinct_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- mutable std::unordered_set<source_value_type, rxcpp::filtered_hash<source_value_type>> remembered;
-
- distinct_observer(dest_type d)
- : dest(d)
- {
- }
- void on_next(source_value_type v) const {
- if (remembered.empty() || remembered.count(v) == 0) {
- remembered.insert(v);
- dest.on_next(v);
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer<value_type, this_type>> make(dest_type d) {
- return make_subscriber<value_type>(d, this_type(d));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(distinct_observer<Subscriber>::make(std::move(dest))) {
- return distinct_observer<Subscriber>::make(std::move(dest));
- }
-};
-
-}
-
-/*! @copydoc rx-distinct.hpp
-*/
-template<class... AN>
-auto distinct(AN&&... an)
- -> operator_factory<distinct_tag, AN...> {
- return operator_factory<distinct_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<distinct_tag>
-{
- template<class Observable,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_hashable<SourceValue>>,
- class Distinct = rxo::detail::distinct<SourceValue>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<SourceValue>(Distinct())) {
- return o.template lift<SourceValue>(Distinct());
- }
-
- template<class... AN>
- static operators::detail::distinct_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "distinct takes no arguments");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp
deleted file mode 100644
index 3702185..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-distinct_until_changed.hpp
-
- \brief For each item from this observable, filter out consequentially repeated values and emit only changes from the new observable that is returned.
-
- \tparam BinaryPredicate (optional) the type of the value comparing function. The signature should be equivalent to the following: bool pred(const T1& a, const T2& b);
-
- \param pred (optional) the function that implements comparison of two values.
-
- \return Observable that emits those items from the source observable that are distinct from their immediate predecessors.
-
- \sample
- \snippet distinct_until_changed.cpp distinct_until_changed sample
- \snippet output.txt distinct_until_changed sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_DISTINCT_UNTIL_CHANGED_HPP)
-#define RXCPP_OPERATORS_RX_DISTINCT_UNTIL_CHANGED_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct distinct_until_changed_invalid_arguments {};
-
-template<class... AN>
-struct distinct_until_changed_invalid : public rxo::operator_base<distinct_until_changed_invalid_arguments<AN...>> {
- using type = observable<distinct_until_changed_invalid_arguments<AN...>, distinct_until_changed_invalid<AN...>>;
-};
-template<class... AN>
-using distinct_until_changed_invalid_t = typename distinct_until_changed_invalid<AN...>::type;
-
-template<class T, class BinaryPredicate>
-struct distinct_until_changed
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<BinaryPredicate> predicate_type;
-
- predicate_type pred;
-
- distinct_until_changed(predicate_type p)
- : pred(std::move(p))
- {
- }
-
- template<class Subscriber>
- struct distinct_until_changed_observer
- {
- typedef distinct_until_changed_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- dest_type dest;
- predicate_type pred;
- mutable rxu::detail::maybe<source_value_type> remembered;
-
- distinct_until_changed_observer(dest_type d, predicate_type pred)
- : dest(std::move(d))
- , pred(std::move(pred))
- {
- }
- void on_next(source_value_type v) const {
- if (remembered.empty() || !pred(v, remembered.get())) {
- remembered.reset(v);
- dest.on_next(v);
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, predicate_type p) {
- return make_subscriber<value_type>(d, this_type(d, std::move(p)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(distinct_until_changed_observer<Subscriber>::make(std::move(dest), pred)) {
- return distinct_until_changed_observer<Subscriber>::make(std::move(dest), pred);
- }
-};
-
-}
-
-/*! @copydoc rx-distinct_until_changed.hpp
-*/
-template<class... AN>
-auto distinct_until_changed(AN&&... an)
- -> operator_factory<distinct_until_changed_tag, AN...> {
- return operator_factory<distinct_until_changed_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<distinct_until_changed_tag>
-{
- template<class Observable,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class DistinctUntilChanged = rxo::detail::distinct_until_changed<SourceValue, rxu::equal_to<>>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<SourceValue>(DistinctUntilChanged(rxu::equal_to<>()))) {
- return o.template lift<SourceValue>(DistinctUntilChanged(rxu::equal_to<>()));
- }
-
- template<class Observable,
- class BinaryPredicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class DistinctUntilChanged = rxo::detail::distinct_until_changed<SourceValue, BinaryPredicate>>
- static auto member(Observable&& o, BinaryPredicate&& pred)
- -> decltype(o.template lift<SourceValue>(DistinctUntilChanged(std::forward<BinaryPredicate>(pred)))) {
- return o.template lift<SourceValue>(DistinctUntilChanged(std::forward<BinaryPredicate>(pred)));
- }
-
- template<class... AN>
- static operators::detail::distinct_until_changed_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "distinct_until_changed takes (optional BinaryPredicate)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-element_at.hpp b/Rx/v2/src/rxcpp/operators/rx-element_at.hpp
deleted file mode 100644
index 1d773ac..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-element_at.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-element_at.hpp
-
- \brief Pulls an item located at a specified index location in the sequence of items and emits that item as its own sole emission.
-
- \param index the index of the element to return.
-
- \return An observable that emit an item located at a specified index location.
-
- \sample
- \snippet element_at.cpp element_at sample
- \snippet output.txt element_at sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_ELEMENT_AT_HPP)
-#define RXCPP_OPERATORS_RX_ELEMENT_AT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct element_at_invalid_arguments {};
-
-template<class... AN>
-struct element_at_invalid : public rxo::operator_base<element_at_invalid_arguments<AN...>> {
- using type = observable<element_at_invalid_arguments<AN...>, element_at_invalid<AN...>>;
-};
-template<class... AN>
-using element_at_invalid_t = typename element_at_invalid<AN...>::type;
-
-template<class T>
-struct element_at {
- typedef rxu::decay_t<T> source_value_type;
-
- struct element_at_values {
- element_at_values(int i)
- : index(i)
- {
- }
- int index;
- };
-
- element_at_values initial;
-
- element_at(int i)
- : initial(i)
- {
- }
-
- template<class Subscriber>
- struct element_at_observer : public element_at_values
- {
- typedef element_at_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- mutable int current;
-
- element_at_observer(dest_type d, element_at_values v)
- : element_at_values(v),
- dest(d),
- current(0)
- {
- }
- void on_next(source_value_type v) const {
- if (current++ == this->index) {
- dest.on_next(v);
- dest.on_completed();
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- if(current <= this->index) {
- dest.on_error(rxu::make_error_ptr(std::range_error("index is out of bounds")));
- }
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, element_at_values v) {
- return make_subscriber<value_type>(d, this_type(d, v));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(element_at_observer<Subscriber>::make(std::move(dest), initial)) {
- return element_at_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-element_at.hpp
-*/
-template<class... AN>
-auto element_at(AN&&... an)
- -> operator_factory<element_at_tag, AN...> {
- return operator_factory<element_at_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<element_at_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>
- >,
- class SourceValue = rxu::value_type_t<Observable>,
- class element_at = rxo::detail::element_at<SourceValue>>
- static auto member(Observable&& o, int index)
- -> decltype(o.template lift<SourceValue>(element_at(index))) {
- return o.template lift<SourceValue>(element_at(index));
- }
-
- template<class... AN>
- static operators::detail::element_at_invalid_t<AN...> member(const AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "element_at takes (required int)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp
deleted file mode 100644
index 3a622bb..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-filter.hpp
-
- \brief For each item from this observable use Predicate to select which items to emit from the new observable that is returned.
-
- \tparam Predicate the type of the filter function
-
- \param p the filter function
-
- \return Observable that emits only those items emitted by the source observable that the filter evaluates as true.
-
- \sample
- \snippet filter.cpp filter sample
- \snippet output.txt filter sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_FILTER_HPP)
-#define RXCPP_OPERATORS_RX_FILTER_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct filter_invalid_arguments {};
-
-template<class... AN>
-struct filter_invalid : public rxo::operator_base<filter_invalid_arguments<AN...>> {
- using type = observable<filter_invalid_arguments<AN...>, filter_invalid<AN...>>;
-};
-template<class... AN>
-using filter_invalid_t = typename filter_invalid<AN...>::type;
-
-template<class T, class Predicate>
-struct filter
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Predicate> test_type;
- test_type test;
-
- filter(test_type t)
- : test(std::move(t))
- {
- }
-
- template<class Subscriber>
- struct filter_observer
- {
- typedef filter_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- mutable test_type test;
-
- filter_observer(dest_type d, test_type t)
- : dest(std::move(d))
- , test(std::move(t))
- {
- }
-
- template <class Value>
- void on_next(Value&& v) const {
- auto filtered = on_exception([&](){
- return !this->test(rxu::as_const(v));
- },
- dest);
- if (filtered.empty()) {
- return;
- }
- if (!filtered.get()) {
- dest.on_next(std::forward<Value>(v));
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
- return make_subscriber<value_type>(d, this_type(d, std::move(t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(filter_observer<Subscriber>::make(std::move(dest), test)) {
- return filter_observer<Subscriber>::make(std::move(dest), test);
- }
-};
-
-}
-
-/*! @copydoc rx-filter.hpp
-*/
-template<class... AN>
-auto filter(AN&&... an)
- -> operator_factory<filter_tag, AN...> {
- return operator_factory<filter_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<filter_tag>
-{
- template<class Observable, class Predicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class Filter = rxo::detail::filter<SourceValue, rxu::decay_t<Predicate>>>
- static auto member(Observable&& o, Predicate&& p)
- -> decltype(o.template lift<SourceValue>(Filter(std::forward<Predicate>(p)))) {
- return o.template lift<SourceValue>(Filter(std::forward<Predicate>(p)));
- }
-
- template<class... AN>
- static operators::detail::filter_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "filter takes (Predicate)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-finally.hpp b/Rx/v2/src/rxcpp/operators/rx-finally.hpp
deleted file mode 100644
index d6f5487..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-finally.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-finally.hpp
-
- \brief Add a new action at the end of the new observable that is returned.
-
- \tparam LastCall the type of the action function
-
- \param lc the action function
-
- \return Observable that emits the same items as the source observable, then invokes the given action.
-
- \sample
- \snippet finally.cpp finally sample
- \snippet output.txt finally sample
-
- If the source observable generates an error, the final action is still being called:
- \snippet finally.cpp error finally sample
- \snippet output.txt error finally sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_FINALLY_HPP)
-#define RXCPP_OPERATORS_RX_FINALLY_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct finally_invalid_arguments {};
-
-template<class... AN>
-struct finally_invalid : public rxo::operator_base<finally_invalid_arguments<AN...>> {
- using type = observable<finally_invalid_arguments<AN...>, finally_invalid<AN...>>;
-};
-template<class... AN>
-using finally_invalid_t = typename finally_invalid<AN...>::type;
-
-template<class T, class LastCall>
-struct finally
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<LastCall> last_call_type;
- last_call_type last_call;
-
- finally(last_call_type lc)
- : last_call(std::move(lc))
- {
- }
-
- template<class Subscriber>
- struct finally_observer
- {
- typedef finally_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
-
- finally_observer(dest_type d)
- : dest(std::move(d))
- {
- }
- void on_next(source_value_type v) const {
- dest.on_next(v);
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, const last_call_type& lc) {
- auto dl = d.get_subscription();
- composite_subscription cs;
- dl.add(cs);
- cs.add([=](){
- dl.unsubscribe();
- lc();
- });
- return make_subscriber<value_type>(cs, this_type(d));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(finally_observer<Subscriber>::make(std::move(dest), last_call)) {
- return finally_observer<Subscriber>::make(std::move(dest), last_call);
- }
-};
-
-}
-
-/*! @copydoc rx-finally.hpp
-*/
-template<class... AN>
-auto finally(AN&&... an)
- -> operator_factory<finally_tag, AN...> {
- return operator_factory<finally_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<finally_tag>
-{
- template<class Observable, class LastCall,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class Finally = rxo::detail::finally<SourceValue, rxu::decay_t<LastCall>>>
- static auto member(Observable&& o, LastCall&& lc)
- -> decltype(o.template lift<SourceValue>(Finally(std::forward<LastCall>(lc)))) {
- return o.template lift<SourceValue>(Finally(std::forward<LastCall>(lc)));
- }
-
- template<class... AN>
- static operators::detail::finally_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "finally takes (LastCall)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp
deleted file mode 100644
index eb76198..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-flat_map.hpp
-
- \brief For each item from this observable use the CollectionSelector to produce an observable and subscribe to that observable.
- For each item from all of the produced observables use the ResultSelector to produce a value to emit from the new observable that is returned.
-
- \tparam CollectionSelector the type of the observable producing function. CollectionSelector must be a function with the signature observable(flat_map::source_value_type)
- \tparam ResultSelector the type of the aggregation function (optional). ResultSelector must be a function with the signature flat_map::value_type(flat_map::source_value_type, flat_map::collection_value_type).
- \tparam Coordination the type of the scheduler (optional).
-
- \param s a function that returns an observable for each item emitted by the source observable.
- \param rs a function that combines one item emitted by each of the source and collection observables and returns an item to be emitted by the resulting observable (optional).
- \param cn the scheduler to synchronize sources from different contexts (optional).
-
- \return Observable that emits the results of applying a function to a pair of values emitted by the source observable and the collection observable.
-
- Observables, produced by the CollectionSelector, are merged. There is another operator rxcpp::observable<T,SourceType>::flat_map that works similar but concatenates the observables.
-
- \sample
- \snippet flat_map.cpp flat_map sample
- \snippet output.txt flat_map sample
-
- \sample
- \snippet flat_map.cpp threaded flat_map sample
- \snippet output.txt threaded flat_map sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_FLATMAP_HPP)
-#define RXCPP_OPERATORS_RX_FLATMAP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct flat_map_invalid_arguments {};
-
-template<class... AN>
-struct flat_map_invalid : public rxo::operator_base<flat_map_invalid_arguments<AN...>> {
- using type = observable<flat_map_invalid_arguments<AN...>, flat_map_invalid<AN...>>;
-};
-template<class... AN>
-using flat_map_invalid_t = typename flat_map_invalid<AN...>::type;
-
-template<class Observable, class CollectionSelector, class ResultSelector, class Coordination>
-struct flat_map_traits {
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<CollectionSelector> collection_selector_type;
- typedef rxu::decay_t<ResultSelector> result_selector_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename source_type::value_type source_value_type;
-
- struct tag_not_valid {};
- template<class CV, class CCS>
- static auto collection_check(int) -> decltype((*(CCS*)nullptr)(*(CV*)nullptr));
- template<class CV, class CCS>
- static tag_not_valid collection_check(...);
-
- static_assert(!std::is_same<decltype(collection_check<source_value_type, collection_selector_type>(0)), tag_not_valid>::value, "flat_map CollectionSelector must be a function with the signature observable(flat_map::source_value_type)");
-
- typedef rxu::decay_t<decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr)))> collection_type;
-
- static_assert(is_observable<collection_type>::value, "flat_map CollectionSelector must return an observable");
-
- typedef typename collection_type::value_type collection_value_type;
-
- template<class CV, class CCV, class CRS>
- static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CV*)nullptr, *(CCV*)nullptr));
- template<class CV, class CCV, class CRS>
- static tag_not_valid result_check(...);
-
- static_assert(!std::is_same<decltype(result_check<source_value_type, collection_value_type, result_selector_type>(0)), tag_not_valid>::value, "flat_map ResultSelector must be a function with the signature flat_map::value_type(flat_map::source_value_type, flat_map::collection_value_type)");
-
- typedef rxu::decay_t<decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr))> value_type;
-};
-
-template<class Observable, class CollectionSelector, class ResultSelector, class Coordination>
-struct flat_map
- : public operator_base<rxu::value_type_t<flat_map_traits<Observable, CollectionSelector, ResultSelector, Coordination>>>
-{
- typedef flat_map<Observable, CollectionSelector, ResultSelector, Coordination> this_type;
- typedef flat_map_traits<Observable, CollectionSelector, ResultSelector, Coordination> traits;
-
- typedef typename traits::source_type source_type;
- typedef typename traits::collection_selector_type collection_selector_type;
- typedef typename traits::result_selector_type result_selector_type;
-
- typedef typename traits::source_value_type source_value_type;
- typedef typename traits::collection_type collection_type;
- typedef typename traits::collection_value_type collection_value_type;
-
- typedef typename traits::coordination_type coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_type o, collection_selector_type s, result_selector_type rs, coordination_type sf)
- : source(std::move(o))
- , selectCollection(std::move(s))
- , selectResult(std::move(rs))
- , coordination(std::move(sf))
- {
- }
- source_type source;
- collection_selector_type selectCollection;
- result_selector_type selectResult;
- coordination_type coordination;
- };
- values initial;
-
- flat_map(source_type o, collection_selector_type s, result_selector_type rs, coordination_type sf)
- : initial(std::move(o), std::move(s), std::move(rs), std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(values i, coordinator_type coor, output_type oarg)
- : values(std::move(i))
- , pendingCompletions(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- int pendingCompletions;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, std::move(coordinator), std::move(scbr));
-
- composite_subscription outercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(outercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- ++state->pendingCompletions;
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- outercs,
- // on_next
- [state](source_value_type st) {
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(innercs);
-
- innercs.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedCollection = state->selectCollection(st);
- auto selectedSource = state->coordinator.in(selectedCollection);
-
- ++state->pendingCompletions;
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<collection_value_type>(
- state->out,
- innercs,
- // on_next
- [state, st](collection_value_type ct) {
- auto selectedResult = state->selectResult(st, std::move(ct));
- state->out.on_next(std::move(selectedResult));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
-
- auto selectedSinkInner = state->coordinator.out(sinkInner);
- selectedSource.subscribe(std::move(selectedSinkInner));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
-
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
-
- source->subscribe(std::move(selectedSink.get()));
-
- }
-};
-
-}
-
-/*! @copydoc rx-flat_map.hpp
-*/
-template<class... AN>
-auto flat_map(AN&&... an)
--> operator_factory<flat_map_tag, AN...> {
- return operator_factory<flat_map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! @copydoc rx-flat_map.hpp
-*/
-template<class... AN>
-auto merge_transform(AN&&... an)
--> operator_factory<flat_map_tag, AN...> {
- return operator_factory<flat_map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<flat_map_tag>
-{
- template<class Observable, class CollectionSelector,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class ResultSelectorType = rxu::detail::take_at<1>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>>,
- class FlatMap = rxo::detail::flat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, ResultSelectorType, identity_one_worker>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, FlatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s) {
- return Result(FlatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), ResultSelectorType(), identity_current_thread()));
- }
-
- template<class Observable, class CollectionSelector, class Coordination,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class ResultSelectorType = rxu::detail::take_at<1>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- is_coordination<Coordination>>,
- class FlatMap = rxo::detail::flat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, ResultSelectorType, rxu::decay_t<Coordination>>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, FlatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, Coordination&& cn) {
- return Result(FlatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), ResultSelectorType(), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class CollectionSelector, class ResultSelector,
- class IsCoordination = is_coordination<ResultSelector>,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- rxu::negation<IsCoordination>>,
- class FlatMap = rxo::detail::flat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, rxu::decay_t<ResultSelector>, identity_one_worker>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class ResultSelectorType = rxu::decay_t<ResultSelector>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, FlatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, ResultSelector&& rs) {
- return Result(FlatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), std::forward<ResultSelector>(rs), identity_current_thread()));
- }
-
- template<class Observable, class CollectionSelector, class ResultSelector, class Coordination,
- class CollectionSelectorType = rxu::decay_t<CollectionSelector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class CollectionType = rxu::result_of_t<CollectionSelectorType(SourceValue)>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, CollectionType>,
- is_coordination<Coordination>>,
- class FlatMap = rxo::detail::flat_map<rxu::decay_t<Observable>, rxu::decay_t<CollectionSelector>, rxu::decay_t<ResultSelector>, rxu::decay_t<Coordination>>,
- class CollectionValueType = rxu::value_type_t<CollectionType>,
- class ResultSelectorType = rxu::decay_t<ResultSelector>,
- class Value = rxu::result_of_t<ResultSelectorType(SourceValue, CollectionValueType)>,
- class Result = observable<Value, FlatMap>
- >
- static Result member(Observable&& o, CollectionSelector&& s, ResultSelector&& rs, Coordination&& cn) {
- return Result(FlatMap(std::forward<Observable>(o), std::forward<CollectionSelector>(s), std::forward<ResultSelector>(rs), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::flat_map_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "flat_map takes (CollectionSelector, optional ResultSelector, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
deleted file mode 100644
index d1c4ea4..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-group_by.hpp
-
- \brief Return an observable that emits grouped_observables, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value.
-
- \tparam KeySelector the type of the key extracting function
- \tparam MarbleSelector the type of the element extracting function
- \tparam BinaryPredicate the type of the key comparing function
- \tparam DurationSelector the type of the duration observable function
-
- \param ks a function that extracts the key for each item (optional)
- \param ms a function that extracts the return element for each item (optional)
- \param p a function that implements comparison of two keys (optional)
-
- \return Observable that emits values of grouped_observable type, each of which corresponds to a unique key value and each of which emits those items from the source observable that share that key value.
-
- \sample
- \snippet group_by.cpp group_by full intro
- \snippet group_by.cpp group_by full sample
- \snippet output.txt group_by full sample
-
- \sample
- \snippet group_by.cpp group_by sample
- \snippet output.txt group_by sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_GROUP_BY_HPP)
-#define RXCPP_OPERATORS_RX_GROUP_BY_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct group_by_invalid_arguments {};
-
-template<class... AN>
-struct group_by_invalid : public rxo::operator_base<group_by_invalid_arguments<AN...>> {
- using type = observable<group_by_invalid_arguments<AN...>, group_by_invalid<AN...>>;
-};
-template<class... AN>
-using group_by_invalid_t = typename group_by_invalid<AN...>::type;
-
-template<class T, class Selector>
-struct is_group_by_selector_for {
-
- typedef rxu::decay_t<Selector> selector_type;
- typedef T source_value_type;
-
- struct tag_not_valid {};
- template<class CV, class CS>
- static auto check(int) -> decltype((*(CS*)nullptr)(*(CV*)nullptr));
- template<class CV, class CS>
- static tag_not_valid check(...);
-
- typedef decltype(check<source_value_type, selector_type>(0)) type;
- static const bool value = !std::is_same<type, tag_not_valid>::value;
-};
-
-template<class T, class Observable, class KeySelector, class MarbleSelector, class BinaryPredicate, class DurationSelector>
-struct group_by_traits
-{
- typedef T source_value_type;
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<KeySelector> key_selector_type;
- typedef rxu::decay_t<MarbleSelector> marble_selector_type;
- typedef rxu::decay_t<BinaryPredicate> predicate_type;
- typedef rxu::decay_t<DurationSelector> duration_selector_type;
-
- static_assert(is_group_by_selector_for<source_value_type, key_selector_type>::value, "group_by KeySelector must be a function with the signature key_type(source_value_type)");
-
- typedef typename is_group_by_selector_for<source_value_type, key_selector_type>::type key_type;
-
- static_assert(is_group_by_selector_for<source_value_type, marble_selector_type>::value, "group_by MarbleSelector must be a function with the signature marble_type(source_value_type)");
-
- typedef typename is_group_by_selector_for<source_value_type, marble_selector_type>::type marble_type;
-
- typedef rxsub::subject<marble_type> subject_type;
-
- typedef std::map<key_type, typename subject_type::subscriber_type, predicate_type> key_subscriber_map_type;
-
- typedef grouped_observable<key_type, marble_type> grouped_observable_type;
-};
-
-template<class T, class Observable, class KeySelector, class MarbleSelector, class BinaryPredicate, class DurationSelector>
-struct group_by
-{
- typedef group_by_traits<T, Observable, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector> traits_type;
- typedef typename traits_type::key_selector_type key_selector_type;
- typedef typename traits_type::marble_selector_type marble_selector_type;
- typedef typename traits_type::marble_type marble_type;
- typedef typename traits_type::predicate_type predicate_type;
- typedef typename traits_type::duration_selector_type duration_selector_type;
- typedef typename traits_type::subject_type subject_type;
- typedef typename traits_type::key_type key_type;
-
- typedef typename traits_type::key_subscriber_map_type group_map_type;
- typedef std::vector<typename composite_subscription::weak_subscription> bindings_type;
-
- struct group_by_state_type
- {
- group_by_state_type(composite_subscription sl, predicate_type p)
- : source_lifetime(sl)
- , groups(p)
- , observers(0)
- {}
- composite_subscription source_lifetime;
- rxsc::worker worker;
- group_map_type groups;
- std::atomic<int> observers;
- };
-
- template<class Subscriber>
- static void stopsource(Subscriber&& dest, std::shared_ptr<group_by_state_type>& state) {
- ++state->observers;
- dest.add([state](){
- if (!state->source_lifetime.is_subscribed()) {
- return;
- }
- --state->observers;
- if (state->observers == 0) {
- state->source_lifetime.unsubscribe();
- }
- });
- }
-
- struct group_by_values
- {
- group_by_values(key_selector_type ks, marble_selector_type ms, predicate_type p, duration_selector_type ds)
- : keySelector(std::move(ks))
- , marbleSelector(std::move(ms))
- , predicate(std::move(p))
- , durationSelector(std::move(ds))
- {
- }
- mutable key_selector_type keySelector;
- mutable marble_selector_type marbleSelector;
- mutable predicate_type predicate;
- mutable duration_selector_type durationSelector;
- };
-
- group_by_values initial;
-
- group_by(key_selector_type ks, marble_selector_type ms, predicate_type p, duration_selector_type ds)
- : initial(std::move(ks), std::move(ms), std::move(p), std::move(ds))
- {
- }
-
- struct group_by_observable : public rxs::source_base<marble_type>
- {
- mutable std::shared_ptr<group_by_state_type> state;
- subject_type subject;
- key_type key;
-
- group_by_observable(std::shared_ptr<group_by_state_type> st, subject_type s, key_type k)
- : state(std::move(st))
- , subject(std::move(s))
- , key(k)
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber&& o) const {
- group_by::stopsource(o, state);
- subject.get_observable().subscribe(std::forward<Subscriber>(o));
- }
-
- key_type on_get_key() {
- return key;
- }
- };
-
- template<class Subscriber>
- struct group_by_observer : public group_by_values
- {
- typedef group_by_observer<Subscriber> this_type;
- typedef typename traits_type::grouped_observable_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- dest_type dest;
-
- mutable std::shared_ptr<group_by_state_type> state;
-
- group_by_observer(composite_subscription l, dest_type d, group_by_values v)
- : group_by_values(v)
- , dest(std::move(d))
- , state(std::make_shared<group_by_state_type>(l, group_by_values::predicate))
- {
- group_by::stopsource(dest, state);
- }
- void on_next(T v) const {
- auto selectedKey = on_exception(
- [&](){
- return this->keySelector(v);},
- [this](rxu::error_ptr e){on_error(e);});
- if (selectedKey.empty()) {
- return;
- }
- auto g = state->groups.find(selectedKey.get());
- if (g == state->groups.end()) {
- if (!dest.is_subscribed()) {
- return;
- }
- auto sub = subject_type();
- g = state->groups.insert(std::make_pair(selectedKey.get(), sub.get_subscriber())).first;
- auto obs = make_dynamic_grouped_observable<key_type, marble_type>(group_by_observable(state, sub, selectedKey.get()));
- auto durationObs = on_exception(
- [&](){
- return this->durationSelector(obs);},
- [this](rxu::error_ptr e){on_error(e);});
- if (durationObs.empty()) {
- return;
- }
-
- dest.on_next(obs);
- composite_subscription duration_sub;
- auto ssub = state->source_lifetime.add(duration_sub);
-
- auto expire_state = state;
- auto expire_dest = g->second;
- auto expire = [=]() {
- auto g = expire_state->groups.find(selectedKey.get());
- if (g != expire_state->groups.end()) {
- expire_state->groups.erase(g);
- expire_dest.on_completed();
- }
- expire_state->source_lifetime.remove(ssub);
- };
- auto robs = durationObs.get().take(1);
- duration_sub.add(robs.subscribe(
- [](const typename decltype(robs)::value_type &){},
- [=](rxu::error_ptr) {expire();},
- [=](){expire();}
- ));
- }
- auto selectedMarble = on_exception(
- [&](){
- return this->marbleSelector(v);},
- [this](rxu::error_ptr e){on_error(e);});
- if (selectedMarble.empty()) {
- return;
- }
- g->second.on_next(std::move(selectedMarble.get()));
- }
- void on_error(rxu::error_ptr e) const {
- for(auto& g : state->groups) {
- g.second.on_error(e);
- }
- dest.on_error(e);
- }
- void on_completed() const {
- for(auto& g : state->groups) {
- g.second.on_completed();
- }
- dest.on_completed();
- }
-
- static subscriber<T, observer_type> make(dest_type d, group_by_values v) {
- auto cs = composite_subscription();
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(group_by_observer<Subscriber>::make(std::move(dest), initial)) {
- return group_by_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-template<class KeySelector, class MarbleSelector, class BinaryPredicate, class DurationSelector>
-class group_by_factory
-{
- typedef rxu::decay_t<KeySelector> key_selector_type;
- typedef rxu::decay_t<MarbleSelector> marble_selector_type;
- typedef rxu::decay_t<BinaryPredicate> predicate_type;
- typedef rxu::decay_t<DurationSelector> duration_selector_type;
- key_selector_type keySelector;
- marble_selector_type marbleSelector;
- predicate_type predicate;
- duration_selector_type durationSelector;
-public:
- group_by_factory(key_selector_type ks, marble_selector_type ms, predicate_type p, duration_selector_type ds)
- : keySelector(std::move(ks))
- , marbleSelector(std::move(ms))
- , predicate(std::move(p))
- , durationSelector(std::move(ds))
- {
- }
- template<class Observable>
- struct group_by_factory_traits
- {
- typedef rxu::value_type_t<rxu::decay_t<Observable>> value_type;
- typedef detail::group_by_traits<value_type, Observable, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector> traits_type;
- typedef detail::group_by<value_type, Observable, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector> group_by_type;
- };
- template<class Observable>
- auto operator()(Observable&& source)
- -> decltype(source.template lift<typename group_by_factory_traits<Observable>::traits_type::grouped_observable_type>(typename group_by_factory_traits<Observable>::group_by_type(std::move(keySelector), std::move(marbleSelector), std::move(predicate), std::move(durationSelector)))) {
- return source.template lift<typename group_by_factory_traits<Observable>::traits_type::grouped_observable_type>(typename group_by_factory_traits<Observable>::group_by_type(std::move(keySelector), std::move(marbleSelector), std::move(predicate), std::move(durationSelector)));
- }
-};
-
-}
-
-/*! @copydoc rx-group_by.hpp
-*/
-template<class... AN>
-auto group_by(AN&&... an)
- -> operator_factory<group_by_tag, AN...> {
- return operator_factory<group_by_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<group_by_tag>
-{
- template<class Observable, class KeySelector, class MarbleSelector, class BinaryPredicate, class DurationSelector,
- class SourceValue = rxu::value_type_t<Observable>,
- class Traits = rxo::detail::group_by_traits<SourceValue, rxu::decay_t<Observable>, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector>,
- class GroupBy = rxo::detail::group_by<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<KeySelector>, rxu::decay_t<MarbleSelector>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<DurationSelector>>,
- class Value = typename Traits::grouped_observable_type>
- static auto member(Observable&& o, KeySelector&& ks, MarbleSelector&& ms, BinaryPredicate&& p, DurationSelector&& ds)
- -> decltype(o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), std::forward<BinaryPredicate>(p), std::forward<DurationSelector>(ds)))) {
- return o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), std::forward<BinaryPredicate>(p), std::forward<DurationSelector>(ds)));
- }
-
- template<class Observable, class KeySelector, class MarbleSelector, class BinaryPredicate,
- class DurationSelector=rxu::ret<observable<int, rxs::detail::never<int>>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Traits = rxo::detail::group_by_traits<SourceValue, rxu::decay_t<Observable>, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector>,
- class GroupBy = rxo::detail::group_by<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<KeySelector>, rxu::decay_t<MarbleSelector>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<DurationSelector>>,
- class Value = typename Traits::grouped_observable_type>
- static auto member(Observable&& o, KeySelector&& ks, MarbleSelector&& ms, BinaryPredicate&& p)
- -> decltype(o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), std::forward<BinaryPredicate>(p), rxu::ret<observable<int, rxs::detail::never<int>>>()))) {
- return o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), std::forward<BinaryPredicate>(p), rxu::ret<observable<int, rxs::detail::never<int>>>()));
- }
-
- template<class Observable, class KeySelector, class MarbleSelector,
- class BinaryPredicate=rxu::less,
- class DurationSelector=rxu::ret<observable<int, rxs::detail::never<int>>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Traits = rxo::detail::group_by_traits<SourceValue, rxu::decay_t<Observable>, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector>,
- class GroupBy = rxo::detail::group_by<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<KeySelector>, rxu::decay_t<MarbleSelector>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<DurationSelector>>,
- class Value = typename Traits::grouped_observable_type>
- static auto member(Observable&& o, KeySelector&& ks, MarbleSelector&& ms)
- -> decltype(o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()))) {
- return o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), std::forward<MarbleSelector>(ms), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()));
- }
-
-
- template<class Observable, class KeySelector,
- class MarbleSelector=rxu::detail::take_at<0>,
- class BinaryPredicate=rxu::less,
- class DurationSelector=rxu::ret<observable<int, rxs::detail::never<int>>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Traits = rxo::detail::group_by_traits<SourceValue, rxu::decay_t<Observable>, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector>,
- class GroupBy = rxo::detail::group_by<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<KeySelector>, rxu::decay_t<MarbleSelector>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<DurationSelector>>,
- class Value = typename Traits::grouped_observable_type>
- static auto member(Observable&& o, KeySelector&& ks)
- -> decltype(o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), rxu::detail::take_at<0>(), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()))) {
- return o.template lift<Value>(GroupBy(std::forward<KeySelector>(ks), rxu::detail::take_at<0>(), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()));
- }
-
- template<class Observable,
- class KeySelector=rxu::detail::take_at<0>,
- class MarbleSelector=rxu::detail::take_at<0>,
- class BinaryPredicate=rxu::less,
- class DurationSelector=rxu::ret<observable<int, rxs::detail::never<int>>>,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Traits = rxo::detail::group_by_traits<SourceValue, rxu::decay_t<Observable>, KeySelector, MarbleSelector, BinaryPredicate, DurationSelector>,
- class GroupBy = rxo::detail::group_by<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<KeySelector>, rxu::decay_t<MarbleSelector>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<DurationSelector>>,
- class Value = typename Traits::grouped_observable_type>
- static auto member(Observable&& o)
- -> decltype(o.template lift<Value>(GroupBy(rxu::detail::take_at<0>(), rxu::detail::take_at<0>(), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()))) {
- return o.template lift<Value>(GroupBy(rxu::detail::take_at<0>(), rxu::detail::take_at<0>(), rxu::less(), rxu::ret<observable<int, rxs::detail::never<int>>>()));
- }
-
- template<class... AN>
- static operators::detail::group_by_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "group_by takes (optional KeySelector, optional MarbleSelector, optional BinaryKeyPredicate, optional DurationSelector), KeySelector takes (Observable::value_type) -> KeyValue, MarbleSelector takes (Observable::value_type) -> MarbleValue, BinaryKeyPredicate takes (KeyValue, KeyValue) -> bool, DurationSelector takes (Observable::value_type) -> Observable");
- }
-
-};
-
-}
-
-#endif
-
diff --git a/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp b/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp
deleted file mode 100644
index 00b10a6..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-ignore_elements.hpp
-
- \brief Do not emit any items from the source Observable, but allow termination notification (either onError or onCompleted) to pass through unchanged.
-
- \return Observable that emits termination notification from the source observable.
-
- \sample
- \snippet ignore_elements.cpp ignore_elements sample
- \snippet output.txt ignore_elements sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_IGNORE_ELEMENTS_HPP)
-#define RXCPP_OPERATORS_RX_IGNORE_ELEMENTS_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct ignore_elements_invalid_arguments {};
-
-template<class... AN>
-struct ignore_elements_invalid : public rxo::operator_base<ignore_elements_invalid_arguments<AN...>> {
- using type = observable<ignore_elements_invalid_arguments<AN...>, ignore_elements_invalid<AN...>>;
-};
-template<class... AN>
-using ignore_elements_invalid_t = typename ignore_elements_invalid<AN...>::type;
-
-template<class T>
-struct ignore_elements {
- typedef rxu::decay_t<T> source_value_type;
-
- template<class Subscriber>
- struct ignore_elements_observer
- {
- typedef ignore_elements_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
-
- ignore_elements_observer(dest_type d)
- : dest(d)
- {
- }
-
- void on_next(source_value_type) const {
- // no-op; ignore element
- }
-
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
-
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d) {
- return make_subscriber<value_type>(d, this_type(d));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(ignore_elements_observer<Subscriber>::make(std::move(dest))) {
- return ignore_elements_observer<Subscriber>::make(std::move(dest));
- }
-};
-
-}
-
-/*! @copydoc rx-ignore_elements.hpp
-*/
-template<class... AN>
-auto ignore_elements(AN&&... an)
--> operator_factory<ignore_elements_tag, AN...> {
- return operator_factory<ignore_elements_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<ignore_elements_tag>
-{
- template<class Observable,
- class SourceValue = rxu::value_type_t<Observable>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class IgnoreElements = rxo::detail::ignore_elements<SourceValue>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<SourceValue>(IgnoreElements())) {
- return o.template lift<SourceValue>(IgnoreElements());
- }
-
- template<class... AN>
- static operators::detail::ignore_elements_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "ignore_elements takes no arguments");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp
deleted file mode 100644
index bcbf93f..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-lift.hpp
-
- \brief takes any function that will take a subscriber for this observable and produce a subscriber.
- this is intended to allow externally defined operators, that use make_subscriber, to be connected into the expression.
-
- \tparam ResultType the type of the emitted results.
- \tparam Operator the type of the operator.
-
- \return An observable that emitting the items from its source.
- */
-
-#if !defined(RXCPP_OPERATORS_RX_LIFT_HPP)
-#define RXCPP_OPERATORS_RX_LIFT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace detail {
-
-template<class V, class S, class F>
-struct is_lift_function_for {
-
- struct tag_not_valid {};
- template<class CS, class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)(*(CS*)nullptr));
- template<class CS, class CF>
- static tag_not_valid check(...);
-
- using for_type = rxu::decay_t<S>;
- using func_type = rxu::decay_t<F>;
- using detail_result = decltype(check<for_type, func_type>(0));
-
- static const bool value = rxu::all_true_type<
- is_subscriber<detail_result>,
- is_subscriber<for_type>,
- std::is_convertible<V, typename rxu::value_type_from<detail_result>::type>>::value;
-};
-
-}
-
-namespace operators {
-
-namespace detail {
-
-template<class ResultType, class SourceOperator, class Operator>
-struct lift_traits
-{
- typedef rxu::decay_t<ResultType> result_value_type;
- typedef rxu::decay_t<SourceOperator> source_operator_type;
- typedef rxu::decay_t<Operator> operator_type;
-
- typedef typename source_operator_type::value_type source_value_type;
-};
-
-template<class ResultType, class SourceOperator, class Operator>
-struct lift_operator : public operator_base<typename lift_traits<ResultType, SourceOperator, Operator>::result_value_type>
-{
- typedef lift_traits<ResultType, SourceOperator, Operator> traits;
- typedef typename traits::source_operator_type source_operator_type;
- typedef typename traits::operator_type operator_type;
- source_operator_type source;
- operator_type chain;
-
- lift_operator(source_operator_type s, operator_type op)
- : source(std::move(s))
- , chain(std::move(op))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- auto lifted = chain(std::move(o));
- trace_activity().lift_enter(source, chain, o, lifted);
- source.on_subscribe(std::move(lifted));
- trace_activity().lift_return(source, chain);
- }
-};
-
-template<class ResultType, class Operator>
-class lift_factory
-{
- typedef rxu::decay_t<Operator> operator_type;
- operator_type chain;
-public:
- lift_factory(operator_type op) : chain(std::move(op)) {}
- template<class Observable>
- auto operator()(const Observable& source)
- -> decltype(source.template lift<ResultType>(chain)) {
- return source.template lift<ResultType>(chain);
- static_assert(rxcpp::detail::is_lift_function_for<rxu::value_type_t<Observable>, subscriber<ResultType>, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber<T, ...>)");
- }
-};
-
-}
-
-template<class ResultType, class Operator>
-auto lift(Operator&& op)
- -> detail::lift_factory<ResultType, Operator> {
- return detail::lift_factory<ResultType, Operator>(std::forward<Operator>(op));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp
deleted file mode 100644
index 7570376..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-map.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-map.hpp
-
- \brief For each item from this observable use Selector to produce an item to emit from the new observable that is returned.
-
- \tparam Selector the type of the transforming function
-
- \param s the selector function
-
- \return Observable that emits the items from the source observable, transformed by the specified function.
-
- \sample
- \snippet map.cpp map sample
- \snippet output.txt map sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_MAP_HPP)
-#define RXCPP_OPERATORS_RX_MAP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct map_invalid_arguments {};
-
-template<class... AN>
-struct map_invalid : public rxo::operator_base<map_invalid_arguments<AN...>> {
- using type = observable<map_invalid_arguments<AN...>, map_invalid<AN...>>;
-};
-template<class... AN>
-using map_invalid_t = typename map_invalid<AN...>::type;
-
-template<class T, class Selector>
-struct map
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Selector> select_type;
- typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type;
- select_type selector;
-
- map(select_type s)
- : selector(std::move(s))
- {
- }
-
- template<class Subscriber>
- struct map_observer
- {
- typedef map_observer<Subscriber> this_type;
- typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<source_value_type, this_type> observer_type;
- dest_type dest;
- mutable select_type selector;
-
- map_observer(dest_type d, select_type s)
- : dest(std::move(d))
- , selector(std::move(s))
- {
- }
- template<class Value>
- void on_next(Value&& v) const {
- auto selected = on_exception(
- [&](){
- return this->selector(std::forward<Value>(v));},
- dest);
- if (selected.empty()) {
- return;
- }
- dest.on_next(std::move(selected.get()));
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<source_value_type, observer_type> make(dest_type d, select_type s) {
- auto cs = d.get_subscription();
- return make_subscriber<source_value_type>(std::move(cs), observer_type(this_type(std::move(d), std::move(s))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(map_observer<Subscriber>::make(std::move(dest), selector)) {
- return map_observer<Subscriber>::make(std::move(dest), selector);
- }
-};
-
-}
-
-/*! @copydoc rx-map.hpp
-*/
-template<class... AN>
-auto map(AN&&... an)
- -> operator_factory<map_tag, AN...> {
- return operator_factory<map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! @copydoc rx-map.hpp
-*/
-template<class... AN>
-auto transform(AN&&... an)
- -> operator_factory<map_tag, AN...> {
- return operator_factory<map_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<map_tag>
-{
- template<class Observable, class Selector,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Map = rxo::detail::map<SourceValue, ResolvedSelector>,
- class Value = rxu::value_type_t<Map>>
- static auto member(Observable&& o, Selector&& s)
- -> decltype(o.template lift<Value>(Map(std::forward<Selector>(s)))) {
- return o.template lift<Value>(Map(std::forward<Selector>(s)));
- }
-
- template<class... AN>
- static operators::detail::map_invalid_t<AN...> member(const AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "map takes Selector");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp
deleted file mode 100644
index cc1ea77..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-merge.hpp
-
- \brief For each given observable subscribe.
- For each item emitted from all of the given observables, deliver from the new observable that is returned.
-
- There are 2 variants of the operator:
- - The source observable emits nested observables, nested observables are merged.
- - The source observable and the arguments v0...vn are used to provide the observables to merge.
-
- \tparam Coordination the type of the scheduler (optional).
- \tparam Value0 ... (optional).
- \tparam ValueN types of source observables (optional).
-
- \param cn the scheduler to synchronize sources from different contexts (optional).
- \param v0 ... (optional).
- \param vn source observables (optional).
-
- \return Observable that emits items that are the result of flattening the observables emitted by the source observable.
-
- If scheduler is omitted, identity_current_thread is used.
-
- \sample
- \snippet merge.cpp threaded implicit merge sample
- \snippet output.txt threaded implicit merge sample
-
- \sample
- \snippet merge.cpp implicit merge sample
- \snippet output.txt implicit merge sample
-
- \sample
- \snippet merge.cpp merge sample
- \snippet output.txt merge sample
-
- \sample
- \snippet merge.cpp threaded merge sample
- \snippet output.txt threaded merge sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_MERGE_HPP)
-#define RXCPP_OPERATORS_RX_MERGE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct merge_invalid_arguments {};
-
-template<class... AN>
-struct merge_invalid : public rxo::operator_base<merge_invalid_arguments<AN...>> {
- using type = observable<merge_invalid_arguments<AN...>, merge_invalid<AN...>>;
-};
-template<class... AN>
-using merge_invalid_t = typename merge_invalid<AN...>::type;
-
-template<class T, class Observable, class Coordination>
-struct merge
- : public operator_base<rxu::value_type_t<rxu::decay_t<T>>>
-{
- //static_assert(is_observable<Observable>::value, "merge requires an observable");
- //static_assert(is_observable<T>::value, "merge requires an observable that contains observables");
-
- typedef merge<T, Observable, Coordination> this_type;
-
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Observable> source_type;
-
- typedef typename source_type::source_operator_type source_operator_type;
- typedef typename source_value_type::value_type value_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_operator_type o, coordination_type sf)
- : source_operator(std::move(o))
- , coordination(std::move(sf))
- {
- }
- source_operator_type source_operator;
- coordination_type coordination;
- };
- values initial;
-
- merge(const source_type& o, coordination_type sf)
- : initial(o.source_operator, std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct merge_state_type
- : public std::enable_shared_from_this<merge_state_type>
- , public values
- {
- merge_state_type(values i, coordinator_type coor, output_type oarg)
- : values(i)
- , source(i.source_operator)
- , pendingCompletions(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
- observable<source_value_type, source_operator_type> source;
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- int pendingCompletions;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<merge_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- composite_subscription outercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(outercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- ++state->pendingCompletions;
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- outercs,
- // on_next
- [state](source_value_type st) {
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(innercs);
-
- innercs.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedSource = state->coordinator.in(st);
-
- ++state->pendingCompletions;
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<value_type>(
- state->out,
- innercs,
- // on_next
- [state, st](value_type ct) {
- state->out.on_next(std::move(ct));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
-
- auto selectedSinkInner = state->coordinator.out(sinkInner);
- selectedSource.subscribe(std::move(selectedSinkInner));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
-};
-
-}
-
-/*! @copydoc rx-merge.hpp
-*/
-template<class... AN>
-auto merge(AN&&... an)
- -> operator_factory<merge_tag, AN...> {
- return operator_factory<merge_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<merge_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Merge = rxo::detail::merge<SourceValue, rxu::decay_t<Observable>, identity_one_worker>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o) {
- return Result(Merge(std::forward<Observable>(o), identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Merge = rxo::detail::merge<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(Merge(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Merge = typename rxu::defer_type<rxo::detail::merge, SourceValue, ObservableObservable, identity_one_worker>::type,
- class Value = rxu::value_type_t<Merge>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Value0&& v0, ValueN&&... vn) {
- return Result(Merge(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>,
- is_coordination<Coordination>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Merge = typename rxu::defer_type<rxo::detail::merge, SourceValue, ObservableObservable, rxu::decay_t<Coordination>>::type,
- class Value = rxu::value_type_t<Merge>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Coordination&& cn, Value0&& v0, ValueN&&... vn) {
- return Result(Merge(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::merge_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "merge takes (optional Coordination, optional Value0, optional ValueN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp b/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp
deleted file mode 100644
index 51f8867..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-merge_delay_error.hpp
-
- \brief 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.
-
- There are 2 variants of the operator:
- - The source observable emits nested observables, nested observables are merged.
- - The source observable and the arguments v0...vn are used to provide the observables to merge.
-
- \tparam Coordination the type of the scheduler (optional).
- \tparam Value0 ... (optional).
- \tparam ValueN types of source observables (optional).
-
- \param cn the scheduler to synchronize sources from different contexts (optional).
- \param v0 ... (optional).
- \param vn source observables (optional).
-
- \return Observable that emits items that are the result of flattening the observables emitted by the source observable.
-
- If scheduler is omitted, identity_current_thread is used.
-
- \sample
- \snippet merge_delay_error.cpp threaded implicit merge sample
- \snippet output.txt threaded implicit merge sample
-
- \sample
- \snippet merge_delay_error.cpp implicit merge sample
- \snippet output.txt implicit merge sample
-
- \sample
- \snippet merge_delay_error.cpp merge sample
- \snippet output.txt merge sample
-
- \sample
- \snippet merge_delay_error.cpp threaded merge sample
- \snippet output.txt threaded merge sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_MERGE_DELAY_ERROR_HPP)
-#define RXCPP_OPERATORS_RX_MERGE_DELAY_ERROR_HPP
-
-#include "rx-merge.hpp"
-
-#include "../rx-composite_exception.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class T, class Observable, class Coordination>
-struct merge_delay_error
- : public operator_base<rxu::value_type_t<rxu::decay_t<T>>>
-{
- //static_assert(is_observable<Observable>::value, "merge requires an observable");
- //static_assert(is_observable<T>::value, "merge requires an observable that contains observables");
-
- typedef merge_delay_error<T, Observable, Coordination> this_type;
-
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Observable> source_type;
-
- typedef typename source_type::source_operator_type source_operator_type;
- typedef typename source_value_type::value_type value_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_operator_type o, coordination_type sf)
- : source_operator(std::move(o))
- , coordination(std::move(sf))
- {
- }
- source_operator_type source_operator;
- coordination_type coordination;
- };
- values initial;
-
- merge_delay_error(const source_type& o, coordination_type sf)
- : initial(o.source_operator, std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct merge_state_type
- : public std::enable_shared_from_this<merge_state_type>
- , public values
- {
- merge_state_type(values i, coordinator_type coor, output_type oarg)
- : values(i)
- , source(i.source_operator)
- , pendingCompletions(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
- observable<source_value_type, source_operator_type> source;
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- int pendingCompletions;
- composite_exception exception;;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<merge_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- composite_subscription outercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(outercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- ++state->pendingCompletions;
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- outercs,
- // on_next
- [state](source_value_type st) {
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innercstoken = state->out.add(innercs);
-
- innercs.add(make_subscription([state, innercstoken](){
- state->out.remove(innercstoken);
- }));
-
- auto selectedSource = state->coordinator.in(st);
-
- ++state->pendingCompletions;
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<value_type>(
- state->out,
- innercs,
- // on_next
- [state, st](value_type ct) {
- state->out.on_next(std::move(ct));
- },
- // on_error
- [state](rxu::error_ptr e) {
- if(--state->pendingCompletions == 0) {
- state->out.on_error(
- rxu::make_error_ptr(std::move(state->exception.add(e))));
- } else {
- state->exception.add(e);
- }
- },
- //on_completed
- [state](){
- if (--state->pendingCompletions == 0) {
- if(!state->exception.empty()) {
- state->out.on_error(
- rxu::make_error_ptr(std::move(state->exception)));
- } else {
- state->out.on_completed();
- }
- }
- }
- );
-
- auto selectedSinkInner = state->coordinator.out(sinkInner);
- selectedSource.subscribe(std::move(selectedSinkInner));
- },
- // on_error
- [state](rxu::error_ptr e) {
- if(--state->pendingCompletions == 0) {
- state->out.on_error(
- rxu::make_error_ptr(std::move(state->exception.add(e))));
- } else {
- state->exception.add(e);
- }
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- if(!state->exception.empty()) {
- state->out.on_error(
- rxu::make_error_ptr(std::move(state->exception)));
- } else {
- state->out.on_completed();
- }
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
-};
-
-}
-
-/*! @copydoc rx-merge-delay-error.hpp
-*/
-template<class... AN>
-auto merge_delay_error(AN&&... an)
- -> operator_factory<merge_delay_error_tag, AN...> {
- return operator_factory<merge_delay_error_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<merge_delay_error_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Merge = rxo::detail::merge_delay_error<SourceValue, rxu::decay_t<Observable>, identity_one_worker>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o) {
- return Result(Merge(std::forward<Observable>(o), identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Merge = rxo::detail::merge_delay_error<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(Merge(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Merge = typename rxu::defer_type<rxo::detail::merge_delay_error, SourceValue, ObservableObservable, identity_one_worker>::type,
- class Value = rxu::value_type_t<Merge>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Value0&& v0, ValueN&&... vn) {
- return Result(Merge(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Value0, ValueN...>,
- is_coordination<Coordination>>,
- class EmittedValue = rxu::value_type_t<Observable>,
- class SourceValue = observable<EmittedValue>,
- class ObservableObservable = observable<SourceValue>,
- class Merge = typename rxu::defer_type<rxo::detail::merge_delay_error, SourceValue, ObservableObservable, rxu::decay_t<Coordination>>::type,
- class Value = rxu::value_type_t<Merge>,
- class Result = observable<Value, Merge>
- >
- static Result member(Observable&& o, Coordination&& cn, Value0&& v0, ValueN&&... vn) {
- return Result(Merge(rxs::from(o.as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::merge_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "merge_delay_error takes (optional Coordination, optional Value0, optional ValueN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp
deleted file mode 100644
index 193a11a..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-multicast.hpp
-
- \brief allows connections to the source to be independent of subscriptions.
-
- \tparam Subject the subject to multicast the source Observable.
-
- \param sub the subject.
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_MULTICAST_HPP)
-#define RXCPP_OPERATORS_RX_MULTICAST_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct multicast_invalid_arguments {};
-
-template<class... AN>
-struct multicast_invalid : public rxo::operator_base<multicast_invalid_arguments<AN...>> {
- using type = observable<multicast_invalid_arguments<AN...>, multicast_invalid<AN...>>;
-};
-template<class... AN>
-using multicast_invalid_t = typename multicast_invalid<AN...>::type;
-
-template<class T, class Observable, class Subject>
-struct multicast : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Subject> subject_type;
-
- struct multicast_state : public std::enable_shared_from_this<multicast_state>
- {
- multicast_state(source_type o, subject_type sub)
- : source(std::move(o))
- , subject_value(std::move(sub))
- {
- }
- source_type source;
- subject_type subject_value;
- rxu::detail::maybe<typename composite_subscription::weak_subscription> connection;
- };
-
- std::shared_ptr<multicast_state> state;
-
- multicast(source_type o, subject_type sub)
- : state(std::make_shared<multicast_state>(std::move(o), std::move(sub)))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber&& o) const {
- state->subject_value.get_observable().subscribe(std::forward<Subscriber>(o));
- }
- void on_connect(composite_subscription cs) const {
- if (state->connection.empty()) {
- auto destination = state->subject_value.get_subscriber();
-
- // the lifetime of each connect is nested in the subject lifetime
- state->connection.reset(destination.add(cs));
-
- auto localState = state;
-
- // when the connection is finished it should shutdown the connection
- cs.add(
- [destination, localState](){
- if (!localState->connection.empty()) {
- destination.remove(localState->connection.get());
- localState->connection.reset();
- }
- });
-
- // use cs not destination for lifetime of subscribe.
- state->source.subscribe(cs, destination);
- }
- }
-};
-
-}
-
-/*! @copydoc rx-multicast.hpp
-*/
-template<class... AN>
-auto multicast(AN&&... an)
- -> operator_factory<multicast_tag, AN...> {
- return operator_factory<multicast_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<multicast_tag>
-{
- template<class Observable, class Subject,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Subject>>,
- class Value = rxu::value_type_t<Multicast>,
- class Result = connectable_observable<Value, Multicast>>
- static Result member(Observable&& o, Subject&& sub) {
- return Result(Multicast(std::forward<Observable>(o), std::forward<Subject>(sub)));
- }
-
- template<class... AN>
- static operators::detail::multicast_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "multicast takes (Subject)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp
deleted file mode 100644
index b50b773..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-observe_on.hpp
-
- \brief All values are queued and delivered using the scheduler from the supplied coordination.
-
- \tparam Coordination the type of the scheduler.
-
- \param cn the scheduler to notify observers on.
-
- \return The source observable modified so that its observers are notified on the specified scheduler.
-
- \sample
- \snippet observe_on.cpp observe_on sample
- \snippet output.txt observe_on sample
-
- Invoking rxcpp::observable::subscribe_on operator, instead of observe_on, gives following results:
- \snippet output.txt subscribe_on sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_OBSERVE_ON_HPP)
-#define RXCPP_OPERATORS_RX_OBSERVE_ON_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct observe_on_invalid_arguments {};
-
-template<class... AN>
-struct observe_on_invalid : public rxo::operator_base<observe_on_invalid_arguments<AN...>> {
- using type = observable<observe_on_invalid_arguments<AN...>, observe_on_invalid<AN...>>;
-};
-template<class... AN>
-using observe_on_invalid_t = typename observe_on_invalid<AN...>::type;
-
-template<class T, class Coordination>
-struct observe_on
-{
- typedef rxu::decay_t<T> source_value_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- coordination_type coordination;
-
- observe_on(coordination_type cn)
- : coordination(std::move(cn))
- {
- }
-
- template<class Subscriber>
- struct observe_on_observer
- {
- typedef observe_on_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- typedef rxn::notification<T> notification_type;
- typedef typename notification_type::type base_notification_type;
- typedef std::deque<base_notification_type> queue_type;
-
- struct mode
- {
- enum type {
- Invalid = 0,
- Processing,
- Empty,
- Disposed,
- Errored
- };
- };
- struct observe_on_state : std::enable_shared_from_this<observe_on_state>
- {
- mutable std::mutex lock;
- mutable queue_type fill_queue;
- mutable queue_type drain_queue;
- composite_subscription lifetime;
- mutable typename mode::type current;
- coordinator_type coordinator;
- dest_type destination;
-
- observe_on_state(dest_type d, coordinator_type coor, composite_subscription cs)
- : lifetime(std::move(cs))
- , current(mode::Empty)
- , coordinator(std::move(coor))
- , destination(std::move(d))
- {
- }
-
- void finish(std::unique_lock<std::mutex>& guard, typename mode::type end) const {
- if (!guard.owns_lock()) {
- std::terminate();
- }
- if (current == mode::Errored || current == mode::Disposed) {return;}
- current = end;
- queue_type fill_expired;
- swap(fill_expired, fill_queue);
- queue_type drain_expired;
- swap(drain_expired, drain_queue);
- RXCPP_UNWIND_AUTO([&](){guard.lock();});
- guard.unlock();
- lifetime.unsubscribe();
- destination.unsubscribe();
- }
-
- void ensure_processing(std::unique_lock<std::mutex>& guard) const {
- if (!guard.owns_lock()) {
- std::terminate();
- }
- if (current == mode::Empty) {
- current = mode::Processing;
-
- if (!lifetime.is_subscribed() && fill_queue.empty() && drain_queue.empty()) {
- finish(guard, mode::Disposed);
- }
-
- auto keepAlive = this->shared_from_this();
-
- auto drain = [keepAlive, this](const rxsc::schedulable& self){
- using std::swap;
- RXCPP_TRY {
- for (;;) {
- if (drain_queue.empty() || !destination.is_subscribed()) {
- std::unique_lock<std::mutex> guard(lock);
- if (!destination.is_subscribed() ||
- (!lifetime.is_subscribed() && fill_queue.empty() && drain_queue.empty())) {
- finish(guard, mode::Disposed);
- return;
- }
- if (drain_queue.empty()) {
- if (fill_queue.empty()) {
- current = mode::Empty;
- return;
- }
- swap(fill_queue, drain_queue);
- }
- }
- auto notification = std::move(drain_queue.front());
- drain_queue.pop_front();
- notification->accept(destination);
- std::unique_lock<std::mutex> guard(lock);
- self();
- if (lifetime.is_subscribed()) break;
- }
- }
- RXCPP_CATCH(...) {
- destination.on_error(rxu::current_exception());
- std::unique_lock<std::mutex> guard(lock);
- finish(guard, mode::Errored);
- }
- };
-
- auto selectedDrain = on_exception(
- [&](){return coordinator.act(drain);},
- destination);
- if (selectedDrain.empty()) {
- finish(guard, mode::Errored);
- return;
- }
-
- auto processor = coordinator.get_worker();
-
- RXCPP_UNWIND_AUTO([&](){guard.lock();});
- guard.unlock();
-
- processor.schedule(selectedDrain.get());
- }
- }
- };
- std::shared_ptr<observe_on_state> state;
-
- observe_on_observer(dest_type d, coordinator_type coor, composite_subscription cs)
- : state(std::make_shared<observe_on_state>(std::move(d), std::move(coor), std::move(cs)))
- {
- }
-
- void on_next(source_value_type v) const {
- std::unique_lock<std::mutex> guard(state->lock);
- if (state->current == mode::Errored || state->current == mode::Disposed) { return; }
- state->fill_queue.push_back(notification_type::on_next(std::move(v)));
- state->ensure_processing(guard);
- }
- void on_error(rxu::error_ptr e) const {
- std::unique_lock<std::mutex> guard(state->lock);
- if (state->current == mode::Errored || state->current == mode::Disposed) { return; }
- state->fill_queue.push_back(notification_type::on_error(e));
- state->ensure_processing(guard);
- }
- void on_completed() const {
- std::unique_lock<std::mutex> guard(state->lock);
- if (state->current == mode::Errored || state->current == mode::Disposed) { return; }
- state->fill_queue.push_back(notification_type::on_completed());
- state->ensure_processing(guard);
- }
-
- static subscriber<value_type, observer<value_type, this_type>> make(dest_type d, coordination_type cn, composite_subscription cs = composite_subscription()) {
- auto coor = cn.create_coordinator(d.get_subscription());
- d.add(cs);
-
- this_type o(d, std::move(coor), cs);
- auto keepAlive = o.state;
- cs.add([=](){
- std::unique_lock<std::mutex> guard(keepAlive->lock);
- keepAlive->ensure_processing(guard);
- });
-
- return make_subscriber<value_type>(d, cs, make_observer<value_type>(std::move(o)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(observe_on_observer<decltype(dest.as_dynamic())>::make(dest.as_dynamic(), coordination)) {
- return observe_on_observer<decltype(dest.as_dynamic())>::make(dest.as_dynamic(), coordination);
- }
-};
-
-}
-
-/*! @copydoc rx-observe_on.hpp
-*/
-template<class... AN>
-auto observe_on(AN&&... an)
- -> operator_factory<observe_on_tag, AN...> {
- return operator_factory<observe_on_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<observe_on_tag>
-{
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class ObserveOn = rxo::detail::observe_on<SourceValue, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Coordination&& cn)
- -> decltype(o.template lift<SourceValue>(ObserveOn(std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(ObserveOn(std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::observe_on_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "observe_on takes (Coordination)");
- }
-};
-
-class observe_on_one_worker : public coordination_base
-{
- rxsc::scheduler factory;
-
- class input_type
- {
- rxsc::worker controller;
- rxsc::scheduler factory;
- identity_one_worker coordination;
- public:
- explicit input_type(rxsc::worker w)
- : controller(w)
- , factory(rxsc::make_same_worker(w))
- , coordination(factory)
- {
- }
- inline rxsc::worker get_worker() const {
- return controller;
- }
- inline rxsc::scheduler get_scheduler() const {
- return factory;
- }
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
- template<class Observable>
- auto in(Observable o) const
- -> decltype(o.observe_on(coordination)) {
- return o.observe_on(coordination);
- }
- template<class Subscriber>
- auto out(Subscriber s) const
- -> Subscriber {
- return s;
- }
- template<class F>
- auto act(F f) const
- -> F {
- return f;
- }
- };
-
-public:
-
- explicit observe_on_one_worker(rxsc::scheduler sc) : factory(sc) {}
-
- typedef coordinator<input_type> coordinator_type;
-
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
-
- inline coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const {
- auto w = factory.create_worker(std::move(cs));
- return coordinator_type(input_type(std::move(w)));
- }
-};
-
-inline observe_on_one_worker observe_on_run_loop(const rxsc::run_loop& rl) {
- return observe_on_one_worker(rxsc::make_run_loop(rl));
-}
-
-inline observe_on_one_worker observe_on_event_loop() {
- static observe_on_one_worker r(rxsc::make_event_loop());
- return r;
-}
-
-inline observe_on_one_worker observe_on_new_thread() {
- static observe_on_one_worker r(rxsc::make_new_thread());
- return r;
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp b/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp
deleted file mode 100644
index bc9beba..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-on_error_resume_next.hpp
-
- \brief If an error occurs, take the result from the Selector and subscribe to that instead.
-
- \tparam Selector the actual type of a function of the form `observable<T>(rxu::error_ptr)`
-
- \param s the function of the form `observable<T>(rxu::error_ptr)`
-
- \return Observable that emits the items from the source observable and switches to a new observable on error.
-
- \sample
- \snippet on_error_resume_next.cpp on_error_resume_next sample
- \snippet output.txt on_error_resume_next sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP)
-#define RXCPP_OPERATORS_RX_ON_ERROR_RESUME_NEXT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct on_error_resume_next_invalid_arguments {};
-
-template<class... AN>
-struct on_error_resume_next_invalid : public rxo::operator_base<on_error_resume_next_invalid_arguments<AN...>> {
- using type = observable<on_error_resume_next_invalid_arguments<AN...>, on_error_resume_next_invalid<AN...>>;
-};
-template<class... AN>
-using on_error_resume_next_invalid_t = typename on_error_resume_next_invalid<AN...>::type;
-
-
-template<class T, class Selector>
-struct on_error_resume_next
-{
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Selector> select_type;
- typedef decltype((*(select_type*)nullptr)(rxu::error_ptr())) fallback_type;
- select_type selector;
-
- on_error_resume_next(select_type s)
- : selector(std::move(s))
- {
- }
-
- template<class Subscriber>
- struct on_error_resume_next_observer
- {
- typedef on_error_resume_next_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Selector> select_type;
- typedef decltype((*(select_type*)nullptr)(rxu::error_ptr())) fallback_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
- dest_type dest;
- composite_subscription lifetime;
- select_type selector;
-
- on_error_resume_next_observer(dest_type d, composite_subscription cs, select_type s)
- : dest(std::move(d))
- , lifetime(std::move(cs))
- , selector(std::move(s))
- {
- dest.add(lifetime);
- }
- void on_next(value_type v) const {
- dest.on_next(std::move(v));
- }
- void on_error(rxu::error_ptr e) const {
- auto selected = on_exception(
- [&](){
- return this->selector(std::move(e));},
- dest);
- if (selected.empty()) {
- return;
- }
- selected->subscribe(dest);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<T, observer_type> make(dest_type d, select_type s) {
- auto cs = composite_subscription();
- return make_subscriber<T>(cs, observer_type(this_type(std::move(d), cs, std::move(s))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(on_error_resume_next_observer<Subscriber>::make(std::move(dest), selector)) {
- return on_error_resume_next_observer<Subscriber>::make(std::move(dest), selector);
- }
-};
-
-}
-
-/*! @copydoc rx-on_error_resume_next.hpp
-*/
-template<class... AN>
-auto on_error_resume_next(AN&&... an)
- -> operator_factory<on_error_resume_next_tag, AN...> {
- return operator_factory<on_error_resume_next_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! @copydoc rx-on_error_resume_next.hpp
-*/
-template<class... AN>
-auto switch_on_error(AN&&... an)
- -> operator_factory<on_error_resume_next_tag, AN...> {
- return operator_factory<on_error_resume_next_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<on_error_resume_next_tag>
-{
- template<class Observable, class Selector,
- class SourceValue = rxu::value_type_t<Observable>,
- class OnErrorResumeNext = rxo::detail::on_error_resume_next<SourceValue, rxu::decay_t<Selector>>,
- class Value = rxu::value_type_t<OnErrorResumeNext>>
- static auto member(Observable&& o, Selector&& p)
- -> decltype(o.template lift<Value>(OnErrorResumeNext(std::forward<Selector>(p)))) {
- return o.template lift<Value>(OnErrorResumeNext(std::forward<Selector>(p)));
- }
-
- template<class... AN>
- static operators::detail::on_error_resume_next_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "on_error_resume_next takes (Selector)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp
deleted file mode 100644
index 411cf27..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-pairwise.hpp
-
- \brief Take values pairwise from this observable.
-
- \return Observable that emits tuples of two the most recent items emitted by the source observable.
-
- \sample
- \snippet pairwise.cpp pairwise sample
- \snippet output.txt pairwise sample
-
- If the source observable emits less than two items, no pairs are emitted by the source observable:
- \snippet pairwise.cpp pairwise short sample
- \snippet output.txt pairwise short sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_PAIRWISE_HPP)
-#define RXCPP_OPERATORS_RX_PAIRWISE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct pairwise_invalid_arguments {};
-
-template<class... AN>
-struct pairwise_invalid : public rxo::operator_base<pairwise_invalid_arguments<AN...>> {
- using type = observable<pairwise_invalid_arguments<AN...>, pairwise_invalid<AN...>>;
-};
-template<class... AN>
-using pairwise_invalid_t = typename pairwise_invalid<AN...>::type;
-
-template<class T>
-struct pairwise
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef std::tuple<source_value_type, source_value_type> value_type;
-
- template<class Subscriber>
- struct pairwise_observer
- {
- typedef pairwise_observer<Subscriber> this_type;
- typedef std::tuple<source_value_type, source_value_type> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
- dest_type dest;
- mutable rxu::detail::maybe<source_value_type> remembered;
-
- pairwise_observer(dest_type d)
- : dest(std::move(d))
- {
- }
- void on_next(source_value_type v) const {
- if (remembered.empty()) {
- remembered.reset(v);
- return;
- }
-
- dest.on_next(std::make_tuple(remembered.get(), v));
- remembered.reset(v);
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<T, observer_type> make(dest_type d) {
- auto cs = d.get_subscription();
- return make_subscriber<T>(std::move(cs), observer_type(this_type(std::move(d))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(pairwise_observer<Subscriber>::make(std::move(dest))) {
- return pairwise_observer<Subscriber>::make(std::move(dest));
- }
-};
-
-}
-
-/*! @copydoc rx-pairwise.hpp
-*/
-template<class... AN>
-auto pairwise(AN&&... an)
- -> operator_factory<pairwise_tag, AN...> {
- return operator_factory<pairwise_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<pairwise_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Pairwise = rxo::detail::pairwise<SourceValue>,
- class Value = rxu::value_type_t<Pairwise>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<Value>(Pairwise())) {
- return o.template lift<Value>(Pairwise());
- }
-
- template<class... AN>
- static operators::detail::pairwise_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "pairwise takes no arguments");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-publish.hpp b/Rx/v2/src/rxcpp/operators/rx-publish.hpp
deleted file mode 100644
index bc686fc..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-publish.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-publish.hpp
-
- \brief Turn a cold observable hot and allow connections to the source to be independent of subscriptions.
- Turn a cold observable hot, send the most recent value to any new subscriber, and allow connections to the source to be independent of subscriptions.
-
- \tparam T the type of the emitted item (optional).
-
- \param first an initial item to be emitted by the resulting observable at connection time before emitting the items from the source observable; not emitted to observers that subscribe after the time of connection (optional).
- \param cs the subscription to control lifetime (optional).
-
- \return rxcpp::connectable_observable that upon connection causes the source observable to emit items to its observers.
-
- \sample
- \snippet publish.cpp publish subject sample
- \snippet output.txt publish subject sample
-
- \sample
- \snippet publish.cpp publish behavior sample
- \snippet output.txt publish behavior sample
-
- \sample
- \snippet publish.cpp publish diamond samethread sample
- \snippet output.txt publish diamond samethread sample
-
- \sample
- \snippet publish.cpp publish diamond bgthread sample
- \snippet output.txt publish diamond bgthread sample
-
- \sample
- \snippet ref_count.cpp ref_count other diamond sample
- \snippet output.txt ref_count other diamond sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_PUBLISH_HPP)
-#define RXCPP_OPERATORS_RX_PUBLISH_HPP
-
-#include "../rx-includes.hpp"
-#include "./rx-multicast.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct publish_invalid_arguments {};
-
-template<class... AN>
-struct publish_invalid : public rxo::operator_base<publish_invalid_arguments<AN...>> {
- using type = observable<publish_invalid_arguments<AN...>, publish_invalid<AN...>>;
-};
-template<class... AN>
-using publish_invalid_t = typename publish_invalid<AN...>::type;
-
-}
-
-/*! @copydoc rx-publish.hpp
-*/
-template<class... AN>
-auto publish(AN&&... an)
- -> operator_factory<publish_tag, AN...> {
- return operator_factory<publish_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief Turn a cold observable hot and allow connections to the source to be independent of subscriptions.
-
- \tparam Coordination the type of the scheduler.
-
- \param cn a scheduler all values are queued and delivered on.
- \param cs the subscription to control lifetime (optional).
-
- \return rxcpp::connectable_observable that upon connection causes the source observable to emit items to its observers, on the specified scheduler.
-
- \sample
- \snippet publish.cpp publish_synchronized sample
- \snippet output.txt publish_synchronized sample
-*/
-template<class... AN>
-auto publish_synchronized(AN&&... an)
- -> operator_factory<publish_synchronized_tag, AN...> {
- return operator_factory<publish_synchronized_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<publish_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::subject<SourceValue>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o) {
- return Result(Multicast(std::forward<Observable>(o), Subject(composite_subscription())));
- }
-
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::subject<SourceValue>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, composite_subscription cs) {
- return Result(Multicast(std::forward<Observable>(o), Subject(cs)));
- }
-
- template<class Observable, class T,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::behavior<SourceValue>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, T first, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(first, cs)));
- }
-
- template<class... AN>
- static operators::detail::publish_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "publish takes (optional CompositeSubscription) or (T, optional CompositeSubscription)");
- }
-};
-
-template<>
-struct member_overload<publish_synchronized_tag>
-{
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::synchronize<SourceValue, rxu::decay_t<Coordination>>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Coordination&& cn, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(std::forward<Coordination>(cn), cs)));
- }
-
- template<class... AN>
- static operators::detail::publish_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "publish_synchronized takes (Coordination, optional CompositeSubscription)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp
deleted file mode 100644
index e5dc819..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp
+++ /dev/null
@@ -1,687 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-reduce.hpp
-
- \brief For each item from this observable use Accumulator to combine items, when completed use ResultSelector to produce a value that will be emitted from the new observable that is returned.
-
- \tparam Seed the type of the initial value for the accumulator
- \tparam Accumulator the type of the data accumulating function
- \tparam ResultSelector the type of the result producing function
-
- \param seed the initial value for the accumulator
- \param a an accumulator function to be invoked on each item emitted by the source observable, the result of which will be used in the next accumulator call
- \param rs a result producing function that makes the final value from the last accumulator call result
-
- \return An observable that emits a single item that is the result of accumulating the output from the items emitted by the source observable.
-
- Some basic reduce-type operators have already been implemented:
- - rxcpp::operators::first
- - rxcpp::operators::last
- - rxcpp::operators::count
- - rxcpp::operators::sum
- - rxcpp::operators::average
- - rxcpp::operators::min
- - rxcpp::operators::max
-
- \sample
- Geometric mean of source values:
- \snippet reduce.cpp reduce sample
- \snippet output.txt reduce sample
-
- If the source observable completes without emitting any items, the resulting observable emits the result of passing the initial seed to the result selector:
- \snippet reduce.cpp reduce empty sample
- \snippet output.txt reduce empty sample
-
- If the accumulator raises an exception, it is returned by the resulting observable in on_error:
- \snippet reduce.cpp reduce exception from accumulator sample
- \snippet output.txt reduce exception from accumulator sample
-
- The same for exceptions raised by the result selector:
- \snippet reduce.cpp reduce exception from result selector sample
- \snippet output.txt reduce exception from result selector sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_REDUCE_HPP)
-#define RXCPP_OPERATORS_RX_REDUCE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct reduce_invalid_arguments {};
-
-template<class... AN>
-struct reduce_invalid : public rxo::operator_base<reduce_invalid_arguments<AN...>> {
- using type = observable<reduce_invalid_arguments<AN...>, reduce_invalid<AN...>>;
-};
-template<class... AN>
-using reduce_invalid_t = typename reduce_invalid<AN...>::type;
-
-template<class Seed, class ResultSelector>
-struct is_result_function_for {
-
- typedef rxu::decay_t<ResultSelector> result_selector_type;
- typedef rxu::decay_t<Seed> seed_type;
-
- struct tag_not_valid {};
-
- template<class CS, class CRS>
- static auto check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr));
- template<class CS, class CRS>
- static tag_not_valid check(...);
-
- typedef rxu::decay_t<decltype(check<seed_type, result_selector_type>(0))> type;
- static const bool value = !std::is_same<type, tag_not_valid>::value;
-};
-
-template<class T, class Observable, class Accumulator, class ResultSelector, class Seed>
-struct reduce_traits
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Accumulator> accumulator_type;
- typedef rxu::decay_t<ResultSelector> result_selector_type;
- typedef rxu::decay_t<Seed> seed_type;
-
- typedef T source_value_type;
-
- typedef typename is_result_function_for<seed_type, result_selector_type>::type value_type;
-};
-
-template<class T, class Observable, class Accumulator, class ResultSelector, class Seed>
-struct reduce : public operator_base<rxu::value_type_t<reduce_traits<T, Observable, Accumulator, ResultSelector, Seed>>>
-{
- typedef reduce<T, Observable, Accumulator, ResultSelector, Seed> this_type;
- typedef reduce_traits<T, Observable, Accumulator, ResultSelector, Seed> traits;
-
- typedef typename traits::source_type source_type;
- typedef typename traits::accumulator_type accumulator_type;
- typedef typename traits::result_selector_type result_selector_type;
- typedef typename traits::seed_type seed_type;
-
- typedef typename traits::source_value_type source_value_type;
- typedef typename traits::value_type value_type;
-
- struct reduce_initial_type
- {
- ~reduce_initial_type()
- {
- }
- reduce_initial_type(source_type o, accumulator_type a, result_selector_type rs, seed_type s)
- : source(std::move(o))
- , accumulator(std::move(a))
- , result_selector(std::move(rs))
- , seed(std::move(s))
- {
- }
- source_type source;
- accumulator_type accumulator;
- result_selector_type result_selector;
- seed_type seed;
-
- private:
- reduce_initial_type& operator=(reduce_initial_type o) RXCPP_DELETE;
- };
- reduce_initial_type initial;
-
- ~reduce()
- {
- }
- reduce(source_type o, accumulator_type a, result_selector_type rs, seed_type s)
- : initial(std::move(o), std::move(a), std::move(rs), std::move(s))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- struct reduce_state_type
- : public reduce_initial_type
- , public std::enable_shared_from_this<reduce_state_type>
- {
- reduce_state_type(reduce_initial_type i, Subscriber scrbr)
- : reduce_initial_type(i)
- , source(i.source)
- , current(reduce_initial_type::seed)
- , out(std::move(scrbr))
- {
- }
- source_type source;
- seed_type current;
- Subscriber out;
-
- private:
- reduce_state_type& operator=(reduce_state_type o) RXCPP_DELETE;
- };
- auto state = std::make_shared<reduce_state_type>(initial, std::move(o));
- state->source.subscribe(
- state->out,
- // on_next
- [state](T t) {
- seed_type next = state->accumulator(std::move(state->current), std::move(t));
- state->current = std::move(next);
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- auto result = on_exception(
- [&](){return state->result_selector(std::move(state->current));},
- state->out);
- if (result.empty()) {
- return;
- }
- state->out.on_next(std::move(result.get()));
- state->out.on_completed();
- }
- );
- }
-private:
- reduce& operator=(reduce o) RXCPP_DELETE;
-};
-
-template<class T>
-struct initialize_seeder {
- typedef T seed_type;
- static seed_type seed() {
- return seed_type{};
- }
-};
-
-template<class T>
-struct average {
- struct seed_type
- {
- seed_type()
- : value()
- , count(0)
- {
- }
- rxu::maybe<T> value;
- int count;
- rxu::detail::maybe<double> stage;
- };
- static seed_type seed() {
- return seed_type{};
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) {
- if (a.count != 0 &&
- (a.count == std::numeric_limits<int>::max() ||
- ((v > 0) && (*(a.value) > (std::numeric_limits<T>::max() - v))) ||
- ((v < 0) && (*(a.value) < (std::numeric_limits<T>::min() - v))))) {
- // would overflow, calc existing and reset for next batch
- // this will add error to the final result, but the alternative
- // is to fail on overflow
- double avg = static_cast<double>(*(a.value)) / a.count;
- if (!a.stage.empty()) {
- a.stage.reset((*a.stage + avg) / 2);
- } else {
- a.stage.reset(avg);
- }
- a.value.reset(std::forward<U>(v));
- a.count = 1;
- } else if (a.value.empty()) {
- a.value.reset(std::forward<U>(v));
- a.count = 1;
- } else {
- *(a.value) += v;
- ++a.count;
- }
- return a;
- }
- double operator()(seed_type a) {
- if (!a.value.empty()) {
- double avg = static_cast<double>(*(a.value)) / a.count;
- if (!a.stage.empty()) {
- avg = (*a.stage + avg) / 2;
- }
- return avg;
- }
- rxu::throw_exception(rxcpp::empty_error("average() requires a stream with at least one value"));
- }
-};
-
-template<class T>
-struct sum {
- typedef rxu::maybe<T> seed_type;
- static seed_type seed() {
- return seed_type();
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) const {
- if (a.empty())
- a.reset(std::forward<U>(v));
- else
- *a = *a + v;
- return a;
- }
- T operator()(seed_type a) const {
- if (a.empty())
- rxu::throw_exception(rxcpp::empty_error("sum() requires a stream with at least one value"));
- return *a;
- }
-};
-
-template<class T>
-struct max {
- typedef rxu::maybe<T> seed_type;
- static seed_type seed() {
- return seed_type();
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) {
- if (a.empty() || *a < v)
- a.reset(std::forward<U>(v));
- return a;
- }
- T operator()(seed_type a) {
- if (a.empty())
- rxu::throw_exception(rxcpp::empty_error("max() requires a stream with at least one value"));
- return *a;
- }
-};
-
-template<class T>
-struct min {
- typedef rxu::maybe<T> seed_type;
- static seed_type seed() {
- return seed_type();
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) {
- if (a.empty() || v < *a)
- a.reset(std::forward<U>(v));
- return a;
- }
- T operator()(seed_type a) {
- if (a.empty())
- rxu::throw_exception(rxcpp::empty_error("min() requires a stream with at least one value"));
- return *a;
- }
-};
-
-template<class T>
-struct first {
- using seed_type = rxu::maybe<T>;
- static seed_type seed() {
- return seed_type();
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) {
- a.reset(std::forward<U>(v));
- return a;
- }
- T operator()(seed_type a) {
- if (a.empty()) {
- rxu::throw_exception(rxcpp::empty_error("first() requires a stream with at least one value"));
- }
- return *a;
- }
-};
-
-template<class T>
-struct last {
- using seed_type = rxu::maybe<T>;
- static seed_type seed() {
- return seed_type();
- }
- template<class U>
- seed_type operator()(seed_type a, U&& v) {
- a.reset(std::forward<U>(v));
- return a;
- }
- T operator()(seed_type a) {
- if (a.empty()) {
- rxu::throw_exception(rxcpp::empty_error("last() requires a stream with at least one value"));
- }
- return *a;
- }
-};
-
-}
-
-/*! @copydoc rx-reduce.hpp
-*/
-template<class... AN>
-auto reduce(AN&&... an)
- -> operator_factory<reduce_tag, AN...> {
- return operator_factory<reduce_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! @copydoc rx-reduce.hpp
-*/
-template<class... AN>
-auto accumulate(AN&&... an)
- -> operator_factory<reduce_tag, AN...> {
- return operator_factory<reduce_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief For each item from this observable reduce it by sending only the first item.
-
- \return An observable that emits only the very first item emitted by the source observable.
-
- \sample
- \snippet math.cpp first sample
- \snippet output.txt first sample
-
- When the source observable calls on_error:
- \snippet math.cpp first empty sample
- \snippet output.txt first empty sample
-*/
-inline auto first()
- -> operator_factory<first_tag> {
- return operator_factory<first_tag>(std::tuple<>{});
-}
-
-/*! \brief For each item from this observable reduce it by sending only the last item.
-
- \return An observable that emits only the very last item emitted by the source observable.
-
- \sample
- \snippet math.cpp last sample
- \snippet output.txt last sample
-
- When the source observable calls on_error:
- \snippet math.cpp last empty sample
- \snippet output.txt last empty sample
-*/
-inline auto last()
- -> operator_factory<last_tag> {
- return operator_factory<last_tag>(std::tuple<>{});
-}
-
-/*! \brief For each item from this observable reduce it by incrementing a count.
-
- \return An observable that emits a single item: the number of elements emitted by the source observable.
-
- \sample
- \snippet math.cpp count sample
- \snippet output.txt count sample
-
- When the source observable calls on_error:
- \snippet math.cpp count error sample
- \snippet output.txt count error sample
-*/
-inline auto count()
- -> operator_factory<reduce_tag, int, rxu::count, rxu::detail::take_at<0>> {
- return operator_factory<reduce_tag, int, rxu::count, rxu::detail::take_at<0>>(std::make_tuple(0, rxu::count(), rxu::take_at<0>()));
-}
-
-/*! \brief For each item from this observable reduce it by adding to the previous values and then dividing by the number of items at the end.
-
- \return An observable that emits a single item: the average of elements emitted by the source observable.
-
- \sample
- \snippet math.cpp average sample
- \snippet output.txt average sample
-
- When the source observable completes without emitting any items:
- \snippet math.cpp average empty sample
- \snippet output.txt average empty sample
-
- When the source observable calls on_error:
- \snippet math.cpp average error sample
- \snippet output.txt average error sample
-*/
-inline auto average()
- -> operator_factory<average_tag> {
- return operator_factory<average_tag>(std::tuple<>{});
-}
-
-/*! \brief For each item from this observable reduce it by adding to the previous items.
-
- \return An observable that emits a single item: the sum of elements emitted by the source observable.
-
- \sample
- \snippet math.cpp sum sample
- \snippet output.txt sum sample
-
- When the source observable completes without emitting any items:
- \snippet math.cpp sum empty sample
- \snippet output.txt sum empty sample
-
- When the source observable calls on_error:
- \snippet math.cpp sum error sample
- \snippet output.txt sum error sample
-*/
-inline auto sum()
- -> operator_factory<sum_tag> {
- return operator_factory<sum_tag>(std::tuple<>{});
-}
-
-/*! \brief For each item from this observable reduce it by taking the min value of the previous items.
-
- \return An observable that emits a single item: the min of elements emitted by the source observable.
-
- \sample
- \snippet math.cpp min sample
- \snippet output.txt min sample
-
- When the source observable completes without emitting any items:
- \snippet math.cpp min empty sample
- \snippet output.txt min empty sample
-
- When the source observable calls on_error:
- \snippet math.cpp min error sample
- \snippet output.txt min error sample
-*/
-inline auto min()
- -> operator_factory<min_tag> {
- return operator_factory<min_tag>(std::tuple<>{});
-}
-
-/*! \brief For each item from this observable reduce it by taking the max value of the previous items.
-
- \return An observable that emits a single item: the max of elements emitted by the source observable.
-
- \sample
- \snippet math.cpp max sample
- \snippet output.txt max sample
-
- When the source observable completes without emitting any items:
- \snippet math.cpp max empty sample
- \snippet output.txt max empty sample
-
- When the source observable calls on_error:
- \snippet math.cpp max error sample
- \snippet output.txt max error sample
-*/
-inline auto max()
- -> operator_factory<max_tag> {
- return operator_factory<max_tag>(std::tuple<>{});
-}
-
-}
-
-template<>
-struct member_overload<reduce_tag>
-{
-
- template<class Observable, class Seed, class Accumulator, class ResultSelector,
- class Reduce = rxo::detail::reduce<rxu::value_type_t<Observable>, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class Value = rxu::value_type_t<Reduce>,
- class Result = observable<Value, Reduce>>
- static Result member(Observable&& o, Seed&& s, Accumulator&& a, ResultSelector&& r)
- {
- return Result(Reduce(std::forward<Observable>(o), std::forward<Accumulator>(a), std::forward<ResultSelector>(r), std::forward<Seed>(s)));
- }
-
- template<class Observable, class Seed, class Accumulator,
- class ResultSelector=rxu::detail::take_at<0>,
- class Reduce = rxo::detail::reduce<rxu::value_type_t<Observable>, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class Value = rxu::value_type_t<Reduce>,
- class Result = observable<Value, Reduce>>
- static Result member(Observable&& o, Seed&& s, Accumulator&& a)
- {
- return Result(Reduce(std::forward<Observable>(o), std::forward<Accumulator>(a), rxu::detail::take_at<0>(), std::forward<Seed>(s)));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "reduce takes (Seed, Accumulator, optional ResultSelector), Accumulator takes (Seed, Observable::value_type) -> Seed, ResultSelector takes (Observable::value_type) -> ResultValue");
- }
-};
-
-template<>
-struct member_overload<first_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::first<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class TakeOne = decltype(((rxu::decay_t<Observable>*)nullptr)->take(1)),
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<TakeOne>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(o.take(1), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "first does not support Observable::value_type");
- }
-};
-
-template<>
-struct member_overload<last_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::last<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(std::forward<Observable>(o), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "last does not support Observable::value_type");
- }
-};
-
-template<>
-struct member_overload<sum_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::sum<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(std::forward<Observable>(o), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "sum does not support Observable::value_type");
- }
-};
-
-template<>
-struct member_overload<average_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::average<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(std::forward<Observable>(o), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "average does not support Observable::value_type");
- }
-};
-
-template<>
-struct member_overload<max_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::max<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(std::forward<Observable>(o), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "max does not support Observable::value_type");
- }
-};
-
-template<>
-struct member_overload<min_tag>
-{
- template<class Observable,
- class SValue = rxu::value_type_t<Observable>,
- class Operation = operators::detail::min<SValue>,
- class Seed = decltype(Operation::seed()),
- class Accumulator = Operation,
- class ResultSelector = Operation,
- class Reduce = rxo::detail::reduce<SValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<ResultSelector>, rxu::decay_t<Seed>>,
- class RValue = rxu::value_type_t<Reduce>,
- class Result = observable<RValue, Reduce>>
- static Result member(Observable&& o)
- {
- return Result(Reduce(std::forward<Observable>(o), Operation{}, Operation{}, Operation::seed()));
- }
-
- template<class... AN>
- static operators::detail::reduce_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "min does not support Observable::value_type");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp
deleted file mode 100644
index b68315d..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-ref_count.hpp
-
- \brief Make some \c connectable_observable behave like an ordinary \c observable.
- Uses a reference count of the subscribers to control the connection to the published observable.
-
- The first subscription will cause a call to \c connect(), and the last \c unsubscribe will unsubscribe the connection.
-
- There are 2 variants of the operator:
- \li \c ref_count(): calls \c connect on the \c source \c connectable_observable.
- \li \c ref_count(other): calls \c connect on the \c other \c connectable_observable.
-
- \tparam ConnectableObservable the type of the \c other \c connectable_observable (optional)
- \param other \c connectable_observable to call \c connect on (optional)
-
- If \c other is omitted, then \c source is used instead (which must be a \c connectable_observable).
- Otherwise, \c source can be a regular \c observable.
-
- \return An \c observable that emits the items from its \c source.
-
- \sample
- \snippet ref_count.cpp ref_count other diamond sample
- \snippet output.txt ref_count other diamond sample
- */
-
-#if !defined(RXCPP_OPERATORS_RX_REF_COUNT_HPP)
-#define RXCPP_OPERATORS_RX_REF_COUNT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct ref_count_invalid_arguments {};
-
-template<class... AN>
-struct ref_count_invalid : public rxo::operator_base<ref_count_invalid_arguments<AN...>> {
- using type = observable<ref_count_invalid_arguments<AN...>, ref_count_invalid<AN...>>;
-};
-template<class... AN>
-using ref_count_invalid_t = typename ref_count_invalid<AN...>::type;
-
-// ref_count(other) takes a regular observable source, not a connectable_observable.
-// use template specialization to avoid instantiating 'subscribe' for two different types
-// which would cause a compilation error.
-template <typename connectable_type, typename observable_type>
-struct ref_count_state_base {
- ref_count_state_base(connectable_type other, observable_type source)
- : connectable(std::move(other))
- , subscribable(std::move(source)) {}
-
- connectable_type connectable; // connects to this. subscribes to this if subscribable empty.
- observable_type subscribable; // subscribes to this if non-empty.
-
- template <typename Subscriber>
- void subscribe(Subscriber&& o) {
- subscribable.subscribe(std::forward<Subscriber>(o));
- }
-};
-
-// Note: explicit specializations have to be at namespace scope prior to C++17.
-template <typename connectable_type>
-struct ref_count_state_base<connectable_type, void> {
- explicit ref_count_state_base(connectable_type c)
- : connectable(std::move(c)) {}
-
- connectable_type connectable; // connects to this. subscribes to this if subscribable empty.
-
- template <typename Subscriber>
- void subscribe(Subscriber&& o) {
- connectable.subscribe(std::forward<Subscriber>(o));
- }
-};
-
-template<class T,
- class ConnectableObservable,
- class Observable = void> // note: type order flipped versus the operator.
-struct ref_count : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> observable_type;
- typedef rxu::decay_t<ConnectableObservable> connectable_type;
-
- // ref_count() == false
- // ref_count(other) == true
- using has_observable_t = rxu::negation<std::is_same<void, Observable>>;
- static constexpr bool has_observable_v = has_observable_t::value;
-
- struct ref_count_state : public std::enable_shared_from_this<ref_count_state>,
- public ref_count_state_base<ConnectableObservable, Observable>
- {
- template <class HasObservable = has_observable_t,
- class Enabled = rxu::enable_if_all_true_type_t<
- rxu::negation<HasObservable>>>
- explicit ref_count_state(connectable_type source)
- : ref_count_state_base<ConnectableObservable, Observable>(std::move(source))
- , subscribers(0)
- {
- }
-
- template <bool HasObservableV = has_observable_v>
- ref_count_state(connectable_type other,
- typename std::enable_if<HasObservableV, observable_type>::type source)
- : ref_count_state_base<ConnectableObservable, Observable>(std::move(other),
- std::move(source))
- , subscribers(0)
- {
- }
-
- std::mutex lock;
- long subscribers;
- composite_subscription connection;
- };
- std::shared_ptr<ref_count_state> state;
-
- // connectable_observable<T> source = ...;
- // source.ref_count();
- //
- // calls connect on source after the subscribe on source.
- template <class HasObservable = has_observable_t,
- class Enabled = rxu::enable_if_all_true_type_t<
- rxu::negation<HasObservable>>>
- explicit ref_count(connectable_type source)
- : state(std::make_shared<ref_count_state>(std::move(source)))
- {
- }
-
- // connectable_observable<?> other = ...;
- // observable<T> source = ...;
- // source.ref_count(other);
- //
- // calls connect on 'other' after the subscribe on 'source'.
- template <bool HasObservableV = has_observable_v>
- ref_count(connectable_type other,
- typename std::enable_if<HasObservableV, observable_type>::type source)
- : state(std::make_shared<ref_count_state>(std::move(other), std::move(source)))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber&& o) const {
- std::unique_lock<std::mutex> guard(state->lock);
- auto needConnect = ++state->subscribers == 1;
- auto keepAlive = state;
- guard.unlock();
- o.add(
- [keepAlive](){
- std::unique_lock<std::mutex> guard_unsubscribe(keepAlive->lock);
- if (--keepAlive->subscribers == 0) {
- keepAlive->connection.unsubscribe();
- keepAlive->connection = composite_subscription();
- }
- });
- keepAlive->subscribe(std::forward<Subscriber>(o));
- if (needConnect) {
- keepAlive->connectable.connect(keepAlive->connection);
- }
- }
-};
-
-}
-
-/*! @copydoc rx-ref_count.hpp
-*/
-template<class... AN>
-auto ref_count(AN&&... an)
- -> operator_factory<ref_count_tag, AN...> {
- return operator_factory<ref_count_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<ref_count_tag>
-{
- template<class ConnectableObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_connectable_observable<ConnectableObservable>>,
- class SourceValue = rxu::value_type_t<ConnectableObservable>,
- class RefCount = rxo::detail::ref_count<SourceValue, rxu::decay_t<ConnectableObservable>>,
- class Value = rxu::value_type_t<RefCount>,
- class Result = observable<Value, RefCount>
- >
- static Result member(ConnectableObservable&& o) {
- return Result(RefCount(std::forward<ConnectableObservable>(o)));
- }
-
- template<class Observable,
- class ConnectableObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_connectable_observable<ConnectableObservable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class RefCount = rxo::detail::ref_count<SourceValue,
- rxu::decay_t<ConnectableObservable>,
- rxu::decay_t<Observable>>,
- class Value = rxu::value_type_t<RefCount>,
- class Result = observable<Value, RefCount>
- >
- static Result member(Observable&& o, ConnectableObservable&& other) {
- return Result(RefCount(std::forward<ConnectableObservable>(other),
- std::forward<Observable>(o)));
- }
-
- template<class... AN>
- static operators::detail::ref_count_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "ref_count takes (optional ConnectableObservable)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp
deleted file mode 100644
index 3b9ac89..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-repeat.hpp
-
- \brief Repeat this observable for the given number of times or infinitely.
-
- \tparam Count the type of the counter (optional).
-
- \param t The number of times the source observable items are repeated (optional). If not specified, infinitely repeats the source observable. Specifying 0 returns an empty sequence immediately
-
- \return An observable that repeats the sequence of items emitted by the source observable for t times.
-
- \sample
- \snippet repeat.cpp repeat count sample
- \snippet output.txt repeat count sample
-
- If the source observable calls on_error, repeat stops:
- \snippet repeat.cpp repeat error sample
- \snippet output.txt repeat error sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_REPEAT_HPP)
-#define RXCPP_OPERATORS_RX_REPEAT_HPP
-
-#include "../rx-includes.hpp"
-#include "rx-retry-repeat-common.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct repeat_invalid_arguments {};
-
-template<class... AN>
-struct repeat_invalid : public rxo::operator_base<repeat_invalid_arguments<AN...>> {
- using type = observable<repeat_invalid_arguments<AN...>, repeat_invalid<AN...>>;
-};
-template<class... AN>
-using repeat_invalid_t = typename repeat_invalid<AN...>::type;
-
-// Contain repeat variations in a namespace
-namespace repeat {
- struct event_handlers {
- template <typename State>
- static inline void on_error(State& state, rxu::error_ptr& e) {
- state->out.on_error(e);
- }
-
- template <typename State>
- static inline void on_completed(State& state) {
- // Functions update() and completed_predicate() vary between finite and infinte versions
- state->update();
- if (state->completed_predicate()) {
- state->out.on_completed();
- } else {
- state->do_subscribe();
- }
- }
- };
-
- // Finite repeat case (explicitely limited with the number of times)
- template <class T, class Observable, class Count>
- using finite = ::rxcpp::operators::detail::retry_repeat_common::finite
- <event_handlers, T, Observable, Count>;
-
- // Infinite repeat case
- template <class T, class Observable>
- using infinite = ::rxcpp::operators::detail::retry_repeat_common::infinite
- <event_handlers, T, Observable>;
-
-}
-} // detail
-
-/*! @copydoc rx-repeat.hpp
-*/
-template<class... AN>
-auto repeat(AN&&... an)
--> operator_factory<repeat_tag, AN...> {
- return operator_factory<repeat_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<repeat_tag> {
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Repeat = rxo::detail::repeat::infinite<SourceValue, rxu::decay_t<Observable>>,
- class Value = rxu::value_type_t<Repeat>,
- class Result = observable<Value, Repeat>>
- static Result member(Observable&& o) {
- return Result(Repeat(std::forward<Observable>(o)));
- }
-
- template<class Observable,
- class Count,
- class Enabled = rxu::enable_if_all_true_type_t<is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Repeat = rxo::detail::repeat::finite<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<Repeat>,
- class Result = observable<Value, Repeat>>
- static Result member(Observable&& o, Count&& c) {
- return Result(Repeat(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::repeat_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "repeat takes (optional Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-replay.hpp b/Rx/v2/src/rxcpp/operators/rx-replay.hpp
deleted file mode 100644
index b2db8d8..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-replay.hpp
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-replay.hpp
-
- \brief 1) replay(optional Coordination, optional CompositeSubscription)
- Turn a cold observable hot, send all earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions.
-
- 2) replay(Count, optional Coordination, optional CompositeSubscription)
- Turn a cold observable hot, send at most count of earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions.
-
- 3) replay(Duration, optional Coordination, optional CompositeSubscription)
- Turn a cold observable hot, send values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions.
-
- 4) replay(Count, Duration, optional Coordination, optional CompositeSubscription)
- Turn a cold observable hot, send at most count of values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions.
-
- \tparam Duration the type of the time interval (optional).
- \tparam Count the type of the maximum number of the most recent items sent to new observers (optional).
- \tparam Coordination the type of the scheduler (optional).
-
- \param count the maximum number of the most recent items sent to new observers (optional).
- \param d the duration of the window in which the replayed items must be emitted
- \param cn a scheduler all values are queued and delivered on (optional).
- \param cs the subscription to control lifetime (optional).
-
- \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay all of its items and notifications to any future observer.
-
- \sample
- \snippet replay.cpp replay sample
- \snippet output.txt replay sample
-
- \sample
- \snippet replay.cpp threaded replay sample
- \snippet output.txt threaded replay sample
-
- \sample
- \snippet replay.cpp replay count sample
- \snippet output.txt replay count sample
-
- \sample
- \snippet replay.cpp threaded replay count sample
- \snippet output.txt threaded replay count sample
-
- \sample
- \snippet replay.cpp replay period sample
- \snippet output.txt replay period sample
-
- \sample
- \snippet replay.cpp threaded replay period sample
- \snippet output.txt threaded replay period sample
-
- \sample
- \snippet replay.cpp replay count+period sample
- \snippet output.txt replay count+period sample
-
- \sample
- \snippet replay.cpp threaded replay count+period sample
- \snippet output.txt threaded replay count+period sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_REPLAY_HPP)
-#define RXCPP_OPERATORS_RX_REPLAY_HPP
-
-#include "../rx-includes.hpp"
-#include "./rx-multicast.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct replay_invalid_arguments {};
-
-template<class... AN>
-struct replay_invalid : public rxo::operator_base<replay_invalid_arguments<AN...>> {
- using type = observable<replay_invalid_arguments<AN...>, replay_invalid<AN...>>;
-};
-template<class... AN>
-using replay_invalid_t = typename replay_invalid<AN...>::type;
-
-}
-
-/*! @copydoc rx-replay.hpp
-*/
-template<class... AN>
-auto replay(AN&&... an)
- -> operator_factory<replay_tag, AN...> {
- return operator_factory<replay_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
- template<>
-struct member_overload<replay_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, identity_one_worker>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o) {
- return Result(Multicast(std::forward<Observable>(o), Subject(identity_current_thread(), composite_subscription())));
- }
-
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, identity_one_worker>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, composite_subscription cs) {
- return Result(Multicast(std::forward<Observable>(o), Subject(identity_current_thread(), cs)));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, rxu::decay_t<Coordination>>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Coordination&& cn, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(std::forward<Coordination>(cn), cs)));
- }
-
- template<class Observable, class Count,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_integral<Count>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, identity_one_worker>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Count count, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(count, identity_current_thread(), cs)));
- }
-
- template<class Observable, class Count, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_integral<Count>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, rxu::decay_t<Coordination>>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Count count, Coordination&& cn, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(count, std::forward<Coordination>(cn), cs)));
- }
-
- template<class Observable, class Duration,
- class IsDuration = rxu::is_duration<Duration>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- IsDuration>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, identity_one_worker>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Duration&& d, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(std::forward<Duration>(d), identity_current_thread(), cs)));
- }
-
- template<class Observable, class Duration, class Coordination,
- class IsDuration = rxu::is_duration<Duration>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- IsDuration,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, rxu::decay_t<Coordination>>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Duration&& d, Coordination&& cn, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(std::forward<Duration>(d), std::forward<Coordination>(cn), cs)));
- }
-
- template<class Observable, class Count, class Duration,
- class IsDuration = rxu::is_duration<Duration>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_integral<Count>,
- IsDuration>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, identity_one_worker>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Count count, Duration&& d, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(count, std::forward<Duration>(d), identity_current_thread(), cs)));
- }
-
- template<class Observable, class Count, class Duration, class Coordination,
- class IsDuration = rxu::is_duration<Duration>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_integral<Count>,
- IsDuration,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Subject = rxsub::replay<SourceValue, rxu::decay_t<Coordination>>,
- class Multicast = rxo::detail::multicast<SourceValue, rxu::decay_t<Observable>, Subject>,
- class Result = connectable_observable<SourceValue, Multicast>
- >
- static Result member(Observable&& o, Count count, Duration&& d, Coordination&& cn, composite_subscription cs = composite_subscription()) {
- return Result(Multicast(std::forward<Observable>(o), Subject(count, std::forward<Duration>(d), std::forward<Coordination>(cn), cs)));
- }
-
- template<class... AN>
- static operators::detail::replay_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "replay takes (optional Count, optional Duration, optional Coordination, optional CompositeSubscription)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp b/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp
deleted file mode 100644
index 30a71fe..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-#pragma once
-
-/*! \file rx-retry-repeat-common.hpp
-
- \brief Implementation commonalities between retry and repeat operators abstracted away from rx-retry.hpp and rx-repeat.hpp files. Should be used only from rx-retry.hpp and rx-repeat.hpp
-
-*/
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
- namespace operators {
- namespace detail {
-
- namespace retry_repeat_common {
- // Structure to perform general retry/repeat operations on state
- template <class Values, class Subscriber, class EventHandlers, class T>
- struct state_type : public std::enable_shared_from_this<state_type<Values, Subscriber, EventHandlers, T>>,
- public Values {
-
- typedef Subscriber output_type;
- state_type(const Values& i, const output_type& oarg)
- : Values(i),
- source_lifetime(composite_subscription::empty()),
- out(oarg) {
- }
-
- void do_subscribe() {
- auto state = this->shared_from_this();
-
- state->out.remove(state->lifetime_token);
- state->source_lifetime.unsubscribe();
-
- state->source_lifetime = composite_subscription();
- state->lifetime_token = state->out.add(state->source_lifetime);
-
- state->source.subscribe(
- state->out,
- state->source_lifetime,
- // on_next
- [state](T t) {
- state->out.on_next(t);
- },
- // on_error
- [state](rxu::error_ptr e) {
- EventHandlers::on_error(state, e);
- },
- // on_completed
- [state]() {
- EventHandlers::on_completed(state);
- }
- );
- }
-
- composite_subscription source_lifetime;
- output_type out;
- composite_subscription::weak_subscription lifetime_token;
- };
-
- // Finite case (explicitely limited with the number of times)
- template <class EventHandlers, class T, class Observable, class Count>
- struct finite : public operator_base<T> {
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Count> count_type;
-
- struct values {
- values(source_type s, count_type t)
- : source(std::move(s)),
- remaining_(std::move(t)) {
- }
-
- inline bool completed_predicate() const {
- // Return true if we are completed
- return remaining_ <= 0;
- }
-
- inline void update() {
- // Decrement counter
- --remaining_;
- }
-
- source_type source;
-
- private:
- // Counter to hold number of times remaining to complete
- count_type remaining_;
- };
-
- finite(source_type s, count_type t)
- : initial_(std::move(s), std::move(t)) {
- }
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
- typedef state_type<values, Subscriber, EventHandlers, T> state_t;
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_t>(initial_, s);
- if (initial_.completed_predicate()) {
- // return completed
- state->out.on_completed();
- } else {
- // start the first iteration
- state->do_subscribe();
- }
- }
-
- private:
- values initial_;
- };
-
- // Infinite case
- template <class EventHandlers, class T, class Observable>
- struct infinite : public operator_base<T> {
- typedef rxu::decay_t<Observable> source_type;
-
- struct values {
- values(source_type s)
- : source(std::move(s)) {
- }
-
- static inline bool completed_predicate() {
- // Infinite never completes
- return false;
- }
-
- static inline void update() {
- // Infinite does not need to update state
- }
-
- source_type source;
- };
-
- infinite(source_type s) : initial_(std::move(s)) {
- }
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
- typedef state_type<values, Subscriber, EventHandlers, T> state_t;
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_t>(initial_, s);
- // start the first iteration
- state->do_subscribe();
- }
-
- private:
- values initial_;
- };
-
-
- }
- }
- }
-}
diff --git a/Rx/v2/src/rxcpp/operators/rx-retry.hpp b/Rx/v2/src/rxcpp/operators/rx-retry.hpp
deleted file mode 100644
index 63e5c27..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-retry.hpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-retry.hpp
-
- \brief Retry this observable for the given number of times.
-
- \tparam Count the type of the counter (optional)
-
- \param t the total number of tries (optional), i.e. retry(2) means one normal try, before an error occurs, and one retry. If not specified, infinitely retries the source observable. Specifying 0 returns immediately without subscribing
-
- \return An observable that mirrors the source observable, resubscribing to it if it calls on_error up to a specified number of retries.
-
- \sample
- \snippet retry.cpp retry count sample
- \snippet output.txt retry count sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_RETRY_HPP)
-#define RXCPP_OPERATORS_RX_RETRY_HPP
-
-#include "../rx-includes.hpp"
-#include "rx-retry-repeat-common.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct retry_invalid_arguments {};
-
-template<class... AN>
-struct retry_invalid : public rxo::operator_base<retry_invalid_arguments<AN...>> {
- using type = observable<retry_invalid_arguments<AN...>, retry_invalid<AN...>>;
-};
-template<class... AN>
-using retry_invalid_t = typename retry_invalid<AN...>::type;
-
-// Contain retry variations in a namespace
-namespace retry {
- struct event_handlers {
- template <typename State>
- static inline void on_error(State& state, rxu::error_ptr& e) {
- state->update();
- // Use specialized predicate for finite/infinte case
- if (state->completed_predicate()) {
- state->out.on_error(e);
- } else {
- state->do_subscribe();
- }
- }
-
- template <typename State>
- static inline void on_completed(State& state) {
- state->out.on_completed();
- }
- };
-
- // Finite repeat case (explicitely limited with the number of times)
- template <class T, class Observable, class Count>
- using finite = ::rxcpp::operators::detail::retry_repeat_common::finite
- <event_handlers, T, Observable, Count>;
-
- // Infinite repeat case
- template <class T, class Observable>
- using infinite = ::rxcpp::operators::detail::retry_repeat_common::infinite
- <event_handlers, T, Observable>;
-
-}
-} // detail
-
-/*! @copydoc rx-retry.hpp
-*/
-template<class... AN>
-auto retry(AN&&... an)
--> operator_factory<retry_tag, AN...> {
- return operator_factory<retry_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<retry_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Retry = rxo::detail::retry::infinite<SourceValue, rxu::decay_t<Observable>>,
- class Value = rxu::value_type_t<Retry>,
- class Result = observable<Value, Retry>
- >
- static Result member(Observable&& o) {
- return Result(Retry(std::forward<Observable>(o)));
- }
-
- template<class Observable,
- class Count,
- class Enabled = rxu::enable_if_all_true_type_t<is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Retry = rxo::detail::retry::finite<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<Retry>,
- class Result = observable<Value, Retry>
- >
- static Result member(Observable&& o, Count&& c) {
- return Result(Retry(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::retry_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "retry takes (optional Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp b/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp
deleted file mode 100644
index f50cbe4..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-sample_time.hpp
-
- \brief Return an Observable that emits the most recent items emitted by the source Observable within periodic time intervals.
-
- \tparam Duration the type of time interval.
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time to sample the source observable.
- \param coordination the scheduler for the items (optional).
-
- \return Observable that emits the most recently emitted item since the previous sampling.
-
- \sample
- \snippet sample.cpp sample period sample
- \snippet output.txt sample period sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SAMPLE_WITH_TIME_HPP)
-#define RXCPP_OPERATORS_RX_SAMPLE_WITH_TIME_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct sample_with_time_invalid_arguments {};
-
-template<class... AN>
-struct sample_with_time_invalid : public rxo::operator_base<sample_with_time_invalid_arguments<AN...>> {
- using type = observable<sample_with_time_invalid_arguments<AN...>, sample_with_time_invalid<AN...>>;
-};
-template<class... AN>
-using sample_with_time_invalid_t = typename sample_with_time_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct sample_with_time
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct sample_with_time_value
- {
- sample_with_time_value(duration_type p, coordination_type c)
- : period(p)
- , coordination(c)
- {
- }
- duration_type period;
- coordination_type coordination;
- };
- sample_with_time_value initial;
-
- sample_with_time(duration_type period, coordination_type coordination)
- : initial(period, coordination)
- {
- }
-
- template<class Subscriber>
- struct sample_with_time_observer
- {
- typedef sample_with_time_observer<Subscriber> this_type;
- typedef T value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- struct sample_with_time_subscriber_value : public sample_with_time_value
- {
- sample_with_time_subscriber_value(composite_subscription cs, dest_type d, sample_with_time_value v, coordinator_type c)
- : sample_with_time_value(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable rxu::maybe<value_type> value;
- };
- std::shared_ptr<sample_with_time_subscriber_value> state;
-
- sample_with_time_observer(composite_subscription cs, dest_type d, sample_with_time_value v, coordinator_type c)
- : state(std::make_shared<sample_with_time_subscriber_value>(sample_with_time_subscriber_value(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){ return localState->coordinator.act(disposer); },
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- auto produce_sample = [localState](const rxsc::schedulable&) {
- if(!localState->value.empty()) {
- localState->dest.on_next(*localState->value);
- localState->value.reset();
- }
- };
- auto selectedProduce = on_exception(
- [&](){ return localState->coordinator.act(produce_sample); },
- localState->dest);
- if (selectedProduce.empty()) {
- return;
- }
-
- state->worker.schedule_periodically(
- localState->worker.now(),
- localState->period,
- [localState, selectedProduce](const rxsc::schedulable&) {
- localState->worker.schedule(selectedProduce.get());
- });
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&) {
- localState->value.reset(v);
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&) {
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&) {
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer<T, this_type>> make(dest_type d, sample_with_time_value v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, this_type(cs, std::move(d), std::move(v), std::move(coordinator)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(sample_with_time_observer<Subscriber>::make(std::move(dest), initial)) {
- return sample_with_time_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-sample_time.hpp
-*/
-template<class... AN>
-auto sample_with_time(AN&&... an)
- -> operator_factory<sample_with_time_tag, AN...> {
- return operator_factory<sample_with_time_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<sample_with_time_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SampleWithTime = rxo::detail::sample_with_time<SourceValue, rxu::decay_t<Duration>, identity_one_worker>>
- static auto member(Observable&& o, Duration&& d)
- -> decltype(o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), identity_current_thread()))) {
- return o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SampleWithTime = rxo::detail::sample_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Coordination&& cn, Duration&& d)
- -> decltype(o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SampleWithTime = rxo::detail::sample_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Duration&& d, Coordination&& cn)
- -> decltype(o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(SampleWithTime(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::sample_with_time_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "sample_with_time takes (optional Coordination, required Duration) or (required Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp
deleted file mode 100644
index 73bcd87..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-scan.hpp
-
- \brief For each item from this observable use Accumulator to combine items into a value that will be emitted from the new observable that is returned.
-
- \tparam Seed the type of the initial value for the accumulator.
- \tparam Accumulator the type of the data accumulating function.
-
- \param seed the initial value for the accumulator.
- \param a an accumulator function to be invoked on each item emitted by the source observable, whose result will be emitted and used in the next accumulator call.
-
- \return An observable that emits the results of each call to the accumulator function.
-
- \sample
- \snippet scan.cpp scan sample
- \snippet output.txt scan sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SCAN_HPP)
-#define RXCPP_OPERATORS_RX_SCAN_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct scan_invalid_arguments {};
-
-template<class... AN>
-struct scan_invalid : public rxo::operator_base<scan_invalid_arguments<AN...>> {
- using type = observable<scan_invalid_arguments<AN...>, scan_invalid<AN...>>;
-};
-template<class... AN>
-using scan_invalid_t = typename scan_invalid<AN...>::type;
-
-template<class T, class Observable, class Accumulator, class Seed>
-struct scan : public operator_base<rxu::decay_t<Seed>>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Accumulator> accumulator_type;
- typedef rxu::decay_t<Seed> seed_type;
-
- struct scan_initial_type
- {
- scan_initial_type(source_type o, accumulator_type a, seed_type s)
- : source(std::move(o))
- , accumulator(std::move(a))
- , seed(s)
- {
- }
- source_type source;
- accumulator_type accumulator;
- seed_type seed;
- };
- scan_initial_type initial;
-
- scan(source_type o, accumulator_type a, seed_type s)
- : initial(std::move(o), a, s)
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- struct scan_state_type
- : public scan_initial_type
- , public std::enable_shared_from_this<scan_state_type>
- {
- scan_state_type(scan_initial_type i, Subscriber scrbr)
- : scan_initial_type(i)
- , result(scan_initial_type::seed)
- , out(std::move(scrbr))
- {
- }
- seed_type result;
- Subscriber out;
- };
- auto state = std::make_shared<scan_state_type>(initial, std::move(o));
- state->source.subscribe(
- state->out,
- // on_next
- [state](T t) {
- state->result = state->accumulator(state->result, t);
- state->out.on_next(state->result);
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-scan.hpp
-*/
-template<class... AN>
-auto scan(AN&&... an)
- -> operator_factory<scan_tag, AN...> {
- return operator_factory<scan_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<scan_tag>
-{
- template<class Observable, class Seed, class Accumulator,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_accumulate_function_for<rxu::value_type_t<Observable>, rxu::decay_t<Seed>, rxu::decay_t<Accumulator>>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Scan = rxo::detail::scan<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Accumulator>, rxu::decay_t<Seed>>,
- class Value = rxu::value_type_t<Scan>,
- class Result = observable<Value, Scan>>
- static Result member(Observable&& o, Seed s, Accumulator&& a) {
- return Result(Scan(std::forward<Observable>(o), std::forward<Accumulator>(a), s));
- }
-
- template<class... AN>
- static operators::detail::scan_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "scan takes (Seed, Accumulator); Accumulator must be a function with the signature Seed(Seed, T)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp b/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp
deleted file mode 100644
index 3350e44..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-sequence_equal.hpp
-
- \brief Determine whether two Observables emit the same sequence of items.
-
- \tparam OtherSource the type of the other observable.
- \tparam BinaryPredicate the type of the value comparing function (optional). The signature should be equivalent to the following: bool pred(const T1& a, const T2& b);
- \tparam Coordination the type of the scheduler (optional).
-
- \param t the other Observable that emits items to compare.
- \param pred the function that implements comparison of two values (optional).
- \param cn the scheduler (optional).
-
- \return Observable that emits true only if both sequences terminate normally after emitting the same sequence of items in the same order; otherwise it will emit false.
-
- \sample
- \snippet sequence_equal.cpp sequence_equal sample
- \snippet output.txt sequence_equal sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SEQUENCE_EQUAL_HPP)
-#define RXCPP_OPERATORS_RX_SEQUENCE_EQUAL_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct sequence_equal_invalid_arguments {};
-
-template<class... AN>
-struct sequence_equal_invalid : public rxo::operator_base<sequence_equal_invalid_arguments<AN...>> {
- using type = observable<sequence_equal_invalid_arguments<AN...>, sequence_equal_invalid<AN...>>;
-};
-template<class... AN>
-using sequence_equal_invalid_t = typename sequence_equal_invalid<AN...>::type;
-
-template<class T, class Observable, class OtherObservable, class BinaryPredicate, class Coordination>
-struct sequence_equal : public operator_base<bool>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<OtherObservable> other_source_type;
- typedef typename other_source_type::value_type other_source_value_type;
- typedef rxu::decay_t<BinaryPredicate> predicate_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values {
- values(source_type s, other_source_type t, predicate_type pred, coordination_type sf)
- : source(std::move(s))
- , other(std::move(t))
- , pred(std::move(pred))
- , coordination(std::move(sf))
- {
- }
-
- source_type source;
- other_source_type other;
- predicate_type pred;
- coordination_type coordination;
- };
-
- values initial;
-
- sequence_equal(source_type s, other_source_type t, predicate_type pred, coordination_type sf)
- : initial(std::move(s), std::move(t), std::move(pred), std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber s) const {
-
- typedef Subscriber output_type;
-
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& vals, coordinator_type coor, const output_type& o)
- : values(vals)
- , coordinator(std::move(coor))
- , out(o)
- , source_completed(false)
- , other_completed(false)
- {
- out.add(other_lifetime);
- out.add(source_lifetime);
- }
-
- composite_subscription other_lifetime;
- composite_subscription source_lifetime;
- coordinator_type coordinator;
- output_type out;
-
- mutable std::list<source_value_type> source_values;
- mutable std::list<other_source_value_type> other_values;
- mutable bool source_completed;
- mutable bool other_completed;
- };
-
- auto coordinator = initial.coordination.create_coordinator();
- auto state = std::make_shared<state_type>(initial, std::move(coordinator), std::move(s));
-
- auto other = on_exception(
- [&](){ return state->coordinator.in(state->other); },
- state->out);
- if (other.empty()) {
- return;
- }
-
- auto source = on_exception(
- [&](){ return state->coordinator.in(state->source); },
- state->out);
- if (source.empty()) {
- return;
- }
-
- auto check_equal = [state]() {
- if(!state->source_values.empty() && !state->other_values.empty()) {
- auto x = std::move(state->source_values.front());
- state->source_values.pop_front();
-
- auto y = std::move(state->other_values.front());
- state->other_values.pop_front();
-
- if (!state->pred(x, y)) {
- state->out.on_next(false);
- state->out.on_completed();
- }
- } else {
- if((!state->source_values.empty() && state->other_completed) ||
- (!state->other_values.empty() && state->source_completed)) {
- state->out.on_next(false);
- state->out.on_completed();
- }
- }
- };
-
- auto check_complete = [state]() {
- if(state->source_completed && state->other_completed) {
- state->out.on_next(state->source_values.empty() && state->other_values.empty());
- state->out.on_completed();
- }
- };
-
- auto sinkOther = make_subscriber<other_source_value_type>(
- state->out,
- state->other_lifetime,
- // on_next
- [state, check_equal](other_source_value_type t) {
- auto& values = state->other_values;
- values.push_back(t);
- check_equal();
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state, check_complete]() {
- auto& completed = state->other_completed;
- completed = true;
- check_complete();
- }
- );
-
- auto selectedSinkOther = on_exception(
- [&](){ return state->coordinator.out(sinkOther); },
- state->out);
- if (selectedSinkOther.empty()) {
- return;
- }
- other->subscribe(std::move(selectedSinkOther.get()));
-
- source.get().subscribe(
- state->source_lifetime,
- // on_next
- [state, check_equal](source_value_type t) {
- auto& values = state->source_values;
- values.push_back(t);
- check_equal();
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state, check_complete]() {
- auto& completed = state->source_completed;
- completed = true;
- check_complete();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-sequence_equal.hpp
-*/
-template<class... AN>
-auto sequence_equal(AN&&... an)
- -> operator_factory<sequence_equal_tag, AN...> {
- return operator_factory<sequence_equal_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<sequence_equal_tag>
-{
- template<class Observable, class OtherObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_observable<OtherObservable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SequenceEqual = rxo::detail::sequence_equal<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<OtherObservable>, rxu::equal_to<>, identity_one_worker>,
- class Value = rxu::value_type_t<SequenceEqual>,
- class Result = observable<Value, SequenceEqual>>
- static Result member(Observable&& o, OtherObservable&& t) {
- return Result(SequenceEqual(std::forward<Observable>(o), std::forward<OtherObservable>(t), rxu::equal_to<>(), identity_current_thread()));
- }
-
- template<class Observable, class OtherObservable, class BinaryPredicate,
- class IsCoordination = is_coordination<BinaryPredicate>,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_observable<OtherObservable>,
- rxu::negation<IsCoordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SequenceEqual = rxo::detail::sequence_equal<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<OtherObservable>, rxu::decay_t<BinaryPredicate>, identity_one_worker>,
- class Value = rxu::value_type_t<SequenceEqual>,
- class Result = observable<Value, SequenceEqual>>
- static Result member(Observable&& o, OtherObservable&& t, BinaryPredicate&& pred) {
- return Result(SequenceEqual(std::forward<Observable>(o), std::forward<OtherObservable>(t), std::forward<BinaryPredicate>(pred), identity_current_thread()));
- }
-
- template<class Observable, class OtherObservable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_observable<OtherObservable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SequenceEqual = rxo::detail::sequence_equal<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<OtherObservable>, rxu::equal_to<>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SequenceEqual>,
- class Result = observable<Value, SequenceEqual>>
- static Result member(Observable&& o, OtherObservable&& t, Coordination&& cn) {
- return Result(SequenceEqual(std::forward<Observable>(o), std::forward<OtherObservable>(t), rxu::equal_to<>(), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class OtherObservable, class BinaryPredicate, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_observable<OtherObservable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SequenceEqual = rxo::detail::sequence_equal<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<OtherObservable>, rxu::decay_t<BinaryPredicate>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SequenceEqual>,
- class Result = observable<Value, SequenceEqual>>
- static Result member(Observable&& o, OtherObservable&& t, BinaryPredicate&& pred, Coordination&& cn) {
- return Result(SequenceEqual(std::forward<Observable>(o), std::forward<OtherObservable>(t), std::forward<BinaryPredicate>(pred), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::sequence_equal_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "sequence_equal takes (OtherObservable, optional BinaryPredicate, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp
deleted file mode 100644
index b77c4da..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-skip.hpp
-
- \brief Make new observable with skipped first count items from this observable.
-
- \tparam Count the type of the items counter
-
- \param t the number of items to skip
-
- \return An observable that is identical to the source observable except that it does not emit the first t items that the source observable emits.
-
- \sample
- \snippet skip.cpp skip sample
- \snippet output.txt skip sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SKIP_HPP)
-#define RXCPP_OPERATORS_RX_SKIP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct skip_invalid_arguments {};
-
-template<class... AN>
-struct skip_invalid : public rxo::operator_base<skip_invalid_arguments<AN...>> {
- using type = observable<skip_invalid_arguments<AN...>, skip_invalid<AN...>>;
-};
-
-template<class... AN>
-using skip_invalid_t = typename skip_invalid<AN...>::type;
-
-template<class T, class Observable, class Count>
-struct skip : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Count> count_type;
- struct values
- {
- values(source_type s, count_type t)
- : source(std::move(s))
- , count(std::move(t))
- {
- }
- source_type source;
- count_type count;
- };
- values initial;
-
- skip(source_type s, count_type t)
- : initial(std::move(s), std::move(t))
- {
- }
-
- struct mode
- {
- enum type {
- skipping, // ignore messages
- triggered, // capture messages
- errored, // error occured
- stopped // observable completed
- };
- };
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
-
- typedef Subscriber output_type;
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& i, const output_type& oarg)
- : values(i)
- , mode_value(i.count > 0 ? mode::skipping : mode::triggered)
- , out(oarg)
- {
- }
- typename mode::type mode_value;
- output_type out;
- };
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, s);
-
- composite_subscription source_lifetime;
-
- s.add(source_lifetime);
-
- state->source.subscribe(
- // split subscription lifetime
- source_lifetime,
- // on_next
- [state](T t) {
- if (state->mode_value == mode::skipping) {
- if (--state->count == 0) {
- state->mode_value = mode::triggered;
- }
- } else {
- state->out.on_next(t);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- state->mode_value = mode::stopped;
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-skip.hpp
-*/
-template<class... AN>
-auto skip(AN&&... an)
--> operator_factory<skip_tag, AN...> {
- return operator_factory<skip_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<skip_tag>
-{
- template<class Observable,
- class Count,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Skip = rxo::detail::skip<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<Skip>,
- class Result = observable<Value, Skip>>
- static Result member(Observable&& o, Count&& c) {
- return Result(Skip(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::skip_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "skip takes (optional Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp
deleted file mode 100644
index 9594715..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-skip_last.hpp
-
- \brief Make new observable with skipped last count items from this observable.
-
- \tparam Count the type of the items counter.
-
- \param t the number of last items to skip.
-
- \return An observable that is identical to the source observable except that it does not emit the last t items that the source observable emits.
-
- \sample
- \snippet skip_last.cpp skip_last sample
- \snippet output.txt skip_last sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SKIP_LAST_HPP)
-#define RXCPP_OPERATORS_RX_SKIP_LAST_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct skip_last_invalid_arguments {};
-
-template<class... AN>
-struct skip_last_invalid : public rxo::operator_base<skip_last_invalid_arguments<AN...>> {
- using type = observable<skip_last_invalid_arguments<AN...>, skip_last_invalid<AN...>>;
-};
-template<class... AN>
-using skip_last_invalid_t = typename skip_last_invalid<AN...>::type;
-
-template<class T, class Observable, class Count>
-struct skip_last : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Count> count_type;
-
- typedef std::queue<T> queue_type;
- typedef typename queue_type::size_type queue_size_type;
-
- struct values
- {
- values(source_type s, count_type t)
- : source(std::move(s))
- , count(static_cast<queue_size_type>(t))
- {
- }
- source_type source;
- queue_size_type count;
- };
- values initial;
-
- skip_last(source_type s, count_type t)
- : initial(std::move(s), std::move(t))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
-
- typedef Subscriber output_type;
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& i, const output_type& oarg)
- : values(i)
- , out(oarg)
- {
- }
- queue_type items;
- output_type out;
- };
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, s);
-
- composite_subscription source_lifetime;
-
- s.add(source_lifetime);
-
- state->source.subscribe(
- // split subscription lifetime
- source_lifetime,
- // on_next
- [state](T t) {
- if(state->count > 0) {
- if (state->items.size() == state->count) {
- state->out.on_next(std::move(state->items.front()));
- state->items.pop();
- }
- state->items.push(t);
- } else {
- state->out.on_next(t);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-skip_last.hpp
-*/
-template<class... AN>
-auto skip_last(AN&&... an)
- -> operator_factory<skip_last_tag, AN...> {
- return operator_factory<skip_last_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<skip_last_tag>
-{
- template<class Observable, class Count,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SkipLast = rxo::detail::skip_last<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<SkipLast>,
- class Result = observable<Value, SkipLast>>
- static Result member(Observable&& o, Count&& c) {
- return Result(SkipLast(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::skip_last_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "skip_last takes (Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp
deleted file mode 100644
index 4df6671..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-skip_until.hpp
-
- \brief Make new observable with items skipped until on_next occurs on the trigger observable or until the specified time.
- skip_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination)
-
- \tparam TriggerSource the type of the trigger observable.
- \tparam Coordination the type of the scheduler (optional).
-
- \param t an observable that has to emit an item before the source observable's elements begin to be mirrored by the resulting observable.
- \param cn the scheduler to use for scheduling the items (optional).
-
- \return An observable that skips items from the source observable until the second observable emits an item or the time runs out, then emits the remaining items.
-
- \sample
- \snippet skip_until.cpp skip_until sample
- \snippet output.txt skip_until sample
-
- \sample
- \snippet skip_until.cpp threaded skip_until sample
- \snippet output.txt threaded skip_until sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP)
-#define RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct skip_until_invalid_arguments {};
-
-template<class... AN>
-struct skip_until_invalid : public rxo::operator_base<skip_until_invalid_arguments<AN...>> {
- using type = observable<skip_until_invalid_arguments<AN...>, skip_until_invalid<AN...>>;
-};
-template<class... AN>
-using skip_until_invalid_t = typename skip_until_invalid<AN...>::type;
-
-template<class T, class Observable, class TriggerObservable, class Coordination>
-struct skip_until : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<TriggerObservable> trigger_source_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- struct values
- {
- values(source_type s, trigger_source_type t, coordination_type sf)
- : source(std::move(s))
- , trigger(std::move(t))
- , coordination(std::move(sf))
- {
- }
- source_type source;
- trigger_source_type trigger;
- coordination_type coordination;
- };
- values initial;
-
- skip_until(source_type s, trigger_source_type t, coordination_type sf)
- : initial(std::move(s), std::move(t), std::move(sf))
- {
- }
-
- struct mode
- {
- enum type {
- skipping, // no messages from trigger
- clear, // trigger completed
- triggered, // trigger sent on_next
- errored, // error either on trigger or on observable
- stopped // observable completed
- };
- };
-
- template<class Subscriber>
- void on_subscribe(Subscriber s) const {
-
- typedef Subscriber output_type;
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& i, coordinator_type coor, const output_type& oarg)
- : values(i)
- , mode_value(mode::skipping)
- , coordinator(std::move(coor))
- , out(oarg)
- {
- out.add(trigger_lifetime);
- out.add(source_lifetime);
- }
- typename mode::type mode_value;
- composite_subscription trigger_lifetime;
- composite_subscription source_lifetime;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator();
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, std::move(coordinator), std::move(s));
-
- auto trigger = on_exception(
- [&](){return state->coordinator.in(state->trigger);},
- state->out);
- if (trigger.empty()) {
- return;
- }
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- auto sinkTrigger = make_subscriber<typename trigger_source_type::value_type>(
- // share parts of subscription
- state->out,
- // new lifetime
- state->trigger_lifetime,
- // on_next
- [state](const typename trigger_source_type::value_type&) {
- if (state->mode_value != mode::skipping) {
- return;
- }
- state->mode_value = mode::triggered;
- state->trigger_lifetime.unsubscribe();
- },
- // on_error
- [state](rxu::error_ptr e) {
- if (state->mode_value != mode::skipping) {
- return;
- }
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (state->mode_value != mode::skipping) {
- return;
- }
- state->mode_value = mode::clear;
- state->trigger_lifetime.unsubscribe();
- }
- );
- auto selectedSinkTrigger = on_exception(
- [&](){return state->coordinator.out(sinkTrigger);},
- state->out);
- if (selectedSinkTrigger.empty()) {
- return;
- }
- trigger->subscribe(std::move(selectedSinkTrigger.get()));
-
- source.get().subscribe(
- // split subscription lifetime
- state->source_lifetime,
- // on_next
- [state](T t) {
- if (state->mode_value != mode::triggered) {
- return;
- }
- state->out.on_next(t);
- },
- // on_error
- [state](rxu::error_ptr e) {
- if (state->mode_value > mode::triggered) {
- return;
- }
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (state->mode_value != mode::triggered) {
- return;
- }
- state->mode_value = mode::stopped;
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-skip_until.hpp
-*/
-template<class... AN>
-auto skip_until(AN&&... an)
- -> operator_factory<skip_until_tag, AN...> {
- return operator_factory<skip_until_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<skip_until_tag>
-{
- template<class Observable, class TimePoint,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<TimePoint, rxsc::scheduler::clock_type::time_point>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timer = typename rxu::defer_type<rxs::detail::timer, identity_one_worker>::type,
- class TimerValue = rxu::value_type_t<Timer>,
- class TriggerObservable = observable<TimerValue, Timer>,
- class SkipUntil = rxo::detail::skip_until<SourceValue, rxu::decay_t<Observable>, TriggerObservable, identity_one_worker>,
- class Value = rxu::value_type_t<SkipUntil>,
- class Result = observable<Value, SkipUntil>>
- static Result member(Observable&& o, TimePoint&& when) {
- auto cn = identity_current_thread();
- return Result(SkipUntil(std::forward<Observable>(o), rxs::timer(std::forward<TimePoint>(when), cn), cn));
- }
-
- template<class Observable, class TimePoint, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- std::is_convertible<TimePoint, rxsc::scheduler::clock_type::time_point>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timer = typename rxu::defer_type<rxs::detail::timer, rxu::decay_t<Coordination>>::type,
- class TimerValue = rxu::value_type_t<Timer>,
- class TriggerObservable = observable<TimerValue, Timer>,
- class SkipUntil = rxo::detail::skip_until<SourceValue, rxu::decay_t<Observable>, TriggerObservable, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SkipUntil>,
- class Result = observable<Value, SkipUntil>>
- static Result member(Observable&& o, TimePoint&& when, Coordination cn) {
- return Result(SkipUntil(std::forward<Observable>(o), rxs::timer(std::forward<TimePoint>(when), cn), cn));
- }
-
- template<class Observable, class TriggerObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, TriggerObservable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SkipUntil = rxo::detail::skip_until<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<TriggerObservable>, identity_one_worker>,
- class Value = rxu::value_type_t<SkipUntil>,
- class Result = observable<Value, SkipUntil>>
- static Result member(Observable&& o, TriggerObservable&& t) {
- return Result(SkipUntil(std::forward<Observable>(o), std::forward<TriggerObservable>(t), identity_current_thread()));
- }
-
- template<class Observable, class TriggerObservable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, TriggerObservable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SkipUntil = rxo::detail::skip_until<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<TriggerObservable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SkipUntil>,
- class Result = observable<Value, SkipUntil>>
- static Result member(Observable&& o, TriggerObservable&& t, Coordination&& cn) {
- return Result(SkipUntil(std::forward<Observable>(o), std::forward<TriggerObservable>(t), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::skip_until_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "skip_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp
deleted file mode 100644
index 643d867..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-skip_while.hpp
-
- \brief Discards the first items fulfilling the predicate from this observable emit them from the new observable that is returned.
-
- \tparam Predicate the type of the predicate
-
- \param t the predicate
-
- \return An observable that discards the first items until condition emitted by the source Observable is not fulfilling the predicate, or all of the items from the source observable if the predicate never returns false
-
- \sample
- \snippet skip_while.cpp skip_while sample
- \snippet output.txt skip_while sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SKIP_WHILE_HPP)
-#define RXCPP_OPERATORS_RX_SKIP_WHILE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct skip_while_invalid_arguments {};
-
-template<class... AN>
-struct skip_while_invalid : public rxo::operator_base<skip_while_invalid_arguments<AN...>> {
- using type = observable<skip_while_invalid_arguments<AN...>, skip_while_invalid<AN...>>;
-};
-template<class... AN>
-using skip_while_invalid_t = typename skip_while_invalid<AN...>::type;
-
-template<class T, class Predicate>
-struct skip_while
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Predicate> test_type;
- test_type test;
-
-
- skip_while(test_type t)
- : test(std::move(t))
- {
- }
-
- template<class Subscriber>
- struct skip_while_observer
- {
- typedef skip_while_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- test_type test;
- bool pass;
-
- skip_while_observer(dest_type d, test_type t)
- : dest(std::move(d))
- , test(std::move(t)),
- pass(false)
- {
- }
- void on_next(source_value_type v) {
- if(pass || !test(v))
- {
- pass = true;
- dest.on_next(v);
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
- return make_subscriber<value_type>(d, this_type(d, std::move(t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(skip_while_observer<Subscriber>::make(std::move(dest), test)) {
- return skip_while_observer<Subscriber>::make(std::move(dest), test);
- }
-};
-
-}
-
-/*! @copydoc rx-skip_while.hpp
-*/
-template<class... AN>
-auto skip_while(AN&&... an)
- -> operator_factory<skip_while_tag, AN...> {
- return operator_factory<skip_while_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
- }
-
-}
-
-template<>
-struct member_overload<skip_while_tag>
-{
- template<class Observable, class Predicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class TakeWhile = rxo::detail::skip_while<SourceValue, rxu::decay_t<Predicate>>>
- static auto member(Observable&& o, Predicate&& p)
- -> decltype(o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)))) {
- return o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)));
- }
-
- template<class... AN>
- static operators::detail::skip_while_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "skip_while takes (Predicate)");
- }
-};
-
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-start_with.hpp b/Rx/v2/src/rxcpp/operators/rx-start_with.hpp
deleted file mode 100644
index 4203631..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-start_with.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-start_with.hpp
-
- \brief Start with the supplied values, then concatenate this observable.
-
- \tparam Value0 ...
- \tparam ValueN the type of sending values
-
- \param v0 ...
- \param vn values to send
-
- \return Observable that emits the specified items and then emits the items emitted by the source observable.
-
- \sample
- \snippet start_with.cpp short start_with sample
- \snippet output.txt short start_with sample
-
- Another form of this operator, rxcpp::observable<void, void>::start_with, gets the source observable as a parameter:
- \snippet start_with.cpp full start_with sample
- \snippet output.txt full start_with sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_START_WITH_HPP)
-#define RXCPP_OPERATORS_RX_START_WITH_HPP
-
-#include "../rx-includes.hpp"
-#include "./rx-concat.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct start_with_invalid_arguments {};
-
-template<class... AN>
-struct start_with_invalid : public rxo::operator_base<start_with_invalid_arguments<AN...>> {
- using type = observable<start_with_invalid_arguments<AN...>, start_with_invalid<AN...>>;
-};
-template<class... AN>
-using start_with_invalid_t = typename start_with_invalid<AN...>::type;
-
-}
-
-/*! @copydoc rx-start_with.hpp
-*/
-template<class... AN>
-auto start_with(AN&&... an)
- -> operator_factory<start_with_tag, AN...> {
- return operator_factory<start_with_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<start_with_tag>
-{
- template<class Observable, class Value0, class... ValueN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class From = decltype(rxs::from(rxu::decay_t<Value0>(std::declval<Value0>()), rxu::decay_t<ValueN>(std::declval<ValueN>())...))
- >
- static auto member(Observable&& o, Value0&& v0, ValueN&&... vn)
- -> decltype(member_overload<concat_tag>::member(std::declval<From>(), std::forward<Observable>(o))) {
- auto first = rxs::from(rxu::decay_t<Value0>(v0), rxu::decay_t<ValueN>(vn)...);
- return member_overload<concat_tag>::member(first, std::forward<Observable>(o));
- }
-
- template<class... AN>
- static operators::detail::start_with_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "start_with takes (Value0, optional ValueN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp
deleted file mode 100644
index c3e3917..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-subscribe.hpp
-
- \brief Subscribe will cause the source observable to emit values to the provided subscriber.
-
- \tparam ArgN types of the subscriber parameters
-
- \param an the parameters for making a subscriber
-
- \return A subscription with which the observer can stop receiving items before the observable has finished sending them.
-
- The arguments of subscribe are forwarded to rxcpp::make_subscriber function. Some possible alternatives are:
-
- - Pass an already composed rxcpp::subscriber:
- \snippet subscribe.cpp subscribe by subscriber
- \snippet output.txt subscribe by subscriber
-
- - Pass an rxcpp::observer. This allows subscribing the same subscriber to several observables:
- \snippet subscribe.cpp subscribe by observer
- \snippet output.txt subscribe by observer
-
- - Pass an `on_next` handler:
- \snippet subscribe.cpp subscribe by on_next
- \snippet output.txt subscribe by on_next
-
- - Pass `on_next` and `on_error` handlers:
- \snippet subscribe.cpp subscribe by on_next and on_error
- \snippet output.txt subscribe by on_next and on_error
-
- - Pass `on_next` and `on_completed` handlers:
- \snippet subscribe.cpp subscribe by on_next and on_completed
- \snippet output.txt subscribe by on_next and on_completed
-
- - Pass `on_next`, `on_error`, and `on_completed` handlers:
- \snippet subscribe.cpp subscribe by on_next, on_error, and on_completed
- \snippet output.txt subscribe by on_next, on_error, and on_completed
- .
-
- All the alternatives above also support passing rxcpp::composite_subscription instance. For example:
- \snippet subscribe.cpp subscribe by subscription, on_next, and on_completed
- \snippet output.txt subscribe by subscription, on_next, and on_completed
-
- If neither subscription nor subscriber are provided, then a new subscription is created and returned as a result:
- \snippet subscribe.cpp subscribe unsubscribe
- \snippet output.txt subscribe unsubscribe
-
- For more details, see rxcpp::make_subscriber function description.
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SUBSCRIBE_HPP)
-#define RXCPP_OPERATORS_RX_SUBSCRIBE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class Subscriber>
-class subscribe_factory;
-
-template<class T, class I>
-class subscribe_factory<subscriber<T, I>>
-{
- subscriber<T, I> scrbr;
-public:
- subscribe_factory(subscriber<T, I> s)
- : scrbr(std::move(s))
- {}
- template<class Observable>
- auto operator()(Observable&& source)
- -> decltype(std::forward<Observable>(source).subscribe(std::move(scrbr))) {
- return std::forward<Observable>(source).subscribe(std::move(scrbr));
- }
-};
-
-}
-
-/*! @copydoc rx-subscribe.hpp
-*/
-template<class T, class... ArgN>
-auto subscribe(ArgN&&... an)
- -> detail::subscribe_factory<decltype (make_subscriber<T>(std::forward<ArgN>(an)...))> {
- return detail::subscribe_factory<decltype (make_subscriber<T>(std::forward<ArgN>(an)...))>
- (make_subscriber<T>(std::forward<ArgN>(an)...));
-}
-
-namespace detail {
-
-class dynamic_factory
-{
-public:
- template<class Observable>
- auto operator()(Observable&& source)
- -> observable<rxu::value_type_t<rxu::decay_t<Observable>>> {
- return observable<rxu::value_type_t<rxu::decay_t<Observable>>>(std::forward<Observable>(source));
- }
-};
-
-}
-
-/*! Return a new observable that performs type-forgetting conversion of this observable.
-
- \return The source observable converted to observable<T>.
-
- \note This operator could be useful to workaround lambda deduction bug on msvc 2013.
-
- \sample
- \snippet as_dynamic.cpp as_dynamic sample
- \snippet output.txt as_dynamic sample
-*/
-inline auto as_dynamic()
- -> detail::dynamic_factory {
- return detail::dynamic_factory();
-}
-
-namespace detail {
-
-class blocking_factory
-{
-public:
- template<class Observable>
- auto operator()(Observable&& source)
- -> decltype(std::forward<Observable>(source).as_blocking()) {
- return std::forward<Observable>(source).as_blocking();
- }
-};
-
-}
-
-/*! Return a new observable that contains the blocking methods for this observable.
-
- \return An observable that contains the blocking methods for this observable.
-
- \sample
- \snippet from.cpp threaded from sample
- \snippet output.txt threaded from sample
-*/
-inline auto as_blocking()
- -> detail::blocking_factory {
- return detail::blocking_factory();
-}
-
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp
deleted file mode 100644
index f026b59..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-subscribe_on.hpp
-
- \brief Subscription and unsubscription are queued and delivered using the scheduler from the supplied coordination.
-
- \tparam Coordination the type of the scheduler.
-
- \param cn the scheduler to perform subscription actions on.
-
- \return The source observable modified so that its subscriptions happen on the specified scheduler.
-
- \sample
- \snippet subscribe_on.cpp subscribe_on sample
- \snippet output.txt subscribe_on sample
-
- Invoking rxcpp::observable::observe_on operator, instead of subscribe_on, gives following results:
- \snippet output.txt observe_on sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SUBSCRIBE_ON_HPP)
-#define RXCPP_OPERATORS_RX_SUBSCRIBE_ON_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct subscribe_on_invalid_arguments {};
-
-template<class... AN>
-struct subscribe_on_invalid : public rxo::operator_base<subscribe_on_invalid_arguments<AN...>> {
- using type = observable<subscribe_on_invalid_arguments<AN...>, subscribe_on_invalid<AN...>>;
-};
-template<class... AN>
-using subscribe_on_invalid_t = typename subscribe_on_invalid<AN...>::type;
-
-template<class T, class Observable, class Coordination>
-struct subscribe_on : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- struct subscribe_on_values
- {
- ~subscribe_on_values()
- {
- }
- subscribe_on_values(source_type s, coordination_type sf)
- : source(std::move(s))
- , coordination(std::move(sf))
- {
- }
- source_type source;
- coordination_type coordination;
- private:
- subscribe_on_values& operator=(subscribe_on_values o) RXCPP_DELETE;
- };
- const subscribe_on_values initial;
-
- ~subscribe_on()
- {
- }
- subscribe_on(source_type s, coordination_type sf)
- : initial(std::move(s), std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber s) const {
-
- typedef Subscriber output_type;
- struct subscribe_on_state_type
- : public std::enable_shared_from_this<subscribe_on_state_type>
- , public subscribe_on_values
- {
- subscribe_on_state_type(const subscribe_on_values& i, const output_type& oarg)
- : subscribe_on_values(i)
- , out(oarg)
- {
- }
- composite_subscription source_lifetime;
- output_type out;
- private:
- subscribe_on_state_type& operator=(subscribe_on_state_type o) RXCPP_DELETE;
- };
-
- composite_subscription coordinator_lifetime;
-
- auto coordinator = initial.coordination.create_coordinator(coordinator_lifetime);
-
- auto controller = coordinator.get_worker();
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<subscribe_on_state_type>(initial, std::move(s));
-
- auto sl = state->source_lifetime;
- auto ol = state->out.get_subscription();
-
- auto disposer = [=](const rxsc::schedulable&){
- sl.unsubscribe();
- ol.unsubscribe();
- coordinator_lifetime.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return coordinator.act(disposer);},
- state->out);
- if (selectedDisposer.empty()) {
- return;
- }
-
- state->source_lifetime.add([=](){
- controller.schedule(selectedDisposer.get());
- });
-
- state->out.add([=](){
- sl.unsubscribe();
- ol.unsubscribe();
- coordinator_lifetime.unsubscribe();
- });
-
- auto producer = [=](const rxsc::schedulable&){
- state->source.subscribe(state->source_lifetime, state->out);
- };
-
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- state->out);
- if (selectedProducer.empty()) {
- return;
- }
-
- controller.schedule(selectedProducer.get());
- }
-private:
- subscribe_on& operator=(subscribe_on o) RXCPP_DELETE;
-};
-
-}
-
-/*! @copydoc rx-subscribe_on.hpp
-*/
-template<class... AN>
-auto subscribe_on(AN&&... an)
- -> operator_factory<subscribe_on_tag, AN...> {
- return operator_factory<subscribe_on_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<subscribe_on_tag>
-{
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SubscribeOn = rxo::detail::subscribe_on<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SubscribeOn>,
- class Result = observable<Value, SubscribeOn>>
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(SubscribeOn(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::subscribe_on_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "subscribe_on takes (Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp
deleted file mode 100644
index 8d3e57e..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-switch_if_empty.hpp
-
- \brief If the source Observable terminates without emitting any items, emits items from a backup Observable.
-
- \tparam BackupSource the type of the backup observable.
-
- \param t a backup observable that is used if the source observable is empty.
-
- \return Observable that emits items from a backup observable if the source observable is empty.
-
- \sample
- \snippet switch_if_empty.cpp switch_if_empty sample
- \snippet output.txt switch_if_empty sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SWITCH_IF_EMPTY_HPP)
-#define RXCPP_OPERATORS_RX_SWITCH_IF_EMPTY_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct switch_if_empty_invalid_arguments {};
-
-template<class... AN>
-struct switch_if_empty_invalid : public rxo::operator_base<switch_if_empty_invalid_arguments<AN...>> {
- using type = observable<switch_if_empty_invalid_arguments<AN...>, switch_if_empty_invalid<AN...>>;
-};
-template<class... AN>
-using switch_if_empty_invalid_t = typename switch_if_empty_invalid<AN...>::type;
-
-template<class T, class BackupSource>
-struct switch_if_empty
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<BackupSource> backup_source_type;
-
- backup_source_type backup;
-
- switch_if_empty(backup_source_type b)
- : backup(std::move(b))
- {
- }
-
- template<class Subscriber>
- struct switch_if_empty_observer
- {
- typedef switch_if_empty_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
-
- dest_type dest;
- composite_subscription lifetime;
- backup_source_type backup;
- mutable bool is_empty;
-
- switch_if_empty_observer(dest_type d, composite_subscription cs, backup_source_type b)
- : dest(std::move(d))
- , lifetime(std::move(cs))
- , backup(std::move(b))
- , is_empty(true)
- {
- dest.add(lifetime);
- }
- void on_next(source_value_type v) const {
- is_empty = false;
- dest.on_next(std::move(v));
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(std::move(e));
- }
- void on_completed() const {
- if(!is_empty) {
- dest.on_completed();
- } else {
- backup.subscribe(dest);
- }
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, backup_source_type b) {
- auto cs = composite_subscription();
- return make_subscriber<value_type>(cs, observer_type(this_type(std::move(d), cs, std::move(b))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(switch_if_empty_observer<Subscriber>::make(std::move(dest), std::move(backup))) {
- return switch_if_empty_observer<Subscriber>::make(std::move(dest), std::move(backup));
- }
-};
-
-}
-
-/*! @copydoc rx-switch_if_empty.hpp
-*/
-template<class... AN>
-auto switch_if_empty(AN&&... an)
- -> operator_factory<switch_if_empty_tag, AN...> {
- return operator_factory<switch_if_empty_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-/*! \brief If the source Observable terminates without emitting any items, emits a default item and completes.
-
- \tparam Value the type of the value to emit.
-
- \param v the default value to emit.
-
- \return Observable that emits the specified default item if the source observable is empty.
-
- \sample
- \snippet default_if_empty.cpp default_if_empty sample
- \snippet output.txt default_if_empty sample
-*/
-template<class... AN>
-auto default_if_empty(AN&&... an)
- -> operator_factory<default_if_empty_tag, AN...> {
- return operator_factory<default_if_empty_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<switch_if_empty_tag>
-{
- template<class Observable, class BackupSource,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, BackupSource>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SwitchIfEmpty = rxo::detail::switch_if_empty<SourceValue, rxu::decay_t<BackupSource>>>
- static auto member(Observable&& o, BackupSource&& b)
- -> decltype(o.template lift<SourceValue>(SwitchIfEmpty(std::forward<BackupSource>(b)))) {
- return o.template lift<SourceValue>(SwitchIfEmpty(std::forward<BackupSource>(b)));
- }
-
- template<class... AN>
- static operators::detail::switch_if_empty_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "switch_if_empty takes (BackupSource)");
- }
-};
-
-template<>
-struct member_overload<default_if_empty_tag>
-{
- template<class Observable, class Value,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class BackupSource = decltype(rxs::from(std::declval<SourceValue>())),
- class DefaultIfEmpty = rxo::detail::switch_if_empty<SourceValue, BackupSource>>
- static auto member(Observable&& o, Value v)
- -> decltype(o.template lift<SourceValue>(DefaultIfEmpty(rxs::from(std::move(v))))) {
- return o.template lift<SourceValue>(DefaultIfEmpty(rxs::from(std::move(v))));
- }
-
- template<class... AN>
- static operators::detail::switch_if_empty_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "default_if_empty takes (Value)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp
deleted file mode 100644
index 4572121..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-switch_on_next.hpp
-
- \brief Return observable that emits the items emitted by the observable most recently emitted by the source observable.
-
- \tparam Coordination the type of the scheduler (optional).
-
- \param cn the scheduler to synchronize sources from different contexts (optional).
-
- \return Observable that emits the items emitted by the observable most recently emitted by the source observable.
-
- \sample
- \snippet switch_on_next.cpp switch_on_next sample
- \snippet output.txt switch_on_next sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_SWITCH_ON_NEXT_HPP)
-#define RXCPP_OPERATORS_RX_SWITCH_ON_NEXT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct switch_on_next_invalid_arguments {};
-
-template<class... AN>
-struct switch_on_next_invalid : public rxo::operator_base<switch_on_next_invalid_arguments<AN...>> {
- using type = observable<switch_on_next_invalid_arguments<AN...>, switch_on_next_invalid<AN...>>;
-};
-template<class... AN>
-using switch_on_next_invalid_t = typename switch_on_next_invalid<AN...>::type;
-
-template<class T, class Observable, class Coordination>
-struct switch_on_next
- : public operator_base<rxu::value_type_t<rxu::decay_t<T>>>
-{
- //static_assert(is_observable<Observable>::value, "switch_on_next requires an observable");
- //static_assert(is_observable<T>::value, "switch_on_next requires an observable that contains observables");
-
- typedef switch_on_next<T, Observable, Coordination> this_type;
-
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Observable> source_type;
-
- typedef typename source_type::source_operator_type source_operator_type;
-
- typedef source_value_type collection_type;
- typedef typename collection_type::value_type collection_value_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(source_operator_type o, coordination_type sf)
- : source_operator(std::move(o))
- , coordination(std::move(sf))
- {
- }
- source_operator_type source_operator;
- coordination_type coordination;
- };
- values initial;
-
- switch_on_next(const source_type& o, coordination_type sf)
- : initial(o.source_operator, std::move(sf))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct switch_state_type
- : public std::enable_shared_from_this<switch_state_type>
- , public values
- {
- switch_state_type(values i, coordinator_type coor, output_type oarg)
- : values(i)
- , source(i.source_operator)
- , pendingCompletions(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
- observable<source_value_type, source_operator_type> source;
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- int pendingCompletions;
- coordinator_type coordinator;
- composite_subscription inner_lifetime;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<switch_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- composite_subscription outercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(outercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- ++state->pendingCompletions;
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<collection_type>(
- state->out,
- outercs,
- // on_next
- [state](collection_type st) {
-
- state->inner_lifetime.unsubscribe();
-
- state->inner_lifetime = composite_subscription();
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innerlifetimetoken = state->out.add(state->inner_lifetime);
-
- state->inner_lifetime.add(make_subscription([state, innerlifetimetoken](){
- state->out.remove(innerlifetimetoken);
- --state->pendingCompletions;
- }));
-
- auto selectedSource = state->coordinator.in(st);
-
- // this subscribe does not share the source subscription
- // so that when it is unsubscribed the source will continue
- auto sinkInner = make_subscriber<collection_value_type>(
- state->out,
- state->inner_lifetime,
- // on_next
- [state, st](collection_value_type ct) {
- state->out.on_next(std::move(ct));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- //on_completed
- [state](){
- if (state->pendingCompletions == 1) {
- state->out.on_completed();
- }
- }
- );
-
- auto selectedSinkInner = state->coordinator.out(sinkInner);
- ++state->pendingCompletions;
- selectedSource.subscribe(std::move(selectedSinkInner));
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
-
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
-
- source->subscribe(std::move(selectedSink.get()));
-
- }
-};
-
-}
-
-/*! @copydoc rx-switch_on_next.hpp
-*/
-template<class... AN>
-auto switch_on_next(AN&&... an)
- -> operator_factory<switch_on_next_tag, AN...> {
- return operator_factory<switch_on_next_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<switch_on_next_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SwitchOnNext = rxo::detail::switch_on_next<SourceValue, rxu::decay_t<Observable>, identity_one_worker>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, SwitchOnNext>
- >
- static Result member(Observable&& o) {
- return Result(SwitchOnNext(std::forward<Observable>(o), identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class SwitchOnNext = rxo::detail::switch_on_next<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<SourceValue>,
- class Result = observable<Value, SwitchOnNext>
- >
- static Result member(Observable&& o, Coordination&& cn) {
- return Result(SwitchOnNext(std::forward<Observable>(o), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::switch_on_next_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "switch_on_next takes (optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp
deleted file mode 100644
index 1e4da4d..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-take.hpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-take.hpp
-
- \brief For the first count items from this observable emit them from the new observable that is returned.
-
- \tparam Count the type of the items counter.
-
- \param t the number of items to take.
-
- \return An observable that emits only the first t items emitted by the source Observable, or all of the items from the source observable if that observable emits fewer than t items.
-
- \sample
- \snippet take.cpp take sample
- \snippet output.txt take sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TAKE_HPP)
-#define RXCPP_OPERATORS_RX_TAKE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct take_invalid_arguments {};
-
-template<class... AN>
-struct take_invalid : public rxo::operator_base<take_invalid_arguments<AN...>> {
- using type = observable<take_invalid_arguments<AN...>, take_invalid<AN...>>;
-};
-template<class... AN>
-using take_invalid_t = typename take_invalid<AN...>::type;
-
-template<class T, class Observable, class Count>
-struct take : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Count> count_type;
- struct values
- {
- values(source_type s, count_type t)
- : source(std::move(s))
- , count(std::move(t))
- {
- }
- source_type source;
- count_type count;
- };
- values initial;
-
- take(source_type s, count_type t)
- : initial(std::move(s), std::move(t))
- {
- }
-
- struct mode
- {
- enum type {
- taking, // capture messages
- triggered, // ignore messages
- errored, // error occured
- stopped // observable completed
- };
- };
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
-
- typedef Subscriber output_type;
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& i, const output_type& oarg)
- : values(i)
- , mode_value(mode::taking)
- , out(oarg)
- {
- }
- typename mode::type mode_value;
- output_type out;
- };
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, s);
-
- composite_subscription source_lifetime;
-
- s.add(source_lifetime);
-
- state->source.subscribe(
- // split subscription lifetime
- source_lifetime,
- // on_next
- [state, source_lifetime](T t) {
- if (state->mode_value < mode::triggered) {
- if (--state->count > 0) {
- state->out.on_next(t);
- } else {
- state->mode_value = mode::triggered;
- state->out.on_next(t);
- // must shutdown source before signaling completion
- source_lifetime.unsubscribe();
- state->out.on_completed();
- }
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- state->mode_value = mode::stopped;
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-take.hpp
-*/
-template<class... AN>
-auto take(AN&&... an)
- -> operator_factory<take_tag, AN...> {
- return operator_factory<take_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<take_tag>
-{
- template<class Observable,
- class Count,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Take = rxo::detail::take<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<Take>,
- class Result = observable<Value, Take>>
- static Result member(Observable&& o, Count&& c) {
- return Result(Take(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::take_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "take takes (optional Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-take_last.hpp b/Rx/v2/src/rxcpp/operators/rx-take_last.hpp
deleted file mode 100644
index 12e28b6..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-take_last.hpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-take_last.hpp
-
- \brief Emit only the final t items emitted by the source Observable.
-
- \tparam Count the type of the items counter.
-
- \param t the number of last items to take.
-
- \return An observable that emits only the last t items emitted by the source Observable, or all of the items from the source observable if that observable emits fewer than t items.
-
- \sample
- \snippet take_last.cpp take_last sample
- \snippet output.txt take_last sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TAKE_LAST_HPP)
-#define RXCPP_OPERATORS_RX_TAKE_LAST_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct take_last_invalid_arguments {};
-
-template<class... AN>
-struct take_last_invalid : public rxo::operator_base<take_last_invalid_arguments<AN...>> {
- using type = observable<take_last_invalid_arguments<AN...>, take_last_invalid<AN...>>;
-};
-template<class... AN>
-using take_last_invalid_t = typename take_last_invalid<AN...>::type;
-
-template<class T, class Observable, class Count>
-struct take_last : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<Count> count_type;
-
- typedef std::queue<T> queue_type;
- typedef typename queue_type::size_type queue_size_type;
-
- struct values
- {
- values(source_type s, count_type t)
- : source(std::move(s))
- , count(static_cast<queue_size_type>(t))
- {
- }
- source_type source;
- queue_size_type count;
- };
- values initial;
-
- take_last(source_type s, count_type t)
- : initial(std::move(s), std::move(t))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(const Subscriber& s) const {
-
- typedef Subscriber output_type;
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(const values& i, const output_type& oarg)
- : values(i)
- , out(oarg)
- {
- }
- queue_type items;
- output_type out;
- };
- // take a copy of the values for each subscription
- auto state = std::make_shared<state_type>(initial, s);
-
- composite_subscription source_lifetime;
-
- s.add(source_lifetime);
-
- state->source.subscribe(
- // split subscription lifetime
- source_lifetime,
- // on_next
- [state, source_lifetime](T t) {
- if(state->count > 0) {
- if (state->items.size() == state->count) {
- state->items.pop();
- }
- state->items.push(t);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- while(!state->items.empty()) {
- state->out.on_next(std::move(state->items.front()));
- state->items.pop();
- }
- state->out.on_completed();
- }
- );
- }
-};
-
-}
-
-/*! @copydoc rx-take_last.hpp
-*/
-template<class... AN>
-auto take_last(AN&&... an)
- -> operator_factory<take_last_tag, AN...> {
- return operator_factory<take_last_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<take_last_tag>
-{
- template<class Observable,
- class Count,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class TakeLast = rxo::detail::take_last<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<Count>>,
- class Value = rxu::value_type_t<TakeLast>,
- class Result = observable<Value, TakeLast>>
- static Result member(Observable&& o, Count&& c) {
- return Result(TakeLast(std::forward<Observable>(o), std::forward<Count>(c)));
- }
-
- template<class... AN>
- static operators::detail::take_last_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "take_last takes (Count)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp
deleted file mode 100644
index 3fd9b71..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-take_until.hpp
-
- \brief For each item from this observable until on_next occurs on the trigger observable or until the specified time, emit them from the new observable that is returned.
- take_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination)
-
- \tparam TriggerSource the type of the trigger observable.
- \tparam TimePoint the type of the time interval.
- \tparam Coordination the type of the scheduler (optional).
-
- \param t an observable whose first emitted item will stop emitting items from the source observable.
- \param when a time point when the returned observable will stop emitting items.
- \param cn the scheduler to use for scheduling the items (optional).
-
- \return An observable that emits the items emitted by the source observable until trigger observable emitted or the time runs out.
-
- \sample
- \snippet take_until.cpp take_until sample
- \snippet output.txt take_until sample
-
- \sample
- \snippet take_until.cpp threaded take_until sample
- \snippet output.txt threaded take_until sample
-
- \sample
- \snippet take_until.cpp take_until time sample
- \snippet output.txt take_until time sample
-
- \sample
- \snippet take_until.cpp threaded take_until time sample
- \snippet output.txt threaded take_until time sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TAKE_UNTIL_HPP)
-#define RXCPP_OPERATORS_RX_TAKE_UNTIL_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct take_until_invalid_arguments {};
-
-template<class... AN>
-struct take_until_invalid : public rxo::operator_base<take_until_invalid_arguments<AN...>> {
- using type = observable<take_until_invalid_arguments<AN...>, take_until_invalid<AN...>>;
-};
-template<class... AN>
-using take_until_invalid_t = typename take_until_invalid<AN...>::type;
-
-template<class T, class Observable, class TriggerObservable, class Coordination>
-struct take_until : public operator_base<T>
-{
- typedef rxu::decay_t<Observable> source_type;
- typedef rxu::decay_t<TriggerObservable> trigger_source_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- struct values
- {
- values(source_type s, trigger_source_type t, coordination_type sf)
- : source(std::move(s))
- , trigger(std::move(t))
- , coordination(std::move(sf))
- {
- }
- source_type source;
- trigger_source_type trigger;
- coordination_type coordination;
- };
- values initial;
-
- take_until(source_type s, trigger_source_type t, coordination_type sf)
- : initial(std::move(s), std::move(t), std::move(sf))
- {
- }
-
- struct mode
- {
- enum type {
- taking, // no messages from trigger
- clear, // trigger completed
- triggered, // trigger sent on_next
- errored, // error either on trigger or on observable
- stopped // observable completed
- };
- };
-
- template<class Subscriber>
- void on_subscribe(Subscriber s) const {
-
- typedef Subscriber output_type;
- struct take_until_state_type
- : public std::enable_shared_from_this<take_until_state_type>
- , public values
- {
- take_until_state_type(const values& i, coordinator_type coor, const output_type& oarg)
- : values(i)
- , mode_value(mode::taking)
- , coordinator(std::move(coor))
- , out(oarg)
- {
- out.add(trigger_lifetime);
- out.add(source_lifetime);
- }
- typename mode::type mode_value;
- composite_subscription trigger_lifetime;
- composite_subscription source_lifetime;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(s.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<take_until_state_type>(initial, std::move(coordinator), std::move(s));
-
- auto trigger = on_exception(
- [&](){return state->coordinator.in(state->trigger);},
- state->out);
- if (trigger.empty()) {
- return;
- }
-
- auto source = on_exception(
- [&](){return state->coordinator.in(state->source);},
- state->out);
- if (source.empty()) {
- return;
- }
-
- auto sinkTrigger = make_subscriber<typename trigger_source_type::value_type>(
- // share parts of subscription
- state->out,
- // new lifetime
- state->trigger_lifetime,
- // on_next
- [state](const typename trigger_source_type::value_type&) {
- if (state->mode_value != mode::taking) {return;}
- state->mode_value = mode::triggered;
- state->out.on_completed();
- },
- // on_error
- [state](rxu::error_ptr e) {
- if (state->mode_value != mode::taking) {return;}
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (state->mode_value != mode::taking) {return;}
- state->mode_value = mode::clear;
- }
- );
- auto selectedSinkTrigger = on_exception(
- [&](){return state->coordinator.out(sinkTrigger);},
- state->out);
- if (selectedSinkTrigger.empty()) {
- return;
- }
- trigger->subscribe(std::move(selectedSinkTrigger.get()));
-
- auto sinkSource = make_subscriber<T>(
- // split subscription lifetime
- state->source_lifetime,
- // on_next
- [state](T t) {
- //
- // everything is crafted to minimize the overhead of this function.
- //
- if (state->mode_value < mode::triggered) {
- state->out.on_next(t);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- if (state->mode_value > mode::clear) {return;}
- state->mode_value = mode::errored;
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (state->mode_value > mode::clear) {return;}
- state->mode_value = mode::stopped;
- state->out.on_completed();
- }
- );
- auto selectedSinkSource = on_exception(
- [&](){return state->coordinator.out(sinkSource);},
- state->out);
- if (selectedSinkSource.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSinkSource.get()));
- }
-};
-
-}
-
-/*! @copydoc rx-take_until.hpp
-*/
-template<class... AN>
-auto take_until(AN&&... an)
- -> operator_factory<take_until_tag, AN...> {
- return operator_factory<take_until_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<take_until_tag>
-{
- template<class Observable, class TimePoint,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<TimePoint, rxsc::scheduler::clock_type::time_point>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timer = typename rxu::defer_type<rxs::detail::timer, identity_one_worker>::type,
- class TimerValue = rxu::value_type_t<Timer>,
- class TriggerObservable = observable<TimerValue, Timer>,
- class TakeUntil = rxo::detail::take_until<SourceValue, rxu::decay_t<Observable>, TriggerObservable, identity_one_worker>,
- class Value = rxu::value_type_t<TakeUntil>,
- class Result = observable<Value, TakeUntil>>
- static Result member(Observable&& o, TimePoint&& when) {
- auto cn = identity_current_thread();
- return Result(TakeUntil(std::forward<Observable>(o), rxs::timer(std::forward<TimePoint>(when), cn), cn));
- }
-
- template<class Observable, class TimePoint, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- std::is_convertible<TimePoint, rxsc::scheduler::clock_type::time_point>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timer = typename rxu::defer_type<rxs::detail::timer, rxu::decay_t<Coordination>>::type,
- class TimerValue = rxu::value_type_t<Timer>,
- class TriggerObservable = observable<TimerValue, Timer>,
- class TakeUntil = rxo::detail::take_until<SourceValue, rxu::decay_t<Observable>, TriggerObservable, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<TakeUntil>,
- class Result = observable<Value, TakeUntil>>
- static Result member(Observable&& o, TimePoint&& when, Coordination cn) {
- return Result(TakeUntil(std::forward<Observable>(o), rxs::timer(std::forward<TimePoint>(when), cn), cn));
- }
-
- template<class Observable, class TriggerObservable,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, TriggerObservable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class TakeUntil = rxo::detail::take_until<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<TriggerObservable>, identity_one_worker>,
- class Value = rxu::value_type_t<TakeUntil>,
- class Result = observable<Value, TakeUntil>>
- static Result member(Observable&& o, TriggerObservable&& t) {
- return Result(TakeUntil(std::forward<Observable>(o), std::forward<TriggerObservable>(t), identity_current_thread()));
- }
-
- template<class Observable, class TriggerObservable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, TriggerObservable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class TakeUntil = rxo::detail::take_until<SourceValue, rxu::decay_t<Observable>, rxu::decay_t<TriggerObservable>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<TakeUntil>,
- class Result = observable<Value, TakeUntil>>
- static Result member(Observable&& o, TriggerObservable&& t, Coordination&& cn) {
- return Result(TakeUntil(std::forward<Observable>(o), std::forward<TriggerObservable>(t), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::take_until_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "take_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-take_while.hpp b/Rx/v2/src/rxcpp/operators/rx-take_while.hpp
deleted file mode 100644
index 85630e7..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-take_while.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-take_while.hpp
-
- \brief For the first items fulfilling the predicate from this observable emit them from the new observable that is returned.
-
- \tparam Predicate the type of the predicate
-
- \param t the predicate
-
- \return An observable that emits only the first items emitted by the source Observable fulfilling the predicate, or all of the items from the source observable if the predicate never returns false
-
- \sample
- \snippet take_while.cpp take_while sample
- \snippet output.txt take_while sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TAKE_WHILE_HPP)
-#define RXCPP_OPERATORS_RX_TAKE_WHILE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct take_while_invalid_arguments {};
-
-template<class... AN>
-struct take_while_invalid : public rxo::operator_base<take_while_invalid_arguments<AN...>> {
- using type = observable<take_while_invalid_arguments<AN...>, take_while_invalid<AN...>>;
-};
-template<class... AN>
-using take_while_invalid_t = typename take_while_invalid<AN...>::type;
-
-template<class T, class Predicate>
-struct take_while
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Predicate> test_type;
- test_type test;
-
-
- take_while(test_type t)
- : test(std::move(t))
- {
- }
-
- template<class Subscriber>
- struct take_while_observer
- {
- typedef take_while_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- test_type test;
-
- take_while_observer(dest_type d, test_type t)
- : dest(std::move(d))
- , test(std::move(t))
- {
- }
- void on_next(source_value_type v) const {
- if (test(v)) {
- dest.on_next(v);
- } else {
- dest.on_completed();
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, test_type t) {
- return make_subscriber<value_type>(d, this_type(d, std::move(t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(take_while_observer<Subscriber>::make(std::move(dest), test)) {
- return take_while_observer<Subscriber>::make(std::move(dest), test);
- }
-};
-
-}
-
-/*! @copydoc rx-take_while.hpp
-*/
-template<class... AN>
-auto take_while(AN&&... an)
- -> operator_factory<take_while_tag, AN...> {
- return operator_factory<take_while_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
- }
-
-}
-
-template<>
-struct member_overload<take_while_tag>
-{
- template<class Observable, class Predicate,
- class SourceValue = rxu::value_type_t<Observable>,
- class TakeWhile = rxo::detail::take_while<SourceValue, rxu::decay_t<Predicate>>>
- static auto member(Observable&& o, Predicate&& p)
- -> decltype(o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)))) {
- return o.template lift<SourceValue>(TakeWhile(std::forward<Predicate>(p)));
- }
-
- template<class... AN>
- static operators::detail::take_while_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "take_while takes (Predicate)");
- }
-};
-
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-tap.hpp b/Rx/v2/src/rxcpp/operators/rx-tap.hpp
deleted file mode 100644
index 550163a..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-tap.hpp
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-tap.hpp
-
- \brief inspect calls to on_next, on_error and on_completed.
-
- \tparam MakeObserverArgN... these args are passed to make_observer.
-
- \param an these args are passed to make_observer.
-
- \return Observable that emits the same items as the source observable to both the subscriber and the observer.
-
- \note If an on_error method is not supplied the observer will ignore errors rather than call std::terminate()
-
- \sample
- \snippet tap.cpp tap sample
- \snippet output.txt tap sample
-
- If the source observable generates an error, the observer passed to tap is called:
- \snippet tap.cpp error tap sample
- \snippet output.txt error tap sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TAP_HPP)
-#define RXCPP_OPERATORS_RX_TAP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct tap_invalid_arguments {};
-
-template<class... AN>
-struct tap_invalid : public rxo::operator_base<tap_invalid_arguments<AN...>> {
- using type = observable<tap_invalid_arguments<AN...>, tap_invalid<AN...>>;
-};
-template<class... AN>
-using tap_invalid_t = typename tap_invalid<AN...>::type;
-
-template<class T, class MakeObserverArgN>
-struct tap_observer_factory;
-
-template<class T, class... ArgN>
-struct tap_observer_factory<T, std::tuple<ArgN...>>
-{
- using source_value_type = rxu::decay_t<T>;
- using out_type = decltype(make_observer<source_value_type, rxcpp::detail::OnErrorIgnore>(*((ArgN*)nullptr)...));
- auto operator()(ArgN&&... an) -> out_type const {
- return make_observer<source_value_type, rxcpp::detail::OnErrorIgnore>(std::forward<ArgN>(an)...);
- }
-};
-
-template<class T, class MakeObserverArgN, class Factory = tap_observer_factory<T, MakeObserverArgN>>
-struct tap
-{
- using source_value_type = rxu::decay_t<T>;
- using args_type = rxu::decay_t<MakeObserverArgN>;
- using factory_type = Factory;
- using out_type = typename factory_type::out_type;
- out_type out;
-
- tap(args_type a)
- : out(rxu::apply(std::move(a), factory_type()))
- {
- }
-
- template<class Subscriber>
- struct tap_observer
- {
- using this_type = tap_observer<Subscriber>;
- using value_type = source_value_type;
- using dest_type = rxu::decay_t<Subscriber>;
- using factory_type = Factory;
- using out_type = typename factory_type::out_type;
- using observer_type = observer<value_type, this_type>;
- dest_type dest;
- out_type out;
-
- tap_observer(dest_type d, out_type o)
- : dest(std::move(d))
- , out(std::move(o))
- {
- }
- void on_next(source_value_type v) const {
- out.on_next(v);
- dest.on_next(v);
- }
- void on_error(rxu::error_ptr e) const {
- out.on_error(e);
- dest.on_error(e);
- }
- void on_completed() const {
- out.on_completed();
- dest.on_completed();
- }
-
- static subscriber<value_type, observer<value_type, this_type>> make(dest_type d, out_type o) {
- return make_subscriber<value_type>(d, this_type(d, std::move(o)));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(tap_observer<Subscriber>::make(std::move(dest), out)) {
- return tap_observer<Subscriber>::make(std::move(dest), out);
- }
-};
-
-}
-
-/*! @copydoc rx-tap.hpp
-*/
-template<class... AN>
-auto tap(AN&&... an)
- -> operator_factory<tap_tag, AN...> {
- return operator_factory<tap_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<tap_tag>
-{
- template<class Observable, class... MakeObserverArgN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Tap = rxo::detail::tap<SourceValue, std::tuple<rxu::decay_t<MakeObserverArgN>...>>>
- static auto member(Observable&& o, MakeObserverArgN&&... an)
- -> decltype(o.template lift<SourceValue>(Tap(std::make_tuple(std::forward<MakeObserverArgN>(an)...)))) {
- return o.template lift<SourceValue>(Tap(std::make_tuple(std::forward<MakeObserverArgN>(an)...)));
- }
-
- template<class... AN>
- static operators::detail::tap_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "tap takes (MakeObserverArgN...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp b/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp
deleted file mode 100644
index 1a4c9a5..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-time_interval.hpp
-
- \brief Returns an observable that emits indications of the amount of time lapsed between consecutive emissions of the source observable.
- The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item.
-
- \tparam Coordination the type of the scheduler.
-
- \param coordination the scheduler for time intervals.
-
- \return Observable that emits a time_duration to indicate the amount of time lapsed between pairs of emissions.
-
- \sample
- \snippet time_interval.cpp time_interval sample
- \snippet output.txt time_interval sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TIME_INTERVAL_HPP)
-#define RXCPP_OPERATORS_RX_TIME_INTERVAL_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct time_interval_invalid_arguments {};
-
-template<class... AN>
-struct time_interval_invalid : public rxo::operator_base<time_interval_invalid_arguments<AN...>> {
- using type = observable<time_interval_invalid_arguments<AN...>, time_interval_invalid<AN...>>;
-};
-template<class... AN>
-using time_interval_invalid_t = typename time_interval_invalid<AN...>::type;
-
-template<class T, class Coordination>
-struct time_interval
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- struct time_interval_values {
- time_interval_values(coordination_type c)
- : coordination(c)
- {
- }
-
- coordination_type coordination;
- };
- time_interval_values initial;
-
- time_interval(coordination_type coordination)
- : initial(coordination)
- {
- }
-
- template<class Subscriber>
- struct time_interval_observer
- {
- typedef time_interval_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- typedef rxsc::scheduler::clock_type::time_point time_point;
- dest_type dest;
- coordination_type coord;
- mutable time_point last;
-
- time_interval_observer(dest_type d, coordination_type coordination)
- : dest(std::move(d)),
- coord(std::move(coordination)),
- last(coord.now())
- {
- }
-
- void on_next(source_value_type) const {
- time_point now = coord.now();
- dest.on_next(now - last);
- last = now;
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, time_interval_values v) {
- return make_subscriber<value_type>(d, this_type(d, v.coordination));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(time_interval_observer<Subscriber>::make(std::move(dest), initial)) {
- return time_interval_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-time_interval.hpp
-*/
-template<class... AN>
-auto time_interval(AN&&... an)
- -> operator_factory<time_interval_tag, AN...> {
- return operator_factory<time_interval_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<time_interval_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class TimeInterval = rxo::detail::time_interval<SourceValue, identity_one_worker>,
- class Value = typename rxsc::scheduler::clock_type::time_point::duration>
- static auto member(Observable&& o)
- -> decltype(o.template lift<Value>(TimeInterval(identity_current_thread()))) {
- return o.template lift<Value>(TimeInterval(identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class TimeInterval = rxo::detail::time_interval<SourceValue, rxu::decay_t<Coordination>>,
- class Value = typename rxsc::scheduler::clock_type::time_point::duration>
- static auto member(Observable&& o, Coordination&& cn)
- -> decltype(o.template lift<Value>(TimeInterval(std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(TimeInterval(std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::time_interval_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "time_interval takes (optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-timeout.hpp b/Rx/v2/src/rxcpp/operators/rx-timeout.hpp
deleted file mode 100644
index d100fa4..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-timeout.hpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-timeout.hpp
-
- \brief Return an observable that terminates with timeout_error if a particular timespan has passed without emitting another item from the source observable.
-
- \tparam Duration the type of time interval.
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time wait for another item from the source observable.
- \param coordination the scheduler to manage timeout for each event (optional).
-
- \return Observable that terminates with an error if a particular timespan has passed without emitting another item from the source observable.
-
- \sample
- \snippet timeout.cpp timeout sample
- \snippet output.txt timeout sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TIMEOUT_HPP)
-#define RXCPP_OPERATORS_RX_TIMEOUT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-class timeout_error: public std::runtime_error
-{
- public:
- explicit timeout_error(const std::string& msg):
- std::runtime_error(msg)
- {}
-};
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct timeout_invalid_arguments {};
-
-template<class... AN>
-struct timeout_invalid : public rxo::operator_base<timeout_invalid_arguments<AN...>> {
- using type = observable<timeout_invalid_arguments<AN...>, timeout_invalid<AN...>>;
-};
-template<class... AN>
-using timeout_invalid_t = typename timeout_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct timeout
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct timeout_values
- {
- timeout_values(duration_type p, coordination_type c)
- : period(p)
- , coordination(c)
- {
- }
-
- duration_type period;
- coordination_type coordination;
- };
- timeout_values initial;
-
- timeout(duration_type period, coordination_type coordination)
- : initial(period, coordination)
- {
- }
-
- template<class Subscriber>
- struct timeout_observer
- {
- typedef timeout_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct timeout_subscriber_values : public timeout_values
- {
- timeout_subscriber_values(composite_subscription cs, dest_type d, timeout_values v, coordinator_type c)
- : timeout_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , index(0)
- {
- }
-
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable std::size_t index;
- };
- typedef std::shared_ptr<timeout_subscriber_values> state_type;
- state_type state;
-
- timeout_observer(composite_subscription cs, dest_type d, timeout_values v, coordinator_type c)
- : state(std::make_shared<timeout_subscriber_values>(timeout_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){ return localState->coordinator.act(disposer); },
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- auto work = [v, localState](const rxsc::schedulable&) {
- auto new_id = ++localState->index;
- auto produce_time = localState->worker.now() + localState->period;
-
- localState->worker.schedule(produce_time, produce_timeout(new_id, localState));
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static std::function<void(const rxsc::schedulable&)> produce_timeout(std::size_t id, state_type state) {
- auto produce = [id, state](const rxsc::schedulable&) {
- if(id != state->index)
- return;
-
- state->dest.on_error(rxu::make_error_ptr(rxcpp::timeout_error("timeout has occurred")));
- };
-
- auto selectedProduce = on_exception(
- [&](){ return state->coordinator.act(produce); },
- state->dest);
- if (selectedProduce.empty()) {
- return std::function<void(const rxsc::schedulable&)>();
- }
-
- return std::function<void(const rxsc::schedulable&)>(selectedProduce.get());
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&) {
- auto new_id = ++localState->index;
- auto produce_time = localState->worker.now() + localState->period;
-
- localState->dest.on_next(v);
- localState->worker.schedule(produce_time, produce_timeout(new_id, localState));
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&) {
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&) {
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){ return localState->coordinator.act(work); },
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, timeout_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(timeout_observer<Subscriber>::make(std::move(dest), initial)) {
- return timeout_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-timeout.hpp
-*/
-template<class... AN>
-auto timeout(AN&&... an)
- -> operator_factory<timeout_tag, AN...> {
- return operator_factory<timeout_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<timeout_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timeout = rxo::detail::timeout<SourceValue, rxu::decay_t<Duration>, identity_one_worker>>
- static auto member(Observable&& o, Duration&& d)
- -> decltype(o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), identity_current_thread()))) {
- return o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), identity_current_thread()));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timeout = rxo::detail::timeout<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Coordination&& cn, Duration&& d)
- -> decltype(o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Coordination, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>,
- rxu::is_duration<Duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timeout = rxo::detail::timeout<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>>
- static auto member(Observable&& o, Duration&& d, Coordination&& cn)
- -> decltype(o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), std::forward<Coordination>(cn)))) {
- return o.template lift<SourceValue>(Timeout(std::forward<Duration>(d), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::timeout_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "timeout takes (optional Coordination, required Duration) or (required Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp b/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp
deleted file mode 100644
index 923cf5d..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-timestamp.hpp
-
- \brief Returns an observable that attaches a timestamp to each item emitted by the source observable indicating when it was emitted.
-
- \tparam Coordination the type of the scheduler (optional).
-
- \param coordination the scheduler to manage timeout for each event (optional).
-
- \return Observable that emits a pair: { item emitted by the source observable, time_point representing the current value of the clock }.
-
- \sample
- \snippet timestamp.cpp timestamp sample
- \snippet output.txt timestamp sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_TIMESTAMP_HPP)
-#define RXCPP_OPERATORS_RX_TIMESTAMP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct timestamp_invalid_arguments {};
-
-template<class... AN>
-struct timestamp_invalid : public rxo::operator_base<timestamp_invalid_arguments<AN...>> {
- using type = observable<timestamp_invalid_arguments<AN...>, timestamp_invalid<AN...>>;
-};
-template<class... AN>
-using timestamp_invalid_t = typename timestamp_invalid<AN...>::type;
-
-template<class T, class Coordination>
-struct timestamp
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- struct timestamp_values {
- timestamp_values(coordination_type c)
- : coordination(c)
- {
- }
-
- coordination_type coordination;
- };
- timestamp_values initial;
-
- timestamp(coordination_type coordination)
- : initial(coordination)
- {
- }
-
- template<class Subscriber>
- struct timestamp_observer
- {
- typedef timestamp_observer<Subscriber> this_type;
- typedef source_value_type value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- coordination_type coord;
-
- timestamp_observer(dest_type d, coordination_type coordination)
- : dest(std::move(d)),
- coord(std::move(coordination))
- {
- }
-
- void on_next(source_value_type v) const {
- dest.on_next(std::make_pair(v, coord.now()));
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static subscriber<value_type, observer_type> make(dest_type d, timestamp_values v) {
- return make_subscriber<value_type>(d, this_type(d, v.coordination));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(timestamp_observer<Subscriber>::make(std::move(dest), initial)) {
- return timestamp_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-timestamp.hpp
-*/
-template<class... AN>
-auto timestamp(AN&&... an)
- -> operator_factory<timestamp_tag, AN...> {
- return operator_factory<timestamp_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<timestamp_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timestamp = rxo::detail::timestamp<SourceValue, identity_one_worker>,
- class Clock = typename rxsc::scheduler::clock_type::time_point,
- class Value = std::pair<SourceValue, Clock>>
- static auto member(Observable&& o)
- -> decltype(o.template lift<Value>(Timestamp(identity_current_thread()))) {
- return o.template lift<Value>(Timestamp(identity_current_thread()));
- }
-
- template<class Observable, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Timestamp = rxo::detail::timestamp<SourceValue, rxu::decay_t<Coordination>>,
- class Clock = typename rxsc::scheduler::clock_type::time_point,
- class Value = std::pair<SourceValue, Clock>>
- static auto member(Observable&& o, Coordination&& cn)
- -> decltype(o.template lift<Value>(Timestamp(std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(Timestamp(std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::timestamp_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "timestamp takes (optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-window.hpp b/Rx/v2/src/rxcpp/operators/rx-window.hpp
deleted file mode 100644
index e033a84..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-window.hpp
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-window.hpp
-
- \brief Return an observable that emits connected, non-overlapping windows, each containing at most count items from the source observable.
- If the skip parameter is set, return an observable that emits windows every skip items containing at most count items from the source observable.
-
- \param count the maximum size of each window before it should be completed
- \param skip how many items need to be skipped before starting a new window
-
- \return Observable that emits connected, non-overlapping windows, each containing at most count items from the source observable.
- If the skip parameter is set, return an Observable that emits windows every skip items containing at most count items from the source observable.
-
- \sample
- \snippet window.cpp window count+skip sample
- \snippet output.txt window count+skip sample
-
- \sample
- \snippet window.cpp window count sample
- \snippet output.txt window count sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_WINDOW_HPP)
-#define RXCPP_OPERATORS_RX_WINDOW_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct window_invalid_arguments {};
-
-template<class... AN>
-struct window_invalid : public rxo::operator_base<window_invalid_arguments<AN...>> {
- using type = observable<window_invalid_arguments<AN...>, window_invalid<AN...>>;
-};
-template<class... AN>
-using window_invalid_t = typename window_invalid<AN...>::type;
-
-template<class T>
-struct window
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef observable<source_value_type> value_type;
-
- struct window_values
- {
- window_values(int c, int s)
- : count(c)
- , skip(s)
- {
- }
- int count;
- int skip;
- };
-
- window_values initial;
-
- window(int count, int skip)
- : initial(count, skip)
- {
- }
-
- template<class Subscriber>
- struct window_observer : public window_values
- {
- typedef window_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
- dest_type dest;
- mutable int cursor;
- mutable std::deque<rxcpp::subjects::subject<T>> subj;
-
- window_observer(dest_type d, window_values v)
- : window_values(v)
- , dest(std::move(d))
- , cursor(0)
- {
- subj.push_back(rxcpp::subjects::subject<T>());
- dest.on_next(subj[0].get_observable().as_dynamic());
- }
- void on_next(T v) const {
- for (auto s : subj) {
- s.get_subscriber().on_next(v);
- }
-
- int c = cursor - this->count + 1;
- if (c >= 0 && c % this->skip == 0) {
- subj[0].get_subscriber().on_completed();
- subj.pop_front();
- }
-
- if (++cursor % this->skip == 0) {
- subj.push_back(rxcpp::subjects::subject<T>());
- dest.on_next(subj[subj.size() - 1].get_observable().as_dynamic());
- }
- }
-
- void on_error(rxu::error_ptr e) const {
- for (auto s : subj) {
- s.get_subscriber().on_error(e);
- }
- dest.on_error(e);
- }
-
- void on_completed() const {
- for (auto s : subj) {
- s.get_subscriber().on_completed();
- }
- dest.on_completed();
- }
-
- static subscriber<T, observer_type> make(dest_type d, window_values v) {
- auto cs = d.get_subscription();
- return make_subscriber<T>(std::move(cs), observer_type(this_type(std::move(d), std::move(v))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(window_observer<Subscriber>::make(std::move(dest), initial)) {
- return window_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-window.hpp
-*/
-template<class... AN>
-auto window(AN&&... an)
- -> operator_factory<window_tag, AN...> {
- return operator_factory<window_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<window_tag>
-{
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Window = rxo::detail::window<SourceValue>,
- class Value = rxu::value_type_t<Window>>
- static auto member(Observable&& o, int count, int skip)
- -> decltype(o.template lift<Value>(Window(count, skip))) {
- return o.template lift<Value>(Window(count, skip));
- }
-
- template<class Observable,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class Window = rxo::detail::window<SourceValue>,
- class Value = rxu::value_type_t<Window>>
- static auto member(Observable&& o, int count)
- -> decltype(o.template lift<Value>(Window(count, count))) {
- return o.template lift<Value>(Window(count, count));
- }
-
- template<class... AN>
- static operators::detail::window_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "window takes (Count, optional Skip)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp
deleted file mode 100644
index 57f7572..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-window_time.hpp
-
- \brief Return an observable that emits observables every period time interval and collects items from this observable for period of time into each produced observable, on the specified scheduler.
- If the skip parameter is set, return an observable that emits observables every skip time interval and collects items from this observable for period of time into each produced observable, on the specified scheduler.
-
- \tparam Duration the type of time intervals.
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time each window collects items before it is completed.
- \param skip the period of time after which a new window will be created.
- \param coordination the scheduler for the windows (optional).
-
- \return Observable that emits observables every period time interval and collect items from this observable for period of time into each produced observable.
- If the skip parameter is set, return an Observable that emits observables every skip time interval and collect items from this observable for period of time into each produced observable.
-
- \sample
- \snippet window.cpp window period+skip+coordination sample
- \snippet output.txt window period+skip+coordination sample
-
- \sample
- \snippet window.cpp window period+skip sample
- \snippet output.txt window period+skip sample
-
- \sample
- \snippet window.cpp window period+coordination sample
- \snippet output.txt window period+coordination sample
-
- \sample
- \snippet window.cpp window period sample
- \snippet output.txt window period sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_WINDOW_WITH_TIME_HPP)
-#define RXCPP_OPERATORS_RX_WINDOW_WITH_TIME_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct window_with_time_invalid_arguments {};
-
-template<class... AN>
-struct window_with_time_invalid : public rxo::operator_base<window_with_time_invalid_arguments<AN...>> {
- using type = observable<window_with_time_invalid_arguments<AN...>, window_with_time_invalid<AN...>>;
-};
-template<class... AN>
-using window_with_time_invalid_t = typename window_with_time_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct window_with_time
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef observable<source_value_type> value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct window_with_time_values
- {
- window_with_time_values(duration_type p, duration_type s, coordination_type c)
- : period(p)
- , skip(s)
- , coordination(c)
- {
- }
- duration_type period;
- duration_type skip;
- coordination_type coordination;
- };
- window_with_time_values initial;
-
- window_with_time(duration_type period, duration_type skip, coordination_type coordination)
- : initial(period, skip, coordination)
- {
- }
-
- template<class Subscriber>
- struct window_with_time_observer
- {
- typedef window_with_time_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct window_with_time_subscriber_values : public window_with_time_values
- {
- window_with_time_subscriber_values(composite_subscription cs, dest_type d, window_with_time_values v, coordinator_type c)
- : window_with_time_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , expected(worker.now())
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable std::deque<rxcpp::subjects::subject<T>> subj;
- rxsc::scheduler::clock_type::time_point expected;
- };
- std::shared_ptr<window_with_time_subscriber_values> state;
-
- window_with_time_observer(composite_subscription cs, dest_type d, window_with_time_values v, coordinator_type c)
- : state(std::make_shared<window_with_time_subscriber_values>(window_with_time_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return localState->coordinator.act(disposer);},
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- //
- // The scheduler is FIFO for any time T. Since the observer is scheduling
- // on_next/on_error/oncompleted the timed schedule calls must be resheduled
- // when they occur to ensure that production happens after on_next/on_error/oncompleted
- //
-
- auto release_window = [localState](const rxsc::schedulable&) {
- localState->worker.schedule([localState](const rxsc::schedulable&) {
- localState->subj[0].get_subscriber().on_completed();
- localState->subj.pop_front();
- });
- };
- auto selectedRelease = on_exception(
- [&](){return localState->coordinator.act(release_window);},
- localState->dest);
- if (selectedRelease.empty()) {
- return;
- }
-
- auto create_window = [localState, selectedRelease](const rxsc::schedulable&) {
- localState->subj.push_back(rxcpp::subjects::subject<T>());
- localState->dest.on_next(localState->subj[localState->subj.size() - 1].get_observable().as_dynamic());
-
- auto produce_at = localState->expected + localState->period;
- localState->expected += localState->skip;
- localState->worker.schedule(produce_at, [localState, selectedRelease](const rxsc::schedulable&) {
- localState->worker.schedule(selectedRelease.get());
- });
- };
- auto selectedCreate = on_exception(
- [&](){return localState->coordinator.act(create_window);},
- localState->dest);
- if (selectedCreate.empty()) {
- return;
- }
-
- state->worker.schedule_periodically(
- state->expected,
- state->skip,
- [localState, selectedCreate](const rxsc::schedulable&) {
- localState->worker.schedule(selectedCreate.get());
- });
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_next(v);
- }
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_error(e);
- }
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_completed();
- }
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, window_with_time_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(window_with_time_observer<Subscriber>::make(std::move(dest), initial)) {
- return window_with_time_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-window_time.hpp
-*/
-template<class... AN>
-auto window_with_time(AN&&... an)
- -> operator_factory<window_with_time_tag, AN...> {
- return operator_factory<window_with_time_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<window_with_time_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowWithTime = rxo::detail::window_with_time<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<WindowWithTime>>
- static auto member(Observable&& o, Duration period)
- -> decltype(o.template lift<Value>(WindowWithTime(period, period, identity_current_thread()))) {
- return o.template lift<Value>(WindowWithTime(period, period, identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowWithTime = rxo::detail::window_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<WindowWithTime>>
- static auto member(Observable&& o, Duration period, Coordination&& cn)
- -> decltype(o.template lift<Value>(WindowWithTime(period, period, std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(WindowWithTime(period, period, std::forward<Coordination>(cn)));
- }
-
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowWithTime = rxo::detail::window_with_time<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<WindowWithTime>>
- static auto member(Observable&& o, Duration&& period, Duration&& skip)
- -> decltype(o.template lift<Value>(WindowWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), identity_current_thread()))) {
- return o.template lift<Value>(WindowWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowWithTime = rxo::detail::window_with_time<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<WindowWithTime>>
- static auto member(Observable&& o, Duration&& period, Duration&& skip, Coordination&& cn)
- -> decltype(o.template lift<Value>(WindowWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(WindowWithTime(std::forward<Duration>(period), std::forward<Duration>(skip), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::window_with_time_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "window_with_time takes (Duration, optional Duration, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp
deleted file mode 100644
index 9375737..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-window_time_count.hpp
-
- \brief Return an observable that emits connected, non-overlapping windows of items from the source observable that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first), on the specified scheduler.
-
- \tparam Duration the type of time intervals.
- \tparam Coordination the type of the scheduler (optional).
-
- \param period the period of time each window collects items before it is completed and replaced with a new window.
- \param count the maximum size of each window before it is completed and new window is created.
- \param coordination the scheduler for the windows (optional).
-
- \return Observable that emits connected, non-overlapping windows of items from the source observable that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first).
-
- \sample
- \snippet window.cpp window period+count+coordination sample
- \snippet output.txt window period+count+coordination sample
-
- \sample
- \snippet window.cpp window period+count sample
- \snippet output.txt window period+count sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_WINDOW_WITH_TIME_OR_COUNT_HPP)
-#define RXCPP_OPERATORS_RX_WINDOW_WITH_TIME_OR_COUNT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct window_with_time_or_count_invalid_arguments {};
-
-template<class... AN>
-struct window_with_time_or_count_invalid : public rxo::operator_base<window_with_time_or_count_invalid_arguments<AN...>> {
- using type = observable<window_with_time_or_count_invalid_arguments<AN...>, window_with_time_or_count_invalid<AN...>>;
-};
-template<class... AN>
-using window_with_time_or_count_invalid_t = typename window_with_time_or_count_invalid<AN...>::type;
-
-template<class T, class Duration, class Coordination>
-struct window_with_time_or_count
-{
- typedef rxu::decay_t<T> source_value_type;
- typedef observable<source_value_type> value_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef rxu::decay_t<Duration> duration_type;
-
- struct window_with_time_or_count_values
- {
- window_with_time_or_count_values(duration_type p, int n, coordination_type c)
- : period(p)
- , count(n)
- , coordination(c)
- {
- }
- duration_type period;
- int count;
- coordination_type coordination;
- };
- window_with_time_or_count_values initial;
-
- window_with_time_or_count(duration_type period, int count, coordination_type coordination)
- : initial(period, count, coordination)
- {
- }
-
- template<class Subscriber>
- struct window_with_time_or_count_observer
- {
- typedef window_with_time_or_count_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct window_with_time_or_count_subscriber_values : public window_with_time_or_count_values
- {
- window_with_time_or_count_subscriber_values(composite_subscription cs, dest_type d, window_with_time_or_count_values v, coordinator_type c)
- : window_with_time_or_count_values(std::move(v))
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- , cursor(0)
- , subj_id(0)
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable int cursor;
- mutable int subj_id;
- mutable rxcpp::subjects::subject<T> subj;
- };
- typedef std::shared_ptr<window_with_time_or_count_subscriber_values> state_type;
- state_type state;
-
- window_with_time_or_count_observer(composite_subscription cs, dest_type d, window_with_time_or_count_values v, coordinator_type c)
- : state(std::make_shared<window_with_time_or_count_subscriber_values>(window_with_time_or_count_subscriber_values(std::move(cs), std::move(d), std::move(v), std::move(c))))
- {
- auto new_id = state->subj_id;
- auto produce_time = state->worker.now();
- auto localState = state;
-
- auto disposer = [=](const rxsc::schedulable&){
- localState->cs.unsubscribe();
- localState->dest.unsubscribe();
- localState->worker.unsubscribe();
- };
- auto selectedDisposer = on_exception(
- [&](){return localState->coordinator.act(disposer);},
- localState->dest);
- if (selectedDisposer.empty()) {
- return;
- }
-
- localState->dest.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
- localState->cs.add([=](){
- localState->worker.schedule(selectedDisposer.get());
- });
-
- //
- // The scheduler is FIFO for any time T. Since the observer is scheduling
- // on_next/on_error/oncompleted the timed schedule calls must be resheduled
- // when they occur to ensure that production happens after on_next/on_error/oncompleted
- //
-
- localState->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){
- localState->worker.schedule(release_window(new_id, produce_time, localState));
- });
- }
-
- static std::function<void(const rxsc::schedulable&)> release_window(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) {
- auto release = [id, expected, state](const rxsc::schedulable&) {
- if (id != state->subj_id)
- return;
-
- state->subj.get_subscriber().on_completed();
- state->subj = rxcpp::subjects::subject<T>();
- state->dest.on_next(state->subj.get_observable().as_dynamic());
- state->cursor = 0;
- auto new_id = ++state->subj_id;
- auto produce_time = expected + state->period;
- state->worker.schedule(produce_time, [new_id, produce_time, state](const rxsc::schedulable&){
- state->worker.schedule(release_window(new_id, produce_time, state));
- });
- };
- auto selectedRelease = on_exception(
- [&](){return state->coordinator.act(release);},
- state->dest);
- if (selectedRelease.empty()) {
- return std::function<void(const rxsc::schedulable&)>();
- }
-
- return std::function<void(const rxsc::schedulable&)>(selectedRelease.get());
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable& self){
- localState->subj.get_subscriber().on_next(v);
- if (++localState->cursor == localState->count) {
- release_window(localState->subj_id, localState->worker.now(), localState)(self);
- }
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- localState->subj.get_subscriber().on_error(e);
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- localState->subj.get_subscriber().on_completed();
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, window_with_time_or_count_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator();
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(window_with_time_or_count_observer<Subscriber>::make(std::move(dest), initial)) {
- return window_with_time_or_count_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-window_time_count.hpp
-*/
-template<class... AN>
-auto window_with_time_or_count(AN&&... an)
- -> operator_factory<window_with_time_or_count_tag, AN...> {
- return operator_factory<window_with_time_or_count_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<window_with_time_or_count_tag>
-{
- template<class Observable, class Duration,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowTimeCount = rxo::detail::window_with_time_or_count<SourceValue, rxu::decay_t<Duration>, identity_one_worker>,
- class Value = rxu::value_type_t<WindowTimeCount>>
- static auto member(Observable&& o, Duration&& period, int count)
- -> decltype(o.template lift<Value>(WindowTimeCount(std::forward<Duration>(period), count, identity_current_thread()))) {
- return o.template lift<Value>(WindowTimeCount(std::forward<Duration>(period), count, identity_current_thread()));
- }
-
- template<class Observable, class Duration, class Coordination,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_observable<Observable>,
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowTimeCount = rxo::detail::window_with_time_or_count<SourceValue, rxu::decay_t<Duration>, rxu::decay_t<Coordination>>,
- class Value = rxu::value_type_t<WindowTimeCount>>
- static auto member(Observable&& o, Duration&& period, int count, Coordination&& cn)
- -> decltype(o.template lift<Value>(WindowTimeCount(std::forward<Duration>(period), count, std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(WindowTimeCount(std::forward<Duration>(period), count, std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::window_with_time_or_count_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "window_with_time_or_count takes (Duration, Count, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp b/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
deleted file mode 100644
index b9f119a..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
+++ /dev/null
@@ -1,324 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-window_toggle.hpp
-
- \brief Return an observable that emits observables every period time interval and collects items from this observable for period of time into each produced observable, on the specified scheduler.
-
- \tparam Openings observable<OT>
- \tparam ClosingSelector a function of type observable<CT>(OT)
- \tparam Coordination the type of the scheduler (optional).
-
- \param opens each value from this observable opens a new window.
- \param closes this function is called for each opened window and returns an observable. the first value from the returned observable will close the window.
- \param coordination the scheduler for the windows (optional).
-
- \return Observable that emits an observable for each opened window.
-
- \sample
- \snippet window.cpp window toggle+coordination sample
- \snippet output.txt window toggle+coordination sample
-
- \sample
- \snippet window.cpp window toggle sample
- \snippet output.txt window toggle sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_WINDOW_TOGGLE_HPP)
-#define RXCPP_OPERATORS_RX_WINDOW_TOGGLE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct window_toggle_invalid_arguments {};
-
-template<class... AN>
-struct window_toggle_invalid : public rxo::operator_base<window_toggle_invalid_arguments<AN...>> {
- using type = observable<window_toggle_invalid_arguments<AN...>, window_toggle_invalid<AN...>>;
-};
-template<class... AN>
-using window_toggle_invalid_t = typename window_toggle_invalid<AN...>::type;
-
-template<class T, class Openings, class ClosingSelector, class Coordination>
-struct window_toggle
-{
- typedef window_toggle<T, Openings, ClosingSelector, Coordination> this_type;
-
- using source_value_type = rxu::decay_t<T>;
- using coordination_type = rxu::decay_t<Coordination>;
- using coordinator_type = typename coordination_type::coordinator_type;
- using openings_type = rxu::decay_t<Openings>;
- using openings_value_type = typename openings_type::value_type;
- using closing_selector_type = rxu::decay_t<ClosingSelector>;
- using closings_type = rxu::result_of_t<closing_selector_type(openings_value_type)>;
- using closings_value_type = typename closings_type::value_type;
-
- struct window_toggle_values
- {
- window_toggle_values(openings_type opens, closing_selector_type closes, coordination_type c)
- : openings(opens)
- , closingSelector(closes)
- , coordination(c)
- {
- }
- openings_type openings;
- mutable closing_selector_type closingSelector;
- coordination_type coordination;
- };
- window_toggle_values initial;
-
- window_toggle(openings_type opens, closing_selector_type closes, coordination_type coordination)
- : initial(opens, closes, coordination)
- {
- }
-
- template<class Subscriber>
- struct window_toggle_observer
- {
- typedef window_toggle_observer<Subscriber> this_type;
- typedef rxu::decay_t<T> value_type;
- typedef rxu::decay_t<Subscriber> dest_type;
- typedef observer<T, this_type> observer_type;
-
- struct window_toggle_subscriber_values : public window_toggle_values
- {
- window_toggle_subscriber_values(composite_subscription cs, dest_type d, window_toggle_values v, coordinator_type c)
- : window_toggle_values(v)
- , cs(std::move(cs))
- , dest(std::move(d))
- , coordinator(std::move(c))
- , worker(coordinator.get_worker())
- {
- }
- composite_subscription cs;
- dest_type dest;
- coordinator_type coordinator;
- rxsc::worker worker;
- mutable std::list<rxcpp::subjects::subject<T>> subj;
- };
- std::shared_ptr<window_toggle_subscriber_values> state;
-
- window_toggle_observer(composite_subscription cs, dest_type d, window_toggle_values v, coordinator_type c)
- : state(std::make_shared<window_toggle_subscriber_values>(window_toggle_subscriber_values(std::move(cs), std::move(d), v, std::move(c))))
- {
- auto localState = state;
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innerscope = localState->dest.add(innercs);
-
- innercs.add([=](){
- localState->dest.remove(innerscope);
- });
-
- localState->dest.add(localState->cs);
-
- auto source = on_exception(
- [&](){return localState->coordinator.in(localState->openings);},
- localState->dest);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<openings_value_type>(
- localState->dest,
- innercs,
- // on_next
- [localState](const openings_value_type& ov) {
- auto closer = localState->closingSelector(ov);
-
- auto it = localState->subj.insert(localState->subj.end(), rxcpp::subjects::subject<T>());
- localState->dest.on_next(it->get_observable().as_dynamic());
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- auto innerscope = localState->dest.add(innercs);
-
- innercs.add([=](){
- localState->dest.remove(innerscope);
- });
-
- auto source = localState->coordinator.in(closer);
-
- auto sit = std::make_shared<decltype(it)>(it);
- auto close = [localState, sit]() {
- auto it = *sit;
- *sit = localState->subj.end();
- if (it != localState->subj.end()) {
- it->get_subscriber().on_completed();
- localState->subj.erase(it);
- }
- };
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<closings_value_type>(
- localState->dest,
- innercs,
- // on_next
- [close, innercs](closings_value_type) {
- close();
- innercs.unsubscribe();
- },
- // on_error
- [localState](rxu::error_ptr e) {
- localState->dest.on_error(e);
- },
- // on_completed
- close
- );
- auto selectedSink = localState->coordinator.out(sink);
- source.subscribe(std::move(selectedSink));
- },
- // on_error
- [localState](rxu::error_ptr e) {
- localState->dest.on_error(e);
- },
- // on_completed
- []() {
- }
- );
- auto selectedSink = on_exception(
- [&](){return localState->coordinator.out(sink);},
- localState->dest);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
-
- void on_next(T v) const {
- auto localState = state;
- auto work = [v, localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_next(v);
- }
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_error(rxu::error_ptr e) const {
- auto localState = state;
- auto work = [e, localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_error(e);
- }
- localState->dest.on_error(e);
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- void on_completed() const {
- auto localState = state;
- auto work = [localState](const rxsc::schedulable&){
- for (auto s : localState->subj) {
- s.get_subscriber().on_completed();
- }
- localState->dest.on_completed();
- };
- auto selectedWork = on_exception(
- [&](){return localState->coordinator.act(work);},
- localState->dest);
- if (selectedWork.empty()) {
- return;
- }
- localState->worker.schedule(selectedWork.get());
- }
-
- static subscriber<T, observer_type> make(dest_type d, window_toggle_values v) {
- auto cs = composite_subscription();
- auto coordinator = v.coordination.create_coordinator(d.get_subscription());
-
- return make_subscriber<T>(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator))));
- }
- };
-
- template<class Subscriber>
- auto operator()(Subscriber dest) const
- -> decltype(window_toggle_observer<Subscriber>::make(std::move(dest), initial)) {
- return window_toggle_observer<Subscriber>::make(std::move(dest), initial);
- }
-};
-
-}
-
-/*! @copydoc rx-window_toggle.hpp
-*/
-template<class... AN>
-auto window_toggle(AN&&... an)
- -> operator_factory<window_toggle_tag, AN...> {
- return operator_factory<window_toggle_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<window_toggle_tag>
-{
- template<class Observable, class Openings, class ClosingSelector,
- class ClosingSelectorType = rxu::decay_t<ClosingSelector>,
- class OpeningsType = rxu::decay_t<Openings>,
- class OpeningsValueType = typename OpeningsType::value_type,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Openings, rxu::result_of_t<ClosingSelectorType(OpeningsValueType)>>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowToggle = rxo::detail::window_toggle<SourceValue, rxu::decay_t<Openings>, rxu::decay_t<ClosingSelector>, identity_one_worker>,
- class Value = observable<SourceValue>>
- static auto member(Observable&& o, Openings&& openings, ClosingSelector&& closingSelector)
- -> decltype(o.template lift<Value>(WindowToggle(std::forward<Openings>(openings), std::forward<ClosingSelector>(closingSelector), identity_immediate()))) {
- return o.template lift<Value>(WindowToggle(std::forward<Openings>(openings), std::forward<ClosingSelector>(closingSelector), identity_immediate()));
- }
-
- template<class Observable, class Openings, class ClosingSelector, class Coordination,
- class ClosingSelectorType = rxu::decay_t<ClosingSelector>,
- class OpeningsType = rxu::decay_t<Openings>,
- class OpeningsValueType = typename OpeningsType::value_type,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, Openings, rxu::result_of_t<ClosingSelectorType(OpeningsValueType)>>,
- is_coordination<Coordination>>,
- class SourceValue = rxu::value_type_t<Observable>,
- class WindowToggle = rxo::detail::window_toggle<SourceValue, rxu::decay_t<Openings>, rxu::decay_t<ClosingSelector>, rxu::decay_t<Coordination>>,
- class Value = observable<SourceValue>>
- static auto member(Observable&& o, Openings&& openings, ClosingSelector&& closingSelector, Coordination&& cn)
- -> decltype(o.template lift<Value>(WindowToggle(std::forward<Openings>(openings), std::forward<ClosingSelector>(closingSelector), std::forward<Coordination>(cn)))) {
- return o.template lift<Value>(WindowToggle(std::forward<Openings>(openings), std::forward<ClosingSelector>(closingSelector), std::forward<Coordination>(cn)));
- }
-
- template<class... AN>
- static operators::detail::window_toggle_invalid_t<AN...> member(AN...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "window_toggle takes (Openings, ClosingSelector, optional Coordination)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp b/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp
deleted file mode 100644
index 616e5d8..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-with_latest_from.hpp
-
- \brief For each item from the first observable select the latest value from all the observables to emit from the new observable that is returned.
-
- \tparam AN types of scheduler (optional), aggregate function (optional), and source observables
-
- \param an scheduler (optional), aggregation function (optional), and source observables
-
- \return Observable that emits items that are the result of combining the items emitted by the source observables.
-
- If scheduler is omitted, identity_current_thread is used.
-
- If aggregation function is omitted, the resulting observable returns tuples of emitted items.
-
- \sample
-
- Neither scheduler nor aggregation function are present:
- \snippet with_latest_from.cpp with_latest_from sample
- \snippet output.txt with_latest_from sample
-
- Only scheduler is present:
- \snippet with_latest_from.cpp Coordination with_latest_from sample
- \snippet output.txt Coordination with_latest_from sample
-
- Only aggregation function is present:
- \snippet with_latest_from.cpp Selector with_latest_from sample
- \snippet output.txt Selector with_latest_from sample
-
- Both scheduler and aggregation function are present:
- \snippet with_latest_from.cpp Coordination+Selector with_latest_from sample
- \snippet output.txt Coordination+Selector with_latest_from sample
-*/
-
-#if !defined(RXCPP_OPERATORS_RX_WITH_LATEST_FROM_HPP)
-#define RXCPP_OPERATORS_RX_WITH_LATEST_FROM_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class... AN>
-struct with_latest_from_invalid_arguments {};
-
-template<class... AN>
-struct with_latest_from_invalid : public rxo::operator_base<with_latest_from_invalid_arguments<AN...>> {
- using type = observable<with_latest_from_invalid_arguments<AN...>, with_latest_from_invalid<AN...>>;
-};
-template<class... AN>
-using with_latest_from_invalid_t = typename with_latest_from_invalid<AN...>::type;
-
-template<class Selector, class... ObservableN>
-struct is_with_latest_from_selector_check {
- typedef rxu::decay_t<Selector> selector_type;
-
- struct tag_not_valid;
- template<class CS, class... CON>
- static auto check(int) -> decltype((*(CS*)nullptr)((*(typename CON::value_type*)nullptr)...));
- template<class CS, class... CON>
- static tag_not_valid check(...);
-
- using type = decltype(check<selector_type, rxu::decay_t<ObservableN>...>(0));
-
- static const bool value = !std::is_same<type, tag_not_valid>::value;
-};
-
-template<class Selector, class... ObservableN>
-struct invalid_with_latest_from_selector {
- static const bool value = false;
-};
-
-template<class Selector, class... ObservableN>
-struct is_with_latest_from_selector : public std::conditional<
- is_with_latest_from_selector_check<Selector, ObservableN...>::value,
- is_with_latest_from_selector_check<Selector, ObservableN...>,
- invalid_with_latest_from_selector<Selector, ObservableN...>>::type {
-};
-
-template<class Selector, class... ON>
-using result_with_latest_from_selector_t = typename is_with_latest_from_selector<Selector, ON...>::type;
-
-template<class Coordination, class Selector, class... ObservableN>
-struct with_latest_from_traits {
-
- typedef std::tuple<ObservableN...> tuple_source_type;
- typedef std::tuple<rxu::detail::maybe<typename ObservableN::value_type>...> tuple_source_value_type;
-
- typedef rxu::decay_t<Selector> selector_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename is_with_latest_from_selector<selector_type, ObservableN...>::type value_type;
-};
-
-template<class Coordination, class Selector, class... ObservableN>
-struct with_latest_from : public operator_base<rxu::value_type_t<with_latest_from_traits<Coordination, Selector, ObservableN...>>>
-{
- typedef with_latest_from<Coordination, Selector, ObservableN...> this_type;
-
- typedef with_latest_from_traits<Coordination, Selector, ObservableN...> traits;
-
- typedef typename traits::tuple_source_type tuple_source_type;
- typedef typename traits::tuple_source_value_type tuple_source_value_type;
-
- typedef typename traits::selector_type selector_type;
-
- typedef typename traits::coordination_type coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(tuple_source_type o, selector_type s, coordination_type sf)
- : source(std::move(o))
- , selector(std::move(s))
- , coordination(std::move(sf))
- {
- }
- tuple_source_type source;
- selector_type selector;
- coordination_type coordination;
- };
- values initial;
-
- with_latest_from(coordination_type sf, selector_type s, tuple_source_type ts)
- : initial(std::move(ts), std::move(s), std::move(sf))
- {
- }
-
- template<int Index, class State>
- void subscribe_one(std::shared_ptr<State> state) const {
-
- typedef typename std::tuple_element<Index, tuple_source_type>::type::value_type source_value_type;
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(innercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(std::get<Index>(state->source));},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- innercs,
- // on_next
- [state](source_value_type st) {
- auto& value = std::get<Index>(state->latest);
-
- if (value.empty()) {
- ++state->valuesSet;
- }
-
- value.reset(st);
-
- if (state->valuesSet == sizeof... (ObservableN) && Index == 0) {
- auto values = rxu::surely(state->latest);
- auto selectedResult = rxu::apply(values, state->selector);
- state->out.on_next(selectedResult);
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
- template<class State, int... IndexN>
- void subscribe_all(std::shared_ptr<State> state, rxu::values<int, IndexN...>) const {
- bool subscribed[] = {(subscribe_one<(sizeof...(IndexN)) - 1 - IndexN>(state), true)...};
- subscribed[0] = (*subscribed); // silence warning
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct with_latest_from_state_type
- : public std::enable_shared_from_this<with_latest_from_state_type>
- , public values
- {
- with_latest_from_state_type(values i, coordinator_type coor, output_type oarg)
- : values(std::move(i))
- , pendingCompletions(sizeof... (ObservableN))
- , valuesSet(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
-
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- mutable int pendingCompletions;
- mutable int valuesSet;
- mutable tuple_source_value_type latest;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<with_latest_from_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- subscribe_all(state, typename rxu::values_from<int, sizeof...(ObservableN)>::type());
- }
-};
-
-}
-
-/*! @copydoc rx-with_latest_from.hpp
-*/
-template<class... AN>
-auto with_latest_from(AN&&... an)
- -> operator_factory<with_latest_from_tag, AN...> {
- return operator_factory<with_latest_from_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<with_latest_from_tag>
-{
- template<class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, ObservableN...>>,
- class with_latest_from = rxo::detail::with_latest_from<identity_one_worker, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<with_latest_from>,
- class Result = observable<Value, with_latest_from>>
- static Result member(Observable&& o, ObservableN&&... on)
- {
- return Result(with_latest_from(identity_current_thread(), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Observable, class Selector, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- operators::detail::is_with_latest_from_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class with_latest_from = rxo::detail::with_latest_from<identity_one_worker, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<with_latest_from>,
- class Result = observable<Value, with_latest_from>>
- static Result member(Observable&& o, Selector&& s, ObservableN&&... on)
- {
- return Result(with_latest_from(identity_current_thread(), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- all_observables<Observable, ObservableN...>>,
- class with_latest_from = rxo::detail::with_latest_from<Coordination, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<with_latest_from>,
- class Result = observable<Value, with_latest_from>>
- static Result member(Observable&& o, Coordination&& cn, ObservableN&&... on)
- {
- return Result(with_latest_from(std::forward<Coordination>(cn), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Selector, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- operators::detail::is_with_latest_from_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class with_latest_from = rxo::detail::with_latest_from<Coordination, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<with_latest_from>,
- class Result = observable<Value, with_latest_from>>
- static Result member(Observable&& o, Coordination&& cn, Selector&& s, ObservableN&&... on)
- {
- return Result(with_latest_from(std::forward<Coordination>(cn), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class... AN>
- static operators::detail::with_latest_from_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "with_latest_from takes (optional Coordination, optional Selector, required Observable, optional Observable...), Selector takes (Observable::value_type...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp
deleted file mode 100644
index b8169fd..0000000
--- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp
+++ /dev/null
@@ -1,344 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_OPERATORS_RX_ZIP_HPP)
-#define RXCPP_OPERATORS_RX_ZIP_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-zip.hpp
-
- \brief Bring by one item from all given observables and select a value to emit from the new observable that is returned.
-
- \tparam AN types of scheduler (optional), aggregate function (optional), and source observables
-
- \param an scheduler (optional), aggregation function (optional), and source observables
-
- \return Observable that emits the result of combining the items emitted and brought by one from each of the source observables.
-
- If scheduler is omitted, identity_current_thread is used.
-
- If aggregation function is omitted, the resulting observable returns tuples of emitted items.
-
- \sample
-
- Neither scheduler nor aggregation function are present:
- \snippet zip.cpp zip sample
- \snippet output.txt zip sample
-
- Only scheduler is present:
- \snippet zip.cpp Coordination zip sample
- \snippet output.txt Coordination zip sample
-
- Only aggregation function is present:
- \snippet zip.cpp Selector zip sample
- \snippet output.txt Selector zip sample
-
- Both scheduler and aggregation function are present:
- \snippet zip.cpp Coordination+Selector zip sample
- \snippet output.txt Coordination+Selector zip sample
-*/
-
-namespace rxcpp {
-
-namespace operators {
-
-namespace detail {
-
-template<class Observable>
-struct zip_source_state
-{
- using value_type = rxu::value_type_t<Observable>;
- zip_source_state()
- : completed(false)
- {
- }
- std::list<value_type> values;
- bool completed;
-};
-
-struct values_not_empty {
- template<class Observable>
- bool operator()(zip_source_state<Observable>& source) const {
- return !source.values.empty();
- }
-};
-
-struct source_completed_values_empty {
- template<class Observable>
- bool operator()(zip_source_state<Observable>& source) const {
- return source.completed && source.values.empty();
- }
-};
-
-struct extract_value_front {
- template<class Observable, class Value = rxu::value_type_t<Observable>>
- Value operator()(zip_source_state<Observable>& source) const {
- auto val = std::move(source.values.front());
- source.values.pop_front();
- return val;
- }
-};
-
-template<class... AN>
-struct zip_invalid_arguments {};
-
-template<class... AN>
-struct zip_invalid : public rxo::operator_base<zip_invalid_arguments<AN...>> {
- using type = observable<zip_invalid_arguments<AN...>, zip_invalid<AN...>>;
-};
-template<class... AN>
-using zip_invalid_t = typename zip_invalid<AN...>::type;
-
-template<class Selector, class... ObservableN>
-struct is_zip_selector_check {
- typedef rxu::decay_t<Selector> selector_type;
-
- struct tag_not_valid;
- template<class CS, class... CON>
- static auto check(int) -> decltype((*(CS*)nullptr)((*(typename CON::value_type*)nullptr)...));
- template<class CS, class... CON>
- static tag_not_valid check(...);
-
- using type = decltype(check<selector_type, rxu::decay_t<ObservableN>...>(0));
-
- static const bool value = !std::is_same<type, tag_not_valid>::value;
-};
-
-template<class Selector, class... ObservableN>
-struct invalid_zip_selector {
- static const bool value = false;
-};
-
-template<class Selector, class... ObservableN>
-struct is_zip_selector : public std::conditional<
- is_zip_selector_check<Selector, ObservableN...>::value,
- is_zip_selector_check<Selector, ObservableN...>,
- invalid_zip_selector<Selector, ObservableN...>>::type {
-};
-
-template<class Selector, class... ON>
-using result_zip_selector_t = typename is_zip_selector<Selector, ON...>::type;
-
-template<class Coordination, class Selector, class... ObservableN>
-struct zip_traits {
- typedef std::tuple<rxu::decay_t<ObservableN>...> tuple_source_type;
- typedef std::tuple<zip_source_state<ObservableN>...> tuple_source_values_type;
-
- typedef rxu::decay_t<Selector> selector_type;
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename is_zip_selector<selector_type, ObservableN...>::type value_type;
-};
-
-template<class Coordination, class Selector, class... ObservableN>
-struct zip : public operator_base<rxu::value_type_t<zip_traits<Coordination, Selector, ObservableN...>>>
-{
- typedef zip<Coordination, Selector, ObservableN...> this_type;
-
- typedef zip_traits<Coordination, Selector, ObservableN...> traits;
-
- typedef typename traits::tuple_source_type tuple_source_type;
- typedef typename traits::tuple_source_values_type tuple_source_values_type;
-
- typedef typename traits::selector_type selector_type;
-
- typedef typename traits::coordination_type coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct values
- {
- values(tuple_source_type o, selector_type s, coordination_type sf)
- : source(std::move(o))
- , selector(std::move(s))
- , coordination(std::move(sf))
- {
- }
- tuple_source_type source;
- selector_type selector;
- coordination_type coordination;
- };
- values initial;
-
- zip(coordination_type sf, selector_type s, tuple_source_type ts)
- : initial(std::move(ts), std::move(s), std::move(sf))
- {
- }
-
- template<int Index, class State>
- void subscribe_one(std::shared_ptr<State> state) const {
-
- typedef typename std::tuple_element<Index, tuple_source_type>::type::value_type source_value_type;
-
- composite_subscription innercs;
-
- // when the out observer is unsubscribed all the
- // inner subscriptions are unsubscribed as well
- state->out.add(innercs);
-
- auto source = on_exception(
- [&](){return state->coordinator.in(std::get<Index>(state->source));},
- state->out);
- if (source.empty()) {
- return;
- }
-
- // this subscribe does not share the observer subscription
- // so that when it is unsubscribed the observer can be called
- // until the inner subscriptions have finished
- auto sink = make_subscriber<source_value_type>(
- state->out,
- innercs,
- // on_next
- [state](source_value_type st) {
- auto& values = std::get<Index>(state->pending).values;
- values.push_back(st);
- if (rxu::apply_to_each(state->pending, values_not_empty(), rxu::all_values_true())) {
- auto selectedResult = rxu::apply_to_each(state->pending, extract_value_front(), state->selector);
- state->out.on_next(selectedResult);
- }
- if (rxu::apply_to_each(state->pending, source_completed_values_empty(), rxu::any_value_true())) {
- state->out.on_completed();
- }
- },
- // on_error
- [state](rxu::error_ptr e) {
- state->out.on_error(e);
- },
- // on_completed
- [state]() {
- auto& completed = std::get<Index>(state->pending).completed;
- completed = true;
- if (--state->pendingCompletions == 0) {
- state->out.on_completed();
- }
- }
- );
- auto selectedSink = on_exception(
- [&](){return state->coordinator.out(sink);},
- state->out);
- if (selectedSink.empty()) {
- return;
- }
- source->subscribe(std::move(selectedSink.get()));
- }
- template<class State, int... IndexN>
- void subscribe_all(std::shared_ptr<State> state, rxu::values<int, IndexN...>) const {
- bool subscribed[] = {(subscribe_one<IndexN>(state), true)...};
- subscribed[0] = (*subscribed); // silence warning
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber scbr) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef Subscriber output_type;
-
- struct zip_state_type
- : public std::enable_shared_from_this<zip_state_type>
- , public values
- {
- zip_state_type(values i, coordinator_type coor, output_type oarg)
- : values(std::move(i))
- , pendingCompletions(sizeof... (ObservableN))
- , valuesSet(0)
- , coordinator(std::move(coor))
- , out(std::move(oarg))
- {
- }
-
- // on_completed on the output must wait until all the
- // subscriptions have received on_completed
- mutable int pendingCompletions;
- mutable int valuesSet;
- mutable tuple_source_values_type pending;
- coordinator_type coordinator;
- output_type out;
- };
-
- auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription());
-
- // take a copy of the values for each subscription
- auto state = std::make_shared<zip_state_type>(initial, std::move(coordinator), std::move(scbr));
-
- subscribe_all(state, typename rxu::values_from<int, sizeof...(ObservableN)>::type());
- }
-};
-
-}
-
-/*! @copydoc rx-zip.hpp
-*/
-template<class... AN>
-auto zip(AN&&... an)
- -> operator_factory<zip_tag, AN...> {
- return operator_factory<zip_tag, AN...>(std::make_tuple(std::forward<AN>(an)...));
-}
-
-}
-
-template<>
-struct member_overload<zip_tag>
-{
- template<class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- all_observables<Observable, ObservableN...>>,
- class Zip = rxo::detail::zip<identity_one_worker, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<Zip>,
- class Result = observable<Value, Zip>>
- static Result member(Observable&& o, ObservableN&&... on)
- {
- return Result(Zip(identity_current_thread(), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Observable, class Selector, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- operators::detail::is_zip_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class Zip = rxo::detail::zip<identity_one_worker, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<Zip>,
- class Result = observable<Value, Zip>>
- static Result member(Observable&& o, Selector&& s, ObservableN&&... on)
- {
- return Result(Zip(identity_current_thread(), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- all_observables<Observable, ObservableN...>>,
- class Zip = rxo::detail::zip<Coordination, rxu::detail::pack, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<Zip>,
- class Result = observable<Value, Zip>>
- static Result member(Observable&& o, Coordination&& cn, ObservableN&&... on)
- {
- return Result(Zip(std::forward<Coordination>(cn), rxu::pack(), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class Coordination, class Selector, class Observable, class... ObservableN,
- class Enabled = rxu::enable_if_all_true_type_t<
- is_coordination<Coordination>,
- operators::detail::is_zip_selector<Selector, Observable, ObservableN...>,
- all_observables<Observable, ObservableN...>>,
- class ResolvedSelector = rxu::decay_t<Selector>,
- class Zip = rxo::detail::zip<Coordination, ResolvedSelector, rxu::decay_t<Observable>, rxu::decay_t<ObservableN>...>,
- class Value = rxu::value_type_t<Zip>,
- class Result = observable<Value, Zip>>
- static Result member(Observable&& o, Coordination&& cn, Selector&& s, ObservableN&&... on)
- {
- return Result(Zip(std::forward<Coordination>(cn), std::forward<Selector>(s), std::make_tuple(std::forward<Observable>(o), std::forward<ObservableN>(on)...)));
- }
-
- template<class... AN>
- static operators::detail::zip_invalid_t<AN...> member(const AN&...) {
- std::terminate();
- return {};
- static_assert(sizeof...(AN) == 10000, "zip takes (optional Coordination, optional Selector, required Observable, optional Observable...), Selector takes (Observable::value_type...)");
- }
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-composite_exception.hpp b/Rx/v2/src/rxcpp/rx-composite_exception.hpp
deleted file mode 100644
index cddd03e..0000000
--- a/Rx/v2/src/rxcpp/rx-composite_exception.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_COMPOSITE_EXCEPTION_HPP)
-#define RXCPP_SOURCES_RX_COMPOSITE_EXCEPTION_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-struct composite_exception : std::exception {
-
- typedef std::vector<rxu::error_ptr> exception_values;
-
- virtual const char *what() const RXCPP_NOEXCEPT override {
- return "rxcpp composite exception";
- }
-
- virtual bool empty() const {
- return exceptions.empty();
- }
-
- virtual composite_exception add(rxu::error_ptr exception_ptr) {
- exceptions.push_back(exception_ptr);
- return *this;
- }
-
- exception_values exceptions;
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp
deleted file mode 100644
index 7038e24..0000000
--- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_CONNECTABLE_OBSERVABLE_HPP)
-#define RXCPP_RX_CONNECTABLE_OBSERVABLE_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace detail {
-
-template<class T>
-struct has_on_connect
-{
- struct not_void {};
- template<class CT>
- static auto check(int) -> decltype((*(CT*)nullptr).on_connect(composite_subscription()));
- template<class CT>
- static not_void check(...);
-
- typedef decltype(check<T>(0)) detail_result;
- static const bool value = std::is_same<detail_result, void>::value;
-};
-
-}
-
-template<class T>
-class dynamic_connectable_observable
- : public dynamic_observable<T>
-{
- struct state_type
- : public std::enable_shared_from_this<state_type>
- {
- typedef std::function<void(composite_subscription)> onconnect_type;
-
- onconnect_type on_connect;
- };
- std::shared_ptr<state_type> state;
-
- template<class U>
- void construct(const dynamic_observable<U>& o, tag_dynamic_observable&&) {
- state = o.state;
- }
-
- template<class U>
- void construct(dynamic_observable<U>&& o, tag_dynamic_observable&&) {
- state = std::move(o.state);
- }
-
- template<class SO>
- void construct(SO&& source, rxs::tag_source&&) {
- auto so = std::make_shared<rxu::decay_t<SO>>(std::forward<SO>(source));
- state->on_connect = [so](composite_subscription cs) mutable {
- so->on_connect(std::move(cs));
- };
- }
-
-public:
-
- typedef tag_dynamic_observable dynamic_observable_tag;
-
- dynamic_connectable_observable()
- {
- }
-
- template<class SOF>
- explicit dynamic_connectable_observable(SOF sof)
- : dynamic_observable<T>(sof)
- , state(std::make_shared<state_type>())
- {
- construct(std::move(sof),
- typename std::conditional<is_dynamic_observable<SOF>::value, tag_dynamic_observable, rxs::tag_source>::type());
- }
-
- template<class SF, class CF>
- dynamic_connectable_observable(SF&& sf, CF&& cf)
- : dynamic_observable<T>(std::forward<SF>(sf))
- , state(std::make_shared<state_type>())
- {
- state->on_connect = std::forward<CF>(cf);
- }
-
- using dynamic_observable<T>::on_subscribe;
-
- void on_connect(composite_subscription cs) const {
- state->on_connect(std::move(cs));
- }
-};
-
-template<class T, class Source>
-connectable_observable<T> make_dynamic_connectable_observable(Source&& s) {
- return connectable_observable<T>(dynamic_connectable_observable<T>(std::forward<Source>(s)));
-}
-
-
-/*!
- \brief a source of values that is shared across all subscribers and does not start until connectable_observable::connect() is called.
-
- \ingroup group-observable
-
-*/
-template<class T, class SourceOperator>
-class connectable_observable
- : public observable<T, SourceOperator>
-{
- typedef connectable_observable<T, SourceOperator> this_type;
- typedef observable<T, SourceOperator> base_type;
- typedef rxu::decay_t<SourceOperator> source_operator_type;
-
- static_assert(detail::has_on_connect<source_operator_type>::value, "inner must have on_connect method void(composite_subscription)");
-
-public:
- typedef tag_connectable_observable observable_tag;
-
- connectable_observable()
- {
- }
-
- explicit connectable_observable(const SourceOperator& o)
- : base_type(o)
- {
- }
- explicit connectable_observable(SourceOperator&& o)
- : base_type(std::move(o))
- {
- }
-
- // implicit conversion between observables of the same value_type
- template<class SO>
- connectable_observable(const connectable_observable<T, SO>& o)
- : base_type(o)
- {}
- // implicit conversion between observables of the same value_type
- template<class SO>
- connectable_observable(connectable_observable<T, SO>&& o)
- : base_type(std::move(o))
- {}
-
- ///
- /// takes any function that will take this observable and produce a result value.
- /// this is intended to allow externally defined operators, that use subscribe,
- /// to be connected into the expression.
- ///
- template<class OperatorFactory>
- auto op(OperatorFactory&& of) const
- -> decltype(of(*(const this_type*)nullptr)) {
- return of(*this);
- static_assert(is_operator_factory_for<this_type, OperatorFactory>::value, "Function passed for op() must have the signature Result(SourceObservable)");
- }
-
- ///
- /// performs type-forgetting conversion to a new composite_observable
- ///
- connectable_observable<T> as_dynamic() {
- return *this;
- }
-
- composite_subscription connect(composite_subscription cs = composite_subscription()) {
- base_type::source_operator.on_connect(cs);
- return cs;
- }
-
- /*! @copydoc rx-ref_count.hpp
- */
- template<class... AN>
- auto ref_count(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(ref_count_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(ref_count_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-connect_forever.hpp
- */
- template<class... AN>
- auto connect_forever(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(connect_forever_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(connect_forever_tag{}, *this, std::forward<AN>(an)...);
- }
-};
-
-
-}
-
-//
-// support range() >> filter() >> subscribe() syntax
-// '>>' is spelled 'stream'
-//
-template<class T, class SourceOperator, class OperatorFactory>
-auto operator >> (const rxcpp::connectable_observable<T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-//
-// support range() | filter() | subscribe() syntax
-// '|' is spelled 'pipe'
-//
-template<class T, class SourceOperator, class OperatorFactory>
-auto operator | (const rxcpp::connectable_observable<T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp
deleted file mode 100644
index 34e1223..0000000
--- a/Rx/v2/src/rxcpp/rx-coordination.hpp
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_COORDINATION_HPP)
-#define RXCPP_RX_COORDINATION_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-struct tag_coordinator {};
-struct coordinator_base {typedef tag_coordinator coordinator_tag;};
-
-template<class T, class C = rxu::types_checked>
-struct is_coordinator : public std::false_type {};
-
-template<class T>
-struct is_coordinator<T, typename rxu::types_checked_from<typename T::coordinator_tag>::type>
- : public std::is_convertible<typename T::coordinator_tag*, tag_coordinator*> {};
-
-struct tag_coordination {};
-struct coordination_base {typedef tag_coordination coordination_tag;};
-
-namespace detail {
-
-template<class T, class C = rxu::types_checked>
-struct is_coordination : public std::false_type {};
-
-template<class T>
-struct is_coordination<T, typename rxu::types_checked_from<typename T::coordination_tag>::type>
- : public std::is_convertible<typename T::coordination_tag*, tag_coordination*> {};
-
-}
-
-template<class T, class Decayed = rxu::decay_t<T>>
-struct is_coordination : detail::is_coordination<Decayed>
-{
-};
-
-template<class Coordination, class DecayedCoordination = rxu::decay_t<Coordination>>
-using coordination_tag_t = typename DecayedCoordination::coordination_tag;
-
-template<class Input>
-class coordinator : public coordinator_base
-{
-public:
- typedef Input input_type;
-
-private:
- struct not_supported {typedef not_supported type;};
-
- template<class Observable>
- struct get_observable
- {
- typedef decltype((*(input_type*)nullptr).in((*(Observable*)nullptr))) type;
- };
-
- template<class Subscriber>
- struct get_subscriber
- {
- typedef decltype((*(input_type*)nullptr).out((*(Subscriber*)nullptr))) type;
- };
-
- template<class F>
- struct get_action_function
- {
- typedef decltype((*(input_type*)nullptr).act((*(F*)nullptr))) type;
- };
-
-public:
- input_type input;
-
- template<class T>
- struct get
- {
- typedef typename std::conditional<
- rxsc::detail::is_action_function<T>::value, get_action_function<T>, typename std::conditional<
- is_observable<T>::value, get_observable<T>, typename std::conditional<
- is_subscriber<T>::value, get_subscriber<T>, not_supported>::type>::type>::type::type type;
- };
-
- coordinator(Input i) : input(i) {}
-
- rxsc::worker get_worker() const {
- return input.get_worker();
- }
- rxsc::scheduler get_scheduler() const {
- return input.get_scheduler();
- }
-
- template<class Observable>
- auto in(Observable o) const
- -> typename get_observable<Observable>::type {
- return input.in(std::move(o));
- static_assert(is_observable<Observable>::value, "can only synchronize observables");
- }
-
- template<class Subscriber>
- auto out(Subscriber s) const
- -> typename get_subscriber<Subscriber>::type {
- return input.out(std::move(s));
- static_assert(is_subscriber<Subscriber>::value, "can only synchronize subscribers");
- }
-
- template<class F>
- auto act(F f) const
- -> typename get_action_function<F>::type {
- return input.act(std::move(f));
- static_assert(rxsc::detail::is_action_function<F>::value, "can only synchronize action functions");
- }
-};
-
-class identity_one_worker : public coordination_base
-{
- rxsc::scheduler factory;
-
- class input_type
- {
- rxsc::worker controller;
- rxsc::scheduler factory;
- public:
- explicit input_type(rxsc::worker w)
- : controller(w)
- , factory(rxsc::make_same_worker(w))
- {
- }
- inline rxsc::worker get_worker() const {
- return controller;
- }
- inline rxsc::scheduler get_scheduler() const {
- return factory;
- }
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
- template<class Observable>
- auto in(Observable o) const
- -> Observable {
- return o;
- }
- template<class Subscriber>
- auto out(Subscriber s) const
- -> Subscriber {
- return s;
- }
- template<class F>
- auto act(F f) const
- -> F {
- return f;
- }
- };
-
-public:
-
- explicit identity_one_worker(rxsc::scheduler sc) : factory(sc) {}
-
- typedef coordinator<input_type> coordinator_type;
-
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
-
- inline coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const {
- auto w = factory.create_worker(std::move(cs));
- return coordinator_type(input_type(std::move(w)));
- }
-};
-
-inline identity_one_worker identity_immediate() {
- static identity_one_worker r(rxsc::make_immediate());
- return r;
-}
-
-inline identity_one_worker identity_current_thread() {
- static identity_one_worker r(rxsc::make_current_thread());
- return r;
-}
-
-inline identity_one_worker identity_same_worker(rxsc::worker w) {
- return identity_one_worker(rxsc::make_same_worker(w));
-}
-
-class serialize_one_worker : public coordination_base
-{
- rxsc::scheduler factory;
-
- template<class F>
- struct serialize_action
- {
- F dest;
- std::shared_ptr<std::mutex> lock;
- serialize_action(F d, std::shared_ptr<std::mutex> m)
- : dest(std::move(d))
- , lock(std::move(m))
- {
- if (!lock) {
- std::terminate();
- }
- }
- auto operator()(const rxsc::schedulable& scbl) const
- -> decltype(dest(scbl)) {
- std::unique_lock<std::mutex> guard(*lock);
- return dest(scbl);
- }
- };
-
- template<class Observer>
- struct serialize_observer
- {
- typedef serialize_observer<Observer> this_type;
- typedef rxu::decay_t<Observer> dest_type;
- typedef typename dest_type::value_type value_type;
- typedef observer<value_type, this_type> observer_type;
- dest_type dest;
- std::shared_ptr<std::mutex> lock;
-
- serialize_observer(dest_type d, std::shared_ptr<std::mutex> m)
- : dest(std::move(d))
- , lock(std::move(m))
- {
- if (!lock) {
- std::terminate();
- }
- }
- void on_next(value_type v) const {
- std::unique_lock<std::mutex> guard(*lock);
- dest.on_next(v);
- }
- void on_error(rxu::error_ptr e) const {
- std::unique_lock<std::mutex> guard(*lock);
- dest.on_error(e);
- }
- void on_completed() const {
- std::unique_lock<std::mutex> guard(*lock);
- dest.on_completed();
- }
-
- template<class Subscriber>
- static subscriber<value_type, observer_type> make(const Subscriber& s, std::shared_ptr<std::mutex> m) {
- return make_subscriber<value_type>(s, observer_type(this_type(s.get_observer(), std::move(m))));
- }
- };
-
- class input_type
- {
- rxsc::worker controller;
- rxsc::scheduler factory;
- std::shared_ptr<std::mutex> lock;
- public:
- explicit input_type(rxsc::worker w, std::shared_ptr<std::mutex> m)
- : controller(w)
- , factory(rxsc::make_same_worker(w))
- , lock(std::move(m))
- {
- }
- inline rxsc::worker get_worker() const {
- return controller;
- }
- inline rxsc::scheduler get_scheduler() const {
- return factory;
- }
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
- template<class Observable>
- auto in(Observable o) const
- -> Observable {
- return o;
- }
- template<class Subscriber>
- auto out(const Subscriber& s) const
- -> decltype(serialize_observer<decltype(s.get_observer())>::make(s, lock)) {
- return serialize_observer<decltype(s.get_observer())>::make(s, lock);
- }
- template<class F>
- auto act(F f) const
- -> serialize_action<F> {
- return serialize_action<F>(std::move(f), lock);
- }
- };
-
-public:
-
- explicit serialize_one_worker(rxsc::scheduler sc) : factory(sc) {}
-
- typedef coordinator<input_type> coordinator_type;
-
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
-
- inline coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const {
- auto w = factory.create_worker(std::move(cs));
- std::shared_ptr<std::mutex> lock = std::make_shared<std::mutex>();
- return coordinator_type(input_type(std::move(w), std::move(lock)));
- }
-};
-
-inline serialize_one_worker serialize_event_loop() {
- static serialize_one_worker r(rxsc::make_event_loop());
- return r;
-}
-
-inline serialize_one_worker serialize_new_thread() {
- static serialize_one_worker r(rxsc::make_new_thread());
- return r;
-}
-
-inline serialize_one_worker serialize_same_worker(rxsc::worker w) {
- return serialize_one_worker(rxsc::make_same_worker(w));
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-coroutine.hpp b/Rx/v2/src/rxcpp/rx-coroutine.hpp
deleted file mode 100644
index 317f867..0000000
--- a/Rx/v2/src/rxcpp/rx-coroutine.hpp
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-/*! \file rx-coroutine.hpp
-
- \brief The proposal to add couroutines to the standard adds `co_await`, `for co_await`, `co_yield` and `co_return`. This file adds `begin(observable<>)` & `end(observable<>)` which enables `for co_await` to work with the `observable<>` type.
-
- for co_await (auto c : interval(seconds(1), observe_on_event_loop()) | take(3)) {
- printf("%d\n", c);
- }
-
-*/
-
-#if !defined(RXCPP_RX_COROUTINE_HPP)
-#define RXCPP_RX_COROUTINE_HPP
-
-#include "rx-includes.hpp"
-
-#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
-
-#include <rxcpp/operators/rx-finally.hpp>
-
-#include <experimental/resumable>
-
-namespace rxcpp {
-namespace coroutine {
-
-using namespace std;
-using namespace std::chrono;
-using namespace std::experimental;
-
-template<typename Source>
-struct co_observable_iterator;
-
-template<typename Source>
-struct co_observable_iterator_state : std::enable_shared_from_this<co_observable_iterator_state<Source>>
-{
- using value_type = typename Source::value_type;
-
- ~co_observable_iterator_state() {
- lifetime.unsubscribe();
- }
- explicit co_observable_iterator_state(const Source& o) : o(o) {}
-
- coroutine_handle<> caller{};
- composite_subscription lifetime{};
- const value_type* value{nullptr};
- exception_ptr error{nullptr};
- Source o;
-};
-
-template<typename Source>
-struct co_observable_inc_awaiter
-{
- bool await_ready() {
- return false;
- }
-
- bool await_suspend(coroutine_handle<> handle) {
- if (!state->lifetime.is_subscribed()) {return false;}
- state->caller = handle;
- return true;
- }
-
- co_observable_iterator<Source> await_resume();
-
- shared_ptr<co_observable_iterator_state<Source>> state;
-};
-
-template<typename Source>
-struct co_observable_iterator : public iterator<input_iterator_tag, typename Source::value_type>
-{
- using value_type = typename Source::value_type;
-
- co_observable_iterator() {}
-
- explicit co_observable_iterator(const Source& o) : state(make_shared<co_observable_iterator_state<Source>>(o)) {}
- explicit co_observable_iterator(const shared_ptr<co_observable_iterator_state<Source>>& o) : state(o) {}
-
- co_observable_iterator(co_observable_iterator&&)=default;
- co_observable_iterator& operator=(co_observable_iterator&&)=default;
-
- co_observable_inc_awaiter<Source> operator++()
- {
- return co_observable_inc_awaiter<Source>{state};
- }
-
- co_observable_iterator& operator++(int) = delete;
- // not implementing postincrement
-
- bool operator==(co_observable_iterator const &rhs) const
- {
- return !!state && !rhs.state && !state->lifetime.is_subscribed();
- }
-
- bool operator!=(co_observable_iterator const &rhs) const
- {
- return !(*this == rhs);
- }
-
- value_type const &operator*() const
- {
- return *(state->value);
- }
-
- value_type const *operator->() const
- {
- return std::addressof(operator*());
- }
-
- shared_ptr<co_observable_iterator_state<Source>> state;
-};
-
-template<typename Source>
-co_observable_iterator<Source> co_observable_inc_awaiter<Source>::await_resume() {
- if (!!state->error) {rethrow_exception(state->error);}
- return co_observable_iterator<Source>{state};
-}
-
-template<typename Source>
-struct co_observable_iterator_awaiter
-{
- using iterator=co_observable_iterator<Source>;
- using value_type=typename iterator::value_type;
-
- explicit co_observable_iterator_awaiter(const Source& o) : it(o) {
- }
-
- bool await_ready() {
- return false;
- }
-
- void await_suspend(coroutine_handle<> handle) {
- weak_ptr<co_observable_iterator_state<Source>> wst=it.state;
- it.state->caller = handle;
- it.state->o |
- rxo::finally([wst](){
- auto st = wst.lock();
- if (st && !!st->caller) {
- auto caller = st->caller;
- st->caller = nullptr;
- caller();
- }
- }) |
- rxo::subscribe<value_type>(
- it.state->lifetime,
- // next
- [wst](const value_type& v){
- auto st = wst.lock();
- if (!st || !st->caller) {terminate();}
- st->value = addressof(v);
- auto caller = st->caller;
- st->caller = nullptr;
- caller();
- },
- // error
- [wst](exception_ptr e){
- auto st = wst.lock();
- if (!st || !st->caller) {terminate();}
- st->error = e;
- auto caller = st->caller;
- st->caller = nullptr;
- caller();
- });
- }
-
- iterator await_resume() {
- if (!!it.state->error) {rethrow_exception(it.state->error);}
- return std::move(it);
- }
-
- iterator it;
-};
-
-}
-}
-
-namespace std
-{
-
-template<typename T, typename SourceOperator>
-auto begin(const rxcpp::observable<T, SourceOperator>& o)
- -> rxcpp::coroutine::co_observable_iterator_awaiter<rxcpp::observable<T, SourceOperator>> {
- return rxcpp::coroutine::co_observable_iterator_awaiter<rxcpp::observable<T, SourceOperator>>{o};
-}
-
-template<typename T, typename SourceOperator>
-auto end(const rxcpp::observable<T, SourceOperator>&)
- -> rxcpp::coroutine::co_observable_iterator<rxcpp::observable<T, SourceOperator>> {
- return rxcpp::coroutine::co_observable_iterator<rxcpp::observable<T, SourceOperator>>{};
-}
-
-}
-
-#endif
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp
deleted file mode 100644
index 031bc53..0000000
--- a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_GROUPED_OBSERVABLE_HPP)
-#define RXCPP_RX_GROUPED_OBSERVABLE_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace detail {
-
-template<class K, class Source>
-struct has_on_get_key_for
-{
- struct not_void {};
- template<class CS>
- static auto check(int) -> decltype((*(CS*)nullptr).on_get_key());
- template<class CS>
- static not_void check(...);
-
- typedef decltype(check<Source>(0)) detail_result;
- static const bool value = std::is_same<detail_result, rxu::decay_t<K>>::value;
-};
-
-}
-
-template<class K, class T>
-class dynamic_grouped_observable
- : public dynamic_observable<T>
-{
-public:
- typedef rxu::decay_t<K> key_type;
- typedef tag_dynamic_grouped_observable dynamic_observable_tag;
-
-private:
- struct state_type
- : public std::enable_shared_from_this<state_type>
- {
- typedef std::function<key_type()> ongetkey_type;
-
- ongetkey_type on_get_key;
- };
- std::shared_ptr<state_type> state;
-
- template<class U, class V>
- friend bool operator==(const dynamic_grouped_observable<U, V>&, const dynamic_grouped_observable<U, V>&);
-
- template<class U, class V>
- void construct(const dynamic_grouped_observable<U, V>& o, const tag_dynamic_grouped_observable&) {
- state = o.state;
- }
-
- template<class U, class V>
- void construct(dynamic_grouped_observable<U, V>&& o, const tag_dynamic_grouped_observable&) {
- state = std::move(o.state);
- }
-
- template<class SO>
- void construct(SO&& source, const rxs::tag_source&) {
- auto so = std::make_shared<rxu::decay_t<SO>>(std::forward<SO>(source));
- state->on_get_key = [so]() mutable {
- return so->on_get_key();
- };
- }
-
-public:
-
- dynamic_grouped_observable()
- {
- }
-
- template<class SOF>
- explicit dynamic_grouped_observable(SOF sof)
- : dynamic_observable<T>(sof)
- , state(std::make_shared<state_type>())
- {
- construct(std::move(sof),
- typename std::conditional<is_dynamic_grouped_observable<SOF>::value, tag_dynamic_grouped_observable, rxs::tag_source>::type());
- }
-
- template<class SF, class CF>
- dynamic_grouped_observable(SF&& sf, CF&& cf)
- : dynamic_observable<T>(std::forward<SF>(sf))
- , state(std::make_shared<state_type>())
- {
- state->on_connect = std::forward<CF>(cf);
- }
-
- using dynamic_observable<T>::on_subscribe;
-
- key_type on_get_key() const {
- return state->on_get_key();
- }
-};
-
-template<class K, class T>
-inline bool operator==(const dynamic_grouped_observable<K, T>& lhs, const dynamic_grouped_observable<K, T>& rhs) {
- return lhs.state == rhs.state;
-}
-template<class K, class T>
-inline bool operator!=(const dynamic_grouped_observable<K, T>& lhs, const dynamic_grouped_observable<K, T>& rhs) {
- return !(lhs == rhs);
-}
-
-template<class K, class T, class Source>
-grouped_observable<K, T> make_dynamic_grouped_observable(Source&& s) {
- return grouped_observable<K, T>(dynamic_grouped_observable<K, T>(std::forward<Source>(s)));
-}
-
-
-
-/*!
- \brief a source of observables which each emit values from one category specified by the key selector.
-
- \ingroup group-observable
-
-*/
-template<class K, class T, class SourceOperator>
-class grouped_observable
- : public observable<T, SourceOperator>
-{
- typedef grouped_observable<K, T, SourceOperator> this_type;
- typedef observable<T, SourceOperator> base_type;
- typedef rxu::decay_t<SourceOperator> source_operator_type;
-
- static_assert(detail::has_on_get_key_for<K, source_operator_type>::value, "inner must have on_get_key method key_type()");
-
-public:
- typedef rxu::decay_t<K> key_type;
- typedef tag_grouped_observable observable_tag;
-
- grouped_observable()
- {
- }
-
- explicit grouped_observable(const SourceOperator& o)
- : base_type(o)
- {
- }
- explicit grouped_observable(SourceOperator&& o)
- : base_type(std::move(o))
- {
- }
-
- // implicit conversion between observables of the same value_type
- template<class SO>
- grouped_observable(const grouped_observable<K, T, SO>& o)
- : base_type(o)
- {}
- // implicit conversion between observables of the same value_type
- template<class SO>
- grouped_observable(grouped_observable<K, T, SO>&& o)
- : base_type(std::move(o))
- {}
-
- ///
- /// performs type-forgetting conversion to a new grouped_observable
- ///
- grouped_observable<K, T> as_dynamic() const {
- return *this;
- }
-
- key_type get_key() const {
- return base_type::source_operator.on_get_key();
- }
-};
-
-
-}
-
-//
-// support range() >> filter() >> subscribe() syntax
-// '>>' is spelled 'stream'
-//
-template<class K, class T, class SourceOperator, class OperatorFactory>
-auto operator >> (const rxcpp::grouped_observable<K, T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-//
-// support range() | filter() | subscribe() syntax
-// '|' is spelled 'pipe'
-//
-template<class K, class T, class SourceOperator, class OperatorFactory>
-auto operator | (const rxcpp::grouped_observable<K, T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp
deleted file mode 100644
index 1eb47db..0000000
--- a/Rx/v2/src/rxcpp/rx-includes.hpp
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_INCLUDES_HPP)
-#define RXCPP_RX_INCLUDES_HPP
-
-#include "rx-trace.hpp"
-
-// some configuration macros
-#if defined(_MSC_VER)
-
-#if _MSC_VER > 1600
-#pragma warning(disable: 4348) // false positives on : redefinition of default parameter : parameter 2
-#define RXCPP_USE_RVALUEREF 1
-#endif
-
-#if _MSC_VER >= 1800
-#define RXCPP_USE_VARIADIC_TEMPLATES 1
-#endif
-
-#if _CPPRTTI
-#define RXCPP_USE_RTTI 1
-#endif
-
-#if _HAS_EXCEPTIONS
-#define RXCPP_USE_EXCEPTIONS 1
-#endif
-
-#define RXCPP_NORETURN __declspec(noreturn)
-
-#elif defined(__clang__)
-
-#if __has_feature(cxx_rvalue_references)
-#define RXCPP_USE_RVALUEREF 1
-#endif
-#if __has_feature(cxx_rtti)
-#define RXCPP_USE_RTTI 1
-#endif
-#if __has_feature(cxx_variadic_templates)
-#define RXCPP_USE_VARIADIC_TEMPLATES 1
-#endif
-#if __has_feature(cxx_exceptions)
-#define RXCPP_USE_EXCEPTIONS 1
-#endif
-
-#if __has_feature(cxx_attributes)
-#define RXCPP_NORETURN [[noreturn]]
-#else
-#define RXCPP_NORETURN __attribute__ ((noreturn))
-#endif
-
-#elif defined(__GNUG__)
-
-#define GCC_VERSION (__GNUC__ * 10000 + \
- __GNUC_MINOR__ * 100 + \
- __GNUC_PATCHLEVEL__)
-
-#if GCC_VERSION >= 40801
-#define RXCPP_USE_RVALUEREF 1
-#endif
-
-#if GCC_VERSION >= 40400
-#define RXCPP_USE_VARIADIC_TEMPLATES 1
-#endif
-
-#if defined(__GXX_RTTI)
-#define RXCPP_USE_RTTI 1
-#endif
-
-#if defined(__EXCEPTIONS)
-#define RXCPP_USE_EXCEPTIONS 1
-#endif
-
-#define RXCPP_NORETURN __attribute__ ((noreturn))
-
-#endif
-
-//
-// control std::hash<> of enum
-// force with RXCPP_FORCE_HASH_ENUM & RXCPP_FORCE_HASH_ENUM_UNDERLYING
-// in time use ifdef to detect library support for std::hash<> of enum
-//
-#define RXCPP_HASH_ENUM 0
-#define RXCPP_HASH_ENUM_UNDERLYING 1
-
-#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
-#define RXCPP_USE_WINRT 0
-#else
-#define RXCPP_USE_WINRT 1
-#endif
-
-#if defined(__APPLE__) && defined(__MACH__)
-#include <TargetConditionals.h>
-#if (TARGET_OS_IPHONE == 1) || (TARGET_IPHONE_SIMULATOR == 1)
-#define RXCPP_ON_IOS
-#endif
-#endif
-
-#if defined(__ANDROID__)
-#define RXCPP_ON_ANDROID
-#endif
-
-#if defined(RXCPP_FORCE_USE_VARIADIC_TEMPLATES)
-#undef RXCPP_USE_VARIADIC_TEMPLATES
-#define RXCPP_USE_VARIADIC_TEMPLATES RXCPP_FORCE_USE_VARIADIC_TEMPLATES
-#endif
-
-#if defined(RXCPP_FORCE_USE_RVALUEREF)
-#undef RXCPP_USE_RVALUEREF
-#define RXCPP_USE_RVALUEREF RXCPP_FORCE_USE_RVALUEREF
-#endif
-
-#if defined(RXCPP_FORCE_USE_RTTI)
-#undef RXCPP_USE_RTTI
-#define RXCPP_USE_RTTI RXCPP_FORCE_USE_RTTI
-#endif
-
-#if defined(RXCPP_FORCE_USE_EXCEPTIONS)
-#undef RXCPP_USE_EXCEPTIONS
-#define RXCPP_USE_EXCEPTIONS RXCPP_FORCE_USE_EXCEPTIONS
-#endif
-
-#if defined(RXCPP_FORCE_USE_WINRT)
-#undef RXCPP_USE_WINRT
-#define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT
-#endif
-
-#if defined(RXCPP_FORCE_HASH_ENUM)
-#undef RXCPP_HASH_ENUM
-#define RXCPP_HASH_ENUM RXCPP_FORCE_HASH_ENUM
-#endif
-
-#if defined(RXCPP_FORCE_HASH_ENUM_UNDERLYING)
-#undef RXCPP_HASH_ENUM_UNDERLYING
-#define RXCPP_HASH_ENUM_UNDERLYING RXCPP_FORCE_HASH_ENUM_UNDERLYING
-#endif
-
-#if defined(RXCPP_FORCE_ON_IOS)
-#undef RXCPP_ON_IOS
-#define RXCPP_ON_IOS RXCPP_FORCE_ON_IOS
-#endif
-
-#if defined(RXCPP_FORCE_ON_ANDROID)
-#undef RXCPP_ON_ANDROID
-#define RXCPP_ON_ANDROID RXCPP_FORCE_ON_ANDROID
-#endif
-
-#if defined(_MSC_VER) && !RXCPP_USE_VARIADIC_TEMPLATES
-// resolve args needs enough to store all the possible resolved args
-#define _VARIADIC_MAX 10
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER <= 1800)
-#define RXCPP_NOEXCEPT
-#else
-#define RXCPP_NOEXCEPT noexcept
-#endif
-
-#pragma push_macro("min")
-#pragma push_macro("max")
-#undef min
-#undef max
-
-#include <stdlib.h>
-
-#include <cstddef>
-
-#include <iostream>
-#include <iomanip>
-
-#include <exception>
-#include <functional>
-#include <memory>
-#include <array>
-#include <vector>
-#include <algorithm>
-#include <atomic>
-#include <map>
-#include <set>
-#include <mutex>
-#include <deque>
-#include <thread>
-#include <future>
-#include <list>
-#include <queue>
-#include <chrono>
-#include <condition_variable>
-#include <initializer_list>
-#include <typeinfo>
-#include <tuple>
-#include <unordered_set>
-#include <type_traits>
-#include <utility>
-
-#if defined(RXCPP_ON_IOS) || defined(RXCPP_ON_ANDROID)
-#include <pthread.h>
-#endif
-
-#include "rx-util.hpp"
-#include "rx-predef.hpp"
-#include "rx-subscription.hpp"
-#include "rx-observer.hpp"
-#include "rx-scheduler.hpp"
-#include "rx-subscriber.hpp"
-#include "rx-notification.hpp"
-#include "rx-coordination.hpp"
-#include "rx-sources.hpp"
-#include "rx-subjects.hpp"
-#include "rx-operators.hpp"
-#include "rx-observable.hpp"
-#include "rx-connectable_observable.hpp"
-#include "rx-grouped_observable.hpp"
-
-#if !defined(RXCPP_LITE)
-#include "operators/rx-all.hpp"
-#include "operators/rx-amb.hpp"
-#include "operators/rx-any.hpp"
-#include "operators/rx-buffer_count.hpp"
-#include "operators/rx-buffer_time.hpp"
-#include "operators/rx-buffer_time_count.hpp"
-#include "operators/rx-combine_latest.hpp"
-#include "operators/rx-concat.hpp"
-#include "operators/rx-concat_map.hpp"
-#include "operators/rx-connect_forever.hpp"
-#include "operators/rx-debounce.hpp"
-#include "operators/rx-delay.hpp"
-#include "operators/rx-distinct.hpp"
-#include "operators/rx-distinct_until_changed.hpp"
-#include "operators/rx-element_at.hpp"
-#include "operators/rx-filter.hpp"
-#include "operators/rx-finally.hpp"
-#include "operators/rx-flat_map.hpp"
-#include "operators/rx-group_by.hpp"
-#include "operators/rx-ignore_elements.hpp"
-#include "operators/rx-map.hpp"
-#include "operators/rx-merge.hpp"
-#include "operators/rx-merge_delay_error.hpp"
-#include "operators/rx-observe_on.hpp"
-#include "operators/rx-on_error_resume_next.hpp"
-#include "operators/rx-pairwise.hpp"
-#include "operators/rx-reduce.hpp"
-#include "operators/rx-repeat.hpp"
-#include "operators/rx-replay.hpp"
-#include "operators/rx-retry.hpp"
-#include "operators/rx-sample_time.hpp"
-#include "operators/rx-scan.hpp"
-#include "operators/rx-sequence_equal.hpp"
-#include "operators/rx-skip.hpp"
-#include "operators/rx-skip_while.hpp"
-#include "operators/rx-skip_last.hpp"
-#include "operators/rx-skip_until.hpp"
-#include "operators/rx-start_with.hpp"
-#include "operators/rx-subscribe_on.hpp"
-#include "operators/rx-switch_if_empty.hpp"
-#include "operators/rx-switch_on_next.hpp"
-#include "operators/rx-take.hpp"
-#include "operators/rx-take_last.hpp"
-#include "operators/rx-take_until.hpp"
-#include "operators/rx-take_while.hpp"
-#include "operators/rx-tap.hpp"
-#include "operators/rx-time_interval.hpp"
-#include "operators/rx-timeout.hpp"
-#include "operators/rx-timestamp.hpp"
-#include "operators/rx-window.hpp"
-#include "operators/rx-window_time.hpp"
-#include "operators/rx-window_time_count.hpp"
-#include "operators/rx-window_toggle.hpp"
-#include "operators/rx-with_latest_from.hpp"
-#include "operators/rx-zip.hpp"
-#endif
-
-#pragma pop_macro("min")
-#pragma pop_macro("max")
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-lite.hpp b/Rx/v2/src/rxcpp/rx-lite.hpp
deleted file mode 100644
index a0a9d92..0000000
--- a/Rx/v2/src/rxcpp/rx-lite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_HPP)
-#define RXCPP_RX_HPP
-
-#define RXCPP_LITE
-#include "rx-includes.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp
deleted file mode 100644
index 20e0c69..0000000
--- a/Rx/v2/src/rxcpp/rx-notification.hpp
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_NOTIFICATION_HPP)
-#define RXCPP_RX_NOTIFICATION_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace notifications {
-
-class subscription
-{
- long s;
- long u;
-
-public:
- explicit inline subscription(long s)
- : s(s), u(std::numeric_limits<long>::max()) {
- }
- inline subscription(long s, long u)
- : s(s), u(u) {
- }
- inline long subscribe() const {
- return s;
- }
- inline long unsubscribe() const {
- return u;
- }
-};
-
-inline bool operator == (subscription lhs, subscription rhs) {
- return lhs.subscribe() == rhs.subscribe() && lhs.unsubscribe() == rhs.unsubscribe();
-}
-
-inline std::ostream& operator<< (std::ostream& out, const subscription& s) {
- out << s.subscribe() << "-" << s.unsubscribe();
- return out;
-}
-
-namespace detail {
-
-template<typename T>
-struct notification_base
- : public std::enable_shared_from_this<notification_base<T>>
-{
- typedef subscriber<T> observer_type;
- typedef std::shared_ptr<notification_base<T>> type;
-
- virtual ~notification_base() {}
-
- virtual void out(std::ostream& out) const =0;
- virtual bool equals(const type& other) const = 0;
- virtual void accept(const observer_type& o) const =0;
-};
-
-template<class T>
-std::ostream& operator<< (std::ostream& out, const std::vector<T>& v);
-
-template<class T>
-auto to_stream(std::ostream& os, const T& t, int, int)
- -> decltype(os << t) {
- return os << t;
-}
-
-#if RXCPP_USE_RTTI
-template<class T>
-std::ostream& to_stream(std::ostream& os, const T&, int, ...) {
- return os << "< " << typeid(T).name() << " does not support ostream>";
-}
-#endif
-
-template<class T>
-std::ostream& to_stream(std::ostream& os, const T&, ...) {
- return os << "<the value does not support ostream>";
-}
-
-template<class T>
-inline std::ostream& ostreamvector (std::ostream& os, const std::vector<T>& v) {
- os << "[";
- bool doemit = false;
- for(auto& i : v) {
- if (doemit) {
- os << ", ";
- } else {
- doemit = true;
- }
- to_stream(os, i, 0, 0);
- }
- os << "]";
- return os;
-}
-
-template<class T>
-inline std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
- return ostreamvector(os, v);
-}
-
-template<class T>
-auto equals(const T& lhs, const T& rhs, int)
- -> decltype(bool(lhs == rhs)) {
- return lhs == rhs;
-}
-
-template<class T>
-bool equals(const T&, const T&, ...) {
- rxu::throw_exception(std::runtime_error("value does not support equality tests"));
- return false;
-}
-
-}
-
-template<typename T>
-struct notification
-{
- typedef typename detail::notification_base<T>::type type;
- typedef typename detail::notification_base<T>::observer_type observer_type;
-
-private:
- typedef detail::notification_base<T> base;
-
- struct on_next_notification : public base {
- on_next_notification(T value) : value(std::move(value)) {
- }
- on_next_notification(const on_next_notification& o) : value(o.value) {}
- on_next_notification(const on_next_notification&& o) : value(std::move(o.value)) {}
- on_next_notification& operator=(on_next_notification o) { value = std::move(o.value); return *this; }
- virtual void out(std::ostream& os) const {
- os << "on_next( ";
- detail::to_stream(os, value, 0, 0);
- os << ")";
- }
- virtual bool equals(const typename base::type& other) const {
- bool result = false;
- other->accept(make_subscriber<T>(make_observer_dynamic<T>([this, &result](T v) {
- result = detail::equals(this->value, v, 0);
- })));
- return result;
- }
- virtual void accept(const typename base::observer_type& o) const {
- o.on_next(value);
- }
- const T value;
- };
-
- struct on_error_notification : public base {
- on_error_notification(rxu::error_ptr ep) : ep(ep) {
- }
- on_error_notification(const on_error_notification& o) : ep(o.ep) {}
- on_error_notification(const on_error_notification&& o) : ep(std::move(o.ep)) {}
- on_error_notification& operator=(on_error_notification o) { ep = std::move(o.ep); return *this; }
- virtual void out(std::ostream& os) const {
- os << "on_error(";
- os << rxu::what(ep);
- os << ")";
- }
- virtual bool equals(const typename base::type& other) const {
- bool result = false;
- // not trying to compare exceptions
- other->accept(make_subscriber<T>(make_observer_dynamic<T>([](T){}, [&result](rxu::error_ptr){
- result = true;
- })));
- return result;
- }
- virtual void accept(const typename base::observer_type& o) const {
- o.on_error(ep);
- }
- const rxu::error_ptr ep;
- };
-
- struct on_completed_notification : public base {
- on_completed_notification() {
- }
- virtual void out(std::ostream& os) const {
- os << "on_completed()";
- }
- virtual bool equals(const typename base::type& other) const {
- bool result = false;
- other->accept(make_subscriber<T>(make_observer_dynamic<T>([](T){}, [&result](){
- result = true;
- })));
- return result;
- }
- virtual void accept(const typename base::observer_type& o) const {
- o.on_completed();
- }
- };
-
- struct exception_tag {};
-
- template<typename Exception>
- static
- type make_on_error(exception_tag&&, Exception&& e) {
- rxu::error_ptr ep = rxu::make_error_ptr(std::forward<Exception>(e));
- return std::make_shared<on_error_notification>(ep);
- }
-
- struct exception_ptr_tag {};
-
- static
- type make_on_error(exception_ptr_tag&&, rxu::error_ptr ep) {
- return std::make_shared<on_error_notification>(ep);
- }
-
-public:
- template<typename U>
- static type on_next(U value) {
- return std::make_shared<on_next_notification>(std::move(value));
- }
-
- static type on_completed() {
- return std::make_shared<on_completed_notification>();
- }
-
- template<typename Exception>
- static type on_error(Exception&& e) {
- return make_on_error(typename std::conditional<
- std::is_same<rxu::decay_t<Exception>, rxu::error_ptr>::value,
- exception_ptr_tag, exception_tag>::type(),
- std::forward<Exception>(e));
- }
-};
-
-template<class T>
-bool operator == (const std::shared_ptr<detail::notification_base<T>>& lhs, const std::shared_ptr<detail::notification_base<T>>& rhs) {
- if (!lhs && !rhs) {return true;}
- if (!lhs || !rhs) {return false;}
- return lhs->equals(rhs);
-}
-
-template<class T>
-std::ostream& operator<< (std::ostream& os, const std::shared_ptr<detail::notification_base<T>>& n) {
- n->out(os);
- return os;
-}
-
-
-template<class T>
-class recorded
-{
- long t;
- T v;
-public:
- recorded(long t, T v)
- : t(t), v(v) {
- }
- long time() const {
- return t;
- }
- const T& value() const {
- return v;
- }
-};
-
-template<class T>
-bool operator == (recorded<T> lhs, recorded<T> rhs) {
- return lhs.time() == rhs.time() && lhs.value() == rhs.value();
-}
-
-template<class T>
-std::ostream& operator<< (std::ostream& out, const recorded<T>& r) {
- out << "@" << r.time() << "-" << r.value();
- return out;
-}
-
-}
-namespace rxn=notifications;
-
-inline std::ostream& operator<< (std::ostream& out, const std::vector<rxcpp::notifications::subscription>& vs) {
- return rxcpp::notifications::detail::ostreamvector(out, vs);
-}
-template<class T>
-inline std::ostream& operator<< (std::ostream& out, const std::vector<rxcpp::notifications::recorded<T>>& vr) {
- return rxcpp::notifications::detail::ostreamvector(out, vr);
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp
deleted file mode 100644
index 7e3d567..0000000
--- a/Rx/v2/src/rxcpp/rx-observable.hpp
+++ /dev/null
@@ -1,1811 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_OBSERVABLE_HPP)
-#define RXCPP_RX_OBSERVABLE_HPP
-
-#include "rx-includes.hpp"
-
-#ifdef __GNUG__
-#define EXPLICIT_THIS this->
-#else
-#define EXPLICIT_THIS
-#endif
-
-namespace rxcpp {
-
-namespace detail {
-
-template<class Subscriber, class T>
-struct has_on_subscribe_for
-{
- struct not_void {};
- template<class CS, class CT>
- static auto check(int) -> decltype((*(CT*)nullptr).on_subscribe(*(CS*)nullptr));
- template<class CS, class CT>
- static not_void check(...);
-
- typedef decltype(check<rxu::decay_t<Subscriber>, T>(0)) detail_result;
- static const bool value = std::is_same<detail_result, void>::value;
-};
-
-}
-
-template<class T>
-class dynamic_observable
- : public rxs::source_base<T>
-{
- struct state_type
- : public std::enable_shared_from_this<state_type>
- {
- typedef std::function<void(subscriber<T>)> onsubscribe_type;
-
- onsubscribe_type on_subscribe;
- };
- std::shared_ptr<state_type> state;
-
- template<class U>
- friend bool operator==(const dynamic_observable<U>&, const dynamic_observable<U>&);
-
- template<class SO>
- void construct(SO&& source, rxs::tag_source&&) {
- rxu::decay_t<SO> so = std::forward<SO>(source);
- state->on_subscribe = [so](subscriber<T> o) mutable {
- so.on_subscribe(std::move(o));
- };
- }
-
- struct tag_function {};
- template<class F>
- void construct(F&& f, tag_function&&) {
- state->on_subscribe = std::forward<F>(f);
- }
-
-public:
-
- typedef tag_dynamic_observable dynamic_observable_tag;
-
- dynamic_observable()
- {
- }
-
- template<class SOF>
- explicit dynamic_observable(SOF&& sof, typename std::enable_if<!is_dynamic_observable<SOF>::value, void**>::type = 0)
- : state(std::make_shared<state_type>())
- {
- construct(std::forward<SOF>(sof),
- typename std::conditional<rxs::is_source<SOF>::value || rxo::is_operator<SOF>::value, rxs::tag_source, tag_function>::type());
- }
-
- void on_subscribe(subscriber<T> o) const {
- state->on_subscribe(std::move(o));
- }
-
- template<class Subscriber>
- typename std::enable_if<is_subscriber<Subscriber>::value, void>::type
- on_subscribe(Subscriber o) const {
- state->on_subscribe(o.as_dynamic());
- }
-};
-
-template<class T>
-inline bool operator==(const dynamic_observable<T>& lhs, const dynamic_observable<T>& rhs) {
- return lhs.state == rhs.state;
-}
-template<class T>
-inline bool operator!=(const dynamic_observable<T>& lhs, const dynamic_observable<T>& rhs) {
- return !(lhs == rhs);
-}
-
-template<class T, class Source>
-observable<T> make_observable_dynamic(Source&& s) {
- return observable<T>(dynamic_observable<T>(std::forward<Source>(s)));
-}
-
-namespace detail {
-template<bool Selector, class Default, class SO>
-struct resolve_observable;
-
-template<class Default, class SO>
-struct resolve_observable<true, Default, SO>
-{
- typedef typename SO::type type;
- typedef typename type::value_type value_type;
- static const bool value = true;
- typedef observable<value_type, type> observable_type;
- template<class... AN>
- static observable_type make(const Default&, AN&&... an) {
- return observable_type(type(std::forward<AN>(an)...));
- }
-};
-template<class Default, class SO>
-struct resolve_observable<false, Default, SO>
-{
- static const bool value = false;
- typedef Default observable_type;
- template<class... AN>
- static observable_type make(const observable_type& that, const AN&...) {
- return that;
- }
-};
-template<class SO>
-struct resolve_observable<true, void, SO>
-{
- typedef typename SO::type type;
- typedef typename type::value_type value_type;
- static const bool value = true;
- typedef observable<value_type, type> observable_type;
- template<class... AN>
- static observable_type make(AN&&... an) {
- return observable_type(type(std::forward<AN>(an)...));
- }
-};
-template<class SO>
-struct resolve_observable<false, void, SO>
-{
- static const bool value = false;
- typedef void observable_type;
- template<class... AN>
- static observable_type make(const AN&...) {
- }
-};
-
-}
-
-template<class Selector, class Default, template<class... TN> class SO, class... AN>
-struct defer_observable
- : public detail::resolve_observable<Selector::value, Default, rxu::defer_type<SO, AN...>>
-{
-};
-
-/*!
- \brief a source of values whose methods block until all values have been emitted. subscribe or use one of the operator methods that reduce the values emitted to a single value.
-
- \ingroup group-observable
-
-*/
-template<class T, class Observable>
-class blocking_observable
-{
- template<class Obsvbl, class... ArgN>
- static auto blocking_subscribe(const Obsvbl& source, bool do_rethrow, ArgN&&... an)
- -> void {
- std::mutex lock;
- std::condition_variable wake;
- bool disposed = false;
-
- auto dest = make_subscriber<T>(std::forward<ArgN>(an)...);
-
- rxu::error_ptr error;
- bool has_error = false;
-
- // keep any error to rethrow at the end.
- // copy 'dest' by-value to avoid using it after it goes out of scope.
- auto scbr = make_subscriber<T>(
- dest,
- [dest](T t){dest.on_next(t);},
- [dest,&error,&has_error,do_rethrow](rxu::error_ptr e){
- if (do_rethrow) {
- has_error = true;
- error = e;
- } else {
- dest.on_error(e);
- }
- },
- [dest](){dest.on_completed();}
- );
-
- auto cs = scbr.get_subscription();
- cs.add(
- [&](){
- std::unique_lock<std::mutex> guard(lock);
- wake.notify_one();
- disposed = true;
- });
-
- source.subscribe(std::move(scbr));
-
- std::unique_lock<std::mutex> guard(lock);
- wake.wait(guard,
- [&](){
- return disposed;
- });
-
- if (has_error) {rxu::rethrow_exception(error);}
- }
-
-public:
- typedef rxu::decay_t<Observable> observable_type;
- observable_type source;
- ~blocking_observable()
- {
- }
- blocking_observable(observable_type s) : source(std::move(s)) {}
-
- ///
- /// `subscribe` will cause this observable to emit values to the provided subscriber.
- ///
- /// \return void
- ///
- /// \param an... - the arguments are passed to make_subscriber().
- ///
- /// callers must provide enough arguments to make a subscriber.
- /// overrides are supported. thus
- /// `subscribe(thesubscriber, composite_subscription())`
- /// will take `thesubscriber.get_observer()` and the provided
- /// subscription and subscribe to the new subscriber.
- /// the `on_next`, `on_error`, `on_completed` methods can be supplied instead of an observer
- /// if a subscription or subscriber is not provided then a new subscription will be created.
- ///
- template<class... ArgN>
- auto subscribe(ArgN&&... an) const
- -> void {
- return blocking_subscribe(source, false, std::forward<ArgN>(an)...);
- }
-
- ///
- /// `subscribe_with_rethrow` will cause this observable to emit values to the provided subscriber.
- ///
- /// \note If the source observable calls on_error, the raised exception is rethrown by this method.
- ///
- /// \note If the source observable calls on_error, the `on_error` method on the subscriber will not be called.
- ///
- /// \return void
- ///
- /// \param an... - the arguments are passed to make_subscriber().
- ///
- /// callers must provide enough arguments to make a subscriber.
- /// overrides are supported. thus
- /// `subscribe(thesubscriber, composite_subscription())`
- /// will take `thesubscriber.get_observer()` and the provided
- /// subscription and subscribe to the new subscriber.
- /// the `on_next`, `on_error`, `on_completed` methods can be supplied instead of an observer
- /// if a subscription or subscriber is not provided then a new subscription will be created.
- ///
- template<class... ArgN>
- auto subscribe_with_rethrow(ArgN&&... an) const
- -> void {
- return blocking_subscribe(source, true, std::forward<ArgN>(an)...);
- }
-
- /*! Return the first item emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The first item emitted by this blocking_observable.
-
- \note If the source observable calls on_error, the raised exception is rethrown by this method.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking first sample
- \snippet output.txt blocking first sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking first empty sample
- \snippet output.txt blocking first empty sample
- */
- template<class... AN>
- auto first(AN**...) -> delayed_type_t<T, AN...> const {
- rxu::maybe<T> result;
- composite_subscription cs;
- subscribe_with_rethrow(
- cs,
- [&](T v){result.reset(v); cs.unsubscribe();});
- if (result.empty())
- rxu::throw_exception(rxcpp::empty_error("first() requires a stream with at least one value"));
- return result.get();
- static_assert(sizeof...(AN) == 0, "first() was passed too many arguments.");
- }
-
- /*! Return the last item emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The last item emitted by this blocking_observable.
-
- \note If the source observable calls on_error, the raised exception is rethrown by this method.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking last sample
- \snippet output.txt blocking last sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking last empty sample
- \snippet output.txt blocking last empty sample
- */
- template<class... AN>
- auto last(AN**...) -> delayed_type_t<T, AN...> const {
- rxu::maybe<T> result;
- subscribe_with_rethrow(
- [&](T v){result.reset(v);});
- if (result.empty())
- rxu::throw_exception(rxcpp::empty_error("last() requires a stream with at least one value"));
- return result.get();
- static_assert(sizeof...(AN) == 0, "last() was passed too many arguments.");
- }
-
- /*! Return the total number of items emitted by this blocking_observable.
-
- \return The total number of items emitted by this blocking_observable.
-
- \sample
- \snippet blocking_observable.cpp blocking count sample
- \snippet output.txt blocking count sample
-
- When the source observable calls on_error:
- \snippet blocking_observable.cpp blocking count error sample
- \snippet output.txt blocking count error sample
- */
- int count() const {
- int result = 0;
- source.count().as_blocking().subscribe_with_rethrow(
- [&](int v){result = v;});
- return result;
- }
-
- /*! Return the sum of all items emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The sum of all items emitted by this blocking_observable.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking sum sample
- \snippet output.txt blocking sum sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking sum empty sample
- \snippet output.txt blocking sum empty sample
-
- When the source observable calls on_error:
- \snippet blocking_observable.cpp blocking sum error sample
- \snippet output.txt blocking sum error sample
- */
- T sum() const {
- return source.sum().as_blocking().last();
- }
-
- /*! Return the average value of all items emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The average value of all items emitted by this blocking_observable.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking average sample
- \snippet output.txt blocking average sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking average empty sample
- \snippet output.txt blocking average empty sample
-
- When the source observable calls on_error:
- \snippet blocking_observable.cpp blocking average error sample
- \snippet output.txt blocking average error sample
- */
- double average() const {
- return source.average().as_blocking().last();
- }
-
- /*! Return the max of all items emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The max of all items emitted by this blocking_observable.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking max sample
- \snippet output.txt blocking max sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking max empty sample
- \snippet output.txt blocking max empty sample
-
- When the source observable calls on_error:
- \snippet blocking_observable.cpp blocking max error sample
- \snippet output.txt blocking max error sample
-*/
- T max() const {
- return source.max().as_blocking().last();
- }
-
- /*! Return the min of all items emitted by this blocking_observable, or throw an std::runtime_error exception if it emits no items.
-
- \return The min of all items emitted by this blocking_observable.
-
- \sample
- When the source observable emits at least one item:
- \snippet blocking_observable.cpp blocking min sample
- \snippet output.txt blocking min sample
-
- When the source observable is empty:
- \snippet blocking_observable.cpp blocking min empty sample
- \snippet output.txt blocking min empty sample
-
- When the source observable calls on_error:
- \snippet blocking_observable.cpp blocking min error sample
- \snippet output.txt blocking min error sample
-*/
- T min() const {
- return source.min().as_blocking().last();
- }
-};
-
-namespace detail {
-
-template<class SourceOperator, class Subscriber>
-struct safe_subscriber
-{
- safe_subscriber(SourceOperator& so, Subscriber& o) : so(std::addressof(so)), o(std::addressof(o)) {}
-
- void subscribe() {
- RXCPP_TRY {
- so->on_subscribe(*o);
- } RXCPP_CATCH(...) {
- if (!o->is_subscribed()) {
- rxu::rethrow_current_exception();
- }
- o->on_error(rxu::make_error_ptr(rxu::current_exception()));
- o->unsubscribe();
- }
- }
-
- void operator()(const rxsc::schedulable&) {
- subscribe();
- }
-
- SourceOperator* so;
- Subscriber* o;
-};
-
-}
-
-template<>
-class observable<void, void>;
-
-/*!
- \defgroup group-observable Observables
-
- \brief These are the set of observable classes in rxcpp.
-
- \class rxcpp::observable
-
- \ingroup group-observable group-core
-
- \brief a source of values. subscribe or use one of the operator methods that return a new observable, which uses this observable as a source.
-
- \par Some code
- This sample will observable::subscribe() to values from a observable<void, void>::range().
-
- \sample
- \snippet range.cpp range sample
- \snippet output.txt range sample
-
-*/
-template<class T, class SourceOperator>
-class observable
- : public observable_base<T>
-{
- static_assert(std::is_same<T, typename SourceOperator::value_type>::value, "SourceOperator::value_type must be the same as T in observable<T, SourceOperator>");
-
- typedef observable<T, SourceOperator> this_type;
-
-public:
- typedef rxu::decay_t<SourceOperator> source_operator_type;
- mutable source_operator_type source_operator;
-
-private:
-
- template<class U, class SO>
- friend class observable;
-
- template<class U, class SO>
- friend bool operator==(const observable<U, SO>&, const observable<U, SO>&);
-
- template<class Subscriber>
- auto detail_subscribe(Subscriber o) const
- -> composite_subscription {
-
- typedef rxu::decay_t<Subscriber> subscriber_type;
-
- static_assert(is_subscriber<subscriber_type>::value, "subscribe must be passed a subscriber");
- static_assert(std::is_same<typename source_operator_type::value_type, T>::value && std::is_convertible<T*, typename subscriber_type::value_type*>::value, "the value types in the sequence must match or be convertible");
- static_assert(detail::has_on_subscribe_for<subscriber_type, source_operator_type>::value, "inner must have on_subscribe method that accepts this subscriber ");
-
- trace_activity().subscribe_enter(*this, o);
-
- if (!o.is_subscribed()) {
- trace_activity().subscribe_return(*this);
- return o.get_subscription();
- }
-
- detail::safe_subscriber<source_operator_type, subscriber_type> subscriber(source_operator, o);
-
- // make sure to let current_thread take ownership of the thread as early as possible.
- if (rxsc::current_thread::is_schedule_required()) {
- const auto& sc = rxsc::make_current_thread();
- sc.create_worker(o.get_subscription()).schedule(subscriber);
- } else {
- // current_thread already owns this thread.
- subscriber.subscribe();
- }
-
- trace_activity().subscribe_return(*this);
- return o.get_subscription();
- }
-
-public:
- typedef T value_type;
-
- static_assert(rxo::is_operator<source_operator_type>::value || rxs::is_source<source_operator_type>::value, "observable must wrap an operator or source");
-
- ~observable()
- {
- }
-
- observable()
- {
- }
-
- explicit observable(const source_operator_type& o)
- : source_operator(o)
- {
- }
- explicit observable(source_operator_type&& o)
- : source_operator(std::move(o))
- {
- }
-
- /// implicit conversion between observables of the same value_type
- template<class SO>
- observable(const observable<T, SO>& o)
- : source_operator(o.source_operator)
- {}
- /// implicit conversion between observables of the same value_type
- template<class SO>
- observable(observable<T, SO>&& o)
- : source_operator(std::move(o.source_operator))
- {}
-
-#if 0
- template<class I>
- void on_subscribe(observer<T, I> o) const {
- source_operator.on_subscribe(o);
- }
-#endif
-
- /*! @copydoc rxcpp::operators::as_dynamic
- */
- template<class... AN>
- observable<T> as_dynamic(AN**...) const {
- return *this;
- static_assert(sizeof...(AN) == 0, "as_dynamic() was passed too many arguments.");
- }
-
- /*! @copydoc rx-ref_count.hpp
- */
- template<class... AN>
- auto ref_count(AN... an) const // ref_count(ConnectableObservable&&)
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(ref_count_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(ref_count_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::as_blocking
- */
- template<class... AN>
- blocking_observable<T, this_type> as_blocking(AN**...) const {
- return blocking_observable<T, this_type>(*this);
- static_assert(sizeof...(AN) == 0, "as_blocking() was passed too many arguments.");
- }
-
- /// \cond SHOW_SERVICE_MEMBERS
-
- ///
- /// takes any function that will take this observable and produce a result value.
- /// this is intended to allow externally defined operators, that use subscribe,
- /// to be connected into the expression.
- ///
- template<class OperatorFactory>
- auto op(OperatorFactory&& of) const
- -> decltype(of(*(const this_type*)nullptr)) {
- return of(*this);
- static_assert(is_operator_factory_for<this_type, OperatorFactory>::value, "Function passed for op() must have the signature Result(SourceObservable)");
- }
-
- /*! @copydoc rx-lift.hpp
- */
- template<class ResultType, class Operator>
- auto lift(Operator&& op) const
- -> observable<rxu::value_type_t<rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>, rxo::detail::lift_operator<ResultType, source_operator_type, Operator>> {
- return observable<rxu::value_type_t<rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>, rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>(
- rxo::detail::lift_operator<ResultType, source_operator_type, Operator>(source_operator, std::forward<Operator>(op)));
- static_assert(detail::is_lift_function_for<T, subscriber<ResultType>, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber<T, ...>)");
- }
-
- ///
- /// takes any function that will take a subscriber for this observable and produce a subscriber.
- /// this is intended to allow externally defined operators, that use make_subscriber, to be connected
- /// into the expression.
- ///
- template<class ResultType, class Operator>
- auto lift_if(Operator&& op) const
- -> typename std::enable_if<detail::is_lift_function_for<T, subscriber<ResultType>, Operator>::value,
- observable<rxu::value_type_t<rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>, rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>>::type {
- return observable<rxu::value_type_t<rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>, rxo::detail::lift_operator<ResultType, source_operator_type, Operator>>(
- rxo::detail::lift_operator<ResultType, source_operator_type, Operator>(source_operator, std::forward<Operator>(op)));
- }
- ///
- /// takes any function that will take a subscriber for this observable and produce a subscriber.
- /// this is intended to allow externally defined operators, that use make_subscriber, to be connected
- /// into the expression.
- ///
- template<class ResultType, class Operator>
- auto lift_if(Operator&&) const
- -> typename std::enable_if<!detail::is_lift_function_for<T, subscriber<ResultType>, Operator>::value,
- decltype(rxs::from<ResultType>())>::type {
- return rxs::from<ResultType>();
- }
- /// \endcond
-
- /*! @copydoc rx-subscribe.hpp
- */
- template<class... ArgN>
- auto subscribe(ArgN&&... an) const
- -> composite_subscription {
- return detail_subscribe(make_subscriber<T>(std::forward<ArgN>(an)...));
- }
-
- /*! @copydoc rx-all.hpp
- */
- template<class... AN>
- auto all(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(all_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(all_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::is_empty
- */
- template<class... AN>
- auto is_empty(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(is_empty_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(is_empty_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-any.hpp
- */
- template<class... AN>
- auto any(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(any_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(any_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::exists
- */
- template<class... AN>
- auto exists(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(exists_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(exists_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::contains
- */
- template<class... AN>
- auto contains(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(contains_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(contains_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-filter.hpp
- */
- template<class... AN>
- auto filter(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(filter_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(filter_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-switch_if_empty.hpp
- */
- template<class... AN>
- auto switch_if_empty(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(switch_if_empty_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(switch_if_empty_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::default_if_empty
- */
- template<class... AN>
- auto default_if_empty(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(default_if_empty_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(default_if_empty_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-sequence_equal.hpp
- */
- template<class... AN>
- auto sequence_equal(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(sequence_equal_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(sequence_equal_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-tap.hpp
- */
- template<class... AN>
- auto tap(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(tap_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(tap_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-time_interval.hpp
- */
- template<class... AN>
- auto time_interval(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(time_interval_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(time_interval_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-timeout.hpp
- */
- template<class... AN>
- auto timeout(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(timeout_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(timeout_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-timestamp.hpp
- */
- template<class... AN>
- auto timestamp(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(timestamp_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(timestamp_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-finally.hpp
- */
- template<class... AN>
- auto finally(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(finally_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(finally_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-on_error_resume_next.hpp
- */
- template<class... AN>
- auto on_error_resume_next(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(on_error_resume_next_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(on_error_resume_next_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-on_error_resume_next.hpp
- */
- template<class... AN>
- auto switch_on_error(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(on_error_resume_next_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(on_error_resume_next_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-map.hpp
- */
- template<class... AN>
- auto map(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-map.hpp
- */
- template<class... AN>
- auto transform(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-debounce.hpp
- */
- template<class... AN>
- auto debounce(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(debounce_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(debounce_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-delay.hpp
- */
- template<class... AN>
- auto delay(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delay_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(delay_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-distinct.hpp
- */
- template<class... AN>
- auto distinct(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(distinct_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(distinct_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-distinct_until_changed.hpp
- */
- template<class... AN>
- auto distinct_until_changed(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(distinct_until_changed_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(distinct_until_changed_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-element_at.hpp
- */
- template<class... AN>
- auto element_at(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(element_at_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(element_at_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-window.hpp
- */
- template<class... AN>
- auto window(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(window_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(window_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-window_time.hpp
- */
- template<class... AN>
- auto window_with_time(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(window_with_time_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(window_with_time_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-window_time_count.hpp
- */
- template<class... AN>
- auto window_with_time_or_count(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(window_with_time_or_count_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(window_with_time_or_count_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-window_toggle.hpp
- */
- template<class... AN>
- auto window_toggle(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(window_toggle_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(window_toggle_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-buffer_count.hpp
- */
- template<class... AN>
- auto buffer(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(buffer_count_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(buffer_count_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-buffer_time.hpp
- */
- template<class... AN>
- auto buffer_with_time(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(buffer_with_time_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(buffer_with_time_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-buffer_time_count.hpp
- */
- template<class... AN>
- auto buffer_with_time_or_count(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(buffer_with_time_or_count_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(buffer_with_time_or_count_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-switch_on_next.hpp
- */
- template<class... AN>
- auto switch_on_next(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(switch_on_next_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(switch_on_next_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-merge.hpp
- */
- template<class... AN>
- auto merge(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(merge_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(merge_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-merge_delay_error.hpp
- */
- template<class... AN>
- auto merge_delay_error(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(merge_delay_error_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(merge_delay_error_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-amb.hpp
- */
- template<class... AN>
- auto amb(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(amb_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(amb_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-flat_map.hpp
- */
- template<class... AN>
- auto flat_map(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(flat_map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(flat_map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-flat_map.hpp
- */
- template<class... AN>
- auto merge_transform(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(flat_map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(flat_map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-concat.hpp
- */
- template<class... AN>
- auto concat(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(concat_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(concat_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-concat_map.hpp
- */
- template<class... AN>
- auto concat_map(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(concat_map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(concat_map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-concat_map.hpp
- */
- template<class... AN>
- auto concat_transform(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(concat_map_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(concat_map_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-with_latest_from.hpp
- */
- template<class... AN>
- auto with_latest_from(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(with_latest_from_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(with_latest_from_tag{}, *this, std::forward<AN>(an)...);
- }
-
-
- /*! @copydoc rx-combine_latest.hpp
- */
- template<class... AN>
- auto combine_latest(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(combine_latest_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(combine_latest_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-zip.hpp
- */
- template<class... AN>
- auto zip(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(zip_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(zip_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-group_by.hpp
- */
- template<class... AN>
- inline auto group_by(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(group_by_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(group_by_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-ignore_elements.hpp
- */
- template<class... AN>
- auto ignore_elements(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(ignore_elements_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(ignore_elements_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-muticast.hpp
- */
- template<class... AN>
- auto multicast(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(multicast_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(multicast_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-publish.hpp
- */
- template<class... AN>
- auto publish(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(publish_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(publish_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::publish_synchronized
- */
- template<class... AN>
- auto publish_synchronized(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(publish_synchronized_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(publish_synchronized_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-replay.hpp
- */
- template<class... AN>
- auto replay(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(replay_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(replay_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-subscribe_on.hpp
- */
- template<class... AN>
- auto subscribe_on(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(subscribe_on_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(subscribe_on_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-observe_on.hpp
- */
- template<class... AN>
- auto observe_on(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(observe_on_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(observe_on_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-reduce.hpp
- */
- template<class... AN>
- auto reduce(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(reduce_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(reduce_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-reduce.hpp
- */
- template<class... AN>
- auto accumulate(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(reduce_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(reduce_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rxcpp::operators::first
- */
- template<class... AN>
- auto first(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<first_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<first_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "first() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::last
- */
- template<class... AN>
- auto last(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<last_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<last_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "last() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::count
- */
- template<class... AN>
- auto count(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<reduce_tag, AN...>::value(), *(this_type*)nullptr, 0, rxu::count(), identity_for<int>()))
- /// \endcond
- {
- return observable_member(delayed_type<reduce_tag, AN...>::value(), *this, 0, rxu::count(), identity_for<int>());
- static_assert(sizeof...(AN) == 0, "count() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::sum
- */
- template<class... AN>
- auto sum(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<sum_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<sum_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "sum() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::average
- */
- template<class... AN>
- auto average(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<average_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<average_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "average() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::max
- */
- template<class... AN>
- auto max(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<max_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<max_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "max() was passed too many arguments.");
- }
-
- /*! @copydoc rxcpp::operators::min
- */
- template<class... AN>
- auto min(AN**...) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(delayed_type<min_tag, AN...>::value(), *(this_type*)nullptr))
- /// \endcond
- {
- return observable_member(delayed_type<min_tag, AN...>::value(), *this);
- static_assert(sizeof...(AN) == 0, "min() was passed too many arguments.");
- }
-
- /*! @copydoc rx-scan.hpp
- */
- template<class... AN>
- auto scan(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(scan_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(scan_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-sample_time.hpp
- */
- template<class... AN>
- auto sample_with_time(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(sample_with_time_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(sample_with_time_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-skip.hpp
- */
- template<class... AN>
- auto skip(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(skip_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(skip_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-skip.hpp
- */
- template<class... AN>
- auto skip_while(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(skip_while_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(skip_while_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-skip_last.hpp
- */
- template<class... AN>
- auto skip_last(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(skip_last_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(skip_last_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-skip_until.hpp
- */
- template<class... AN>
- auto skip_until(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(skip_until_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(skip_until_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-take.hpp
- */
- template<class... AN>
- auto take(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(take_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(take_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-take_last.hpp
- */
- template<class... AN>
- auto take_last(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(take_last_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(take_last_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-take_until.hpp
- */
- template<class... AN>
- auto take_until(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(take_until_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(take_until_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-take_while.hpp
- */
- template<class... AN>
- auto take_while(AN&&... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(take_while_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(take_while_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-repeat.hpp
- */
- template<class... AN>
- auto repeat(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(repeat_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(repeat_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-retry.hpp
- */
- template<class... AN>
- auto retry(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(retry_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(retry_tag{}, *(this_type*)this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-start_with.hpp
- */
- template<class... AN>
- auto start_with(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(start_with_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(start_with_tag{}, *this, std::forward<AN>(an)...);
- }
-
- /*! @copydoc rx-pairwise.hpp
- */
- template<class... AN>
- auto pairwise(AN... an) const
- /// \cond SHOW_SERVICE_MEMBERS
- -> decltype(observable_member(pairwise_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...))
- /// \endcond
- {
- return observable_member(pairwise_tag{}, *this, std::forward<AN>(an)...);
- }
-};
-
-template<class T, class SourceOperator>
-inline bool operator==(const observable<T, SourceOperator>& lhs, const observable<T, SourceOperator>& rhs) {
- return lhs.source_operator == rhs.source_operator;
-}
-template<class T, class SourceOperator>
-inline bool operator!=(const observable<T, SourceOperator>& lhs, const observable<T, SourceOperator>& rhs) {
- return !(lhs == rhs);
-}
-
-/*!
- \defgroup group-core Basics
-
- \brief These are the core classes that combine to represent a set of values emitted over time that can be cancelled.
-
- \class rxcpp::observable<void, void>
-
- \brief typed as ```rxcpp::observable<>```, this is a collection of factory methods that return an observable.
-
- \ingroup group-core
-
- \par Create a new type of observable
-
- \sample
- \snippet create.cpp Create sample
- \snippet output.txt Create sample
-
- \par Create an observable that emits a range of values
-
- \sample
- \snippet range.cpp range sample
- \snippet output.txt range sample
-
- \par Create an observable that emits nothing / generates an error / immediately completes
-
- \sample
- \snippet never.cpp never sample
- \snippet output.txt never sample
- \snippet error.cpp error sample
- \snippet output.txt error sample
- \snippet empty.cpp empty sample
- \snippet output.txt empty sample
-
- \par Create an observable that generates new observable for each subscriber
-
- \sample
- \snippet defer.cpp defer sample
- \snippet output.txt defer sample
-
- \par Create an observable that emits items every specified interval of time
-
- \sample
- \snippet interval.cpp interval sample
- \snippet output.txt interval sample
-
- \par Create an observable that emits items in the specified interval of time
-
- \sample
- \snippet timer.cpp duration timer sample
- \snippet output.txt duration timer sample
-
- \par Create an observable that emits all items from a collection
-
- \sample
- \snippet iterate.cpp iterate sample
- \snippet output.txt iterate sample
-
- \par Create an observable that emits a set of specified items
-
- \sample
- \snippet from.cpp from sample
- \snippet output.txt from sample
-
- \par Create an observable that emits a single item
-
- \sample
- \snippet just.cpp just sample
- \snippet output.txt just sample
-
- \par Create an observable that emits a set of items and then subscribes to another observable
-
- \sample
- \snippet start_with.cpp full start_with sample
- \snippet output.txt full start_with sample
-
- \par Create an observable that generates a new observable based on a generated resource for each subscriber
-
- \sample
- \snippet scope.cpp scope sample
- \snippet output.txt scope sample
-
-*/
-template<>
-class observable<void, void>
-{
- ~observable();
-public:
- /*! @copydoc rx-create.hpp
- */
- template<class T, class OnSubscribe>
- static auto create(OnSubscribe os)
- -> decltype(rxs::create<T>(std::move(os))) {
- return rxs::create<T>(std::move(os));
- }
-
- /*! @copydoc rx-range.hpp
- */
- template<class T>
- static auto range(T first = 0, T last = std::numeric_limits<T>::max(), std::ptrdiff_t step = 1)
- -> decltype(rxs::range<T>(first, last, step, identity_current_thread())) {
- return rxs::range<T>(first, last, step, identity_current_thread());
- }
- /*! @copydoc rx-range.hpp
- */
- template<class T, class Coordination>
- static auto range(T first, T last, std::ptrdiff_t step, Coordination cn)
- -> decltype(rxs::range<T>(first, last, step, std::move(cn))) {
- return rxs::range<T>(first, last, step, std::move(cn));
- }
- /*! @copydoc rx-range.hpp
- */
- template<class T, class Coordination>
- static auto range(T first, T last, Coordination cn)
- -> decltype(rxs::range<T>(first, last, std::move(cn))) {
- return rxs::range<T>(first, last, std::move(cn));
- }
- /*! @copydoc rx-range.hpp
- */
- template<class T, class Coordination>
- static auto range(T first, Coordination cn)
- -> decltype(rxs::range<T>(first, std::move(cn))) {
- return rxs::range<T>(first, std::move(cn));
- }
-
- /*! @copydoc rx-never.hpp
- */
- template<class T>
- static auto never()
- -> decltype(rxs::never<T>()) {
- return rxs::never<T>();
- }
-
- /*! @copydoc rx-defer.hpp
- */
- template<class ObservableFactory>
- static auto defer(ObservableFactory of)
- -> decltype(rxs::defer(std::move(of))) {
- return rxs::defer(std::move(of));
- }
-
- /*! @copydoc rx-interval.hpp
- */
- template<class... AN>
- static auto interval(rxsc::scheduler::clock_type::duration period, AN**...)
- -> decltype(rxs::interval(period)) {
- return rxs::interval(period);
- static_assert(sizeof...(AN) == 0, "interval(period) was passed too many arguments.");
- }
- /*! @copydoc rx-interval.hpp
- */
- template<class Coordination>
- static auto interval(rxsc::scheduler::clock_type::duration period, Coordination cn)
- -> decltype(rxs::interval(period, std::move(cn))) {
- return rxs::interval(period, std::move(cn));
- }
- /*! @copydoc rx-interval.hpp
- */
- template<class... AN>
- static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, AN**...)
- -> decltype(rxs::interval(initial, period)) {
- return rxs::interval(initial, period);
- static_assert(sizeof...(AN) == 0, "interval(initial, period) was passed too many arguments.");
- }
- /*! @copydoc rx-interval.hpp
- */
- template<class Coordination>
- static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, Coordination cn)
- -> decltype(rxs::interval(initial, period, std::move(cn))) {
- return rxs::interval(initial, period, std::move(cn));
- }
-
- /*! @copydoc rx-timer.hpp
- */
- template<class... AN>
- static auto timer(rxsc::scheduler::clock_type::time_point at, AN**...)
- -> decltype(rxs::timer(at)) {
- return rxs::timer(at);
- static_assert(sizeof...(AN) == 0, "timer(at) was passed too many arguments.");
- }
- /*! @copydoc rx-timer.hpp
- */
- template<class... AN>
- static auto timer(rxsc::scheduler::clock_type::duration after, AN**...)
- -> decltype(rxs::timer(after)) {
- return rxs::timer(after);
- static_assert(sizeof...(AN) == 0, "timer(after) was passed too many arguments.");
- }
- /*! @copydoc rx-timer.hpp
- */
- template<class Coordination>
- static auto timer(rxsc::scheduler::clock_type::time_point when, Coordination cn)
- -> decltype(rxs::timer(when, std::move(cn))) {
- return rxs::timer(when, std::move(cn));
- }
- /*! @copydoc rx-timer.hpp
- */
- template<class Coordination>
- static auto timer(rxsc::scheduler::clock_type::duration when, Coordination cn)
- -> decltype(rxs::timer(when, std::move(cn))) {
- return rxs::timer(when, std::move(cn));
- }
-
- /*! @copydoc rx-iterate.hpp
- */
- template<class Collection>
- static auto iterate(Collection c)
- -> decltype(rxs::iterate(std::move(c), identity_current_thread())) {
- return rxs::iterate(std::move(c), identity_current_thread());
- }
- /*! @copydoc rx-iterate.hpp
- */
- template<class Collection, class Coordination>
- static auto iterate(Collection c, Coordination cn)
- -> decltype(rxs::iterate(std::move(c), std::move(cn))) {
- return rxs::iterate(std::move(c), std::move(cn));
- }
-
- /*! @copydoc rxcpp::sources::from()
- */
- template<class T>
- static auto from()
- -> decltype( rxs::from<T>()) {
- return rxs::from<T>();
- }
- /*! @copydoc rxcpp::sources::from(Coordination cn)
- */
- template<class T, class Coordination>
- static auto from(Coordination cn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- decltype( rxs::from<T>(std::move(cn)))>::type {
- return rxs::from<T>(std::move(cn));
- }
- /*! @copydoc rxcpp::sources::from(Value0 v0, ValueN... vn)
- */
- template<class Value0, class... ValueN>
- static auto from(Value0 v0, ValueN... vn)
- -> typename std::enable_if<!is_coordination<Value0>::value,
- decltype( rxs::from(v0, vn...))>::type {
- return rxs::from(v0, vn...);
- }
- /*! @copydoc rxcpp::sources::from(Coordination cn, Value0 v0, ValueN... vn)
- */
- template<class Coordination, class Value0, class... ValueN>
- static auto from(Coordination cn, Value0 v0, ValueN... vn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- decltype( rxs::from(std::move(cn), v0, vn...))>::type {
- return rxs::from(std::move(cn), v0, vn...);
- }
-
- /*! @copydoc rxcpp::sources::just(Value0 v0)
- */
- template<class T>
- static auto just(T v)
- -> decltype(rxs::just(std::move(v))) {
- return rxs::just(std::move(v));
- }
- /*! @copydoc rxcpp::sources::just(Value0 v0, Coordination cn)
- */
- template<class T, class Coordination>
- static auto just(T v, Coordination cn)
- -> decltype(rxs::just(std::move(v), std::move(cn))) {
- return rxs::just(std::move(v), std::move(cn));
- }
-
- /*! @copydoc rxcpp::sources::start_with(Observable o, Value0 v0, ValueN... vn)
- */
- template<class Observable, class Value0, class... ValueN>
- static auto start_with(Observable o, Value0 v0, ValueN... vn)
- -> decltype(rxs::start_with(std::move(o), std::move(v0), std::move(vn)...)) {
- return rxs::start_with(std::move(o), std::move(v0), std::move(vn)...);
- }
-
- /*! @copydoc rx-empty.hpp
- */
- template<class T>
- static auto empty()
- -> decltype(from<T>()) {
- return from<T>();
- }
- /*! @copydoc rx-empty.hpp
- */
- template<class T, class Coordination>
- static auto empty(Coordination cn)
- -> decltype(from<T>(std::move(cn))) {
- return from<T>(std::move(cn));
- }
-
- /*! @copydoc rx-error.hpp
- */
- template<class T, class Exception>
- static auto error(Exception&& e)
- -> decltype(rxs::error<T>(std::forward<Exception>(e))) {
- return rxs::error<T>(std::forward<Exception>(e));
- }
- /*! @copydoc rx-error.hpp
- */
- template<class T, class Exception, class Coordination>
- static auto error(Exception&& e, Coordination cn)
- -> decltype(rxs::error<T>(std::forward<Exception>(e), std::move(cn))) {
- return rxs::error<T>(std::forward<Exception>(e), std::move(cn));
- }
-
- /*! @copydoc rx-scope.hpp
- */
- template<class ResourceFactory, class ObservableFactory>
- static auto scope(ResourceFactory rf, ObservableFactory of)
- -> decltype(rxs::scope(std::move(rf), std::move(of))) {
- return rxs::scope(std::move(rf), std::move(of));
- }
-};
-
-}
-
-//
-// support range() >> filter() >> subscribe() syntax
-// '>>' is spelled 'stream'
-//
-template<class T, class SourceOperator, class OperatorFactory>
-auto operator >> (const rxcpp::observable<T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-//
-// support range() | filter() | subscribe() syntax
-// '|' is spelled 'pipe'
-//
-template<class T, class SourceOperator, class OperatorFactory>
-auto operator | (const rxcpp::observable<T, SourceOperator>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp
deleted file mode 100644
index 92321f1..0000000
--- a/Rx/v2/src/rxcpp/rx-observer.hpp
+++ /dev/null
@@ -1,665 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_OBSERVER_HPP)
-#define RXCPP_RX_OBSERVER_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-
-template<class T>
-struct observer_base
-{
- typedef T value_type;
- typedef tag_observer observer_tag;
-};
-
-namespace detail {
-template<class T>
-struct OnNextEmpty
-{
- void operator()(const T&) const {}
-};
-struct OnErrorEmpty
-{
- void operator()(rxu::error_ptr) const {
- // error implicitly ignored, abort
- std::terminate();
- }
-};
-struct OnErrorIgnore
-{
- void operator()(rxu::error_ptr) const {
- }
-};
-struct OnCompletedEmpty
-{
- void operator()() const {}
-};
-
-template<class T, class State, class OnNext>
-struct OnNextForward
-{
- using state_t = rxu::decay_t<State>;
- using onnext_t = rxu::decay_t<OnNext>;
- OnNextForward() : onnext() {}
- explicit OnNextForward(onnext_t on) : onnext(std::move(on)) {}
- onnext_t onnext;
- void operator()(state_t& s, T& t) const {
- onnext(s, t);
- }
- void operator()(state_t& s, T&& t) const {
- onnext(s, t);
- }
-};
-template<class T, class State>
-struct OnNextForward<T, State, void>
-{
- using state_t = rxu::decay_t<State>;
- OnNextForward() {}
- void operator()(state_t& s, T& t) const {
- s.on_next(t);
- }
- void operator()(state_t& s, T&& t) const {
- s.on_next(t);
- }
-};
-
-template<class State, class OnError>
-struct OnErrorForward
-{
- using state_t = rxu::decay_t<State>;
- using onerror_t = rxu::decay_t<OnError>;
- OnErrorForward() : onerror() {}
- explicit OnErrorForward(onerror_t oe) : onerror(std::move(oe)) {}
- onerror_t onerror;
- void operator()(state_t& s, rxu::error_ptr ep) const {
- onerror(s, ep);
- }
-};
-template<class State>
-struct OnErrorForward<State, void>
-{
- using state_t = rxu::decay_t<State>;
- OnErrorForward() {}
- void operator()(state_t& s, rxu::error_ptr ep) const {
- s.on_error(ep);
- }
-};
-
-template<class State, class OnCompleted>
-struct OnCompletedForward
-{
- using state_t = rxu::decay_t<State>;
- using oncompleted_t = rxu::decay_t<OnCompleted>;
- OnCompletedForward() : oncompleted() {}
- explicit OnCompletedForward(oncompleted_t oc) : oncompleted(std::move(oc)) {}
- oncompleted_t oncompleted;
- void operator()(state_t& s) const {
- oncompleted(s);
- }
-};
-template<class State>
-struct OnCompletedForward<State, void>
-{
- OnCompletedForward() {}
- void operator()(State& s) const {
- s.on_completed();
- }
-};
-
-template<class T, class F>
-struct is_on_next_of
-{
- struct not_void {};
- template<class CT, class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)(*(CT*)nullptr));
- template<class CT, class CF>
- static not_void check(...);
-
- typedef decltype(check<T, rxu::decay_t<F>>(0)) detail_result;
- static const bool value = std::is_same<detail_result, void>::value;
-};
-
-template<class F>
-struct is_on_error
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)(*(rxu::error_ptr*)nullptr));
- template<class CF>
- static not_void check(...);
-
- static const bool value = std::is_same<decltype(check<rxu::decay_t<F>>(0)), void>::value;
-};
-
-template<class State, class F>
-struct is_on_error_for
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)(*(State*)nullptr, *(rxu::error_ptr*)nullptr));
- template<class CF>
- static not_void check(...);
-
- static const bool value = std::is_same<decltype(check<rxu::decay_t<F>>(0)), void>::value;
-};
-
-template<class F>
-struct is_on_completed
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)());
- template<class CF>
- static not_void check(...);
-
- static const bool value = std::is_same<decltype(check<rxu::decay_t<F>>(0)), void>::value;
-};
-
-}
-
-
-/*!
- \brief consumes values from an observable using `State` that may implement on_next, on_error and on_completed with optional overrides of each function.
-
- \tparam T - the type of value in the stream
- \tparam State - the type of the stored state
- \tparam OnNext - the type of a function that matches `void(State&, T)`. Called 0 or more times. If `void` State::on_next will be called.
- \tparam OnError - the type of a function that matches `void(State&, rxu::error_ptr)`. Called 0 or 1 times, no further calls will be made. If `void` State::on_error will be called.
- \tparam OnCompleted - the type of a function that matches `void(State&)`. Called 0 or 1 times, no further calls will be made. If `void` State::on_completed will be called.
-
- \ingroup group-core
-
-*/
-template<class T, class State, class OnNext, class OnError, class OnCompleted>
-class observer : public observer_base<T>
-{
-public:
- using this_type = observer<T, State, OnNext, OnError, OnCompleted>;
- using state_t = rxu::decay_t<State>;
- using on_next_t = typename std::conditional<
- !std::is_same<void, OnNext>::value,
- rxu::decay_t<OnNext>,
- detail::OnNextForward<T, State, OnNext>>::type;
- using on_error_t = typename std::conditional<
- !std::is_same<void, OnError>::value,
- rxu::decay_t<OnError>,
- detail::OnErrorForward<State, OnError>>::type;
- using on_completed_t = typename std::conditional<
- !std::is_same<void, OnCompleted>::value,
- rxu::decay_t<OnCompleted>,
- detail::OnCompletedForward<State, OnCompleted>>::type;
-
-private:
- mutable state_t state;
- on_next_t onnext;
- on_error_t onerror;
- on_completed_t oncompleted;
-
-public:
-
- explicit observer(state_t s, on_next_t n = on_next_t(), on_error_t e = on_error_t(), on_completed_t c = on_completed_t())
- : state(std::move(s))
- , onnext(std::move(n))
- , onerror(std::move(e))
- , oncompleted(std::move(c))
- {
- }
- explicit observer(state_t s, on_next_t n, on_completed_t c)
- : state(std::move(s))
- , onnext(std::move(n))
- , onerror(on_error_t())
- , oncompleted(std::move(c))
- {
- }
- observer(const this_type& o)
- : state(o.state)
- , onnext(o.onnext)
- , onerror(o.onerror)
- , oncompleted(o.oncompleted)
- {
- }
- observer(this_type&& o)
- : state(std::move(o.state))
- , onnext(std::move(o.onnext))
- , onerror(std::move(o.onerror))
- , oncompleted(std::move(o.oncompleted))
- {
- }
- this_type& operator=(this_type o) {
- state = std::move(o.state);
- onnext = std::move(o.onnext);
- onerror = std::move(o.onerror);
- oncompleted = std::move(o.oncompleted);
- return *this;
- }
-
- void on_next(T& t) const {
- onnext(state, t);
- }
- void on_next(T&& t) const {
- onnext(state, std::move(t));
- }
- void on_error(rxu::error_ptr e) const {
- onerror(state, e);
- }
- void on_completed() const {
- oncompleted(state);
- }
- observer<T> as_dynamic() const {
- return observer<T>(*this);
- }
-};
-
-/*!
- \brief consumes values from an observable using default empty method implementations with optional overrides of each function.
-
- \tparam T - the type of value in the stream
- \tparam OnNext - the type of a function that matches `void(T)`. Called 0 or more times. If `void` OnNextEmpty<T> is used.
- \tparam OnError - the type of a function that matches `void(rxu::error_ptr)`. Called 0 or 1 times, no further calls will be made. If `void` OnErrorEmpty is used.
- \tparam OnCompleted - the type of a function that matches `void()`. Called 0 or 1 times, no further calls will be made. If `void` OnCompletedEmpty is used.
-
- \ingroup group-core
-
-*/
-template<class T, class OnNext, class OnError, class OnCompleted>
-class observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted> : public observer_base<T>
-{
-public:
- using this_type = observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>;
- using on_next_t = typename std::conditional<
- !std::is_same<void, OnNext>::value,
- rxu::decay_t<OnNext>,
- detail::OnNextEmpty<T>>::type;
- using on_error_t = typename std::conditional<
- !std::is_same<void, OnError>::value,
- rxu::decay_t<OnError>,
- detail::OnErrorEmpty>::type;
- using on_completed_t = typename std::conditional<
- !std::is_same<void, OnCompleted>::value,
- rxu::decay_t<OnCompleted>,
- detail::OnCompletedEmpty>::type;
-
-private:
- on_next_t onnext;
- on_error_t onerror;
- on_completed_t oncompleted;
-
-public:
- static_assert(detail::is_on_next_of<T, on_next_t>::value, "Function supplied for on_next must be a function with the signature void(T);");
- static_assert(detail::is_on_error<on_error_t>::value, "Function supplied for on_error must be a function with the signature void(rxu::error_ptr);");
- static_assert(detail::is_on_completed<on_completed_t>::value, "Function supplied for on_completed must be a function with the signature void();");
-
- observer()
- : onnext(on_next_t())
- , onerror(on_error_t())
- , oncompleted(on_completed_t())
- {
- }
-
- explicit observer(on_next_t n, on_error_t e = on_error_t(), on_completed_t c = on_completed_t())
- : onnext(std::move(n))
- , onerror(std::move(e))
- , oncompleted(std::move(c))
- {
- }
- observer(const this_type& o)
- : onnext(o.onnext)
- , onerror(o.onerror)
- , oncompleted(o.oncompleted)
- {
- }
- observer(this_type&& o)
- : onnext(std::move(o.onnext))
- , onerror(std::move(o.onerror))
- , oncompleted(std::move(o.oncompleted))
- {
- }
- this_type& operator=(this_type o) {
- onnext = std::move(o.onnext);
- onerror = std::move(o.onerror);
- oncompleted = std::move(o.oncompleted);
- return *this;
- }
-
- void on_next(T& t) const {
- onnext(t);
- }
- void on_next(T&& t) const {
- onnext(std::move(t));
- }
- void on_error(rxu::error_ptr e) const {
- onerror(e);
- }
- void on_completed() const {
- oncompleted();
- }
- observer<T> as_dynamic() const {
- return observer<T>(*this);
- }
-};
-
-namespace detail
-{
-
-template<class T>
-struct virtual_observer : public std::enable_shared_from_this<virtual_observer<T>>
-{
- virtual ~virtual_observer() {}
- virtual void on_next(T&) const {};
- virtual void on_next(T&&) const {};
- virtual void on_error(rxu::error_ptr) const {};
- virtual void on_completed() const {};
-};
-
-template<class T, class Observer>
-struct specific_observer : public virtual_observer<T>
-{
- explicit specific_observer(Observer o)
- : destination(std::move(o))
- {
- }
-
- Observer destination;
- virtual void on_next(T& t) const {
- destination.on_next(t);
- }
- virtual void on_next(T&& t) const {
- destination.on_next(std::move(t));
- }
- virtual void on_error(rxu::error_ptr e) const {
- destination.on_error(e);
- }
- virtual void on_completed() const {
- destination.on_completed();
- }
-};
-
-}
-
-/*!
- \brief consumes values from an observable using type-forgetting (shared allocated state with virtual methods)
-
- \tparam T - the type of value in the stream
-
- \ingroup group-core
-
-*/
-template<class T>
-class observer<T, void, void, void, void> : public observer_base<T>
-{
-public:
- typedef tag_dynamic_observer dynamic_observer_tag;
-
-private:
- using this_type = observer<T, void, void, void, void>;
- using base_type = observer_base<T>;
- using virtual_observer = detail::virtual_observer<T>;
-
- std::shared_ptr<virtual_observer> destination;
-
- template<class Observer>
- static auto make_destination(Observer o)
- -> std::shared_ptr<virtual_observer> {
- return std::make_shared<detail::specific_observer<T, Observer>>(std::move(o));
- }
-
-public:
- observer()
- {
- }
- observer(const this_type& o)
- : destination(o.destination)
- {
- }
- observer(this_type&& o)
- : destination(std::move(o.destination))
- {
- }
-
- template<class Observer>
- explicit observer(Observer o)
- : destination(make_destination(std::move(o)))
- {
- }
-
- this_type& operator=(this_type o) {
- destination = std::move(o.destination);
- return *this;
- }
-
- // perfect forwarding delays the copy of the value.
- template<class V>
- void on_next(V&& v) const {
- if (destination) {
- destination->on_next(std::forward<V>(v));
- }
- }
- void on_error(rxu::error_ptr e) const {
- if (destination) {
- destination->on_error(e);
- }
- }
- void on_completed() const {
- if (destination) {
- destination->on_completed();
- }
- }
-
- observer<T> as_dynamic() const {
- return *this;
- }
-};
-
-template<class T, class DefaultOnError = detail::OnErrorEmpty>
-auto make_observer()
- -> observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>, DefaultOnError> {
- return observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>, DefaultOnError>();
-}
-
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class U, class State, class OnNext, class OnError, class OnCompleted>
-auto make_observer(observer<U, State, OnNext, OnError, OnCompleted> o)
- -> observer<T, State, OnNext, OnError, OnCompleted> {
- return observer<T, State, OnNext, OnError, OnCompleted>(std::move(o));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class Observer>
-auto make_observer(Observer ob)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !detail::is_on_error<Observer>::value &&
- is_observer<Observer>::value,
- Observer>::type {
- return std::move(ob);
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class Observer>
-auto make_observer(Observer ob)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !detail::is_on_error<Observer>::value &&
- !is_observer<Observer>::value,
- observer<T, Observer>>::type {
- return observer<T, Observer>(std::move(ob));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class OnNext>
-auto make_observer(OnNext on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- observer<T, detail::stateless_observer_tag, OnNext, DefaultOnError>>::type {
- return observer<T, detail::stateless_observer_tag, OnNext, DefaultOnError>(
- std::move(on));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class OnError>
-auto make_observer(OnError oe)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, OnError>::value &&
- detail::is_on_error<OnError>::value,
- observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>, OnError>>::type {
- return observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>, OnError>(
- detail::OnNextEmpty<T>(), std::move(oe));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class OnNext, class OnError>
-auto make_observer(OnNext on, OnError oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- observer<T, detail::stateless_observer_tag, OnNext, OnError>>::type {
- return observer<T, detail::stateless_observer_tag, OnNext, OnError>(
- std::move(on), std::move(oe));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class OnNext, class OnCompleted>
-auto make_observer(OnNext on, OnCompleted oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- observer<T, detail::stateless_observer_tag, OnNext, DefaultOnError, OnCompleted>>::type {
- return observer<T, detail::stateless_observer_tag, OnNext, DefaultOnError, OnCompleted>(
- std::move(on), DefaultOnError(), std::move(oc));
-}
-template<class T, class DefaultOnError = detail::OnErrorEmpty, class OnNext, class OnError, class OnCompleted>
-auto make_observer(OnNext on, OnError oe, OnCompleted oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>::type {
- return observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(
- std::move(on), std::move(oe), std::move(oc));
-}
-
-
-template<class T, class State, class OnNext>
-auto make_observer(State os, OnNext on)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, State>::value &&
- !detail::is_on_error<State>::value,
- observer<T, State, OnNext>>::type {
- return observer<T, State, OnNext>(
- std::move(os), std::move(on));
-}
-template<class T, class State, class OnError>
-auto make_observer(State os, OnError oe)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, State>::value &&
- !detail::is_on_error<State>::value &&
- detail::is_on_error_for<State, OnError>::value,
- observer<T, State, detail::OnNextEmpty<T>, OnError>>::type {
- return observer<T, State, detail::OnNextEmpty<T>, OnError>(
- std::move(os), detail::OnNextEmpty<T>(), std::move(oe));
-}
-template<class T, class State, class OnNext, class OnError>
-auto make_observer(State os, OnNext on, OnError oe)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, State>::value &&
- !detail::is_on_error<State>::value &&
- detail::is_on_error_for<State, OnError>::value,
- observer<T, State, OnNext, OnError>>::type {
- return observer<T, State, OnNext, OnError>(
- std::move(os), std::move(on), std::move(oe));
-}
-template<class T, class State, class OnNext, class OnCompleted>
-auto make_observer(State os, OnNext on, OnCompleted oc)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, State>::value &&
- !detail::is_on_error<State>::value,
- observer<T, State, OnNext, void, OnCompleted>>::type {
- return observer<T, State, OnNext, void, OnCompleted>(
- std::move(os), std::move(on), std::move(oc));
-}
-template<class T, class State, class OnNext, class OnError, class OnCompleted>
-auto make_observer(State os, OnNext on, OnError oe, OnCompleted oc)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, State>::value &&
- !detail::is_on_error<State>::value &&
- detail::is_on_error_for<State, OnError>::value,
- observer<T, State, OnNext, OnError, OnCompleted>>::type {
- return observer<T, State, OnNext, OnError, OnCompleted>(
- std::move(os), std::move(on), std::move(oe), std::move(oc));
-}
-
-template<class T, class Observer>
-auto make_observer_dynamic(Observer o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value,
- observer<T>>::type {
- return observer<T>(std::move(o));
-}
-template<class T, class OnNext>
-auto make_observer_dynamic(OnNext&& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- observer<T>>::type {
- return observer<T>(
- make_observer<T>(std::forward<OnNext>(on)));
-}
-template<class T, class OnNext, class OnError>
-auto make_observer_dynamic(OnNext&& on, OnError&& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- observer<T>>::type {
- return observer<T>(
- make_observer<T>(std::forward<OnNext>(on), std::forward<OnError>(oe)));
-}
-template<class T, class OnNext, class OnCompleted>
-auto make_observer_dynamic(OnNext&& on, OnCompleted&& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- observer<T>>::type {
- return observer<T>(
- make_observer<T>(std::forward<OnNext>(on), std::forward<OnCompleted>(oc)));
-}
-template<class T, class OnNext, class OnError, class OnCompleted>
-auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- observer<T>>::type {
- return observer<T>(
- make_observer<T>(std::forward<OnNext>(on), std::forward<OnError>(oe), std::forward<OnCompleted>(oc)));
-}
-
-namespace detail {
-
-template<class F>
-struct maybe_from_result
-{
- typedef decltype((*(F*)nullptr)()) decl_result_type;
- typedef rxu::decay_t<decl_result_type> result_type;
- typedef rxu::maybe<result_type> type;
-};
-
-}
-
-template<class F, class OnError>
-auto on_exception(const F& f, const OnError& c)
- -> typename std::enable_if<detail::is_on_error<OnError>::value, typename detail::maybe_from_result<F>::type>::type {
- typename detail::maybe_from_result<F>::type r;
- RXCPP_TRY {
- r.reset(f());
- } RXCPP_CATCH(...) {
- c(rxu::current_exception());
- }
- return r;
-}
-
-template<class F, class Subscriber>
-auto on_exception(const F& f, const Subscriber& s)
- -> typename std::enable_if<is_subscriber<Subscriber>::value, typename detail::maybe_from_result<F>::type>::type {
- typename detail::maybe_from_result<F>::type r;
- RXCPP_TRY {
- r.reset(f());
- } RXCPP_CATCH(...) {
- s.on_error(rxu::current_exception());
- }
- return r;
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp
deleted file mode 100644
index 9a5481a..0000000
--- a/Rx/v2/src/rxcpp/rx-operators.hpp
+++ /dev/null
@@ -1,534 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_OPERATORS_HPP)
-#define RXCPP_RX_OPERATORS_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace operators {
-
-struct tag_operator {};
-template<class T>
-struct operator_base
-{
- typedef T value_type;
- typedef tag_operator operator_tag;
-};
-
-namespace detail {
-
-template<class T, class =rxu::types_checked>
-struct is_operator : std::false_type
-{
-};
-
-template<class T>
-struct is_operator<T, rxu::types_checked_t<typename T::operator_tag>>
- : std::is_convertible<typename T::operator_tag*, tag_operator*>
-{
-};
-
-}
-
-template<class T, class Decayed = rxu::decay_t<T>>
-struct is_operator : detail::is_operator<Decayed>
-{
-};
-
-
-}
-namespace rxo=operators;
-
-template<class Tag>
-struct member_overload
-{
- template<class... AN>
- static auto member(AN&&...) ->
- typename Tag::template include_header<std::false_type> {
- return typename Tag::template include_header<std::false_type>();
- }
-};
-
-template<class T, class... AN>
-struct delayed_type{using value_type = T; static T value(AN**...) {return T{};}};
-
-template<class T, class... AN>
-using delayed_type_t = rxu::value_type_t<delayed_type<T, AN...>>;
-
-template<class Tag, class... AN, class Overload = member_overload<rxu::decay_t<Tag>>>
-auto observable_member(Tag, AN&&... an) ->
- decltype(Overload::member(std::forward<AN>(an)...)) {
- return Overload::member(std::forward<AN>(an)...);
-}
-
-template<class Tag, class... AN>
-class operator_factory
-{
- using this_type = operator_factory<Tag, AN...>;
- using tag_type = rxu::decay_t<Tag>;
- using tuple_type = std::tuple<rxu::decay_t<AN>...>;
-
- tuple_type an;
-
-public:
- operator_factory(tuple_type an)
- : an(std::move(an))
- {
- }
-
- template<class... ZN>
- auto operator()(tag_type t, ZN&&... zn) const
- -> decltype(observable_member(t, std::forward<ZN>(zn)...)) {
- return observable_member(t, std::forward<ZN>(zn)...);
- }
-
- template<class Observable>
- auto operator()(Observable source) const
- -> decltype(rxu::apply(std::tuple_cat(std::make_tuple(tag_type{}, source), (*(tuple_type*)nullptr)), (*(this_type*)nullptr))) {
- return rxu::apply(std::tuple_cat(std::make_tuple(tag_type{}, source), an), *this);
- }
-};
-
-}
-
-#include "operators/rx-lift.hpp"
-#include "operators/rx-subscribe.hpp"
-
-namespace rxcpp {
-
-struct amb_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-amb.hpp>");
- };
-};
-
-struct all_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-all.hpp>");
- };
-};
-
-struct is_empty_tag : all_tag {};
-
-struct any_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-any.hpp>");
- };
-};
-
-struct exists_tag : any_tag {};
-struct contains_tag : any_tag {};
-
-struct buffer_count_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-buffer_count.hpp>");
- };
-};
-
-struct buffer_with_time_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-buffer_time.hpp>");
- };
-};
-
-struct buffer_with_time_or_count_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-buffer_time_count.hpp>");
- };
-};
-
-struct combine_latest_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-combine_latest.hpp>");
- };
-};
-
-struct concat_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-concat.hpp>");
- };
-};
-
-struct concat_map_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-concat_map.hpp>");
- };
-};
-
-struct connect_forever_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-connect_forever.hpp>");
- };
-};
-
-struct debounce_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-debounce.hpp>");
- };
-};
-
-struct delay_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-delay.hpp>");
- };
-};
-
-struct distinct_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-distinct.hpp>");
- };
-};
-
-struct distinct_until_changed_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-distinct_until_changed.hpp>");
- };
-};
-
-struct element_at_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-element_at.hpp>");
- };
-};
-
-struct filter_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-filter.hpp>");
- };
-};
-
-struct finally_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-finally.hpp>");
- };
-};
-
-struct flat_map_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-flat_map.hpp>");
- };
-};
-
-struct group_by_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-group_by.hpp>");
- };
-};
-
-struct ignore_elements_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-ignore_elements.hpp>");
- };
-};
-
-struct map_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-map.hpp>");
- };
-};
-
-struct merge_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-merge.hpp>");
- };
-};
-struct merge_delay_error_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-merge_delay_error.hpp>");
- };
-};
-
-struct multicast_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-multicast.hpp>");
- };
-};
-
-struct observe_on_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-observe_on.hpp>");
- };
-};
-
-struct on_error_resume_next_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-on_error_resume_next.hpp>");
- };
-};
-
-class empty_error: public std::runtime_error
-{
- public:
- explicit empty_error(const std::string& msg):
- std::runtime_error(msg)
- {}
-};
-struct reduce_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-reduce.hpp>");
- };
-};
-struct first_tag : reduce_tag {};
-struct last_tag : reduce_tag {};
-struct sum_tag : reduce_tag {};
-struct average_tag : reduce_tag {};
-struct min_tag : reduce_tag {};
-struct max_tag : reduce_tag {};
-
-struct ref_count_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-ref_count.hpp>");
- };
-};
-
-struct pairwise_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-pairwise.hpp>");
- };
-};
-
-struct publish_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-publish.hpp>");
- };
-};
-struct publish_synchronized_tag : publish_tag {};
-
-struct repeat_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-repeat.hpp>");
- };
-};
-
-struct replay_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-replay.hpp>");
- };
-};
-
-struct retry_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-retry.hpp>");
- };
-};
-
-struct sample_with_time_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-sample_time.hpp>");
- };
-};
-
-struct scan_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-scan.hpp>");
- };
-};
-
-struct sequence_equal_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-sequence_equal.hpp>");
- };
-};
-
-struct skip_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-skip.hpp>");
- };
-};
-
-struct skip_while_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-skip_while.hpp>");
- };
-};
-
-struct skip_last_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-skip_last.hpp>");
- };
-};
-
-struct skip_until_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-skip_until.hpp>");
- };
-};
-
-struct start_with_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-start_with.hpp>");
- };
-};
-
-struct subscribe_on_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-subscribe_on.hpp>");
- };
-};
-
-struct switch_if_empty_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-switch_if_empty.hpp>");
- };
-};
-struct default_if_empty_tag : switch_if_empty_tag {};
-
-struct switch_on_next_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-switch_on_next.hpp>");
- };
-};
-
-struct take_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-take.hpp>");
- };
-};
-
-struct take_last_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-take_last.hpp>");
- };
-};
-
-struct take_while_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-take_while.hpp>");
- };
-};
-
-struct take_until_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-take_until.hpp>");
- };
-};
-
-struct tap_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-rap.hpp>");
- };
-};
-
-struct timeout_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-timeout.hpp>");
- };
-};
-
-struct time_interval_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-time_interval.hpp>");
- };
-};
-
-struct timestamp_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-timestamp.hpp>");
- };
-};
-
-struct window_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-window.hpp>");
- };
-};
-
-struct window_with_time_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-window_time.hpp>");
- };
-};
-
-struct window_with_time_or_count_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-window_time_count.hpp>");
- };
-};
-
-struct window_toggle_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-window_toggle.hpp>");
- };
-};
-
-struct with_latest_from_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-with_latest_from.hpp>");
- };
-};
-
-struct zip_tag {
- template<class Included>
- struct include_header{
- static_assert(Included::value, "missing include: please #include <rxcpp/operators/rx-zip.hpp>");
- };
-};
-
-}
-
-#include "operators/rx-multicast.hpp"
-#include "operators/rx-publish.hpp"
-#include "operators/rx-ref_count.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp
deleted file mode 100644
index f833620..0000000
--- a/Rx/v2/src/rxcpp/rx-predef.hpp
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_PREDEF_HPP)
-#define RXCPP_RX_PREDEF_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-//
-// create a typedef for rxcpp_trace_type to override the default
-//
-inline auto trace_activity() -> decltype(rxcpp_trace_activity(trace_tag()))& {
- static decltype(rxcpp_trace_activity(trace_tag())) trace;
- return trace;
-}
-
-
-struct tag_action {};
-template<class T, class C = rxu::types_checked>
-struct is_action : public std::false_type {};
-
-template<class T>
-struct is_action<T, typename rxu::types_checked_from<typename T::action_tag>::type>
- : public std::is_convertible<typename T::action_tag*, tag_action*> {};
-
-
-struct tag_worker {};
-template<class T>
-class is_worker
-{
- struct not_void {};
- template<class C>
- static typename C::worker_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_worker*>::value;
-};
-
-struct tag_scheduler {};
-template<class T>
-class is_scheduler
-{
- struct not_void {};
- template<class C>
- static typename C::scheduler_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_scheduler*>::value;
-};
-
-struct tag_schedulable {};
-template<class T>
-class is_schedulable
-{
- struct not_void {};
- template<class C>
- static typename C::schedulable_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_schedulable*>::value;
-};
-
-namespace detail
-{
-
-struct stateless_observer_tag {};
-
-}
-
-// state with optional overrides
-template<class T, class State = void, class OnNext = void, class OnError = void, class OnCompleted = void>
-class observer;
-
-// no state with optional overrides
-template<class T, class OnNext, class OnError, class OnCompleted>
-class observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>;
-
-// virtual functions forward to dynamically allocated shared observer instance.
-template<class T>
-class observer<T, void, void, void, void>;
-
-struct tag_observer {};
-template<class T>
-class is_observer
-{
- template<class C>
- static typename C::observer_tag* check(int);
- template<class C>
- static void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_observer*>::value;
-};
-
-struct tag_dynamic_observer {};
-template<class T>
-class is_dynamic_observer
-{
- struct not_void {};
- template<class C>
- static typename C::dynamic_observer_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_dynamic_observer*>::value;
-};
-
-struct tag_subscriber {};
-template<class T>
-class is_subscriber
-{
- struct not_void {};
- template<class C>
- static typename C::subscriber_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_subscriber*>::value;
-};
-
-struct tag_dynamic_observable {};
-template<class T>
-class is_dynamic_observable
-{
- struct not_void {};
- template<class C>
- static typename C::dynamic_observable_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_dynamic_observable*>::value;
-};
-
-template<class T>
-class dynamic_observable;
-
-template<
- class T = void,
- class SourceObservable = typename std::conditional<std::is_same<T, void>::value,
- void, dynamic_observable<T>>::type>
-class observable;
-
-template<class T, class Source>
-observable<T> make_observable_dynamic(Source&&);
-
-template<class Selector, class Default, template<class... TN> class SO, class... AN>
-struct defer_observable;
-
-struct tag_observable {};
-template<class T>
-struct observable_base {
- typedef tag_observable observable_tag;
- typedef T value_type;
-};
-
-namespace detail {
-
-template<class T, class =rxu::types_checked>
-struct is_observable : std::false_type
-{
-};
-
-template<class T>
-struct is_observable<T, rxu::types_checked_t<typename T::observable_tag>>
- : std::is_convertible<typename T::observable_tag*, tag_observable*>
-{
-};
-
-}
-
-template<class T, class Decayed = rxu::decay_t<T>>
-struct is_observable : detail::is_observable<Decayed>
-{
-};
-
-template<class Observable, class DecayedObservable = rxu::decay_t<Observable>>
-using observable_tag_t = typename DecayedObservable::observable_tag;
-
-// extra indirection for vs2013 support
-template<class Types, class =rxu::types_checked>
-struct expand_observable_tags { struct type; };
-template<class... ObservableN>
-struct expand_observable_tags<rxu::types<ObservableN...>, rxu::types_checked_t<typename ObservableN::observable_tag...>>
-{
- using type = rxu::types<typename ObservableN::observable_tag...>;
-};
-template<class... ObservableN>
-using observable_tags_t = typename expand_observable_tags<rxu::types<ObservableN...>>::type;
-
-template<class... ObservableN>
-using all_observables = rxu::all_true_type<is_observable<ObservableN>...>;
-
-struct tag_dynamic_connectable_observable : public tag_dynamic_observable {};
-
-template<class T>
-class is_dynamic_connectable_observable
-{
- struct not_void {};
- template<class C>
- static typename C::dynamic_observable_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_dynamic_connectable_observable*>::value;
-};
-
-template<class T>
-class dynamic_connectable_observable;
-
-template<class T,
- class SourceObservable = typename std::conditional<std::is_same<T, void>::value,
- void, dynamic_connectable_observable<T>>::type>
-class connectable_observable;
-
-struct tag_connectable_observable : public tag_observable {};
-template<class T>
-class is_connectable_observable
-{
- template<class C>
- static typename C::observable_tag check(int);
- template<class C>
- static void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_connectable_observable>::value;
-};
-
-struct tag_dynamic_grouped_observable : public tag_dynamic_observable {};
-
-template<class T>
-class is_dynamic_grouped_observable
-{
- struct not_void {};
- template<class C>
- static typename C::dynamic_observable_tag* check(int);
- template<class C>
- static not_void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_dynamic_grouped_observable*>::value;
-};
-
-template<class K, class T>
-class dynamic_grouped_observable;
-
-template<class K, class T,
- class SourceObservable = typename std::conditional<std::is_same<T, void>::value,
- void, dynamic_grouped_observable<K, T>>::type>
-class grouped_observable;
-
-template<class K, class T, class Source>
-grouped_observable<K, T> make_dynamic_grouped_observable(Source&& s);
-
-struct tag_grouped_observable : public tag_observable {};
-template<class T>
-class is_grouped_observable
-{
- template<class C>
- static typename C::observable_tag check(int);
- template<class C>
- static void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_grouped_observable>::value;
-};
-
-template<class Source, class Function>
-struct is_operator_factory_for {
- using function_type = rxu::decay_t<Function>;
- using source_type = rxu::decay_t<Source>;
-
-// check methods instead of void_t for vs2013 support
-
- struct tag_not_valid;
- template<class CS, class CO>
- static auto check(int) -> decltype((*(CS*)nullptr)((*(CO*)nullptr)));
- template<class CS, class CO>
- static tag_not_valid check(...);
-
- using type = decltype(check<function_type, source_type>(0));
-
- static const bool value = !std::is_same<type, tag_not_valid>::value && is_observable<source_type>::value;
-};
-
-//
-// this type is the default used by operators that subscribe to
-// multiple sources. It assumes that the sources are already synchronized
-//
-struct identity_observable
-{
- template<class Observable>
- auto operator()(Observable o)
- -> Observable {
- return std::move(o);
- static_assert(is_observable<Observable>::value, "only support observables");
- }
-};
-
-template<class T>
-struct identity_for
-{
- T operator()(T t) {
- return std::move(t);
- }
-};
-
-template<class T, class Seed, class Accumulator>
-struct is_accumulate_function_for {
-
- typedef rxu::decay_t<Accumulator> accumulator_type;
- typedef rxu::decay_t<Seed> seed_type;
- typedef T source_value_type;
-
- struct tag_not_valid {};
- template<class CS, class CV, class CRS>
- static auto check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr, *(CV*)nullptr));
- template<class CS, class CV, class CRS>
- static tag_not_valid check(...);
-
- typedef decltype(check<seed_type, source_value_type, accumulator_type>(0)) type;
- static const bool value = std::is_same<type, seed_type>::value;
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp
deleted file mode 100644
index fc68979..0000000
--- a/Rx/v2/src/rxcpp/rx-scheduler.hpp
+++ /dev/null
@@ -1,961 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_HPP)
-#define RXCPP_RX_SCHEDULER_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-class worker_interface;
-class scheduler_interface;
-
-namespace detail {
-
-class action_type;
-typedef std::shared_ptr<action_type> action_ptr;
-
-typedef std::shared_ptr<worker_interface> worker_interface_ptr;
-typedef std::shared_ptr<const worker_interface> const_worker_interface_ptr;
-
-typedef std::weak_ptr<worker_interface> worker_interface_weak_ptr;
-typedef std::weak_ptr<const worker_interface> const_worker_interface_weak_ptr;
-
-typedef std::shared_ptr<scheduler_interface> scheduler_interface_ptr;
-typedef std::shared_ptr<const scheduler_interface> const_scheduler_interface_ptr;
-
-inline action_ptr shared_empty() {
- static action_ptr shared_empty = std::make_shared<detail::action_type>();
- return shared_empty;
-}
-
-}
-
-// It is essential to keep virtual function calls out of an inner loop.
-// To make tail-recursion work efficiently the recursion objects create
-// a space on the stack inside the virtual function call in the actor that
-// allows the callback and the scheduler to share stack space that records
-// the request and the allowance without any virtual calls in the loop.
-
-/// recursed is set on a schedulable by the action to allow the called
-/// function to request to be rescheduled.
-class recursed
-{
- bool& isrequested;
- recursed operator=(const recursed&);
-public:
- explicit recursed(bool& r)
- : isrequested(r)
- {
- }
- /// request to be rescheduled
- inline void operator()() const {
- isrequested = true;
- }
-};
-
-/// recurse is passed to the action by the scheduler.
-/// the action uses recurse to coordinate the scheduler and the function.
-class recurse
-{
- bool& isallowed;
- mutable bool isrequested;
- recursed requestor;
- recurse operator=(const recurse&);
-public:
- explicit recurse(bool& a)
- : isallowed(a)
- , isrequested(true)
- , requestor(isrequested)
- {
- }
- /// does the scheduler allow tail-recursion now?
- inline bool is_allowed() const {
- return isallowed;
- }
- /// did the function request to be recursed?
- inline bool is_requested() const {
- return isrequested;
- }
- /// reset the function request. call before each call to the function.
- inline void reset() const {
- isrequested = false;
- }
- /// get the recursed to set into the schedulable for the function to use to request recursion
- inline const recursed& get_recursed() const {
- return requestor;
- }
-};
-
-/// recursion is used by the scheduler to signal to each action whether tail recursion is allowed.
-class recursion
-{
- mutable bool isallowed;
- recurse recursor;
- recursion operator=(const recursion&);
-public:
- recursion()
- : isallowed(true)
- , recursor(isallowed)
- {
- }
- explicit recursion(bool b)
- : isallowed(b)
- , recursor(isallowed)
- {
- }
- /// set whether tail-recursion is allowed
- inline void reset(bool b = true) const {
- isallowed = b;
- }
- /// get the recurse to pass into each action being called
- inline const recurse& get_recurse() const {
- return recursor;
- }
-};
-
-
-struct action_base
-{
- typedef tag_action action_tag;
-};
-
-class schedulable;
-
-/// action provides type-forgetting for a potentially recursive set of calls to a function that takes a schedulable
-class action : public action_base
-{
- typedef action this_type;
- detail::action_ptr inner;
-public:
- action()
- {
- }
- explicit action(detail::action_ptr i)
- : inner(std::move(i))
- {
- }
-
- /// return the empty action
- inline static action empty() {
- return action(detail::shared_empty());
- }
-
- /// call the function
- inline void operator()(const schedulable& s, const recurse& r) const;
-};
-
-struct scheduler_base
-{
- typedef std::chrono::steady_clock clock_type;
- typedef tag_scheduler scheduler_tag;
-};
-
-struct worker_base : public subscription_base
-{
- typedef tag_worker worker_tag;
-};
-
-class worker_interface
- : public std::enable_shared_from_this<worker_interface>
-{
- typedef worker_interface this_type;
-
-public:
- typedef scheduler_base::clock_type clock_type;
-
- virtual ~worker_interface() {}
-
- virtual clock_type::time_point now() const = 0;
-
- virtual void schedule(const schedulable& scbl) const = 0;
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const = 0;
-};
-
-namespace detail {
-
-template<class F>
-struct is_action_function
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)(*(schedulable*)nullptr));
- template<class CF>
- static not_void check(...);
-
- static const bool value = std::is_same<decltype(check<rxu::decay_t<F>>(0)), void>::value;
-};
-
-}
-
-class weak_worker;
-
-/// a worker ensures that all scheduled actions on the same instance are executed in-order with no overlap
-/// a worker ensures that all scheduled actions are unsubscribed when it is unsubscribed
-/// some inner implementations will impose additional constraints on the execution of items.
-class worker : public worker_base
-{
- typedef worker this_type;
- detail::worker_interface_ptr inner;
- composite_subscription lifetime;
- friend bool operator==(const worker&, const worker&);
- friend class weak_worker;
-public:
- typedef scheduler_base::clock_type clock_type;
- typedef composite_subscription::weak_subscription weak_subscription;
-
- worker()
- {
- }
- worker(composite_subscription cs, detail::const_worker_interface_ptr i)
- : inner(std::const_pointer_cast<worker_interface>(i))
- , lifetime(std::move(cs))
- {
- }
- worker(composite_subscription cs, worker o)
- : inner(o.inner)
- , lifetime(std::move(cs))
- {
- }
-
- inline const composite_subscription& get_subscription() const {
- return lifetime;
- }
- inline composite_subscription& get_subscription() {
- return lifetime;
- }
-
- // composite_subscription
- //
- inline bool is_subscribed() const {
- return lifetime.is_subscribed();
- }
- inline weak_subscription add(subscription s) const {
- return lifetime.add(std::move(s));
- }
- inline void remove(weak_subscription w) const {
- return lifetime.remove(std::move(w));
- }
- inline void clear() const {
- return lifetime.clear();
- }
- inline void unsubscribe() const {
- return lifetime.unsubscribe();
- }
-
- // worker_interface
- //
- /// return the current time for this worker
- inline clock_type::time_point now() const {
- return inner->now();
- }
-
- /// insert the supplied schedulable to be run as soon as possible
- inline void schedule(const schedulable& scbl) const {
- // force rebinding scbl to this worker
- schedule_rebind(scbl);
- }
-
- /// insert the supplied schedulable to be run at the time specified
- inline void schedule(clock_type::time_point when, const schedulable& scbl) const {
- // force rebinding scbl to this worker
- schedule_rebind(when, scbl);
- }
-
- // helpers
- //
-
- /// insert the supplied schedulable to be run at now() + the delay specified
- inline void schedule(clock_type::duration when, const schedulable& scbl) const {
- // force rebinding scbl to this worker
- schedule_rebind(now() + when, scbl);
- }
-
- /// insert the supplied schedulable to be run at the initial time specified and then again at initial + (N * period)
- /// this will continue until the worker or schedulable is unsubscribed.
- inline void schedule_periodically(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl) const {
- // force rebinding scbl to this worker
- schedule_periodically_rebind(initial, period, scbl);
- }
-
- /// insert the supplied schedulable to be run at now() + the initial delay specified and then again at now() + initial + (N * period)
- /// this will continue until the worker or schedulable is unsubscribed.
- inline void schedule_periodically(clock_type::duration initial, clock_type::duration period, const schedulable& scbl) const {
- // force rebinding scbl to this worker
- schedule_periodically_rebind(now() + initial, period, scbl);
- }
-
- /// use the supplied arguments to make a schedulable and then insert it to be run
- template<class Arg0, class... ArgN>
- auto schedule(Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type;
- template<class... ArgN>
- /// use the supplied arguments to make a schedulable and then insert it to be run
- void schedule_rebind(const schedulable& scbl, ArgN&&... an) const;
-
- /// use the supplied arguments to make a schedulable and then insert it to be run
- template<class Arg0, class... ArgN>
- auto schedule(clock_type::time_point when, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type;
- /// use the supplied arguments to make a schedulable and then insert it to be run
- template<class... ArgN>
- void schedule_rebind(clock_type::time_point when, const schedulable& scbl, ArgN&&... an) const;
-
- /// use the supplied arguments to make a schedulable and then insert it to be run
- template<class Arg0, class... ArgN>
- auto schedule_periodically(clock_type::time_point initial, clock_type::duration period, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type;
- /// use the supplied arguments to make a schedulable and then insert it to be run
- template<class... ArgN>
- void schedule_periodically_rebind(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl, ArgN&&... an) const;
-};
-
-inline bool operator==(const worker& lhs, const worker& rhs) {
- return lhs.inner == rhs.inner && lhs.lifetime == rhs.lifetime;
-}
-inline bool operator!=(const worker& lhs, const worker& rhs) {
- return !(lhs == rhs);
-}
-
-class weak_worker
-{
- detail::worker_interface_weak_ptr inner;
- composite_subscription lifetime;
-
-public:
- weak_worker()
- {
- }
- explicit weak_worker(worker& owner)
- : inner(owner.inner)
- , lifetime(owner.lifetime)
- {
- }
-
- worker lock() const {
- return worker(lifetime, inner.lock());
- }
-};
-
-class scheduler_interface
- : public std::enable_shared_from_this<scheduler_interface>
-{
- typedef scheduler_interface this_type;
-
-public:
- typedef scheduler_base::clock_type clock_type;
-
- virtual ~scheduler_interface() {}
-
- virtual clock_type::time_point now() const = 0;
-
- virtual worker create_worker(composite_subscription cs) const = 0;
-};
-
-
-struct schedulable_base :
- // public subscription_base, <- already in worker base
- public worker_base,
- public action_base
-{
- typedef tag_schedulable schedulable_tag;
-};
-
-/*!
- \brief allows functions to be called at specified times and possibly in other contexts.
-
- \ingroup group-core
-
-*/
-class scheduler : public scheduler_base
-{
- typedef scheduler this_type;
- detail::scheduler_interface_ptr inner;
- friend bool operator==(const scheduler&, const scheduler&);
-public:
- typedef scheduler_base::clock_type clock_type;
-
- scheduler()
- {
- }
- explicit scheduler(detail::scheduler_interface_ptr i)
- : inner(std::move(i))
- {
- }
- explicit scheduler(detail::const_scheduler_interface_ptr i)
- : inner(std::const_pointer_cast<scheduler_interface>(i))
- {
- }
-
- /// return the current time for this scheduler
- inline clock_type::time_point now() const {
- return inner->now();
- }
- /// create a worker with a lifetime.
- /// when the worker is unsubscribed all scheduled items will be unsubscribed.
- /// items scheduled to a worker will be run one at a time.
- /// scheduling order is preserved: when more than one item is scheduled for
- /// time T then at time T they will be run in the order that they were scheduled.
- inline worker create_worker(composite_subscription cs = composite_subscription()) const {
- return inner->create_worker(cs);
- }
-};
-
-template<class Scheduler, class... ArgN>
-inline scheduler make_scheduler(ArgN&&... an) {
- return scheduler(std::static_pointer_cast<scheduler_interface>(std::make_shared<Scheduler>(std::forward<ArgN>(an)...)));
-}
-
-inline scheduler make_scheduler(std::shared_ptr<scheduler_interface> si) {
- return scheduler(si);
-}
-
-class schedulable : public schedulable_base
-{
- typedef schedulable this_type;
-
- composite_subscription lifetime;
- weak_worker controller;
- action activity;
- bool scoped;
- composite_subscription::weak_subscription action_scope;
-
- struct detacher
- {
- ~detacher()
- {
- if (that) {
- that->unsubscribe();
- }
- }
- detacher(const this_type* that)
- : that(that)
- {
- }
- const this_type* that;
- };
-
- class recursed_scope_type
- {
- mutable const recursed* requestor;
-
- class exit_recursed_scope_type
- {
- const recursed_scope_type* that;
- public:
- ~exit_recursed_scope_type()
- {
- if (that != nullptr) {
- that->requestor = nullptr;
- }
- }
- exit_recursed_scope_type(const recursed_scope_type* that)
- : that(that)
- {
- }
- exit_recursed_scope_type(exit_recursed_scope_type && other) RXCPP_NOEXCEPT
- : that(other.that)
- {
- other.that = nullptr;
- }
- };
- public:
- recursed_scope_type()
- : requestor(nullptr)
- {
- }
- recursed_scope_type(const recursed_scope_type&)
- : requestor(nullptr)
- {
- // does not aquire recursion scope
- }
- recursed_scope_type& operator=(const recursed_scope_type& )
- {
- // no change in recursion scope
- return *this;
- }
- exit_recursed_scope_type reset(const recurse& r) const {
- requestor = std::addressof(r.get_recursed());
- return exit_recursed_scope_type(this);
- }
- bool is_recursed() const {
- return !!requestor;
- }
- void operator()() const {
- (*requestor)();
- }
- };
- recursed_scope_type recursed_scope;
-
-public:
- typedef composite_subscription::weak_subscription weak_subscription;
- typedef scheduler_base::clock_type clock_type;
-
- ~schedulable()
- {
- if (scoped) {
- controller.lock().remove(action_scope);
- }
- }
- schedulable()
- : scoped(false)
- {
- }
-
- /// action and worker share lifetime
- schedulable(worker q, action a)
- : lifetime(q.get_subscription())
- , controller(q)
- , activity(std::move(a))
- , scoped(false)
- {
- }
- /// action and worker have independent lifetimes
- schedulable(composite_subscription cs, worker q, action a)
- : lifetime(std::move(cs))
- , controller(q)
- , activity(std::move(a))
- , scoped(true)
- , action_scope(controller.lock().add(lifetime))
- {
- }
- /// inherit lifetimes
- schedulable(schedulable scbl, worker q, action a)
- : lifetime(scbl.get_subscription())
- , controller(q)
- , activity(std::move(a))
- , scoped(scbl.scoped)
- , action_scope(scbl.scoped ? controller.lock().add(lifetime) : weak_subscription())
- {
- }
-
- inline const composite_subscription& get_subscription() const {
- return lifetime;
- }
- inline composite_subscription& get_subscription() {
- return lifetime;
- }
- inline const worker get_worker() const {
- return controller.lock();
- }
- inline worker get_worker() {
- return controller.lock();
- }
- inline const action& get_action() const {
- return activity;
- }
- inline action& get_action() {
- return activity;
- }
-
- inline static schedulable empty(worker sc) {
- return schedulable(composite_subscription::empty(), sc, action::empty());
- }
-
- inline auto set_recursed(const recurse& r) const
- -> decltype(recursed_scope.reset(r)) {
- return recursed_scope.reset(r);
- }
-
- // recursed
- //
- bool is_recursed() const {
- return recursed_scope.is_recursed();
- }
- /// requests tail-recursion of the same action
- /// this will exit the process if called when
- /// is_recursed() is false.
- /// Note: to improve perf it is not required
- /// to call is_recursed() before calling this
- /// operator. Context is sufficient. The schedulable
- /// passed to the action by the scheduler will return
- /// true from is_recursed()
- inline void operator()() const {
- recursed_scope();
- }
-
- // composite_subscription
- //
- inline bool is_subscribed() const {
- return lifetime.is_subscribed();
- }
- inline weak_subscription add(subscription s) const {
- return lifetime.add(std::move(s));
- }
- template<class F>
- auto add(F f) const
- -> typename std::enable_if<rxcpp::detail::is_unsubscribe_function<F>::value, weak_subscription>::type {
- return lifetime.add(make_subscription(std::move(f)));
- }
- inline void remove(weak_subscription w) const {
- return lifetime.remove(std::move(w));
- }
- inline void clear() const {
- return lifetime.clear();
- }
- inline void unsubscribe() const {
- return lifetime.unsubscribe();
- }
-
- // scheduler
- //
- inline clock_type::time_point now() const {
- return controller.lock().now();
- }
- /// put this on the queue of the stored scheduler to run asap
- inline void schedule() const {
- if (is_subscribed()) {
- get_worker().schedule(*this);
- }
- }
- /// put this on the queue of the stored scheduler to run at the specified time
- inline void schedule(clock_type::time_point when) const {
- if (is_subscribed()) {
- get_worker().schedule(when, *this);
- }
- }
- /// put this on the queue of the stored scheduler to run after a delay from now
- inline void schedule(clock_type::duration when) const {
- if (is_subscribed()) {
- get_worker().schedule(when, *this);
- }
- }
-
- // action
- //
- /// invokes the action
- inline void operator()(const recurse& r) const {
- if (!is_subscribed()) {
- return;
- }
- detacher protect(this);
- activity(*this, r);
- protect.that = nullptr;
- }
-};
-
-struct current_thread;
-
-namespace detail {
-
-class action_type
- : public std::enable_shared_from_this<action_type>
-{
- typedef action_type this_type;
-
-public:
- typedef std::function<void(const schedulable&, const recurse&)> function_type;
-
-private:
- function_type f;
-
-public:
- action_type()
- {
- }
-
- action_type(function_type f)
- : f(std::move(f))
- {
- }
-
- inline void operator()(const schedulable& s, const recurse& r) {
- if (!f) {
- std::terminate();
- }
- f(s, r);
- }
-};
-
-class action_tailrecurser
- : public std::enable_shared_from_this<action_type>
-{
- typedef action_type this_type;
-
-public:
- typedef std::function<void(const schedulable&)> function_type;
-
-private:
- function_type f;
-
-public:
- action_tailrecurser()
- {
- }
-
- action_tailrecurser(function_type f)
- : f(std::move(f))
- {
- }
-
- inline void operator()(const schedulable& s, const recurse& r) {
- if (!f) {
- std::terminate();
- }
- trace_activity().action_enter(s);
- auto scope = s.set_recursed(r);
- while (s.is_subscribed()) {
- r.reset();
- f(s);
- if (!r.is_allowed() || !r.is_requested()) {
- if (r.is_requested()) {
- s.schedule();
- }
- break;
- }
- trace_activity().action_recurse(s);
- }
- trace_activity().action_return(s);
- }
-};
-}
-
-inline void action::operator()(const schedulable& s, const recurse& r) const {
- (*inner)(s, r);
-}
-
-inline action make_action_empty() {
- return action::empty();
-}
-
-template<class F>
-inline action make_action(F&& f) {
- static_assert(detail::is_action_function<F>::value, "action function must be void(schedulable)");
- auto fn = std::forward<F>(f);
- return action(std::make_shared<detail::action_type>(detail::action_tailrecurser(fn)));
-}
-
-// copy
-inline auto make_schedulable(
- const schedulable& scbl)
- -> schedulable {
- return schedulable(scbl);
-}
-// move
-inline auto make_schedulable(
- schedulable&& scbl)
- -> schedulable {
- return schedulable(std::move(scbl));
-}
-
-inline schedulable make_schedulable(worker sc, action a) {
- return schedulable(sc, a);
-}
-inline schedulable make_schedulable(worker sc, composite_subscription cs, action a) {
- return schedulable(cs, sc, a);
-}
-
-template<class F>
-auto make_schedulable(worker sc, F&& f)
- -> typename std::enable_if<detail::is_action_function<F>::value, schedulable>::type {
- return schedulable(sc, make_action(std::forward<F>(f)));
-}
-template<class F>
-auto make_schedulable(worker sc, composite_subscription cs, F&& f)
- -> typename std::enable_if<detail::is_action_function<F>::value, schedulable>::type {
- return schedulable(cs, sc, make_action(std::forward<F>(f)));
-}
-template<class F>
-auto make_schedulable(schedulable scbl, composite_subscription cs, F&& f)
- -> typename std::enable_if<detail::is_action_function<F>::value, schedulable>::type {
- return schedulable(cs, scbl.get_worker(), make_action(std::forward<F>(f)));
-}
-template<class F>
-auto make_schedulable(schedulable scbl, worker sc, F&& f)
- -> typename std::enable_if<detail::is_action_function<F>::value, schedulable>::type {
- return schedulable(scbl, sc, make_action(std::forward<F>(f)));
-}
-template<class F>
-auto make_schedulable(schedulable scbl, F&& f)
- -> typename std::enable_if<detail::is_action_function<F>::value, schedulable>::type {
- return schedulable(scbl, scbl.get_worker(), make_action(std::forward<F>(f)));
-}
-
-inline auto make_schedulable(schedulable scbl, composite_subscription cs)
- -> schedulable {
- return schedulable(cs, scbl.get_worker(), scbl.get_action());
-}
-inline auto make_schedulable(schedulable scbl, worker sc, composite_subscription cs)
- -> schedulable {
- return schedulable(cs, sc, scbl.get_action());
-}
-inline auto make_schedulable(schedulable scbl, worker sc)
- -> schedulable {
- return schedulable(scbl, sc, scbl.get_action());
-}
-
-template<class Arg0, class... ArgN>
-auto worker::schedule(Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type {
- auto scbl = make_schedulable(*this, std::forward<Arg0>(a0), std::forward<ArgN>(an)...);
- trace_activity().schedule_enter(*inner.get(), scbl);
- inner->schedule(std::move(scbl));
- trace_activity().schedule_return(*inner.get());
-}
-template<class... ArgN>
-void worker::schedule_rebind(const schedulable& scbl, ArgN&&... an) const {
- auto rescbl = make_schedulable(scbl, *this, std::forward<ArgN>(an)...);
- trace_activity().schedule_enter(*inner.get(), rescbl);
- inner->schedule(std::move(rescbl));
- trace_activity().schedule_return(*inner.get());
-}
-
-template<class Arg0, class... ArgN>
-auto worker::schedule(clock_type::time_point when, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type {
- auto scbl = make_schedulable(*this, std::forward<Arg0>(a0), std::forward<ArgN>(an)...);
- trace_activity().schedule_when_enter(*inner.get(), when, scbl);
- inner->schedule(when, std::move(scbl));
- trace_activity().schedule_when_return(*inner.get());
-}
-template<class... ArgN>
-void worker::schedule_rebind(clock_type::time_point when, const schedulable& scbl, ArgN&&... an) const {
- auto rescbl = make_schedulable(scbl, *this, std::forward<ArgN>(an)...);
- trace_activity().schedule_when_enter(*inner.get(), when, rescbl);
- inner->schedule(when, std::move(rescbl));
- trace_activity().schedule_when_return(*inner.get());
-}
-
-template<class Arg0, class... ArgN>
-auto worker::schedule_periodically(clock_type::time_point initial, clock_type::duration period, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type {
- schedule_periodically_rebind(initial, period, make_schedulable(*this, std::forward<Arg0>(a0), std::forward<ArgN>(an)...));
-}
-template<class... ArgN>
-void worker::schedule_periodically_rebind(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl, ArgN&&... an) const {
- auto keepAlive = *this;
- auto target = std::make_shared<clock_type::time_point>(initial);
- auto activity = make_schedulable(scbl, keepAlive, std::forward<ArgN>(an)...);
- auto periodic = make_schedulable(
- activity,
- [keepAlive, target, period, activity](schedulable self) {
- // any recursion requests will be pushed to the scheduler queue
- recursion r(false);
- // call action
- activity(r.get_recurse());
-
- // schedule next occurance (if the action took longer than 'period' target will be in the past)
- *target += period;
- self.schedule(*target);
- });
- trace_activity().schedule_when_enter(*inner.get(), *target, periodic);
- inner->schedule(*target, periodic);
- trace_activity().schedule_when_return(*inner.get());
-}
-
-namespace detail {
-
-template<class TimePoint>
-struct time_schedulable
-{
- typedef TimePoint time_point_type;
-
- time_schedulable(TimePoint when, schedulable a)
- : when(when)
- , what(std::move(a))
- {
- }
- TimePoint when;
- schedulable what;
-};
-
-
-// Sorts time_schedulable items in priority order sorted
-// on value of time_schedulable.when. Items with equal
-// values for when are sorted in fifo order.
-template<class TimePoint>
-class schedulable_queue {
-public:
- typedef time_schedulable<TimePoint> item_type;
- typedef std::pair<item_type, int64_t> elem_type;
- typedef std::vector<elem_type> container_type;
- typedef const item_type& const_reference;
-
-private:
- struct compare_elem
- {
- bool operator()(const elem_type& lhs, const elem_type& rhs) const {
- if (lhs.first.when == rhs.first.when) {
- return lhs.second > rhs.second;
- }
- else {
- return lhs.first.when > rhs.first.when;
- }
- }
- };
-
- typedef std::priority_queue<
- elem_type,
- container_type,
- compare_elem
- > queue_type;
-
- queue_type q;
-
- int64_t ordinal;
-public:
-
- schedulable_queue()
- : ordinal(0)
- {
- }
-
- const_reference top() const {
- return q.top().first;
- }
-
- void pop() {
- q.pop();
- }
-
- bool empty() const {
- return q.empty();
- }
-
- void push(const item_type& value) {
- q.push(elem_type(value, ordinal++));
- }
-
- void push(item_type&& value) {
- q.push(elem_type(std::move(value), ordinal++));
- }
-};
-
-}
-
-}
-namespace rxsc=schedulers;
-
-}
-
-#include "schedulers/rx-currentthread.hpp"
-#include "schedulers/rx-runloop.hpp"
-#include "schedulers/rx-newthread.hpp"
-#include "schedulers/rx-eventloop.hpp"
-#include "schedulers/rx-immediate.hpp"
-#include "schedulers/rx-virtualtime.hpp"
-#include "schedulers/rx-sameworker.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp
deleted file mode 100644
index 51ed07d..0000000
--- a/Rx/v2/src/rxcpp/rx-sources.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SOURCES_HPP)
-#define RXCPP_RX_SOURCES_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace sources {
-
-struct tag_source {};
-template<class T>
-struct source_base
-{
- typedef T value_type;
- typedef tag_source source_tag;
-};
-template<class T>
-class is_source
-{
- template<class C>
- static typename C::source_tag* check(int);
- template<class C>
- static void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_source*>::value;
-};
-
-}
-namespace rxs=sources;
-
-}
-
-#include "sources/rx-create.hpp"
-#include "sources/rx-range.hpp"
-#include "sources/rx-iterate.hpp"
-#include "sources/rx-interval.hpp"
-#include "sources/rx-empty.hpp"
-#include "sources/rx-defer.hpp"
-#include "sources/rx-never.hpp"
-#include "sources/rx-error.hpp"
-#include "sources/rx-scope.hpp"
-#include "sources/rx-timer.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-subjects.hpp b/Rx/v2/src/rxcpp/rx-subjects.hpp
deleted file mode 100644
index bcbe3c8..0000000
--- a/Rx/v2/src/rxcpp/rx-subjects.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_SUBJECTS_HPP)
-#define RXCPP_RX_SCHEDULER_SUBJECTS_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace subjects {
-
-}
-namespace rxsub=subjects;
-
-}
-
-#include "subjects/rx-subject.hpp"
-#include "subjects/rx-behavior.hpp"
-#include "subjects/rx-replaysubject.hpp"
-#include "subjects/rx-synchronize.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp
deleted file mode 100644
index 3d6c515..0000000
--- a/Rx/v2/src/rxcpp/rx-subscriber.hpp
+++ /dev/null
@@ -1,835 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SUBSCRIBER_HPP)
-#define RXCPP_RX_SUBSCRIBER_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-template<class T>
-struct subscriber_base : public observer_base<T>, public subscription_base
-{
- typedef tag_subscriber subscriber_tag;
-};
-
-/*!
- \brief binds an observer that consumes values with a composite_subscription that controls lifetime.
-
- \ingroup group-core
-
-*/
-template<class T, class Observer = observer<T>>
-class subscriber : public subscriber_base<T>
-{
- static_assert(!is_subscriber<Observer>::value, "not allowed to nest subscribers");
- static_assert(is_observer<Observer>::value, "subscriber must contain an observer<T, ...>");
- typedef subscriber<T, Observer> this_type;
- typedef rxu::decay_t<Observer> observer_type;
-
- composite_subscription lifetime;
- observer_type destination;
- trace_id id;
-
- struct nextdetacher
- {
- ~nextdetacher()
- {
- trace_activity().on_next_return(*that);
- if (do_unsubscribe) {
- that->unsubscribe();
- }
- }
- nextdetacher(const this_type* that)
- : that(that)
- , do_unsubscribe(true)
- {
- }
- template<class U>
- void operator()(U u) {
- trace_activity().on_next_enter(*that, u);
- RXCPP_TRY {
- that->destination.on_next(std::move(u));
- do_unsubscribe = false;
- } RXCPP_CATCH(...) {
- auto ex = rxu::current_exception();
- trace_activity().on_error_enter(*that, ex);
- that->destination.on_error(std::move(ex));
- trace_activity().on_error_return(*that);
- }
- }
- const this_type* that;
- volatile bool do_unsubscribe;
- };
-
- struct errordetacher
- {
- ~errordetacher()
- {
- trace_activity().on_error_return(*that);
- that->unsubscribe();
- }
- errordetacher(const this_type* that)
- : that(that)
- {
- }
- inline void operator()(rxu::error_ptr ex) {
- trace_activity().on_error_enter(*that, ex);
- that->destination.on_error(std::move(ex));
- }
- const this_type* that;
- };
-
- struct completeddetacher
- {
- ~completeddetacher()
- {
- trace_activity().on_completed_return(*that);
- that->unsubscribe();
- }
- completeddetacher(const this_type* that)
- : that(that)
- {
- }
- inline void operator()() {
- trace_activity().on_completed_enter(*that);
- that->destination.on_completed();
- }
- const this_type* that;
- };
-
- subscriber();
-public:
- typedef typename composite_subscription::weak_subscription weak_subscription;
-
- subscriber(const this_type& o)
- : lifetime(o.lifetime)
- , destination(o.destination)
- , id(o.id)
- {
- }
- subscriber(this_type&& o)
- : lifetime(std::move(o.lifetime))
- , destination(std::move(o.destination))
- , id(std::move(o.id))
- {
- }
-
- template<class U, class O>
- friend class subscriber;
-
- template<class O>
- subscriber(
- const subscriber<T, O>& o,
- typename std::enable_if<
- !std::is_same<O, observer<T>>::value &&
- std::is_same<Observer, observer<T>>::value, void**>::type = nullptr)
- : lifetime(o.lifetime)
- , destination(o.destination.as_dynamic())
- , id(o.id)
- {
- }
-
- template<class U>
- subscriber(trace_id id, composite_subscription cs, U&& o)
- : lifetime(std::move(cs))
- , destination(std::forward<U>(o))
- , id(std::move(id))
- {
- static_assert(!is_subscriber<U>::value, "cannot nest subscribers");
- static_assert(is_observer<U>::value, "must pass observer to subscriber");
- trace_activity().create_subscriber(*this);
- }
-
- this_type& operator=(this_type o) {
- lifetime = std::move(o.lifetime);
- destination = std::move(o.destination);
- id = std::move(o.id);
- return *this;
- }
-
- const observer_type& get_observer() const {
- return destination;
- }
- observer_type& get_observer() {
- return destination;
- }
- const composite_subscription& get_subscription() const {
- return lifetime;
- }
- composite_subscription& get_subscription() {
- return lifetime;
- }
- trace_id get_id() const {
- return id;
- }
-
- subscriber<T> as_dynamic() const {
- return subscriber<T>(id, lifetime, destination.as_dynamic());
- }
-
- // observer
- //
- template<class V>
- void on_next(V&& v) const {
- if (!is_subscribed()) {
- return;
- }
- nextdetacher protect(this);
- protect(std::forward<V>(v));
- }
- void on_error(rxu::error_ptr e) const {
- if (!is_subscribed()) {
- return;
- }
- errordetacher protect(this);
- protect(std::move(e));
- }
- void on_completed() const {
- if (!is_subscribed()) {
- return;
- }
- completeddetacher protect(this);
- protect();
- }
-
- // composite_subscription
- //
- bool is_subscribed() const {
- return lifetime.is_subscribed();
- }
- weak_subscription add(subscription s) const {
- return lifetime.add(std::move(s));
- }
- template<class F>
- auto add(F f) const
- -> typename std::enable_if<detail::is_unsubscribe_function<F>::value, weak_subscription>::type {
- return lifetime.add(make_subscription(std::move(f)));
- }
- void remove(weak_subscription w) const {
- return lifetime.remove(std::move(w));
- }
- void clear() const {
- return lifetime.clear();
- }
- void unsubscribe() const {
- return lifetime.unsubscribe();
- }
-
-};
-
-template<class T, class Observer>
-auto make_subscriber(
- subscriber<T, Observer> o)
- -> subscriber<T, Observer> {
- return subscriber<T, Observer>(std::move(o));
-}
-
-// observer
-//
-
-template<class T>
-auto make_subscriber()
- -> typename std::enable_if<
- detail::is_on_next_of<T, detail::OnNextEmpty<T>>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>>(trace_id::make_next_id_subscriber(), composite_subscription(),
- observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>(detail::OnNextEmpty<T>()));
-}
-
-template<class T, class I>
-auto make_subscriber(
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(trace_id::make_next_id_subscriber(), composite_subscription(), o);
-}
-template<class T, class Observer>
-auto make_subscriber(const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value &&
- !is_subscriber<Observer>::value,
- subscriber<T, Observer>>::type {
- return subscriber<T, Observer>(trace_id::make_next_id_subscriber(), composite_subscription(), o);
-}
-template<class T, class Observer>
-auto make_subscriber(const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- return subscriber<T, observer<T, Observer>>(trace_id::make_next_id_subscriber(), composite_subscription(), o);
-}
-template<class T, class OnNext>
-auto make_subscriber(const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(trace_id::make_next_id_subscriber(), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext>(on));
-}
-template<class T, class OnNext, class OnError>
-auto make_subscriber(const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(trace_id::make_next_id_subscriber(), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
-}
-template<class T, class OnNext, class OnCompleted>
-auto make_subscriber(const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(trace_id::make_next_id_subscriber(), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
-}
-template<class T, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(trace_id::make_next_id_subscriber(), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
-}
-
-// explicit lifetime
-//
-
-template<class T>
-auto make_subscriber(const composite_subscription& cs)
- -> subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>> {
- return subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>(detail::OnNextEmpty<T>()));
-}
-
-template<class T, class I>
-auto make_subscriber(const composite_subscription& cs,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(trace_id::make_next_id_subscriber(), cs, o);
-}
-template<class T, class I>
-auto make_subscriber(const composite_subscription& cs,
- const subscriber<T, I>& s)
- -> subscriber<T, I> {
- return subscriber<T, I>(trace_id::make_next_id_subscriber(), cs, s.get_observer());
-}
-template<class T, class Observer>
-auto make_subscriber(const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- !is_subscriber<Observer>::value &&
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- return subscriber<T, Observer>(trace_id::make_next_id_subscriber(), cs, o);
-}
-template<class T, class Observer>
-auto make_subscriber(const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- return subscriber<T, observer<T, Observer>>(trace_id::make_next_id_subscriber(), cs, make_observer<T>(o));
-}
-template<class T, class OnNext>
-auto make_subscriber(const composite_subscription& cs, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext>(on));
-}
-template<class T, class OnNext, class OnError>
-auto make_subscriber(const composite_subscription& cs, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
-}
-template<class T, class OnNext, class OnCompleted>
-auto make_subscriber(const composite_subscription& cs, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
-}
-template<class T, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
-}
-
-// explicit id
-//
-
-template<class T>
-auto make_subscriber(trace_id id)
- -> subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>> {
- return subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>>(std::move(id), composite_subscription(),
- observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>(detail::OnNextEmpty<T>()));
-}
-
-template<class T>
-auto make_subscriber(trace_id id, const composite_subscription& cs)
- -> subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>> {
- return subscriber<T, observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, detail::OnNextEmpty<T>>(detail::OnNextEmpty<T>()));
-}
-
-template<class T, class I>
-auto make_subscriber(trace_id id,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(std::move(id), composite_subscription(), o);
-}
-template<class T, class I>
-auto make_subscriber(trace_id id, const composite_subscription& cs,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(std::move(id), cs, o);
-}
-template<class T, class Observer>
-auto make_subscriber(trace_id id, const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- return subscriber<T, Observer>(std::move(id), composite_subscription(), o);
-}
-template<class T, class Observer>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- return subscriber<T, Observer>(std::move(id), cs, o);
-}
-template<class T, class Observer>
-auto make_subscriber(trace_id id, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- return subscriber<T, observer<T, Observer>>(std::move(id), composite_subscription(), o);
-}
-template<class T, class Observer>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- return subscriber<T, observer<T, Observer>>(std::move(id), cs, o);
-}
-template<class T, class OnNext>
-auto make_subscriber(trace_id id, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(std::move(id), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext>(on));
-}
-template<class T, class OnNext>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext>(on));
-}
-template<class T, class OnNext, class OnError>
-auto make_subscriber(trace_id id, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(std::move(id), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
-}
-template<class T, class OnNext, class OnError>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
-}
-template<class T, class OnNext, class OnCompleted>
-auto make_subscriber(trace_id id, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(std::move(id), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
-}
-template<class T, class OnNext, class OnCompleted>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
-}
-template<class T, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(trace_id id, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(std::move(id), composite_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
-}
-template<class T, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(trace_id id, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- return subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
-}
-
-// chain defaults from subscriber
-//
-
-template<class T, class OtherT, class OtherObserver, class I>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- auto r = subscriber<T, observer<T, I>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class I>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- auto r = subscriber<T, observer<T, I>>(std::move(id), scbr.get_subscription(), o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- auto r = subscriber<T, Observer>(std::move(id), scbr.get_subscription(), o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const Observer& o)
- -> typename std::enable_if<
- !is_subscription<Observer>::value &&
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- auto r = subscriber<T, Observer>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- auto r = subscriber<T, observer<T, Observer>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), make_observer<T>(o));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- auto r = subscriber<T, observer<T, Observer>>(std::move(id), scbr.get_subscription(), o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext>(on));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(std::move(id), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext>(on));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(std::move(id), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(std::move(id), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(std::move(id), scbr.get_subscription(),
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-
-template<class T, class OtherT, class OtherObserver, class I>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& , const composite_subscription& cs,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(trace_id::make_next_id_subscriber(), cs, o);
-}
-template<class T, class OtherT, class OtherObserver, class I>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>&, trace_id id, const composite_subscription& cs,
- const observer<T, I>& o)
- -> subscriber<T, observer<T, I>> {
- return subscriber<T, observer<T, I>>(std::move(id), cs, o);
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- auto r = subscriber<T, Observer>(trace_id::make_next_id_subscriber(), cs, o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- is_observer<Observer>::value,
- subscriber<T, Observer>>::type {
- auto r = subscriber<T, Observer>(std::move(id), cs, o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- auto r = subscriber<T, observer<T, Observer>>(trace_id::make_next_id_subscriber(), cs, o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class Observer>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const Observer& o)
- -> typename std::enable_if<
- !detail::is_on_next_of<T, Observer>::value &&
- !is_subscriber<Observer>::value &&
- !is_subscription<Observer>::value &&
- !is_observer<Observer>::value,
- subscriber<T, observer<T, Observer>>>::type {
- auto r = subscriber<T, observer<T, Observer>>(std::move(id), cs, o);
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext>(on));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const OnNext& on)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext>(on));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const OnNext& on, const OnError& oe)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError>(on, oe));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, detail::OnErrorEmpty, OnCompleted>(on, detail::OnErrorEmpty(), oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(trace_id::make_next_id_subscriber(), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class OtherT, class OtherObserver, class OnNext, class OnError, class OnCompleted>
-auto make_subscriber(const subscriber<OtherT, OtherObserver>& scbr, trace_id id, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc)
- -> typename std::enable_if<
- detail::is_on_next_of<T, OnNext>::value &&
- detail::is_on_error<OnError>::value &&
- detail::is_on_completed<OnCompleted>::value,
- subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>>::type {
- auto r = subscriber<T, observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>>(std::move(id), cs,
- observer<T, detail::stateless_observer_tag, OnNext, OnError, OnCompleted>(on, oe, oc));
- trace_activity().connect(r, scbr);
- return r;
-}
-
-template<class T, class Observer>
-auto make_subscriber(const subscriber<T, Observer>& scbr, const composite_subscription& cs)
- -> subscriber<T, Observer> {
- auto r = subscriber<T, Observer>(scbr.get_id(), cs, scbr.get_observer());
- trace_activity().connect(r, scbr);
- return r;
-}
-template<class T, class Observer>
-auto make_subscriber(const subscriber<T, Observer>& scbr, trace_id id, const composite_subscription& cs)
- -> subscriber<T, Observer> {
- auto r = subscriber<T, Observer>(std::move(id), cs, scbr.get_observer());
- trace_activity().connect(r, scbr);
- return r;
-}
-
-template<class T, class Observer>
-auto make_subscriber(const subscriber<T, Observer>& scbr, trace_id id)
- -> subscriber<T, Observer> {
- auto r = subscriber<T, Observer>(std::move(id), scbr.get_subscription(), scbr.get_observer());
- trace_activity().connect(r, scbr);
- return r;
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp
deleted file mode 100644
index 2d6bcb6..0000000
--- a/Rx/v2/src/rxcpp/rx-subscription.hpp
+++ /dev/null
@@ -1,613 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SUBSCRIPTION_HPP)
-#define RXCPP_RX_SUBSCRIPTION_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace detail {
-
-template<class F>
-struct is_unsubscribe_function
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)());
- template<class CF>
- static not_void check(...);
-
- static const bool value = std::is_same<decltype(check<rxu::decay_t<F>>(0)), void>::value;
-};
-
-}
-
-struct tag_subscription {};
-struct subscription_base {typedef tag_subscription subscription_tag;};
-template<class T>
-class is_subscription
-{
- template<class C>
- static typename C::subscription_tag* check(int);
- template<class C>
- static void check(...);
-public:
- static const bool value = std::is_convertible<decltype(check<rxu::decay_t<T>>(0)), tag_subscription*>::value;
-};
-
-template<class Unsubscribe>
-class static_subscription
-{
- typedef rxu::decay_t<Unsubscribe> unsubscribe_call_type;
- unsubscribe_call_type unsubscribe_call;
- static_subscription()
- {
- }
-public:
- static_subscription(const static_subscription& o)
- : unsubscribe_call(o.unsubscribe_call)
- {
- }
- static_subscription(static_subscription&& o)
- : unsubscribe_call(std::move(o.unsubscribe_call))
- {
- }
- static_subscription(unsubscribe_call_type s)
- : unsubscribe_call(std::move(s))
- {
- }
- void unsubscribe() const {
- unsubscribe_call();
- }
-};
-
-class subscription : public subscription_base
-{
- class base_subscription_state : public std::enable_shared_from_this<base_subscription_state>
- {
- base_subscription_state();
- public:
-
- explicit base_subscription_state(bool initial)
- : issubscribed(initial)
- {
- }
- virtual ~base_subscription_state() {}
- virtual void unsubscribe() {
- }
- std::atomic<bool> issubscribed;
- };
-public:
- typedef std::weak_ptr<base_subscription_state> weak_state_type;
-
-private:
- template<class I>
- struct subscription_state : public base_subscription_state
- {
- typedef rxu::decay_t<I> inner_t;
- subscription_state(inner_t i)
- : base_subscription_state(true)
- , inner(std::move(i))
- {
- }
- virtual void unsubscribe() {
- if (issubscribed.exchange(false)) {
- trace_activity().unsubscribe_enter(*this);
- inner.unsubscribe();
- trace_activity().unsubscribe_return(*this);
- }
- }
- inner_t inner;
- };
-
-protected:
- std::shared_ptr<base_subscription_state> state;
-
- friend bool operator<(const subscription&, const subscription&);
- friend bool operator==(const subscription&, const subscription&);
-
-private:
- subscription(weak_state_type w)
- : state(w.lock())
- {
- if (!state) {
- std::terminate();
- }
- }
-
- explicit subscription(std::shared_ptr<base_subscription_state> s)
- : state(std::move(s))
- {
- if (!state) {
- std::terminate();
- }
- }
-public:
-
- subscription()
- : state(std::make_shared<base_subscription_state>(false))
- {
- if (!state) {
- std::terminate();
- }
- }
- template<class U>
- explicit subscription(U u, typename std::enable_if<!is_subscription<U>::value, void**>::type = nullptr)
- : state(std::make_shared<subscription_state<U>>(std::move(u)))
- {
- if (!state) {
- std::terminate();
- }
- }
- template<class U>
- explicit subscription(U u, typename std::enable_if<!std::is_same<subscription, U>::value && is_subscription<U>::value, void**>::type = nullptr)
- // intentionally slice
- : state(std::move((*static_cast<subscription*>(&u)).state))
- {
- if (!state) {
- std::terminate();
- }
- }
- subscription(const subscription& o)
- : state(o.state)
- {
- if (!state) {
- std::terminate();
- }
- }
- subscription(subscription&& o)
- : state(std::move(o.state))
- {
- if (!state) {
- std::terminate();
- }
- }
- subscription& operator=(subscription o) {
- state = std::move(o.state);
- return *this;
- }
- bool is_subscribed() const {
- if (!state) {
- std::terminate();
- }
- return state->issubscribed;
- }
- void unsubscribe() const {
- if (!state) {
- std::terminate();
- }
- auto keepAlive = state;
- state->unsubscribe();
- }
-
- weak_state_type get_weak() {
- return state;
- }
-
- // Atomically promote weak subscription to strong.
- // Calls std::terminate if w has already expired.
- static subscription lock(weak_state_type w) {
- return subscription(w);
- }
-
- // Atomically try to promote weak subscription to strong.
- // Returns an empty maybe<> if w has already expired.
- static rxu::maybe<subscription> maybe_lock(weak_state_type w) {
- auto strong_subscription = w.lock();
- if (!strong_subscription) {
- return rxu::detail::maybe<subscription>{};
- } else {
- return rxu::detail::maybe<subscription>{subscription{std::move(strong_subscription)}};
- }
- }
-};
-
-inline bool operator<(const subscription& lhs, const subscription& rhs) {
- return lhs.state < rhs.state;
-}
-inline bool operator==(const subscription& lhs, const subscription& rhs) {
- return lhs.state == rhs.state;
-}
-inline bool operator!=(const subscription& lhs, const subscription& rhs) {
- return !(lhs == rhs);
-}
-
-
-inline auto make_subscription()
- -> subscription {
- return subscription();
-}
-template<class I>
-auto make_subscription(I&& i)
- -> typename std::enable_if<!is_subscription<I>::value && !detail::is_unsubscribe_function<I>::value,
- subscription>::type {
- return subscription(std::forward<I>(i));
-}
-template<class Unsubscribe>
-auto make_subscription(Unsubscribe&& u)
- -> typename std::enable_if<detail::is_unsubscribe_function<Unsubscribe>::value,
- subscription>::type {
- return subscription(static_subscription<Unsubscribe>(std::forward<Unsubscribe>(u)));
-}
-
-class composite_subscription;
-
-namespace detail {
-
-struct tag_composite_subscription_empty {};
-
-class composite_subscription_inner
-{
-private:
- typedef subscription::weak_state_type weak_subscription;
- struct composite_subscription_state : public std::enable_shared_from_this<composite_subscription_state>
- {
- // invariant: cannot access this data without the lock held.
- std::set<subscription> subscriptions;
- // double checked locking:
- // issubscribed must be loaded again after each lock acquisition.
- // invariant:
- // never call subscription::unsubscribe with lock held.
- std::mutex lock;
- // invariant: transitions from 'true' to 'false' exactly once, at any time.
- std::atomic<bool> issubscribed;
-
- ~composite_subscription_state()
- {
- std::unique_lock<decltype(lock)> guard(lock);
- subscriptions.clear();
- }
-
- composite_subscription_state()
- : issubscribed(true)
- {
- }
- composite_subscription_state(tag_composite_subscription_empty)
- : issubscribed(false)
- {
- }
-
- // Atomically add 's' to the set of subscriptions.
- //
- // If unsubscribe() has already occurred, this immediately
- // calls s.unsubscribe().
- //
- // cs.unsubscribe() [must] happens-before s.unsubscribe()
- //
- // Due to the un-atomic nature of calling 's.unsubscribe()',
- // it is possible to observe the unintuitive
- // add(s)=>s.unsubscribe() prior
- // to any of the unsubscribe()=>sN.unsubscribe().
- inline weak_subscription add(subscription s) {
- if (!issubscribed) { // load.acq [seq_cst]
- s.unsubscribe();
- } else if (s.is_subscribed()) {
- std::unique_lock<decltype(lock)> guard(lock);
- if (!issubscribed) { // load.acq [seq_cst]
- // unsubscribe was called concurrently.
- guard.unlock();
- // invariant: do not call unsubscribe with lock held.
- s.unsubscribe();
- } else {
- subscriptions.insert(s);
- }
- }
- return s.get_weak();
- }
-
- // Atomically remove 'w' from the set of subscriptions.
- //
- // This does nothing if 'w' was already previously removed,
- // or refers to an expired value.
- inline void remove(weak_subscription w) {
- if (issubscribed) { // load.acq [seq_cst]
- rxu::maybe<subscription> maybe_subscription = subscription::maybe_lock(w);
-
- if (maybe_subscription.empty()) {
- // Do nothing if the subscription has already expired.
- return;
- }
-
- std::unique_lock<decltype(lock)> guard(lock);
- // invariant: subscriptions must be accessed under the lock.
-
- if (issubscribed) { // load.acq [seq_cst]
- subscription& s = maybe_subscription.get();
- subscriptions.erase(std::move(s));
- } // else unsubscribe() was called concurrently; this becomes a no-op.
- }
- }
-
- // Atomically clear all subscriptions that were observably added
- // (and not subsequently observably removed).
- //
- // Un-atomically call unsubscribe on those subscriptions.
- //
- // forall subscriptions in {add(s1),add(s2),...}
- // - {remove(s3), remove(s4), ...}:
- // cs.unsubscribe() || cs.clear() happens before s.unsubscribe()
- //
- // cs.unsubscribe() observed-before cs.clear ==> do nothing.
- inline void clear() {
- if (issubscribed) { // load.acq [seq_cst]
- std::unique_lock<decltype(lock)> guard(lock);
-
- if (!issubscribed) { // load.acq [seq_cst]
- // unsubscribe was called concurrently.
- return;
- }
-
- std::set<subscription> v(std::move(subscriptions));
- // invariant: do not call unsubscribe with lock held.
- guard.unlock();
- std::for_each(v.begin(), v.end(),
- [](const subscription& s) {
- s.unsubscribe(); });
- }
- }
-
- // Atomically clear all subscriptions that were observably added
- // (and not subsequently observably removed).
- //
- // Un-atomically call unsubscribe on those subscriptions.
- //
- // Switches to an 'unsubscribed' state, all subsequent
- // adds are immediately unsubscribed.
- //
- // cs.unsubscribe() [must] happens-before
- // cs.add(s) ==> s.unsubscribe()
- //
- // forall subscriptions in {add(s1),add(s2),...}
- // - {remove(s3), remove(s4), ...}:
- // cs.unsubscribe() || cs.clear() happens before s.unsubscribe()
- inline void unsubscribe() {
- if (issubscribed.exchange(false)) { // cas.acq_rel [seq_cst]
- std::unique_lock<decltype(lock)> guard(lock);
-
- // is_subscribed can only transition to 'false' once,
- // does not need an extra atomic access here.
-
- std::set<subscription> v(std::move(subscriptions));
- // invariant: do not call unsubscribe with lock held.
- guard.unlock();
- std::for_each(v.begin(), v.end(),
- [](const subscription& s) {
- s.unsubscribe(); });
- }
- }
- };
-
-public:
- typedef std::shared_ptr<composite_subscription_state> shared_state_type;
-
-protected:
- mutable shared_state_type state;
-
-public:
- composite_subscription_inner()
- : state(std::make_shared<composite_subscription_state>())
- {
- }
- composite_subscription_inner(tag_composite_subscription_empty et)
- : state(std::make_shared<composite_subscription_state>(et))
- {
- }
-
- composite_subscription_inner(const composite_subscription_inner& o)
- : state(o.state)
- {
- if (!state) {
- std::terminate();
- }
- }
- composite_subscription_inner(composite_subscription_inner&& o)
- : state(std::move(o.state))
- {
- if (!state) {
- std::terminate();
- }
- }
-
- composite_subscription_inner& operator=(composite_subscription_inner o)
- {
- state = std::move(o.state);
- if (!state) {
- std::terminate();
- }
- return *this;
- }
-
- inline weak_subscription add(subscription s) const {
- if (!state) {
- std::terminate();
- }
- return state->add(std::move(s));
- }
- inline void remove(weak_subscription w) const {
- if (!state) {
- std::terminate();
- }
- state->remove(std::move(w));
- }
- inline void clear() const {
- if (!state) {
- std::terminate();
- }
- state->clear();
- }
- inline void unsubscribe() {
- if (!state) {
- std::terminate();
- }
- state->unsubscribe();
- }
-};
-
-inline composite_subscription shared_empty();
-
-}
-
-/*!
- \brief controls lifetime for scheduler::schedule and observable<T, SourceOperator>::subscribe.
-
- \ingroup group-core
-
-*/
-class composite_subscription
- : protected detail::composite_subscription_inner
- , public subscription
-{
- typedef detail::composite_subscription_inner inner_type;
-public:
- typedef subscription::weak_state_type weak_subscription;
-
- composite_subscription(detail::tag_composite_subscription_empty et)
- : inner_type(et)
- , subscription() // use empty base
- {
- }
-
-public:
-
- composite_subscription()
- : inner_type()
- , subscription(*static_cast<const inner_type*>(this))
- {
- }
-
- composite_subscription(const composite_subscription& o)
- : inner_type(o)
- , subscription(static_cast<const subscription&>(o))
- {
- }
- composite_subscription(composite_subscription&& o)
- : inner_type(std::move(o))
- , subscription(std::move(static_cast<subscription&>(o)))
- {
- }
-
- composite_subscription& operator=(composite_subscription o)
- {
- inner_type::operator=(std::move(o));
- subscription::operator=(std::move(*static_cast<subscription*>(&o)));
- return *this;
- }
-
- static inline composite_subscription empty() {
- return detail::shared_empty();
- }
-
- using subscription::is_subscribed;
- using subscription::unsubscribe;
-
- using inner_type::clear;
-
- inline weak_subscription add(subscription s) const {
- if (s == static_cast<const subscription&>(*this)) {
- // do not nest the same subscription
- std::terminate();
- //return s.get_weak();
- }
- auto that = this->subscription::state.get();
- trace_activity().subscription_add_enter(*that, s);
- auto w = inner_type::add(std::move(s));
- trace_activity().subscription_add_return(*that);
- return w;
- }
-
- template<class F>
- auto add(F f) const
- -> typename std::enable_if<detail::is_unsubscribe_function<F>::value, weak_subscription>::type {
- return add(make_subscription(std::move(f)));
- }
-
- inline void remove(weak_subscription w) const {
- auto that = this->subscription::state.get();
- trace_activity().subscription_remove_enter(*that, w);
- inner_type::remove(w);
- trace_activity().subscription_remove_return(*that);
- }
-};
-
-inline bool operator<(const composite_subscription& lhs, const composite_subscription& rhs) {
- return static_cast<const subscription&>(lhs) < static_cast<const subscription&>(rhs);
-}
-inline bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) {
- return static_cast<const subscription&>(lhs) == static_cast<const subscription&>(rhs);
-}
-inline bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) {
- return !(lhs == rhs);
-}
-
-namespace detail {
-
-inline composite_subscription shared_empty() {
- static composite_subscription shared_empty = composite_subscription(tag_composite_subscription_empty());
- return shared_empty;
-}
-
-}
-
-template<class T>
-class resource : public subscription_base
-{
-public:
- typedef typename composite_subscription::weak_subscription weak_subscription;
-
- resource()
- : lifetime(composite_subscription())
- , value(std::make_shared<rxu::detail::maybe<T>>())
- {
- }
-
- explicit resource(T t, composite_subscription cs = composite_subscription())
- : lifetime(std::move(cs))
- , value(std::make_shared<rxu::detail::maybe<T>>(rxu::detail::maybe<T>(std::move(t))))
- {
- auto localValue = value;
- lifetime.add(
- [localValue](){
- localValue->reset();
- }
- );
- }
-
- T& get() {
- return value.get()->get();
- }
- composite_subscription& get_subscription() {
- return lifetime;
- }
-
- bool is_subscribed() const {
- return lifetime.is_subscribed();
- }
- weak_subscription add(subscription s) const {
- return lifetime.add(std::move(s));
- }
- template<class F>
- auto add(F f) const
- -> typename std::enable_if<detail::is_unsubscribe_function<F>::value, weak_subscription>::type {
- return lifetime.add(make_subscription(std::move(f)));
- }
- void remove(weak_subscription w) const {
- return lifetime.remove(std::move(w));
- }
- void clear() const {
- return lifetime.clear();
- }
- void unsubscribe() const {
- return lifetime.unsubscribe();
- }
-
-protected:
- composite_subscription lifetime;
- std::shared_ptr<rxu::detail::maybe<T>> value;
-};
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp
deleted file mode 100644
index 37737f7..0000000
--- a/Rx/v2/src/rxcpp/rx-test.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-#pragma once
-
-#if !defined(RXCPP_RX_TEST_HPP)
-#define RXCPP_RX_TEST_HPP
-
-#include "rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace test {
-
-namespace detail {
-
-template<class T>
-struct test_subject_base
- : public std::enable_shared_from_this<test_subject_base<T>>
-{
- typedef rxn::recorded<typename rxn::notification<T>::type> recorded_type;
- typedef std::shared_ptr<test_subject_base<T>> type;
-
- virtual ~test_subject_base() {}
- virtual void on_subscribe(subscriber<T>) const =0;
- virtual std::vector<recorded_type> messages() const =0;
- virtual std::vector<rxn::subscription> subscriptions() const =0;
-};
-
-template<class T>
-struct test_source
- : public rxs::source_base<T>
-{
- explicit test_source(typename test_subject_base<T>::type ts)
- : ts(std::move(ts))
- {
- if (!this->ts) std::terminate();
- }
- typename test_subject_base<T>::type ts;
- void on_subscribe(subscriber<T> o) const {
- ts->on_subscribe(std::move(o));
- }
- template<class Subscriber>
- typename std::enable_if<!std::is_same<Subscriber, subscriber<T>>::value, void>::type
- on_subscribe(Subscriber o) const {
-
- static_assert(is_subscriber<Subscriber>::value, "on_subscribe must be passed a subscriber.");
-
- ts->on_subscribe(o.as_dynamic());
- }
-};
-
-}
-
-template<class T>
-class testable_observer
- : public observer<T>
-{
- typedef observer<T> observer_base;
- typedef typename detail::test_subject_base<T>::type test_subject;
- test_subject ts;
-
-public:
- typedef typename detail::test_subject_base<T>::recorded_type recorded_type;
-
- testable_observer(test_subject ts, observer_base ob)
- : observer_base(std::move(ob))
- , ts(std::move(ts))
- {
- }
-
- std::vector<recorded_type> messages() const {
- return ts->messages();
- }
-};
-
-//struct tag_test_observable : public tag_observable {};
-
-/*!
- \brief a source of values that records the time of each subscription/unsubscription and all the values and the time they were emitted.
-
- \ingroup group-observable
-
-*/
-template<class T>
-class testable_observable
- : public observable<T, typename detail::test_source<T>>
-{
- typedef observable<T, typename detail::test_source<T>> observable_base;
- typedef typename detail::test_subject_base<T>::type test_subject;
- test_subject ts;
-
- //typedef tag_test_observable observable_tag;
-
-public:
- typedef typename detail::test_subject_base<T>::recorded_type recorded_type;
-
- explicit testable_observable(test_subject ts)
- : observable_base(detail::test_source<T>(ts))
- , ts(ts)
- {
- }
-
- std::vector<rxn::subscription> subscriptions() const {
- return ts->subscriptions();
- }
-
- std::vector<recorded_type> messages() const {
- return ts->messages();
- }
-};
-
-}
-namespace rxt=test;
-
-}
-
-//
-// support range() >> filter() >> subscribe() syntax
-// '>>' is spelled 'stream'
-//
-template<class T, class OperatorFactory>
-auto operator >> (const rxcpp::test::testable_observable<T>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-//
-// support range() | filter() | subscribe() syntax
-// '|' is spelled 'pipe'
-//
-template<class T, class OperatorFactory>
-auto operator | (const rxcpp::test::testable_observable<T>& source, OperatorFactory&& of)
- -> decltype(source.op(std::forward<OperatorFactory>(of))) {
- return source.op(std::forward<OperatorFactory>(of));
-}
-
-#include "schedulers/rx-test.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-trace.hpp b/Rx/v2/src/rxcpp/rx-trace.hpp
deleted file mode 100644
index bf0abaf..0000000
--- a/Rx/v2/src/rxcpp/rx-trace.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_TRACE_HPP)
-#define RXCPP_RX_TRACE_HPP
-
-#include <iostream>
-#include <exception>
-#include <atomic>
-
-namespace rxcpp {
-
-struct trace_id
-{
- static inline trace_id make_next_id_subscriber() {
- static std::atomic<unsigned long> id(0xB0000000);
- return trace_id{++id};
- }
- unsigned long id;
-};
-
-inline bool operator==(const trace_id& lhs, const trace_id& rhs) {
- return lhs.id == rhs.id;
-}
-inline bool operator!=(const trace_id& lhs, const trace_id& rhs) {
- return !(lhs==rhs);
-}
-
-inline bool operator<(const trace_id& lhs, const trace_id& rhs) {
- if ((lhs.id & 0xF0000000) != (rhs.id & 0xF0000000)) std::terminate();
- return lhs.id < rhs.id;
-}
-inline bool operator>(const trace_id& lhs, const trace_id& rhs) {
- return rhs<lhs;
-}
-
-inline std::ostream& operator<< (std::ostream& os, const trace_id& id) {
- return os << std::hex << id.id << std::dec;
-}
-
-struct trace_noop
-{
- template<class Worker, class Schedulable>
- inline void schedule_enter(const Worker&, const Schedulable&) {}
- template<class Worker>
- inline void schedule_return(const Worker&) {}
- template<class Worker, class When, class Schedulable>
- inline void schedule_when_enter(const Worker&, const When&, const Schedulable&) {}
- template<class Worker>
- inline void schedule_when_return(const Worker&) {}
-
- template<class Schedulable>
- inline void action_enter(const Schedulable&) {}
- template<class Schedulable>
- inline void action_return(const Schedulable&) {}
- template<class Schedulable>
- inline void action_recurse(const Schedulable&) {}
-
- template<class Observable, class Subscriber>
- inline void subscribe_enter(const Observable& , const Subscriber& ) {}
- template<class Observable>
- inline void subscribe_return(const Observable& ) {}
-
- template<class SubscriberFrom, class SubscriberTo>
- inline void connect(const SubscriberFrom&, const SubscriberTo&) {}
-
- template<class OperatorSource, class OperatorChain, class Subscriber, class SubscriberLifted>
- inline void lift_enter(const OperatorSource&, const OperatorChain&, const Subscriber&, const SubscriberLifted&) {}
- template<class OperatorSource, class OperatorChain>
- inline void lift_return(const OperatorSource&, const OperatorChain&) {}
-
- template<class SubscriptionState>
- inline void unsubscribe_enter(const SubscriptionState&) {}
- template<class SubscriptionState>
- inline void unsubscribe_return(const SubscriptionState&) {}
-
- template<class SubscriptionState, class Subscription>
- inline void subscription_add_enter(const SubscriptionState&, const Subscription&) {}
- template<class SubscriptionState>
- inline void subscription_add_return(const SubscriptionState&) {}
-
- template<class SubscriptionState, class WeakSubscription>
- inline void subscription_remove_enter(const SubscriptionState&, const WeakSubscription&) {}
- template<class SubscriptionState>
- inline void subscription_remove_return(const SubscriptionState&) {}
-
- template<class Subscriber>
- inline void create_subscriber(const Subscriber&) {}
-
- template<class Subscriber, class T>
- inline void on_next_enter(const Subscriber&, const T&) {}
- template<class Subscriber>
- inline void on_next_return(const Subscriber&) {}
-
- template<class Subscriber, class ErrorPtr>
- inline void on_error_enter(const Subscriber&, const ErrorPtr&) {}
- template<class Subscriber>
- inline void on_error_return(const Subscriber&) {}
-
- template<class Subscriber>
- inline void on_completed_enter(const Subscriber&) {}
- template<class Subscriber>
- inline void on_completed_return(const Subscriber&) {}
-};
-
-struct trace_tag {};
-
-}
-
-inline auto rxcpp_trace_activity(...) -> rxcpp::trace_noop;
-
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp
deleted file mode 100644
index e5867e5..0000000
--- a/Rx/v2/src/rxcpp/rx-util.hpp
+++ /dev/null
@@ -1,1031 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_UTIL_HPP)
-#define RXCPP_RX_UTIL_HPP
-
-#include "rx-includes.hpp"
-
-#if !defined(RXCPP_ON_IOS) && !defined(RXCPP_ON_ANDROID) && !defined(RXCPP_THREAD_LOCAL)
-#if defined(_MSC_VER)
-#define RXCPP_THREAD_LOCAL __declspec(thread)
-#else
-#define RXCPP_THREAD_LOCAL __thread
-#endif
-#endif
-
-#if !defined(RXCPP_DELETE)
-#if defined(_MSC_VER)
-#define RXCPP_DELETE __pragma(warning(disable: 4822)) =delete
-#else
-#define RXCPP_DELETE =delete
-#endif
-#endif
-
-#define RXCPP_CONCAT(Prefix, Suffix) Prefix ## Suffix
-#define RXCPP_CONCAT_EVALUATE(Prefix, Suffix) RXCPP_CONCAT(Prefix, Suffix)
-
-#define RXCPP_MAKE_IDENTIFIER(Prefix) RXCPP_CONCAT_EVALUATE(Prefix, __LINE__)
-
-// Provide replacements for try/catch keywords, using which is a compilation error
-// when exceptions are disabled with -fno-exceptions.
-#if RXCPP_USE_EXCEPTIONS
-#define RXCPP_TRY try
-#define RXCPP_CATCH(...) catch(__VA_ARGS__)
-// See also rxu::throw_exception for 'throw' keyword replacement.
-#else
-#define RXCPP_TRY if ((true))
-#define RXCPP_CATCH(...) if ((false))
-// See also rxu::throw_exception, which will std::terminate without exceptions.
-#endif
-
-namespace rxcpp {
-
-namespace util {
-
-template<class T> using value_type_t = typename std::decay<T>::type::value_type;
-template<class T> using decay_t = typename std::decay<T>::type;
-template<class... TN> using result_of_t = typename std::result_of<TN...>::type;
-
-template<class T, std::size_t size>
-std::vector<T> to_vector(const T (&arr) [size]) {
- return std::vector<T>(std::begin(arr), std::end(arr));
-}
-
-template<class T>
-std::vector<T> to_vector(std::initializer_list<T> il) {
- return std::vector<T>(il);
-}
-
-template<class T0, class... TN>
-typename std::enable_if<!std::is_array<T0>::value && std::is_pod<T0>::value, std::vector<T0>>::type to_vector(T0 t0, TN... tn) {
- return to_vector({t0, tn...});
-}
-
-// lifted from https://github.com/ericniebler/range-v3/blob/630fc70baa07cbfd222f329e44a3122ab64ce364/include/range/v3/range_fwd.hpp
-// removed constexpr & noexcept to support older VC compilers
-template<typename T>
-/*constexpr*/ T const &as_const(T & t) /*noexcept*/
-{
- return t;
-}
-template<typename T>
-void as_const(T const &&) = delete;
-
-template<class T, T... ValueN>
-struct values {};
-
-template<class T, int Remaining, T Step = 1, T Cursor = 0, T... ValueN>
-struct values_from;
-
-template<class T, T Step, T Cursor, T... ValueN>
-struct values_from<T, 0, Step, Cursor, ValueN...>
-{
- typedef values<T, ValueN...> type;
-};
-
-template<class T, int Remaining, T Step, T Cursor, T... ValueN>
-struct values_from
-{
- typedef typename values_from<T, Remaining - 1, Step, Cursor + Step, ValueN..., Cursor>::type type;
-};
-
-template<bool... BN>
-struct all_true;
-
-template<bool B>
-struct all_true<B>
-{
- static const bool value = B;
-};
-template<bool B, bool... BN>
-struct all_true<B, BN...>
-{
- static const bool value = B && all_true<BN...>::value;
-};
-
-template<bool... BN>
-using enable_if_all_true_t = typename std::enable_if<all_true<BN...>::value>::type;
-
-template<class... BN>
-struct all_true_type;
-
-template<class B>
-struct all_true_type<B>
-{
- static const bool value = B::value;
-};
-template<class B, class... BN>
-struct all_true_type<B, BN...>
-{
- static const bool value = B::value && all_true_type<BN...>::value;
-};
-
-template<class... BN>
-using enable_if_all_true_type_t = typename std::enable_if<all_true_type<BN...>::value>::type;
-
-struct all_values_true {
- template<class... ValueN>
- bool operator()(ValueN... vn) const;
-
- template<class Value0>
- bool operator()(Value0 v0) const {
- return v0;
- }
-
- template<class Value0, class... ValueN>
- bool operator()(Value0 v0, ValueN... vn) const {
- return v0 && all_values_true()(vn...);
- }
-};
-
-struct any_value_true {
- template<class... ValueN>
- bool operator()(ValueN... vn) const;
-
- template<class Value0>
- bool operator()(Value0 v0) const {
- return v0;
- }
-
- template<class Value0, class... ValueN>
- bool operator()(Value0 v0, ValueN... vn) const {
- return v0 || any_value_true()(vn...);
- }
-};
-
-template<class... TN>
-struct types {};
-
-//
-// based on Walter Brown's void_t proposal
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3911.pdf
-//
-
-struct types_checked {};
-
-namespace detail {
-template<class... TN> struct types_checked_from {typedef types_checked type;};
-}
-
-template<class... TN>
-struct types_checked_from {typedef typename detail::types_checked_from<TN...>::type type;};
-
-template<class... TN>
-using types_checked_t = typename types_checked_from<TN...>::type;
-
-
-template<class Types, class =types_checked>
-struct expand_value_types { struct type; };
-template<class... TN>
-struct expand_value_types<types<TN...>, types_checked_t<typename std::decay<TN>::type::value_type...>>
-{
- using type = types<typename std::decay<TN>::type::value_type...>;
-};
-template<class... TN>
-using value_types_t = typename expand_value_types<types<TN...>>::type;
-
-
-template<class T, class C = types_checked>
-struct value_type_from : public std::false_type {typedef types_checked type;};
-
-template<class T>
-struct value_type_from<T, typename types_checked_from<value_type_t<T>>::type>
- : public std::true_type {typedef value_type_t<T> type;};
-
-namespace detail {
-template<class F, class... ParamN, int... IndexN>
-auto apply(std::tuple<ParamN...> p, values<int, IndexN...>, F&& f)
- -> decltype(f(std::forward<ParamN>(std::get<IndexN>(p))...)) {
- return f(std::forward<ParamN>(std::get<IndexN>(p))...);
-}
-
-template<class F_inner, class F_outer, class... ParamN, int... IndexN>
-auto apply_to_each(std::tuple<ParamN...>& p, values<int, IndexN...>, F_inner& f_inner, F_outer& f_outer)
- -> decltype(f_outer(std::move(f_inner(std::get<IndexN>(p)))...)) {
- return f_outer(std::move(f_inner(std::get<IndexN>(p)))...);
-}
-
-template<class F_inner, class F_outer, class... ParamN, int... IndexN>
-auto apply_to_each(std::tuple<ParamN...>& p, values<int, IndexN...>, const F_inner& f_inner, const F_outer& f_outer)
- -> decltype(f_outer(std::move(f_inner(std::get<IndexN>(p)))...)) {
- return f_outer(std::move(f_inner(std::get<IndexN>(p)))...);
-}
-
-}
-template<class F, class... ParamN>
-auto apply(std::tuple<ParamN...> p, F&& f)
- -> decltype(detail::apply(std::move(p), typename values_from<int, sizeof...(ParamN)>::type(), std::forward<F>(f))) {
- return detail::apply(std::move(p), typename values_from<int, sizeof...(ParamN)>::type(), std::forward<F>(f));
-}
-
-template<class F_inner, class F_outer, class... ParamN>
-auto apply_to_each(std::tuple<ParamN...>& p, F_inner& f_inner, F_outer& f_outer)
- -> decltype(detail::apply_to_each(p, typename values_from<int, sizeof...(ParamN)>::type(), f_inner, f_outer)) {
- return detail::apply_to_each(p, typename values_from<int, sizeof...(ParamN)>::type(), f_inner, f_outer);
-}
-
-template<class F_inner, class F_outer, class... ParamN>
-auto apply_to_each(std::tuple<ParamN...>& p, const F_inner& f_inner, const F_outer& f_outer)
- -> decltype(detail::apply_to_each(p, typename values_from<int, sizeof...(ParamN)>::type(), f_inner, f_outer)) {
- return detail::apply_to_each(p, typename values_from<int, sizeof...(ParamN)>::type(), f_inner, f_outer);
-}
-
-namespace detail {
-
-template<class F>
-struct apply_to
-{
- F to;
-
- explicit apply_to(F f)
- : to(std::move(f))
- {
- }
-
- template<class... ParamN>
- auto operator()(std::tuple<ParamN...> p)
- -> decltype(rxcpp::util::apply(std::move(p), to)) {
- return rxcpp::util::apply(std::move(p), to);
- }
- template<class... ParamN>
- auto operator()(std::tuple<ParamN...> p) const
- -> decltype(rxcpp::util::apply(std::move(p), to)) {
- return rxcpp::util::apply(std::move(p), to);
- }
-};
-
-}
-
-template<class F>
-auto apply_to(F f)
- -> detail::apply_to<F> {
- return detail::apply_to<F>(std::move(f));
-}
-
-namespace detail {
-
-struct pack
-{
- template<class... ParamN>
- auto operator()(ParamN... pn)
- -> decltype(std::make_tuple(std::move(pn)...)) {
- return std::make_tuple(std::move(pn)...);
- }
- template<class... ParamN>
- auto operator()(ParamN... pn) const
- -> decltype(std::make_tuple(std::move(pn)...)) {
- return std::make_tuple(std::move(pn)...);
- }
-};
-
-}
-
-inline auto pack()
- -> detail::pack {
- return detail::pack();
-}
-
-namespace detail {
-
-template<int Index>
-struct take_at
-{
- template<class... ParamN>
- auto operator()(ParamN... pn)
- -> typename std::tuple_element<Index, std::tuple<decay_t<ParamN>...>>::type {
- return std::get<Index>(std::make_tuple(std::move(pn)...));
- }
- template<class... ParamN>
- auto operator()(ParamN... pn) const
- -> typename std::tuple_element<Index, std::tuple<decay_t<ParamN>...>>::type {
- return std::get<Index>(std::make_tuple(std::move(pn)...));
- }
-};
-
-}
-
-template<int Index>
-inline auto take_at()
- -> detail::take_at<Index> {
- return detail::take_at<Index>();
-}
-
-template <class D>
-struct resolve_type;
-
-template <template<class... TN> class Deferred, class... AN>
-struct defer_trait
-{
- template<bool R>
- struct tag_valid {static const bool valid = true; static const bool value = R;};
- struct tag_not_valid {static const bool valid = false; static const bool value = false;};
- typedef Deferred<typename resolve_type<AN>::type...> resolved_type;
- template<class... CN>
- static auto check(int) -> tag_valid<resolved_type::value>;
- template<class... CN>
- static tag_not_valid check(...);
-
- typedef decltype(check<AN...>(0)) tag_type;
- static const bool valid = tag_type::valid;
- static const bool value = tag_type::value;
- static const bool not_value = valid && !value;
-};
-
-template <template<class... TN> class Deferred, class... AN>
-struct defer_type
-{
- template<class R>
- struct tag_valid {typedef R type; static const bool value = true;};
- struct tag_not_valid {typedef void type; static const bool value = false;};
- typedef Deferred<typename resolve_type<AN>::type...> resolved_type;
- template<class... CN>
- static auto check(int) -> tag_valid<resolved_type>;
- template<class... CN>
- static tag_not_valid check(...);
-
- typedef decltype(check<AN...>(0)) tag_type;
- typedef typename tag_type::type type;
- static const bool value = tag_type::value;
-};
-
-template <template<class... TN> class Deferred, class... AN>
-struct defer_value_type
-{
- template<class R>
- struct tag_valid {typedef R type; static const bool value = true;};
- struct tag_not_valid {typedef void type; static const bool value = false;};
- typedef Deferred<typename resolve_type<AN>::type...> resolved_type;
- template<class... CN>
- static auto check(int) -> tag_valid<value_type_t<resolved_type>>;
- template<class... CN>
- static tag_not_valid check(...);
-
- typedef decltype(check<AN...>(0)) tag_type;
- typedef typename tag_type::type type;
- static const bool value = tag_type::value;
-};
-
-template <template<class... TN> class Deferred, class... AN>
-struct defer_seed_type
-{
- template<class R>
- struct tag_valid {typedef R type; static const bool value = true;};
- struct tag_not_valid {typedef void type; static const bool value = false;};
- typedef Deferred<typename resolve_type<AN>::type...> resolved_type;
- template<class... CN>
- static auto check(int) -> tag_valid<typename resolved_type::seed_type>;
- template<class... CN>
- static tag_not_valid check(...);
-
- typedef decltype(check<AN...>(0)) tag_type;
- typedef typename tag_type::type type;
- static const bool value = tag_type::value;
-};
-
-template <class D>
-struct resolve_type
-{
- typedef D type;
-};
-template <template<class... TN> class Deferred, class... AN>
-struct resolve_type<defer_type<Deferred, AN...>>
-{
- typedef typename defer_type<Deferred, AN...>::type type;
-};
-template <template<class... TN> class Deferred, class... AN>
-struct resolve_type<defer_value_type<Deferred, AN...>>
-{
- typedef typename defer_value_type<Deferred, AN...>::type type;
-};
-template <template<class... TN> class Deferred, class... AN>
-struct resolve_type<defer_seed_type<Deferred, AN...>>
-{
- typedef typename defer_seed_type<Deferred, AN...>::type type;
-};
-
-struct plus
-{
- template <class LHS, class RHS>
- auto operator()(LHS&& lhs, RHS&& rhs) const
- -> decltype(std::forward<LHS>(lhs) + std::forward<RHS>(rhs))
- { return std::forward<LHS>(lhs) + std::forward<RHS>(rhs); }
-};
-
-struct count
-{
- template <class T>
- int operator()(int cnt, T&&) const
- { return cnt + 1; }
-};
-
-struct less
-{
- template <class LHS, class RHS>
- auto operator()(LHS&& lhs, RHS&& rhs) const
- -> decltype(std::forward<LHS>(lhs) < std::forward<RHS>(rhs))
- { return std::forward<LHS>(lhs) < std::forward<RHS>(rhs); }
-};
-
-template <class T>
-struct ret
-{
- template <class LHS>
- auto operator()(LHS&& ) const
- -> decltype(T())
- { return T(); }
-};
-
-template<class T = void>
-struct equal_to
-{
- bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; }
-};
-
-template<>
-struct equal_to<void>
-{
- template<class LHS, class RHS>
- auto operator()(LHS&& lhs, RHS&& rhs) const
- -> decltype(std::forward<LHS>(lhs) == std::forward<RHS>(rhs))
- { return std::forward<LHS>(lhs) == std::forward<RHS>(rhs); }
-};
-
-namespace detail {
-template<class OStream, class Delimit>
-struct print_function
-{
- OStream& os;
- Delimit delimit;
- print_function(OStream& os, Delimit d) : os(os), delimit(std::move(d)) {}
-
- template<class... TN>
- void operator()(const TN&... tn) const {
- bool inserts[] = {(os << tn, true)...};
- inserts[0] = *reinterpret_cast<bool*>(inserts); // silence warning
- delimit();
- }
-
- template<class... TN>
- void operator()(const std::tuple<TN...>& tpl) const {
- rxcpp::util::apply(tpl, *this);
- }
-};
-
-template<class OStream>
-struct endline
-{
- OStream& os;
- endline(OStream& os) : os(os) {}
- void operator()() const {
- os << std::endl;
- }
-private:
- endline& operator=(const endline&) RXCPP_DELETE;
-};
-
-template<class OStream, class ValueType>
-struct insert_value
-{
- OStream& os;
- ValueType value;
- insert_value(OStream& os, ValueType v) : os(os), value(std::move(v)) {}
- void operator()() const {
- os << value;
- }
-private:
- insert_value& operator=(const insert_value&) RXCPP_DELETE;
-};
-
-template<class OStream, class Function>
-struct insert_function
-{
- OStream& os;
- Function call;
- insert_function(OStream& os, Function f) : os(os), call(std::move(f)) {}
- void operator()() const {
- call(os);
- }
-private:
- insert_function& operator=(const insert_function&) RXCPP_DELETE;
-};
-
-template<class OStream, class Delimit>
-auto print_followed_with(OStream& os, Delimit d)
- -> detail::print_function<OStream, Delimit> {
- return detail::print_function<OStream, Delimit>(os, std::move(d));
-}
-
-}
-
-template<class OStream>
-auto endline(OStream& os)
- -> detail::endline<OStream> {
- return detail::endline<OStream>(os);
-}
-
-template<class OStream>
-auto println(OStream& os)
- -> decltype(detail::print_followed_with(os, endline(os))) {
- return detail::print_followed_with(os, endline(os));
-}
-template<class OStream, class Delimit>
-auto print_followed_with(OStream& os, Delimit d)
- -> decltype(detail::print_followed_with(os, detail::insert_function<OStream, Delimit>(os, std::move(d)))) {
- return detail::print_followed_with(os, detail::insert_function<OStream, Delimit>(os, std::move(d)));
-}
-template<class OStream, class DelimitValue>
-auto print_followed_by(OStream& os, DelimitValue dv)
- -> decltype(detail::print_followed_with(os, detail::insert_value<OStream, DelimitValue>(os, std::move(dv)))) {
- return detail::print_followed_with(os, detail::insert_value<OStream, DelimitValue>(os, std::move(dv)));
-}
-
-inline std::string what(std::exception_ptr ep) {
-#if RXCPP_USE_EXCEPTIONS
- try {std::rethrow_exception(ep);}
- catch (const std::exception& ex) {
- return ex.what();
- } catch (...) {
- return std::string("<not derived from std::exception>");
- }
-#endif
- (void)ep;
- return std::string("<exceptions are disabled>");
-}
-
-namespace detail {
-
-template <class T>
-class maybe
-{
- bool is_set;
- typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type
- storage;
-public:
- maybe()
- : is_set(false)
- {
- }
-
- maybe(T value)
- : is_set(false)
- {
- new (reinterpret_cast<T*>(&storage)) T(value);
- is_set = true;
- }
-
- maybe(const maybe& other)
- : is_set(false)
- {
- if (other.is_set) {
- new (reinterpret_cast<T*>(&storage)) T(other.get());
- is_set = true;
- }
- }
- maybe(maybe&& other)
- : is_set(false)
- {
- if (other.is_set) {
- new (reinterpret_cast<T*>(&storage)) T(std::move(other.get()));
- is_set = true;
- other.reset();
- }
- }
-
- ~maybe()
- {
- reset();
- }
-
- typedef T value_type;
- typedef T* iterator;
- typedef const T* const_iterator;
-
- bool empty() const {
- return !is_set;
- }
-
- std::size_t size() const {
- return is_set ? 1 : 0;
- }
-
- iterator begin() {
- return reinterpret_cast<T*>(&storage);
- }
- const_iterator begin() const {
- return reinterpret_cast<T*>(&storage);
- }
-
- iterator end() {
- return reinterpret_cast<T*>(&storage) + size();
- }
- const_iterator end() const {
- return reinterpret_cast<T*>(&storage) + size();
- }
-
- T* operator->() {
- if (!is_set) std::terminate();
- return reinterpret_cast<T*>(&storage);
- }
- const T* operator->() const {
- if (!is_set) std::terminate();
- return reinterpret_cast<T*>(&storage);
- }
-
- T& operator*() {
- if (!is_set) std::terminate();
- return *reinterpret_cast<T*>(&storage);
- }
- const T& operator*() const {
- if (!is_set) std::terminate();
- return *reinterpret_cast<T*>(&storage);
- }
-
- T& get() {
- if (!is_set) std::terminate();
- return *reinterpret_cast<T*>(&storage);
- }
- const T& get() const {
- if (!is_set) std::terminate();
- return *reinterpret_cast<const T*>(&storage);
- }
-
- void reset()
- {
- if (is_set) {
- is_set = false;
- reinterpret_cast<T*>(&storage)->~T();
- //std::fill_n(reinterpret_cast<char*>(&storage), sizeof(T), 0);
- }
- }
-
- template<class U>
- void reset(U&& value) {
- reset();
- new (reinterpret_cast<T*>(&storage)) T(std::forward<U>(value));
- is_set = true;
- }
-
- maybe& operator=(const T& other) {
- reset(other);
- return *this;
- }
- maybe& operator=(const maybe& other) {
- if (!other.empty()) {
- reset(other.get());
- } else {
- reset();
- }
- return *this;
- }
-};
-
-}
-using detail::maybe;
-
-namespace detail {
- struct surely
- {
- template<class... T>
- auto operator()(T... t)
- -> decltype(std::make_tuple(t.get()...)) {
- return std::make_tuple(t.get()...);
- }
- template<class... T>
- auto operator()(T... t) const
- -> decltype(std::make_tuple(t.get()...)) {
- return std::make_tuple(t.get()...);
- }
- };
-}
-
-template<class... T>
-inline auto surely(const std::tuple<T...>& tpl)
- -> decltype(apply(tpl, detail::surely())) {
- return apply(tpl, detail::surely());
-}
-
-namespace detail {
-
-template<typename Function>
-class unwinder
-{
-public:
- ~unwinder()
- {
- if (!!function)
- {
- RXCPP_TRY {
- (*function)();
- } RXCPP_CATCH(...) {
- std::terminate();
- }
- }
- }
-
- explicit unwinder(Function* functionArg)
- : function(functionArg)
- {
- }
-
- void dismiss()
- {
- function = nullptr;
- }
-
-private:
- unwinder();
- unwinder(const unwinder&);
- unwinder& operator=(const unwinder&);
-
- Function* function;
-};
-
-}
-
-#if !defined(RXCPP_THREAD_LOCAL)
-template<typename T>
-class thread_local_storage
-{
-private:
- pthread_key_t key;
-
-public:
- thread_local_storage()
- {
- pthread_key_create(&key, NULL);
- }
-
- ~thread_local_storage()
- {
- pthread_key_delete(key);
- }
-
- thread_local_storage& operator =(T* p)
- {
- pthread_setspecific(key, p);
- return *this;
- }
-
- bool operator !()
- {
- return pthread_getspecific(key) == NULL;
- }
-
- T* operator ->()
- {
- return static_cast<T*>(pthread_getspecific(key));
- }
-
- T* get()
- {
- return static_cast<T*>(pthread_getspecific(key));
- }
-};
-#endif
-
-template<typename, typename C = types_checked>
-struct is_string : std::false_type {
-};
-
-template <typename T>
-struct is_string<T,
- typename types_checked_from<
- typename T::value_type,
- typename T::traits_type,
- typename T::allocator_type>::type>
- : std::is_base_of<
- std::basic_string<
- typename T::value_type,
- typename T::traits_type,
- typename T::allocator_type>, T> {
-};
-
-namespace detail {
-
- template <class T, class = types_checked>
- struct is_duration : std::false_type {};
-
- template <class T>
- struct is_duration<T, types_checked_t<T, typename T::rep, typename T::period>>
- : std::is_convertible<T*, std::chrono::duration<typename T::rep, typename T::period>*> {};
-
-}
-
-template <class T, class Decayed = decay_t<T>>
-struct is_duration : detail::is_duration<Decayed> {};
-
-
-// C++17 negation
-namespace detail {
- template<class T>
- struct not_value : std::conditional<T::value, std::false_type, std::true_type>::type {
- };
-}
-
-template <class T>
-struct negation : detail::not_value<T> {};
-
-}
-
-#if !RXCPP_USE_EXCEPTIONS
-namespace util {
-
-namespace detail {
-
-struct error_base {
- virtual const char* what() = 0;
- virtual ~error_base() {}
-};
-
-// Use the "Type Erasure" idiom to wrap an std::exception-like
-// value into an error pointer.
-//
-// Supported types:
-// exception, bad_exception, bad_alloc.
-template <class E>
-struct error_specific : public error_base {
- error_specific(const E& e) : data(e) {}
- error_specific(E&& e) : data(std::move(e)) {}
-
- virtual ~error_specific() {}
-
- virtual const char* what() {
- return data.what();
- }
-
- E data;
-};
-
-}
-
-}
-#endif
-
-namespace util {
-
-#if RXCPP_USE_EXCEPTIONS
-using error_ptr = std::exception_ptr;
-#else
-// Note: std::exception_ptr cannot be used directly when exceptions are disabled.
-// Any attempt to 'throw' or to call into any of the std functions accepting
-// an std::exception_ptr will either fail to compile or result in an abort at runtime.
-using error_ptr = std::shared_ptr<util::detail::error_base>;
-
-inline std::string what(error_ptr ep) {
- return std::string(ep->what());
-}
-#endif
-
-// TODO: Do we really need an identity make?
-// (It was causing some compilation errors deep inside templates).
-inline error_ptr make_error_ptr(error_ptr e) {
- return e;
-}
-
-// Replace std::make_exception_ptr (which would immediately terminate
-// when exceptions are disabled).
-template <class E>
-error_ptr make_error_ptr(E&& e) {
-#if RXCPP_USE_EXCEPTIONS
- return std::make_exception_ptr(std::forward<E>(e));
-#else
- using e_type = rxcpp::util::decay_t<E>;
- using pointed_to_type = rxcpp::util::detail::error_specific<e_type>;
- auto sp = std::make_shared<pointed_to_type>(std::forward<E>(e));
- return std::static_pointer_cast<rxcpp::util::detail::error_base>(sp);
-#endif
-}
-
-// Replace std::rethrow_exception to be compatible with our error_ptr typedef.
-RXCPP_NORETURN inline void rethrow_exception(error_ptr e) {
-#if RXCPP_USE_EXCEPTIONS
- std::rethrow_exception(e);
-#else
- // error_ptr != std::exception_ptr so we can't use std::rethrow_exception
- //
- // However even if we could, calling std::rethrow_exception just terminates if exceptions are disabled.
- //
- // Therefore this function should only be called when we are completely giving up and have no idea
- // how to handle the error.
- (void)e;
- std::terminate();
-#endif
-}
-
-// A replacement for the "throw" keyword which is illegal when
-// exceptions are disabled with -fno-exceptions.
-template <typename E>
-RXCPP_NORETURN inline void throw_exception(E&& e) {
-#if RXCPP_USE_EXCEPTIONS
- throw std::forward<E>(e);
-#else
- // "throw" keyword is unsupported when exceptions are disabled.
- // Immediately terminate instead.
- (void)e;
- std::terminate();
-#endif
-}
-
-// TODO: Do we really need this? rxu::rethrow_exception(rxu::current_exception())
-// would have the same semantics in either case.
-RXCPP_NORETURN inline void rethrow_current_exception() {
-#if RXCPP_USE_EXCEPTIONS
- std::rethrow_exception(std::current_exception());
-#else
- std::terminate();
-#endif
-}
-
-// If called during exception handling, return the currently caught exception.
-// Otherwise return null.
-inline error_ptr current_exception() {
-#if RXCPP_USE_EXCEPTIONS
- return std::current_exception();
-#else
- // When exceptions are disabled, we can never be inside of a catch block.
- // Return null similar to std::current_exception returning null outside of catch.
- return nullptr;
-#endif
-}
-
-}
-namespace rxu=util;
-
-
-//
-// due to an noisy static_assert issue in more than one std lib impl,
-// rxcpp maintains a whitelist filter for the types that are allowed
-// to be hashed. this allows is_hashable<T> to work.
-//
-// NOTE: this should eventually be removed!
-//
-template <class T, typename = void>
-struct filtered_hash;
-
-#if RXCPP_HASH_ENUM
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_enum<T>::value>::type> : std::hash<T> {
-};
-#elif RXCPP_HASH_ENUM_UNDERLYING
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_enum<T>::value>::type> : std::hash<typename std::underlying_type<T>::type> {
-};
-#endif
-
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_integral<T>::value>::type> : std::hash<T> {
-};
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_pointer<T>::value>::type> : std::hash<T> {
-};
-template <class T>
-struct filtered_hash<T, typename std::enable_if<rxu::is_string<T>::value>::type> : std::hash<T> {
-};
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_convertible<T, std::chrono::duration<typename T::rep, typename T::period>>::value>::type> {
- using argument_type = T;
- using result_type = std::size_t;
-
- result_type operator()(argument_type const & dur) const
- {
- return std::hash<typename argument_type::rep>{}(dur.count());
- }
-};
-template <class T>
-struct filtered_hash<T, typename std::enable_if<std::is_convertible<T, std::chrono::time_point<typename T::clock, typename T::duration>>::value>::type> {
- using argument_type = T;
- using result_type = std::size_t;
-
- result_type operator()(argument_type const & tp) const
- {
- return std::hash<typename argument_type::rep>{}(tp.time_since_epoch().count());
- }
-};
-
-template<typename, typename C = rxu::types_checked>
-struct is_hashable
- : std::false_type {};
-
-template<typename T>
-struct is_hashable<T,
- typename rxu::types_checked_from<
- typename filtered_hash<T>::result_type,
- typename filtered_hash<T>::argument_type,
- typename std::result_of<filtered_hash<T>(T)>::type>::type>
- : std::true_type {};
-
-}
-
-#define RXCPP_UNWIND(Name, Function) \
- RXCPP_UNWIND_EXPLICIT(uwfunc_ ## Name, Name, Function)
-
-#define RXCPP_UNWIND_AUTO(Function) \
- RXCPP_UNWIND_EXPLICIT(RXCPP_MAKE_IDENTIFIER(uwfunc_), RXCPP_MAKE_IDENTIFIER(unwind_), Function)
-
-#define RXCPP_UNWIND_EXPLICIT(FunctionName, UnwinderName, Function) \
- auto FunctionName = (Function); \
- rxcpp::util::detail::unwinder<decltype(FunctionName)> UnwinderName(std::addressof(FunctionName))
-
-#endif
diff --git a/Rx/v2/src/rxcpp/rx.hpp b/Rx/v2/src/rxcpp/rx.hpp
deleted file mode 100644
index 79bd4fd..0000000
--- a/Rx/v2/src/rxcpp/rx.hpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_HPP)
-#define RXCPP_RX_HPP
-
-#include "rx-includes.hpp"
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp
deleted file mode 100644
index fafa3c1..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp
+++ /dev/null
@@ -1,272 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_CURRENT_THREAD_HPP)
-#define RXCPP_RX_SCHEDULER_CURRENT_THREAD_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-namespace detail {
-
-struct action_queue
-{
- typedef action_queue this_type;
-
- typedef scheduler_base::clock_type clock;
- typedef time_schedulable<clock::time_point> item_type;
-
-private:
- typedef schedulable_queue<item_type::time_point_type> queue_item_time;
-
-public:
- struct current_thread_queue_type {
- std::shared_ptr<worker_interface> w;
- recursion r;
- queue_item_time q;
- };
-
-private:
-#if defined(RXCPP_THREAD_LOCAL)
- static current_thread_queue_type*& current_thread_queue() {
- static RXCPP_THREAD_LOCAL current_thread_queue_type* q;
- return q;
- }
-#else
- static rxu::thread_local_storage<current_thread_queue_type>& current_thread_queue() {
- static rxu::thread_local_storage<current_thread_queue_type> q;
- return q;
- }
-#endif
-
-public:
-
- static bool owned() {
- return !!current_thread_queue();
- }
- static const std::shared_ptr<worker_interface>& get_worker_interface() {
- return current_thread_queue()->w;
- }
- static recursion& get_recursion() {
- return current_thread_queue()->r;
- }
- static bool empty() {
- if (!current_thread_queue()) {
- std::terminate();
- }
- return current_thread_queue()->q.empty();
- }
- static queue_item_time::const_reference top() {
- if (!current_thread_queue()) {
- std::terminate();
- }
- return current_thread_queue()->q.top();
- }
- static void pop() {
- auto& state = current_thread_queue();
- if (!state) {
- std::terminate();
- }
- state->q.pop();
- if (state->q.empty()) {
- // allow recursion
- state->r.reset(true);
- }
- }
- static void push(item_type item) {
- auto& state = current_thread_queue();
- if (!state) {
- std::terminate();
- }
- if (!item.what.is_subscribed()) {
- return;
- }
- state->q.push(std::move(item));
- // disallow recursion
- state->r.reset(false);
- }
- static std::shared_ptr<worker_interface> ensure(std::shared_ptr<worker_interface> w) {
- if (!!current_thread_queue()) {
- std::terminate();
- }
- // create and publish new queue
- current_thread_queue() = new current_thread_queue_type();
- current_thread_queue()->w = w;
- return w;
- }
- static std::unique_ptr<current_thread_queue_type> create(std::shared_ptr<worker_interface> w) {
- std::unique_ptr<current_thread_queue_type> result(new current_thread_queue_type());
- result->w = std::move(w);
- return result;
- }
- static void set(current_thread_queue_type* q) {
- if (!!current_thread_queue()) {
- std::terminate();
- }
- // publish new queue
- current_thread_queue() = q;
- }
- static void destroy(current_thread_queue_type* q) {
- delete q;
- }
- static void destroy() {
- if (!current_thread_queue()) {
- std::terminate();
- }
-#if defined(RXCPP_THREAD_LOCAL)
- destroy(current_thread_queue());
-#else
- destroy(current_thread_queue().get());
-#endif
- current_thread_queue() = nullptr;
- }
-};
-
-}
-
-struct current_thread : public scheduler_interface
-{
-private:
- typedef current_thread this_type;
- current_thread(const this_type&);
-
- typedef detail::action_queue queue_type;
-
- struct derecurser : public worker_interface
- {
- private:
- typedef current_thread this_type;
- derecurser(const this_type&);
- public:
- derecurser()
- {
- }
- virtual ~derecurser()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- queue_type::push(queue_type::item_type(now(), scbl));
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- queue_type::push(queue_type::item_type(when, scbl));
- }
- };
-
- struct current_worker : public worker_interface
- {
- private:
- typedef current_thread this_type;
- current_worker(const this_type&);
- public:
- current_worker()
- {
- }
- virtual ~current_worker()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- schedule(now(), scbl);
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- if (!scbl.is_subscribed()) {
- return;
- }
-
- {
- // check ownership
- if (queue_type::owned()) {
- // already has an owner - delegate
- queue_type::get_worker_interface()->schedule(when, scbl);
- return;
- }
-
- // take ownership
- queue_type::ensure(std::make_shared<derecurser>());
- }
- // release ownership
- RXCPP_UNWIND_AUTO([]{
- queue_type::destroy();
- });
-
- const auto& recursor = queue_type::get_recursion().get_recurse();
- std::this_thread::sleep_until(when);
- if (scbl.is_subscribed()) {
- scbl(recursor);
- }
- if (queue_type::empty()) {
- return;
- }
-
- // loop until queue is empty
- for (
- auto next = queue_type::top().when;
- (std::this_thread::sleep_until(next), true);
- next = queue_type::top().when
- ) {
- auto what = queue_type::top().what;
-
- queue_type::pop();
-
- if (what.is_subscribed()) {
- what(recursor);
- }
-
- if (queue_type::empty()) {
- break;
- }
- }
- }
- };
-
- std::shared_ptr<current_worker> wi;
-
-public:
- current_thread()
- : wi(std::make_shared<current_worker>())
- {
- }
- virtual ~current_thread()
- {
- }
-
- static bool is_schedule_required() { return !queue_type::owned(); }
-
- inline bool is_tail_recursion_allowed() const {
- return queue_type::empty();
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- return worker(std::move(cs), wi);
- }
-};
-
-inline const scheduler& make_current_thread() {
- static scheduler instance = make_scheduler<current_thread>();
- return instance;
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp
deleted file mode 100644
index 4f83767..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_EVENT_LOOP_HPP)
-#define RXCPP_RX_SCHEDULER_EVENT_LOOP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-struct event_loop : public scheduler_interface
-{
-private:
- typedef event_loop this_type;
- event_loop(const this_type&);
-
- struct loop_worker : public worker_interface
- {
- private:
- typedef loop_worker this_type;
- loop_worker(const this_type&);
-
- typedef detail::schedulable_queue<
- typename clock_type::time_point> queue_item_time;
-
- typedef queue_item_time::item_type item_type;
-
- composite_subscription lifetime;
- worker controller;
- std::shared_ptr<const scheduler_interface> alive;
-
- public:
- virtual ~loop_worker()
- {
- }
- loop_worker(composite_subscription cs, worker w, std::shared_ptr<const scheduler_interface> alive)
- : lifetime(cs)
- , controller(w)
- , alive(alive)
- {
- auto token = controller.add(cs);
- cs.add([token, w](){
- w.remove(token);
- });
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- controller.schedule(lifetime, scbl.get_action());
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- controller.schedule(when, lifetime, scbl.get_action());
- }
- };
-
- mutable thread_factory factory;
- scheduler newthread;
- mutable std::atomic<std::size_t> count;
- composite_subscription loops_lifetime;
- std::vector<worker> loops;
-
-public:
- event_loop()
- : factory([](std::function<void()> start){
- return std::thread(std::move(start));
- })
- , newthread(make_new_thread())
- , count(0)
- {
- auto remaining = std::max(std::thread::hardware_concurrency(), unsigned(4));
- while (remaining--) {
- loops.push_back(newthread.create_worker(loops_lifetime));
- }
- }
- explicit event_loop(thread_factory tf)
- : factory(tf)
- , newthread(make_new_thread(tf))
- , count(0)
- {
- auto remaining = std::max(std::thread::hardware_concurrency(), unsigned(4));
- while (remaining--) {
- loops.push_back(newthread.create_worker(loops_lifetime));
- }
- }
- virtual ~event_loop()
- {
- loops_lifetime.unsubscribe();
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- return worker(cs, std::make_shared<loop_worker>(cs, loops[++count % loops.size()], this->shared_from_this()));
- }
-};
-
-inline scheduler make_event_loop() {
- static scheduler instance = make_scheduler<event_loop>();
- return instance;
-}
-inline scheduler make_event_loop(thread_factory tf) {
- return make_scheduler<event_loop>(tf);
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp
deleted file mode 100644
index 0d2b695..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_IMMEDIATE_HPP)
-#define RXCPP_RX_SCHEDULER_IMMEDIATE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-struct immediate : public scheduler_interface
-{
-private:
- typedef immediate this_type;
- immediate(const this_type&);
-
- struct immediate_worker : public worker_interface
- {
- private:
- typedef immediate_worker this_type;
- immediate_worker(const this_type&);
- public:
- virtual ~immediate_worker()
- {
- }
- immediate_worker()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- if (scbl.is_subscribed()) {
- // allow recursion
- recursion r(true);
- scbl(r.get_recurse());
- }
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- std::this_thread::sleep_until(when);
- if (scbl.is_subscribed()) {
- // allow recursion
- recursion r(true);
- scbl(r.get_recurse());
- }
- }
- };
-
- std::shared_ptr<immediate_worker> wi;
-
-public:
- immediate()
- : wi(std::make_shared<immediate_worker>())
- {
- }
- virtual ~immediate()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- return worker(std::move(cs), wi);
- }
-};
-
-inline const scheduler& make_immediate() {
- static scheduler instance = make_scheduler<immediate>();
- return instance;
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp
deleted file mode 100644
index 7c93469..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_NEW_THREAD_HPP)
-#define RXCPP_RX_SCHEDULER_NEW_THREAD_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-typedef std::function<std::thread(std::function<void()>)> thread_factory;
-
-struct new_thread : public scheduler_interface
-{
-private:
- typedef new_thread this_type;
- new_thread(const this_type&);
-
- struct new_worker : public worker_interface
- {
- private:
- typedef new_worker this_type;
-
- typedef detail::action_queue queue_type;
-
- new_worker(const this_type&);
-
- struct new_worker_state : public std::enable_shared_from_this<new_worker_state>
- {
- typedef detail::schedulable_queue<
- typename clock_type::time_point> queue_item_time;
-
- typedef queue_item_time::item_type item_type;
-
- virtual ~new_worker_state()
- {
- // Ensure that std::thread is no longer joinable,
- // otherwise the destructor will call std::terminate.
- if (!worker.joinable()) {
- return;
- }
- if (worker.get_id() != std::this_thread::get_id()) {
- worker.join();
- } else {
- worker.detach();
- }
- }
-
- explicit new_worker_state(composite_subscription cs)
- : lifetime(cs)
- {
- }
-
- composite_subscription lifetime;
- mutable std::mutex lock;
- mutable std::condition_variable wake;
- mutable queue_item_time q;
- std::thread worker;
- recursion r;
- };
-
- std::shared_ptr<new_worker_state> state;
-
- public:
- virtual ~new_worker()
- {
- }
-
- explicit new_worker(std::shared_ptr<new_worker_state> ws)
- : state(ws)
- {
- }
-
- new_worker(composite_subscription cs, thread_factory& tf)
- : state(std::make_shared<new_worker_state>(cs))
- {
- auto keepAlive = state;
-
- state->lifetime.add([keepAlive](){
- std::unique_lock<std::mutex> guard(keepAlive->lock);
- auto expired = std::move(keepAlive->q);
- keepAlive->q = new_worker_state::queue_item_time{};
- if (!keepAlive->q.empty()) std::terminate();
- keepAlive->wake.notify_one();
-
- // ~new_worker_state cleans up the std::thread
- });
-
- state->worker = tf([keepAlive](){
-
- // take ownership
- queue_type::ensure(std::make_shared<new_worker>(keepAlive));
- // release ownership
- RXCPP_UNWIND_AUTO([]{
- queue_type::destroy();
- });
-
- for(;;) {
- std::unique_lock<std::mutex> guard(keepAlive->lock);
- if (keepAlive->q.empty()) {
- keepAlive->wake.wait(guard, [keepAlive](){
- return !keepAlive->lifetime.is_subscribed() || !keepAlive->q.empty();
- });
- }
- if (!keepAlive->lifetime.is_subscribed()) {
- break;
- }
- auto& peek = keepAlive->q.top();
- if (!peek.what.is_subscribed()) {
- keepAlive->q.pop();
- continue;
- }
- if (clock_type::now() < peek.when) {
- keepAlive->wake.wait_until(guard, peek.when);
- continue;
- }
- auto what = peek.what;
- keepAlive->q.pop();
- keepAlive->r.reset(keepAlive->q.empty());
- guard.unlock();
- what(keepAlive->r.get_recurse());
- }
- });
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- schedule(now(), scbl);
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- if (scbl.is_subscribed()) {
- std::unique_lock<std::mutex> guard(state->lock);
- state->q.push(new_worker_state::item_type(when, scbl));
- state->r.reset(false);
- }
- state->wake.notify_one();
- }
- };
-
- mutable thread_factory factory;
-
-public:
- new_thread()
- : factory([](std::function<void()> start){
- return std::thread(std::move(start));
- })
- {
- }
- explicit new_thread(thread_factory tf)
- : factory(tf)
- {
- }
- virtual ~new_thread()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- return worker(cs, std::make_shared<new_worker>(cs, factory));
- }
-};
-
-inline scheduler make_new_thread() {
- static scheduler instance = make_scheduler<new_thread>();
- return instance;
-}
-inline scheduler make_new_thread(thread_factory tf) {
- return make_scheduler<new_thread>(tf);
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-runloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-runloop.hpp
deleted file mode 100644
index 7e522f6..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-runloop.hpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_RUN_LOOP_HPP)
-#define RXCPP_RX_SCHEDULER_RUN_LOOP_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-namespace detail {
-
-struct run_loop_state : public std::enable_shared_from_this<run_loop_state>
-{
- typedef scheduler::clock_type clock_type;
-
- typedef detail::schedulable_queue<
- clock_type::time_point> queue_item_time;
-
- typedef queue_item_time::item_type item_type;
- typedef queue_item_time::const_reference const_reference_item_type;
-
- virtual ~run_loop_state()
- {
- }
-
- run_loop_state()
- {
- }
-
- composite_subscription lifetime;
- mutable std::mutex lock;
- mutable queue_item_time q;
- recursion r;
- std::function<void(clock_type::time_point)> notify_earlier_wakeup;
-};
-
-}
-
-
-struct run_loop_scheduler : public scheduler_interface
-{
-private:
- typedef run_loop_scheduler this_type;
- run_loop_scheduler(const this_type&);
-
- struct run_loop_worker : public worker_interface
- {
- private:
- typedef run_loop_worker this_type;
-
- run_loop_worker(const this_type&);
-
- public:
- std::weak_ptr<detail::run_loop_state> state;
-
- virtual ~run_loop_worker()
- {
- }
-
- explicit run_loop_worker(std::weak_ptr<detail::run_loop_state> ws)
- : state(ws)
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- schedule(now(), scbl);
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- if (scbl.is_subscribed()) {
- auto st = state.lock();
- std::unique_lock<std::mutex> guard(st->lock);
- const bool need_earlier_wakeup_notification = st->notify_earlier_wakeup &&
- (st->q.empty() || when < st->q.top().when);
- st->q.push(detail::run_loop_state::item_type(when, scbl));
- st->r.reset(false);
- if (need_earlier_wakeup_notification) st->notify_earlier_wakeup(when);
- guard.unlock(); // So we can't get attempt to recursively lock the state
- }
- }
- };
-
- std::weak_ptr<detail::run_loop_state> state;
-
-public:
- explicit run_loop_scheduler(std::weak_ptr<detail::run_loop_state> ws)
- : state(ws)
- {
- }
- virtual ~run_loop_scheduler()
- {
- }
-
- virtual clock_type::time_point now() const {
- return clock_type::now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- auto lifetime = state.lock()->lifetime;
- auto token = lifetime.add(cs);
- cs.add([=](){lifetime.remove(token);});
- return worker(cs, create_worker_interface());
- }
-
- std::shared_ptr<worker_interface> create_worker_interface() const {
- return std::make_shared<run_loop_worker>(state);
- }
-};
-
-class run_loop
-{
-private:
- typedef run_loop this_type;
- // don't allow this instance to copy/move since it owns current_thread queue
- // for the thread it is constructed on.
- run_loop(const this_type&);
- run_loop(this_type&&);
-
- typedef detail::action_queue queue_type;
-
- typedef detail::run_loop_state::item_type item_type;
- typedef detail::run_loop_state::const_reference_item_type const_reference_item_type;
-
- std::shared_ptr<detail::run_loop_state> state;
- std::shared_ptr<run_loop_scheduler> sc;
-
-public:
- typedef scheduler::clock_type clock_type;
- run_loop()
- : state(std::make_shared<detail::run_loop_state>())
- , sc(std::make_shared<run_loop_scheduler>(state))
- {
- // take ownership so that the current_thread scheduler
- // uses the same queue on this thread
- queue_type::ensure(sc->create_worker_interface());
- }
- ~run_loop()
- {
- state->lifetime.unsubscribe();
-
- std::unique_lock<std::mutex> guard(state->lock);
-
- // release ownership
- queue_type::destroy();
-
- auto expired = std::move(state->q);
- if (!state->q.empty()) std::terminate();
- }
-
- clock_type::time_point now() const {
- return clock_type::now();
- }
-
- composite_subscription get_subscription() const {
- return state->lifetime;
- }
-
- bool empty() const {
- return state->q.empty();
- }
-
- const_reference_item_type peek() const {
- return state->q.top();
- }
-
- void dispatch() const {
- std::unique_lock<std::mutex> guard(state->lock);
- if (state->q.empty()) {
- return;
- }
- auto& peek = state->q.top();
- if (!peek.what.is_subscribed()) {
- state->q.pop();
- return;
- }
- if (clock_type::now() < peek.when) {
- return;
- }
- auto what = peek.what;
- state->q.pop();
- state->r.reset(state->q.empty());
- guard.unlock();
- what(state->r.get_recurse());
- }
-
- scheduler get_scheduler() const {
- return make_scheduler(sc);
- }
-
- void set_notify_earlier_wakeup(std::function<void(clock_type::time_point)> const& f) {
- std::unique_lock<std::mutex> guard(state->lock);
- state->notify_earlier_wakeup = f;
- }
-};
-
-inline scheduler make_run_loop(const run_loop& r) {
- return r.get_scheduler();
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp
deleted file mode 100644
index 4bfbd0b..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_SAME_WORKER_HPP)
-#define RXCPP_RX_SCHEDULER_SAME_WORKER_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-struct same_worker : public scheduler_interface
-{
-private:
- typedef same_worker this_type;
- same_worker(const this_type&);
-
- rxsc::worker controller;
-
-public:
- explicit same_worker(rxsc::worker w)
- : controller(std::move(w))
- {
- }
- virtual ~same_worker()
- {
- }
-
- virtual clock_type::time_point now() const {
- return controller.now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- // use different lifetime
- auto inner_lifetime = controller.get_subscription();
- auto token = inner_lifetime.add(cs);
- cs.add([inner_lifetime, token](){inner_lifetime.remove(token);});
- return worker(cs, controller);
- }
-};
-
-inline scheduler make_same_worker(rxsc::worker w) {
- return make_scheduler<same_worker>(std::move(w));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp
deleted file mode 100644
index aaa073d..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp
+++ /dev/null
@@ -1,617 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_TEST_HPP)
-#define RXCPP_RX_SCHEDULER_TEST_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-namespace detail {
-
-class test_type : public scheduler_interface
-{
-public:
-
- typedef scheduler_interface::clock_type clock_type;
-
- struct test_type_state : public virtual_time<long, long>
- {
- typedef virtual_time<long, long> base;
-
- using base::schedule_absolute;
- using base::schedule_relative;
-
- clock_type::time_point now() const {
- return to_time_point(clock_now);
- }
-
- virtual void schedule_absolute(long when, const schedulable& a) const
- {
- if (when <= base::clock_now)
- when = base::clock_now + 1;
-
- return base::schedule_absolute(when, a);
- }
-
- virtual long add(long absolute, long relative) const
- {
- return absolute + relative;
- }
-
- virtual clock_type::time_point to_time_point(long absolute) const
- {
- return clock_type::time_point(std::chrono::milliseconds(absolute));
- }
-
- virtual long to_relative(clock_type::duration d) const
- {
- return static_cast<long>(std::chrono::duration_cast<std::chrono::milliseconds>(d).count());
- }
- };
-
-private:
- mutable std::shared_ptr<test_type_state> state;
-
-public:
- struct test_type_worker : public worker_interface
- {
- mutable std::shared_ptr<test_type_state> state;
-
- typedef test_type_state::absolute absolute;
- typedef test_type_state::relative relative;
-
- test_type_worker(std::shared_ptr<test_type_state> st)
- : state(std::move(st))
- {
- }
-
- virtual clock_type::time_point now() const {
- return state->now();
- }
-
- virtual void schedule(const schedulable& scbl) const {
- state->schedule_absolute(state->clock(), scbl);
- }
-
- virtual void schedule(clock_type::time_point when, const schedulable& scbl) const {
- state->schedule_relative(state->to_relative(when - now()), scbl);
- }
-
- void schedule_absolute(absolute when, const schedulable& scbl) const {
- state->schedule_absolute(when, scbl);
- }
-
- void schedule_relative(relative when, const schedulable& scbl) const {
- state->schedule_relative(when, scbl);
- }
-
- bool is_enabled() const {return state->is_enabled();}
- absolute clock() const {return state->clock();}
-
- void start() const
- {
- state->start();
- }
-
- void stop() const
- {
- state->stop();
- }
-
- void advance_to(absolute time) const
- {
- state->advance_to(time);
- }
-
- void advance_by(relative time) const
- {
- state->advance_by(time);
- }
-
- void sleep(relative time) const
- {
- state->sleep(time);
- }
-
- template<class T>
- subscriber<T, rxt::testable_observer<T>> make_subscriber() const;
- };
-
-public:
- test_type()
- : state(std::make_shared<test_type_state>())
- {
- }
-
- virtual clock_type::time_point now() const {
- return state->now();
- }
-
- virtual worker create_worker(composite_subscription cs) const {
- return worker(cs, std::make_shared<test_type_worker>(state));
- }
-
- bool is_enabled() const {return state->is_enabled();}
- long clock() {
- return state->clock();
- }
-
- clock_type::time_point to_time_point(long absolute) const {
- return state->to_time_point(absolute);
- }
-
- std::shared_ptr<test_type_worker> create_test_type_worker_interface() const {
- return std::make_shared<test_type_worker>(state);
- }
-
- template<class T>
- rxt::testable_observable<T> make_hot_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const;
-
- template<class T>
- rxt::testable_observable<T> make_cold_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const;
-};
-
-template<class T>
-class mock_observer
- : public rxt::detail::test_subject_base<T>
-{
- typedef typename rxn::notification<T> notification_type;
- typedef rxn::recorded<typename notification_type::type> recorded_type;
-
-public:
- explicit mock_observer(std::shared_ptr<test_type::test_type_state> sc)
- : sc(sc)
- {
- }
-
- std::shared_ptr<test_type::test_type_state> sc;
- std::vector<recorded_type> m;
-
- virtual void on_subscribe(subscriber<T>) const {
- std::terminate();
- }
- virtual std::vector<rxn::subscription> subscriptions() const {
- std::terminate();
- }
-
- virtual std::vector<recorded_type> messages() const {
- return m;
- }
-};
-
-template<class T>
-subscriber<T, rxt::testable_observer<T>> test_type::test_type_worker::make_subscriber() const
-{
- typedef typename rxn::notification<T> notification_type;
- typedef rxn::recorded<typename notification_type::type> recorded_type;
-
- auto ts = std::make_shared<mock_observer<T>>(state);
-
- return rxcpp::make_subscriber<T>(rxt::testable_observer<T>(ts, make_observer_dynamic<T>(
- // on_next
- [ts](T value)
- {
- ts->m.push_back(
- recorded_type(ts->sc->clock(), notification_type::on_next(value)));
- },
- // on_error
- [ts](rxu::error_ptr e)
- {
- ts->m.push_back(
- recorded_type(ts->sc->clock(), notification_type::on_error(e)));
- },
- // on_completed
- [ts]()
- {
- ts->m.push_back(
- recorded_type(ts->sc->clock(), notification_type::on_completed()));
- })));
-}
-
-template<class T>
-class cold_observable
- : public rxt::detail::test_subject_base<T>
-{
- typedef cold_observable<T> this_type;
- std::shared_ptr<test_type::test_type_state> sc;
- typedef rxn::recorded<typename rxn::notification<T>::type> recorded_type;
- mutable std::vector<recorded_type> mv;
- mutable std::vector<rxn::subscription> sv;
- mutable worker controller;
-
-public:
-
- cold_observable(std::shared_ptr<test_type::test_type_state> sc, worker w, std::vector<recorded_type> mv)
- : sc(sc)
- , mv(std::move(mv))
- , controller(w)
- {
- }
-
- template<class Iterator>
- cold_observable(std::shared_ptr<test_type::test_type_state> sc, worker w, Iterator begin, Iterator end)
- : sc(sc)
- , mv(begin, end)
- , controller(w)
- {
- }
-
- virtual void on_subscribe(subscriber<T> o) const {
- sv.push_back(rxn::subscription(sc->clock()));
- auto index = sv.size() - 1;
-
- for (auto& message : mv) {
- auto n = message.value();
- sc->schedule_relative(message.time(), make_schedulable(
- controller,
- [n, o](const schedulable&) {
- if (o.is_subscribed()) {
- n->accept(o);
- }
- }));
- }
-
- auto sharedThis = std::static_pointer_cast<const this_type>(this->shared_from_this());
- o.add([sharedThis, index]() {
- sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock());
- });
- }
-
- virtual std::vector<rxn::subscription> subscriptions() const {
- return sv;
- }
-
- virtual std::vector<recorded_type> messages() const {
- return mv;
- }
-};
-
-template<class T>
-rxt::testable_observable<T> test_type::make_cold_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const
-{
- auto co = std::make_shared<cold_observable<T>>(state, create_worker(composite_subscription()), std::move(messages));
- return rxt::testable_observable<T>(co);
-}
-
-template<class T>
-class hot_observable
- : public rxt::detail::test_subject_base<T>
-{
- typedef hot_observable<T> this_type;
- std::shared_ptr<test_type::test_type_state> sc;
- typedef rxn::recorded<typename rxn::notification<T>::type> recorded_type;
- typedef subscriber<T> observer_type;
- mutable std::vector<recorded_type> mv;
- mutable std::vector<rxn::subscription> sv;
- mutable std::list<observer_type> observers;
- mutable worker controller;
-
-public:
-
- hot_observable(std::shared_ptr<test_type::test_type_state> sc, worker w, std::vector<recorded_type> mv)
- : sc(sc)
- , mv(mv)
- , controller(w)
- {
- for (auto& message : mv) {
- auto n = message.value();
- sc->schedule_absolute(message.time(), make_schedulable(
- controller,
- [this, n](const schedulable&) {
- auto local = this->observers;
- for (auto& o : local) {
- if (o.is_subscribed()) {
- n->accept(o);
- }
- }
- }));
- }
- }
-
- virtual ~hot_observable() {}
-
- virtual void on_subscribe(observer_type o) const {
- auto olocation = observers.insert(observers.end(), o);
-
- sv.push_back(rxn::subscription(sc->clock()));
- auto index = sv.size() - 1;
-
- auto sharedThis = std::static_pointer_cast<const this_type>(this->shared_from_this());
- o.add([sharedThis, index, olocation]() {
- sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock());
- sharedThis->observers.erase(olocation);
- });
- }
-
- virtual std::vector<rxn::subscription> subscriptions() const {
- return sv;
- }
-
- virtual std::vector<recorded_type> messages() const {
- return mv;
- }
-};
-
-template<class T>
-rxt::testable_observable<T> test_type::make_hot_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const
-{
- auto worker = create_worker(composite_subscription());
- auto shared = std::make_shared<hot_observable<T>>(state, worker, std::move(messages));
- return rxt::testable_observable<T>(shared);
-}
-
-template<class F>
-struct is_create_source_function
-{
- struct not_void {};
- template<class CF>
- static auto check(int) -> decltype((*(CF*)nullptr)());
- template<class CF>
- static not_void check(...);
-
- static const bool value = is_observable<decltype(check<rxu::decay_t<F>>(0))>::value;
-};
-
-}
-
-class test : public scheduler
-{
- std::shared_ptr<detail::test_type> tester;
-public:
-
- explicit test(std::shared_ptr<detail::test_type> t)
- : scheduler(std::static_pointer_cast<scheduler_interface>(t))
- , tester(t)
- {
- }
-
- typedef detail::test_type::clock_type clock_type;
-
- static const long created_time = 100;
- static const long subscribed_time = 200;
- static const long unsubscribed_time = 1000;
-
- template<class T>
- struct messages
- {
- typedef typename rxn::notification<T> notification_type;
- typedef rxn::recorded<typename notification_type::type> recorded_type;
- typedef rxn::subscription subscription_type;
-
- messages() {}
-
- template<typename U>
- static recorded_type next(long ticks, U value) {
- return recorded_type(ticks, notification_type::on_next(std::move(value)));
- }
-
- static recorded_type completed(long ticks) {
- return recorded_type(ticks, notification_type::on_completed());
- }
-
- template<typename Exception>
- static recorded_type error(long ticks, Exception&& e) {
- return recorded_type(ticks, notification_type::on_error(std::forward<Exception>(e)));
- }
-
- static rxn::subscription subscribe(long subscribe, long unsubscribe) {
- return rxn::subscription(subscribe, unsubscribe);
- }
- };
-
- class test_worker : public worker
- {
- std::shared_ptr<detail::test_type::test_type_worker> tester;
- public:
-
- ~test_worker() {
- }
-
- explicit test_worker(composite_subscription cs, std::shared_ptr<detail::test_type::test_type_worker> t)
- : worker(cs, std::static_pointer_cast<worker_interface>(t))
- , tester(t)
- {
- }
-
- bool is_enabled() const {return tester->is_enabled();}
- long clock() const {return tester->clock();}
-
- void schedule_absolute(long when, const schedulable& a) const {
- tester->schedule_absolute(when, a);
- }
-
- void schedule_relative(long when, const schedulable& a) const {
- tester->schedule_relative(when, a);
- }
-
- template<class Arg0, class... ArgN>
- auto schedule_absolute(long when, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type {
- tester->schedule_absolute(when, make_schedulable(*this, std::forward<Arg0>(a0), std::forward<ArgN>(an)...));
- }
-
- template<class Arg0, class... ArgN>
- auto schedule_relative(long when, Arg0&& a0, ArgN&&... an) const
- -> typename std::enable_if<
- (detail::is_action_function<Arg0>::value ||
- is_subscription<Arg0>::value) &&
- !is_schedulable<Arg0>::value>::type {
- tester->schedule_relative(when, make_schedulable(*this, std::forward<Arg0>(a0), std::forward<ArgN>(an)...));
- }
-
- void advance_to(long time) const
- {
- tester->advance_to(time);
- }
-
- void advance_by(long time) const
- {
- tester->advance_by(time);
- }
-
- void sleep(long time) const
- {
- tester->sleep(time);
- }
-
- template<class T, class F>
- auto start(F createSource, long created, long subscribed, long unsubscribed) const
- -> subscriber<T, rxt::testable_observer<T>>
- {
- struct state_type
- : public std::enable_shared_from_this<state_type>
- {
- typedef decltype(createSource()) source_type;
-
- std::unique_ptr<source_type> source;
- subscriber<T, rxt::testable_observer<T>> o;
-
- explicit state_type(subscriber<T, rxt::testable_observer<T>> o)
- : source()
- , o(o)
- {
- }
- };
- auto state = std::make_shared<state_type>(this->make_subscriber<T>());
-
- schedule_absolute(created, [createSource, state](const schedulable&) {
- state->source.reset(new typename state_type::source_type(createSource()));
- });
- schedule_absolute(subscribed, [state](const schedulable&) {
- state->source->subscribe(state->o);
- });
- schedule_absolute(unsubscribed, [state](const schedulable&) {
- state->o.unsubscribe();
- });
-
- tester->start();
-
- return state->o;
- }
-
- template<class T, class F>
- auto start(F&& createSource, long unsubscribed) const
- -> subscriber<T, rxt::testable_observer<T>>
- {
- return start<T>(std::forward<F>(createSource), created_time, subscribed_time, unsubscribed);
- }
-
- template<class T, class F>
- auto start(F&& createSource) const
- -> subscriber<T, rxt::testable_observer<T>>
- {
- return start<T>(std::forward<F>(createSource), created_time, subscribed_time, unsubscribed_time);
- }
-
- template<class F>
- struct start_traits
- {
- typedef decltype((*(F*)nullptr)()) source_type;
- typedef typename source_type::value_type value_type;
- typedef subscriber<value_type, rxt::testable_observer<value_type>> subscriber_type;
- };
-
- template<class F>
- auto start(F createSource, long created, long subscribed, long unsubscribed) const
- -> typename std::enable_if<detail::is_create_source_function<F>::value, start_traits<F>>::type::subscriber_type
- {
- return start<rxu::value_type_t<start_traits<F>>>(std::move(createSource), created, subscribed, unsubscribed);
- }
-
- template<class F>
- auto start(F createSource, long unsubscribed) const
- -> typename std::enable_if<detail::is_create_source_function<F>::value, start_traits<F>>::type::subscriber_type
- {
- return start<rxu::value_type_t<start_traits<F>>>(std::move(createSource), created_time, subscribed_time, unsubscribed);
- }
-
- template<class F>
- auto start(F createSource) const
- -> typename std::enable_if<detail::is_create_source_function<F>::value, start_traits<F>>::type::subscriber_type
- {
- return start<rxu::value_type_t<start_traits<F>>>(std::move(createSource), created_time, subscribed_time, unsubscribed_time);
- }
-
- void start() const {
- tester->start();
- }
-
- template<class T>
- subscriber<T, rxt::testable_observer<T>> make_subscriber() const {
- return tester->make_subscriber<T>();
- }
- };
-
- clock_type::time_point now() const {
- return tester->now();
- }
-
- test_worker create_worker(composite_subscription cs = composite_subscription()) const {
- return test_worker(cs, tester->create_test_type_worker_interface());
- }
-
- bool is_enabled() const {return tester->is_enabled();}
- long clock() const {return tester->clock();}
-
- clock_type::time_point to_time_point(long absolute) const {
- return tester->to_time_point(absolute);
- }
-
- template<class T>
- rxt::testable_observable<T> make_hot_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const{
- return tester->make_hot_observable(std::move(messages));
- }
-
- template<class T, std::size_t size>
- auto make_hot_observable(const T (&arr) [size]) const
- -> decltype(tester->make_hot_observable(std::vector<T>())) {
- return tester->make_hot_observable(rxu::to_vector(arr));
- }
-
- template<class T>
- auto make_hot_observable(std::initializer_list<T> il) const
- -> decltype(tester->make_hot_observable(std::vector<T>())) {
- return tester->make_hot_observable(std::vector<T>(il));
- }
-
- template<class T>
- rxt::testable_observable<T> make_cold_observable(std::vector<rxn::recorded<std::shared_ptr<rxn::detail::notification_base<T>>>> messages) const {
- return tester->make_cold_observable(std::move(messages));
- }
-
- template<class T, std::size_t size>
- auto make_cold_observable(const T (&arr) [size]) const
- -> decltype(tester->make_cold_observable(std::vector<T>())) {
- return tester->make_cold_observable(rxu::to_vector(arr));
- }
-
- template<class T>
- auto make_cold_observable(std::initializer_list<T> il) const
- -> decltype(tester->make_cold_observable(std::vector<T>())) {
- return tester->make_cold_observable(std::vector<T>(il));
- }
-};
-
-
-inline test make_test() {
- return test(std::make_shared<detail::test_type>());
-}
-
-}
-
-inline identity_one_worker identity_test() {
- static identity_one_worker r(rxsc::make_test());
- return r;
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp
deleted file mode 100644
index c36ddf3..0000000
--- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SCHEDULER_VIRTUAL_TIME_HPP)
-#define RXCPP_RX_SCHEDULER_VIRTUAL_TIME_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace schedulers {
-
-namespace detail {
-
-template<class Absolute, class Relative>
-struct virtual_time_base : std::enable_shared_from_this<virtual_time_base<Absolute, Relative>>
-{
-private:
- typedef virtual_time_base<Absolute, Relative> this_type;
- virtual_time_base(const virtual_time_base&);
-
- mutable bool isenabled;
-
-public:
- typedef Absolute absolute;
- typedef Relative relative;
-
- virtual ~virtual_time_base()
- {
- }
-
-protected:
- virtual_time_base()
- : isenabled(false)
- , clock_now(0)
- {
- }
- explicit virtual_time_base(absolute initialClock)
- : isenabled(false)
- , clock_now(initialClock)
- {
- }
-
- mutable absolute clock_now;
-
- typedef time_schedulable<long> item_type;
-
- virtual absolute add(absolute, relative) const =0;
-
- virtual typename scheduler_base::clock_type::time_point to_time_point(absolute) const =0;
- virtual relative to_relative(typename scheduler_base::clock_type::duration) const =0;
-
- virtual item_type top() const =0;
- virtual void pop() const =0;
- virtual bool empty() const =0;
-
-public:
-
- virtual void schedule_absolute(absolute, const schedulable&) const =0;
-
- virtual void schedule_relative(relative when, const schedulable& a) const {
- auto at = add(clock_now, when);
- return schedule_absolute(at, a);
- }
-
- bool is_enabled() const {return isenabled;}
- absolute clock() const {return clock_now;}
-
- void start() const
- {
- if (!isenabled) {
- isenabled = true;
- rxsc::recursion r;
- r.reset(false);
- while (!empty() && isenabled) {
- auto next = top();
- pop();
- if (next.what.is_subscribed()) {
- if (next.when > clock_now) {
- clock_now = next.when;
- }
- next.what(r.get_recurse());
- }
- }
- isenabled = false;
- }
- }
-
- void stop() const
- {
- isenabled = false;
- }
-
- void advance_to(absolute time) const
- {
- if (time < clock_now) {
- std::terminate();
- }
-
- if (time == clock_now) {
- return;
- }
-
- if (!isenabled) {
- isenabled = true;
- rxsc::recursion r;
- while (!empty() && isenabled) {
- auto next = top();
- if (next.when <= time) {
- pop();
- if (!next.what.is_subscribed()) {
- continue;
- }
- if (next.when > clock_now) {
- clock_now = next.when;
- }
- next.what(r.get_recurse());
- }
- else {
- break;
- }
- }
- isenabled = false;
- clock_now = time;
- }
- else {
- std::terminate();
- }
- }
-
- void advance_by(relative time) const
- {
- auto dt = add(clock_now, time);
-
- if (dt < clock_now) {
- std::terminate();
- }
-
- if (dt == clock_now) {
- return;
- }
-
- if (!isenabled) {
- advance_to(dt);
- }
- else {
- std::terminate();
- }
- }
-
- void sleep(relative time) const
- {
- auto dt = add(clock_now, time);
-
- if (dt < clock_now) {
- std::terminate();
- }
-
- clock_now = dt;
- }
-
-};
-
-}
-
-template<class Absolute, class Relative>
-struct virtual_time : public detail::virtual_time_base<Absolute, Relative>
-{
- typedef detail::virtual_time_base<Absolute, Relative> base;
-
- typedef typename base::item_type item_type;
-
- typedef detail::schedulable_queue<
- typename item_type::time_point_type> queue_item_time;
-
- mutable queue_item_time q;
-
-public:
- virtual ~virtual_time()
- {
- }
-
-protected:
- virtual_time()
- {
- }
- explicit virtual_time(typename base::absolute initialClock)
- : base(initialClock)
- {
- }
-
- virtual item_type top() const {
- return q.top();
- }
- virtual void pop() const {
- q.pop();
- }
- virtual bool empty() const {
- return q.empty();
- }
-
- using base::schedule_absolute;
- using base::schedule_relative;
-
- virtual void schedule_absolute(typename base::absolute when, const schedulable& a) const
- {
- // use a separate subscription here so that a's subscription is not affected
- auto run = make_schedulable(
- a.get_worker(),
- composite_subscription(),
- [a](const schedulable& scbl) {
- rxsc::recursion r;
- r.reset(false);
- if (scbl.is_subscribed()) {
- scbl.unsubscribe(); // unsubscribe() run, not a;
- a(r.get_recurse());
- }
- });
- q.push(item_type(when, run));
- }
-};
-
-
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-create.hpp b/Rx/v2/src/rxcpp/sources/rx-create.hpp
deleted file mode 100644
index 95b9533..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-create.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_CREATE_HPP)
-#define RXCPP_SOURCES_RX_CREATE_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-create.hpp
-
- \brief Returns an observable that executes the specified function when a subscriber subscribes to it.
-
- \tparam T the type of the items that this observable emits
- \tparam OnSubscribe the type of OnSubscribe handler function
-
- \param os OnSubscribe event handler
-
- \return Observable that executes the specified function when a Subscriber subscribes to it.
-
- \sample
- \snippet create.cpp Create sample
- \snippet output.txt Create sample
-
- \warning
- It is good practice to check the observer's is_subscribed state from within the function you pass to create
- so that your observable can stop emitting items or doing expensive calculations when there is no longer an interested observer.
-
- \badcode
- \snippet create.cpp Create bad code
- \snippet output.txt Create bad code
-
- \goodcode
- \snippet create.cpp Create good code
- \snippet output.txt Create good code
-
- \warning
- It is good practice to use operators like observable::take to control lifetime rather than use the subscription explicitly.
-
- \goodcode
- \snippet create.cpp Create great code
- \snippet output.txt Create great code
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class T, class OnSubscribe>
-struct create : public source_base<T>
-{
- typedef create<T, OnSubscribe> this_type;
-
- typedef rxu::decay_t<OnSubscribe> on_subscribe_type;
-
- on_subscribe_type on_subscribe_function;
-
- create(on_subscribe_type os)
- : on_subscribe_function(std::move(os))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
-
- on_exception(
- [&](){
- this->on_subscribe_function(o);
- return true;
- },
- o);
- }
-};
-
-}
-
-/*! @copydoc rx-create.hpp
- */
-template<class T, class OnSubscribe>
-auto create(OnSubscribe os)
- -> observable<T, detail::create<T, OnSubscribe>> {
- return observable<T, detail::create<T, OnSubscribe>>(
- detail::create<T, OnSubscribe>(std::move(os)));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-defer.hpp b/Rx/v2/src/rxcpp/sources/rx-defer.hpp
deleted file mode 100644
index 306b4d0..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-defer.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_DEFER_HPP)
-#define RXCPP_SOURCES_RX_DEFER_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-defer.hpp
-
- \brief Returns an observable that calls the specified observable factory to create an observable for each new observer that subscribes.
-
- \tparam ObservableFactory the type of the observable factory
-
- \param of the observable factory function to invoke for each observer that subscribes to the resulting observable
-
- \return observable whose observers' subscriptions trigger an invocation of the given observable factory function
-
- \sample
- \snippet defer.cpp defer sample
- \snippet output.txt defer sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class ObservableFactory>
-struct defer_traits
-{
- typedef rxu::decay_t<ObservableFactory> observable_factory_type;
- typedef decltype((*(observable_factory_type*)nullptr)()) collection_type;
- typedef typename collection_type::value_type value_type;
-};
-
-template<class ObservableFactory>
-struct defer : public source_base<rxu::value_type_t<defer_traits<ObservableFactory>>>
-{
- typedef defer<ObservableFactory> this_type;
- typedef defer_traits<ObservableFactory> traits;
-
- typedef typename traits::observable_factory_type observable_factory_type;
- typedef typename traits::collection_type collection_type;
-
- observable_factory_type observable_factory;
-
- defer(observable_factory_type of)
- : observable_factory(std::move(of))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
-
- auto selectedCollection = on_exception(
- [this](){return this->observable_factory();},
- o);
- if (selectedCollection.empty()) {
- return;
- }
-
- selectedCollection->subscribe(o);
- }
-};
-
-}
-
-/*! @copydoc rx-defer.hpp
- */
-template<class ObservableFactory>
-auto defer(ObservableFactory of)
- -> observable<rxu::value_type_t<detail::defer_traits<ObservableFactory>>, detail::defer<ObservableFactory>> {
- return observable<rxu::value_type_t<detail::defer_traits<ObservableFactory>>, detail::defer<ObservableFactory>>(
- detail::defer<ObservableFactory>(std::move(of)));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-empty.hpp b/Rx/v2/src/rxcpp/sources/rx-empty.hpp
deleted file mode 100644
index 2e11a16..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-empty.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_EMPTY_HPP)
-#define RXCPP_SOURCES_RX_EMPTY_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-empty.hpp
-
- \brief Returns an observable that sends no items to observer and immediately completes, on the specified scheduler.
-
- \tparam T the type of (not) emitted items
- \tparam Coordination the type of the scheduler (optional)
-
- \param cn the scheduler to use for scheduling the items (optional)
-
- \return Observable that sends no items to observer and immediately completes.
-
- \sample
- \snippet empty.cpp empty sample
- \snippet output.txt empty sample
-
- \sample
- \snippet empty.cpp threaded empty sample
- \snippet output.txt threaded empty sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-/*! @copydoc rx-empty.hpp
- */
-template<class T>
-auto empty()
- -> decltype(from<T>()) {
- return from<T>();
-}
-/*! @copydoc rx-empty.hpp
- */
-template<class T, class Coordination>
-auto empty(Coordination cn)
- -> decltype(from<T>(std::move(cn))) {
- return from<T>(std::move(cn));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp
deleted file mode 100644
index f245d02..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-error.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_ERROR_HPP)
-#define RXCPP_SOURCES_RX_ERROR_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-error.hpp
-
- \brief Returns an observable that sends no items to observer and immediately generates an error, on the specified scheduler.
-
- \tparam T the type of (not) emitted items
- \tparam Exception the type of the error
- \tparam Coordination the type of the scheduler (optional)
-
- \param e the error to be passed to observers
- \param cn the scheduler to use for scheduling the items (optional)
-
- \return Observable that sends no items to observer and immediately generates an error.
-
- \sample
- \snippet error.cpp error sample
- \snippet output.txt error sample
-
- \sample
- \snippet error.cpp threaded error sample
- \snippet output.txt threaded error sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class T, class Coordination>
-struct error : public source_base<T>
-{
- typedef error<T, Coordination> this_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
-
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct error_initial_type
- {
- error_initial_type(rxu::error_ptr e, coordination_type cn)
- : exception(e)
- , coordination(std::move(cn))
- {
- }
- rxu::error_ptr exception;
- coordination_type coordination;
- };
- error_initial_type initial;
-
- error(rxu::error_ptr e, coordination_type cn)
- : initial(e, std::move(cn))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
-
- // creates a worker whose lifetime is the same as this subscription
- auto coordinator = initial.coordination.create_coordinator(o.get_subscription());
- auto controller = coordinator.get_worker();
- auto exception = initial.exception;
-
- auto producer = [=](const rxsc::schedulable&){
- auto& dest = o;
- if (!dest.is_subscribed()) {
- // terminate loop
- return;
- }
-
- dest.on_error(exception);
- // o is unsubscribed
- };
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- o);
- if (selectedProducer.empty()) {
- return;
- }
- controller.schedule(selectedProducer.get());
- }
-};
-
-struct throw_ptr_tag{};
-struct throw_instance_tag{};
-
-template <class T, class Coordination>
-auto make_error(throw_ptr_tag&&, rxu::error_ptr exception, Coordination cn)
- -> observable<T, error<T, Coordination>> {
- return observable<T, error<T, Coordination>>(error<T, Coordination>(std::move(exception), std::move(cn)));
-}
-
-template <class T, class E, class Coordination>
-auto make_error(throw_instance_tag&&, E e, Coordination cn)
- -> observable<T, error<T, Coordination>> {
- rxu::error_ptr ep = rxu::make_error_ptr(e);
- return observable<T, error<T, Coordination>>(error<T, Coordination>(std::move(ep), std::move(cn)));
-}
-
-}
-
-}
-
-namespace sources {
-
-/*! @copydoc rx-error.hpp
- */
-template<class T, class E>
-auto error(E e)
- -> decltype(detail::make_error<T>(typename std::conditional<std::is_same<rxu::error_ptr, rxu::decay_t<E>>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate())) {
- return detail::make_error<T>(typename std::conditional<std::is_same<rxu::error_ptr, rxu::decay_t<E>>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate());
-}
-/*! @copydoc rx-error.hpp
- */
-template<class T, class E, class Coordination>
-auto error(E e, Coordination cn)
- -> decltype(detail::make_error<T>(typename std::conditional<std::is_same<rxu::error_ptr, rxu::decay_t<E>>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn))) {
- return detail::make_error<T>(typename std::conditional<std::is_same<rxu::error_ptr, rxu::decay_t<E>>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp
deleted file mode 100644
index 7d3d47d..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_INTERVAL_HPP)
-#define RXCPP_SOURCES_RX_INTERVAL_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-interval.hpp
-
- \brief Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler.
-
- \tparam Coordination the type of the scheduler (optional)
-
- \param period period between emitted values
- \param cn the scheduler to use for scheduling the items (optional)
-
- \return Observable that sends a sequential integer each time interval
-
- \sample
- \snippet interval.cpp interval sample
- \snippet output.txt interval sample
-
- \sample
- \snippet interval.cpp immediate interval sample
- \snippet output.txt immediate interval sample
-
- \sample
- \snippet interval.cpp threaded interval sample
- \snippet output.txt threaded interval sample
-
- \sample
- \snippet interval.cpp threaded immediate interval sample
- \snippet output.txt threaded immediate interval sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class Coordination>
-struct interval : public source_base<long>
-{
- typedef interval<Coordination> this_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct interval_initial_type
- {
- interval_initial_type(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, coordination_type cn)
- : initial(i)
- , period(p)
- , coordination(std::move(cn))
- {
- }
- rxsc::scheduler::clock_type::time_point initial;
- rxsc::scheduler::clock_type::duration period;
- coordination_type coordination;
- };
- interval_initial_type initial;
-
- interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, coordination_type cn)
- : initial(i, p, std::move(cn))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- // creates a worker whose lifetime is the same as this subscription
- auto coordinator = initial.coordination.create_coordinator(o.get_subscription());
-
- auto controller = coordinator.get_worker();
-
- auto counter = std::make_shared<long>(0);
-
- auto producer = [o, counter](const rxsc::schedulable&) {
- // send next value
- o.on_next(++(*counter));
- };
-
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- o);
- if (selectedProducer.empty()) {
- return;
- }
-
- controller.schedule_periodically(initial.initial, initial.period, selectedProducer.get());
- }
-};
-
-template<class Duration, class Coordination>
-struct defer_interval : public defer_observable<
- rxu::all_true<
- std::is_convertible<Duration, rxsc::scheduler::clock_type::duration>::value,
- is_coordination<Coordination>::value>,
- void,
- interval, Coordination>
-{
-};
-
-}
-
-
-/*! @copydoc rx-interval.hpp
- */
-template<class Duration>
-auto interval(Duration period)
- -> typename std::enable_if<
- detail::defer_interval<Duration, identity_one_worker>::value,
- typename detail::defer_interval<Duration, identity_one_worker>::observable_type>::type {
- return detail::defer_interval<Duration, identity_one_worker>::make(identity_current_thread().now(), period, identity_current_thread());
-}
-
-/*! @copydoc rx-interval.hpp
- */
-template<class Coordination>
-auto interval(rxsc::scheduler::clock_type::duration period, Coordination cn)
- -> typename std::enable_if<
- detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::value,
- typename detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::observable_type>::type {
- return detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::make(cn.now(), period, std::move(cn));
-}
-
-/*! @copydoc rx-interval.hpp
- */
-template<class Duration>
-auto interval(rxsc::scheduler::clock_type::time_point when, Duration period)
- -> typename std::enable_if<
- detail::defer_interval<Duration, identity_one_worker>::value,
- typename detail::defer_interval<Duration, identity_one_worker>::observable_type>::type {
- return detail::defer_interval<Duration, identity_one_worker>::make(when, period, identity_current_thread());
-}
-
-/*! @copydoc rx-interval.hpp
- */
-template<class Coordination>
-auto interval(rxsc::scheduler::clock_type::time_point when, rxsc::scheduler::clock_type::duration period, Coordination cn)
- -> typename std::enable_if<
- detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::value,
- typename detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::observable_type>::type {
- return detail::defer_interval<rxsc::scheduler::clock_type::duration, Coordination>::make(when, period, std::move(cn));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp
deleted file mode 100644
index 07f50bf..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_ITERATE_HPP)
-#define RXCPP_SOURCES_RX_ITERATE_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-iterate.hpp
-
- \brief Returns an observable that sends each value in the collection, on the specified scheduler.
-
- \tparam Collection the type of the collection of values that this observable emits
- \tparam Coordination the type of the scheduler (optional)
-
- \param c collection containing values to send
- \param cn the scheduler to use for scheduling the items (optional)
-
- \return Observable that sends each value in the collection.
-
- \sample
- \snippet iterate.cpp iterate sample
- \snippet output.txt iterate sample
-
- \sample
- \snippet iterate.cpp threaded iterate sample
- \snippet output.txt threaded iterate sample
-
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class Collection>
-struct is_iterable
-{
- typedef rxu::decay_t<Collection> collection_type;
-
- struct not_void {};
- template<class CC>
- static auto check(int) -> decltype(std::begin(*(CC*)nullptr));
- template<class CC>
- static not_void check(...);
-
- static const bool value = !std::is_same<decltype(check<collection_type>(0)), not_void>::value;
-};
-
-template<class Collection>
-struct iterate_traits
-{
- typedef rxu::decay_t<Collection> collection_type;
- typedef rxu::decay_t<decltype(std::begin(*(collection_type*)nullptr))> iterator_type;
- typedef rxu::value_type_t<std::iterator_traits<iterator_type>> value_type;
-};
-
-template<class Collection, class Coordination>
-struct iterate : public source_base<rxu::value_type_t<iterate_traits<Collection>>>
-{
- typedef iterate<Collection, Coordination> this_type;
- typedef iterate_traits<Collection> traits;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- typedef typename traits::collection_type collection_type;
- typedef typename traits::iterator_type iterator_type;
-
- struct iterate_initial_type
- {
- iterate_initial_type(collection_type c, coordination_type cn)
- : collection(std::move(c))
- , coordination(std::move(cn))
- {
- }
- collection_type collection;
- coordination_type coordination;
- };
- iterate_initial_type initial;
-
- iterate(collection_type c, coordination_type cn)
- : initial(std::move(c), std::move(cn))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- typedef typename coordinator_type::template get<Subscriber>::type output_type;
-
- struct iterate_state_type
- : public iterate_initial_type
- {
- iterate_state_type(const iterate_initial_type& i, output_type o)
- : iterate_initial_type(i)
- , cursor(std::begin(iterate_initial_type::collection))
- , end(std::end(iterate_initial_type::collection))
- , out(std::move(o))
- {
- }
- iterate_state_type(const iterate_state_type& o)
- : iterate_initial_type(o)
- , cursor(std::begin(iterate_initial_type::collection))
- , end(std::end(iterate_initial_type::collection))
- , out(std::move(o.out)) // since lambda capture does not yet support move
- {
- }
- mutable iterator_type cursor;
- iterator_type end;
- mutable output_type out;
- };
-
- // creates a worker whose lifetime is the same as this subscription
- auto coordinator = initial.coordination.create_coordinator(o.get_subscription());
-
- iterate_state_type state(initial, o);
-
- auto controller = coordinator.get_worker();
-
- auto producer = [state](const rxsc::schedulable& self){
- if (!state.out.is_subscribed()) {
- // terminate loop
- return;
- }
-
- if (state.cursor != state.end) {
- // send next value
- state.out.on_next(*state.cursor);
- ++state.cursor;
- }
-
- if (state.cursor == state.end) {
- state.out.on_completed();
- // o is unsubscribed
- return;
- }
-
- // tail recurse this same action to continue loop
- self();
- };
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- o);
- if (selectedProducer.empty()) {
- return;
- }
- controller.schedule(selectedProducer.get());
-
- }
-};
-
-}
-
-/*! @copydoc rx-iterate.hpp
- */
-template<class Collection>
-auto iterate(Collection c)
- -> observable<rxu::value_type_t<detail::iterate_traits<Collection>>, detail::iterate<Collection, identity_one_worker>> {
- return observable<rxu::value_type_t<detail::iterate_traits<Collection>>, detail::iterate<Collection, identity_one_worker>>(
- detail::iterate<Collection, identity_one_worker>(std::move(c), identity_immediate()));
-}
-/*! @copydoc rx-iterate.hpp
- */
-template<class Collection, class Coordination>
-auto iterate(Collection c, Coordination cn)
- -> observable<rxu::value_type_t<detail::iterate_traits<Collection>>, detail::iterate<Collection, Coordination>> {
- return observable<rxu::value_type_t<detail::iterate_traits<Collection>>, detail::iterate<Collection, Coordination>>(
- detail::iterate<Collection, Coordination>(std::move(c), std::move(cn)));
-}
-
-/*! Returns an observable that sends an empty set of values and then completes.
-
- \tparam T the type of elements (not) to be sent
-
- \return Observable that sends an empty set of values and then completes.
-
- This is a degenerate case of rxcpp::observable<void,void>#from(Value0,ValueN...) operator.
-
- \note This is a degenerate case of ```from(Value0 v0, ValueN... vn)``` operator.
-*/
-template<class T>
-auto from()
- -> decltype(iterate(std::initializer_list<T>(), identity_immediate())) {
- return iterate(std::initializer_list<T>(), identity_immediate());
-}
-/*! Returns an observable that sends an empty set of values and then completes, on the specified scheduler.
-
- \tparam T the type of elements (not) to be sent
- \tparam Coordination the type of the scheduler
-
- \return Observable that sends an empty set of values and then completes.
-
- \note This is a degenerate case of ```from(Coordination cn, Value0 v0, ValueN... vn)``` operator.
-*/
-template<class T, class Coordination>
-auto from(Coordination cn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- decltype( iterate(std::initializer_list<T>(), std::move(cn)))>::type {
- return iterate(std::initializer_list<T>(), std::move(cn));
-}
-/*! Returns an observable that sends each value from its arguments list.
-
- \tparam Value0 ...
- \tparam ValueN the type of sending values
-
- \param v0 ...
- \param vn values to send
-
- \return Observable that sends each value from its arguments list.
-
- \sample
- \snippet from.cpp from sample
- \snippet output.txt from sample
-
- \note This operator is useful to send separated values. If they are stored as a collection, use observable<void,void>::iterate instead.
-*/
-template<class Value0, class... ValueN>
-auto from(Value0 v0, ValueN... vn)
- -> typename std::enable_if<!is_coordination<Value0>::value,
- decltype(iterate(*(std::array<Value0, sizeof...(ValueN) + 1>*)nullptr, identity_immediate()))>::type {
- std::array<Value0, sizeof...(ValueN) + 1> c{{v0, vn...}};
- return iterate(std::move(c), identity_immediate());
-}
-/*! Returns an observable that sends each value from its arguments list, on the specified scheduler.
-
- \tparam Coordination the type of the scheduler
- \tparam Value0 ...
- \tparam ValueN the type of sending values
-
- \param cn the scheduler to use for scheduling the items
- \param v0 ...
- \param vn values to send
-
- \return Observable that sends each value from its arguments list.
-
- \sample
- \snippet from.cpp threaded from sample
- \snippet output.txt threaded from sample
-
- \note This operator is useful to send separated values. If they are stored as a collection, use observable<void,void>::iterate instead.
-*/
-template<class Coordination, class Value0, class... ValueN>
-auto from(Coordination cn, Value0 v0, ValueN... vn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- decltype(iterate(*(std::array<Value0, sizeof...(ValueN) + 1>*)nullptr, std::move(cn)))>::type {
- std::array<Value0, sizeof...(ValueN) + 1> c{{v0, vn...}};
- return iterate(std::move(c), std::move(cn));
-}
-
-
-/*! Returns an observable that sends the specified item to observer and then completes.
-
- \tparam T the type of the emitted item
-
- \param v the value to send
-
- \return Observable that sends the specified item to observer and then completes.
-
- \sample
- \snippet just.cpp just sample
- \snippet output.txt just sample
-*/
-template<class Value0>
-auto just(Value0 v0)
- -> typename std::enable_if<!is_coordination<Value0>::value,
- decltype(iterate(*(std::array<Value0, 1>*)nullptr, identity_immediate()))>::type {
- std::array<Value0, 1> c{{v0}};
- return iterate(std::move(c), identity_immediate());
-}
-/*! Returns an observable that sends the specified item to observer and then completes, on the specified scheduler.
-
- \tparam T the type of the emitted item
- \tparam Coordination the type of the scheduler
-
- \param v the value to send
- \param cn the scheduler to use for scheduling the items
-
- \return Observable that sends the specified item to observer and then completes.
-
- \sample
- \snippet just.cpp threaded just sample
- \snippet output.txt threaded just sample
-*/
-template<class Value0, class Coordination>
-auto just(Value0 v0, Coordination cn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- decltype(iterate(*(std::array<Value0, 1>*)nullptr, std::move(cn)))>::type {
- std::array<Value0, 1> c{{v0}};
- return iterate(std::move(c), std::move(cn));
-}
-
-/*! Returns an observable that sends the specified values before it begins to send items emitted by the given observable.
-
- \tparam Observable the type of the observable that emits values for resending
- \tparam Value0 ...
- \tparam ValueN the type of sending values
-
- \param o the observable that emits values for resending
- \param v0 ...
- \param vn values to send
-
- \return Observable that sends the specified values before it begins to send items emitted by the given observable.
-
- \sample
- \snippet start_with.cpp full start_with sample
- \snippet output.txt full start_with sample
-
- Instead of passing the observable as a parameter, you can use rxcpp::observable<T, SourceOperator>::start_with method of the existing observable:
- \snippet start_with.cpp short start_with sample
- \snippet output.txt short start_with sample
-*/
-template<class Observable, class Value0, class... ValueN>
-auto start_with(Observable o, Value0 v0, ValueN... vn)
- -> decltype(from(rxu::value_type_t<Observable>(v0), rxu::value_type_t<Observable>(vn)...).concat(o)) {
- return from(rxu::value_type_t<Observable>(v0), rxu::value_type_t<Observable>(vn)...).concat(o);
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-never.hpp b/Rx/v2/src/rxcpp/sources/rx-never.hpp
deleted file mode 100644
index ea34399..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-never.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_NEVER_HPP)
-#define RXCPP_SOURCES_RX_NEVER_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-never.hpp
-
- \brief Returns an observable that never sends any items or notifications to observer.
-
- \tparam T the type of (not) emitted items
-
- \return Observable that never sends any items or notifications to observer.
-
- \sample
- \snippet never.cpp never sample
- \snippet output.txt never sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class T>
-struct never : public source_base<T>
-{
- template<class Subscriber>
- void on_subscribe(Subscriber) const {
- }
-};
-
-}
-
-/*! @copydoc rx-never.hpp
- */
-template<class T>
-auto never()
- -> observable<T, detail::never<T>> {
- return observable<T, detail::never<T>>(detail::never<T>());
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp
deleted file mode 100644
index c56ee1f..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-range.hpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_RANGE_HPP)
-#define RXCPP_SOURCES_RX_RANGE_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-range.hpp
-
- \brief Returns an observable that sends values in the range ```first```-```last``` by adding ```step``` to the previous value. The values are sent on the specified scheduler.
-
- \tparam T the type of the values that this observable emits
- \tparam Coordination the type of the scheduler (optional)
-
- \param first first value to send (optional)
- \param last last value to send (optional)
- \param step value to add to the previous value to get the next value (optional)
- \param cn the scheduler to run the generator loop on (optional)
-
- \return Observable that sends values in the range ```first```-```last``` by adding ```step``` to the previous value using the specified scheduler.
-
- \sample
- \snippet range.cpp threaded range sample
- \snippet output.txt threaded range sample
-
- An alternative way to specify the scheduler for emitted values is to use observable::subscribe_on operator
- \snippet range.cpp subscribe_on range sample
- \snippet output.txt subscribe_on range sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class T, class Coordination>
-struct range : public source_base<T>
-{
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct range_state_type
- {
- range_state_type(T f, T l, std::ptrdiff_t s, coordination_type cn)
- : next(f)
- , last(l)
- , step(s)
- , coordination(std::move(cn))
- {
- }
- mutable T next;
- T last;
- std::ptrdiff_t step;
- coordination_type coordination;
- };
- range_state_type initial;
- range(T f, T l, std::ptrdiff_t s, coordination_type cn)
- : initial(f, l, s, std::move(cn))
- {
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- // creates a worker whose lifetime is the same as this subscription
- auto coordinator = initial.coordination.create_coordinator(o.get_subscription());
-
- auto controller = coordinator.get_worker();
-
- auto state = initial;
-
- auto producer = [=](const rxsc::schedulable& self){
- auto& dest = o;
- if (!dest.is_subscribed()) {
- // terminate loop
- return;
- }
-
- // send next value
- dest.on_next(state.next);
- if (!dest.is_subscribed()) {
- // terminate loop
- return;
- }
-
- if (std::max(state.last, state.next) - std::min(state.last, state.next) < std::abs(state.step)) {
- if (state.last != state.next) {
- dest.on_next(state.last);
- }
- dest.on_completed();
- // o is unsubscribed
- return;
- }
- state.next = static_cast<T>(state.step + state.next);
-
- // tail recurse this same action to continue loop
- self();
- };
-
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- o);
- if (selectedProducer.empty()) {
- return;
- }
-
- controller.schedule(selectedProducer.get());
- }
-};
-
-}
-
-/*! @copydoc rx-create.hpp
- */
-template<class T>
-auto range(T first = 0, T last = std::numeric_limits<T>::max(), std::ptrdiff_t step = 1)
- -> observable<T, detail::range<T, identity_one_worker>> {
- return observable<T, detail::range<T, identity_one_worker>>(
- detail::range<T, identity_one_worker>(first, last, step, identity_current_thread()));
-}
-/*! @copydoc rx-create.hpp
- */
-template<class T, class Coordination>
-auto range(T first, T last, std::ptrdiff_t step, Coordination cn)
- -> observable<T, detail::range<T, Coordination>> {
- return observable<T, detail::range<T, Coordination>>(
- detail::range<T, Coordination>(first, last, step, std::move(cn)));
-}
-/*! @copydoc rx-create.hpp
- */
-template<class T, class Coordination>
-auto range(T first, T last, Coordination cn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- observable<T, detail::range<T, Coordination>>>::type {
- return observable<T, detail::range<T, Coordination>>(
- detail::range<T, Coordination>(first, last, 1, std::move(cn)));
-}
-/*! @copydoc rx-create.hpp
- */
-template<class T, class Coordination>
-auto range(T first, Coordination cn)
- -> typename std::enable_if<is_coordination<Coordination>::value,
- observable<T, detail::range<T, Coordination>>>::type {
- return observable<T, detail::range<T, Coordination>>(
- detail::range<T, Coordination>(first, std::numeric_limits<T>::max(), 1, std::move(cn)));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-scope.hpp b/Rx/v2/src/rxcpp/sources/rx-scope.hpp
deleted file mode 100644
index d7151f2..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-scope.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_SCOPE_HPP)
-#define RXCPP_SOURCES_RX_SCOPE_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-scope.hpp
-
- \brief Returns an observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes.
-
- \tparam ResourceFactory the type of the resource factory
- \tparam ObservableFactory the type of the observable factory
-
- \param rf the resource factory function that resturn the rxcpp::resource that is used as a resource by the observable factory
- \param of the observable factory function to invoke for each observer that subscribes to the resulting observable
-
- \return observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes.
-
- \sample
- \snippet scope.cpp scope sample
- \snippet output.txt scope sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class ResourceFactory, class ObservableFactory>
-struct scope_traits
-{
- typedef rxu::decay_t<ResourceFactory> resource_factory_type;
- typedef rxu::decay_t<ObservableFactory> observable_factory_type;
- typedef decltype((*(resource_factory_type*)nullptr)()) resource_type;
- typedef decltype((*(observable_factory_type*)nullptr)(resource_type())) collection_type;
- typedef typename collection_type::value_type value_type;
-
- static_assert(is_subscription<resource_type>::value, "ResourceFactory must return a subscription");
-};
-
-template<class ResourceFactory, class ObservableFactory>
-struct scope : public source_base<rxu::value_type_t<scope_traits<ResourceFactory, ObservableFactory>>>
-{
- typedef scope_traits<ResourceFactory, ObservableFactory> traits;
- typedef typename traits::resource_factory_type resource_factory_type;
- typedef typename traits::observable_factory_type observable_factory_type;
- typedef typename traits::resource_type resource_type;
- typedef typename traits::value_type value_type;
-
- struct values
- {
- values(resource_factory_type rf, observable_factory_type of)
- : resource_factory(std::move(rf))
- , observable_factory(std::move(of))
- {
- }
- resource_factory_type resource_factory;
- observable_factory_type observable_factory;
- };
- values initial;
-
-
- scope(resource_factory_type rf, observable_factory_type of)
- : initial(std::move(rf), std::move(of))
- {
- }
-
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
-
- struct state_type
- : public std::enable_shared_from_this<state_type>
- , public values
- {
- state_type(values i, Subscriber o)
- : values(i)
- , out(std::move(o))
- {
- }
- Subscriber out;
- rxu::detail::maybe<resource_type> resource;
- };
-
- auto state = std::make_shared<state_type>(state_type(initial, std::move(o)));
-
- state->resource = on_exception(
- [&](){return state->resource_factory(); },
- state->out);
- if (state->resource.empty()) {
- return;
- }
- state->out.add(state->resource->get_subscription());
-
- auto selectedCollection = on_exception(
- [state](){return state->observable_factory(state->resource.get()); },
- state->out);
- if (selectedCollection.empty()) {
- return;
- }
-
- selectedCollection->subscribe(state->out);
- }
-};
-
-}
-
-/*! @copydoc rx-scope.hpp
- */
-template<class ResourceFactory, class ObservableFactory>
-auto scope(ResourceFactory rf, ObservableFactory of)
- -> observable<rxu::value_type_t<detail::scope_traits<ResourceFactory, ObservableFactory>>, detail::scope<ResourceFactory, ObservableFactory>> {
- return observable<rxu::value_type_t<detail::scope_traits<ResourceFactory, ObservableFactory>>, detail::scope<ResourceFactory, ObservableFactory>>(
- detail::scope<ResourceFactory, ObservableFactory>(std::move(rf), std::move(of)));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/sources/rx-timer.hpp b/Rx/v2/src/rxcpp/sources/rx-timer.hpp
deleted file mode 100644
index 2b8e270..0000000
--- a/Rx/v2/src/rxcpp/sources/rx-timer.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_SOURCES_RX_TIMER_HPP)
-#define RXCPP_SOURCES_RX_TIMER_HPP
-
-#include "../rx-includes.hpp"
-
-/*! \file rx-timer.hpp
-
- \brief Returns an observable that emits an integer at the specified time point.
-
- \tparam Coordination the type of the scheduler (optional)
-
- \param when time point when the value is emitted
- \param cn the scheduler to use for scheduling the items (optional)
-
- \return Observable that emits an integer at the specified time point
-
- \sample
- \snippet timer.cpp timepoint timer sample
- \snippet output.txt timepoint timer sample
-
- \sample
- \snippet timer.cpp duration timer sample
- \snippet output.txt duration timer sample
-
- \sample
- \snippet timer.cpp threaded timepoint timer sample
- \snippet output.txt threaded timepoint timer sample
-
- \sample
- \snippet timer.cpp threaded duration timer sample
- \snippet output.txt threaded duration timer sample
-*/
-
-namespace rxcpp {
-
-namespace sources {
-
-namespace detail {
-
-template<class Coordination>
-struct timer : public source_base<long>
-{
- typedef timer<Coordination> this_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-
- struct timer_initial_type
- {
- timer_initial_type(rxsc::scheduler::clock_type::time_point t, coordination_type cn)
- : when(t)
- , coordination(std::move(cn))
- {
- }
- rxsc::scheduler::clock_type::time_point when;
- coordination_type coordination;
- };
- timer_initial_type initial;
-
- timer(rxsc::scheduler::clock_type::time_point t, coordination_type cn)
- : initial(t, std::move(cn))
- {
- }
- timer(rxsc::scheduler::clock_type::duration p, coordination_type cn)
- : initial(rxsc::scheduler::clock_type::time_point(), std::move(cn))
- {
- initial.when = initial.coordination.now() + p;
- }
- template<class Subscriber>
- void on_subscribe(Subscriber o) const {
- static_assert(is_subscriber<Subscriber>::value, "subscribe must be passed a subscriber");
-
- // creates a worker whose lifetime is the same as this subscription
- auto coordinator = initial.coordination.create_coordinator(o.get_subscription());
- auto controller = coordinator.get_worker();
-
- auto producer = [o](const rxsc::schedulable&) {
- // send the value and complete
- o.on_next(1L);
- o.on_completed();
- };
-
- auto selectedProducer = on_exception(
- [&](){return coordinator.act(producer);},
- o);
- if (selectedProducer.empty()) {
- return;
- }
-
- controller.schedule(initial.when, selectedProducer.get());
- }
-};
-
-template<class TimePointOrDuration, class Coordination>
-struct defer_timer : public defer_observable<
- rxu::all_true<
- std::is_convertible<TimePointOrDuration, rxsc::scheduler::clock_type::time_point>::value ||
- std::is_convertible<TimePointOrDuration, rxsc::scheduler::clock_type::duration>::value,
- is_coordination<Coordination>::value>,
- void,
- timer, Coordination>
-{
-};
-
-}
-
-/*! @copydoc rx-timer.hpp
- */
-template<class TimePointOrDuration>
-auto timer(TimePointOrDuration when)
- -> typename std::enable_if<
- detail::defer_timer<TimePointOrDuration, identity_one_worker>::value,
- typename detail::defer_timer<TimePointOrDuration, identity_one_worker>::observable_type>::type {
- return detail::defer_timer<TimePointOrDuration, identity_one_worker>::make(when, identity_current_thread());
-}
-
-/*! @copydoc rx-timer.hpp
- */
-template<class TimePointOrDuration, class Coordination>
-auto timer(TimePointOrDuration when, Coordination cn)
- -> typename std::enable_if<
- detail::defer_timer<TimePointOrDuration, Coordination>::value,
- typename detail::defer_timer<TimePointOrDuration, Coordination>::observable_type>::type {
- return detail::defer_timer<TimePointOrDuration, Coordination>::make(when, std::move(cn));
-}
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp b/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp
deleted file mode 100644
index ff3becb..0000000
--- a/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_BEHAVIOR_HPP)
-#define RXCPP_RX_BEHAVIOR_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace subjects {
-
-namespace detail {
-
-template<class T>
-class behavior_observer : public detail::multicast_observer<T>
-{
- typedef behavior_observer<T> this_type;
- typedef detail::multicast_observer<T> base_type;
-
- class behavior_observer_state : public std::enable_shared_from_this<behavior_observer_state>
- {
- mutable std::mutex lock;
- mutable T value;
-
- public:
- behavior_observer_state(T first)
- : value(first)
- {
- }
-
- void reset(T v) const {
- std::unique_lock<std::mutex> guard(lock);
- value = std::move(v);
- }
- T get() const {
- std::unique_lock<std::mutex> guard(lock);
- return value;
- }
- };
-
- std::shared_ptr<behavior_observer_state> state;
-
-public:
- behavior_observer(T f, composite_subscription l)
- : base_type(l)
- , state(std::make_shared<behavior_observer_state>(std::move(f)))
- {
- }
-
- subscriber<T> get_subscriber() const {
- return make_subscriber<T>(this->get_id(), this->get_subscription(), observer<T, detail::behavior_observer<T>>(*this)).as_dynamic();
- }
-
- T get_value() const {
- return state->get();
- }
-
- template<class V>
- void on_next(V v) const {
- state->reset(v);
- base_type::on_next(std::move(v));
- }
-};
-
-}
-
-template<class T>
-class behavior
-{
- detail::behavior_observer<T> s;
-
-public:
- explicit behavior(T f, composite_subscription cs = composite_subscription())
- : s(std::move(f), cs)
- {
- }
-
- bool has_observers() const {
- return s.has_observers();
- }
-
- T get_value() const {
- return s.get_value();
- }
-
- subscriber<T> get_subscriber() const {
- return s.get_subscriber();
- }
-
- observable<T> get_observable() const {
- auto keepAlive = s;
- return make_observable_dynamic<T>([=](subscriber<T> o){
- if (keepAlive.get_subscription().is_subscribed()) {
- o.on_next(get_value());
- }
- keepAlive.add(s.get_subscriber(), std::move(o));
- });
- }
-};
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/subjects/rx-replaysubject.hpp b/Rx/v2/src/rxcpp/subjects/rx-replaysubject.hpp
deleted file mode 100644
index 020b0f8..0000000
--- a/Rx/v2/src/rxcpp/subjects/rx-replaysubject.hpp
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_REPLAYSUBJECT_HPP)
-#define RXCPP_RX_REPLAYSUBJECT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace subjects {
-
-namespace detail {
-
-template<class Coordination>
-struct replay_traits
-{
- typedef rxu::maybe<std::size_t> count_type;
- typedef rxu::maybe<rxsc::scheduler::clock_type::duration> period_type;
- typedef rxsc::scheduler::clock_type::time_point time_point_type;
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
-};
-
-template<class T, class Coordination>
-class replay_observer : public detail::multicast_observer<T>
-{
- typedef replay_observer<T, Coordination> this_type;
- typedef detail::multicast_observer<T> base_type;
-
- typedef replay_traits<Coordination> traits;
- typedef typename traits::count_type count_type;
- typedef typename traits::period_type period_type;
- typedef typename traits::time_point_type time_point_type;
- typedef typename traits::coordination_type coordination_type;
- typedef typename traits::coordinator_type coordinator_type;
-
- class replay_observer_state : public std::enable_shared_from_this<replay_observer_state>
- {
- mutable std::mutex lock;
- mutable std::list<T> values;
- mutable std::list<time_point_type> time_points;
- mutable count_type count;
- mutable period_type period;
- mutable composite_subscription replayLifetime;
- public:
- mutable coordination_type coordination;
- mutable coordinator_type coordinator;
-
- private:
- void remove_oldest() const {
- values.pop_front();
- if (!period.empty()) {
- time_points.pop_front();
- }
- }
-
- public:
- ~replay_observer_state(){
- replayLifetime.unsubscribe();
- }
- explicit replay_observer_state(count_type _count, period_type _period, coordination_type _coordination, coordinator_type _coordinator, composite_subscription _replayLifetime)
- : count(_count)
- , period(_period)
- , replayLifetime(_replayLifetime)
- , coordination(std::move(_coordination))
- , coordinator(std::move(_coordinator))
- {
- }
-
- void add(T v) const {
- std::unique_lock<std::mutex> guard(lock);
-
- if (!count.empty()) {
- if (values.size() == count.get())
- remove_oldest();
- }
-
- if (!period.empty()) {
- auto now = coordination.now();
- while (!time_points.empty() && (now - time_points.front() > period.get()))
- remove_oldest();
- time_points.push_back(now);
- }
-
- values.push_back(std::move(v));
- }
- std::list<T> get() const {
- std::unique_lock<std::mutex> guard(lock);
- return values;
- }
- };
-
- std::shared_ptr<replay_observer_state> state;
-
-public:
- replay_observer(count_type count, period_type period, coordination_type coordination, composite_subscription replayLifetime, composite_subscription subscriberLifetime)
- : base_type(subscriberLifetime)
- {
- replayLifetime.add(subscriberLifetime);
- auto coordinator = coordination.create_coordinator(replayLifetime);
- state = std::make_shared<replay_observer_state>(std::move(count), std::move(period), std::move(coordination), std::move(coordinator), std::move(replayLifetime));
- }
-
- subscriber<T> get_subscriber() const {
- return make_subscriber<T>(this->get_id(), this->get_subscription(), observer<T, detail::replay_observer<T, Coordination>>(*this)).as_dynamic();
- }
-
- std::list<T> get_values() const {
- return state->get();
- }
-
- coordinator_type& get_coordinator() const {
- return state->coordinator;
- }
-
- template<class V>
- void on_next(V v) const {
- state->add(v);
- base_type::on_next(std::move(v));
- }
-};
-
-}
-
-template<class T, class Coordination>
-class replay
-{
- typedef detail::replay_traits<Coordination> traits;
- typedef typename traits::count_type count_type;
- typedef typename traits::period_type period_type;
- typedef typename traits::time_point_type time_point_type;
-
- detail::replay_observer<T, Coordination> s;
-
-public:
- explicit replay(Coordination cn, composite_subscription cs = composite_subscription())
- : s(count_type(), period_type(), cn, cs, composite_subscription{})
- {
- }
-
- replay(std::size_t count, Coordination cn, composite_subscription cs = composite_subscription())
- : s(count_type(std::move(count)), period_type(), cn, cs, composite_subscription{})
- {
- }
-
- replay(rxsc::scheduler::clock_type::duration period, Coordination cn, composite_subscription cs = composite_subscription())
- : s(count_type(), period_type(period), cn, cs, composite_subscription{})
- {
- }
-
- replay(std::size_t count, rxsc::scheduler::clock_type::duration period, Coordination cn, composite_subscription cs = composite_subscription())
- : s(count_type(count), period_type(period), cn, cs, composite_subscription{})
- {
- }
-
- bool has_observers() const {
- return s.has_observers();
- }
-
- std::list<T> get_values() const {
- return s.get_values();
- }
-
- subscriber<T> get_subscriber() const {
- return s.get_subscriber();
- }
-
- observable<T> get_observable() const {
- auto keepAlive = s;
- auto observable = make_observable_dynamic<T>([=](subscriber<T> o){
- for (auto&& value: get_values()) {
- o.on_next(value);
- }
- keepAlive.add(keepAlive.get_subscriber(), std::move(o));
- });
- return s.get_coordinator().in(observable);
- }
-};
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp
deleted file mode 100644
index 4ce96b4..0000000
--- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp
+++ /dev/null
@@ -1,277 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SUBJECT_HPP)
-#define RXCPP_RX_SUBJECT_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace subjects {
-
-namespace detail {
-
-template<class T>
-class multicast_observer
-{
- typedef subscriber<T> observer_type;
- typedef std::vector<observer_type> list_type;
-
- struct mode
- {
- enum type {
- Invalid = 0,
- Casting,
- Disposed,
- Completed,
- Errored
- };
- };
-
- struct state_type
- : public std::enable_shared_from_this<state_type>
- {
- explicit state_type(composite_subscription cs)
- : current(mode::Casting)
- , lifetime(cs)
- {
- }
- std::mutex lock;
- typename mode::type current;
- rxu::error_ptr error;
- composite_subscription lifetime;
- };
-
- struct completer_type
- : public std::enable_shared_from_this<completer_type>
- {
- ~completer_type()
- {
- }
- completer_type(std::shared_ptr<state_type> s, const std::shared_ptr<completer_type>& old, observer_type o)
- : state(s)
- {
- retain(old);
- observers.push_back(o);
- }
- completer_type(std::shared_ptr<state_type> s, const std::shared_ptr<completer_type>& old)
- : state(s)
- {
- retain(old);
- }
- void retain(const std::shared_ptr<completer_type>& old) {
- if (old) {
- observers.reserve(old->observers.size() + 1);
- std::copy_if(
- old->observers.begin(), old->observers.end(),
- std::inserter(observers, observers.end()),
- [](const observer_type& o){
- return o.is_subscribed();
- });
- }
- }
- std::shared_ptr<state_type> state;
- list_type observers;
- };
-
- // this type prevents a circular ref between state and completer
- struct binder_type
- : public std::enable_shared_from_this<binder_type>
- {
- explicit binder_type(composite_subscription cs)
- : state(std::make_shared<state_type>(cs))
- , id(trace_id::make_next_id_subscriber())
- {
- }
-
- std::shared_ptr<state_type> state;
-
- trace_id id;
-
- // used to avoid taking lock in on_next
- mutable std::weak_ptr<completer_type> current_completer;
-
- // must only be accessed under state->lock
- mutable std::shared_ptr<completer_type> completer;
- };
-
- std::shared_ptr<binder_type> b;
-
-public:
- typedef subscriber<T, observer<T, detail::multicast_observer<T>>> input_subscriber_type;
-
- explicit multicast_observer(composite_subscription cs)
- : b(std::make_shared<binder_type>(cs))
- {
- std::weak_ptr<binder_type> binder = b;
- b->state->lifetime.add([binder](){
- auto b = binder.lock();
- if (b && b->state->current == mode::Casting){
- b->state->current = mode::Disposed;
- b->current_completer.reset();
- b->completer.reset();
- }
- });
- }
- trace_id get_id() const {
- return b->id;
- }
- composite_subscription get_subscription() const {
- return b->state->lifetime;
- }
- input_subscriber_type get_subscriber() const {
- return make_subscriber<T>(get_id(), get_subscription(), observer<T, detail::multicast_observer<T>>(*this));
- }
- bool has_observers() const {
- std::unique_lock<std::mutex> guard(b->state->lock);
- return b->completer && !b->completer->observers.empty();
- }
- template<class SubscriberFrom>
- void add(const SubscriberFrom& sf, observer_type o) const {
- trace_activity().connect(sf, o);
- std::unique_lock<std::mutex> guard(b->state->lock);
- switch (b->state->current) {
- case mode::Casting:
- {
- if (o.is_subscribed()) {
- std::weak_ptr<binder_type> binder = b;
- o.add([=](){
- auto b = binder.lock();
- if (b) {
- std::unique_lock<std::mutex> guard(b->state->lock);
- b->completer = std::make_shared<completer_type>(b->state, b->completer);
- }
- });
- b->completer = std::make_shared<completer_type>(b->state, b->completer, o);
- }
- }
- break;
- case mode::Completed:
- {
- guard.unlock();
- o.on_completed();
- return;
- }
- break;
- case mode::Errored:
- {
- auto e = b->state->error;
- guard.unlock();
- o.on_error(e);
- return;
- }
- break;
- case mode::Disposed:
- {
- guard.unlock();
- o.unsubscribe();
- return;
- }
- break;
- default:
- std::terminate();
- }
- }
- template<class V>
- void on_next(V v) const {
- auto current_completer = b->current_completer.lock();
- if (!current_completer) {
- std::unique_lock<std::mutex> guard(b->state->lock);
- b->current_completer = b->completer;
- current_completer = b->current_completer.lock();
- }
- if (!current_completer || current_completer->observers.empty()) {
- return;
- }
- for (auto& o : current_completer->observers) {
- if (o.is_subscribed()) {
- o.on_next(v);
- }
- }
- }
- void on_error(rxu::error_ptr e) const {
- std::unique_lock<std::mutex> guard(b->state->lock);
- if (b->state->current == mode::Casting) {
- b->state->error = e;
- b->state->current = mode::Errored;
- auto s = b->state->lifetime;
- auto c = std::move(b->completer);
- b->current_completer.reset();
- guard.unlock();
- if (c) {
- for (auto& o : c->observers) {
- if (o.is_subscribed()) {
- o.on_error(e);
- }
- }
- }
- s.unsubscribe();
- }
- }
- void on_completed() const {
- std::unique_lock<std::mutex> guard(b->state->lock);
- if (b->state->current == mode::Casting) {
- b->state->current = mode::Completed;
- auto s = b->state->lifetime;
- auto c = std::move(b->completer);
- b->current_completer.reset();
- guard.unlock();
- if (c) {
- for (auto& o : c->observers) {
- if (o.is_subscribed()) {
- o.on_completed();
- }
- }
- }
- s.unsubscribe();
- }
- }
-};
-
-
-}
-
-template<class T>
-class subject
-{
- detail::multicast_observer<T> s;
-
-public:
- typedef subscriber<T, observer<T, detail::multicast_observer<T>>> subscriber_type;
- typedef observable<T> observable_type;
- subject()
- : s(composite_subscription())
- {
- }
- explicit subject(composite_subscription cs)
- : s(cs)
- {
- }
-
- bool has_observers() const {
- return s.has_observers();
- }
-
- composite_subscription get_subscription() const {
- return s.get_subscription();
- }
-
- subscriber_type get_subscriber() const {
- return s.get_subscriber();
- }
-
- observable<T> get_observable() const {
- auto keepAlive = s;
- return make_observable_dynamic<T>([=](subscriber<T> o){
- keepAlive.add(keepAlive.get_subscriber(), std::move(o));
- });
- }
-};
-
-}
-
-}
-
-#endif
diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp
deleted file mode 100644
index 858eef3..0000000
--- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-#pragma once
-
-#if !defined(RXCPP_RX_SYNCHRONIZE_HPP)
-#define RXCPP_RX_SYNCHRONIZE_HPP
-
-#include "../rx-includes.hpp"
-
-namespace rxcpp {
-
-namespace subjects {
-
-namespace detail {
-
-template<class T, class Coordination>
-class synchronize_observer : public detail::multicast_observer<T>
-{
- typedef synchronize_observer<T, Coordination> this_type;
- typedef detail::multicast_observer<T> base_type;
-
- typedef rxu::decay_t<Coordination> coordination_type;
- typedef typename coordination_type::coordinator_type coordinator_type;
- typedef typename coordinator_type::template get<subscriber<T>>::type output_type;
-
- struct synchronize_observer_state : public std::enable_shared_from_this<synchronize_observer_state>
- {
- typedef rxn::notification<T> notification_type;
- typedef typename notification_type::type base_notification_type;
- typedef std::deque<base_notification_type> queue_type;
-
- struct mode
- {
- enum type {
- Invalid = 0,
- Processing,
- Empty,
- Disposed
- };
- };
-
- mutable std::mutex lock;
- mutable std::condition_variable wake;
- mutable queue_type fill_queue;
- composite_subscription lifetime;
- mutable typename mode::type current;
- coordinator_type coordinator;
- output_type destination;
-
- void ensure_processing(std::unique_lock<std::mutex>& guard) const {
- if (!guard.owns_lock()) {
- std::terminate();
- }
- if (current == mode::Empty) {
- current = mode::Processing;
- auto keepAlive = this->shared_from_this();
-
- auto drain_queue = [keepAlive, this](const rxsc::schedulable& self){
- RXCPP_TRY {
- std::unique_lock<std::mutex> guard(lock);
- if (!destination.is_subscribed()) {
- current = mode::Disposed;
- fill_queue.clear();
- guard.unlock();
- lifetime.unsubscribe();
- return;
- }
- if (fill_queue.empty()) {
- current = mode::Empty;
- return;
- }
- auto notification = std::move(fill_queue.front());
- fill_queue.pop_front();
- guard.unlock();
- notification->accept(destination);
- self();
- } RXCPP_CATCH(...) {
- destination.on_error(rxu::current_exception());
- std::unique_lock<std::mutex> guard(lock);
- current = mode::Empty;
- }
- };
-
- auto selectedDrain = on_exception(
- [&](){return coordinator.act(drain_queue);},
- destination);
- if (selectedDrain.empty()) {
- return;
- }
-
- auto processor = coordinator.get_worker();
- processor.schedule(lifetime, selectedDrain.get());
- }
- }
-
- synchronize_observer_state(coordinator_type coor, composite_subscription cs, output_type scbr)
- : lifetime(std::move(cs))
- , current(mode::Empty)
- , coordinator(std::move(coor))
- , destination(std::move(scbr))
- {
- }
-
- template<class V>
- void on_next(V v) const {
- if (lifetime.is_subscribed()) {
- std::unique_lock<std::mutex> guard(lock);
- fill_queue.push_back(notification_type::on_next(std::move(v)));
- ensure_processing(guard);
- }
- wake.notify_one();
- }
- void on_error(rxu::error_ptr e) const {
- if (lifetime.is_subscribed()) {
- std::unique_lock<std::mutex> guard(lock);
- fill_queue.push_back(notification_type::on_error(e));
- ensure_processing(guard);
- }
- wake.notify_one();
- }
- void on_completed() const {
- if (lifetime.is_subscribed()) {
- std::unique_lock<std::mutex> guard(lock);
- fill_queue.push_back(notification_type::on_completed());
- ensure_processing(guard);
- }
- wake.notify_one();
- }
- };
-
- std::shared_ptr<synchronize_observer_state> state;
-
-public:
- synchronize_observer(coordination_type cn, composite_subscription dl, composite_subscription il)
- : base_type(dl)
- {
- auto o = make_subscriber<T>(dl, make_observer_dynamic<T>( *static_cast<base_type*>(this) ));
-
- // creates a worker whose lifetime is the same as the destination subscription
- auto coordinator = cn.create_coordinator(dl);
-
- state = std::make_shared<synchronize_observer_state>(std::move(coordinator), std::move(il), std::move(o));
- }
-
- subscriber<T> get_subscriber() const {
- return make_subscriber<T>(this->get_id(), state->lifetime, observer<T, detail::synchronize_observer<T, Coordination>>(*this)).as_dynamic();
- }
-
- template<class V>
- void on_next(V v) const {
- state->on_next(std::move(v));
- }
- void on_error(rxu::error_ptr e) const {
- state->on_error(e);
- }
- void on_completed() const {
- state->on_completed();
- }
-};
-
-}
-
-template<class T, class Coordination>
-class synchronize
-{
- detail::synchronize_observer<T, Coordination> s;
-
-public:
- explicit synchronize(Coordination cn, composite_subscription cs = composite_subscription())
- : s(std::move(cn), std::move(cs), composite_subscription())
- {
- }
-
- bool has_observers() const {
- return s.has_observers();
- }
-
- subscriber<T> get_subscriber() const {
- return s.get_subscriber();
- }
-
- observable<T> get_observable() const {
- auto keepAlive = s;
- return make_observable_dynamic<T>([=](subscriber<T> o){
- keepAlive.add(keepAlive.get_subscriber(), std::move(o));
- });
- }
-};
-
-}
-
-class synchronize_in_one_worker : public coordination_base
-{
- rxsc::scheduler factory;
-
- class input_type
- {
- rxsc::worker controller;
- rxsc::scheduler factory;
- identity_one_worker coordination;
- public:
- explicit input_type(rxsc::worker w)
- : controller(w)
- , factory(rxsc::make_same_worker(w))
- , coordination(factory)
- {
- }
- inline rxsc::worker get_worker() const {
- return controller;
- }
- inline rxsc::scheduler get_scheduler() const {
- return factory;
- }
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
- template<class Observable>
- auto in(Observable o) const
- -> decltype(o.publish_synchronized(coordination).ref_count()) {
- return o.publish_synchronized(coordination).ref_count();
- }
- template<class Subscriber>
- auto out(Subscriber s) const
- -> Subscriber {
- return s;
- }
- template<class F>
- auto act(F f) const
- -> F {
- return f;
- }
- };
-
-public:
-
- explicit synchronize_in_one_worker(rxsc::scheduler sc) : factory(sc) {}
-
- typedef coordinator<input_type> coordinator_type;
-
- inline rxsc::scheduler::clock_type::time_point now() const {
- return factory.now();
- }
-
- inline coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const {
- auto w = factory.create_worker(std::move(cs));
- return coordinator_type(input_type(std::move(w)));
- }
-};
-
-inline synchronize_in_one_worker synchronize_event_loop() {
- static synchronize_in_one_worker r(rxsc::make_event_loop());
- return r;
-}
-
-inline synchronize_in_one_worker synchronize_new_thread() {
- static synchronize_in_one_worker r(rxsc::make_new_thread());
- return r;
-}
-
-}
-
-#endif
diff --git a/Rx/v2/test/CMakeLists.txt b/Rx/v2/test/CMakeLists.txt
deleted file mode 100644
index c2d1530..0000000
--- a/Rx/v2/test/CMakeLists.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-project(rxcpp_test LANGUAGES C CXX)
-
-# define some folders
-
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-include(${RXCPP_DIR}/projects/CMake/shared.cmake)
-
-# configure unit tests via CTest
-enable_testing()
-
-set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test)
-
-# define the sources of the self test
-set(TEST_SOURCES
- ${TEST_DIR}/subscriptions/coroutine.cpp
- ${TEST_DIR}/subscriptions/observer.cpp
- ${TEST_DIR}/subscriptions/subscription.cpp
- ${TEST_DIR}/subjects/subject.cpp
- ${TEST_DIR}/sources/create.cpp
- ${TEST_DIR}/sources/defer.cpp
- ${TEST_DIR}/sources/empty.cpp
- ${TEST_DIR}/sources/interval.cpp
- ${TEST_DIR}/sources/scope.cpp
- ${TEST_DIR}/sources/timer.cpp
- ${TEST_DIR}/operators/all.cpp
- ${TEST_DIR}/operators/any.cpp
- ${TEST_DIR}/operators/amb.cpp
- ${TEST_DIR}/operators/amb_variadic.cpp
- ${TEST_DIR}/operators/buffer.cpp
- ${TEST_DIR}/operators/combine_latest.cpp
- ${TEST_DIR}/operators/concat.cpp
- ${TEST_DIR}/operators/concat_map.cpp
- ${TEST_DIR}/operators/contains.cpp
- ${TEST_DIR}/operators/debounce.cpp
- ${TEST_DIR}/operators/default_if_empty.cpp
- ${TEST_DIR}/operators/delay.cpp
- ${TEST_DIR}/operators/distinct.cpp
- ${TEST_DIR}/operators/distinct_until_changed.cpp
- ${TEST_DIR}/operators/element_at.cpp
- ${TEST_DIR}/operators/exists.cpp
- ${TEST_DIR}/operators/filter.cpp
- ${TEST_DIR}/operators/finally.cpp
- ${TEST_DIR}/operators/flat_map.cpp
- ${TEST_DIR}/operators/group_by.cpp
- ${TEST_DIR}/operators/ignore_elements.cpp
- ${TEST_DIR}/operators/is_empty.cpp
- ${TEST_DIR}/operators/lift.cpp
- ${TEST_DIR}/operators/map.cpp
- ${TEST_DIR}/operators/merge.cpp
- ${TEST_DIR}/operators/merge_delay_error.cpp
- ${TEST_DIR}/operators/observe_on.cpp
- ${TEST_DIR}/operators/on_error_resume_next.cpp
- ${TEST_DIR}/operators/pairwise.cpp
- ${TEST_DIR}/operators/publish.cpp
- ${TEST_DIR}/operators/reduce.cpp
- ${TEST_DIR}/operators/repeat.cpp
- ${TEST_DIR}/operators/replay.cpp
- ${TEST_DIR}/operators/retry.cpp
- ${TEST_DIR}/operators/sample.cpp
- ${TEST_DIR}/operators/scan.cpp
- ${TEST_DIR}/operators/sequence_equal.cpp
- ${TEST_DIR}/operators/skip.cpp
- ${TEST_DIR}/operators/skip_while.cpp
- ${TEST_DIR}/operators/skip_last.cpp
- ${TEST_DIR}/operators/skip_until.cpp
- ${TEST_DIR}/operators/start_with.cpp
- ${TEST_DIR}/operators/subscribe_on.cpp
- ${TEST_DIR}/operators/switch_if_empty.cpp
- ${TEST_DIR}/operators/switch_on_next.cpp
- ${TEST_DIR}/operators/take.cpp
- ${TEST_DIR}/operators/take_last.cpp
- ${TEST_DIR}/operators/take_until.cpp
- ${TEST_DIR}/operators/take_while.cpp
- ${TEST_DIR}/operators/tap.cpp
- ${TEST_DIR}/operators/time_interval.cpp
- ${TEST_DIR}/operators/timeout.cpp
- ${TEST_DIR}/operators/timestamp.cpp
- ${TEST_DIR}/operators/with_latest_from.cpp
- ${TEST_DIR}/operators/window.cpp
- ${TEST_DIR}/operators/window_toggle.cpp
- ${TEST_DIR}/operators/zip.cpp
-)
-
-set(TEST_COMPILE_DEFINITIONS "")
-set(TEST_COMMAND_ARGUMENTS "")
-
-if (NOT RX_USE_EXCEPTIONS)
- MESSAGE( STATUS "no exceptions" )
- list(APPEND TEST_COMPILE_DEFINITIONS CATCH_CONFIG_DISABLE_EXCEPTIONS)
- list(APPEND TEST_COMMAND_ARGUMENTS -e)
-endif()
-
-
-add_executable(rxcppv2_test ${TEST_DIR}/test.cpp ${TEST_SOURCES})
-add_executable(rxcpp::tests ALIAS rxcppv2_test)
-set_target_properties(
- rxcppv2_test PROPERTIES
- EXCLUDE_FROM_DEFAULT_BUILD TRUE
- EXCLUDE_FROM_ALL TRUE
-)
-target_compile_options(rxcppv2_test PUBLIC ${RX_COMPILE_OPTIONS})
-target_compile_features(rxcppv2_test PUBLIC ${RX_COMPILE_FEATURES})
-target_compile_definitions(rxcppv2_test PUBLIC ${TEST_COMPILE_DEFINITIONS})
-target_include_directories(rxcppv2_test
- PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
- )
-target_link_libraries(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT})
-
-
-foreach(ONE_TEST_SOURCE ${TEST_SOURCES})
- get_filename_component(ONE_TEST_NAME "${ONE_TEST_SOURCE}" NAME)
- string( REPLACE ".cpp" "" ONE_TEST_NAME ${ONE_TEST_NAME})
- set(ONE_TEST_FULL_NAME "rxcpp_test_${ONE_TEST_NAME}")
- add_executable( ${ONE_TEST_FULL_NAME} ${ONE_TEST_SOURCE} )
- add_executable( rxcpp::${ONE_TEST_NAME} ALIAS ${ONE_TEST_FULL_NAME})
- target_compile_definitions(${ONE_TEST_FULL_NAME} PUBLIC "CATCH_CONFIG_MAIN" ${TEST_COMPILE_DEFINITIONS})
- target_compile_options(${ONE_TEST_FULL_NAME} PUBLIC ${RX_COMPILE_OPTIONS})
- target_compile_features(${ONE_TEST_FULL_NAME} PUBLIC ${RX_COMPILE_FEATURES})
- target_include_directories(${ONE_TEST_FULL_NAME}
- PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
- )
- target_link_libraries(${ONE_TEST_FULL_NAME} ${CMAKE_THREAD_LIBS_INIT})
-
- add_test(NAME ${ONE_TEST_NAME} COMMAND ${ONE_TEST_FULL_NAME} ${TEST_COMMAND_ARGUMENTS})
-endforeach(ONE_TEST_SOURCE ${TEST_SOURCES})
-
-
-
diff --git a/Rx/v2/test/operators/all.cpp b/Rx/v2/test/operators/all.cpp
deleted file mode 100644
index 75dee75..0000000
--- a/Rx/v2/test/operators/all.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-all.hpp>
-
-SCENARIO("all emits true if every item emitted by the source observable evaluated as true", "[all][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_all;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 2),
- on.completed(250)
- });
-
- WHEN("a predicate function is passed to the all operator") {
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::all([](int n) { return n == 2; })
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true") {
- auto required = rxu::to_vector({
- on_all.next(250, true),
- on_all.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("all emits false if any item emitted by the source observable evaluated as false", "[all][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_all;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.completed(250)
- });
-
- WHEN("a predicate function is passed to the all operator") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .all([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
-
- }
- );
-
- THEN("the output only contains false") {
- auto required = rxu::to_vector({
- on_all.next(220, false),
- on_all.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("all emits true if the source observable is empty", "[all][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_all;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("a predicate function is passed to the all operator") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .all([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true") {
- auto required = rxu::to_vector({
- on_all.next(250, true),
- on_all.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("all never emits if the source observable never emits any items", "[all][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_all;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("a predicate function is passed to the all operator") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .all([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty") {
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("all emits an error if the source observable emit an error", "[all][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_all;
-
- std::runtime_error ex("all on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("a predicate function is passed to the all operator") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .all([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains an error") {
- auto required = rxu::to_vector({
- on_all.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/amb.cpp b/Rx/v2/test/operators/amb.cpp
deleted file mode 100644
index 9d6297c..0000000
--- a/Rx/v2/test/operators/amb.cpp
+++ /dev/null
@@ -1,953 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-amb.hpp"
-
-SCENARIO("amb never 3", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2)
- });
-
- auto ys3 = sc.make_hot_observable({
- on.next(120, 3)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(200)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 1000)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 1000)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 1000)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb never empty", "[amb][join][operators]"){
- GIVEN("1 cold observable with 2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2),
- on.completed(400)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.completed(150)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb completes", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(100)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(410, 102),
- on.next(510, 103),
- on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 610)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb winner throws", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.error(310, ex)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(100)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(410, 102),
- on.next(510, 103),
- on.error(610, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 610)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb loser throws", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.error(20, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(100)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(410, 102),
- on.next(510, 103),
- on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 610)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb throws before selection", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(110, 1),
- on.completed(200)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.error(50, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(130, 3),
- on.completed(300)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(100)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(350, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb throws before selection and emission end", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(110, 1),
- on.completed(200)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.error(50, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(130, 3),
- on.completed(300)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.completed(500)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(350, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 350)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb loser comes when winner has already emitted", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(200, ys3),
- o_on.completed(200)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(410, 102),
- on.next(510, 103),
- on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 610)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were no subscriptions to the ys3"){
- auto required = std::vector<rxn::subscription>();
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb empty list", "[amb][join][operators]"){
- GIVEN("1 empty cold observable of observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_cold_observable({
- o_on.completed(200)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only comlpete message"){
- auto required = rxu::to_vector({
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb source throws before selection", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.error(100, ex)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(300, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 300)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 300)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 300)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb source throws after selection", "[amb][join][operators]"){
- GIVEN("1 cold observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.next(100, ys3),
- o_on.error(300, ex)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(410, 102),
- on.error(500, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 500)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 500)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(300, 310)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("amb never empty, custom coordination", "[amb][join][operators]"){
- GIVEN("1 cold observable with 2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2),
- on.completed(400)
- });
-
- auto xs = sc.make_cold_observable({
- o_on.next(100, ys1),
- o_on.next(100, ys2),
- o_on.completed(150)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .amb(so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(401)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/amb_variadic.cpp b/Rx/v2/test/operators/amb_variadic.cpp
deleted file mode 100644
index a188758..0000000
--- a/Rx/v2/test/operators/amb_variadic.cpp
+++ /dev/null
@@ -1,590 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-amb.hpp"
-
-SCENARIO("variadic amb never 3", "[amb][join][operators]"){
- GIVEN("3 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2)
- });
-
- auto ys3 = sc.make_hot_observable({
- on.next(120, 3)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- | rxo::amb(ys2, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb never empty", "[amb][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2),
- on.completed(400)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(ys2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb empty never", "[amb][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1),
- on.completed(400)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(ys2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb completes", "[amb][join][operators]"){
- GIVEN("3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(ys2, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(310, 102),
- on.next(410, 103),
- on.completed(510)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 510)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb winner&owner throws", "[amb][join][operators]"){
- GIVEN("3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.error(310, ex)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(ys2, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(310, 102),
- on.next(410, 103),
- on.error(510, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 510)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb winner&non-owner throws", "[amb][join][operators]"){
- GIVEN("3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.error(310, ex)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(20, 201),
- on.next(120, 202),
- on.next(220, 203),
- on.completed(320)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys2
- .amb(ys1, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(310, 102),
- on.next(410, 103),
- on.error(510, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 510)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb loser&non-owner throws", "[amb][join][operators]"){
- GIVEN("3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.error(20, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys2
- .amb(ys1, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(310, 102),
- on.next(410, 103),
- on.completed(510)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 510)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb loser&owner throws", "[amb][join][operators]"){
- GIVEN("3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("amb on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(110, 102),
- on.next(210, 103),
- on.completed(310)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.error(20, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(30, 301),
- on.next(130, 302),
- on.next(230, 303),
- on.completed(330)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(ys2, ys3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints from the first observable"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(310, 102),
- on.next(410, 103),
- on.completed(510)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 510)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic amb never empty, custom coordination", "[amb][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys1 = sc.make_hot_observable({
- on.next(100, 1)
- });
-
- auto ys2 = sc.make_hot_observable({
- on.next(110, 2),
- on.completed(400)
- });
-
- WHEN("the first observable is selected to produce ints"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .amb(so, ys2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(401)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/any.cpp b/Rx/v2/test/operators/any.cpp
deleted file mode 100644
index 01aa02a..0000000
--- a/Rx/v2/test/operators/any.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-any.hpp>
-
-SCENARIO("any emits true if an item satisfies the given condition", "[any][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_any;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::any([](int n) { return n == 2; })
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_any.next(210, true),
- on_any.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("any emits false if no item satisfies the given condition", "[any][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_any;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .any([](int n) { return n > 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
-
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_any.next(250, false),
- on_any.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("any emits false if the source observable is empty", "[any][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_any;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .any([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_any.next(250, false),
- on_any.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-SCENARIO("any never emits if the source observable never emits any items", "[any][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_any;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .any([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("any emits an error", "[any][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_any;
-
- std::runtime_error ex("any on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .any([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on_any.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp
deleted file mode 100644
index e1b980c..0000000
--- a/Rx/v2/test/operators/buffer.cpp
+++ /dev/null
@@ -1,1231 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-concat.hpp>
-#include <rxcpp/operators/rx-buffer_count.hpp>
-#include <rxcpp/operators/rx-buffer_time.hpp>
-#include <rxcpp/operators/rx-buffer_time_count.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-
-SCENARIO("buffer count partial window", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("group each int with the next 4 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::buffer(5)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(250, rxu::to_vector({ 2, 3, 4, 5 })),
- v_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count full windows", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("group each int with the next int"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(220, rxu::to_vector({ 2, 3 })),
- v_on.next(240, rxu::to_vector({ 4, 5 })),
- v_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count full and partial windows", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("group each int with the next 2 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(230, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(250, rxu::to_vector({ 5 })),
- v_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count error", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- std::runtime_error ex("buffer on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.error(250, ex)
- });
-
- WHEN("group each int with the next 4 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(5)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count skip less", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("group each int with the next 2 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(3, 1)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(230, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(240, rxu::to_vector({ 3, 4, 5 })),
- v_on.next(250, rxu::to_vector({ 4, 5 })),
- v_on.next(250, rxu::to_vector({ 5 })),
- v_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count skip more", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("group each int with the next int skipping the third one"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(2, 3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(220, rxu::to_vector({ 2, 3 })),
- v_on.next(250, rxu::to_vector({ 5 })),
- v_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count basic", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(3, 2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(280, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(350, rxu::to_vector({ 4, 5, 6 })),
- v_on.next(420, rxu::to_vector({ 6, 7, 8 })),
- v_on.next(600, rxu::to_vector({ 8, 9 })),
- v_on.completed(600)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count disposed", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(3, 2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 370
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(280, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(350, rxu::to_vector({ 4, 5, 6 })),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 370)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer count error 2", "[buffer][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- std::runtime_error ex("buffer on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
-
- WHEN("group each int with the next 2 ints"){
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer(3, 2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(280, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(350, rxu::to_vector({ 4, 5, 6 })),
- v_on.next(420, rxu::to_vector({ 6, 7, 8 })),
- v_on.error(600, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time on intervals", "[buffer_with_time][operators][long][!hide]"){
- GIVEN("7 intervals of 2 seconds"){
- WHEN("the period is 2sec and the initial is 5sec"){
- // time: |-----------------|
- // events: 1 2 3 4 5 6 7
- // buffers: ---
- // -1-
- // 2-3
- // -4-
- // 5-6
- // -7
- using namespace std::chrono;
-
- #define TIME milliseconds
- #define UNIT *15
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + TIME(5 UNIT);
- auto period = TIME(2 UNIT);
-
- auto bufSource = rxs::interval(start, period, so)
- | rxo::take(7)
- | rxo::buffer_with_time(TIME(3 UNIT), so);
-
- bufSource
- .subscribe(
- [](std::vector<long> counter){
- printf("on_next: ");
- std::for_each(counter.begin(), counter.end(), [](long c){
- printf("%ld ", c);
- });
- printf("\n");
- },
- [](rxu::error_ptr){
- printf("on_error\n");
- },
- [](){
- printf("on_completed\n");
- }
- );
- }
- }
-}
-
-SCENARIO("buffer with time on intervals, implicit coordination", "[buffer_with_time][operators][long][!hide]"){
- GIVEN("7 intervals of 2 seconds"){
- WHEN("the period is 2sec and the initial is 5sec"){
- // time: |-----------------|
- // events: 1 2 3 4 5 6 7
- // buffers: ---
- // -1-
- // 2-3
- // -4-
- // 5-6
- // -7
- using namespace std::chrono;
-
- #define TIME milliseconds
- #define UNIT *15
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + TIME(5 UNIT);
- auto period = TIME(2 UNIT);
-
- rx::observable<>::interval(start, period, so)
- .take(7)
- .buffer_with_time(TIME(3 UNIT))
- .subscribe(
- [](std::vector<long> counter){
- printf("on_next: ");
- std::for_each(counter.begin(), counter.end(), [](long c){
- printf("%ld ", c);
- });
- printf("\n");
- },
- [](rxu::error_ptr){
- printf("on_error\n");
- },
- [](){
- printf("on_completed\n");
- }
- );
- }
- }
-}
-
-SCENARIO("buffer with time on overlapping intervals", "[buffer_with_time][operators][long][!hide]"){
- GIVEN("5 intervals of 2 seconds"){
- WHEN("the period is 2sec and the initial is 5sec"){
- // time: |-------------|
- // events: 1 2 3 4 5
- // buffers: ----
- // --1-
- // 1-2-
- // 2-3-
- // 3-4-
- // 4-5
- // 5
- using namespace std::chrono;
-
- #define TIME milliseconds
- #define UNIT *15
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + TIME(5 UNIT);
- auto period = TIME(2 UNIT);
-
- rx::observable<>::interval(start, period, so)
- .take(5)
- .buffer_with_time(TIME(4 UNIT), TIME(2 UNIT), so)
- .subscribe(
- [](std::vector<long> counter){
- printf("on_next: ");
- std::for_each(counter.begin(), counter.end(), [](long c){
- printf("%ld ", c);
- });
- printf("\n");
- },
- [](rxu::error_ptr){
- printf("on_error\n");
- },
- [](){
- printf("on_completed\n");
- }
- );
- }
- }
-}
-
-SCENARIO("buffer with time on overlapping intervals, implicit coordination", "[buffer_with_time][operators][long][!hide]"){
- GIVEN("5 intervals of 2 seconds"){
- WHEN("the period is 2sec and the initial is 5sec"){
- // time: |-------------|
- // events: 1 2 3 4 5
- // buffers: ----
- // --1-
- // 1-2-
- // 2-3-
- // 3-4-
- // 4-5
- // 5
- using namespace std::chrono;
-
- #define TIME milliseconds
- #define UNIT *15
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + TIME(5 UNIT);
- auto period = TIME(2 UNIT);
-
- rx::observable<>::interval(start, period, so)
- .take(5)
- .buffer_with_time(TIME(4 UNIT), TIME(2 UNIT))
- .subscribe(
- [](std::vector<long> counter){
- printf("on_next: ");
- std::for_each(counter.begin(), counter.end(), [](long c){
- printf("%ld ", c);
- });
- printf("\n");
- },
- [](rxu::error_ptr){
- printf("on_error\n");
- },
- [](){
- printf("on_completed\n");
- }
- );
- }
- }
-}
-
-SCENARIO("buffer with time on intervals, error", "[buffer_with_time][operators][long][!hide]"){
- GIVEN("5 intervals of 2 seconds"){
- WHEN("the period is 2sec and the initial is 5sec"){
- // time: |-------------|
- // events: 1 2 3 4 5
- // buffers: ----
- // --1-
- // 1-2-
- // 2-3-
- // 3-4-
- // 4-5
- // 5
- using namespace std::chrono;
-
- #define TIME milliseconds
- #define UNIT *15
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + TIME(5 UNIT);
- auto period = TIME(2 UNIT);
-
- std::runtime_error ex("buffer_with_time on_error from source");
-
- auto ys1 = rx::observable<>::interval(start, period, so).take(5);
- auto ys2 = rx::observable<>::error<long, std::runtime_error>(std::runtime_error("buffer_with_time on_error from source"), so);
- ys1.concat(so, ys2)
- .buffer_with_time(TIME(4 UNIT), TIME(2 UNIT), so)
- .subscribe(
- [](std::vector<long> counter){
- printf("on_next: ");
- std::for_each(counter.begin(), counter.end(), [](long c){
- printf("%ld ", c);
- });
- printf("\n");
- },
- [](rxu::error_ptr){
- printf("on_error\n");
- },
- [](){
- printf("on_completed\n");
- }
- );
- }
- }
-}
-
-SCENARIO("buffer with time, overlapping intervals", "[buffer_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intersecting intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time(milliseconds(100), milliseconds(70), so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(301, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(371, rxu::to_vector({ 4, 5, 6 })),
- v_on.next(441, rxu::to_vector({ 6, 7, 8 })),
- v_on.next(511, rxu::to_vector({ 8, 9 })),
- v_on.next(581, std::vector<int>()),
- v_on.next(601, std::vector<int>()),
- v_on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time, intervals with skips", "[buffer_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intervals with skips"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time(milliseconds(70), milliseconds(100), so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(271, rxu::to_vector({ 2, 3 })),
- v_on.next(371, rxu::to_vector({ 5, 6 })),
- v_on.next(471, rxu::to_vector({ 8, 9 })),
- v_on.next(571, std::vector<int>()),
- v_on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time, error", "[buffer_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- std::runtime_error ex("buffer_with_time on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
- WHEN("group ints on intersecting intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time(milliseconds(100), milliseconds(70), so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(301, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(371, rxu::to_vector({ 4, 5, 6 })),
- v_on.next(441, rxu::to_vector({ 6, 7, 8 })),
- v_on.next(511, rxu::to_vector({ 8, 9 })),
- v_on.next(581, std::vector<int>()),
- v_on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time, disposed", "[buffer_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intersecting intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time(milliseconds(100), milliseconds(70), so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 370
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(301, rxu::to_vector({ 2, 3, 4 })),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 371)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time, same", "[buffer_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time(milliseconds(100), so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(301, rxu::to_vector({ 2, 3, 4 })),
- v_on.next(401, rxu::to_vector({ 5, 6, 7 })),
- v_on.next(501, rxu::to_vector({ 8, 9 })),
- v_on.next(601, std::vector<int>()),
- v_on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time or count, basic", "[buffer_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::buffer_with_time_or_count(milliseconds(70), 3, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(241, rxu::to_vector({ 1, 2, 3 })),
- v_on.next(312, rxu::to_vector({ 4 })),
- v_on.next(371, rxu::to_vector({ 5, 6, 7 })),
- v_on.next(442, rxu::to_vector({ 8 })),
- v_on.next(512, rxu::to_vector({ 9 })),
- v_on.next(582, std::vector<int>()),
- v_on.next(601, std::vector<int>()),
- v_on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time or count, error", "[buffer_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- std::runtime_error ex("buffer_with_time on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time_or_count(milliseconds(70), 3, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(241, rxu::to_vector({ 1, 2, 3 })),
- v_on.next(312, rxu::to_vector({ 4 })),
- v_on.next(371, rxu::to_vector({ 5, 6, 7 })),
- v_on.next(442, rxu::to_vector({ 8 })),
- v_on.next(512, rxu::to_vector({ 9 })),
- v_on.next(582, std::vector<int>()),
- v_on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time or count, dispose", "[buffer_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time_or_count(milliseconds(70), 3, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 372
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(241, rxu::to_vector({ 1, 2, 3 })),
- v_on.next(312, rxu::to_vector({ 4 })),
- v_on.next(371, rxu::to_vector({ 5, 6, 7 })),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 373)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time or count, only time triggered", "[buffer_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(305, 2),
- on.next(505, 3),
- on.next(605, 4),
- on.next(610, 5),
- on.completed(850)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time_or_count(milliseconds(100), 3, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(301, rxu::to_vector({ 1 })),
- v_on.next(401, rxu::to_vector({ 2 })),
- v_on.next(501, std::vector<int>()),
- v_on.next(601, rxu::to_vector({ 3 })),
- v_on.next(701, rxu::to_vector({ 4, 5 })),
- v_on.next(801, std::vector<int>()),
- v_on.next(851, std::vector<int>()),
- v_on.completed(851)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 850)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("buffer with time or count, only count triggered", "[buffer_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(305, 2),
- on.next(505, 3),
- on.next(605, 4),
- on.next(610, 5),
- on.completed(850)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .buffer_with_time_or_count(milliseconds(370), 2, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- v_on.next(306, rxu::to_vector({ 1, 2 })),
- v_on.next(606, rxu::to_vector({ 3, 4 })),
- v_on.next(851, rxu::to_vector({ 5 })),
- v_on.completed(851)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 850)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.cpp
deleted file mode 100644
index 198fb2f..0000000
--- a/Rx/v2/test/operators/combine_latest.cpp
+++ /dev/null
@@ -1,1666 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-combine_latest.hpp"
-
-SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.next(230, 5),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.next(225, 4 + 3),
- on.next(230, 4 + 5),
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive ends with error left", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.error(230, ex)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest consecutive ends with error right", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(250)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.error(245, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints followed by an error"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.error(245, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest never N", "[combine_latest][join][operators]"){
- GIVEN("N never completed hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> n;
- for (int i = 0; i < N; ++i) {
- n.push_back(
- sc.make_hot_observable({
- on.next(150, 1)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n[0]
- .combine_latest(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- n[1], n[2], n[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){
- GIVEN("N empty hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210 + 10 * i)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .combine_latest(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- e[1], e[2], e[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(200 + 10 * N)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- int i = 0;
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * ++i)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("combine_latest never/empty", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty/never", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest return/empty", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest never/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest return/never", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-
-SCENARIO("combine_latest return/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest empty/error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return emp
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error/empty", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- emp
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest return/error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error/return", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error/error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("combine_latest on_error from source 1");
- std::runtime_error ex2("combine_latest on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest next+error/error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("combine_latest on_error from source 1");
- std::runtime_error ex2("combine_latest on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error/next+error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("combine_latest on_error from source 1");
- std::runtime_error ex2("combine_latest on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex2)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest never/error", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error/never", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error after completed left", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return ret
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest error after completed right", "[combine_latest][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .combine_latest(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest selector throws", "[combine_latest][join][operators][!throws]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .combine_latest(
- // Note for trying to handle this test case when exceptions are disabled
- // with RXCPP_USE_EXCEPTIONS == 0:
- //
- // It seems that this test is in particular testing that the
- // combine_latest selector (aggregate function) thrown exceptions
- // are being translated into an on_error.
- //
- // Since there appears to be no way to give combine_latest
- // an Observable that would call on_error directly (as opposed
- // to a regular function that's converted into an observable),
- // this test is meaningless when exceptions are disabled
- // since any selectors with 'throw' will not even compile.
- //
- // Attempting to change this to e.g.
- // o1.combineLatest(o2).map ... unconditional onError
- // would defeat the purpose of the test since its the combineLatest
- // implementation that's supposed to be doing the error forwarding.
- [&ex](int, int) -> int {
- rxu::throw_exception(ex);
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators][!throws]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::runtime_error ex("combine_latest on_error from source");
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(210 + 10 * i, 1),
- on.completed(500)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .combine_latest(
- [&ex](int, int, int, int) -> int {
- rxu::throw_exception(ex);
- },
- e[1], e[2], e[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(200 + 10 * N, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * N)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("combine_latest typical N", "[combine_latest][join][operators]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> o;
- for (int i = 0; i < N; ++i) {
- o.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.next(210 + 10 * i, i + 1),
- on.next(410 + 10 * i, i + N + 1),
- on.completed(800)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o[0]
- .combine_latest(
- [](int v0, int v1, int v2, int v3) {
- return v0 + v1 + v2 + v3;
- },
- o[1], o[2], o[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(200 + 10 * N, N * (N + 1) / 2)
- });
- for (int i = 0; i < N; ++i) {
- required.push_back(on.next(410 + 10 * i, N * (N + 1) / 2 + N + N * i));
- }
- required.push_back(on.completed(800));
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(o.begin(), o.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 800)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp
deleted file mode 100644
index 88dcac7..0000000
--- a/Rx/v2/test/operators/concat.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-concat.hpp>
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-const int static_onnextcalls = 1000000;
-
-SCENARIO("synchronize concat ranges", "[!hide][range][synchronize][concat][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::synchronize_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- auto c = rxs::range(0, sectionCount - 1, 1, so)
- .concat(
- so,
- rxs::range(sectionCount, sectionCount * 2 - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat sync ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-SCENARIO("observe_on concat ranges", "[!hide][range][observe_on][concat][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::observe_on_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- int c = rxs::range(0, sectionCount - 1, 1, so)
- .concat(
- so,
- rxs::range(sectionCount, sectionCount * 2 - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat observe_on ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-SCENARIO("serialize concat ranges", "[!hide][range][serialize][concat][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::serialize_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- int c = rxs::range(0, sectionCount - 1, 1, so)
- .concat(
- so,
- rxs::range(sectionCount, sectionCount * 2 - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat serial ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-
-SCENARIO("concat completes", "[concat][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.next(500, ys3),
- o_on.completed(600)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::concat()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 103),
- on.next(420, 104),
- on.next(510, 105),
- on.next(520, 106),
- on.next(540, 201),
- on.next(550, 202),
- on.next(560, 203),
- on.next(570, 204),
- on.next(590, 301),
- on.next(600, 302),
- on.next(610, 303),
- on.next(620, 304),
- on.next(700, 305),
- on.completed(730)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 530)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(530, 580)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(580, 730)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp
deleted file mode 100644
index cfd6f4f..0000000
--- a/Rx/v2/test/operators/concat_map.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-filter.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-#include <rxcpp/operators/rx-concat_map.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-static const int static_tripletCount = 100;
-
-SCENARIO("concat_transform pythagorian ranges", "[!hide][range][concat_transform][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto sc = rxsc::make_immediate();
- //auto sc = rxsc::make_current_thread();
- auto so = rx::identity_one_worker(sc);
-
- int c = 0;
- int ct = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .concat_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .concat_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;});
- triples
- .take(tripletCount)
- .subscribe(
- rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){++ct;}),
- [](rxu::error_ptr){abort();});
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-SCENARIO("synchronize concat_transform pythagorian ranges", "[!hide][range][concat_transform][synchronize][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::synchronize_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .concat_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .concat_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("observe_on concat_transform pythagorian ranges", "[!hide][range][concat_transform][observe_on][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::observe_on_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .concat_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .concat_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
-
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat observe_on pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("serialize concat_transform pythagorian ranges", "[!hide][range][concat_transform][serialize][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::serialize_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .concat_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .concat_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
-
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "concat serial pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("concat_map completes", "[concat_map][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::concat_map(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(500, "qux"),
- s_on.next(600, "foo"),
- s_on.next(650, "bar"),
- s_on.next(700, "baz"),
- s_on.next(750, "qux"),
- s_on.completed(800)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(550, 800)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("concat_transform completes", "[concat_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::concat_transform(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(500, "qux"),
- s_on.next(600, "foo"),
- s_on.next(650, "bar"),
- s_on.next(700, "baz"),
- s_on.next(750, "qux"),
- s_on.completed(800)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(550, 800)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
-
- WHEN("each int is mapped to the strings with coordinator"){
-
- auto res = w.start(
- [&]() {
- return xs
- .concat_transform(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;},
- rx::identity_current_thread())
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(500, "qux"),
- s_on.next(600, "foo"),
- s_on.next(650, "bar"),
- s_on.next(700, "baz"),
- s_on.next(750, "qux"),
- s_on.completed(800)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(550, 800)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("concat_transform, no result selector, no coordination", "[concat_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .concat_transform(
- [&](int){
- return ys;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(500, "qux"),
- s_on.next(600, "foo"),
- s_on.next(650, "bar"),
- s_on.next(700, "baz"),
- s_on.next(750, "qux"),
- s_on.completed(800)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(550, 800)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("concat_transform, no result selector, with coordination", "[concat_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .concat_transform(
- [&](int){
- return ys;},
- rx::identity_current_thread())
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(500, "qux"),
- s_on.next(600, "foo"),
- s_on.next(650, "bar"),
- s_on.next(700, "baz"),
- s_on.next(750, "qux"),
- s_on.completed(800)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(550, 800)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/contains.cpp b/Rx/v2/test/operators/contains.cpp
deleted file mode 100644
index d96a49b..0000000
--- a/Rx/v2/test/operators/contains.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-any.hpp>
-
-SCENARIO("contains emits true if an item satisfies the given condition", "[contains][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_contains;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::contains(2)
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_contains.next(210, true),
- on_contains.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("contains emits false if no item satisfies the given condition", "[contains][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_contains;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .contains(20)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_contains.next(250, false),
- on_contains.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("contains emits false if the source observable is empty", "[contains][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_contains;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .contains(2)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_contains.next(250, false),
- on_contains.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-SCENARIO("contains never emits if the source observable never emits any items", "[contains][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_contains;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .contains(2)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("contains emits an error", "[contains][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_contains;
-
- std::runtime_error ex("contains on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .contains(2)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on_contains.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/debounce.cpp b/Rx/v2/test/operators/debounce.cpp
deleted file mode 100644
index 1a33719..0000000
--- a/Rx/v2/test/operators/debounce.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-debounce.hpp>
-
-using namespace std::chrono;
-
-SCENARIO("debounce - never", "[debounce][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("values are debounceed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs | rxo::debounce(so, milliseconds(10));
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1001)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("debounce - empty", "[debounce][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("values are debounceed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.debounce(milliseconds(10), so);
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(251)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("debounce - no overlap", "[debounce][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("values are debounceed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.debounce(milliseconds(10), so);
- }
- );
-
- THEN("the output only contains debounced items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(221, 2),
- on.next(251, 3),
- on.completed(301)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("debounce - overlap", "[debounce][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 3),
- on.next(235, 4),
- on.next(245, 5),
- on.next(255, 6),
- on.next(265, 7),
- on.completed(300)
- });
-
- WHEN("values are debounceed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.debounce(milliseconds(30), so);
- }
- );
-
- THEN("the output only contains debounced items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(296, 7),
- on.completed(301)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("debounce - throw", "[debounce][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("debounce on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("values are debounceed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.debounce(milliseconds(10), so);
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on.error(251, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/default_if_empty.cpp b/Rx/v2/test/operators/default_if_empty.cpp
deleted file mode 100644
index 3acd73a..0000000
--- a/Rx/v2/test/operators/default_if_empty.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-switch_if_empty.hpp>
-
-SCENARIO("default_if_empty should not switch if the source is not empty", "[default_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(210, 1),
- on.completed(250)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::default_if_empty(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains an item from the source") {
- auto required = rxu::to_vector({
- on.next(210, 1),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("default_if_empty should switch if the source is empty", "[default_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .default_if_empty(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains an item from the backup source") {
- auto required = rxu::to_vector({
- on.next(250, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("default_if_empty - never", "[default_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .default_if_empty(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("default_if_empty - source throws", "[default_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("default_if_empty on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .default_if_empty(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains an error from the source"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/delay.cpp b/Rx/v2/test/operators/delay.cpp
deleted file mode 100644
index 55a8cdf..0000000
--- a/Rx/v2/test/operators/delay.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-delay.hpp>
-
-using namespace std::chrono;
-
-SCENARIO("delay - never", "[delay][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("values are delayed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs | rxo::delay(milliseconds(10), so);
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1001)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("delay - empty", "[delay][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("values are delayed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.delay(so, milliseconds(10));
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("delay - return", "[delay][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("values are delayed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.delay(milliseconds(10), so);
- }
- );
-
- THEN("the output only contains delayed items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 2),
- on.next(250, 3),
- on.completed(310)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("delay - throw", "[delay][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("delay on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("values are delayed"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.delay(milliseconds(10), so);
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on.error(251, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/distinct.cpp b/Rx/v2/test/operators/distinct.cpp
deleted file mode 100644
index 19d2176..0000000
--- a/Rx/v2/test/operators/distinct.cpp
+++ /dev/null
@@ -1,699 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-distinct.hpp>
-
-SCENARIO("distinct - never", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("distinct - empty", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - return", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - throw", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("distinct on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - all changes", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - all same", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 2),
- on.next(230, 2),
- on.next(240, 2),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - some changes", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(220, 3),
- on.next(225, 2),
- on.next(230, 2),
- on.next(230, 1), //*
- on.next(240, 2),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(230, 1), //*
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - strings", "[distinct][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<std::string> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, "A"),
- on.next(210, "B"),
- on.next(220, "B"),
- on.next(230, "B"),
- on.next(240, "B"),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, "B"),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - system_clock's duration", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<system_clock::duration> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, system_clock::duration{ 10 }),
- on.next(210, system_clock::duration{ 20 }),
- on.next(220, system_clock::duration{ 20 }),
- on.next(230, system_clock::duration{ 100 }),
- on.next(240, system_clock::duration{ 100 }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, system_clock::duration{ 20 }),
- on.next(230, system_clock::duration{ 100 }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - high_resolution_clock's duration", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<high_resolution_clock::duration> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, high_resolution_clock::duration{ 10 }),
- on.next(210, high_resolution_clock::duration{ 20 }),
- on.next(220, high_resolution_clock::duration{ 20 }),
- on.next(230, high_resolution_clock::duration{ 100 }),
- on.next(240, high_resolution_clock::duration{ 100 }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, high_resolution_clock::duration{ 20 }),
- on.next(230, high_resolution_clock::duration{ 100 }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - steady_clock's duration", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<steady_clock::duration> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, steady_clock::duration{ 10 }),
- on.next(210, steady_clock::duration{ 20 }),
- on.next(220, steady_clock::duration{ 20 }),
- on.next(230, steady_clock::duration{ 100 }),
- on.next(240, steady_clock::duration{ 100 }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, steady_clock::duration{ 20 }),
- on.next(230, steady_clock::duration{ 100 }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - system_clock's time_point", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<system_clock::time_point> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, system_clock::time_point{ system_clock::duration{ 10 } }),
- on.next(210, system_clock::time_point{ system_clock::duration{ 20 } }),
- on.next(220, system_clock::time_point{ system_clock::duration{ 20 } }),
- on.next(230, system_clock::time_point{ system_clock::duration{ 100 } }),
- on.next(240, system_clock::time_point{ system_clock::duration{ 100 } }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, system_clock::time_point{ system_clock::duration{ 20 } }),
- on.next(230, system_clock::time_point{ system_clock::duration{ 100 } }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - high_resolution_clock's time_point", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<high_resolution_clock::time_point> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, high_resolution_clock::time_point{ high_resolution_clock::duration{ 10 } }),
- on.next(210, high_resolution_clock::time_point{ high_resolution_clock::duration{ 20 } }),
- on.next(220, high_resolution_clock::time_point{ high_resolution_clock::duration{ 20 } }),
- on.next(230, high_resolution_clock::time_point{ high_resolution_clock::duration{ 100 } }),
- on.next(240, high_resolution_clock::time_point{ high_resolution_clock::duration{ 100 } }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, high_resolution_clock::time_point{ high_resolution_clock::duration{ 20 } }),
- on.next(230, high_resolution_clock::time_point{ high_resolution_clock::duration{ 100 } }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - steady_clock's time_point", "[distinct][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- using namespace std::chrono;
- const rxsc::test::messages<steady_clock::time_point> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, steady_clock::time_point{ steady_clock::duration{ 10 } }),
- on.next(210, steady_clock::time_point{ steady_clock::duration{ 20 } }),
- on.next(220, steady_clock::time_point{ steady_clock::duration{ 20 } }),
- on.next(230, steady_clock::time_point{ steady_clock::duration{ 100 } }),
- on.next(240, steady_clock::time_point{ steady_clock::duration{ 100 } }),
- on.completed(250)
- });
-
- WHEN("distinct values are taken") {
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, steady_clock::time_point{ steady_clock::duration{ 20 } }),
- on.next(230, steady_clock::time_point{ steady_clock::duration{ 100 } }),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct - enum", "[distinct][operators]"){
- enum Value {
- A,
- B,
- C
- };
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<Value> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, Value::A),
- on.next(210, Value::A),
- on.next(220, Value::B),
- on.next(230, Value::B),
- on.next(240, Value::B),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, Value::A),
- on.next(220, Value::B),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/distinct_until_changed.cpp b/Rx/v2/test/operators/distinct_until_changed.cpp
deleted file mode 100644
index c27a41a..0000000
--- a/Rx/v2/test/operators/distinct_until_changed.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-distinct_until_changed.hpp>
-
-SCENARIO("distinct_until_changed - never", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs | rxo::distinct_until_changed();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("distinct_until_changed - empty", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - return", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - throw", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("distinct_until_changed on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - all changes", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - all same", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 2),
- on.next(230, 2),
- on.next(240, 2),
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - some changes", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(220, 3),
- on.next(225, 2), //*
- on.next(230, 2),
- on.next(230, 1), //*
- on.next(240, 2), //*
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(225, 2), //*
- on.next(230, 1), //*
- on.next(240, 2), //*
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-struct A {
- int i;
-
- bool operator!=(const A& a) const {
- return i != a.i;
- }
-
- bool operator==(const A& a) const {
- return i == a.i;
- }
-};
-
-SCENARIO("distinct_until_changed - custom type", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<A> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, A{1}),
- on.next(210, A{2}), //*
- on.next(215, A{3}), //*
- on.next(220, A{3}),
- on.next(225, A{2}), //*
- on.next(230, A{2}),
- on.next(230, A{1}), //*
- on.next(240, A{2}), //*
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.distinct_until_changed();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, A{2}), //*
- on.next(215, A{3}), //*
- on.next(225, A{2}), //*
- on.next(230, A{1}), //*
- on.next(240, A{2}), //*
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("distinct_until_changed - custom predicate", "[distinct_until_changed][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(220, 3),
- on.next(225, 2), //*
- on.next(230, 2),
- on.next(230, 1), //*
- on.next(240, 2), //*
- on.completed(250)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .distinct_until_changed([](int x, int y) { return x == y; })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2), //*
- on.next(215, 3), //*
- on.next(225, 2), //*
- on.next(230, 1), //*
- on.next(240, 2), //*
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/element_at.cpp b/Rx/v2/test/operators/element_at.cpp
deleted file mode 100644
index d6caaec..0000000
--- a/Rx/v2/test/operators/element_at.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-element_at.hpp>
-
-SCENARIO("element_at - never", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs | rxo::element_at(3);
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("element_at - empty", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("element_at on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(0);
- }
- );
-
- THEN("the output only contains an error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("element_at - first", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(0);
- }
- );
-
- THEN("the output contains the first element"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("element_at - throw", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("element_at on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(3);
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("element_at - non-first", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4), //
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(2);
- }
- );
-
- THEN("the output contains the element at requested index"){
- auto required = rxu::to_vector({
- on.next(230, 4),
- on.completed(230)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("element_at - last in a sequence", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5), //
- on.completed(250)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(3);
- }
- );
-
- THEN("the output contains the element at requested index"){
- auto required = rxu::to_vector({
- on.next(240, 5),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("element_at - invalid index", "[element_at][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("element_at on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), // #0
- on.next(220, 3), // #1
- on.next(230, 4), // #2
- on.next(240, 5), // #3
- on.completed(250)
- });
-
- WHEN("element_at is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.element_at(4);
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/exists.cpp b/Rx/v2/test/operators/exists.cpp
deleted file mode 100644
index 5e40a21..0000000
--- a/Rx/v2/test/operators/exists.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-any.hpp>
-
-// NOTE: `exists` is an alias of `any`
-
-SCENARIO("exists emits true if an item satisfies the given condition", "[exists][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_exists;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::exists([](int n) { return n == 2; })
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_exists.next(210, true),
- on_exists.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("exists emits false if no item satisfies the given condition", "[exists][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_exists;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .exists([](int n) { return n > 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
-
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_exists.next(250, false),
- on_exists.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("exists emits false if the source observable is empty", "[exists][operators]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_exists;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .exists([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on_exists.next(250, false),
- on_exists.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-SCENARIO("exists never emits if the source observable never emits any items", "[exists][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_exists;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .exists([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("exists emits an error", "[exists][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_exists;
-
- std::runtime_error ex("exists on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("invoked with a predicate"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .exists([](int n) { return n == 2; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on_exists.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp
deleted file mode 100644
index 08dd6ee..0000000
--- a/Rx/v2/test/operators/filter.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-filter.hpp>
-
-namespace {
-bool IsPrime(int x)
-{
- if (x < 2) return false;
- for (int i = 2; i <= x/2; ++i)
- {
- if (x % i == 0)
- return false;
- }
- return true;
-}
-}
-
-SCENARIO("filter stops on completion", "[filter][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600),
- on.next(610, 12),
- on.error(620, std::runtime_error("error in unsubscribed stream")),
- on.completed(630)
- });
-
- WHEN("filtered to ints that are primes"){
- auto res = w.start(
- [&xs, &invoked]() {
- return xs
- | rxo::filter([&invoked](int x) {
- invoked++;
- return IsPrime(x);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
- THEN("the output only contains primes"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7),
- on.next(580, 11),
- on.completed(600)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("filter was called until completed"){
- REQUIRE(9 == invoked);
- }
- }
- }
-}
-
-
-SCENARIO("filter stops on disposal", "[where][filter][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [&xs, &invoked]() {
- return xs
- .filter([&invoked](int x) {
- invoked++;
- return IsPrime(x);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains primes that arrived before disposal"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until disposed"){
- REQUIRE(5 == invoked);
- }
- }
- }
-}
-
-SCENARIO("filter stops on error", "[where][filter][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- std::runtime_error ex("filter on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.error(600, ex),
- on.next(610, 12),
- on.error(620, std::runtime_error("error in unsubscribed stream")),
- on.completed(630)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .filter([&invoked](int x) {
- invoked++;
- return IsPrime(x);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains primes"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7),
- on.next(580, 11),
- on.error(600, ex),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until error"){
- REQUIRE(9 == invoked);
- }
- }
- }
-}
-
-// filter cannot possibly catch an exception when exceptions are disabled,
-// so this test is meaningless when exceptions are disabled.
-SCENARIO("filter stops on throw from predicate", "[where][filter][operators][!throws]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- std::runtime_error ex("filter predicate error");
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600),
- on.next(610, 12),
- on.error(620, std::runtime_error("error in unsubscribed stream")),
- on.completed(630)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [ex, xs, &invoked]() {
- return xs
- .filter([ex, &invoked](int x) {
- invoked++;
- if (x > 5) {
- rxu::throw_exception(ex);
- }
- return IsPrime(x);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains primes"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.error(380, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 380)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until error"){
- REQUIRE(4 == invoked);
- }
- }
- }
-}
-
-SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600),
- on.next(610, 12),
- on.error(620, std::exception()),
- on.completed(630)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::observable<int, rx::dynamic_observable<int>> ys;
-
- WHEN("filtered to ints that are primes"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&invoked, &res, &ys, &xs](const rxsc::schedulable&) {
- ys = xs
- .filter([&invoked, &res](int x) {
- invoked++;
- if (x == 8)
- res.unsubscribe();
- return IsPrime(x);
- });
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable&) {
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable&) {
- res.unsubscribe();
- });
-
- w.start();
-
- THEN("the output only contains primes"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 450)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until disposed"){
- REQUIRE(6 == invoked);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/finally.cpp b/Rx/v2/test/operators/finally.cpp
deleted file mode 100644
index eb7046c..0000000
--- a/Rx/v2/test/operators/finally.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-finally.hpp>
-
-SCENARIO("finally - never", "[finally][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("finally action is set"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- | rxo::finally([&invoked]() {
- ++invoked;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("finally called once"){
- REQUIRE(1 == invoked);
- }
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("finally - empty", "[finally][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("finally action is set"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .finally([&invoked]() {
- ++invoked;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("finally called once"){
- REQUIRE(1 == invoked);
- }
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("finally - items emitted", "[finally][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("finally action is set"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .finally([&invoked]() {
- ++invoked;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("finally called once"){
- REQUIRE(1 == invoked);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("finally - throw", "[finally][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- std::runtime_error ex("finally on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("finally action is set"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .finally([&invoked]() {
- ++invoked;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("finally called once"){
- REQUIRE(1 == invoked);
- }
-
- THEN("the output only contains only error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp
deleted file mode 100644
index e1837b0..0000000
--- a/Rx/v2/test/operators/flat_map.cpp
+++ /dev/null
@@ -1,788 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-filter.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-#include <rxcpp/operators/rx-flat_map.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-static const int static_tripletCount = 100;
-
-SCENARIO("pythagorian for loops", "[!hide][for][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("a for loop"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- int c = 0;
- int ct = 0;
- int n = 1;
- auto start = clock::now();
- for(int z = 1;; ++z)
- {
- for(int x = 1; x <= z; ++x)
- {
- for(int y = x; y <= z; ++y)
- {
- ++c;
- if(x*x + y*y == z*z)
- {
- ++ct;
- if(ct == tripletCount)
- goto done;
- }
- }
- }
- }
- done:
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-SCENARIO("merge_transform pythagorian ranges", "[!hide][range][merge_transform][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::identity_immediate();
-
- int c = 0;
- int ct = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .merge_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .flat_map(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;});
- triples
- .take(tripletCount)
- .subscribe(
- rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){
- ++ct;
- }));
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-SCENARIO("synchronize merge_transform pythagorian ranges", "[!hide][range][merge_transform][synchronize][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::synchronize_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .merge_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .merge_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("observe_on merge_transform pythagorian ranges", "[!hide][range][merge_transform][observe_on][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::observe_on_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .merge_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .merge_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge observe_on pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("serialize merge_transform pythagorian ranges", "[!hide][range][merge_transform][serialize][pythagorian][perf]"){
- const int& tripletCount = static_tripletCount;
- GIVEN("some ranges"){
- WHEN("generating pythagorian triplets"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::serialize_event_loop();
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- auto triples =
- rxs::range(1, so)
- .merge_transform(
- [&c, so](int z){
- return rxs::range(1, z, 1, so)
- .merge_transform(
- [&c, so, z](int x){
- return rxs::range(x, z, 1, so)
- .filter([&c, z, x](int y){
- ++c;
- if (x*x + y*y == z*z) {
- return true;}
- else {
- return false;}})
- .transform([z, x](int y){return std::make_tuple(x, y, z);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*x*/, std::tuple<int,int,int> triplet){return triplet;},
- so)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();},
- [](int /*z*/, std::tuple<int,int,int> triplet){return triplet;},
- so);
- int ct = triples
- .take(tripletCount)
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge serial pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("flat_map completes", "[flat_map][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::flat_map(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(800, "qux"),
- s_on.completed(850)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("merge_transform completes", "[merge_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::merge_transform(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(800, "qux"),
- s_on.completed(850)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
-
- WHEN("each int is mapped to the strings with coordinator"){
-
- auto res = w.start(
- [&]() {
- return xs
- .merge_transform(
- [&](int){
- return ys;},
- [](int, std::string s){
- return s;},
- rx::identity_current_thread())
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(800, "qux"),
- s_on.completed(850)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("merge_transform source never ends", "[merge_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.next(500, 5),
- i_on.next(700, 0)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .merge_transform([&](int){return ys;}, [](int, std::string s){return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(750, "foo"),
- s_on.next(800, "qux"),
- s_on.next(800, "bar"),
- s_on.next(850, "baz"),
- s_on.next(900, "qux"),
- s_on.next(950, "foo")
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850),
- s_on.subscribe(700, 950),
- s_on.subscribe(900, 1000)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("merge_transform inner error", "[merge_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.completed(500)
- });
-
- std::runtime_error ex("filter on_error from inner source");
-
- auto ys = sc.make_cold_observable({
- s_on.next(55, "foo"),
- s_on.next(104, "bar"),
- s_on.next(153, "baz"),
- s_on.next(202, "qux"),
- s_on.error(301, ex)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .merge_transform([&](int){return ys;}, [](int, std::string s){return s;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(355, "foo"),
- s_on.next(404, "bar"),
- s_on.next(453, "baz"),
- s_on.next(455, "foo"),
- s_on.next(502, "qux"),
- s_on.next(504, "bar"),
- s_on.next(553, "baz"),
- s_on.next(555, "foo"),
- s_on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 601)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 601),
- s_on.subscribe(400, 601),
- s_on.subscribe(500, 601),
- s_on.subscribe(600, 601)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("merge_transform, no result selector, no coordination", "[merge_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .merge_transform(
- [&](int){
- return ys;})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(800, "qux"),
- s_on.completed(850)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("merge_transform, no result selector, with coordination", "[merge_transform][transform][map][operators]"){
- GIVEN("two cold observables. one of ints. one of strings."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> i_on;
- const rxsc::test::messages<std::string> s_on;
-
- auto xs = sc.make_cold_observable({
- i_on.next(100, 4),
- i_on.next(200, 2),
- i_on.next(300, 3),
- i_on.next(400, 1),
- i_on.completed(500)
- });
-
- auto ys = sc.make_cold_observable({
- s_on.next(50, "foo"),
- s_on.next(100, "bar"),
- s_on.next(150, "baz"),
- s_on.next(200, "qux"),
- s_on.completed(250)
- });
-
- WHEN("each int is mapped to the strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .merge_transform(
- [&](int){
- return ys;},
- rx::identity_current_thread())
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains strings repeated for each int"){
- auto required = rxu::to_vector({
- s_on.next(350, "foo"),
- s_on.next(400, "bar"),
- s_on.next(450, "baz"),
- s_on.next(450, "foo"),
- s_on.next(500, "qux"),
- s_on.next(500, "bar"),
- s_on.next(550, "baz"),
- s_on.next(550, "foo"),
- s_on.next(600, "qux"),
- s_on.next(600, "bar"),
- s_on.next(650, "baz"),
- s_on.next(650, "foo"),
- s_on.next(700, "qux"),
- s_on.next(700, "bar"),
- s_on.next(750, "baz"),
- s_on.next(800, "qux"),
- s_on.completed(850)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ints"){
- auto required = rxu::to_vector({
- i_on.subscribe(200, 700)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there were four subscription and unsubscription to the strings"){
- auto required = rxu::to_vector({
- s_on.subscribe(300, 550),
- s_on.subscribe(400, 650),
- s_on.subscribe(500, 750),
- s_on.subscribe(600, 850)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp
deleted file mode 100644
index 645bda4..0000000
--- a/Rx/v2/test/operators/group_by.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-concat.hpp>
-#include <rxcpp/operators/rx-group_by.hpp>
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-#include <rxcpp/operators/rx-start_with.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-#include <locale>
-#include <sstream>
-
-SCENARIO("range partitioned by group_by across hardware threads to derive pi", "[!hide][pi][group_by][observe_on][long][perf]"){
- GIVEN("a for loop"){
- WHEN("partitioning pi series across all hardware threads"){
-
- std::atomic_int c;
- c = 0;
- auto pi = [&](int k) {
- ++c;
- return ( k % 2 == 0 ? -4.0L : 4.0L ) / ( ( 2.0L * k ) - 1.0L );
- };
-
- using namespace std::chrono;
- auto start = steady_clock::now();
-
- // share an output thread across all the producer threads
- auto outputthread = rxcpp::observe_on_one_worker(rxcpp::observe_on_new_thread().create_coordinator().get_scheduler());
-
- struct work
- {
- int index;
- int first;
- int last;
- };
-
- // use all available hardware threads
- auto total = rxcpp::observable<>::range(0, (2 * std::thread::hardware_concurrency()) - 1).
- map(
- [](int index){
- static const int chunk = 100000000 / (2 * std::thread::hardware_concurrency());
- int first = (chunk * index) + 1;
- int last = chunk * (index + 1);
- return work{index, first, last};}
- ).
- group_by(
- [](work w) -> int {return w.index % std::thread::hardware_concurrency();},
- [](work w){return w;}).
- map(
- [=](rxcpp::grouped_observable<int, work> onproc) {
- auto key = onproc.get_key();
- // share a producer thread across all the ranges in this group of chunks
- auto producerthread = rxcpp::observe_on_one_worker(rxcpp::observe_on_new_thread().create_coordinator().get_scheduler());
- return onproc.
- map(
- [=](work w){
- std::stringstream message;
- message << std::setw(3) << w.index << ": range - " << w.first << "-" << w.last;
-
- return rxcpp::observable<>::range(w.first, w.last, producerthread).
- map(pi).
- sum(). // each thread maps and reduces its contribution to the answer
- map(
- [=](long double v){
- std::stringstream message;
- message << key << " on " << std::this_thread::get_id() << " - value: " << std::setprecision(16) << v;
- return std::make_tuple(message.str(), v);
- }).
- start_with(std::make_tuple(message.str(), 0.0L)).
- as_dynamic();
- }).
- concat(). // only subscribe to one range at a time in this group.
- observe_on(outputthread).
- map(rxcpp::util::apply_to(
- [](std::string message, long double v){
- std::cout << message << std::endl;
- return v;
- })).
- as_dynamic();
- }).
- merge().
- sum(). // reduces the contributions from all the threads to the answer
- as_blocking().
- last();
-
- std::cout << std::setprecision(16) << "Pi: " << total << std::endl;
- auto finish = steady_clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "pi using group_by and concat to partition the work : " << c << " calls to pi(), " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-SCENARIO("range partitioned by dividing work across hardware threads to derive pi", "[!hide][pi][observe_on][long][perf]"){
- GIVEN("a for loop"){
- WHEN("partitioning pi series across all hardware threads"){
-
- std::atomic_int c;
- c = 0;
- auto pi = [&](int k) {
- ++c;
- return ( k % 2 == 0 ? -4.0L : 4.0L ) / ( ( 2.0L * k ) - 1.0L );
- };
-
- using namespace std::chrono;
- auto start = steady_clock::now();
-
- struct work
- {
- int index;
- int first;
- int last;
- };
-
- // use all available hardware threads
- auto total = rxcpp::observable<>::range(0, (2 * std::thread::hardware_concurrency()) - 1).
- map(
- [](int index){
- static const int chunk = 100000000 / (2 * std::thread::hardware_concurrency());
- int first = (chunk * index) + 1;
- int last = chunk * (index + 1);
- return work{index, first, last};
- }).
- map(
- [=](work w){
- std::stringstream message;
- message << std::setw(3) << w.index << ": range - " << w.first << "-" << w.last;
-
- // create a new thread for every chunk
- return rxcpp::observable<>::range(w.first, w.last, rxcpp::observe_on_new_thread()).
- map(pi).
- sum(). // each thread maps and reduces its contribution to the answer
- map(
- [=](long double v){
- std::stringstream message;
- message << w.index << " on " << std::this_thread::get_id() << " - value: " << std::setprecision(16) << v;
- return std::make_tuple(message.str(), v);
- }).
- start_with(std::make_tuple(message.str(), 0.0L)).
- as_dynamic();
- }).
- merge(rxcpp::observe_on_new_thread()).
- map(rxcpp::util::apply_to(
- [](std::string message, long double v){
- std::cout << message << std::endl;
- return v;
- })).
- sum(). // reduces the contributions from all the threads to the answer
- as_blocking().
- last();
-
- std::cout << std::setprecision(16) << "Pi: " << total << std::endl;
- auto finish = steady_clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "pi using division of the whole range to partition the work : " << c << " calls to pi(), " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-char whitespace(char c) {
- return std::isspace<char>(c, std::locale::classic());
-}
-
-std::string trim(std::string s) {
- auto first = std::find_if_not(s.begin(), s.end(), whitespace);
- auto last = std::find_if_not(s.rbegin(), s.rend(), whitespace);
- if (last != s.rend()) {
- s.erase(s.end() - (last-s.rbegin()), s.end());
- }
- s.erase(s.begin(), first);
- return s;
-}
-
-bool tolowerLess(char lhs, char rhs) {
- return std::tolower(lhs, std::locale::classic()) < std::tolower(rhs, std::locale::classic());
-}
-
-bool tolowerStringLess(const std::string& lhs, const std::string& rhs) {
- return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), tolowerLess);
-}
-
-SCENARIO("group_by", "[group_by][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<std::string> on;
- int keyInvoked = 0;
- int marbleInvoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(90, "error"),
- on.next(110, "error"),
- on.next(130, "error"),
- on.next(220, " foo"),
- on.next(240, " FoO "),
- on.next(270, "baR "),
- on.next(310, "foO "),
- on.next(350, " Baz "),
- on.next(360, " qux "),
- on.next(390, " bar"),
- on.next(420, " BAR "),
- on.next(470, "FOO "),
- on.next(480, "baz "),
- on.next(510, " bAZ "),
- on.next(530, " fOo "),
- on.completed(570),
- on.next(580, "error"),
- on.completed(600),
- on.error(650, std::runtime_error("error in completed sequence"))
- });
-
- WHEN("group normalized strings"){
-
- auto res = w.start(
- [&]() {
- return xs
- .group_by(
- [&](std::string v){
- ++keyInvoked;
- return trim(std::move(v));
- },
- [&](std::string v){
- ++marbleInvoked;
- std::reverse(v.begin(), v.end());
- return v;
- },
- tolowerStringLess)
- .map([](const rxcpp::grouped_observable<std::string, std::string>& g){return g.get_key();})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of group keys"){
- auto required = rxu::to_vector({
- on.next(220, "foo"),
- on.next(270, "baR"),
- on.next(350, "Baz"),
- on.next(360, "qux"),
- on.completed(570)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 570)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("key selector was invoked for each value"){
- REQUIRE(12 == keyInvoked);
- }
-
- THEN("marble selector was invoked for each value"){
- REQUIRE(12 == marbleInvoked);
- }
- }
- }
-}
-
-SCENARIO("group_by take 1", "[group_by][take][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<long> on;
- int keyInvoked = 0;
- int marbleInvoked = 0;
- int groupEmitted = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(130, -1),
- on.next(220, 0),
- on.next(240, -1),
- on.next(270, 2),
- on.next(310, -3),
- on.next(350, 4),
- on.next(360, -5),
- on.next(390, 6),
- on.next(420, -7),
- on.next(470, 8),
- on.next(480, -9),
- on.completed(570)
- });
-
- WHEN("1 group of ints is emitted"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::group_by(
- [&](long v) {
- ++keyInvoked;
- return v % 2;
- },
- [&](long v){
- ++marbleInvoked;
- return v;
- })
- | rxo::take(1)
- | rxo::map([&](const rxcpp::grouped_observable<long, long>& g) -> rxcpp::observable<long> {
- ++groupEmitted;
- return g;
- })
- | rxo::merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- on.next(220, 0),
- on.next(270, 2),
- on.next(350, 4),
- on.next(390, 6),
- on.next(470, 8),
- on.completed(570)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 570)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("key selector was invoked for each value"){
- REQUIRE(10 == keyInvoked);
- }
-
- THEN("marble selector was invoked for each value"){
- REQUIRE(5 == marbleInvoked);
- }
-
- THEN("1 group emitted"){
- REQUIRE(1 == groupEmitted);
- }
- }
- }
-}
-
-SCENARIO("group_by take 1 take 4", "[group_by][take][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<long> on;
- int keyInvoked = 0;
- int marbleInvoked = 0;
- int groupEmitted = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(130, -1),
- on.next(220, 0),
- on.next(240, -1),
- on.next(270, 2),
- on.next(310, -3),
- on.next(350, 4),
- on.next(360, -5),
- on.next(390, 6),
- on.next(420, -7),
- });
-
- WHEN("1 group of ints is emitted"){
-
- auto res = w.start(
- [&]() {
- return xs
- .group_by(
- [&](long v) {
- ++keyInvoked;
- return v % 2;
- },
- [&](long v){
- ++marbleInvoked;
- return v;
- })
- .take(1)
- .map([&](const rxcpp::grouped_observable<long, long>& g) -> rxcpp::observable<long> {
- ++groupEmitted;
- return g.take(4);
- })
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- on.next(220, 0),
- on.next(270, 2),
- on.next(350, 4),
- on.next(390, 6),
- on.completed(390)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 390)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("key selector was invoked for each value"){
- REQUIRE(7 == keyInvoked);
- }
-
- THEN("marble selector was invoked for each value"){
- REQUIRE(4 == marbleInvoked);
- }
-
- THEN("1 group emitted"){
- REQUIRE(1 == groupEmitted);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/ignore_elements.cpp b/Rx/v2/test/operators/ignore_elements.cpp
deleted file mode 100644
index fdf856d..0000000
--- a/Rx/v2/test/operators/ignore_elements.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-ignore_elements.hpp>
-
-SCENARIO("ignore_elements - never", "[ignore_elements][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("ignore_elements is applied"){
-
- auto res = w.start(
- [xs]() {
- return xs | rxo::ignore_elements();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("ignore_elements - empty", "[ignore_elements][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("ignore_elements is applied"){
-
- auto res = w.start(
- [xs]() {
- return xs.ignore_elements();
- }
- );
-
- THEN("the output contains the completion message"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("ignore_elements - throw", "[ignore_elements][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("ignore_elements on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("ignore_elements is applied"){
-
- auto res = w.start(
- [xs]() {
- return xs.ignore_elements();
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("ignore_elements - items", "[ignore_elements][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("ignore_elements is applied"){
-
- auto res = w.start(
- [xs]() {
- return xs.ignore_elements();
- }
- );
-
- THEN("the output contains the completion message"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/is_empty.cpp b/Rx/v2/test/operators/is_empty.cpp
deleted file mode 100644
index 85e16eb..0000000
--- a/Rx/v2/test/operators/is_empty.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-all.hpp>
-
-SCENARIO("is_empty emits false if the source observable is not empty", "[is_empty][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_is_empty;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 10),
- on.next(220, 20),
- on.completed(250)
- });
-
- WHEN("is_empty is invoked") {
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::is_empty()
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true") {
- auto required = rxu::to_vector({
- on_is_empty.next(210, false),
- on_is_empty.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("is_empty emits true if the source observable is empty", "[is_empty][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_is_empty;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("is_empty is invoked") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .is_empty()
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains true") {
- auto required = rxu::to_vector({
- on_is_empty.next(250, true),
- on_is_empty.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("is_empty never emits if the source observable never emits any items", "[is_empty][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_is_empty;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("is_empty is invoked") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .is_empty()
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty") {
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("is_empty emits an error if the source observable emit an error", "[is_empty][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> on_is_empty;
-
- std::runtime_error ex("is_empty on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("is_empty is invoked") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .is_empty()
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output only contains an error") {
- auto required = rxu::to_vector({
- on_is_empty.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp
deleted file mode 100644
index 1f58c1d..0000000
--- a/Rx/v2/test/operators/lift.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-#include "../test.h"
-
-namespace detail {
-
-template<class Predicate>
-struct liftfilter
-{
- typedef typename std::decay<Predicate>::type test_type;
- test_type test;
-
- liftfilter(test_type t)
- : test(t)
- {
- }
-
- template<class Subscriber>
- struct filter_observer : public rx::observer_base<typename std::decay<Subscriber>::type::value_type>
- {
- typedef filter_observer<Subscriber> this_type;
- typedef rx::observer_base<typename std::decay<Subscriber>::type::value_type> base_type;
- typedef typename base_type::value_type value_type;
- typedef typename std::decay<Subscriber>::type dest_type;
- typedef rx::observer<value_type, this_type> observer_type;
- dest_type dest;
- test_type test;
-
- filter_observer(dest_type d, test_type t)
- : dest(d)
- , test(t)
- {
- }
- void on_next(typename dest_type::value_type v) const {
- bool filtered = false;
- RXCPP_TRY {
- filtered = !test(v);
- } RXCPP_CATCH(...) {
- dest.on_error(rxu::current_exception());
- return;
- }
- if (!filtered) {
- dest.on_next(v);
- }
- }
- void on_error(rxu::error_ptr e) const {
- dest.on_error(e);
- }
- void on_completed() const {
- dest.on_completed();
- }
-
- static rx::subscriber<value_type, observer_type> make(const dest_type& d, const test_type& t) {
- return rx::make_subscriber<value_type>(d, observer_type(this_type(d, t)));
- }
- };
-
- template<class Subscriber>
- auto operator()(const Subscriber& dest) const
- -> decltype(filter_observer<Subscriber>::make(dest, test)) {
- return filter_observer<Subscriber>::make(dest, test);
- }
-};
-
-}
-
-namespace {
-
-template<class Predicate>
-auto liftfilter(Predicate&& p)
- -> detail::liftfilter<typename std::decay<Predicate>::type> {
- return detail::liftfilter<typename std::decay<Predicate>::type>(std::forward<Predicate>(p));
-}
-
-bool IsPrime(int x)
-{
- if (x < 2) return false;
- for (int i = 2; i <= x/2; ++i)
- {
- if (x % i == 0)
- return false;
- }
- return true;
-}
-
-}
-
-SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [&xs, &invoked]() {
- return xs
- .lift<int>(liftfilter([&invoked](int x) {
- invoked++;
- return IsPrime(x);
- }))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains primes that arrived before disposal"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until disposed"){
- REQUIRE(5 == invoked);
- }
- }
- }
-}
-
-SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stream][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [&xs, &invoked]() {
- return xs
- >> rxo::lift<int>(liftfilter([&invoked](int x) {
- invoked++;
- return IsPrime(x);
- }))
- // forget type to workaround lambda deduction bug on msvc 2013
- >> rxo::as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains primes that arrived before disposal"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until disposed"){
- REQUIRE(5 == invoked);
- }
- }
- }
-}
-
-SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(180, 2),
- on.next(230, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(380, 6),
- on.next(390, 7),
- on.next(450, 8),
- on.next(470, 9),
- on.next(560, 10),
- on.next(580, 11),
- on.completed(600)
- });
-
- WHEN("filtered to ints that are primes"){
-
- auto res = w.start(
- [&xs, &invoked]() {
- auto predicate = [&](int x){
- invoked++;
- return IsPrime(x);
- };
- return xs
- .lift<int>([=](rx::subscriber<int> dest){
- // VS2013 deduction issue requires dynamic (type-forgetting)
- return rx::make_subscriber<int>(
- dest,
- rx::make_observer_dynamic<int>(
- [=](int n){
- bool pass = false;
- RXCPP_TRY {pass = predicate(n);} RXCPP_CATCH(...){dest.on_error(rxu::current_exception());};
- if (pass) {dest.on_next(n);}
- },
- [=](rxu::error_ptr e){dest.on_error(e);},
- [=](){dest.on_completed();}));
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains primes that arrived before disposal"){
- auto required = rxu::to_vector({
- on.next(230, 3),
- on.next(340, 5),
- on.next(390, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("where was called until disposed"){
- REQUIRE(5 == invoked);
- }
- }
- }
-}
-
diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp
deleted file mode 100644
index c96cc8d..0000000
--- a/Rx/v2/test/operators/map.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-map.hpp>
-
-SCENARIO("map stops on completion", "[map][operators]") {
- GIVEN("a test hot observable of ints") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- WHEN("mapped to ints that are one larger") {
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .map([&invoked](int x) {
- invoked++;
- return x + 1;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion") {
- auto required = rxu::to_vector({
- on.next(210, 3),
- on.next(240, 4),
- on.next(290, 5),
- on.next(350, 6),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription") {
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("map was called until completed") {
- REQUIRE(4 == invoked);
- }
- }
- }
-}
-
-SCENARIO("map - never", "[map][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("values are mapped") {
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::map([](int x) {
- return x + 1;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty") {
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("map - empty", "[map][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("values are mapped") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .map([](int x) {
- return x + 1;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains complete message") {
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("map - items emitted", "[map][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("values are mapped") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .map([](int x) {
- return x + 1;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed") {
- auto required = rxu::to_vector({
- on.next(210, 3),
- on.next(240, 4),
- on.completed(300)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("map - throw", "[map][operators]") {
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("map on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("values are mapped") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .map([](int x) {
- return x + 1;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains only error") {
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source") {
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp
deleted file mode 100644
index 917d74d..0000000
--- a/Rx/v2/test/operators/merge.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-const int static_onnextcalls = 1000000;
-
-
-SCENARIO("synchronize merge ranges", "[!hide][range][synchronize][merge][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::synchronize_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- int c = rxs::range(0, sectionCount - 1, 1, so)
- .merge(
- so,
- rxs::range(sectionCount, (sectionCount * 2) - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge sync ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-SCENARIO("observe_on merge ranges", "[!hide][range][observe_on][merge][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::observe_on_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- int c = rxs::range(0, sectionCount - 1, 1, so)
- .merge(
- so,
- rxs::range(sectionCount, (sectionCount * 2) - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge observe_on ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-SCENARIO("serialize merge ranges", "[!hide][range][serialize][merge][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("some ranges"){
- WHEN("generating ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto so = rx::serialize_event_loop();
-
- int n = 1;
- auto sectionCount = onnextcalls / 3;
- auto start = clock::now();
- int c = rxs::range(0, sectionCount - 1, 1, so)
- .merge(
- so,
- rxs::range(sectionCount, (sectionCount * 2) - 1, 1, so),
- rxs::range(sectionCount * 2, onnextcalls - 1, 1, so))
- .as_blocking()
- .count();
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish.time_since_epoch()) -
- duration_cast<milliseconds>(start.time_since_epoch());
- std::cout << "merge serial ranges : " << n << " subscribed, " << c << " emitted, " << msElapsed.count() << "ms elapsed " << std::endl;
- }
- }
-}
-
-SCENARIO("merge completes", "[merge][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.next(500, ys3),
- o_on.completed(600)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 103),
- on.next(410, 201),
- on.next(420, 104),
- on.next(420, 202),
- on.next(430, 203),
- on.next(440, 204),
- on.next(510, 105),
- on.next(510, 301),
- on.next(520, 106),
- on.next(520, 302),
- on.next(530, 303),
- on.next(540, 304),
- on.next(620, 305),
- on.completed(650)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 530)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(400, 450)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(500, 650)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic merge completes", "[merge][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .merge(ys2, ys3);
- }
- );
-
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(210, 201),
- on.next(210, 301),
- on.next(220, 102),
- on.next(220, 202),
- on.next(220, 302),
- on.next(230, 203),
- on.next(230, 303),
- on.next(240, 204),
- on.next(240, 304),
- on.next(310, 103),
- on.next(320, 104),
- on.next(320, 305),
- on.next(410, 105),
- on.next(420, 106),
- on.completed(430)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 430)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/merge_delay_error.cpp b/Rx/v2/test/operators/merge_delay_error.cpp
deleted file mode 100644
index 83172ec..0000000
--- a/Rx/v2/test/operators/merge_delay_error.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-merge_delay_error.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-//merge_delay_error must work the very same way as `merge()` except the error handling
-
-SCENARIO("merge_delay_error completes", "[merge][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.next(500, ys3),
- o_on.completed(600)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::merge_delay_error()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 103),
- on.next(410, 201),
- on.next(420, 104),
- on.next(420, 202),
- on.next(430, 203),
- on.next(440, 204),
- on.next(510, 105),
- on.next(510, 301),
- on.next(520, 106),
- on.next(520, 302),
- on.next(530, 303),
- on.next(540, 304),
- on.next(620, 305),
- on.completed(650)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 530)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(400, 450)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(500, 650)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic merge_delay_error completes with error", "[merge][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(230, 107),
- on.completed(240)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.error(40, std::runtime_error("merge_delay_error on_error from ys2")),
- on.next(50, 205),
- on.completed(60)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .merge_delay_error(ys2, ys3);
- }
- );
-
- rx::composite_exception ex;
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(210, 201),
- on.next(210, 301),
- on.next(220, 102),
- on.next(220, 202),
- on.next(220, 302),
- on.next(230, 203),
- on.next(230, 303),
- on.next(240, 304),
- on.next(310, 103),
- on.next(320, 104),
- on.next(320, 305),
- on.next(410, 105),
- on.next(430, 107),
- on.error(440, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 440)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("variadic merge_delay_error completes with 2 errors", "[merge][join][operators]"){
- GIVEN("1 hot observable with 3 cold observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.error(220, std::runtime_error("merge_delay_error on_error from ys1")),
- on.next(230, 107),
- on.completed(240)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.error(40, std::runtime_error("merge_delay_error on_error from ys2")),
- on.next(50, 205),
- on.completed(60)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.next(120, 305),
- on.completed(150)
- });
-
- WHEN("each int is merged"){
-
- auto res = w.start(
- [&]() {
- return ys1
- .merge_delay_error(ys2, ys3);
- }
- );
-
- rx::composite_exception ex;
- THEN("the output contains merged ints"){
- auto required = rxu::to_vector({
- on.next(210, 101),
- on.next(210, 201),
- on.next(210, 301),
- on.next(220, 102),
- on.next(220, 202),
- on.next(220, 302),
- on.next(230, 203),
- on.next(230, 303),
- on.next(240, 304),
- on.next(310, 103),
- on.next(320, 104),
- on.next(320, 305),
- on.next(410, 105),
- on.error(420, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 420)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ys3"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/observe_on.cpp b/Rx/v2/test/operators/observe_on.cpp
deleted file mode 100644
index aac2d40..0000000
--- a/Rx/v2/test/operators/observe_on.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-take.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-const int static_onnextcalls = 100000;
-
-SCENARIO("range observed on new_thread", "[!hide][range][observe_on_debug][observe_on][long][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a range"){
- WHEN("multicasting a million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto el = rx::observe_on_new_thread();
-
- for (int n = 0; n < 10; n++)
- {
- std::atomic_bool disposed;
- std::atomic_bool done;
- auto c = std::make_shared<int>(0);
-
- rx::composite_subscription cs;
- cs.add([&](){
- if (!done) {abort();}
- disposed = true;
- });
-
- auto start = clock::now();
- rxs::range<int>(1)
- .take(onnextcalls)
- .observe_on(el)
- .as_blocking()
- .subscribe(
- cs,
- [c](int){
- ++(*c);
- },
- [&](){
- done = true;
- });
- auto expected = onnextcalls;
- REQUIRE(*c == expected);
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "range -> observe_on new_thread : " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed, int-per-second " << *c / (msElapsed.count() / 1000.0) << std::endl;
- }
- }
- }
-}
-
-SCENARIO("observe_on", "[observe][observe_on]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("subscribe_on is specified"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .observe_on(so);
- }
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.completed(301)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("stream observe_on", "[observe][observe_on]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("observe_on is specified"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- | rxo::observe_on(so);
- }
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.completed(301)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-class nocompare {
-public:
- int v;
-};
-
-SCENARIO("observe_on no-comparison", "[observe][observe_on]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::observe_on_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<nocompare> in;
- const rxsc::test::messages<int> out;
-
- auto xs = sc.make_hot_observable({
- in.next(150, nocompare{1}),
- in.next(210, nocompare{2}),
- in.next(240, nocompare{3}),
- in.completed(300)
- });
-
- WHEN("observe_on is specified"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- | rxo::observe_on(so)
- | rxo::map([](nocompare v){ return v.v; })
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- out.next(211, 2),
- out.next(241, 3),
- out.completed(301)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- out.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/on_error_resume_next.cpp b/Rx/v2/test/operators/on_error_resume_next.cpp
deleted file mode 100644
index e67b66e..0000000
--- a/Rx/v2/test/operators/on_error_resume_next.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-on_error_resume_next.hpp>
-
-SCENARIO("switch_on_error stops on completion", "[switch_on_error][on_error_resume_next][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- auto ys = sc.make_cold_observable({
- on.next(10, -1),
- on.completed(20),
- });
-
- WHEN("passed through unchanged"){
-
- auto res = w.start(
- [xs, ys, &invoked]() {
- return xs
- .switch_on_error([ys, &invoked](rxu::error_ptr) {
- invoked++;
- return ys;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one xs subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was no ys subscription"){
- auto required = std::vector<rxcpp::notifications::subscription>();
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("switch_on_error selector was not called"){
- REQUIRE(0 == invoked);
- }
- }
- }
-}
-
-SCENARIO("on_error_resume_next stops on completion", "[on_error_resume_next][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- auto ys = sc.make_cold_observable({
- on.next(10, -1),
- on.completed(20),
- });
-
- WHEN("passed through unchanged"){
-
- auto res = w.start(
- [xs, ys, &invoked]() {
- return xs
- .on_error_resume_next([ys, &invoked](rxu::error_ptr) {
- invoked++;
- return ys;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one xs subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was no ys subscription"){
- auto required = std::vector<rxcpp::notifications::subscription>();
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("on_error_resume_next selector was not called"){
- REQUIRE(0 == invoked);
- }
- }
- }
-}
-
-SCENARIO("on_error_resume_next stops on error", "[on_error_resume_next][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- std::runtime_error ex("on_error_resume_next on_error from source");
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.error(300, ex),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- auto ys = sc.make_cold_observable({
- on.next(10, -1),
- on.completed(20),
- });
-
- WHEN("are resumed after an error"){
-
- auto res = w.start(
- [xs, ys, &invoked]() {
- return xs
- .on_error_resume_next([ys, &invoked](rxu::error_ptr) {
- invoked++;
- return ys;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(310, -1),
- on.completed(320)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one xs subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one ys subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 320)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("on_error_resume_next selector was called once"){
- REQUIRE(1 == invoked);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/pairwise.cpp b/Rx/v2/test/operators/pairwise.cpp
deleted file mode 100644
index 20f86dd..0000000
--- a/Rx/v2/test/operators/pairwise.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-pairwise.hpp"
-
-SCENARIO("pairwise - enough items to create pairs", "[pairwise][operators]") {
- GIVEN("a cold observable of n ints") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::tuple<int, int>> on_pairwise;
-
- auto xs = sc.make_cold_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400),
- });
-
- WHEN("taken pairwise") {
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::pairwise()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains n-1 tuples of ints"){
- auto delay = rxcpp::schedulers::test::subscribed_time;
- auto required = rxu::to_vector({
- on_pairwise.next(210 + delay, std::make_tuple(1, 2)),
- on_pairwise.next(240 + delay, std::make_tuple(2, 3)),
- on_pairwise.next(290 + delay, std::make_tuple(3, 4)),
- on_pairwise.next(350 + delay, std::make_tuple(4, 5)),
- on_pairwise.completed(400 + delay)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("pairwise - not enough items to create a pair", "[pairwise][operators]") {
- GIVEN("a cold observable of 1 ints") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::tuple<int, int>> on_pairwise;
-
- auto xs = sc.make_cold_observable({
- on.next(180, 1),
- on.completed(400),
- });
-
- WHEN("taken pairwise") {
-
- auto res = w.start(
- [xs]() {
- return xs
- .pairwise()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains no tuples of ints"){
- auto delay = rxcpp::schedulers::test::subscribed_time;
- auto required = rxu::to_vector({
- on_pairwise.completed(400 + delay)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp
deleted file mode 100644
index fe578d7..0000000
--- a/Rx/v2/test/operators/publish.cpp
+++ /dev/null
@@ -1,465 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-publish.hpp>
-#include <rxcpp/operators/rx-connect_forever.hpp>
-#include <rxcpp/operators/rx-ref_count.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-
-
-SCENARIO("publish range", "[!hide][range][subject][publish][subject][operators]"){
- GIVEN("a range"){
- WHEN("published"){
- auto published = rxs::range<int>(0, 10).publish();
- std::cout << "subscribe to published" << std::endl;
- published.subscribe(
- // on_next
- [](int v){std::cout << v << ", ";},
- // on_completed
- [](){std::cout << " done." << std::endl;});
- std::cout << "connect to published" << std::endl;
- published.connect();
- }
- WHEN("ref_count is used"){
- auto published = rxs::range<int>(0, 10).publish().ref_count();
- std::cout << "subscribe to ref_count" << std::endl;
- published.subscribe(
- // on_next
- [](int v){std::cout << v << ", ";},
- // on_completed
- [](){std::cout << " done." << std::endl;});
- }
- WHEN("connect_forever is used"){
- auto published = rxs::range<int>(0, 10).publish().connect_forever();
- std::cout << "subscribe to connect_forever" << std::endl;
- published.subscribe(
- // on_next
- [](int v){std::cout << v << ", ";},
- // on_completed
- [](){std::cout << " done." << std::endl;});
- }
- }
-}
-
-SCENARIO("publish ref_count", "[range][subject][publish][ref_count][operators]"){
- GIVEN("a range"){
- WHEN("ref_count is used"){
- auto published = rxs::range<int>(0, 3).publish().ref_count();
-
- std::vector<int> results;
- published.subscribe(
- // on_next
- [&](int v){
- results.push_back(v);
- },
- // on_completed
- [](){});
-
- std::vector<int> expected_results;
- expected_results.push_back(0);
- expected_results.push_back(1);
- expected_results.push_back(2);
- expected_results.push_back(3);
-
- CHECK(results == expected_results);
- }
- WHEN("ref_count(other) is used"){
- auto published = rxs::range<double>(0, 10).publish();
- auto map_to_int = published.map([](double v) { return (long) v; });
-
- // Ensures that 'ref_count(other)' has the source value type,
- // not the publisher's value type.
- auto with_ref_count = map_to_int.ref_count(published);
-
- std::vector<long> results;
-
- with_ref_count.subscribe(
- // on_next
- [&](long v){
- results.push_back(v);
- },
- // on_completed
- [](){});
-
- std::vector<long> expected_results;
- for (long i = 0; i <= 10; ++i) {
- expected_results.push_back(i);
- }
- CHECK(results == expected_results);
- }
- WHEN("ref_count(other) is used in a diamond"){
- auto source = rxs::range<double>(0, 3);
-
- int published_on_next_count = 0;
- // Ensure we only subscribe once to 'published' when its in a diamond.
- auto next = source.map(
- [&](double v) {
- published_on_next_count++;
- return v;
- }
- );
- auto published = next.publish();
-
- // Ensures that 'x.ref_count(other)' has the 'x' value type, not the other's value
- // type.
- auto map_to_int = published.map([](double v) { return (long) v; });
-
- auto left = map_to_int.map([](long v) { return v * 2; });
- auto right = map_to_int.map([](long v) { return v * 100; });
-
- auto merge = left.merge(right);
- auto with_ref_count = merge.ref_count(published);
-
- std::vector<long> results;
-
- with_ref_count.subscribe(
- // on_next
- [&](long v){
- results.push_back(v);
- },
- // on_completed
- [](){});
-
- // Ensure we only subscribe once to 'published' when its in a diamond.
- CHECK(published_on_next_count == 4);
-
- std::vector<long> expected_results;
- expected_results.push_back(0);
- expected_results.push_back(0);
- expected_results.push_back(2);
- expected_results.push_back(100);
- expected_results.push_back(4);
- expected_results.push_back(200);
- expected_results.push_back(6);
- expected_results.push_back(300);
-
- // Ensure left,right is interleaved without being biased towards one side.
- CHECK(results == expected_results);
- }
- }
-}
-
-SCENARIO("publish basic", "[publish][multicast][subject][operators]"){
- GIVEN("a test hot observable of longs"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 7),
- on.next(220, 3),
- on.next(280, 4),
- on.next(290, 1),
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 13),
- on.next(430, 2),
- on.next(450, 9),
- on.next(520, 11),
- on.next(560, 20),
- on.completed(600)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.publish().as_dynamic();
- //ys = xs.publish_last().as_dynamic();
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time,
- [&ys, &res](const rxsc::schedulable&){
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [&res](const rxsc::schedulable&){
- res.unsubscribe();
- });
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(300,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(400,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(500,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(550,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(650,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(800,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(520, 11)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 3 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400),
- on.subscribe(500, 550),
- on.subscribe(650, 800)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-
-SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){
- GIVEN("a test hot observable of longs"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("publish on_error");
-
- auto xs = sc.make_hot_observable({
- on.next(110, 7),
- on.next(220, 3),
- on.next(280, 4),
- on.next(290, 1),
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 13),
- on.next(430, 2),
- on.next(450, 9),
- on.next(520, 11),
- on.next(560, 20),
- on.error(600, ex)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.publish().as_dynamic();
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time,
- [&ys, &res](const rxsc::schedulable&){
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [&res](const rxsc::schedulable&){
- res.unsubscribe();
- });
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(300,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(400,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(500,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(800,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(520, 11),
- on.next(560, 20),
- on.error(600, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 3 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400),
- on.subscribe(500, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("publish basic with initial value", "[publish][multicast][behavior][operators]"){
- GIVEN("a test hot observable of longs"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 7),
- on.next(220, 3),
- on.next(280, 4),
- on.next(290, 1),
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 13),
- on.next(430, 2),
- on.next(450, 9),
- on.next(520, 11),
- on.next(560, 20),
- on.completed(600)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.publish(1979).as_dynamic();
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time,
- [&ys, &res](const rxsc::schedulable&){
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [&res](const rxsc::schedulable&){
- res.unsubscribe();
- });
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(300,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(400,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(500,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(550,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(650,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(800,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(200, 1979),
- on.next(340, 8),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(520, 11)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 3 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400),
- on.subscribe(500, 550),
- on.subscribe(650, 800)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/reduce.cpp b/Rx/v2/test/operators/reduce.cpp
deleted file mode 100644
index 46ad3cd..0000000
--- a/Rx/v2/test/operators/reduce.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-reduce.hpp"
-
-SCENARIO("reduce some data with seed", "[reduce][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 42;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 0),
- on.next(220, 1),
- on.next(230, 2),
- on.next(240, 3),
- on.next(250, 4),
- on.completed(260)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .reduce(seed,
- [](int sum, int x) {
- return sum + x;
- },
- [](int sum) {
- return sum * 5;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(260, (seed + 0 + 1 + 2 + 3 + 4) * 5),
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 260)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("accumulate some data with seed", "[accumulate][reduce][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 42;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 0),
- on.next(220, 1),
- on.next(230, 2),
- on.next(240, 3),
- on.next(250, 4),
- on.completed(260)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .accumulate(seed,
- [](int sum, int x) {
- return sum + x;
- },
- [](int sum) {
- return sum * 5;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(260, (seed + 0 + 1 + 2 + 3 + 4) * 5),
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 260)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("average some data", "[reduce][average][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<double> d_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 3),
- on.next(220, 4),
- on.next(230, 2),
- on.completed(250)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs.average();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- d_on.next(250, 3.0),
- d_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sum some data", "[reduce][sum][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 3),
- on.next(220, 4),
- on.next(230, 2),
- on.completed(250)
- });
-
- WHEN("sum is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.sum();
- }
- );
-
- THEN("the output contains the sum of source values"){
- auto required = rxu::to_vector({
- d_on.next(250, 9),
- d_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("max", "[reduce][max][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 3),
- on.next(220, 4),
- on.next(230, 2),
- on.completed(250)
- });
-
- WHEN("max is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.max();
- }
- );
-
- THEN("the output contains the max of source values"){
- auto required = rxu::to_vector({
- d_on.next(250, 4),
- d_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-// Does not work because calling max() on an empty stream throws an exception
-// which will crash when exceptions are disabled.
-//
-// TODO: the max internal implementation should be rewritten not to throw exceptions.
-SCENARIO("max, empty", "[reduce][max][operators][!throws]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- std::runtime_error ex("max on_error");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("max is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.max();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- d_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("max, error", "[reduce][max][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- std::runtime_error ex("max on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("max is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.max();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- d_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("min", "[reduce][min][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 3),
- on.next(220, 4),
- on.next(230, 2),
- on.completed(250)
- });
-
- WHEN("min is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.min();
- }
- );
-
- THEN("the output contains the min of source values"){
- auto required = rxu::to_vector({
- d_on.next(250, 2),
- d_on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-// Does not work with exceptions disabled, min will throw when stream is empty
-// and this crashes immediately.
-// TODO: min implementation should be rewritten not to throw exceptions.
-SCENARIO("min, empty", "[reduce][min][operators][!throws]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- std::runtime_error ex("min on_error");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("min is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.min();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- d_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("min, error", "[reduce][min][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<int> d_on;
-
- std::runtime_error ex("min on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("min is calculated"){
-
- auto res = w.start(
- [&]() {
- return xs.min();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- d_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/repeat.cpp b/Rx/v2/test/operators/repeat.cpp
deleted file mode 100644
index 0aa9598..0000000
--- a/Rx/v2/test/operators/repeat.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-repeat.hpp"
-
-
-SCENARIO("repeat, basic test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3),
- on.completed(250)
- });
-
- WHEN("infinite repeat is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::repeat()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains 3 sets of ints"){
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(350, 2),
- on.next(400, 3),
- on.next(550, 1),
- on.next(600, 2),
- on.next(650, 3),
- on.next(800, 1),
- on.next(850, 2),
- on.next(900, 3)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 4 subscriptions and 4 unsubscriptions to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 450),
- on.subscribe(450, 700),
- on.subscribe(700, 950),
- on.subscribe(950, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("repeat, 0 times case", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3),
- on.completed(250)
- });
-
- WHEN("repeat zero times is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::repeat(0)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output should be empty"){
- auto required = rxu::to_vector({
- on.completed(200)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("no subscriptions in repeat(0) variant that skips on.next()"){
- auto required = std::vector<rxcpp::notifications::subscription>();
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("repeat, infinite observable test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints that never completes."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3)
- });
-
- WHEN("infinite repeat is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains a set of ints"){
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(350, 2),
- on.next(400, 3)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription and 1 unsubscription to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("repeat, error test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints followed by an error."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("repeat on_error from source");
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3),
- on.error(250, ex)
- });
-
- WHEN("infinite repeat is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains a set of ints and an error"){
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(350, 2),
- on.next(400, 3),
- on.error(450, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription and 1 unsubscription to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 450)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("countable repeat, basic test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(5, 1),
- on.next(10, 2),
- on.next(15, 3),
- on.completed(20)
- });
-
- WHEN("repeat of 3 iterations is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains 3 sets of ints"){
- auto required = rxu::to_vector({
- on.next(205, 1),
- on.next(210, 2),
- on.next(215, 3),
- on.next(225, 1),
- on.next(230, 2),
- on.next(235, 3),
- on.next(245, 1),
- on.next(250, 2),
- on.next(255, 3),
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 3 subscriptions and 3 unsubscriptions to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220),
- on.subscribe(220, 240),
- on.subscribe(240, 260)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("countable repeat, dispose test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(5, 1),
- on.next(10, 2),
- on.next(15, 3),
- on.completed(20)
- });
-
- WHEN("repeat of 3 iterations is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 231
- );
-
- THEN("the output contains less than 2 full sets of ints"){
- auto required = rxu::to_vector({
- on.next(205, 1),
- on.next(210, 2),
- on.next(215, 3),
- on.next(225, 1),
- on.next(230, 2),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 2 subscriptions and 2 unsubscriptions to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220),
- on.subscribe(220, 231)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("countable repeat, infinite observable test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints that never completes."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3)
- });
-
- WHEN("infinite repeat is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains a set of ints"){
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(350, 2),
- on.next(400, 3)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription and 1 unsubscription to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("countable repeat, error test", "[repeat][operators]"){
- GIVEN("cold observable of 3 ints followed by an error."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("repeat on_error from source");
-
- auto xs = sc.make_cold_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3),
- on.error(250, ex)
- });
-
- WHEN("infinite repeat is launched"){
-
- auto res = w.start(
- [&]() {
- return xs
- .repeat(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains a set of ints and an error"){
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(350, 2),
- on.next(400, 3),
- on.error(450, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription and 1 unsubscription to the ints"){
- auto required = rxu::to_vector({
- on.subscribe(200, 450)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/replay.cpp b/Rx/v2/test/operators/replay.cpp
deleted file mode 100644
index 62ab372..0000000
--- a/Rx/v2/test/operators/replay.cpp
+++ /dev/null
@@ -1,698 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-replay.hpp>
-
-SCENARIO("replay basic", "[replay][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(600)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.replay().as_dynamic();
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time,
- [&ys, &res](const rxsc::schedulable&){
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [&res](const rxsc::schedulable&){
- res.unsubscribe();
- });
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(300,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(400,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(500,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(550,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(650,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(800,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(520, 11)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 3 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400),
- on.subscribe(500, 550),
- on.subscribe(650, 800)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("replay error", "[replay][error][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("publish on_error");
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.error(600, ex)
- });
-
- auto res = w.make_subscriber<int>();
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.replay().as_dynamic();
- });
-
- w.schedule_absolute(rxsc::test::subscribed_time,
- [&ys, &res](const rxsc::schedulable&){
- ys.subscribe(res);
- });
-
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [&res](const rxsc::schedulable&){
- res.unsubscribe();
- });
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(300,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(400,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- {
- rx::composite_subscription connection;
-
- w.schedule_absolute(500,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(800,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
- }
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(520, 11),
- on.next(560, 12),
- on.error(600, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 2 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400),
- on.subscribe(500, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("replay multiple subscriptions", "[replay][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- // Create connectable observable
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.replay().as_dynamic();
- });
-
- // Manage connection
- rx::composite_subscription connection;
- w.schedule_absolute(rxsc::test::subscribed_time,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
-
- // Subscribe before the first item emitted
- auto res1 = w.make_subscriber<int>();
- w.schedule_absolute(200, [&ys, &res1](const rxsc::schedulable&){ys.subscribe(res1);});
-
- // Subscribe in the middle of emitting
- auto res2 = w.make_subscriber<int>();
- w.schedule_absolute(400, [&ys, &res2](const rxsc::schedulable&){ys.subscribe(res2);});
-
- // Subscribe after the last item emitted
- auto res3 = w.make_subscriber<int>();
- w.schedule_absolute(600, [&ys, &res3](const rxsc::schedulable&){ys.subscribe(res3);});
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(400, 1),
- on.next(400, 2),
- on.next(400, 3),
- on.next(400, 4),
- on.next(400, 5),
- on.next(400, 6),
- on.next(400, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(600, 1),
- on.next(600, 2),
- on.next(600, 3),
- on.next(600, 4),
- on.next(600, 5),
- on.next(600, 6),
- on.next(600, 7),
- on.next(600, 8),
- on.next(600, 9),
- on.next(600, 10),
- on.next(600, 11),
- on.next(600, 12),
- on.completed(650)
- });
- auto actual = res3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 650)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("replay multiple subscriptions with count", "[replay][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
-
- // Create connectable observable
- w.schedule_absolute(rxsc::test::created_time,
- [&ys, &xs](const rxsc::schedulable&){
- ys = xs.replay(3).as_dynamic();
- });
-
- // Manage connection
- rx::composite_subscription connection;
- w.schedule_absolute(rxsc::test::subscribed_time,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
-
- // Subscribe before the first item emitted
- auto res1 = w.make_subscriber<int>();
- w.schedule_absolute(200, [&ys, &res1](const rxsc::schedulable&){ys.subscribe(res1);});
-
- // Subscribe in the middle of emitting
- auto res2 = w.make_subscriber<int>();
- w.schedule_absolute(400, [&ys, &res2](const rxsc::schedulable&){ys.subscribe(res2);});
-
- // Subscribe after the last item emitted
- auto res3 = w.make_subscriber<int>();
- w.schedule_absolute(600, [&ys, &res3](const rxsc::schedulable&){ys.subscribe(res3);});
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 1),
- on.next(280, 2),
- on.next(290, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(400, 5),
- on.next(400, 6),
- on.next(400, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(600, 10),
- on.next(600, 11),
- on.next(600, 12),
- on.completed(650)
- });
- auto actual = res3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 650)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("replay multiple subscriptions with time", "[replay][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- auto so = rx::identity_one_worker(sc);
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(240, 2),
- on.next(260, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
- using namespace std::chrono;
-
- // Create connectable observable
- w.schedule_absolute(rxsc::test::created_time,
- [&](const rxsc::schedulable&){
- ys = xs.replay(milliseconds(100), so).as_dynamic();
- });
-
- // Manage connection
- rx::composite_subscription connection;
- w.schedule_absolute(rxsc::test::subscribed_time,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
-
- // Subscribe before the first item emitted
- auto res1 = w.make_subscriber<int>();
- w.schedule_absolute(200, [&ys, &res1](const rxsc::schedulable&){ys.subscribe(res1);});
-
- // Subscribe in the middle of emitting
- auto res2 = w.make_subscriber<int>();
- w.schedule_absolute(400, [&ys, &res2](const rxsc::schedulable&){ys.subscribe(res2);});
-
- // Subscribe after the last item emitted
- auto res3 = w.make_subscriber<int>();
- w.schedule_absolute(600, [&ys, &res3](const rxsc::schedulable&){ys.subscribe(res3);});
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 1),
- on.next(240, 2),
- on.next(260, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(400, 4),
- on.next(400, 5),
- on.next(400, 6),
- on.next(400, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(600, 11),
- on.next(600, 12),
- on.completed(650)
- });
- auto actual = res3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 650)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("replay multiple subscriptions with count and time", "[replay][multicast][subject][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- auto so = rx::identity_one_worker(sc);
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 0),
- on.next(220, 1),
- on.next(240, 2),
- on.next(260, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
-
- rx::connectable_observable<int> ys;
-
- WHEN("subscribed and then connected"){
- using namespace std::chrono;
-
- // Create connectable observable
- w.schedule_absolute(rxsc::test::created_time,
- [&](const rxsc::schedulable&){
- ys = xs.replay(3, milliseconds(100), so).as_dynamic();
- });
-
- // Manage connection
- rx::composite_subscription connection;
- w.schedule_absolute(rxsc::test::subscribed_time,
- [connection, &ys](const rxsc::schedulable&){
- ys.connect(connection);
- });
- w.schedule_absolute(rxsc::test::unsubscribed_time,
- [connection](const rxsc::schedulable&){
- connection.unsubscribe();
- });
-
- // Subscribe before the first item emitted
- auto res1 = w.make_subscriber<int>();
- w.schedule_absolute(200, [&ys, &res1](const rxsc::schedulable&){ys.subscribe(res1);});
-
- // Subscribe in the middle of emitting
- auto res2 = w.make_subscriber<int>();
- w.schedule_absolute(400, [&ys, &res2](const rxsc::schedulable&){ys.subscribe(res2);});
-
- // Subscribe after the last item emitted
- auto res3 = w.make_subscriber<int>();
- w.schedule_absolute(600, [&ys, &res3](const rxsc::schedulable&){ys.subscribe(res3);});
-
- w.start();
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 1),
- on.next(240, 2),
- on.next(260, 3),
- on.next(340, 4),
- on.next(360, 5),
- on.next(370, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(400, 5),
- on.next(400, 6),
- on.next(400, 7),
- on.next(410, 8),
- on.next(430, 9),
- on.next(450, 10),
- on.next(520, 11),
- on.next(560, 12),
- on.completed(650)
- });
- auto actual = res2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(600, 11),
- on.next(600, 12),
- on.completed(650)
- });
- auto actual = res3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 650)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/retry.cpp b/Rx/v2/test/operators/retry.cpp
deleted file mode 100644
index c3d2aa6..0000000
--- a/Rx/v2/test/operators/retry.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-retry.hpp"
-
-SCENARIO("retry, basic test", "[retry][operators]") {
- GIVEN("hot observable of 3x4x7 ints with errors inbetween the groups. Infinite retry.") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- std::runtime_error ex("retry on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(300, 1),
- on.next(325, 2),
- on.next(350, 3),
- on.error(400, ex),
- on.next(425, 1),
- on.next(450, 2),
- on.next(475, 3),
- on.next(500, 4),
- on.error(525, ex),
- on.next(550, 1),
- on.next(575, 2),
- on.next(600, 3),
- on.next(625, 4),
- on.next(650, 5),
- on.next(675, 6),
- on.next(700, 7),
- on.completed(725)
- });
-
- WHEN("infinite retry is launched") {
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::retry()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains all the data until complete") {
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(325, 2),
- on.next(350, 3),
- on.next(425, 1),
- on.next(450, 2),
- on.next(475, 3),
- on.next(500, 4),
- on.next(550, 1),
- on.next(575, 2),
- on.next(600, 3),
- on.next(625, 4),
- on.next(650, 5),
- on.next(675, 6),
- on.next(700, 7),
- on.completed(725)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there were 3 subscriptions and 3 unsubscriptions to the ints") {
- auto required = rxu::to_vector({
- on.subscribe(200, 400),
- on.subscribe(400, 525),
- on.subscribe(525, 725)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("retry 0, basic test", "[retry][operators]") {
- GIVEN("hot observable of 3 ints. Infinite retry.") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- std::runtime_error ex("retry on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(150, 2),
- on.next(200, 3),
- });;
-
- WHEN("retry is invoked with 0 times as argument") {
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::retry(0)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output should be empty"){
- auto required = rxu::to_vector({
- on.completed(200)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("no subscriptions in retry(0)"){
- auto required = std::vector<rxcpp::notifications::subscription>();
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
-
- }
-}
-
-
-SCENARIO("retry with failure", "[retry][operators]") {
- GIVEN("hot observable of 3x4x7 ints with errors inbetween the groups. Retry 2. Must fail.") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- std::runtime_error ex("retry on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(300, 1),
- on.next(325, 2),
- on.next(350, 3),
- on.error(400, ex),
- on.next(425, 1),
- on.next(450, 2),
- on.next(475, 3),
- on.next(500, 4),
- on.error(525, ex),
- on.next(550, 1),
- on.next(575, 2),
- on.next(600, 3),
- on.next(625, 4),
- on.next(650, 5),
- on.next(675, 6),
- on.next(700, 7),
- on.completed(725)
- });
-
- WHEN("retry of 2 is launched with expected error before complete") {
-
- auto res = w.start(
- [&]() {
- return xs
- .retry(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- });
-
- THEN("The output contains all the data until retry fails") {
- auto required = rxu::to_vector({
- on.next(300, 1),
- on.next(325, 2),
- on.next(350, 3),
- on.next(425, 1),
- on.next(450, 2),
- on.next(475, 3),
- on.next(500, 4),
- on.error(525, ex),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(actual == required);
- }
-
- THEN("There were 2 subscriptions and 2 unsubscriptions to the ints") {
- auto required = rxu::to_vector({
- on.subscribe(200, 400),
- on.subscribe(400, 525)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-
diff --git a/Rx/v2/test/operators/sample.cpp b/Rx/v2/test/operators/sample.cpp
deleted file mode 100644
index 7c49ac3..0000000
--- a/Rx/v2/test/operators/sample.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-sample_time.hpp"
-
-SCENARIO("sample with time, error", "[sample_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("sample_with_time on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
- WHEN("group ints on intersecting intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::sample_with_time(milliseconds(100), so)
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- on.next(301, 4),
- on.next(401, 7),
- on.next(501, 9),
- on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sample with time, disposed", "[sample_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4), //
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intersecting intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .sample_with_time(milliseconds(100), so)
- .as_dynamic();
- },
- 370
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- on.next(301, 4),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 371)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sample with time, same", "[sample_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::vector<int>> v_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- WHEN("group ints on intervals"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .sample_with_time(milliseconds(100), so)
- .as_dynamic();
- }
- );
-
- THEN("the output contains groups of ints"){
- auto required = rxu::to_vector({
- on.next(301, 4),
- on.next(401, 7),
- on.next(501, 9),
- on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the xs"){
- auto required = rxu::to_vector({
- on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp
deleted file mode 100644
index 1cb38a5..0000000
--- a/Rx/v2/test/operators/scan.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-take.hpp>
-#include <rxcpp/operators/rx-scan.hpp>
-
-SCENARIO("scan: issue 41", "[scan][operators][issue][!hide]"){
- GIVEN("map of scan of interval"){
- auto sc = rxsc::make_current_thread();
- auto so = rxcpp::synchronize_in_one_worker(sc);
- auto start = sc.now() + std::chrono::seconds(2);
- auto period = std::chrono::seconds(1);
-
- rxcpp::observable<>::interval(start, period, so)
- .scan(0, [] (int a, int i) { return a + i; })
- .map([] (int i) { return i * i; })
- .take(10)
- .subscribe([] (int i) { std::cout << i << std::endl; });
-
- }
-}
-
-SCENARIO("scan: seed, never", "[scan][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::scan(seed, [](int sum, int x) {
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scan: seed, empty", "[scan][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .scan(seed, [](int sum, int x) {
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scan: seed, return", "[scan][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.completed(250)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .scan(seed, [](int sum, int x) {
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(220, seed + 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scan: seed, throw", "[scan][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- std::runtime_error ex("scan on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .scan(seed, [](int sum, int x) {
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on error"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scan: seed, some data", "[scan][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .scan(seed, [](int sum, int x) {
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, seed + 2),
- on.next(220, seed + 2 + 3),
- on.next(230, seed + 2 + 3 + 4),
- on.next(240, seed + 2 + 3 + 4 + 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scan: seed, accumulator throws", "[scan][operators][!throws]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int seed = 1;
-
- std::runtime_error ex("scan on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("mapped to ints that are one larger"){
-
- auto res = w.start(
- [&]() {
- return xs
- .scan(seed, [&](int sum, int x) {
- if (x == 4) {
- rxu::throw_exception(ex);
- }
- return sum + x;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on error"){
- auto required = rxu::to_vector({
- on.next(210, seed + 2),
- on.next(220, seed + 2 + 3),
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/sequence_equal.cpp b/Rx/v2/test/operators/sequence_equal.cpp
deleted file mode 100644
index 6ada320..0000000
--- a/Rx/v2/test/operators/sequence_equal.cpp
+++ /dev/null
@@ -1,862 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-sequence_equal.hpp"
-
-SCENARIO("sequence_equal - source never emits", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(200, 2),
- on.next(300, 3),
- on.next(400, 4),
- on.next(500, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- | rxo::sequence_equal(ys)
- | rxo::as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - other source never emits", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both sources never emit any items", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 0),
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<bool>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both sources emit the same sequence of items", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains true"){
- auto required = rxu::to_vector({
- o_on.next(610, true),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - first source emits less items than the second one", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(610, false),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - second source emits less items than the first one", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(610, false),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - sources emit different sequence of items", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 9), //
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(330, false),
- o_on.completed(330)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 330)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - sources emit items in a different order", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 4),
- on.next(440, 3),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(330, false),
- o_on.completed(330)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 330)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - source observable is empty", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.completed(250)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(330, false),
- o_on.completed(330)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - other observable is empty", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.completed(400)
- });
-
- auto ys = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(310, false),
- o_on.completed(310)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 310)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both observables are empty", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.completed(400)
- });
-
- auto ys = sc.make_hot_observable({
- on.completed(250)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains false"){
- auto required = rxu::to_vector({
- o_on.next(400, true),
- o_on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - source observable emits an error", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- std::runtime_error ex("sequence_equal error");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- o_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - other observable emits an error", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- std::runtime_error ex("sequence_equal error");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.completed(400)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- o_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both observables emit errors", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- std::runtime_error ex("sequence_equal error1");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(250, ex)
- });
-
- auto ys = sc.make_hot_observable({
- on.error(300, ex)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys)
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains an error"){
- auto required = rxu::to_vector({
- o_on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both sources emit the same sequence of items, custom comparing function", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys, [](int x, int y) { return x == y; })
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains true"){
- auto required = rxu::to_vector({
- o_on.next(610, true),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both sources emit the same sequence of items, custom coordinator", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys, rxcpp::identity_one_worker(rxsc::make_current_thread()))
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains true"){
- auto required = rxu::to_vector({
- o_on.next(610, true),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("sequence_equal - both sources emit the same sequence of items, custom comparing function and coordinator", "[sequence_equal][operators]"){
- GIVEN("two sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(310, 3),
- on.next(410, 4),
- on.next(510, 5),
- on.completed(610)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 2),
- on.next(330, 3),
- on.next(440, 4),
- on.next(550, 5),
- on.completed(600)
- });
-
- WHEN("two observables are checked for equality"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .sequence_equal(ys, [](int x, int y) { return x == y; }, rxcpp::identity_one_worker(rxsc::make_current_thread()))
- .as_dynamic(); // forget type to workaround lambda deduction bug on msvc 2013
- }
- );
-
- THEN("the output contains true"){
- auto required = rxu::to_vector({
- o_on.next(610, true),
- o_on.completed(610)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 610)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/skip.cpp b/Rx/v2/test/operators/skip.cpp
deleted file mode 100644
index 383e855..0000000
--- a/Rx/v2/test/operators/skip.cpp
+++ /dev/null
@@ -1,633 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-skip.hpp"
-
-SCENARIO("skip, complete after", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("more values than generated are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(20)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, complete same", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("exact number of values is skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::skip(17)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, complete before", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("part of values is skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(10)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, complete zero", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("no values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(0)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, error after", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("more values than generated are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(20)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains only error message"){
- auto required = rxu::to_vector({
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, error same", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("exact number of values is skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(17)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains only error message"){
- auto required = rxu::to_vector({
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, error before", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("part of values is skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, dispose before", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("all generated values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 250
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, dispose after", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("some generated values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip, consecutive", "[skip][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.completed(400)
- });
-
- WHEN("3+2 values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip(3)
- .skip(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/skip_last.cpp b/Rx/v2/test/operators/skip_last.cpp
deleted file mode 100644
index 7da7aee..0000000
--- a/Rx/v2/test/operators/skip_last.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-skip_last.hpp>
-
-SCENARIO("skip last 0", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("0 last values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::skip_last(0)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains the completion event"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip last 1", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("1 last value is skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_last(1)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(220, 2),
- on.next(230, 3),
- on.next(240, 4),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip last 2", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("2 last values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(230, 2),
- on.next(240, 3),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip last 10, complete before all elements are skipped", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("10 last values are skipped"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_last(10)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("no items to skip_last", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("2 last values are skipped"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .skip_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_last, source observable emits an error", "[skip_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("2 last values are skipped"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .skip_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error message"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/skip_until.cpp b/Rx/v2/test/operators/skip_until.cpp
deleted file mode 100644
index 9bd49aa..0000000
--- a/Rx/v2/test/operators/skip_until.cpp
+++ /dev/null
@@ -1,610 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-skip_until.hpp>
-
-SCENARIO("skip_until, some data next", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(225, 99),
- on.completed(230)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- | rxo::skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, some data error", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.error(225, ex)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains error message"){
- auto required = rxu::to_vector({
- on.error(225, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, error some data", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(230, 3),
- on.completed(250)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, some data empty", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(225)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, never next", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(225, 2),
- on.completed(250)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, never error", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.error(225, ex)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains error message"){
- auto required = rxu::to_vector({
- on.error(225, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, some data error after completed", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.error(300, ex)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains error message"){
- auto required = rxu::to_vector({
- on.error(300, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, some data never", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, never empty", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(225)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until, never never", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [&]() {
- return l
- .skip_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("skip_until time point, some data next", "[skip_until][skip][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto t = sc.to_time_point(225);
-
- WHEN("invoked with a time point"){
-
- auto res = w.start(
- [&]() {
- return l
- | rxo::skip_until(t, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(231, 4),
- on.next(241, 5),
- on.completed(251)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Rx/v2/test/operators/skip_while.cpp b/Rx/v2/test/operators/skip_while.cpp
deleted file mode 100644
index cc773b1..0000000
--- a/Rx/v2/test/operators/skip_while.cpp
+++ /dev/null
@@ -1,434 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-skip_while.hpp>
-
-namespace {
- class not_equal_to {
- int value;
- public:
- not_equal_to(int value) : value(value) { }
- bool operator()(int i) const {
- return i != value;
- }
- };
-}
-
-SCENARIO("skip_while not equal to 4", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("values before 4 are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(4))
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, complete after", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("none are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(0))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains no items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, complete before", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("7 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(72))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, error after", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_while on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("no values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(0))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed and the error"){
- auto required = rxu::to_vector({
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, error before", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("skip_while on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.error(500, ex),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("only one value is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(72))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(460, 72),
- on.error(500, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 500)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, dispose before", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 100),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(100))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 250
- );
-
- THEN("the output only contains items sent while subscribed"){
- std::vector<rxcpp::notifications::recorded<std::shared_ptr<rxcpp::notifications::detail::notification_base<int> > > > required;
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("skip_while, dispose after", "[skip_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4), //this is skipped due to delayed subscription
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("5 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .skip_while(not_equal_to(1))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/start_with.cpp b/Rx/v2/test/operators/start_with.cpp
deleted file mode 100644
index ef192b3..0000000
--- a/Rx/v2/test/operators/start_with.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-start_with.hpp>
-
-SCENARIO("start_with - source never emits or completes", "[start_with][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("start_with one value"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::start_with(1)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains start_with value"){
- auto required = rxu::to_vector({
- on.next(200, 1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("start_with - source completes without emitting items", "[start_with][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("start_with one value"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .start_with(5)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains start_with item and complete message"){
- auto required = rxu::to_vector({
- on.next(200, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("start_with - source emits and completes", "[start_with][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("start_with one value"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .start_with(5)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains start_with item and the items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(200, 5),
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("start_with - sources terminates with an error", "[start_with][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("start_with on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("start_with one value"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .start_with(5)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains start_with item and an error"){
- auto required = rxu::to_vector({
- on.next(200, 5),
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("start_with several items - source emits and completes", "[start_with][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(250)
- });
-
- WHEN("start_with one value"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .start_with(5, 6)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains start_with item and the items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(200, 5),
- on.next(200, 6),
- on.next(210, 2),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/subscribe_on.cpp b/Rx/v2/test/operators/subscribe_on.cpp
deleted file mode 100644
index ef8a8c7..0000000
--- a/Rx/v2/test/operators/subscribe_on.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-subscribe_on.hpp>
-#include <rxcpp/operators/rx-observe_on.hpp>
-
-#include <sstream>
-
-static const int static_subscriptions = 50000;
-
-SCENARIO("for loop subscribes to map with subscribe_on and observe_on", "[!hide][for][just][subscribe][subscribe_on][observe_on][long][perf]"){
- const int& subscriptions = static_subscriptions;
- GIVEN("a for loop"){
- WHEN("subscribe 50K times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- int runs = 10;
-
- for (;runs > 0; --runs) {
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- for (int i = 0; i < subscriptions; ++i) {
- c += rx::observable<>::just(1)
- .map([](int i) {
- std::stringstream serializer;
- serializer << i;
- return serializer.str();
- })
- .map([](const std::string& s) {
- int i;
- std::stringstream(s) >> i;
- return i;
- })
- .subscribe_on(rx::observe_on_event_loop())
- .observe_on(rx::observe_on_event_loop())
- .as_blocking()
- .count();
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- REQUIRE(subscriptions == c);
- std::cout << "loop subscribe map subscribe_on observe_on : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
- }
-}
-
-SCENARIO("for loop subscribes to map with subscribe_on", "[!hide][subscribe_on_only][for][just][subscribe][subscribe_on][long][perf]"){
- const int& subscriptions = static_subscriptions;
- GIVEN("a for loop"){
- WHEN("subscribe 50K times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- int runs = 10;
-
- for (;runs > 0; --runs) {
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
-
- for (int i = 0; i < subscriptions; ++i) {
- c += rx::observable<>::
- just(1).
- map([](int i) {
- std::stringstream serializer;
- serializer << i;
- return serializer.str();
- }).
- map([](const std::string& s) {
- int i;
- std::stringstream(s) >> i;
- return i;
- }).
- subscribe_on(rx::observe_on_event_loop()).
- as_blocking().
- count();
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- REQUIRE(subscriptions == c);
- std::cout << "loop subscribe map subscribe_on : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
- }
-}
-
-SCENARIO("subscribe_on", "[subscribe][subscribe_on]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("subscribe_on is specified"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .subscribe_on(so);
- }
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(201, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("stream subscribe_on", "[subscribe][subscribe_on]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
-
- WHEN("subscribe_on is specified"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- | rxo::subscribe_on(so);
- }
- );
-
- THEN("the output contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.completed(300)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(201, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/switch_if_empty.cpp b/Rx/v2/test/operators/switch_if_empty.cpp
deleted file mode 100644
index b205858..0000000
--- a/Rx/v2/test/operators/switch_if_empty.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-switch_if_empty.hpp>
-
-SCENARIO("switch_if_empty should not switch if the source is not empty", "[switch_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys = sc.make_cold_observable({
- on.next(10, 2),
- on.completed(230)
- });
-
- auto xs = sc.make_hot_observable({
- on.next(210, 1),
- on.completed(250)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- | rxo::switch_if_empty(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains an item from the source") {
- auto required = rxu::to_vector({
- on.next(210, 1),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was no subscription/unsubscription to ys"){
- auto required = std::vector<rxn::subscription>();
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_if_empty should switch if the source is empty", "[switch_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys = sc.make_cold_observable({
- on.next(10, 2),
- on.completed(20)
- });
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .switch_if_empty(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains an item from the backup source") {
- auto required = rxu::to_vector({
- on.next(260, 2),
- on.completed(270)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys"){
- auto required = rxu::to_vector({
- on.subscribe(250, 270)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_if_empty - never", "[switch_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto ys = sc.make_cold_observable({
- on.next(10, 2),
- on.completed(20)
- });
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .switch_if_empty(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was no subscription/unsubscription to ys"){
- auto required = std::vector<rxn::subscription>();
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_if_empty - source throws", "[switch_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("switch_if_empty on_error from source");
-
- auto ys = sc.make_cold_observable({
- on.next(10, 2),
- on.completed(20)
- });
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .switch_if_empty(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains an error from the source"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was no subscription/unsubscription to ys"){
- auto required = std::vector<rxn::subscription>();
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_if_empty - backup source throws", "[switch_if_empty][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("switch_if_empty on_error from backup source");
-
- auto ys = sc.make_cold_observable({
- on.error(10, ex)
- });
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("started"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- .switch_if_empty(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains an error from the backup source"){
- auto required = rxu::to_vector({
- on.error(260, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys"){
- auto required = rxu::to_vector({
- on.subscribe(250, 260)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/switch_on_next.cpp b/Rx/v2/test/operators/switch_on_next.cpp
deleted file mode 100644
index f3515ba..0000000
--- a/Rx/v2/test/operators/switch_on_next.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-switch_on_next.hpp>
-
-SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.completed(150)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.next(500, ys3),
- o_on.completed(600)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::switch_on_next();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 201),
- on.next(420, 202),
- on.next(430, 203),
- on.next(440, 204),
- on.next(510, 301),
- on.next(520, 302),
- on.next(530, 303),
- on.next(540, 304),
- on.completed(650)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys2"){
- auto required = rxu::to_vector({
- on.subscribe(400, 450)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys3"){
- auto required = rxu::to_vector({
- on.subscribe(500, 650)
- });
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_on_next - inner throws", "[switch_on_next][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("switch_on_next on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.error(50, ex)
- });
-
- auto ys3 = sc.make_cold_observable({
- on.next(10, 301),
- on.next(20, 302),
- on.next(30, 303),
- on.next(40, 304),
- on.completed(150)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.next(500, ys3),
- o_on.completed(600)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.switch_on_next();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 201),
- on.next(420, 202),
- on.next(430, 203),
- on.next(440, 204),
- on.error(450, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 450)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys2"){
- auto required = rxu::to_vector({
- on.subscribe(400, 450)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys3"){
- auto required = std::vector<rxn::subscription>();
- auto actual = ys3.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_on_next - outer throws", "[switch_on_next][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("switch_on_next on_error from source");
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto ys2 = sc.make_cold_observable({
- on.next(10, 201),
- on.next(20, 202),
- on.next(30, 203),
- on.next(40, 204),
- on.completed(50)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.next(400, ys2),
- o_on.error(500, ex)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.switch_on_next();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 201),
- on.next(420, 202),
- on.next(430, 203),
- on.next(440, 204),
- on.error(500, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 500)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 400)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys2"){
- auto required = rxu::to_vector({
- on.subscribe(400, 450)
- });
- auto actual = ys2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_on_next - no inner", "[switch_on_next][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- o_on.completed(500)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.switch_on_next();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(500)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 500)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("switch_on_next - inner completes", "[switch_on_next][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto ys1 = sc.make_cold_observable({
- on.next(10, 101),
- on.next(20, 102),
- on.next(110, 103),
- on.next(120, 104),
- on.next(210, 105),
- on.next(220, 106),
- on.completed(230)
- });
-
- auto xs = sc.make_hot_observable({
- o_on.next(300, ys1),
- o_on.completed(540)
- });
-
- WHEN("distinct values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs.switch_on_next();
- }
- );
-
- THEN("the output only contains distinct items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(310, 101),
- on.next(320, 102),
- on.next(410, 103),
- on.next(420, 104),
- on.next(510, 105),
- on.next(520, 106),
- on.completed(540)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 540)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to ys1"){
- auto required = rxu::to_vector({
- on.subscribe(300, 530)
- });
- auto actual = ys1.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp
deleted file mode 100644
index 414acf2..0000000
--- a/Rx/v2/test/operators/take.cpp
+++ /dev/null
@@ -1,618 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-take.hpp>
-
-SCENARIO("take 2", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("2 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::take(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, complete after", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("20 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(20)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, complete same", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("17 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(17)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(630)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 630)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, complete before", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("10 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(10)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.completed(415)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 415)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, error after", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("take on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("20 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(20)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, error same", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, std::runtime_error("error in unsubscribed stream"))
- });
-
- WHEN("17 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(17)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(630)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 630)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, error before", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, std::runtime_error("error in unsubscribed stream"))
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.completed(270)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 270)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, dispose before", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 250
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take, dispose after", "[take][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take(3)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.completed(270)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 270)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
diff --git a/Rx/v2/test/operators/take_last.cpp b/Rx/v2/test/operators/take_last.cpp
deleted file mode 100644
index 76228f0..0000000
--- a/Rx/v2/test/operators/take_last.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-take_last.hpp>
-
-SCENARIO("take last 0", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("0 last values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::take_last(0)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains the completion event"){
- auto required = rxu::to_vector({
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take last 1", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("1 last value is taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_last(1)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(250, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take last 2", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("2 last values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(250, 4),
- on.next(250, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take last 10, complete before all elements are taken", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("10 last values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_last(10)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(250, 2),
- on.next(250, 3),
- on.next(250, 4),
- on.next(250, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("no items to take_last", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("2 last values are taken"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .take_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("take_last, source observable emits an error", "[take_last][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("2 last values are taken"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- .take_last(2)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error message"){
- auto required = rxu::to_vector({
- on.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/take_until.cpp b/Rx/v2/test/operators/take_until.cpp
deleted file mode 100644
index 93c5962..0000000
--- a/Rx/v2/test/operators/take_until.cpp
+++ /dev/null
@@ -1,794 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-take_until.hpp>
-
-SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(150, 1),
- on.next(225, 99),
- on.completed(230)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [xs, ys]() {
- return xs
- | rxo::take_until(ys)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = ys.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(225, 99),
- on.completed(230)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt some data error", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("take_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.error(225, ex)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.error(225, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(225)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(225, 2), //!
- on.completed(250)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("take_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.error(225, ex)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.error(225, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(225)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000 /* can't dispose prematurely, could be in flight to dispatch OnError */)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt before first produced", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(230, 2),
- on.completed(240)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), //!
- on.completed(220)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, preempt before first produced, remain silent and proper unsubscribed", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- bool sourceNotDisposed = false;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.error(215, std::runtime_error("error in unsubscribed stream")), // should not come
- on.completed(240)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2), //!
- on.completed(220)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r, &sourceNotDisposed]() {
- return l
- .map([&sourceNotDisposed](int v){sourceNotDisposed = true; return v; })
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("signal disposed"){
- auto required = false;
- auto actual = sourceNotDisposed;
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- bool signalNotDisposed = false;
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.next(230, 2),
- on.completed(240)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(250, 2),
- on.completed(260)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r, &signalNotDisposed]() {
- return l
- .take_until(r
- .map([&signalNotDisposed](int v){signalNotDisposed = true; return v; }))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(230, 2),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("signal disposed"){
- auto required = false;
- auto actual = signalNotDisposed;
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until, error some", "[take_until][take][operators]"){
- GIVEN("2 sources"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("take_until on_error from source");
-
- auto l = sc.make_hot_observable({
- on.next(150, 1),
- on.error(225, ex)
- });
-
- auto r = sc.make_hot_observable({
- on.next(150, 1),
- on.next(240, 2)
- });
-
- WHEN("one is taken until the other emits a marble"){
-
- auto res = w.start(
- [l, r]() {
- return l
- .take_until(r)
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.error(225, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = l.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the trigger"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = r.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_until trigger on time point", "[take_until][take][operators]"){
- GIVEN("a source and a time point"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- auto t = sc.to_time_point(225);
-
- WHEN("invoked with a time point"){
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::take_until(t, so)
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(221, 3),
- on.completed(226)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 226)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/take_while.cpp b/Rx/v2/test/operators/take_while.cpp
deleted file mode 100644
index 68b5fc0..0000000
--- a/Rx/v2/test/operators/take_while.cpp
+++ /dev/null
@@ -1,550 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-take_while.hpp>
-
-namespace {
- class not_equal_to {
- int value;
- public:
- not_equal_to(int value) : value(value) { }
- bool operator()(int i) const {
- return i != value;
- }
- };
-}
-
-SCENARIO("take_while not equal to 4", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(220, 3),
- on.next(230, 4),
- on.next(240, 5),
- on.completed(250)
- });
-
- WHEN("values before 4 are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(4))
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(220, 3),
- on.completed(230)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, complete after", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("all are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(0))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, complete before", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.completed(690)
- });
-
- WHEN("10 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(72))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.completed(460)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 460)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, error after", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("take_while on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
-
- WHEN("all values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(0))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed and the error"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 690)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, error same", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, std::runtime_error("error in unsubscribed stream"))
- });
-
- WHEN("all but one values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(10))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.completed(630)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 630)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, error before", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10),
- on.error(690, std::runtime_error("error in unsubscribed stream"))
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(1))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.completed(280)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 280)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, dispose before", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(100))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 250
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("take_while, dispose after", "[take_while][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 6),
- on.next(150, 4),
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.next(280, 1),
- on.next(300, -1),
- on.next(310, 3),
- on.next(340, 8),
- on.next(370, 11),
- on.next(410, 15),
- on.next(415, 16),
- on.next(460, 72),
- on.next(510, 76),
- on.next(560, 32),
- on.next(570, -100),
- on.next(580, -3),
- on.next(590, 5),
- on.next(630, 10)
- });
-
- WHEN("3 values are taken"){
-
- auto res = w.start(
- [xs]() {
- return xs
- .take_while(not_equal_to(1))
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 400
- );
-
- THEN("the output only contains items sent while subscribed"){
- auto required = rxu::to_vector({
- on.next(210, 9),
- on.next(230, 13),
- on.next(270, 7),
- on.completed(280)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 280)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
diff --git a/Rx/v2/test/operators/tap.cpp b/Rx/v2/test/operators/tap.cpp
deleted file mode 100644
index c9e8317..0000000
--- a/Rx/v2/test/operators/tap.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-tap.hpp>
-
-SCENARIO("tap stops on completion", "[tap][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- WHEN("on_next is tapped"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- | rxo::tap([&invoked](int) {
- invoked++;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.next(350, 5),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("tap on_next was called until completed"){
- REQUIRE(4 == invoked);
- }
- }
- }
-}
-
-SCENARIO("tap stops on error", "[tap][operators]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- std::runtime_error ex("tap on_error from source");
- long invoked = 0;
-
- auto xs = sc.make_hot_observable({
- on.next(180, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.error(300, ex),
- on.next(350, 5),
- on.completed(400),
- on.next(410, -1),
- on.completed(420),
- on.error(430, std::runtime_error("error on unsubscribed stream"))
- });
-
- WHEN("on_error is tapped"){
-
- auto res = w.start(
- [xs, &invoked]() {
- return xs
- .tap([&invoked](rxu::error_ptr) {
- invoked++;
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(290, 4),
- on.error(300, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 300)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("tap on_next was called until completed"){
- REQUIRE(1 == invoked);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/time_interval.cpp b/Rx/v2/test/operators/time_interval.cpp
deleted file mode 100644
index aa5f476..0000000
--- a/Rx/v2/test/operators/time_interval.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-time_interval.hpp"
-
-using namespace std::chrono;
-
-SCENARIO("should not emit time intervals if the source never emits any items", "[time_interval][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type::time_point::duration duration;
-
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("time_interval operator is invoked"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::time_interval();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<duration>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("should not emit time intervals if the source observable is empty", "[time_interval][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type::time_point::duration duration;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<duration> on_time_interval;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("time_interval operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.time_interval();
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on_time_interval.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should emit time intervals for every item in the source observable", "[time_interval][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type clock_type;
- typedef clock_type::time_point::duration duration;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<duration> on_time_interval;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(250)
- });
-
- WHEN("time_interval operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.time_interval(so);
- }
- );
-
- THEN("the output contains the emitted items while subscribed"){
- auto required = rxu::to_vector({
- on_time_interval.next(210, milliseconds(10)),
- on_time_interval.next(240, milliseconds(30)),
- on_time_interval.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should emit time intervals and an error if there is an error", "[time_interval][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type clock_type;
- typedef clock_type::time_point::duration duration;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<duration> on_time_interval;
-
- std::runtime_error ex("on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.error(250, ex)
- });
-
- WHEN("time_interval operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.time_interval(so);
- }
- );
-
- THEN("the output contains emitted items and an error"){
- auto required = rxu::to_vector({
- on_time_interval.next(210, milliseconds(10)),
- on_time_interval.next(240, milliseconds(30)),
- on_time_interval.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/timeout.cpp b/Rx/v2/test/operators/timeout.cpp
deleted file mode 100644
index dbbea6c..0000000
--- a/Rx/v2/test/operators/timeout.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-timeout.hpp"
-
-using namespace std::chrono;
-
-SCENARIO("should timeout if the source never emits any items", "[timeout][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- rxcpp::timeout_error ex("timeout has occurred");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("timeout is set"){
-
- auto res = w.start(
- [so, xs]() {
- return xs
- | rxo::timeout(milliseconds(10), so);
- }
- );
-
- THEN("the error notification message is captured"){
- auto required = rxu::to_vector({
- on.error(211, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 212)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("should not timeout if completed before the specified timeout duration", "[timeout][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("timeout is set"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timeout(so, milliseconds(100));
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(251)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should not timeout if all items are emitted within the specified timeout duration", "[timeout][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(250)
- });
-
- WHEN("timeout is set"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timeout(milliseconds(40), so);
- }
- );
-
- THEN("the output contains the emitted items while subscribed"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.completed(251)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should timeout if there are no emitted items within the timeout duration", "[timeout][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- rxcpp::timeout_error ex("timeout has occurred");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- // -- no emissions
- on.completed(300)
- });
-
- WHEN("timeout is set"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timeout(milliseconds(40), so);
- }
- );
-
- THEN("an error notification message is captured"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.error(281, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 282)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should not timeout if there is an error", "[timeout][operators]"){
- GIVEN("a source"){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.error(250, ex)
- });
-
- WHEN("timeout is set"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timeout(milliseconds(100), so);
- }
- );
-
- THEN("the output contains only an error message"){
- auto required = rxu::to_vector({
- on.error(251, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/timestamp.cpp b/Rx/v2/test/operators/timestamp.cpp
deleted file mode 100644
index 43b4512..0000000
--- a/Rx/v2/test/operators/timestamp.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-timestamp.hpp"
-
-using namespace std::chrono;
-
-SCENARIO("should not emit timestamped items if the source never emits any items", "[timestamp][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type::time_point time_point;
-
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("timestamp operator is invoked"){
-
- auto res = w.start(
- [xs]() {
- return xs
- | rxo::timestamp();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<std::pair<int, time_point>>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("should not emit timestamped items if the source observable is empty", "[timestamp][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type::time_point time_point;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::pair<int, time_point>> on_timestamp;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(250)
- });
-
- WHEN("timestamp operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timestamp();
- }
- );
-
- THEN("the output only contains complete message"){
- auto required = rxu::to_vector({
- on_timestamp.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should emit timestamped items for every item in the source observable", "[timestamp][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type clock_type;
- typedef clock_type::time_point time_point;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::pair<int, time_point>> on_timestamp;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.completed(250)
- });
-
- WHEN("timestamp operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timestamp(so);
- }
- );
-
- THEN("the output contains the emitted items while subscribed"){
- auto required = rxu::to_vector({
- on_timestamp.next(210, std::make_pair(2, clock_type::time_point(milliseconds(210)))),
- on_timestamp.next(240, std::make_pair(3, clock_type::time_point(milliseconds(240)))),
- on_timestamp.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("should emit timestamped items and an error if there is an error", "[timestamp][operators]"){
- GIVEN("a source"){
- typedef rxsc::detail::test_type::clock_type clock_type;
- typedef clock_type::time_point time_point;
-
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::pair<int, time_point>> on_timestamp;
-
- std::runtime_error ex("on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.error(250, ex)
- });
-
- WHEN("timestamp operator is invoked"){
-
- auto res = w.start(
- [so, xs]() {
- return xs.timestamp(so);
- }
- );
-
- THEN("the output contains emitted items and an error"){
- auto required = rxu::to_vector({
- on_timestamp.next(210, std::make_pair(2, clock_type::time_point(milliseconds(210)))),
- on_timestamp.next(240, std::make_pair(3, clock_type::time_point(milliseconds(240)))),
- on_timestamp.error(250, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp
deleted file mode 100644
index 22d7997..0000000
--- a/Rx/v2/test/operators/window.cpp
+++ /dev/null
@@ -1,1042 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-reduce.hpp>
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-#include <rxcpp/operators/rx-window.hpp>
-#include <rxcpp/operators/rx-window_time.hpp>
-#include <rxcpp/operators/rx-window_time_count.hpp>
-
-SCENARIO("window count, basic", "[window][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- auto res = w.start(
- [&]() {
- return xs
- .window(3, 2)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window count, inner timings", "[window][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- auto res = rxcpp::observable<rxcpp::observable<int>>();
- auto windows = std::vector<rxcpp::observable<int>>();
- auto observers = std::vector<rxt::testable_observer<int>>();
-
- w.schedule_absolute(
- rxsc::test::created_time,
- [&](const rxsc::schedulable&) {
- res = xs
- | rxo::window(3, 2);
- }
- );
-
- w.schedule_absolute(
- rxsc::test::subscribed_time,
- [&](const rxsc::schedulable&) {
- res.subscribe(
- // on_next
- [&](rx::observable<int> window) {
- auto result = w.make_subscriber<int>();
- windows.push_back(window);
- observers.push_back(result.get_observer());
- window.subscribe(result);
- }
- );
- }
- );
-
- w.start();
-
- THEN("the output contains 5 windows"){
- REQUIRE(5 == observers.size());
- }
-
- THEN("the 1st output window contains ints"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.completed(280)
- });
- auto actual = observers[0].messages();
- REQUIRE(required == actual);
- }
-
- THEN("the 2nd output window contains ints"){
- auto required = rxu::to_vector({
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.completed(350)
- });
- auto actual = observers[1].messages();
- REQUIRE(required == actual);
- }
-
- THEN("the 3rd output window contains ints"){
- auto required = rxu::to_vector({
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.completed(420)
- });
- auto actual = observers[2].messages();
- REQUIRE(required == actual);
- }
-
- THEN("the 4th output window contains ints"){
- auto required = rxu::to_vector({
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
- auto actual = observers[3].messages();
- REQUIRE(required == actual);
- }
-
- THEN("the 5th output window only contains complete message"){
- auto required = rxu::to_vector({
- on.completed(600)
- });
- auto actual = observers[4].messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window count, dispose", "[window][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- auto res = w.start(
- [&]() {
- return xs
- .window(3, 2)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 370
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(350, 6)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 370)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window count, error", "[window][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("window on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
-
- WHEN("group each int with the next 2 ints"){
- auto res = w.start(
- [&]() {
- return xs
- .window(3, 2)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, basic", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(270, 4),
- on.next(320, 5),
- on.next(360, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(460, 9),
- on.next(470, 10),
- on.completed(490)
- });
-
- WHEN("group ints by 100 time units"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::window_with_time(milliseconds(100), milliseconds(50), so)
- | rxo::merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(271, 4),
- on.next(271, 4),
- on.next(321, 5),
- on.next(321, 5),
- on.next(361, 6),
- on.next(361, 6),
- on.next(391, 7),
- on.next(391, 7),
- on.next(411, 8),
- on.next(411, 8),
- on.next(461, 9),
- on.next(461, 9),
- on.next(471, 10),
- on.next(471, 10),
- on.completed(491)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 490)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, basic same", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(270, 4),
- on.next(320, 5),
- on.next(360, 6),
- on.next(390, 7),
- on.next(410, 8),
- on.next(460, 9),
- on.next(470, 10),
- on.completed(490)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(100), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(271, 4),
- on.next(321, 5),
- on.next(361, 6),
- on.next(391, 7),
- on.next(411, 8),
- on.next(461, 9),
- on.next(471, 10),
- on.completed(491)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 490)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, basic 1", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(100), milliseconds(70), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(351, 6),
- on.next(381, 7),
- on.next(421, 8),
- on.next(421, 8),
- on.next(471, 9),
- on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, basic 2", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(70), milliseconds(100), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(321, 5),
- on.next(351, 6),
- on.next(421, 8),
- on.next(471, 9),
- on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, error", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("window_with_time on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(100), milliseconds(70), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(351, 6),
- on.next(381, 7),
- on.next(421, 8),
- on.next(421, 8),
- on.next(471, 9),
- on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, disposed", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(100), milliseconds(70), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 370
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(351, 6),
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 371)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time, basic same 1", "[window_with_time][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(100, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(380, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time(milliseconds(70), so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(381, 7),
- on.next(421, 8),
- on.next(471, 9),
- on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time or count, basic", "[window_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::window_with_time_or_count(milliseconds(70), 3, so)
- | rxo::merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(206, 1),
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(371, 7),
- on.next(421, 8),
- on.next(471, 9),
- on.completed(601)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time or count, error", "[window_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- std::runtime_error ex("window_with_time on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.error(600, ex)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time_or_count(milliseconds(70), 3, so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(206, 1),
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(371, 7),
- on.next(421, 8),
- on.next(471, 9),
- on.error(601, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 600)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time or count, disposed", "[window_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(210, 2),
- on.next(240, 3),
- on.next(280, 4),
- on.next(320, 5),
- on.next(350, 6),
- on.next(370, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.completed(600)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time_or_count(milliseconds(70), 3, so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 372
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(206, 1),
- on.next(211, 2),
- on.next(241, 3),
- on.next(281, 4),
- on.next(321, 5),
- on.next(351, 6),
- on.next(371, 7)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 373)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time or count, only time triggered", "[window_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(305, 2),
- on.next(505, 3),
- on.next(605, 4),
- on.next(610, 5),
- on.completed(850)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time_or_count(milliseconds(100), 3, so)
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(206, 1),
- on.next(306, 2),
- on.next(506, 3),
- on.next(606, 4),
- on.next(611, 5),
- on.completed(851)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 850)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window with time or count, only count triggered", "[window_with_time_or_count][operators]"){
- GIVEN("1 hot observable of ints."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<rx::observable<int>> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(205, 1),
- on.next(305, 2),
- on.next(505, 3),
- on.next(605, 4),
- on.next(610, 5),
- on.completed(850)
- });
-
- WHEN("group each int with the next 2 ints"){
- using namespace std::chrono;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_with_time_or_count(milliseconds(370), 2, so)
- .map([](rx::observable<int> w){
- return w.count();
- })
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains merged groups of ints"){
- auto required = rxu::to_vector({
- on.next(306, 2),
- on.next(606, 2),
- on.next(851, 1),
- on.completed(851)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 850)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/window_toggle.cpp b/Rx/v2/test/operators/window_toggle.cpp
deleted file mode 100644
index b85c1ba..0000000
--- a/Rx/v2/test/operators/window_toggle.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-map.hpp>
-#include <rxcpp/operators/rx-merge.hpp>
-#include <rxcpp/operators/rx-window_toggle.hpp>
-
-SCENARIO("window toggle, basic", "[window_toggle][operators]"){
- GIVEN("1 hot observable of ints and hot observable of opens."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::string> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(90, 1),
- on.next(180, 2),
- on.next(250, 3),
- on.next(260, 4),
- on.next(310, 5),
- on.next(340, 6),
- on.next(410, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.next(550, 10),
- on.completed(590)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(255, 50),
- on.next(330, 100),
- on.next(350, 50),
- on.next(400, 90),
- on.completed(900)
- });
-
- WHEN("ints are split into windows"){
- using namespace std::chrono;
-
- int wi = 0;
-
- auto res = w.start(
- [&]() {
- return xs
- | rxo::window_toggle(ys, [&](int y){
- return rx::observable<>::timer(milliseconds(y), so);
- }, so)
- | rxo::map([wi](rxcpp::observable<int> w) mutable {
- auto ti = wi++;
- return w
- | rxo::map([ti](int x){return std::to_string(ti) + " " + std::to_string(x);})
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- })
- | rxo::merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output contains ints assigned to windows"){
- auto required = rxu::to_vector({
- o_on.next(261, "0 4"),
- o_on.next(341, "1 6"),
- o_on.next(411, "1 7"),
- o_on.next(411, "3 7"),
- o_on.next(421, "1 8"),
- o_on.next(421, "3 8"),
- o_on.next(471, "3 9"),
- o_on.completed(591)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 590)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window toggle, basic same", "[window_toggle][operators]"){
- GIVEN("1 hot observable of ints and hot observable of opens."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::string> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(90, 1),
- on.next(180, 2),
- on.next(250, 3),
- on.next(260, 4),
- on.next(310, 5),
- on.next(340, 6),
- on.next(410, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.next(550, 10),
- on.completed(590)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(255, 50),
- on.next(330, 100),
- on.next(350, 50),
- on.next(400, 90),
- on.completed(900)
- });
-
- WHEN("ints are split into windows"){
- using namespace std::chrono;
-
- int wi = 0;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_toggle(ys, [&](int){
- return ys;
- }, so)
- .map([wi](rxcpp::observable<int> w) mutable {
- auto ti = wi++;
- return w
- .map([ti](int x){return std::to_string(ti) + " " + std::to_string(x);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- })
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints assigned to windows"){
- auto required = rxu::to_vector({
- o_on.next(261, "0 4"),
- o_on.next(311, "0 5"),
- o_on.next(341, "1 6"),
- o_on.next(411, "3 7"),
- o_on.next(421, "3 8"),
- o_on.next(471, "3 9"),
- o_on.next(551, "3 10"),
- o_on.completed(591)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 590)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window toggle, error", "[window_toggle][operators]"){
- GIVEN("1 hot observable of ints and hot observable of opens."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::string> o_on;
-
- std::runtime_error ex("window_toggle on_error from source");
-
- auto xs = sc.make_hot_observable({
- on.next(90, 1),
- on.next(180, 2),
- on.next(250, 3),
- on.next(260, 4),
- on.next(310, 5),
- on.next(340, 6),
- on.next(410, 7),
- on.error(420, ex),
- on.next(470, 9),
- on.next(550, 10),
- on.completed(590)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(255, 50),
- on.next(330, 100),
- on.next(350, 50),
- on.next(400, 90),
- on.completed(900)
- });
-
- WHEN("ints are split into windows"){
- using namespace std::chrono;
-
- int wi = 0;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_toggle(ys, [&](int){
- return ys;
- }, so)
- .map([wi](rxcpp::observable<int> w) mutable {
- auto ti = wi++;
- return w
- .map([ti](int x){return std::to_string(ti) + " " + std::to_string(x);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- })
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains ints assigned to windows"){
- auto required = rxu::to_vector({
- o_on.next(261, "0 4"),
- o_on.next(311, "0 5"),
- o_on.next(341, "1 6"),
- o_on.next(411, "3 7"),
- o_on.error(421, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 420)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("window toggle, disposed", "[window_toggle][operators]"){
- GIVEN("1 hot observable of ints and hot observable of opens."){
- auto sc = rxsc::make_test();
- auto so = rx::synchronize_in_one_worker(sc);
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<std::string> o_on;
-
- auto xs = sc.make_hot_observable({
- on.next(90, 1),
- on.next(180, 2),
- on.next(250, 3),
- on.next(260, 4),
- on.next(310, 5),
- on.next(340, 6),
- on.next(410, 7),
- on.next(420, 8),
- on.next(470, 9),
- on.next(550, 10),
- on.completed(590)
- });
-
- auto ys = sc.make_hot_observable({
- on.next(255, 50),
- on.next(330, 100),
- on.next(350, 50),
- on.next(400, 90),
- on.completed(900)
- });
-
- WHEN("ints are split into windows"){
- using namespace std::chrono;
-
- int wi = 0;
-
- auto res = w.start(
- [&]() {
- return xs
- .window_toggle(ys, [&](int){
- return ys;
- }, so)
- .map([wi](rxcpp::observable<int> w) mutable {
- auto ti = wi++;
- return w
- .map([ti](int x){return std::to_string(ti) + " " + std::to_string(x);})
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- })
- .merge()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- },
- 420
- );
-
- THEN("the output contains ints assigned to windows"){
- auto required = rxu::to_vector({
- o_on.next(261, "0 4"),
- o_on.next(311, "0 5"),
- o_on.next(341, "1 6"),
- o_on.next(411, "3 7")
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the observable"){
- auto required = rxu::to_vector({
- o_on.subscribe(200, 420)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
diff --git a/Rx/v2/test/operators/with_latest_from.cpp b/Rx/v2/test/operators/with_latest_from.cpp
deleted file mode 100644
index ae7092a..0000000
--- a/Rx/v2/test/operators/with_latest_from.cpp
+++ /dev/null
@@ -1,1645 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-with_latest_from.hpp"
-
-SCENARIO("with_latest_from interleaved with tail", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.next(230, 5),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.next(230, 4 + 5),
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from consecutive", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.completed(250)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 250)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from consecutive ends with error left", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.error(230, ex)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from consecutive ends with error right", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(250)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.error(245, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints followed by an error"){
- auto required = rxu::to_vector({
- on.next(235, 4 + 6),
- on.next(240, 4 + 7),
- on.error(245, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from never N", "[with_latest_from][join][operators]"){
- GIVEN("N never completed hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> n;
- for (int i = 0; i < N; ++i) {
- n.push_back(
- sc.make_hot_observable({
- on.next(150, 1)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n[0]
- .with_latest_from(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- n[1], n[2], n[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("with_latest_from empty N", "[with_latest_from][join][operators]"){
- GIVEN("N empty hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210 + 10 * i)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .with_latest_from(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- e[1], e[2], e[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(200 + 10 * N)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- int i = 0;
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * ++i)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("with_latest_from never/empty", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from empty/never", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from empty/return", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from return/empty", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(220)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from never/return", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from return/never", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-
-SCENARIO("with_latest_from return/return", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from empty/error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return emp
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error/empty", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- emp
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from return/error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error/return", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error/error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("with_latest_from on_error from source 1");
- std::runtime_error ex2("with_latest_from on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from next+error/error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("with_latest_from on_error from source 1");
- std::runtime_error ex2("with_latest_from on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error/next+error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("with_latest_from on_error from source 1");
- std::runtime_error ex2("with_latest_from on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex2)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from never/error", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error/never", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error after completed left", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return ret
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from error after completed right", "[with_latest_from][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .with_latest_from(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from selector throws", "[with_latest_from][join][operators][!throws]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .with_latest_from(
- [&ex](int, int) -> int {
- rxu::throw_exception(ex);
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("with_latest_from selector throws N", "[with_latest_from][join][operators][!throws]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::runtime_error ex("with_latest_from on_error from source");
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(210 + 10 * i, 1),
- on.completed(500)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[3]
- .with_latest_from(
- [&ex](int, int, int, int) -> int {
- rxu::throw_exception(ex);
- },
- e[0], e[1], e[2]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(200 + 10 * N, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * N)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("with_latest_from typical N", "[with_latest_from][join][operators]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> o;
- for (int i = 0; i < N; ++i) {
- o.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.next(210 + 10 * i, i + 1),
- on.next(410 + 10 * i, i + N + 1),
- on.completed(800)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o[3]
- .with_latest_from(
- [](int v0, int v1, int v2, int v3) {
- return v0 + v1 + v2 + v3;
- },
- o[0], o[1], o[2]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(200 + 10 * N, N * (N + 1) / 2),
- on.next(410 + 10 * (N - 1), (N - 1) * N / 2 + N + N * N)
- });
- required.push_back(on.completed(800));
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(o.begin(), o.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 800)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
diff --git a/Rx/v2/test/operators/zip.cpp b/Rx/v2/test/operators/zip.cpp
deleted file mode 100644
index c048006..0000000
--- a/Rx/v2/test/operators/zip.cpp
+++ /dev/null
@@ -1,1881 +0,0 @@
-#include "../test.h"
-#include <rxcpp/operators/rx-zip.hpp>
-
-SCENARIO("zip never/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n1 = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto n2 = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n1
- | rxo::zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never N", "[zip][join][operators]"){
- GIVEN("N never completed hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const std::size_t N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> n;
- for (std::size_t i = 0; i < N; ++i) {
- n.push_back(
- sc.make_hot_observable({
- on.next(150, 1)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n[0]
- | rxo::zip(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- n[1], n[2], n[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- | rxo::as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(n.begin(), n.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip never/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e1 = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto e2 = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(210)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty N", "[zip][join][operators]"){
- GIVEN("N empty hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210 + 10 * i)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .zip(
- [](int v0, int v1, int v2, int v3){
- return v0 + v1 + v2 + v3;
- },
- e[1], e[2], e[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(200 + 10 * N)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- int i = 0;
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * ++i)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip empty/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(215)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto e = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(210)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- e
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only complete message"){
- auto required = rxu::to_vector({
- on.completed(215)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the e"){
- auto required = rxu::to_vector({
- on.subscribe(200, 210)
- });
- auto actual = e.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(220)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output is empty"){
- auto required = std::vector<rxsc::test::messages<int>::recorded_type>();
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip empty/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return emp
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/empty", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto emp = sc.make_hot_observable({
- on.next(150, 1),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- emp
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the emp"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = emp.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip never/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return n
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/never", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto n = sc.make_hot_observable({
- on.next(150, 1)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- n
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the n"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = n.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip return/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/return", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(230)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip left completes first", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(220)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 4),
- on.completed(225)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(215, 2 + 4),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip right completes first", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 4),
- on.completed(225)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(220)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(215, 2 + 4),
- on.completed(225)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 225)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip selector throws", "[zip][join][operators][!throws]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.completed(240)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o1
- .zip(
- [&ex](int, int) -> int {
- rxu::throw_exception(ex);
- },
- o2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip selector throws N", "[zip][join][operators][!throws]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::runtime_error ex("zip on_error from source");
-
- std::vector<rxcpp::test::testable_observable<int>> e;
- for (int i = 0; i < N; ++i) {
- e.push_back(
- sc.make_hot_observable({
- on.next(210 + 10 * i, 1),
- on.completed(500)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return e[0]
- .zip(
- [&ex](int, int, int, int) -> int {
- rxu::throw_exception(ex);
- },
- e[1], e[2], e[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error"){
- auto required = rxu::to_vector({
- on.error(200 + 10 * N, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(e.begin(), e.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 200 + 10 * N)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip typical N", "[zip][join][operators]"){
- GIVEN("N hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- const int N = 4;
-
- std::vector<rxcpp::test::testable_observable<int>> o;
- for (int i = 0; i < N; ++i) {
- o.push_back(
- sc.make_hot_observable({
- on.next(150, 1),
- on.next(210 + 10 * i, i + 1),
- on.next(410 + 10 * i, i + N + 1),
- on.completed(800)
- })
- );
- }
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o[0]
- .zip(
- [](int v0, int v1, int v2, int v3) {
- return v0 + v1 + v2 + v3;
- },
- o[1], o[2], o[3]
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(200 + 10 * N, N * (N + 1) / 2),
- on.next(400 + 10 * N, N * (3 * N + 1) / 2)
- });
- required.push_back(on.completed(800));
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to each observable"){
-
- std::for_each(o.begin(), o.end(), [&](rxcpp::test::testable_observable<int> &s){
- auto required = rxu::to_vector({
- on.subscribe(200, 800)
- });
- auto actual = s.subscriptions();
- REQUIRE(required == actual);
- });
- }
- }
- }
-}
-
-SCENARIO("zip interleaved with tail", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(220, 3),
- on.next(230, 5),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(220, 2 + 3),
- on.next(230, 4 + 5),
- on.completed(230)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(230)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints"){
- auto required = rxu::to_vector({
- on.next(235, 2 + 6),
- on.next(240, 4 + 7),
- on.completed(240)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 240)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive ends with error left", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.error(230, ex)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.completed(250)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only an error"){
- auto required = rxu::to_vector({
- on.error(230, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 230)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip consecutive ends with error right", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto o1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(215, 2),
- on.next(225, 4),
- on.completed(250)
- });
-
- auto o2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(235, 6),
- on.next(240, 7),
- on.error(245, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return o2
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- o1
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains combined ints followed by an error"){
- auto required = rxu::to_vector({
- on.next(235, 2 + 6),
- on.next(240, 4 + 7),
- on.error(245, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the o2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 245)
- });
- auto actual = o2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip next+error/error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex1)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error/next+error", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex1("zip on_error from source 1");
- std::runtime_error ex2("zip on_error from source 2");
-
- auto err1 = sc.make_hot_observable({
- on.next(150, 1),
- on.error(230, ex1)
- });
-
- auto err2 = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.error(220, ex2)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err1
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err2
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex2)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err1"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err1.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err2"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err2.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error after completed left", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return ret
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- err
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("zip error after completed right", "[zip][join][operators]"){
- GIVEN("2 hot observables of ints."){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("zip on_error from source");
-
- auto err = sc.make_hot_observable({
- on.next(150, 1),
- on.error(220, ex)
- });
-
- auto ret = sc.make_hot_observable({
- on.next(150, 1),
- on.next(210, 2),
- on.completed(215)
- });
-
- WHEN("each int is combined with the latest from the other source"){
-
- auto res = w.start(
- [&]() {
- return err
- .zip(
- [](int v2, int v1){
- return v2 + v1;
- },
- ret
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains only error message"){
- auto required = rxu::to_vector({
- on.error(220, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the ret"){
- auto required = rxu::to_vector({
- on.subscribe(200, 215)
- });
- auto actual = ret.subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription to the err"){
- auto required = rxu::to_vector({
- on.subscribe(200, 220)
- });
- auto actual = err.subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/sources/create.cpp b/Rx/v2/test/sources/create.cpp
deleted file mode 100644
index 0e3cac7..0000000
--- a/Rx/v2/test/sources/create.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "../test.h"
-
-SCENARIO("create stops on completion", "[create][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- WHEN("created"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::create<int>(
- [&](const rx::subscriber<int>& s){
- invoked++;
- s.on_next(1);
- s.on_next(2);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains all items"){
- auto required = rxu::to_vector({
- on.next(200, 1),
- on.next(200, 2)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("create was called until completed"){
- REQUIRE(1 == invoked);
- }
- }
- }
-}
-
-SCENARIO("when observer::on_next is overridden", "[create][observer][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- long invoked = 0;
-
- WHEN("created"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::create<int>(
- [&](const rx::subscriber<int>& so){
- invoked++;
- auto sn = rx::make_subscriber<int>(so,
- rx::make_observer<int>(so.get_observer(),
- [](rx::observer<int>& o, int v){
- o.on_next(v + 1);
- }));
- sn.on_next(1);
- sn.on_next(2);
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output contains all items incremented by 1"){
- auto required = rxu::to_vector({
- on.next(200, 2),
- on.next(200, 3)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("create was called until completed"){
- REQUIRE(1 == invoked);
- }
- }
- }
-}
diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp
deleted file mode 100644
index a8187ad..0000000
--- a/Rx/v2/test/sources/defer.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "../test.h"
-
-SCENARIO("defer stops on completion", "[defer][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<long> on;
-
- long invoked = 0;
-
- rxu::detail::maybe<rx::test::testable_observable<long>> xs;
-
- WHEN("deferred"){
-
- auto empty = rx::observable<>::empty<long>();
- auto just = rx::observable<>::just(42);
- auto one = rx::observable<>::from(42);
- auto error = rx::observable<>::error<long>(rxu::error_ptr());
- auto runtimeerror = rx::observable<>::error<long>(std::runtime_error("runtime"));
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::defer(
- [&](){
- invoked++;
- xs.reset(sc.make_cold_observable({
- on.next(100, sc.clock()),
- on.completed(200)
- }));
- return xs.get();
- })
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(300, 200L),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
-
- THEN("defer was called until completed"){
- REQUIRE(1 == invoked);
- }
- }
- }
-}
diff --git a/Rx/v2/test/sources/empty.cpp b/Rx/v2/test/sources/empty.cpp
deleted file mode 100644
index a57be9f..0000000
--- a/Rx/v2/test/sources/empty.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "../test.h"
-
-SCENARIO("empty emits no items", "[empty][sources]"){
- GIVEN("an empty source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- WHEN("created"){
-
- auto res = w.start(
- []() {
- return rx::observable<>::empty<int>()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains the completion message"){
- auto required = rxu::to_vector({
- on.completed(200)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("empty emits no items (rx::sources)", "[empty][sources]"){
- GIVEN("an empty source"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- WHEN("created"){
- using namespace rx::sources;
-
- auto res = w.start(
- []() {
- return empty<int>()
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output only contains the completion message"){
- auto required = rxu::to_vector({
- on.completed(200)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp
deleted file mode 100644
index 9ab2fca..0000000
--- a/Rx/v2/test/sources/interval.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "../test.h"
-
-SCENARIO("schedule_periodically", "[!hide][periodically][scheduler][long][perf][sources]"){
- GIVEN("schedule_periodically"){
- WHEN("the period is 1sec and the initial is 2sec"){
- using namespace std::chrono;
-
- int c = 0;
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
- auto start = w.now() + seconds(2);
- auto period = seconds(1);
- w.schedule_periodically(start, period,
- [=, &c](rxsc::schedulable scbl){
- auto nsDelta = duration_cast<milliseconds>(scbl.now() - (start + (period * c)));
- ++c;
- std::cout << "schedule_periodically : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl;
- if (c == 5) {scbl.unsubscribe();}
- });
- }
- }
-}
-
-SCENARIO("schedule_periodically by duration", "[!hide][periodically][scheduler][long][perf][sources]"){
- GIVEN("schedule_periodically_duration"){
- WHEN("the period is 1sec and the initial is 2sec"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- int c = 0;
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
-
- auto schedule_periodically_duration = [w](
- rxsc::current_thread::clock_type::duration initial,
- rxsc::current_thread::clock_type::duration period,
- rxsc::schedulable activity){
- auto periodic = rxsc::make_schedulable(
- activity,
- [period, activity](rxsc::schedulable self) {
- auto start = clock::now();
- // any recursion requests will be pushed to the scheduler queue
- rxsc::recursion r(false);
- // call action
- activity(r.get_recurse());
- auto finish = clock::now();
-
- // schedule next occurance (if the action took longer than 'period' target will be in the past)
- self.schedule(period - (finish - start));
- });
- w.schedule(initial, periodic);
- };
-
- auto start = w.now() + seconds(2);
- auto period = seconds(1);
- schedule_periodically_duration(seconds(2), period,
- rxsc::make_schedulable(w, [=, &c](rxsc::schedulable scbl){
- auto nsDelta = duration_cast<milliseconds>(scbl.now() - (start + (period * c)));
- ++c;
- std::cout << "schedule_periodically_duration : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl;
- if (c == 5) {scbl.unsubscribe();}
- }));
- }
- }
-}
-
-SCENARIO("intervals", "[!hide][periodically][interval][scheduler][long][perf][sources]"){
- GIVEN("10 intervals of 1 seconds"){
- WHEN("the period is 1sec and the initial is 2sec"){
- using namespace std::chrono;
-
- int c = 0;
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now() + seconds(2);
- auto period = seconds(1);
- rx::composite_subscription cs;
- rx::observable<>::interval(start, period, so)
- .subscribe(
- cs,
- [=, &c](long counter){
- auto nsDelta = duration_cast<milliseconds>(sc.now() - (start + (period * (counter - 1))));
- c = counter - 1;
- std::cout << "interval : period " << counter << ", " << nsDelta.count() << "ms delta from target time" << std::endl;
- if (counter == 5) {cs.unsubscribe();}
- },
- [](rxu::error_ptr){abort();});
- }
- }
-}
diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp
deleted file mode 100644
index 1389344..0000000
--- a/Rx/v2/test/sources/scope.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-#include "../test.h"
-
-SCENARIO("scope, cold observable", "[scope][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- rxu::detail::maybe<rx::test::testable_observable<int>> xs;
-
- typedef rx::resource<std::vector<int>> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- return resource(rxu::to_vector({1, 2, 3, 4, 5}));
- },
- [&](resource r){
- auto msg = std::vector<rxsc::test::messages<int>::recorded_type>();
- int time = 10;
- auto values = r.get();
- std::for_each(values.begin(), values.end(), [&](int &v){
- msg.push_back(on.next(time, v));
- time += 10;
- });
- msg.push_back(on.completed(time));
- xs.reset(sc.make_cold_observable(msg));
- return xs.get();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 1),
- on.next(220, 2),
- on.next(230, 3),
- on.next(240, 4),
- on.next(250, 5),
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 260)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, hot observable", "[scope][sources]"){
- GIVEN("a test hot observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- rxu::detail::maybe<rx::test::testable_observable<int>> xs;
-
- typedef rx::resource<std::vector<int>> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- return resource(rxu::to_vector({1, 2, 3, 4, 5}));
- },
- [&](resource r){
- auto msg = std::vector<rxsc::test::messages<int>::recorded_type>();
- int time = 210;
- auto values = r.get();
- std::for_each(values.begin(), values.end(), [&](int &v){
- msg.push_back(on.next(time, v));
- time += 10;
- });
- msg.push_back(on.completed(time));
- xs.reset(sc.make_hot_observable(msg));
- return xs.get();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(210, 1),
- on.next(220, 2),
- on.next(230, 3),
- on.next(240, 4),
- on.next(250, 5),
- on.completed(260)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 260)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, complete", "[scope][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int resource_factory_invoked = 0;
- int observable_factory_invoked = 0;
-
- rxu::detail::maybe<rx::test::testable_observable<int>> xs;
-
- typedef rx::resource<int> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- ++resource_factory_invoked;
- return resource(sc.clock());
- },
- [&](resource r){
- ++observable_factory_invoked;
- xs.reset(sc.make_cold_observable(rxu::to_vector({
- on.next(100, r.get()),
- on.completed(200)
- })));
- return xs.get();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("Resource factory is used once"){
- REQUIRE(1 == resource_factory_invoked);
- }
-
- THEN("Observable factory is used once"){
- REQUIRE(1 == observable_factory_invoked);
- }
-
- THEN("the output stops on completion"){
- auto required = rxu::to_vector({
- on.next(300, 200),
- on.completed(400)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, error", "[scope][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("scope on_error from source");
-
- int resource_factory_invoked = 0;
- int observable_factory_invoked = 0;
-
- rxu::detail::maybe<rx::test::testable_observable<int>> xs;
-
- typedef rx::resource<int> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- ++resource_factory_invoked;
- return resource(sc.clock());
- },
- [&](resource r){
- ++observable_factory_invoked;
- xs.reset(sc.make_cold_observable(rxu::to_vector({
- on.next(100, r.get()),
- on.error(200, ex)
- })));
- return xs.get();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("Resource factory is used once"){
- REQUIRE(1 == resource_factory_invoked);
- }
-
- THEN("Observable factory is used once"){
- REQUIRE(1 == observable_factory_invoked);
- }
-
- THEN("the output stops on error"){
- auto required = rxu::to_vector({
- on.next(300, 200),
- on.error(400, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 400)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, dispose", "[scope][sources]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- int resource_factory_invoked = 0;
- int observable_factory_invoked = 0;
-
- rxu::detail::maybe<rx::test::testable_observable<int>> xs;
-
- typedef rx::resource<int> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- ++resource_factory_invoked;
- return resource(sc.clock());
- },
- [&](resource r){
- ++observable_factory_invoked;
- xs.reset(sc.make_cold_observable(rxu::to_vector({
- on.next(100, r.get()),
- on.next(1000, r.get() + 1)
- })));
- return xs.get();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("Resource factory is used once"){
- REQUIRE(1 == resource_factory_invoked);
- }
-
- THEN("Observable factory is used once"){
- REQUIRE(1 == observable_factory_invoked);
- }
-
- THEN("the output contains resulting ints"){
- auto required = rxu::to_vector({
- on.next(300, 200)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("there was one subscription and one unsubscription"){
- auto required = rxu::to_vector({
- on.subscribe(200, 1000)
- });
- auto actual = xs.get().subscriptions();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, throw resource selector", "[scope][sources][!throws]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("scope on_error from source");
-
- int resource_factory_invoked = 0;
- int observable_factory_invoked = 0;
-
- typedef rx::resource<int> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&]() -> resource {
- ++resource_factory_invoked;
- rxu::throw_exception(ex);
- //return resource(sc.clock());
- },
- [&](resource){
- ++observable_factory_invoked;
- return rx::observable<>::never<int>();
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("Resource factory is used once"){
- REQUIRE(1 == resource_factory_invoked);
- }
-
- THEN("Observable factory is not used"){
- REQUIRE(0 == observable_factory_invoked);
- }
-
- THEN("the output stops on error"){
- auto required = rxu::to_vector({
- on.error(200, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
-
-SCENARIO("scope, throw resource usage", "[scope][sources][!throws]"){
- GIVEN("a test cold observable of ints"){
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("scope on_error from source");
-
- int resource_factory_invoked = 0;
- int observable_factory_invoked = 0;
-
- typedef rx::resource<int> resource;
-
- WHEN("created by scope"){
-
- auto res = w.start(
- [&]() {
- return rx::observable<>::
- scope(
- [&](){
- ++resource_factory_invoked;
- return resource(sc.clock());
- },
- [&](resource) -> rx::observable<int> {
- ++observable_factory_invoked;
- rxu::throw_exception(ex);
- }
- )
- // forget type to workaround lambda deduction bug on msvc 2013
- .as_dynamic();
- }
- );
-
- THEN("Resource factory is used once"){
- REQUIRE(1 == resource_factory_invoked);
- }
-
- THEN("Observable factory is used once"){
- REQUIRE(1 == observable_factory_invoked);
- }
-
- THEN("the output stops on error"){
- auto required = rxu::to_vector({
- on.error(200, ex)
- });
- auto actual = res.get_observer().messages();
- REQUIRE(required == actual);
- }
- }
- }
-}
diff --git a/Rx/v2/test/sources/timer.cpp b/Rx/v2/test/sources/timer.cpp
deleted file mode 100644
index 3f46b21..0000000
--- a/Rx/v2/test/sources/timer.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "../test.h"
-
-SCENARIO("timer", "[!hide][periodically][timer][scheduler][long][perf][sources]"){
- GIVEN("the timer of 1 sec"){
- WHEN("the period is 1 sec"){
- using namespace std::chrono;
-
- auto sc = rxsc::make_current_thread();
- auto so = rx::synchronize_in_one_worker(sc);
- auto start = sc.now();
- auto period = seconds(1);
- rx::composite_subscription cs;
- rx::observable<>::timer(period, so)
- .subscribe(
- cs,
- [=](long counter){
- auto nsDelta = duration_cast<milliseconds>(sc.now() - (start + (period * counter)));
- std::cout << "timer : period " << counter << ", " << nsDelta.count() << "ms delta from target time" << std::endl;
- },
- [](rxu::error_ptr){abort();},
- [](){std::cout << "completed" << std::endl;});
- }
- }
-}
diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp
deleted file mode 100644
index 09318a3..0000000
--- a/Rx/v2/test/subjects/subject.cpp
+++ /dev/null
@@ -1,745 +0,0 @@
-#define RXCPP_SUBJECT_TEST_ASYNC 1
-
-#include "../test.h"
-
-#include <rxcpp/operators/rx-finally.hpp>
-
-#include <future>
-
-
-const int static_onnextcalls = 10000000;
-static int aliased = 0;
-
-SCENARIO("for loop locks mutex", "[!hide][for][mutex][long][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("locking mutex 100 million times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- int c = 0;
- int n = 1;
- auto start = clock::now();
- std::mutex m;
- for (int i = 0; i < onnextcalls; i++) {
- std::unique_lock<std::mutex> guard(m);
- ++c;
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-namespace syncwithvoid {
-template<class T, class OnNext>
-class sync_subscriber
-{
-public:
- OnNext onnext;
- bool issubscribed;
- explicit sync_subscriber(OnNext on)
- : onnext(on)
- , issubscribed(true)
- {
- }
- bool is_subscribed() {return issubscribed;}
- void unsubscribe() {issubscribed = false;}
- void on_next(T v) {
- onnext(v);
- }
-};
-}
-SCENARIO("for loop calls void on_next(int)", "[!hide][for][asyncobserver][baseline][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("calling on_next 100 million times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto c = std::addressof(aliased);
- *c = 0;
- int n = 1;
- auto start = clock::now();
- auto onnext = [c](int){++*c;};
- syncwithvoid::sync_subscriber<int, decltype(onnext)> scbr(onnext);
- for (int i = 0; i < onnextcalls && scbr.is_subscribed(); i++) {
- scbr.on_next(i);
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop void : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << *c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-namespace asyncwithready {
-// ready is an immutable class.
-class ready
-{
-public:
- typedef std::function<void()> onthen_type;
-private:
- std::function<void(onthen_type)> setthen;
-public:
- ready() {}
- ready(std::function<void(onthen_type)> st) : setthen(st) {}
- bool is_ready() {return !setthen;}
- void then(onthen_type ot) {
- if (is_ready()) {
- abort();
- }
- setthen(ot);
- }
-};
-template<class T, class OnNext>
-class async_subscriber
-{
-public:
- OnNext onnext;
- bool issubscribed;
- int count;
- explicit async_subscriber(OnNext on)
- : onnext(on)
- , issubscribed(true)
- , count(0)
- {
- }
- bool is_subscribed() {return issubscribed;}
- void unsubscribe() {issubscribed = false;}
- ready on_next(T v) {
- // push v onto queue
-
- // under some condition pop v off of queue and pass it on
- onnext(v);
-
- // for demo purposes
- // simulate queue full every 100000 items
- if (count == 100000) {
- // 'queue is full'
- ready no([this](ready::onthen_type ot){
- // full version will sync producer and consumer (in producer push and consumer pop)
- // and decide when to restart the producer
- if (!this->count) {
- ot();
- }
- });
- // set queue empty since the demo has no separate consumer thread
- count = 0;
- // 'queue is empty'
- return no;
- }
- static const ready yes;
- return yes;
- }
-};
-}
-SCENARIO("for loop calls ready on_next(int)", "[!hide][for][asyncobserver][ready][perf]"){
- static const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("calling on_next 100 million times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto c = std::addressof(aliased);
- *c = 0;
- int n = 1;
- auto start = clock::now();
- auto onnext = [&c](int){++*c;};
- asyncwithready::async_subscriber<int, decltype(onnext)> scbr(onnext);
- asyncwithready::ready::onthen_type chunk;
- int i = 0;
- chunk = [&chunk, scbr, i]() mutable {
- for (; i < onnextcalls && scbr.is_subscribed(); i++) {
- auto controller = scbr.on_next(i);
- if (!controller.is_ready()) {
- controller.then(chunk);
- return;
- }
- }
- };
- chunk();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop ready : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << *c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-namespace asyncwithfuture {
-class unit {};
-template<class T, class OnNext>
-class async_subscriber
-{
-public:
- OnNext onnext;
- bool issubscribed;
- explicit async_subscriber(OnNext on)
- : onnext(on)
- , issubscribed(true)
- {
- }
- bool is_subscribed() {return issubscribed;}
- void unsubscribe() {issubscribed = false;}
- std::future<unit> on_next(T v) {
- std::promise<unit> ready;
- ready.set_value(unit());
- onnext(v); return ready.get_future();}
-};
-}
-SCENARIO("for loop calls std::future<unit> on_next(int)", "[!hide][for][asyncobserver][future][long][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("calling on_next 100 million times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto c = std::addressof(aliased);
- *c = 0;
- int n = 1;
- auto start = clock::now();
- auto onnext = [&c](int){++*c;};
- asyncwithfuture::async_subscriber<int, decltype(onnext)> scbr(onnext);
- for (int i = 0; i < onnextcalls && scbr.is_subscribed(); i++) {
- auto isready = scbr.on_next(i);
- if (isready.wait_for(std::chrono::milliseconds(0)) == std::future_status::timeout) {
- isready.wait();
- }
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop future<unit> : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << *c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- }
- }
-}
-
-SCENARIO("for loop calls observer", "[!hide][for][observer][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("observing 100 million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- static int& c = aliased;
- int n = 1;
-
- c = 0;
- auto start = clock::now();
- auto o = rx::make_observer<int>(
- [](int){++c;},
- [](rxu::error_ptr){abort();});
- for (int i = 0; i < onnextcalls; i++) {
- o.on_next(i);
- }
- o.on_completed();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop -> observer : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec"<< std::endl;
- }
- }
-}
-
-SCENARIO("for loop calls subscriber", "[!hide][for][subscriber][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop"){
- WHEN("observing 100 million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- static int& c = aliased;
- int n = 1;
-
- c = 0;
- auto start = clock::now();
- auto o = rx::make_subscriber<int>(
- [](int){++c;},
- [](rxu::error_ptr){abort();});
- for (int i = 0; i < onnextcalls && o.is_subscribed(); i++) {
- o.on_next(i);
- }
- o.on_completed();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("range calls subscriber", "[!hide][range][subscriber][perf]"){
- const int& onnextcalls = static_onnextcalls;
- GIVEN("a range"){
- WHEN("observing 100 million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- static int& c = aliased;
- int n = 1;
-
- c = 0;
- auto start = clock::now();
-
- rxs::range<int>(1, onnextcalls).subscribe(
- [](int){
- ++c;
- },
- [](rxu::error_ptr){abort();});
-
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "range -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
-}
-
-SCENARIO("for loop calls subject", "[!hide][for][subject][subjects][long][perf]"){
- static const int& onnextcalls = static_onnextcalls;
- GIVEN("a for loop and a subject"){
- WHEN("multicasting a million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- for (int n = 0; n < 10; n++)
- {
- auto p = std::make_shared<int>(0);
- auto c = std::make_shared<int>(0);
- rxsub::subject<int> sub;
-
-#if RXCPP_SUBJECT_TEST_ASYNC
- std::vector<std::future<int>> f(n);
- std::atomic<int> asyncUnsubscriptions{0};
-#endif
-
- auto o = sub.get_subscriber();
-
- o.add(rx::make_subscription([c, n](){
- auto expected = n * onnextcalls;
- REQUIRE(*c == expected);
- }));
-
- for (int i = 0; i < n; i++) {
-#if RXCPP_SUBJECT_TEST_ASYNC
- f[i] = std::async([sub, o, &asyncUnsubscriptions]() {
- auto source = sub.get_observable();
- while(o.is_subscribed()) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- rx::composite_subscription cs;
- source
- .finally([&asyncUnsubscriptions](){
- ++asyncUnsubscriptions;})
- .subscribe(
- rx::make_subscriber<int>(
- cs,
- [cs](int){
- cs.unsubscribe();
- },
- [](rxu::error_ptr){abort();}));
- }
- return 0;
- });
-#endif
- sub.get_observable().subscribe(
- [c, p](int){
- ++(*c);
- },
- [](rxu::error_ptr){abort();});
- }
-
- auto start = clock::now();
- for (int i = 0; i < onnextcalls && o.is_subscribed(); i++) {
-#if RXCPP_DEBUG_SUBJECT_RACE
- if (*p != *c) abort();
- (*p) += n;
-#endif
- o.on_next(i);
- }
- o.on_completed();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop -> subject : " << n << " subscribed, " << std::setw(9) << (*c) << " on_next calls, ";
-#if RXCPP_SUBJECT_TEST_ASYNC
- std::cout << std::setw(4) << asyncUnsubscriptions << " async, ";
-#endif
- std::cout << msElapsed.count() << "ms elapsed " << *c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
- }
- }
- }
-}
-
-SCENARIO("range calls subject", "[!hide][range][subject][subjects][long][perf]"){
- static const int& onnextcalls = static_onnextcalls;
- GIVEN("a range and a subject"){
- WHEN("multicasting a million ints"){
- using namespace std::chrono;
- typedef steady_clock clock;
- for (int n = 0; n < 10; n++)
- {
- auto p = std::make_shared<int>(0);
- auto c = std::make_shared<int>(0);
- rxsub::subject<int> sub;
-
-#if RXCPP_SUBJECT_TEST_ASYNC
- std::vector<std::future<int>> f(n);
- std::atomic<int> asyncUnsubscriptions{0};
-#endif
-
- auto o = sub.get_subscriber();
-
- o.add(rx::make_subscription([c, n](){
- auto expected = n * onnextcalls;
- REQUIRE(*c == expected);
- }));
-
- for (int i = 0; i < n; i++) {
-#if RXCPP_SUBJECT_TEST_ASYNC
- f[i] = std::async([sub, o, &asyncUnsubscriptions]() {
- while(o.is_subscribed()) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- rx::composite_subscription cs;
- sub.get_observable()
- .finally([&asyncUnsubscriptions](){
- ++asyncUnsubscriptions;})
- .subscribe(cs,
- [cs](int){
- cs.unsubscribe();
- },
- [](rxu::error_ptr){abort();});
- }
- return 0;
- });
-#endif
- sub.get_observable()
- .subscribe(
- [c, p](int){
- ++(*c);
- },
- [](rxu::error_ptr){abort();}
- );
- }
-
- auto start = clock::now();
- rxs::range<int>(1, onnextcalls)
-#if RXCPP_DEBUG_SUBJECT_RACE
- .filter([c, p, n](int){
- if (*p != *c) abort();
- (*p) += n;
- return true;
- })
-#endif
- .subscribe(o);
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "range -> subject : " << n << " subscribed, " << std::setw(9) << (*c) << " on_next calls, ";
-#if RXCPP_SUBJECT_TEST_ASYNC
- std::cout << std::setw(4) << asyncUnsubscriptions << " async, ";
-#endif
- std::cout << msElapsed.count() << "ms elapsed " << *c / (msElapsed.count() / 1000.0) << " ops/sec"<< std::endl;
- }
- }
- }
-}
-
-
-SCENARIO("subject - infinite source", "[subject][subjects]"){
- GIVEN("a subject and an infinite source"){
-
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
- const rxsc::test::messages<bool> check;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 1),
- on.next(110, 2),
- on.next(220, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7),
- on.next(630, 8),
- on.next(710, 9),
- on.next(870, 10),
- on.next(940, 11),
- on.next(1020, 12)
- });
-
- rxsub::subject<int> s;
-
- auto results1 = w.make_subscriber<int>();
-
- auto results2 = w.make_subscriber<int>();
-
- auto results3 = w.make_subscriber<int>();
-
- WHEN("multicasting an infinite source"){
-
- auto checks = rxu::to_vector({
- check.next(0, false)
- });
-
- auto record = [&s, &check, &checks](long at) -> void {
- checks.push_back(check.next(at, s.has_observers()));
- };
-
- auto o = s.get_subscriber();
-
- w.schedule_absolute(100, [&s, &o, &checks, &record](const rxsc::schedulable&){
- s = rxsub::subject<int>(); o = s.get_subscriber(); checks.clear(); record(100);});
- w.schedule_absolute(200, [&xs, &o, &record](const rxsc::schedulable&){
- xs.subscribe(o); record(200);});
- w.schedule_absolute(1000, [&o, &record](const rxsc::schedulable&){
- o.unsubscribe(); record(1000);});
-
- w.schedule_absolute(300, [&s, &results1, &record](const rxsc::schedulable&){
- s.get_observable().subscribe(results1); record(300);});
- w.schedule_absolute(400, [&s, &results2, &record](const rxsc::schedulable&){
- s.get_observable().subscribe(results2); record(400);});
- w.schedule_absolute(900, [&s, &results3, &record](const rxsc::schedulable&){
- s.get_observable().subscribe(results3); record(900);});
-
- w.schedule_absolute(600, [&results1, &record](const rxsc::schedulable&){
- results1.unsubscribe(); record(600);});
- w.schedule_absolute(700, [&results2, &record](const rxsc::schedulable&){
- results2.unsubscribe(); record(700);});
- w.schedule_absolute(800, [&results1, &record](const rxsc::schedulable&){
- results1.unsubscribe(); record(800);});
- w.schedule_absolute(950, [&results3, &record](const rxsc::schedulable&){
- results3.unsubscribe(); record(950);});
-
- w.start();
-
- THEN("result1 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7)
- });
- auto actual = results1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result2 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(410, 6),
- on.next(520, 7),
- on.next(630, 8)
- });
- auto actual = results2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result3 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(940, 11)
- });
- auto actual = results3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("checks contains expected messages"){
- auto required = rxu::to_vector({
- check.next(100, false),
- check.next(200, false),
- check.next(300, true),
- check.next(400, true),
- check.next(600, true),
- check.next(700, false),
- check.next(800, false),
- check.next(900, true),
- check.next(950, false),
- check.next(1000, false)
- });
- auto actual = checks;
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("subject - finite source", "[subject][subjects]"){
- GIVEN("a subject and an finite source"){
-
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(70, 1),
- on.next(110, 2),
- on.next(220, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7),
- on.completed(630),
- on.next(640, 9),
- on.completed(650),
- on.error(660, std::runtime_error("error on unsubscribed stream"))
- });
-
- rxsub::subject<int> s;
-
- auto results1 = w.make_subscriber<int>();
-
- auto results2 = w.make_subscriber<int>();
-
- auto results3 = w.make_subscriber<int>();
-
- WHEN("multicasting an infinite source"){
-
- auto o = s.get_subscriber();
-
- w.schedule_absolute(100, [&s, &o](const rxsc::schedulable&){
- s = rxsub::subject<int>(); o = s.get_subscriber();});
- w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable&){
- xs.subscribe(o);});
- w.schedule_absolute(1000, [&o](const rxsc::schedulable&){
- o.unsubscribe();});
-
- w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable&){
- s.get_observable().subscribe(results1);});
- w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable&){
- s.get_observable().subscribe(results2);});
- w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable&){
- s.get_observable().subscribe(results3);});
-
- w.schedule_absolute(600, [&results1](const rxsc::schedulable&){
- results1.unsubscribe();});
- w.schedule_absolute(700, [&results2](const rxsc::schedulable&){
- results2.unsubscribe();});
- w.schedule_absolute(800, [&results1](const rxsc::schedulable&){
- results1.unsubscribe();});
- w.schedule_absolute(950, [&results3](const rxsc::schedulable&){
- results3.unsubscribe();});
-
- w.start();
-
- THEN("result1 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7)
- });
- auto actual = results1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result2 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(410, 6),
- on.next(520, 7),
- on.completed(630)
- });
- auto actual = results2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result3 contains expected messages"){
- auto required = rxu::to_vector({
- on.completed(900)
- });
- auto actual = results3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-
-SCENARIO("subject - on_error in source", "[subject][subjects]"){
- GIVEN("a subject and a source with an error"){
-
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("subject on_error in stream");
-
- auto xs = sc.make_hot_observable({
- on.next(70, 1),
- on.next(110, 2),
- on.next(220, 3),
- on.next(270, 4),
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7),
- on.error(630, ex),
- on.next(640, 9),
- on.completed(650),
- on.error(660, std::runtime_error("error on unsubscribed stream"))
- });
-
- rxsub::subject<int> s;
-
- auto results1 = w.make_subscriber<int>();
-
- auto results2 = w.make_subscriber<int>();
-
- auto results3 = w.make_subscriber<int>();
-
- WHEN("multicasting an infinite source"){
-
- auto o = s.get_subscriber();
-
- w.schedule_absolute(100, [&s, &o](const rxsc::schedulable&){
- s = rxsub::subject<int>(); o = s.get_subscriber();});
- w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable&){
- xs.subscribe(o);});
- w.schedule_absolute(1000, [&o](const rxsc::schedulable&){
- o.unsubscribe();});
-
- w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable&){
- s.get_observable().subscribe(results1);});
- w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable&){
- s.get_observable().subscribe(results2);});
- w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable&){
- s.get_observable().subscribe(results3);});
-
- w.schedule_absolute(600, [&results1](const rxsc::schedulable&){
- results1.unsubscribe();});
- w.schedule_absolute(700, [&results2](const rxsc::schedulable&){
- results2.unsubscribe();});
- w.schedule_absolute(800, [&results1](const rxsc::schedulable&){
- results1.unsubscribe();});
- w.schedule_absolute(950, [&results3](const rxsc::schedulable&){
- results3.unsubscribe();});
-
- w.start();
-
- THEN("result1 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(340, 5),
- on.next(410, 6),
- on.next(520, 7)
- });
- auto actual = results1.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result2 contains expected messages"){
- auto required = rxu::to_vector({
- on.next(410, 6),
- on.next(520, 7),
- on.error(630, ex)
- });
- auto actual = results2.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- THEN("result3 contains expected messages"){
- auto required = rxu::to_vector({
- on.error(900, ex)
- });
- auto actual = results3.get_observer().messages();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
diff --git a/Rx/v2/test/subscriptions/coroutine.cpp b/Rx/v2/test/subscriptions/coroutine.cpp
deleted file mode 100644
index d678714..0000000
--- a/Rx/v2/test/subscriptions/coroutine.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-#include "../test.h"
-
-#include <rxcpp/rx-coroutine.hpp>
-
-#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
-
-SCENARIO("coroutine completes", "[coroutine]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(210, 2),
- on.next(310, 10),
- on.completed(350)
- });
-
- WHEN("for co_await"){
-
- std::vector<typename rxsc::test::messages<int>::recorded_type> messages;
-
- w.advance_to(rxsc::test::subscribed_time);
-
- auto d = [&]() -> std::future<void> {
- RXCPP_TRY {
- for co_await (auto n : xs | rxo::as_dynamic()) {
- messages.push_back(on.next(w.clock(), n));
- }
- messages.push_back(on.completed(w.clock()));
- } RXCPP_CATCH(...) {
- messages.push_back(on.error(w.clock(), rxu::current_exception()));
- }
- }();
-
- w.advance_to(rxsc::test::unsubscribed_time);
-
- THEN("the function completed"){
- REQUIRE(d.wait_for(std::chrono::seconds(0)) == std::future_status::ready);
- }
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.next(310, 10),
- on.completed(350)
- });
- auto actual = messages;
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 350)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-SCENARIO("coroutine errors", "[coroutine]"){
- GIVEN("a source") {
- auto sc = rxsc::make_test();
- auto w = sc.create_worker();
- const rxsc::test::messages<int> on;
-
- std::runtime_error ex("error in source");
-
- auto xs = sc.make_hot_observable({
- on.next(110, 1),
- on.next(210, 2),
- on.error(310, ex),
- on.next(310, 10),
- on.completed(350)
- });
-
- WHEN("for co_await"){
-
- std::vector<typename rxsc::test::messages<int>::recorded_type> messages;
-
- w.advance_to(rxsc::test::subscribed_time);
-
- auto d = [&]() -> std::future<void> {
- RXCPP_TRY {
- for co_await (auto n : xs | rxo::as_dynamic()) {
- messages.push_back(on.next(w.clock(), n));
- }
- messages.push_back(on.completed(w.clock()));
- } RXCPP_CATCH(...) {
- messages.push_back(on.error(w.clock(), rxu::current_exception()));
- }
- }();
-
- w.advance_to(rxsc::test::unsubscribed_time);
-
- THEN("the function completed"){
- REQUIRE(d.wait_for(std::chrono::seconds(0)) == std::future_status::ready);
- }
-
- THEN("the output only contains true"){
- auto required = rxu::to_vector({
- on.next(210, 2),
- on.error(310, ex)
- });
- auto actual = messages;
- REQUIRE(required == actual);
- }
-
- THEN("there was 1 subscription/unsubscription to the source"){
- auto required = rxu::to_vector({
- on.subscribe(200, 310)
- });
- auto actual = xs.subscriptions();
- REQUIRE(required == actual);
- }
-
- }
- }
-}
-
-#endif
diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp
deleted file mode 100644
index 894e610..0000000
--- a/Rx/v2/test/subscriptions/observer.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "../test.h"
-
-SCENARIO("subscriber traits", "[observer][traits]"){
- GIVEN("given some subscriber types"){
- int result = 0;
- auto next = [&result](int i){result += i;};
- auto error = [&result](rxu::error_ptr){result += 10;};
- auto completed = [&result](){result += 100;};
-// auto ra = rx::rxu::detail::arg_resolver_n<0, rx::tag_resumption_resolution::template predicate, typename rx::tag_resumption_resolution::default_type, rx::resumption, decltype(next), decltype(error), decltype(completed), rx::rxu::detail::tag_unresolvable, rx::rxu::detail::tag_unresolvable>(rx::resumption(), next, error, completed, rx::rxu::detail::tag_unresolvable(), rx::rxu::detail::tag_unresolvable());
-// auto ra = typename rx::rxu::detail::arg_resolver<rx::tag_resumption_resolution::template predicate, typename rx::tag_resumption_resolution::default_type, rx::resumption, decltype(next), decltype(error), decltype(completed)>::type(rx::resumption(), next, error, completed, rx::rxu::detail::tag_unresolvable(), rx::rxu::detail::tag_unresolvable());
-// auto arg = rx::rxu::detail::resolve_arg<rx::tag_resumption_resolution::template predicate, typename rx::tag_resumption_resolution::default_type>(rx::resumption(), next, error, completed);
-// auto argset = rx::rxu::detail::resolve_arg_set(rxcpp::detail::tag_subscriber_set<int>(), rx::resumption(), next, error, completed);
-// auto o = rx::detail::make_observer_resolved<int>(argset);
-// auto o = rx::detail::select_observer<int>(argset);
-// auto scrbResult = rx::subscriber<int, decltype(o)>(std::move(std::get<0>(argset).value), std::move(std::get<1>(argset).value), o);
-// static_assert(std::tuple_element<1, decltype(argset)>::type::is_arg, "resumption is a required parameter");
-// auto scrbResult = rx::detail::make_subscriber_resolved<int>(rx::rxu::detail::resolve_arg_set(rx::detail::tag_subscriber_set<int>(), rx::resumption(), next, error, completed));
-// auto scrbResult = rx::detail::make_subscriber_resolved<int>(argset);
- auto scrbResult = rx::make_subscriber<int>(next, error, completed);
- auto scrbdup = rx::make_subscriber<int>(scrbResult);
- auto scrbop = rx::make_subscriber<int>(scrbResult, next, error, completed);
- auto scrbsharelifetime = rx::make_subscriber<int>(scrbResult, scrbop.get_observer());
- auto scrbuniquelifetime = rx::make_subscriber<int>(scrbResult, rx::composite_subscription());
-
- auto emptyNext = [](int){};
- auto scrb = rx::make_subscriber<int>(emptyNext);
- WHEN("tested"){
- THEN("is_observer value is true for subscriber"){
- REQUIRE(rx::is_observer<decltype(scrb)>::value);
- }
- THEN("is_subscription value is true for subscriber"){
- REQUIRE(rx::is_subscription<decltype(scrb)>::value);
- }
- }
- WHEN("nothing is called"){
- THEN("static_observer result is 0"){
- REQUIRE(result == 0);
- }
- }
- WHEN("onnext is called with 1"){
- THEN("subscriber result is 1"){
- scrbResult.on_next(1);
- REQUIRE(result == 1);
- }
- }
- WHEN("after error"){
- THEN("subscriber result is 10"){
- scrbResult.on_error(rxu::current_exception());
- REQUIRE(result == 10);
- }
- }
- WHEN("after completed"){
- THEN("subscriber result is 100"){
- scrbResult.on_completed();
- REQUIRE(result == 100);
- }
- }
- }
-}
-
-SCENARIO("observer traits", "[observer][traits]"){
- GIVEN("given some observer types"){
- auto emptyNext = [](int){};
- auto dob = rx::make_observer_dynamic<int>(emptyNext);
- auto so = rx::make_observer<int>(emptyNext);
- auto eo = rx::make_observer<int>();
- WHEN("tested"){
- THEN("is_observer value is true for dynamic_observer"){
- REQUIRE(rx::is_observer<decltype(dob)>::value);
- }
- THEN("is_observer value is true for static_observer"){
- REQUIRE(rx::is_observer<decltype(so)>::value);
- }
- THEN("is_observer value is true for observer<void>"){
- REQUIRE(rx::is_observer<decltype(eo)>::value);
- }
- }
- }
-}
-
-SCENARIO("non-observer traits", "[observer][traits]"){
- GIVEN("given some subscription types"){
- auto empty = [](){};
- rx::static_subscription<decltype(empty)> ss(empty);
- auto es = rx::make_subscription();
- rx::composite_subscription cs;
- WHEN("tested"){
- THEN("is_observer value is false for static_subscription"){
- REQUIRE(!rx::is_observer<decltype(ss)>::value);
- }
- THEN("is_observer value is false for subscription<void>"){
- REQUIRE(!rx::is_observer<decltype(es)>::value);
- }
- THEN("is_observer value is false for composite_subscription"){
- REQUIRE(!rx::is_observer<decltype(cs)>::value);
- }
- }
- }
-}
-
-SCENARIO("subscriber behavior", "[observer][traits]"){
- GIVEN("given some subscriber types"){
- int result = 0;
- auto next = [&result](int i){result += i;};
- auto error = [&result](rxu::error_ptr){result += 10;};
- auto completed = [&result](){result += 100;};
- auto dob = rx::make_subscriber<int>(rx::make_observer_dynamic<int>(next, error, completed));
- auto so = rx::make_subscriber<int>(next, error, completed);
- WHEN("nothing is called"){
- THEN("dynamic_observer result is 0"){
- REQUIRE(result == 0);
- }
- THEN("static_observer result is 0"){
- REQUIRE(result == 0);
- }
- THEN("observer<void> result is 0"){
- REQUIRE(result == 0);
- }
- THEN("dynamic_observer is subscribed"){
- REQUIRE(dob.is_subscribed());
- }
- THEN("static_observer is subscribed"){
- REQUIRE(so.is_subscribed());
- }
- }
- WHEN("onnext is called with 1"){
- THEN("dynamic_observer result is 1"){
- dob.on_next(1);
- REQUIRE(result == 1);
- }
- THEN("static_observer result is 1"){
- so.on_next(1);
- REQUIRE(result == 1);
- }
- THEN("dynamic_observer is subscribed"){
- dob.on_next(1);
- REQUIRE(dob.is_subscribed());
- }
- THEN("static_observer is subscribed"){
- so.on_next(1);
- REQUIRE(so.is_subscribed());
- }
- }
- WHEN("after error"){
- THEN("dynamic_observer result is 10"){
- dob.on_error(rxu::current_exception());
- REQUIRE(result == 10);
- }
- THEN("static_observer result is 10"){
- so.on_error(rxu::current_exception());
- REQUIRE(result == 10);
- }
- THEN("dynamic_observer is not subscribed"){
- dob.on_error(rxu::current_exception());
- REQUIRE(!dob.is_subscribed());
- }
- THEN("static_observer is not subscribed"){
- so.on_error(rxu::current_exception());
- REQUIRE(!so.is_subscribed());
- }
- }
- WHEN("after completed"){
- THEN("dynamic_observer result is 100"){
- dob.on_completed();
- REQUIRE(result == 100);
- }
- THEN("static_observer result is 100"){
- so.on_completed();
- REQUIRE(result == 100);
- }
- THEN("dynamic_observer is not subscribed"){
- dob.on_completed();
- REQUIRE(!dob.is_subscribed());
- }
- THEN("static_observer is not subscribed"){
- so.on_completed();
- REQUIRE(!so.is_subscribed());
- }
- }
- }
-}
diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp
deleted file mode 100644
index 33218a7..0000000
--- a/Rx/v2/test/subscriptions/subscription.cpp
+++ /dev/null
@@ -1,461 +0,0 @@
-#include "../test.h"
-#include "rxcpp/operators/rx-combine_latest.hpp"
-#include "rxcpp/operators/rx-map.hpp"
-#include "rxcpp/operators/rx-take.hpp"
-#include "rxcpp/operators/rx-observe_on.hpp"
-#include "rxcpp/operators/rx-publish.hpp"
-#include "rxcpp/operators/rx-ref_count.hpp"
-
-#include <sstream>
-
-SCENARIO("observe subscription", "[!hide]"){
- GIVEN("observable of ints"){
- WHEN("subscribe"){
- auto observers = std::make_shared<std::list<rxcpp::subscriber<int>>>();
-
- auto observable = rxcpp::observable<>::create<int>([=](rxcpp::subscriber<int> out){
- auto it = observers->insert(observers->end(), out);
- it->add([=](){
- observers->erase(it);
- });
- });
-
- }
- }
-}
-
-static const int static_subscriptions = 10000;
-
-SCENARIO("for loop subscribes to map", "[!hide][for][just][subscribe][long][perf]"){
- const int& subscriptions = static_subscriptions;
- GIVEN("a for loop"){
- WHEN("subscribe 100K times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
- int runs = 10;
-
- auto loop = [&](const rxsc::schedulable& self) {
- int c = 0;
- int n = 1;
- auto start = clock::now();
- for (int i = 0; i < subscriptions; i++) {
- rx::observable<>::just(1)
- .map([](int i) {
- std::stringstream serializer;
- serializer << i;
- return serializer.str();
- })
- .map([](const std::string& s) {
- int i;
- std::stringstream(s) >> i;
- return i;
- })
- .subscribe([&](int){
- ++c;
- });
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop subscribe map : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- if (--runs > 0) {
- self();
- }
- };
-
- w.schedule(loop);
- }
- }
-}
-
-SCENARIO("for loop subscribes to combine_latest", "[!hide][for][just][combine_latest][subscribe][long][perf]"){
- const int& subscriptions = static_subscriptions;
- GIVEN("a for loop"){
- WHEN("subscribe 100K times"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
- int runs = 10;
-
- auto loop = [&](const rxsc::schedulable& self) {
- int c = 0;
- int n = 1;
- auto start = clock::now();
- for (int i = 0; i < subscriptions; i++) {
- rx::observable<>::just(1)
- .combine_latest([](int i, int j) {
- return i + j;
- }, rx::observable<>::just(2))
- .subscribe([&](int){
- ++c;
- });
- }
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "loop subscribe combine_latest : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- if (--runs > 0) {
- self();
- }
- };
-
- w.schedule(loop);
- }
- }
-}
-
-SCENARIO("synchronized range debug", "[!hide][subscribe][range][synchronize_debug][synchronize][long][perf]"){
- GIVEN("range"){
- WHEN("synchronized"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
-
- auto es = rx::synchronize_event_loop();
-
- const int values = 10000;
-
- int runs = 10;
-
- auto loop = [&](const rxsc::schedulable& self) {
- std::atomic<int> c(0);
- int n = 1;
- auto liftrequirecompletion = [&](rx::subscriber<int> dest){
- auto completionstate = std::make_shared<std::tuple<bool, long, rx::subscriber<int>>>(false, 0, std::move(dest));
- std::get<2>(*completionstate).add([=](){
- if (std::get<1>(*completionstate) != values || !std::get<0>(*completionstate)) {
- abort();
- }
- });
- // VS2013 deduction issue requires dynamic (type-forgetting)
- return rx::make_subscriber<int>(
- std::get<2>(*completionstate),
- [=](int n){
- ++std::get<1>(*completionstate);
- std::get<2>(*completionstate).on_next(n);
- },
- [=](rxu::error_ptr){
- abort();
- },
- [=](){
- if (std::get<1>(*completionstate) != values) {
- abort();
- }
- std::get<0>(*completionstate) = true;
- std::get<2>(*completionstate).on_completed();
- }).as_dynamic();
- };
- auto start = clock::now();
- auto ew = es.create_coordinator().get_worker();
- std::atomic<int> v(0);
- auto s0 = rxs::range(1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .publish_synchronized(es)
- .ref_count()
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- auto s1 = rxs::range(values + 1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .publish_synchronized(es)
- .ref_count()
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- auto s2 = rxs::range((values * 2) + 1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .publish_synchronized(es)
- .ref_count()
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- while(v != values * 3 || c != 3);
- s0.unsubscribe();
- s1.unsubscribe();
- s2.unsubscribe();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "range synchronized : " << n << " subscribed, " << v << " on_next calls, " << msElapsed.count() << "ms elapsed, " << v / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- if (--runs > 0) {
- self();
- }
- };
-
- w.schedule(loop);
- }
- }
-}
-
-SCENARIO("observe_on range debug", "[!hide][subscribe][range][observe_on_debug][observe_on][long][perf]"){
- GIVEN("range"){
- WHEN("observed on"){
- using namespace std::chrono;
- typedef steady_clock clock;
-
- auto sc = rxsc::make_current_thread();
- auto w = sc.create_worker();
-
- auto es = rx::observe_on_event_loop();
-
- const int values = 10000;
-
- int runs = 10;
-
- auto loop = [&](const rxsc::schedulable& self) {
- std::atomic<int> c(0);
- int n = 1;
- auto liftrequirecompletion = [&](rx::subscriber<int> dest){
- auto completionstate = std::make_shared<std::tuple<bool, long, rx::subscriber<int>>>(false, 0, std::move(dest));
- std::get<2>(*completionstate).add([=](){
- if (std::get<1>(*completionstate) != values || !std::get<0>(*completionstate)) {
- abort();
- }
- });
- // VS2013 deduction issue requires dynamic (type-forgetting)
- return rx::make_subscriber<int>(
- std::get<2>(*completionstate),
- [=](int n){
- ++std::get<1>(*completionstate);
- std::get<2>(*completionstate).on_next(n);
- },
- [=](rxu::error_ptr){
- abort();
- },
- [=](){
- if (std::get<1>(*completionstate) != values) {
- abort();
- }
- std::get<0>(*completionstate) = true;
- std::get<2>(*completionstate).on_completed();
- }).as_dynamic();
- };
- auto start = clock::now();
- auto ew = es.create_coordinator().get_worker();
- std::atomic<int> v(0);
- auto s0 = rxs::range(1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .observe_on(es)
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- auto s1 = rxs::range(values + 1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .observe_on(es)
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- auto s2 = rxs::range((values * 2) + 1, es)
- .take(values)
- .lift<int>(liftrequirecompletion)
- .as_dynamic()
- .observe_on(es)
- .lift<int>(liftrequirecompletion)
- .subscribe(
- rx::make_observer_dynamic<int>(
- [&](int){
- ++v;
- },
- [&](){
- ++c;
- }));
- while(v != values * 3 || c != 3);
- s0.unsubscribe();
- s1.unsubscribe();
- s2.unsubscribe();
- auto finish = clock::now();
- auto msElapsed = duration_cast<milliseconds>(finish-start);
- std::cout << "range observe_on : " << n << " subscribed, " << v << " on_next calls, " << msElapsed.count() << "ms elapsed, " << v / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl;
-
- if (--runs > 0) {
- self();
- }
- };
-
- w.schedule(loop);
- }
- }
-}
-
-SCENARIO("subscription traits", "[subscription][traits]"){
- GIVEN("given some subscription types"){
- auto es = rx::make_subscription();
- rx::composite_subscription cs;
- WHEN("tested"){
- THEN("is_subscription value is true for empty subscription"){
- REQUIRE(rx::is_subscription<decltype(es)>::value);
- }
- THEN("is_subscription value is true for composite_subscription"){
- REQUIRE(rx::is_subscription<decltype(cs)>::value);
- }
- }
- }
-}
-
-SCENARIO("non-subscription traits", "[subscription][traits]"){
- GIVEN("given some non-subscription types"){
- auto l = [](){};
- int i = 0;
- void* v = nullptr;
- WHEN("tested"){
- THEN("is_subscription value is false for lambda"){
- l();
- REQUIRE(!rx::is_subscription<decltype(l)>::value);
- }
- THEN("is_subscription value is false for int"){
- i = 0;
- REQUIRE(!rx::is_subscription<decltype(i)>::value);
- }
- THEN("is_subscription value is false for void*"){
- v = nullptr;
- REQUIRE(!rx::is_subscription<decltype(v)>::value);
- }
- THEN("is_subscription value is false for void"){
- REQUIRE(!rx::is_subscription<void>::value);
- }
- }
- }
-}
-
-SCENARIO("subscription static", "[subscription]"){
- GIVEN("given a subscription"){
- int i=0;
- auto s = rx::make_subscription([&i](){++i;});
- WHEN("not used"){
- THEN("is subscribed"){
- REQUIRE(s.is_subscribed());
- }
- THEN("i is 0"){
- REQUIRE(i == 0);
- }
- }
- WHEN("used"){
- THEN("is not subscribed when unsubscribed once"){
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- THEN("is not subscribed when unsubscribed twice"){
- s.unsubscribe();
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- THEN("i is 1 when unsubscribed once"){
- s.unsubscribe();
- REQUIRE(i == 1);
- }
- THEN("i is 1 when unsubscribed twice"){
- s.unsubscribe();
- s.unsubscribe();
- REQUIRE(i == 1);
- }
- }
- }
-}
-
-SCENARIO("subscription empty", "[subscription]"){
- GIVEN("given an empty subscription"){
- auto s = rx::make_subscription();
- WHEN("not used"){
- THEN("is not subscribed"){
- REQUIRE(!s.is_subscribed());
- }
- }
- WHEN("used"){
- THEN("is not subscribed when unsubscribed once"){
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- THEN("is not subscribed when unsubscribed twice"){
- s.unsubscribe();
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- }
- }
-}
-
-SCENARIO("subscription composite", "[subscription]"){
- GIVEN("given a subscription"){
- int i=0;
- rx::composite_subscription s;
- s.add(rx::make_subscription());
- s.add(rx::make_subscription([&i](){++i;}));
- s.add([&i](){++i;});
- WHEN("not used"){
- THEN("is subscribed"){
- REQUIRE(s.is_subscribed());
- }
- THEN("i is 0"){
- REQUIRE(i == 0);
- }
- }
- WHEN("used"){
- THEN("is not subscribed when unsubscribed once"){
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- THEN("is not subscribed when unsubscribed twice"){
- s.unsubscribe();
- s.unsubscribe();
- REQUIRE(!s.is_subscribed());
- }
- THEN("i is 2 when unsubscribed once"){
- s.unsubscribe();
- REQUIRE(i == 2);
- }
- THEN("i is 2 when unsubscribed twice"){
- s.unsubscribe();
- s.unsubscribe();
- REQUIRE(i == 2);
- }
- }
- }
-}
-
diff --git a/Rx/v2/test/test.cpp b/Rx/v2/test/test.cpp
deleted file mode 100644
index 8cd3e05..0000000
--- a/Rx/v2/test/test.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <exception>
-#if (__GLIBCXX__ / 10000) == 2014 || (__GLIBCXX__ / 10000) == 2015
-namespace std {
-inline bool uncaught_exception() noexcept(true) {
- return current_exception() != nullptr;
-}
-}
-#endif
-
-#define CATCH_CONFIG_MAIN
-#include "catch.hpp"
diff --git a/Rx/v2/test/test.h b/Rx/v2/test/test.h
deleted file mode 100644
index fc8fe08..0000000
--- a/Rx/v2/test/test.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <exception>
-#if (__GLIBCXX__ / 10000) == 2014 || (__GLIBCXX__ / 10000) == 2015
-namespace std {
-inline bool uncaught_exception() noexcept(true) {
- return current_exception() != nullptr;
-}
-}
-#endif
-
-#include "rxcpp/rx-lite.hpp"
-namespace rx=rxcpp;
-namespace rxu=rxcpp::util;
-namespace rxs=rxcpp::sources;
-namespace rxo=rxcpp::operators;
-namespace rxsub=rxcpp::subjects;
-namespace rxsc=rxcpp::schedulers;
-namespace rxn=rx::notifications;
-
-#include "rxcpp/rx-test.hpp"
-namespace rxt = rxcpp::test;
-
-#include "catch.hpp"
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 42882b2..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-version: 2.2.{build}
-
-branches:
-# whitelist
- only:
- - master
- - appveyor
-
-image: Visual Studio 2017
-
-environment:
- matrix:
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- VSVER: Visual Studio 14 2015 Win64
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- VSVER: Visual Studio 15 2017 Win64
-
-platform:
- - x64
-
-configuration:
- - Release
-
-install:
- - cmake --version
- - git submodule -q update --init
-
-before_build:
- - cmake -G"%VSVER%" .
-
-build:
- project: build\rxcpp.sln
-
-test_script:
- - cd build\test\
- - ctest -V -C Release
- - cd ..\..
-
-artifacts:
- - path: Rx\v2\src\
- name: rxcpp source
- type: zip
- - path: Rx\v2\examples\
- name: rxcpp examples
- type: zip
-
-notifications:
- - provider: Webhook
- url: https://webhooks.gitter.im/e/4c53c094183ccaa8d059
- method: POST
- on_build_success: true
- on_build_failure: true
- on_build_status_changed: false
- - provider: Email
- to:
- - kirk.shoop@microsoft.com
- on_build_success: true
- on_build_failure: true
- on_build_status_changed: false
diff --git a/license.md b/license.md
deleted file mode 100644
index 051a6b5..0000000
--- a/license.md
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt
deleted file mode 100644
index 3d07447..0000000
--- a/projects/CMake/CMakeLists.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-project(rxcpp VERSION 2.2.4 LANGUAGES C CXX)
-
-set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-
-# define some folders
-
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-add_subdirectory(${RXCPP_DIR}/Rx/v2/test ${CMAKE_CURRENT_BINARY_DIR}/test)
-
-add_subdirectory(${RXCPP_DIR}/projects/doxygen ${CMAKE_CURRENT_BINARY_DIR}/projects/doxygen)
-
-set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples)
-
-add_subdirectory(${EXAMPLES_DIR}/cep ${CMAKE_CURRENT_BINARY_DIR}/examples/cep)
-add_subdirectory(${EXAMPLES_DIR}/stop ${CMAKE_CURRENT_BINARY_DIR}/examples/stop)
-add_subdirectory(${EXAMPLES_DIR}/linesfrombytes ${CMAKE_CURRENT_BINARY_DIR}/examples/linesfrombytes)
-add_subdirectory(${EXAMPLES_DIR}/println ${CMAKE_CURRENT_BINARY_DIR}/examples/println)
-add_subdirectory(${EXAMPLES_DIR}/pythagorian ${CMAKE_CURRENT_BINARY_DIR}/examples/pythagorian)
-add_subdirectory(${EXAMPLES_DIR}/tests ${CMAKE_CURRENT_BINARY_DIR}/examples/tests)
-
-# The list of RxCpp source files. Please add every new file to this list
-set(RX_SOURCES
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-all.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-amb.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-any.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-concat.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-debounce.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-delay.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-distinct.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-element_at.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-filter.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-finally.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-group_by.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-ignore_elements.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-lift.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-map.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-merge.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-merge_delay_error.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-multicast.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-on_error_resume_next.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-publish.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-reduce.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-repeat.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-replay.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-retry-repeat-common.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-retry.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-sample_time.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-scan.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-sequence_equal.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-skip.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-skip_while.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-skip_last.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-start_with.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-switch_if_empty.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-take.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-take_last.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-take_until.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-take_while.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-tap.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-time_interval.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-timeout.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-timestamp.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-with_latest_from.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-window.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-window_time.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-window_toggle.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/operators/rx-zip.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-composite_exception.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-connectable_observable.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-coordination.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-coroutine.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-grouped_observable.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-includes.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-lite.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-notification.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-observable.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-observer.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-operators.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-predef.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-scheduler.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-sources.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-subjects.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-subscriber.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-subscription.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-test.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-trace.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx-util.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/rx.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-runloop.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-test.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-create.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-defer.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-empty.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-error.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-interval.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-iterate.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-never.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-range.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-scope.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/sources/rx-timer.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/subjects/rx-replaysubject.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/subjects/rx-subject.hpp
- ${RXCPP_DIR}/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp
-)
-
-# Grouping all the source files puts them into a virtual folder in Visual Studio
-source_group("src" FILES ${RX_SOURCES})
-
-if (MSVC)
-# This 'RxCpp' build target only appears to be a virtual project for IDEs.
-# It won't actually build correctly since it is missing the shared.cmake integration.
-add_library(RxCpp SHARED ${RX_SOURCES})
-SET_TARGET_PROPERTIES(RxCpp PROPERTIES LINKER_LANGUAGE CXX)
-endif (MSVC)
-
-set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE CACHE BOOL "Don't require all projects to be built in order to install" FORCE)
-
-install(DIRECTORY ${RXCPP_DIR}/Rx/v2/src/rxcpp/ DESTINATION include/rxcpp
- FILES_MATCHING PATTERN "*.hpp")
diff --git a/projects/CMake/shared.cmake b/projects/CMake/shared.cmake
deleted file mode 100644
index f7f7a31..0000000
--- a/projects/CMake/shared.cmake
+++ /dev/null
@@ -1,71 +0,0 @@
-FIND_PACKAGE(Threads)
-
-option(RX_USE_EXCEPTIONS "Use C++ exceptions" ON)
-
-# define some compiler settings
-
-MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} )
-
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- MESSAGE( STATUS "clang compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
- MESSAGE( STATUS "using clang settings" )
- set(RX_COMPILE_OPTIONS
- -Wall -Wextra -Werror -Wunused
- -stdlib=libc++
- -Wno-error=unused-command-line-argument
- -ftemplate-depth=1024
- )
- if (NOT RX_USE_EXCEPTIONS)
- MESSAGE( STATUS "no exceptions" )
- list(APPEND RX_COMPILE_OPTIONS -fno-exceptions)
- endif()
-elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- MESSAGE( STATUS "gnu compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
- MESSAGE( STATUS "using gnu settings" )
- set(RX_COMPILE_OPTIONS
- -Wall -Wextra -Werror -Wunused
- )
- if (NOT RX_USE_EXCEPTIONS)
- MESSAGE( STATUS "no exceptions" )
- list(APPEND RX_COMPILE_OPTIONS -fno-exceptions)
- endif()
- elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- MESSAGE( STATUS "msvc compiler version: " ${CMAKE_CXX_COMPILER_VERSION} )
- MESSAGE( STATUS "using msvc settings" )
- set(RX_COMPILE_OPTIONS
- /W4 /WX
- /wd4503 # truncated symbol
- /wd4702 # unreachable code
- /bigobj
- /DUNICODE /D_UNICODE # it is a new millenium
- )
- if (NOT RX_USE_EXCEPTIONS)
- MESSAGE( STATUS "no exceptions" )
- list(APPEND RX_COMPILE_OPTIONS /EHs-c-)
- endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.23506.0")
- MESSAGE( STATUS "with coroutines" )
- list(APPEND RX_COMPILE_OPTIONS
- /await # enable coroutines
- )
- endif()
-endif()
-
-set(RX_COMPILE_FEATURES
- cxx_auto_type
- cxx_nullptr
- cxx_decltype
- cxx_lambdas
- cxx_range_for
- cxx_right_angle_brackets
- cxx_rvalue_references
- cxx_static_assert
- cxx_trailing_return_types
- cxx_alias_templates
- cxx_variadic_templates
- cxx_template_template_parameters
- )
-
-set(IX_SRC_DIR ${RXCPP_DIR}/Ix/CPP/src)
-set(RX_SRC_DIR ${RXCPP_DIR}/Rx/v2/src)
-set(RX_CATCH_DIR ${RXCPP_DIR}/ext/catch/single_include/catch2)
diff --git a/projects/doxygen/CMakeLists.txt b/projects/doxygen/CMakeLists.txt
deleted file mode 100644
index 1c1ba4c..0000000
--- a/projects/doxygen/CMakeLists.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
-
-project(doxygen LANGUAGES C CXX)
-
-# define some folders
-
-get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
-get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH)
-
-MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} )
-
-# target to generate documentation with Doxygen
-find_package(Doxygen)
-
-if(DOXYGEN_FOUND)
- include(${RXCPP_DIR}/projects/CMake/shared.cmake)
- set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples)
-
- # Doxygen configuration
- set(DOXY_CONF_DIR ${RXCPP_DIR}/projects/doxygen)
- set(DOXY_CONF_FILE ${DOXY_CONF_DIR}/doxygen.conf)
-
- # File with main page (index.html) content
- set(DOXY_MAIN_PAGE ${DOXY_CONF_DIR}/mainpage.dox)
- set(DOXY_FOOTER_HTML ${DOXY_CONF_DIR}/footer.html)
-
- # Sources for processing location
- set(DOXY_INPUT_DIR "${IX_SRC_DIR} ${RX_SRC_DIR} ${DOXY_MAIN_PAGE}")
-
- # C++ examples location
- set(DOXY_EXAMPLES_SRC_DIR ${EXAMPLES_DIR}/doxygen)
- set(DOXY_EXAMPLES_BIN_DIR doxy_examples)
-
- # Directories and files allowed for include-type command (\include, \example, \snippet etc)
- set(DOXY_INCLUDE_DIR "${RXCPP_DIR} ${DOXY_EXAMPLES_SRC_DIR}")
-
- # Resulting documentation to be placed here
- set(DOXY_OUTPUT_DIR ${RXCPP_DIR}/projects/doxygen)
-
- # Make Doxygen configuration from template with placeholders
- configure_file(${DOXY_CONF_FILE}.in ${DOXY_CONF_FILE})
-
- # Target to build examples
- set(DOXY_EXAMPLE_SRC_LIST
- ${DOXY_EXAMPLES_SRC_DIR}/main.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/all.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/amb.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/as_dynamic.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/blocking_observable.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/buffer.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/combine_latest.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/composite_exception.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/concat.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/concat_map.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/contains.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/create.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/defer.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/debounce.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/default_if_empty.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/delay.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/distinct.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/distinct_until_changed.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/element_at.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/empty.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/error.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/exists.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/filter.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/finally.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/flat_map.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/from.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/group_by.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/ignore_elements.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/interval.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/iterate.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/just.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/map.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/math.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/merge.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/merge_delay_error.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/never.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/observe_on.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/on_error_resume_next.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/pairwise.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/publish.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/range.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/reduce.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/ref_count.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/repeat.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/replay.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/retry.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/sample.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/scan.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/scope.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/sequence_equal.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/skip.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/skip_while.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/skip_last.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/skip_until.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/start_with.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/subscribe.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/subscribe_on.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/switch_if_empty.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/switch_on_next.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/take.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/take_last.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/take_until.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/take_while.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/tap.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/time_interval.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/timeout.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/timer.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/timestamp.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/with_latest_from.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/window.cpp
- ${DOXY_EXAMPLES_SRC_DIR}/zip.cpp
- )
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DOXY_EXAMPLES_BIN_DIR})
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${DOXY_EXAMPLES_BIN_DIR})
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DOXY_EXAMPLES_BIN_DIR})
- add_executable(doxy_examples EXCLUDE_FROM_ALL ${DOXY_EXAMPLE_SRC_LIST})
- add_executable(rxcpp::doxygen::examples ALIAS doxy_examples)
- target_compile_options(doxy_examples PUBLIC ${RX_COMPILE_OPTIONS})
- target_compile_features(doxy_examples PUBLIC ${RX_COMPILE_FEATURES})
- target_include_directories(doxy_examples
- PUBLIC ${RX_SRC_DIR} ${RX_CATCH_DIR}
- )
- target_link_libraries(doxy_examples PRIVATE ${CMAKE_THREAD_LIBS_INIT})
-
- # Target to execute examples and save their output
- add_custom_command(
- OUTPUT doxy_examples_output
- COMMAND ${DOXY_EXAMPLES_BIN_DIR}/doxy_examples > ${DOXY_EXAMPLES_SRC_DIR}/output.txt
- COMMENT "Execute examples for Doxygen documentation")
-
- # Target to generate docs
- add_custom_target(doc
- COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY_CONF_FILE}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS doxy_examples doxy_examples_output
- COMMENT "Generating documentation with Doxygen"
- VERBATIM)
-endif()
diff --git a/projects/doxygen/doxygen.conf.in b/projects/doxygen/doxygen.conf.in
deleted file mode 100644
index 7cd39eb..0000000
--- a/projects/doxygen/doxygen.conf.in
+++ /dev/null
@@ -1,2434 +0,0 @@
-# Doxyfile 1.8.9.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME = "RxCpp"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF = "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++."
-
-# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
-# in the documentation. The maximum height of the logo should not exceed 55
-# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
-# the logo to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ${DOXY_OUTPUT_DIR}
-
-# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS = NO
-
-# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
-# characters to appear in the names of generated files. If set to NO, non-ASCII
-# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
-# U+3044.
-# The default value is: NO.
-
-ALLOW_UNICODE_NAMES = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# will be relative from the directory where doxygen is started.
-# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
-# path mentioned in the documentation of a class, which tells the reader which
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
-# page for each member. If set to NO, the documentation of a member will be part
-# of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
-
-ALIASES = "sample=@par Sample Code\n" \
- "badcode=@par Bad Code\n" \
- "goodcode=@par Good Code\n"
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
-# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
-# Fortran. In the later case the parser tries to guess whether the code is fixed
-# or free formatted code, this is the default for Fortran type files), VHDL. For
-# instance to make doxygen treat .inc files as Fortran files (default is PHP),
-# and .f files as C (default is Fortran), use: inc=Fortran f=C.
-#
-# Note: For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by putting a % sign in front of the word or
-# globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO,
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. If set to YES, local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO, only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO, these classes will be included in the various overviews. This option
-# has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO, these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO, these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES, upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES, the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
-# append additional text to a page's title, such as Class Reference. If set to
-# YES the compound reference will be hidden.
-# The default value is: NO.
-
-HIDE_COMPOUND_REFERENCE= NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
-# list. This list is created by putting \todo commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
-# list. This list is created by putting \test commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES, the
-# list will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. See also \cite for info how to create references.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO, doxygen will only warn about wrong or incomplete
-# parameter documentation, but not about the absence of documentation.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces.
-# Note: If this tag is empty the current directory is searched.
-
-INPUT = ${DOXY_INPUT_DIR}
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank the
-# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
-# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
-# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
-# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
-# *.qsf, *.as and *.js.
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.idl \
- *.ddl \
- *.odl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.cs \
- *.d \
- *.php \
- *.php4 \
- *.php5 \
- *.phtml \
- *.inc \
- *.m \
- *.markdown \
- *.md \
- *.mm \
- *.dox \
- *.py \
- *.f90 \
- *.f \
- *.for \
- *.tcl \
- *.vhd \
- *.vhdl \
- *.ucf \
- *.qsf \
- *.as \
- *.js
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS = rxcpp::*detail cpplinq::*detail
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH = ${DOXY_INCLUDE_DIR}
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS = YES
-
-# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# compiled with the --with-libclang option.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER = ${DOXY_FOOTER_HTML}
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# cascading style sheets that are included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefore more robust against future updates.
-# Doxygen will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list). For an example see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the style sheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler (hhc.exe). If non-empty,
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated
-# (YES) or that it should be included in the master .chm file (NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated
-# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
-# enables the Previous and Next buttons.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH = 250
-
-# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
-# setting. When disabled, doxygen will generate a PHP script for searching and
-# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
-# and searching needs to be provided by external tools. See the section
-# "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. To get the times font for
-# instance you can specify
-# EXTRA_PACKAGES=times
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
-# string, for the replacement values of the other commands the user is referred
-# to HTML_HEADER.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
-# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER =
-
-# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# LaTeX style sheets that are included after the standard style sheets created
-# by doxygen. Using this option one can overrule certain style aspects. Doxygen
-# will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_STYLESHEET =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES, to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE =
-
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION = .3
-
-# The MAN_SUBDIR tag determines the name of the directory created within
-# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
-# MAN_EXTENSION with the initial . removed.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_SUBDIR =
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT = xml
-
-# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
-# listings (including syntax highlighting and cross-referencing information) to
-# the XML output. Note that enabling this will significantly increase the size
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT = docbook
-
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
-# AutoGen Definitions (see http://autogen.sf.net) file that captures the
-# structure of the code including all documentation. Note that this feature is
-# still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO, the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
-# in the source code. If set to NO, only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES, the include files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all references to function-like macros that are alone on a line, have
-# an all uppercase name, and do not end with a semicolon. Such function macros
-# are typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have a unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
-# the class index. If set to NO, only the inherited external classes will be
-# listed.
-# The default value is: NO.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS = YES
-
-# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH =
-
-# If set to YES the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: NO.
-
-HAVE_DOT = YES
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS = 0
-
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot.
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, jpg, gif and svg.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS =
-
-# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
-
-PLANTUML_JAR_PATH =
-
-# When using plantuml, the specified paths are searched for files specified by
-# the !include statement in a plantuml block.
-
-PLANTUML_INCLUDE_PATH =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
-# files that are used to generate the various graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_CLEANUP = YES
diff --git a/projects/doxygen/footer.html b/projects/doxygen/footer.html
deleted file mode 100644
index 87fc98d..0000000
--- a/projects/doxygen/footer.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- HTML footer for doxygen 1.8.9.1-->
-<!-- start footer part -->
-<!--BEGIN GENERATE_TREEVIEW-->
-<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- $navpath
- <li class="footer">$generatedby
- <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
- </ul>
-</div>
-<!--END GENERATE_TREEVIEW-->
-<!--BEGIN !GENERATE_TREEVIEW-->
-<hr class="footer"/><address class="footer"><small>
-$generatedby &#160;<a href="http://www.doxygen.org/index.html">
-<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
-</a> $doxygenversion
-</small></address>
-<!--END !GENERATE_TREEVIEW-->
-<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-
- ga('create', 'UA-60804833-2', 'auto');
- ga('send', 'pageview');
-
-</script>
-</body>
-</html>
diff --git a/projects/doxygen/mainpage.dox b/projects/doxygen/mainpage.dox
deleted file mode 100644
index 348215a..0000000
--- a/projects/doxygen/mainpage.dox
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- \mainpage
-
- RxCpp is an implementation of the Observable/Observer pattern and a set of operations. It is an async equivalent of the container/iterator pattern and the set of algorithms found in the STL.
-
- \par Resources for Learning about Reactive Extentions
-
- Introduction to Rx --- http://www.introtorx.com
-
- Interactive diagrams of Rx Observables --- http://rxmarbles.io
-
- Reactive Extensions portal --- http://reactivex.io
-
- Reactive Extensions tutorial --- http://reactive-extensions.github.io/learnrx/
-
- \par RxCpp specific
-
- Start here --- \ref group-core
-
- Github --- https://github.com/Reactive-Extensions/RxCpp
-
- \par readme.html
-
- \htmlinclude Readme.html
-*/
diff --git a/projects/nuget/release.txt b/projects/nuget/release.txt
deleted file mode 100644
index 237f085..0000000
--- a/projects/nuget/release.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Write-NuGetPackage .\rxcpp.autoconfig
-Publish-NuGetPackage -Packages .\rxcpp.4.0.0.nupkg
diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig
deleted file mode 100644
index 14aeeeb..0000000
--- a/projects/nuget/rxcpp.autoconfig
+++ /dev/null
@@ -1,32 +0,0 @@
-nuget {
- nuspec {
- id = rxcpp;
- version : 4.0.0;
- title: Reactive Extensions for C++;
- authors: {Microsoft Open Technologies Inc.};
- owners: {Microsoft Open Technologies Inc.};
- licenseUrl: "https://github.com/Reactive-Extensions/RxCpp/blob/master/license.md";
- projectUrl: "https://github.com/Reactive-Extensions/RxCpp";
- iconUrl: "http://go.microsoft.com/fwlink/?LinkId=261274";
- requireLicenseAcceptance:false;
- summary: "The Reactive Extensions (Rx) asynchronous algorithm library";
- description: @"The Reactive Extensions for C++ (RxCpp) is a library of algorithms for values-distributed-in-time. The Range-v3 library does the same for values-distributed-in-space.
- Compiles for gcc, clang and VisualStudio on Linux, OSX and Windows.";
- releaseNotes: "rx lite complete!, bug fixes, breaking changes to make repeat(0) and retry(0), VC2017 support, coroutines support, take_while, is_empty";
- copyright: Copyright 2016;
- tags: { RxCpp, RxC++, Rx, Reactive, Observable, Functional, native, nativepackage};
- };
-
- files {
-
- #defines {
- SDK_RX = ..\..\;
- }
- include: { "${SDK_RX}Rx\v2\src\**\*" };
- docs: { ${SDK_RX}AUTHORS.txt, ${SDK_RX}Rx\v2\license.txt, ${SDK_RX}Rx\v2\examples\**\* };
- }
-
- targets {
- Defines += HAS_RXCPP;
- }
-}
diff --git a/projects/scripts/install_libcxx.sh b/projects/scripts/install_libcxx.sh
deleted file mode 100644
index b82e83b..0000000
--- a/projects/scripts/install_libcxx.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-#
-# Install libc++ under travis
-
-svn --quiet co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
-mkdir libcxx/build
-(cd libcxx/build && cmake .. -DLIBCXX_CXX_ABI=libstdc++ -DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.6;/usr/include/c++/4.6/x86_64-linux-gnu")
-make -C libcxx/build cxx -j2
-sudo cp libcxx/build/lib/libc++.so.1.0 /usr/lib/
-sudo cp -r libcxx/build/include/c++/v1 /usr/include/c++/v1/
-sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so
-sudo ln -sf /usr/lib/libc++.so.1.0 /usr/lib/libc++.so.1 \ No newline at end of file
diff --git a/projects/scripts/travis-doxygen.sh b/projects/scripts/travis-doxygen.sh
deleted file mode 100644
index 1b908b3..0000000
--- a/projects/scripts/travis-doxygen.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ -n "$GH_TOKEN" ]; then
- cd projects/doxygen/html
- git init
- git config user.name "Kirk Shoop"
- git config user.email "kirk.shoop@microsoft.com"
- git add *
- git commit -m "doxygen generated site"
- git push --force "https://${GH_TOKEN}@github.com/Reactive-Extensions/RxCpp.git" master:gh-pages
-fi
diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh
deleted file mode 100755
index cd32b55..0000000
--- a/projects/scripts/travis-install.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-set -e
-
-echo "TRAVIS_OS_NAME=$TRAVIS_OS_NAME"
-
-#if OS is linux or is not set
-if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then
-
- wget http://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.sh
- chmod a+x cmake-3.2.3-Linux-x86_64.sh
- sudo ./cmake-3.2.3-Linux-x86_64.sh --skip-license --prefix=/usr/local
- export PATH=/usr/local/bin:$PATH
-
- cmake --version
-
-elif [ "$TRAVIS_OS_NAME" = osx ]; then
-
- xcode-select --install
- brew update || echo "suppress failures in order to ignore warnings"
- brew doctor || echo "suppress failures in order to ignore warnings"
- brew list cmake || echo "suppress failures in order to ignore warnings"
- sudo brew uninstall --force cmake || "suppress failures in order to ignore warnings"
- brew search cmake || echo "suppress failures in order to ignore warnings"
- brew install cmake || echo "suppress failures in order to ignore warnings"
- brew upgrade cmake || echo "suppress failures in order to ignore warnings"
-
- cmake --version
-fi
-