From f3d0a84a06bace7bfcf5f98b30f93bf77edf8144 Mon Sep 17 00:00:00 2001 From: clca Date: Mon, 5 Nov 2012 22:23:33 -0800 Subject: [PATCH 001/782] Reactive Extensions OSS V1.0 --- Ix++/.gitignore | 109 + Ix++/license.txt.txt | 15 + Ix++/projects/CppLinq.vpj | 156 ++ Ix++/projects/CppLinq.vpw | 7 + Ix++/projects/Unittest.CppLinq.vpj | 137 + Ix++/samples/SampleCppLinq/SampleCppLinq.cpp | 128 + Ix++/samples/SampleCppLinq/SampleCppLinq.sln | 20 + .../SampleCppLinq/SampleCppLinq.vcxproj | 92 + .../SampleCppLinq.vcxproj.filters | 25 + Ix++/samples/SampleCppLinq/data.txt | 655 +++++ Ix++/src/cpplinq/linq.hpp | 531 ++++ Ix++/src/cpplinq/linq_cursor.hpp | 340 +++ Ix++/src/cpplinq/linq_groupby.hpp | 195 ++ Ix++/src/cpplinq/linq_iterators.hpp | 194 ++ Ix++/src/cpplinq/linq_last.hpp | 85 + Ix++/src/cpplinq/linq_select.hpp | 52 + Ix++/src/cpplinq/linq_selectmany.hpp | 107 + Ix++/src/cpplinq/linq_skip.hpp | 35 + Ix++/src/cpplinq/linq_take.hpp | 96 + Ix++/src/cpplinq/linq_where.hpp | 69 + Ix++/src/cpplinq/util.hpp | 223 ++ Ix++/unittest/makefile | 37 + Ix++/unittest/testbench.cpp | 527 ++++ Ix++/unittest/testbench.hpp | 87 + Ix/.gitattributes | 22 + Ix/.gitignore | 163 ++ Ix/Common.targets | 180 ++ Ix/Import.targets | 16 + Ix/Interactive Extensions.sln | 332 +++ Ix/Interactive Extensions.vsmdi | 6 + Ix/Interactive Extensions.vssscc | 10 + Ix/Local.testsettings | 37 + .../AsyncEnumerable.Aggregates.cs | 2019 ++++++++++++++ .../AsyncEnumerable.Conversions.cs | 262 ++ .../AsyncEnumerable.Creation.cs | 283 ++ .../AsyncEnumerable.Exceptions.cs | 381 +++ .../AsyncEnumerable.Generated.cs | 1250 +++++++++ .../AsyncEnumerable.Multiple.cs | 755 +++++ .../AsyncEnumerable.Single.cs | 2466 +++++++++++++++++ .../AsyncEnumerator.cs | 26 + Ix/System.Interactive.Async/Disposables.cs | 89 + .../EnumerableGrouping.cs | 34 + .../IAsyncEnumerable.cs | 23 + .../IAsyncEnumerator.cs | 34 + Ix/System.Interactive.Async/IAsyncGrouping.cs | 19 + .../IOrderedAsyncEnumerable.cs | 15 + .../Properties/AssemblyInfo.cs | 37 + .../System.Interactive.Async.csproj | 47 + Ix/System.Interactive.Async/TaskExt.cs | 134 + .../Properties/AssemblyInfo.cs | 37 + .../QueryableEx.cs | 2327 ++++++++++++++++ .../System.Interactive.Providers.csproj | 41 + .../EnumerableEx.Aggregates.cs | 173 ++ .../EnumerableEx.Buffering.cs | 647 +++++ .../EnumerableEx.Creation.cs | 173 ++ .../EnumerableEx.Exceptions.cs | 284 ++ .../EnumerableEx.Imperative.cs | 156 ++ .../EnumerableEx.Multiple.cs | 96 + Ix/System.Interactive/EnumerableEx.Single.cs | 672 +++++ .../Properties/AssemblyInfo.cs | 37 + .../System.Interactive.csproj | 41 + Ix/Tests/App.cs | 47 + Ix/Tests/AsyncTests.Aggregates.cs | 2168 +++++++++++++++ Ix/Tests/AsyncTests.Bugs.cs | 266 ++ Ix/Tests/AsyncTests.Conversions.cs | 312 +++ Ix/Tests/AsyncTests.Creation.cs | 409 +++ Ix/Tests/AsyncTests.Exceptions.cs | 551 ++++ Ix/Tests/AsyncTests.Multiple.cs | 787 ++++++ Ix/Tests/AsyncTests.Single.cs | 2455 ++++++++++++++++ Ix/Tests/AsyncTests.cs | 54 + Ix/Tests/Properties/AppManifest.xml | 7 + Ix/Tests/Properties/AssemblyInfo.cs | 35 + Ix/Tests/Tests.Aggregates.cs | 118 + Ix/Tests/Tests.Buffering.cs | 625 +++++ Ix/Tests/Tests.Creation.cs | 224 ++ Ix/Tests/Tests.Exceptions.cs | 311 +++ Ix/Tests/Tests.Imperative.cs | 180 ++ Ix/Tests/Tests.Multiple.cs | 74 + Ix/Tests/Tests.Qbservable.cs | 139 + Ix/Tests/Tests.Single.cs | 431 +++ Ix/Tests/Tests.cs | 51 + Ix/Tests/Tests.csproj | 91 + Ix/TraceAndTestImpact.testsettings | 21 + Ix/license.txt | 15 + README.md | 24 + Rx++/.gitattributes | 22 + Rx++/.gitignore | 163 ++ Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 171 ++ Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h | 91 + .../MfcTimeFliesLikeAnArrow.cpp | 153 + .../MfcTimeFliesLikeAnArrow.h | 37 + .../MfcTimeFliesLikeAnArrow.rc | 276 ++ .../MfcTimeFliesLikeAnArrow.vcxproj | 137 + .../MfcTimeFliesLikeAnArrow.vcxproj.filters | 63 + Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt | 95 + Rx++/MfcTimeFliesLikeAnArrow/Resource.h | 20 + .../res/MfcTimeFliesLikeAnArrow.ico | Bin 0 -> 67777 bytes .../res/MfcTimeFliesLikeAnArrow.rc2 | Bin 0 -> 830 bytes Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp | 9 + Rx++/MfcTimeFliesLikeAnArrow/stdafx.h | 64 + Rx++/MfcTimeFliesLikeAnArrow/targetver.h | 10 + Rx++/RxCpp.sln | 26 + Rx++/license.txt | 15 + Rx++/testbench/rxcpp-binder.h | 48 + Rx++/testbench/rxcpp.h | 889 ++++++ Rx++/testbench/testbench.cpp | 45 + Rx++/testbench/testbench.vcxproj | 95 + Rx++/testbench/testbench.vcxproj.filters | 30 + 108 files changed, 29100 insertions(+) create mode 100644 Ix++/.gitignore create mode 100644 Ix++/license.txt.txt create mode 100644 Ix++/projects/CppLinq.vpj create mode 100644 Ix++/projects/CppLinq.vpw create mode 100644 Ix++/projects/Unittest.CppLinq.vpj create mode 100644 Ix++/samples/SampleCppLinq/SampleCppLinq.cpp create mode 100644 Ix++/samples/SampleCppLinq/SampleCppLinq.sln create mode 100644 Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj create mode 100644 Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters create mode 100644 Ix++/samples/SampleCppLinq/data.txt create mode 100644 Ix++/src/cpplinq/linq.hpp create mode 100644 Ix++/src/cpplinq/linq_cursor.hpp create mode 100644 Ix++/src/cpplinq/linq_groupby.hpp create mode 100644 Ix++/src/cpplinq/linq_iterators.hpp create mode 100644 Ix++/src/cpplinq/linq_last.hpp create mode 100644 Ix++/src/cpplinq/linq_select.hpp create mode 100644 Ix++/src/cpplinq/linq_selectmany.hpp create mode 100644 Ix++/src/cpplinq/linq_skip.hpp create mode 100644 Ix++/src/cpplinq/linq_take.hpp create mode 100644 Ix++/src/cpplinq/linq_where.hpp create mode 100644 Ix++/src/cpplinq/util.hpp create mode 100644 Ix++/unittest/makefile create mode 100644 Ix++/unittest/testbench.cpp create mode 100644 Ix++/unittest/testbench.hpp create mode 100644 Ix/.gitattributes create mode 100644 Ix/.gitignore create mode 100644 Ix/Common.targets create mode 100644 Ix/Import.targets create mode 100644 Ix/Interactive Extensions.sln create mode 100644 Ix/Interactive Extensions.vsmdi create mode 100644 Ix/Interactive Extensions.vssscc create mode 100644 Ix/Local.testsettings create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Single.cs create mode 100644 Ix/System.Interactive.Async/AsyncEnumerator.cs create mode 100644 Ix/System.Interactive.Async/Disposables.cs create mode 100644 Ix/System.Interactive.Async/EnumerableGrouping.cs create mode 100644 Ix/System.Interactive.Async/IAsyncEnumerable.cs create mode 100644 Ix/System.Interactive.Async/IAsyncEnumerator.cs create mode 100644 Ix/System.Interactive.Async/IAsyncGrouping.cs create mode 100644 Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs create mode 100644 Ix/System.Interactive.Async/Properties/AssemblyInfo.cs create mode 100644 Ix/System.Interactive.Async/System.Interactive.Async.csproj create mode 100644 Ix/System.Interactive.Async/TaskExt.cs create mode 100644 Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs create mode 100644 Ix/System.Interactive.Providers/QueryableEx.cs create mode 100644 Ix/System.Interactive.Providers/System.Interactive.Providers.csproj create mode 100644 Ix/System.Interactive/EnumerableEx.Aggregates.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Buffering.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Creation.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Exceptions.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Imperative.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Multiple.cs create mode 100644 Ix/System.Interactive/EnumerableEx.Single.cs create mode 100644 Ix/System.Interactive/Properties/AssemblyInfo.cs create mode 100644 Ix/System.Interactive/System.Interactive.csproj create mode 100644 Ix/Tests/App.cs create mode 100644 Ix/Tests/AsyncTests.Aggregates.cs create mode 100644 Ix/Tests/AsyncTests.Bugs.cs create mode 100644 Ix/Tests/AsyncTests.Conversions.cs create mode 100644 Ix/Tests/AsyncTests.Creation.cs create mode 100644 Ix/Tests/AsyncTests.Exceptions.cs create mode 100644 Ix/Tests/AsyncTests.Multiple.cs create mode 100644 Ix/Tests/AsyncTests.Single.cs create mode 100644 Ix/Tests/AsyncTests.cs create mode 100644 Ix/Tests/Properties/AppManifest.xml create mode 100644 Ix/Tests/Properties/AssemblyInfo.cs create mode 100644 Ix/Tests/Tests.Aggregates.cs create mode 100644 Ix/Tests/Tests.Buffering.cs create mode 100644 Ix/Tests/Tests.Creation.cs create mode 100644 Ix/Tests/Tests.Exceptions.cs create mode 100644 Ix/Tests/Tests.Imperative.cs create mode 100644 Ix/Tests/Tests.Multiple.cs create mode 100644 Ix/Tests/Tests.Qbservable.cs create mode 100644 Ix/Tests/Tests.Single.cs create mode 100644 Ix/Tests/Tests.cs create mode 100644 Ix/Tests/Tests.csproj create mode 100644 Ix/TraceAndTestImpact.testsettings create mode 100644 Ix/license.txt create mode 100644 README.md create mode 100644 Rx++/.gitattributes create mode 100644 Rx++/.gitignore create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/Resource.h create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/stdafx.h create mode 100644 Rx++/MfcTimeFliesLikeAnArrow/targetver.h create mode 100644 Rx++/RxCpp.sln create mode 100644 Rx++/license.txt create mode 100644 Rx++/testbench/rxcpp-binder.h create mode 100644 Rx++/testbench/rxcpp.h create mode 100644 Rx++/testbench/testbench.cpp create mode 100644 Rx++/testbench/testbench.vcxproj create mode 100644 Rx++/testbench/testbench.vcxproj.filters diff --git a/Ix++/.gitignore b/Ix++/.gitignore new file mode 100644 index 0000000..8bbd318 --- /dev/null +++ b/Ix++/.gitignore @@ -0,0 +1,109 @@ +# 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 \ No newline at end of file diff --git a/Ix++/license.txt.txt b/Ix++/license.txt.txt new file mode 100644 index 0000000..d7fd6c0 --- /dev/null +++ b/Ix++/license.txt.txt @@ -0,0 +1,15 @@ +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://aspnetwebstack.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++/projects/CppLinq.vpj b/Ix++/projects/CppLinq.vpj new file mode 100644 index 0000000..209f42c --- /dev/null +++ b/Ix++/projects/CppLinq.vpj @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ix++/projects/CppLinq.vpw b/Ix++/projects/CppLinq.vpw new file mode 100644 index 0000000..105f982 --- /dev/null +++ b/Ix++/projects/CppLinq.vpw @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Ix++/projects/Unittest.CppLinq.vpj b/Ix++/projects/Unittest.CppLinq.vpj new file mode 100644 index 0000000..7bbb967 --- /dev/null +++ b/Ix++/projects/Unittest.CppLinq.vpj @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.cpp b/Ix++/samples/SampleCppLinq/SampleCppLinq.cpp new file mode 100644 index 0000000..e459e4b --- /dev/null +++ b/Ix++/samples/SampleCppLinq/SampleCppLinq.cpp @@ -0,0 +1,128 @@ +// 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +vector 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) + { + 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) + { + 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 load_data() +{ + ifstream datafile("data.txt"); + vector 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++/samples/SampleCppLinq/SampleCppLinq.sln b/Ix++/samples/SampleCppLinq/SampleCppLinq.sln new file mode 100644 index 0000000..32769e0 --- /dev/null +++ b/Ix++/samples/SampleCppLinq/SampleCppLinq.sln @@ -0,0 +1,20 @@ + +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++/samples/SampleCppLinq/SampleCppLinq.vcxproj b/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj new file mode 100644 index 0000000..83dd175 --- /dev/null +++ b/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj @@ -0,0 +1,92 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + $(VCTargetsPath11) + + + {B65551BA-E1BA-4735-BA51-FFA83D64823E} + Win32Proj + SampleCppLinq + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + d:\work\CppLinq Project\src;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + + + false + d:\work\CppLinq Project\src;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters b/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters new file mode 100644 index 0000000..3e3685f --- /dev/null +++ b/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + + \ No newline at end of file diff --git a/Ix++/samples/SampleCppLinq/data.txt b/Ix++/samples/SampleCppLinq/data.txt new file mode 100644 index 0000000..b16aea6 --- /dev/null +++ b/Ix++/samples/SampleCppLinq/data.txt @@ -0,0 +1,655 @@ +{'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++/src/cpplinq/linq.hpp b/Ix++/src/cpplinq/linq.hpp new file mode 100644 index 0000000..64cf8fb --- /dev/null +++ b/Ix++/src/cpplinq/linq.hpp @@ -0,0 +1,531 @@ +// 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: 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 + +#include +#include +#include +#include +#include +#include +#include +#include + + + +// 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 + + +// 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 + struct not1_{ + Pred pred; + not1_(Pred p) : pred(p) + {} + template + bool operator()(const T& value) + { + return !pred(value); + } + }; + // note: VC2010's std::not1 doesn't support lambda expressions. provide our own. + template + not1_ not1(Pred p) { return not1_(p); } +} + +namespace detail { + template + struct cast_to { + template + U operator()(const T& value) const { + return static_cast(value); + } + }; +} + +template +class linq_driver +{ + typedef typename Collection::cursor::element_type + element_type; + typedef typename Collection::cursor::reference_type + reference_type; +public: + typedef cursor_iterator + iterator; + + linq_driver(Collection c) : c(c) {} + + + // -------------------- linq core methods -------------------- + + template + linq_driver< linq_groupby > groupby(KeyFn fn) + { + return linq_groupby(c, std::move(fn) ); + } + + // TODO: groupby(keyfn, eq) + + // TODO: join... + + template + linq_driver< linq_select > select(Selector sel) const { + return linq_select(c, std::move(sel) ); + } + + template + linq_driver< linq_select_many > + select_many(Fn fn) const + { + return linq_select_many(c, fn, detail::default_select_many_selector()); + } + + template + linq_driver< linq_select_many > select_many(Fn fn, Fn2 fn2) const + { + return linq_select_many(c, fn, fn2); + } + + template + linq_driver< linq_where > where(Predicate p) const { + return typename linq_where(c, std::move(p) ); + } + + + // -------------------- linq peripheral methods -------------------- + + template + 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 + T aggregate(T initialValue, Fn fn) const + { + return std::accumulate(begin(), end(), initialValue, fn); + } + + bool any() const { return !empty(cur); } + + template + bool any(Predicate p) const { + auto it = std::find_if(begin(), end(), p); + return it != end(); + } + + template + bool all(Predicate p) const { + auto it = std::find_if(begin(), end(), detail::not1(p)); + return it == end(); + } + + // TODO: average + + template + auto cast() + -> decltype(static_cast(0)->select(detail::cast_to())) + { + return this->select(detail::cast_to()); + } + + // TODO: concat + + bool contains(const typename Collection::cursor::element_type& value) const { + return std::find(begin(), end(), value) != end(); + } + + typename std::iterator_traits::distance_type count() const { + return std::distance(begin(), end()); + } + + template + typename std::iterator_traits::distance_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(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(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 + 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 + 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 + 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 + 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()); + } + + template + 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()); + } + + template + 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> skip(size_t n) const { + return linq_skip(c, n); + } + + // TODO: skip_while(pred) + + // TODO: sum + + linq_driver> take(size_t n) const { + return linq_take(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 to_vector() const + { + return std::vector(begin(), end()); + } + + // -------------------- container/range methods -------------------- + + iterator begin() const { return iterator(c.get_cursor()); } + iterator end() const { return iterator(); } + linq_driver& operator=(const linq_driver& other) { c = other.c; return *this; } + template + linq_driver& operator=(const linq_driver& other) { c = other.c; return *this; } + + typename std::iterator_traits::reference + operator[](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 > + late_bind() const + { + return dynamic_collection(c); + } + +private: + Collection c; +}; + +// TODO: should probably use reference-wrapper instead? +template +linq_driver::iterator>> from(TContainer& c) +{ + auto cur = iter_cursor::iterator>(begin(c), end(c)); + return std::move(cur); +} +template +const linq_driver& from(const linq_driver& c) +{ + return c; +} +template +linq_driver> from(Iter start, Iter finish) +{ + return iter_cursor(start, finish); +} + +template +linq_driver from_value(const TContainer& c) +{ + return linq_driver(c); +} + +} + +#endif // defined(CPPLINQ_LINQ_HPP) + diff --git a/Ix++/src/cpplinq/linq_cursor.hpp b/Ix++/src/cpplinq/linq_cursor.hpp new file mode 100644 index 0000000..827c488 --- /dev/null +++ b/Ix++/src/cpplinq/linq_cursor.hpp @@ -0,0 +1,340 @@ +// 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 + +/// 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 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 + struct iter_to_cursor_category_; + + template + struct iter_to_cursor_category + { + static const size_t catIx = sizeof(detail::get_category_from_iterator(typename std::iterator_traits::iterator_category()) /*.value*/ ); + typedef typename iter_to_cursor_category_::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 + 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 + struct min_cursor_category : min_cursor_category::type, Cat3> + { + }; + + template + struct min_cursor_category + : std::conditional< + less_or_equal_cursor_category::value, + Cat2, + Cat1> + { + }; + + template + struct cursor_type { + typedef decltype(cursor(*static_cast(0))) type; + }; + } + + // simultaniously models a cursor and a cursor-collection + template + class iter_cursor : collection_tag { + public: + + typedef iter_cursor cursor; + + typedef typename std::remove_reference::value_type>::type + element_type; + typedef typename std::iterator_traits::reference + reference_type; + typedef typename util::iter_to_cursor_category::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::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(ptrdiff_t n) { current += n; } + size_t size() { return fin-start; } + void position() { return current-start; } + void truncate(size_t n) { + if (n > fin-current) { + fin = current + n; + } + } + + + iter_cursor(Iterator start, Iterator fin) + : start(start) + , fin(std::move(fin)) + , current(start) + { + } + + iter_cursor(Iterator start, Iterator fin, Iterator current) + : start(std::move(start)) + , fin(std::move(fin)) + , current(std::move(current)) + { + } + + iter_cursor get_cursor() const { return *this; } + + private: + Iterator current; + Iterator start, fin; + }; + + + template + 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 dynamic_cursor : collection_tag + { + template + struct instance : cursor_interface + { + 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* copy() const + { + return new instance(*this); + } + }; + + std::unique_ptr> myCur; + + public: + typedef forward_cursor_tag cursor_category; // TODO: not strictly true! + typedef typename std::remove_reference::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 + dynamic_cursor(Cursor cursor) + : myCur(new instance(std::move(cursor))) + { + } + + template + dynamic_cursor(Iterator start, Iterator end) + { + *this = iter_cursor(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 + struct container_interface + { + virtual dynamic_cursor get_cursor() const = 0; + }; + + template + class dynamic_collection + { + std::shared_ptr< container_interface > container; + + template + struct instance : container_interface + { + Container c; + + instance(Container c) : c(c) + { + } + + dynamic_cursor get_cursor() const + { + return c.get_cursor(); + } + }; + + public: + typedef dynamic_cursor cursor; + + dynamic_collection() {} + + dynamic_collection(const dynamic_collection& other) + : container(other.container) + { + } + + // container or query + template + dynamic_collection(Container c) + : container(new instance(c)) + { + } + + // container or query + template + dynamic_collection(Iterator begin, Iterator end) + : container(new instance< iter_cursor >(iter_cursor(begin, end))) + { + } + + dynamic_cursor get_cursor() const { + return container ? container->get_cursor() : dynamic_cursor(); + } + }; +} + +#endif // !defined(CPPLINQ_LINQ_CURSOR_HPP diff --git a/Ix++/src/cpplinq/linq_groupby.hpp b/Ix++/src/cpplinq/linq_groupby.hpp new file mode 100644 index 0000000..c521e5e --- /dev/null +++ b/Ix++/src/cpplinq/linq_groupby.hpp @@ -0,0 +1,195 @@ +// 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 +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 + bool operator()(const T& a, const T& b) const { + return a == b; + } +}; +struct default_less +{ + template + 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 linq_groupby +{ + typedef typename Collection::cursor + inner_cursor; + + typedef typename util::result_of::type + key_type; + + typedef std::list + element_list_type; + + typedef group + group_type; + + typedef std::list + 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 groups; + std::map 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; + typename std::list::iterator inner; + typename std::list::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++/src/cpplinq/linq_iterators.hpp b/Ix++/src/cpplinq/linq_iterators.hpp new file mode 100644 index 0000000..ed267ec --- /dev/null +++ b/Ix++/src/cpplinq/linq_iterators.hpp @@ -0,0 +1,194 @@ +// 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 + +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 + typename std::enable_if< + std::is_convertible::value, + Iter + >::type + operator+(const Iter& it, typename std::iterator_traits::distance_type n) { + return it += n; + } + template + typename std::enable_if< + std::is_convertible::value, + Iter + >::type + operator-(const Iter& it, typename std::iterator_traits::distance_type n) { + return it -= n; + } + template + typename std::enable_if< + std::is_convertible::value, + Iter + >::type + operator-=(const Iter& it, typename std::iterator_traits::distance_type n) { + return it += (-n); + } + + template + typename std::enable_if< + std::is_convertible::value, + bool + >::type + operator!=(const Iter& it, const Iter& it2) { + return !(it == it2); + } + template + typename std::enable_if< + std::is_convertible::value, + bool + >::type + operator>(const Iter& it, const Iter& it2) { + return it2 < it; + } + template + typename std::enable_if< + std::is_convertible::value, + bool + >::type + operator<=(const Iter& it, const Iter& it2) { + return !(it2 < it); + } + template + typename std::enable_if< + std::is_convertible::value, + bool + >::type + operator>=(const Iter& it, const Iter& it2) { + return !(it < it2); + } + + namespace util { + template + typename std::iterator_traits::pointer deref_iterator(const Iter& it) { + return detail::deref_iterator(it, std::identity::reference>()); + } + + template + T* deref_iterator(const Iter& it, std::identity) { + return &*it; + } + + template + util::value_ptr deref_iterator(const Iter& it, std::identity) { + return util::value_ptr(*it); + } + } + + + template + 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 + iter_range make_range(Iter start, Iter finish) { + return iter_range(start, finish); + } + + // decays into a onepass/forward iterator + template + class cursor_iterator + : public std::iterator::value, + typename std::add_pointer::type, + util::value_ptr>::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(); + } + + pointer operator->() const { + auto& v = **this; + return &v; + } + + cursor_iterator& operator++() { + cur->inc(); + + if (cur->empty()) { cur.reset(); } + return *this; + } + + cursor_iterator& operator+=(ptrdiff_t n) { + cur->skip(n); + + if (cur->empty()) { cur.reset(); } + return *this; + } + + + + private: + bool empty() const { + !cur || cur->empty(); + } + + util::maybe cur; + }; + + template + class container_range + { + Container c; + + public: + typedef cursor_iterator 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++/src/cpplinq/linq_last.hpp b/Ix++/src/cpplinq/linq_last.hpp new file mode 100644 index 0000000..fd08823 --- /dev/null +++ b/Ix++/src/cpplinq/linq_last.hpp @@ -0,0 +1,85 @@ +// 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 + 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 std::move(elem); + } + + // TODO: bidirectional iterator in constant time + + template + 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 + 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 + 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 std::move(elem); + } + + template + 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 + 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++/src/cpplinq/linq_select.hpp b/Ix++/src/cpplinq/linq_select.hpp new file mode 100644 index 0000000..650a1dc --- /dev/null +++ b/Ix++/src/cpplinq/linq_select.hpp @@ -0,0 +1,52 @@ +// 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 + +namespace cpplinq +{ + template + class linq_select + { + typedef typename Collection::cursor + inner_cursor; + public: + struct cursor { + typedef typename util::result_of::type + reference_type; + typedef typename std::remove_reference::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(size_t n) { cur.skip(n); } + size_t position() const { return cur.position(); } + 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++/src/cpplinq/linq_selectmany.hpp b/Ix++/src/cpplinq/linq_selectmany.hpp new file mode 100644 index 0000000..45f0574 --- /dev/null +++ b/Ix++/src/cpplinq/linq_selectmany.hpp @@ -0,0 +1,107 @@ +// 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" + +namespace cpplinq +{ + namespace detail + { + struct default_select_many_selector + { + template + auto operator()(T1&& t1, T2&& t2) const + -> decltype(std::forward(t2)) + { + return std::forward(t2); + } + }; + } + + // cur -> (T -> cur) -> cur + template + class linq_select_many + { + template static T instance(); // for type inference + + Container1 c1; + Fn fn; + Fn2 fn2; + + typedef typename Container1::cursor Cur1; + typedef decltype(from(instance()(instance().get()))) Container2; + typedef typename Container2::cursor Cur2; + + public: + class cursor + { + public: + typedef typename util::min_cursor_category::type + cursor_category; + typedef typename Cur2::reference_type reference_type; + typedef typename Cur2::element_type element_type; + + private: + // TODO: we need to lazy eval somehow, but this feels wrong. + Cur1 cur1; + dynamic_cursor cur2; + Fn fn; + Fn2 fn2; + + public: + cursor(Cur1 cur1, const Fn& fn, const Fn2& fn2) + : cur1(std::move(cur1)), fn(fn), fn2(fn2) + { + auto container2 = fn(cur1.get()); + cur2 = from(container2).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; + + auto container2 = fn(cur1.get()); + cur2 = from(container2).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++/src/cpplinq/linq_skip.hpp b/Ix++/src/cpplinq/linq_skip.hpp new file mode 100644 index 0000000..422592a --- /dev/null +++ b/Ix++/src/cpplinq/linq_skip.hpp @@ -0,0 +1,35 @@ +// 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 + +namespace cpplinq +{ + template + struct linq_skip + { + public: + typedef typename Collection::cursor cursor; + + linq_skip(const Collection& c, size_t n) : c(c), n(n) {} + + cursor get_cursor() const { + size_t rem = n; + + auto cur = c.get_cursor(); + while(rem-- && !cur.empty()) { + cur.inc(); + } + cur.forget(); + return std::move(cur); + } + + private: + Collection c; + size_t n; + }; +} +#endif // !defined(CPPLINQ_LINQ_SKIP_HPP) + + diff --git a/Ix++/src/cpplinq/linq_take.hpp b/Ix++/src/cpplinq/linq_take.hpp new file mode 100644 index 0000000..63f7449 --- /dev/null +++ b/Ix++/src/cpplinq/linq_take.hpp @@ -0,0 +1,96 @@ +// 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 + +namespace cpplinq +{ + template + 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, 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(size_t n) { cur.skip(n); rem -= n; } + size_t position() const { return cur.position(); } + size_t size() const { return cur.size(); } + + private: + InnerCursor cur; + size_t rem; + }; + + namespace detail { + template + linq_take_cursor + take_get_cursor_( + const Collection& c, + size_t n, + onepass_cursor_tag + ) + { + return linq_take_cursor(c.get_cursor(), n); + } + + template + typename Collection::cursor + take_get_cursor_( + const Collection& c, + size_t n, + random_access_cursor_tag + ) + { + auto cur = c.get_cursor(); + if (cur.size() > n) { + cur.truncate(n); + } + return std::move(cur); + } + } + + template + 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>::type + cursor; + + linq_take(const Collection& c, 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; + size_t n; + }; + + template + auto get_cursor( + const linq_take& 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++/src/cpplinq/linq_where.hpp b/Ix++/src/cpplinq/linq_where.hpp new file mode 100644 index 0000000..4f66ba7 --- /dev/null +++ b/Ix++/src/cpplinq/linq_where.hpp @@ -0,0 +1,69 @@ +// 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 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 (!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++/src/cpplinq/util.hpp b/Ix++/src/cpplinq/util.hpp new file mode 100644 index 0000000..6fb62ff --- /dev/null +++ b/Ix++/src/cpplinq/util.hpp @@ -0,0 +1,223 @@ +// 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 + struct container_traits { + typedef typename Container::iterator iterator; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::iterator_category iterator_category; + + // TODO: conservative definition for now. + enum { is_writable_iterator = + std::is_reference::reference>::value + && std::is_same::type, + typename std::remove_cv::reference>::type>::type>::value + }; + }; + + template <> + struct container_traits; + + template + struct container_traits + : container_traits + {}; + template + struct container_traits + : container_traits + { + 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 + 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 + struct min_iterator_category + : std::conditional< + less_or_equal_iterator_category::value, + Cat2, + Cat1> + { + }; + +#if 0 +#define CppLinq_GET_ITERATOR_TYPE(TContainer) \ + decltype(begin(static_cast(0))) +#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \ + decltype(begin(static_cast(0))) +#else +#define CppLinq_GET_ITERATOR_TYPE(TContainer) \ + typename ::cpplinq::util::container_traits::iterator +#define CppLinq_GET_CONST_ITERATOR_TYPE(TContainer) \ + typename ::cpplinq::util::container_traits::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 T instance(); + }; + template struct result_of; + template + struct result_of { + typedef decltype(detail::instance()()) type; + }; + template + struct result_of { + typedef decltype(detail::instance()(detail::instance())) type; + }; + template + struct result_of { + typedef decltype(detail::instance()(detail::instance(), + detail::instance())) type; + }; + template + struct result_of { + typedef decltype(detail::instance()(detail::instance(), + detail::instance(), + detail::instance())) type; + }; + template + struct result_of { + typedef decltype(detail::instance()(detail::instance(), + detail::instance(), + detail::instance(), + detail::instance())) type; + }; +#else + template + struct result_of : std::tr1::result_of {}; +#endif + + // faux pointer proxy for iterators that dereference to a value rather than reference, such as selectors + template + struct value_ptr + { + T value; + value_ptr(const T& pvalue) : value(value) + {} + value_ptr(const T* pvalue) : value(*pvalue) + {} + const T* operator->() + { + return &value; + } + }; + + + template + class maybe + { + bool is_set; + typename std::aligned_storage::value>::type + storage; + public: + maybe() + : is_set(false) + { + } + + maybe(T value) + : is_set(false) + { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + + maybe(const maybe& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(*other.get()); + is_set = true; + } + } + maybe(maybe&& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(std::move(*other.get())); + is_set = true; + other.reset(); + } + } + + ~maybe() + { + reset(); + } + + void reset() + { + if (is_set) { + is_set = false; + reinterpret_cast(&storage)->~T(); + } + } + + T* get() { + return is_set ? reinterpret_cast(&storage) : 0; + } + + const T* get() const { + return is_set ? reinterpret_cast(&storage) : 0; + } + + void set(const T& value) { + if (is_set) { + *reinterpret_cast(&storage) = value; + } else { + new (reinterpret_cast(&storage)) T(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++/unittest/makefile b/Ix++/unittest/makefile new file mode 100644 index 0000000..c839943 --- /dev/null +++ b/Ix++/unittest/makefile @@ -0,0 +1,37 @@ + + +!ifndef Config +Config=Debug +!endif + +O=..\..\bin\$(Config) + +!message Building ===== $(Config) ===== + +program=testbench.exe +INCLUDE=$(INCLUDE);../ + +!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 ../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++/unittest/testbench.cpp b/Ix++/unittest/testbench.cpp new file mode 100644 index 0000000..7788e5f --- /dev/null +++ b/Ix++/unittest/testbench.cpp @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "cpplinq/linq.hpp" + +#include "testbench.hpp" + +using namespace std; +using namespace cpplinq; + +struct int_iter + : std::iterator +{ + 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+=(ptrdiff_t offset) { + value += step*offset; return *this; + } + int_iter& operator-=(ptrdiff_t offset) { + value -= step*offset; return *this; + } + ptrdiff_t operator-(int_iter rhs) const { + return 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, ptrdiff_t rhs) { + return lhs+=rhs; +} +int_iter operator+(ptrdiff_t lhs, int_iter rhs) { + return rhs+=lhs; +} +int_iter operator-(int_iter lhs, 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 vector_range(int start, int end) +{ + vector v; + for (int i = start; i < end; ++i) + v.push_back(i); + return v; +} + +TEST(test_selection) +{ + vector 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 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 +void display(It start, It end) +{ + int i = 0; + for_each(start, end, [&](typename iterator_traits::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 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 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 some_primes(size_t howMany) +{ + auto xs = from(int_range(0, -1)) + .where(is_prime) + .take(howMany); + auto v = vector(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(); + VERIFY_EQ(false, q[0]); + VERIFY_EQ(true, q[1]); + VERIFY_EQ(true, q[2]); + VERIFY((std::is_same::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 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 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> 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 +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()); }); + + 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 +} + +int main(int argc, char** argv) +{ + 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++/unittest/testbench.hpp b/Ix++/unittest/testbench.hpp new file mode 100644 index 0000000..6dbb1c8 --- /dev/null +++ b/Ix++/unittest/testbench.hpp @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#include +#include +#include +#include +#include +#include + +struct empty_testcase{ void run(){} const char* name(){return 0;} }; + +template +struct testcase : empty_testcase{}; + + +template +struct testrange { + void run(size_t& pass, size_t& fail) + { + using namespace std; + { testcase a_case; + if (a_case.name()) { + 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 size_t rem = (end-begin-1); + testrange().run(pass, fail); + testrange().run(pass, fail); + } +}; + +template +struct testrange { + void run(size_t& pass, 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 msg; + errmsg() : msg(new std::stringstream) + {} + + template + 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/Ix/.gitattributes b/Ix/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/Ix/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/Ix/.gitignore b/Ix/.gitignore new file mode 100644 index 0000000..5ebd21a --- /dev/null +++ b/Ix/.gitignore @@ -0,0 +1,163 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## 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/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# 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 + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.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 + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Ix/Common.targets b/Ix/Common.targets new file mode 100644 index 0000000..032880f --- /dev/null +++ b/Ix/Common.targets @@ -0,0 +1,180 @@ + + + + + AnyCPU + 8.0.30703 + 2.0 + + + + + true + full + false + bin\Debug40\ + $(DefineConstants);TRACE;DEBUG + prompt + 4 + v4.0 + DESKTOPCLR + DESKTOPCLR40 + + + pdbonly + true + bin\Release40\ + $(DefineConstants);TRACE + prompt + 4 + v4.0 + DESKTOPCLR + DESKTOPCLR40 + + + + true + full + false + bin\Debug35\ + $(DefineConstants);TRACE;DEBUG;NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_RXINTERFACES;NO_ZIP + prompt + 4 + v3.5 + DESKTOPCLR + DESKTOPCLR20 + + + pdbonly + true + bin\Release35\ + $(DefineConstants);TRACE;NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_RXINTERFACES;NO_ZIP + prompt + 4 + v3.5 + DESKTOPCLR + DESKTOPCLR20 + + + + true + full + false + bin\DebugSL4\ + $(DefineConstants);TRACE;DEBUG;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES + prompt + 4 + Silverlight + v4.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHT4 + + + pdbonly + true + bin\ReleaseSL4\ + $(DefineConstants);TRACE;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES + prompt + 4 + Silverlight + v4.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHT4 + + + true + full + false + bin\DebugSL5\ + $(DefineConstants);TRACE;DEBUG;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES + prompt + 4 + Silverlight + v5.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHT5 + + + pdbonly + true + bin\ReleaseSL5\ + $(DefineConstants);TRACE;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES + prompt + 4 + Silverlight + v5.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHT5 + + + + true + full + false + bin\DebugWP7\ + $(DefineConstants);TRACE;DEBUG;WINDOWSPHONE7;NO_TLS;NO_VARIANCE;NO_SERIALIZABLE;NO_TPL;NO_HASHSET;NO_REMOTING;NO_SEMAPHORE;NO_LARGEARITY;NO_ZIP + prompt + 4 + WindowsPhone + Silverlight + v4.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHTM7 + + + pdbonly + true + bin\ReleaseWP7\ + $(DefineConstants);TRACE;WINDOWSPHONE7;NO_TLS;NO_VARIANCE;NO_SERIALIZABLE;NO_TPL;NO_HASHSET;NO_REMOTING;NO_SEMAPHORE;NO_LARGEARITY;NO_ZIP + prompt + 4 + WindowsPhone + Silverlight + v4.0 + $(TargetFrameworkVersion) + false + SILVERLIGHT + SILVERLIGHTM7 + + + + $(DefineConstants);$(BuildPlatform);$(BuildFlavor) + + + + $(DefineConstants);STABLE + + + + $(DefineConstants);SIGNED + true + ..\35MSSharedLib1024.snk + true + + + + $(DefineConstants);NO_CODECOVERAGE + + + + CP_SetBuildReferencePath + + + + $(ProjectDir)..\..\..\References\$(BuildFlavor) + + + + \ No newline at end of file diff --git a/Ix/Import.targets b/Ix/Import.targets new file mode 100644 index 0000000..fb23483 --- /dev/null +++ b/Ix/Import.targets @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Ix/Interactive Extensions.sln b/Ix/Interactive Extensions.sln new file mode 100644 index 0000000..5fbfed0 --- /dev/null +++ b/Ix/Interactive Extensions.sln @@ -0,0 +1,332 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive", "System.Interactive\System.Interactive.csproj", "{8E4B04F0-915E-48F9-9796-76278C6094BD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{C4C8532A-F8D2-428B-962E-FD578A1E647C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{01E445E3-2296-48ED-A70D-F64CE755E0B6}" + ProjectSection(SolutionItems) = preProject + Interactive Extensions.vsmdi = Interactive Extensions.vsmdi + Local.testsettings = Local.testsettings + TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive.Providers", "System.Interactive.Providers\System.Interactive.Providers.csproj", "{6D62E966-469D-4A99-BD43-0A17FA14FB4F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive.Async", "System.Interactive.Async\System.Interactive.Async.csproj", "{7269A578-326A-4C3E-9874-A2D2600095BC}" +EndProject +Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = Interactive Extensions.vsmdi + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Debug35|Any CPU = Debug35|Any CPU + Debug35|Mixed Platforms = Debug35|Mixed Platforms + Debug35|x86 = Debug35|x86 + Debug40|Any CPU = Debug40|Any CPU + Debug40|Mixed Platforms = Debug40|Mixed Platforms + Debug40|x86 = Debug40|x86 + DebugPL|Any CPU = DebugPL|Any CPU + DebugPL|Mixed Platforms = DebugPL|Mixed Platforms + DebugPL|x86 = DebugPL|x86 + DebugSL4|Any CPU = DebugSL4|Any CPU + DebugSL4|Mixed Platforms = DebugSL4|Mixed Platforms + DebugSL4|x86 = DebugSL4|x86 + DebugSL5|Any CPU = DebugSL5|Any CPU + DebugSL5|Mixed Platforms = DebugSL5|Mixed Platforms + DebugSL5|x86 = DebugSL5|x86 + DebugWP7|Any CPU = DebugWP7|Any CPU + DebugWP7|Mixed Platforms = DebugWP7|Mixed Platforms + DebugWP7|x86 = DebugWP7|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + Release35|Any CPU = Release35|Any CPU + Release35|Mixed Platforms = Release35|Mixed Platforms + Release35|x86 = Release35|x86 + Release40|Any CPU = Release40|Any CPU + Release40|Mixed Platforms = Release40|Mixed Platforms + Release40|x86 = Release40|x86 + ReleasePL|Any CPU = ReleasePL|Any CPU + ReleasePL|Mixed Platforms = ReleasePL|Mixed Platforms + ReleasePL|x86 = ReleasePL|x86 + ReleaseSL4|Any CPU = ReleaseSL4|Any CPU + ReleaseSL4|Mixed Platforms = ReleaseSL4|Mixed Platforms + ReleaseSL4|x86 = ReleaseSL4|x86 + ReleaseSL5|Any CPU = ReleaseSL5|Any CPU + ReleaseSL5|Mixed Platforms = ReleaseSL5|Mixed Platforms + ReleaseSL5|x86 = ReleaseSL5|x86 + ReleaseWP7|Any CPU = ReleaseWP7|Any CPU + ReleaseWP7|Mixed Platforms = ReleaseWP7|Mixed Platforms + ReleaseWP7|x86 = ReleaseWP7|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Any CPU.Build.0 = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|x86.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Any CPU.Build.0 = Debug35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|x86.ActiveCfg = Debug35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Any CPU.Build.0 = Debug40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|x86.ActiveCfg = Debug40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Any CPU.Build.0 = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|x86.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Any CPU.ActiveCfg = Release35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Any CPU.Build.0 = Release35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|x86.ActiveCfg = Release35|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Any CPU.ActiveCfg = Release40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Any CPU.Build.0 = Release40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|x86.ActiveCfg = Release40|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU + {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Any CPU.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Any CPU.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Mixed Platforms.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|x86.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Any CPU.Build.0 = Debug35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|x86.ActiveCfg = Debug35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Any CPU.Build.0 = Debug40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|x86.ActiveCfg = Debug40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Any CPU.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Any CPU.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Mixed Platforms.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|x86.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Any CPU.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|x86.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Any CPU.ActiveCfg = Release35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Any CPU.Build.0 = Release35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|x86.ActiveCfg = Release35|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Any CPU.ActiveCfg = Release40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Any CPU.Build.0 = Release40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|x86.ActiveCfg = Release40|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Any CPU.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|x86.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU + {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Any CPU.Build.0 = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|x86.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Any CPU.Build.0 = Debug35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|x86.ActiveCfg = Debug35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Any CPU.Build.0 = Debug40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|x86.ActiveCfg = Debug40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Any CPU.Build.0 = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|x86.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Any CPU.ActiveCfg = Release35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Any CPU.Build.0 = Release35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|x86.ActiveCfg = Release35|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Any CPU.ActiveCfg = Release40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Any CPU.Build.0 = Release40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|x86.ActiveCfg = Release40|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Any CPU.Build.0 = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|x86.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|x86.ActiveCfg = Debug35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Any CPU.Build.0 = Debug40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|x86.ActiveCfg = Debug40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Any CPU.Build.0 = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|x86.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|Any CPU.ActiveCfg = Release35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|x86.ActiveCfg = Release35|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Any CPU.ActiveCfg = Release40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Any CPU.Build.0 = Release40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|x86.ActiveCfg = Release40|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU + {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Ix/Interactive Extensions.vsmdi b/Ix/Interactive Extensions.vsmdi new file mode 100644 index 0000000..3031d67 --- /dev/null +++ b/Ix/Interactive Extensions.vsmdi @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Ix/Interactive Extensions.vssscc b/Ix/Interactive Extensions.vssscc new file mode 100644 index 0000000..6cb031b --- /dev/null +++ b/Ix/Interactive Extensions.vssscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" +} diff --git a/Ix/Local.testsettings b/Ix/Local.testsettings new file mode 100644 index 0000000..9c078dd --- /dev/null +++ b/Ix/Local.testsettings @@ -0,0 +1,37 @@ + + + These are default test settings for a local test run. + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs new file mode 100644 index 0000000..8b0f766 --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs @@ -0,0 +1,2019 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, Func resultSelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + var tcs = new TaskCompletionSource(); + + var acc = seed; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + acc = accumulator(acc, e.Current); + f(ct); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + } + } + else + { + var result = default(TResult); + try + { + result = resultSelector(acc); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + return; + } + + tcs.TrySetResult(result); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return source.Aggregate(seed, accumulator, x => x, cancellationToken); + } + + public static Task Aggregate(this IAsyncEnumerable source, Func accumulator, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + var tcs = new TaskCompletionSource(); + + var first = true; + var acc = default(TSource); + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + if (first) + acc = e.Current; + else + acc = accumulator(acc, e.Current); + f(ct); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + + first = false; + } + else + { + if (first) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(acc); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Count(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0, (c, _) => c + 1, cancellationToken); + } + + public static Task Count(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).Aggregate(0, (c, _) => c + 1, cancellationToken); + } + + public static Task LongCount(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0L, (c, _) => c + 1, cancellationToken); + } + + public static Task LongCount(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).Aggregate(0L, (c, _) => c + 1, cancellationToken); + } + + public static Task All(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + if (!predicate(e.Current)) + tcs.TrySetResult(false); + else + f(ct); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + else + { + tcs.TrySetResult(true); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Any(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + if (predicate(e.Current)) + tcs.TrySetResult(true); + else + f(ct); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + else + { + tcs.TrySetResult(false); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Any(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var e = source.GetEnumerator(); + return e.MoveNext(cancellationToken); + } + + public static Task Contains(this IAsyncEnumerable source, TSource value, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Any(x => comparer.Equals(x, value), cancellationToken); + } + + public static Task Contains(this IAsyncEnumerable source, TSource value, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Contains(value, EqualityComparer.Default, cancellationToken); + } + + public static Task First(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + e.MoveNext(cancellationToken).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + tcs.TrySetResult(e.Current); + else + tcs.TrySetException(new InvalidOperationException()); + }); + }); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task First(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).First(cancellationToken); + } + + public static Task FirstOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + e.MoveNext(cancellationToken).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + tcs.TrySetResult(e.Current); + else + tcs.TrySetResult(default(TSource)); + }); + }); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task FirstOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).FirstOrDefault(cancellationToken); + } + + public static Task Last(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + var last = default(TSource); + var hasLast = false; + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + hasLast = true; + last = e.Current; + f(ct); + } + else + { + if (!hasLast) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(last); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Last(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).Last(cancellationToken); + } + + public static Task LastOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + var last = default(TSource); + var hasLast = false; + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + hasLast = true; + last = e.Current; + f(ct); + } + else + { + if (!hasLast) + tcs.TrySetResult(default(TSource)); + else + tcs.TrySetResult(last); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task LastOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).LastOrDefault(cancellationToken); + } + + public static Task Single(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + e.MoveNext(cancellationToken).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var result = e.Current; + e.MoveNext(cancellationToken).ContinueWith(t1 => + { + t1.Handle(tcs, res1 => + { + if (res1) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(result); + }); + }); + } + else + tcs.TrySetException(new InvalidOperationException()); + }); + }); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Single(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).Single(cancellationToken); + } + + public static Task SingleOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + e.MoveNext(cancellationToken).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var result = e.Current; + e.MoveNext(cancellationToken).ContinueWith(t1 => + { + t1.Handle(tcs, res1 => + { + if (res1) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(result); + }); + }); + } + else + tcs.TrySetResult(default(TSource)); + }); + }); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task SingleOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return source.Where(predicate).SingleOrDefault(cancellationToken); + } + + public static Task ElementAt(this IAsyncEnumerable source, int index, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (index < 0) + throw new ArgumentOutOfRangeException("index"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + var next = default(Action); + next = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (index == 0) + { + tcs.TrySetResult(e.Current); + } + else + { + index--; + next(ct); + } + } + else + { + tcs.TrySetException(new ArgumentOutOfRangeException()); + } + }); + }); + + next(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task ElementAtOrDefault(this IAsyncEnumerable source, int index, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (index < 0) + throw new ArgumentOutOfRangeException("index"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + var next = default(Action); + next = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (index == 0) + { + tcs.TrySetResult(e.Current); + } + else + { + index--; + next(ct); + } + } + else + { + tcs.TrySetResult(default(TSource)); + } + }); + }); + + next(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task ToArray(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(new List(), (list, x) => { list.Add(x); return list; }, list => list.ToArray(), cancellationToken); + } + + public static Task> ToList(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(new List(), (list, x) => { list.Add(x); return list; }, cancellationToken); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Aggregate(new Dictionary(comparer), (d, x) => { d.Add(keySelector(x), elementSelector(x)); return d; }, cancellationToken); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + + return source.ToDictionary(keySelector, elementSelector, EqualityComparer.Default, cancellationToken); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.ToDictionary(keySelector, x => x, comparer, cancellationToken); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.ToDictionary(keySelector, x => x, EqualityComparer.Default, cancellationToken); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Aggregate(new Lookup(comparer), (lookup, x) => { lookup.Add(keySelector(x), elementSelector(x)); return lookup; }, lookup => (ILookup)lookup, cancellationToken); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + + return source.ToLookup(keySelector, elementSelector, EqualityComparer.Default, cancellationToken); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.ToLookup(keySelector, x => x, comparer, cancellationToken); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.ToLookup(keySelector, x => x, EqualityComparer.Default, cancellationToken); + } + + class Lookup : ILookup + { + private readonly Dictionary> map; + + public Lookup(IEqualityComparer comparer) + { + map = new Dictionary>(comparer); + } + + public void Add(TKey key, TElement element) + { + var g = default(EnumerableGrouping); + if (!map.TryGetValue(key, out g)) + { + g = new EnumerableGrouping(key); + map.Add(key, g); + } + + g.Add(element); + } + + public bool Contains(TKey key) + { + return map.ContainsKey(key); + } + + public int Count + { + get { return map.Keys.Count; } + } + + public IEnumerable this[TKey key] + { + get { return map[key]; } + } + + public IEnumerator> GetEnumerator() + { + return map.Values.Cast>().GetEnumerator(); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + count++; + sum += e.Current; + f(ct); + } + else + { + if (count == 0) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (e.Current.HasValue) + { + count++; + sum += e.Current.Value; + } + f(ct); + } + else + { + if (count == 0) + tcs.TrySetResult(null); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + count++; + sum += e.Current; + f(ct); + } + else + { + if (count == 0) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (e.Current.HasValue) + { + count++; + sum += e.Current.Value; + } + f(ct); + } + else + { + if (count == 0) + tcs.TrySetResult(null); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + count++; + sum += e.Current; + f(ct); + } + else + { + if (count == 0) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0.0; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (e.Current.HasValue) + { + count++; + sum += e.Current.Value; + } + f(ct); + } + else + { + if (count == 0) + tcs.TrySetResult(null); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0f; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + count++; + sum += e.Current; + f(ct); + } + else + { + if (count == 0) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0f; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (e.Current.HasValue) + { + count++; + sum += e.Current.Value; + } + f(ct); + } + else + { + if (count == 0) + tcs.TrySetResult(null); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0m; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + count++; + sum += e.Current; + f(ct); + } + else + { + if (count == 0) + tcs.TrySetException(new InvalidOperationException()); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var tcs = new TaskCompletionSource(); + + var count = 0L; + var sum = 0m; + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (e.Current.HasValue) + { + count++; + sum += e.Current.Value; + } + f(ct); + } + else + { + if (count == 0) + tcs.TrySetResult(null); + else + tcs.TrySetResult(sum / count); + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Average(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Max, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Max, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Max, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Max, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Max, cancellationToken); + } + + static T? NullableMax(T? x, T? y) + where T : struct, IComparable + { + if (!x.HasValue) + return y; + if (!y.HasValue) + return x; + if (x.Value.CompareTo(y.Value) >= 0) + return x; + return y; + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(int?), NullableMax, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(long?), NullableMax, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(double?), NullableMax, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(float?), NullableMax, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(decimal?), NullableMax, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var comparer = Comparer.Default; + return source.Aggregate((x, y) => comparer.Compare(x, y) >= 0 ? x : y, cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Max(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Min, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Min, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Min, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Min, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(Math.Min, cancellationToken); + } + + static T? NullableMin(T? x, T? y) + where T : struct, IComparable + { + if (!x.HasValue) + return y; + if (!y.HasValue) + return x; + if (x.Value.CompareTo(y.Value) <= 0) + return x; + return y; + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(int?), NullableMin, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(long?), NullableMin, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(double?), NullableMin, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(float?), NullableMin, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(default(decimal?), NullableMin, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + var comparer = Comparer.Default; + return source.Aggregate((x, y) => comparer.Compare(x, y) <= 0 ? x : y, cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Min(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0, (x, y) => x + y, cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0L, (x, y) => x + y, cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0.0, (x, y) => x + y, cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0f, (x, y) => x + y, cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate(0m, (x, y) => x + y, cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate((int?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate((long?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate((double?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate((float?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Aggregate((decimal?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Select(selector).Sum(cancellationToken); + } + + public static Task IsEmpty(this IAsyncEnumerable source, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Any(cancellationToken).ContinueWith(t => !t.Result); + } + + public static Task Min(this IAsyncEnumerable source, IComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return MinBy(source, x => x, comparer, cancellationToken).ContinueWith(t => t.Result.First()); + } + + public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return MinBy(source, keySelector, Comparer.Default, cancellationToken); + } + + public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue), cancellationToken); + } + + public static Task Max(this IAsyncEnumerable source, IComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return MaxBy(source, x => x, comparer, cancellationToken).ContinueWith(t => t.Result.First()); + } + + public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return MaxBy(source, keySelector, Comparer.Default, cancellationToken); + } + + public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue), cancellationToken); + } + + private static Task> ExtremaBy(IAsyncEnumerable source, Func keySelector, Func compare, CancellationToken cancellationToken) + { + var tcs = new TaskCompletionSource>(); + + var result = new List(); + + var hasFirst = false; + var current = default(TSource); + var resKey = default(TKey); + + var e = source.GetEnumerator(); + + var f = default(Action); + f = ct => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (!hasFirst) + { + if (!res) + { + tcs.TrySetException(new InvalidOperationException("Source sequence doesn't contain any elements.")); + return; + } + + current = e.Current; + + try + { + resKey = keySelector(current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + result.Add(current); + + hasFirst = true; + f(ct); + } + else + { + if (res) + { + var key = default(TKey); + var cmp = default(int); + + try + { + current = e.Current; + key = keySelector(current); + cmp = compare(key, resKey); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (cmp == 0) + { + result.Add(current); + } + else if (cmp > 0) + { + result = new List { current }; + resKey = key; + } + + f(ct); + } + else + { + tcs.TrySetResult(result); + } + } + }); + }); + + f(cancellationToken); + + return tcs.Task.Finally(e.Dispose); + } + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs new file mode 100644 index 0000000..2c66eec --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static IAsyncEnumerable ToAsyncEnumerable(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var e = source.GetEnumerator(); + + return Create( + ct => Task.Factory.StartNew(() => + { + var res = default(bool); + try + { + res = e.MoveNext(); + } + finally + { + if (!res) + e.Dispose(); + } + return res; + }, ct), + () => e.Current, + () => e.Dispose() + ); + }); + } + + public static IEnumerable ToEnumerable(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return ToEnumerable_(source); + } + + private static IEnumerable ToEnumerable_(IAsyncEnumerable source) + { + using (var e = source.GetEnumerator()) + { + while (true) + { + var t = e.MoveNext(CancellationToken.None); + t.Wait(); + if (!t.Result) + break; + var c = e.Current; + yield return c; + } + } + } + +#if !NO_RXINTERFACES + public static IAsyncEnumerable ToAsyncEnumerable(this IObservable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var observer = new ToAsyncEnumerableObserver(); + observer.Queue = new Queue>(); + + var subscription = source.Subscribe(observer); + + return Create( + (ct, tcs) => + { + lock (observer.Queue) + { + if (observer.Queue.Count > 0) + { + var n = observer.Queue.Dequeue(); + n.Switch( + x => + { + observer.Current = x; + tcs.TrySetResult(true); + }, + ex => + { + tcs.TrySetException(ex); + }, + _ => + { + tcs.TrySetResult(false); + } + ); + } + else + observer.TaskCompletionSource = tcs; + } + + return tcs.Task; + }, + () => observer.Current, + () => + { + subscription.Dispose(); + // Should we cancel in-flight operations somehow? + }); + }); + } + + class ToAsyncEnumerableObserver : IObserver + { + public Queue> Queue { get; set; } + public T Current { get; set; } + public TaskCompletionSource TaskCompletionSource { get; set; } + + public void OnCompleted() + { + lock (Queue) + { + if (TaskCompletionSource == null) + Queue.Enqueue(new Either.Choice3(true)); + else + { + TaskCompletionSource.SetResult(false); + TaskCompletionSource = null; + } + } + } + + public void OnError(Exception error) + { + lock (Queue) + { + if (TaskCompletionSource == null) + Queue.Enqueue(new Either.Choice2(error)); + else + { + TaskCompletionSource.SetException(error); + TaskCompletionSource = null; + } + } + } + + public void OnNext(T value) + { + lock (Queue) + { + if (TaskCompletionSource == null) + Queue.Enqueue(new Either.Choice1(value)); + else + { + Current = value; + TaskCompletionSource.SetResult(true); + TaskCompletionSource = null; + } + } + } + } + + abstract class Either + { + public abstract void Switch(Action choice1, Action choice2, Action choice3); + + public class Choice1 : Either + { + public Choice1(T value) { Value = value; } + public T Value { get; private set; } + + public override void Switch(Action choice1, Action choice2, Action choice3) + { + choice1(Value); + } + } + + public class Choice2 : Either + { + public Choice2(U value) { Value = value; } + public U Value { get; private set; } + + public override void Switch(Action choice1, Action choice2, Action choice3) + { + choice2(Value); + } + } + + public class Choice3 : Either + { + public Choice3(V value) { Value = value; } + public V Value { get; private set; } + + public override void Switch(Action choice1, Action choice2, Action choice3) + { + choice3(Value); + } + } + } + + public static IObservable ToObservable(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new ToObservableObservable(source); + } + + class ToObservableObservable : IObservable + { + private readonly IAsyncEnumerable source; + + public ToObservableObservable(IAsyncEnumerable source) + { + this.source = source; + } + + public IDisposable Subscribe(IObserver observer) + { + var ctd = new CancellationTokenDisposable(); + var e = source.GetEnumerator(); + + var f = default(Action); + f = () => e.MoveNext(ctd.Token).ContinueWith(t => + { + if (t.IsFaulted) + { + observer.OnError(t.Exception); + e.Dispose(); + } + else if (t.IsCanceled) + { + e.Dispose(); + } + else if (t.IsCompleted) + { + if (t.Result) + { + observer.OnNext(e.Current); + f(); + } + else + { + observer.OnCompleted(); + e.Dispose(); + } + } + }, ctd.Token); + + f(); + + return new CompositeDisposable(ctd, e); + } + } +#endif + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs new file mode 100644 index 0000000..f930293 --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + static IAsyncEnumerable Create(Func> getEnumerator) + { + return new AnonymousAsyncEnumerable(getEnumerator); + } + + class AnonymousAsyncEnumerable : IAsyncEnumerable + { + Func> getEnumerator; + + public AnonymousAsyncEnumerable(Func> getEnumerator) + { + this.getEnumerator = getEnumerator; + } + + public IAsyncEnumerator GetEnumerator() + { + return getEnumerator(); + } + } + + static IAsyncEnumerator Create(Func> moveNext, Func current, Action dispose) + { + return new AnonymousAsyncEnumerator(moveNext, current, dispose); + } + + static IAsyncEnumerator Create(Func, Task> moveNext, Func current, Action dispose) + { + var self = default(IAsyncEnumerator); + self = new AnonymousAsyncEnumerator( + ct => + { + var tcs = new TaskCompletionSource(); + + var stop = new Action(() => + { + self.Dispose(); + tcs.TrySetCanceled(); + }); + + var ctr = ct.Register(stop); + + var res = moveNext(ct, tcs).Finally(ctr.Dispose); + return res; + }, + current, + dispose + ); + return self; + } + + class AnonymousAsyncEnumerator : IAsyncEnumerator + { + private readonly Func> _moveNext; + private readonly Func _current; + private readonly Action _dispose; + private bool _disposed; + + public AnonymousAsyncEnumerator(Func> moveNext, Func current, Action dispose) + { + _moveNext = moveNext; + _current = current; + _dispose = dispose; + } + + public Task MoveNext(CancellationToken cancellationToken) + { + if (_disposed) + return TaskExt.Return(false, CancellationToken.None); + + return _moveNext(cancellationToken); + } + + public T Current + { + get + { + return _current(); + } + } + + public void Dispose() + { + if (!_disposed) + { + _disposed = true; + _dispose(); + } + } + } + + public static IAsyncEnumerable Return(TValue value) + { + return new[] { value }.ToAsyncEnumerable(); + } + + public static IAsyncEnumerable Throw(Exception exception) + { + if (exception == null) + throw new ArgumentNullException("exception"); + + return Create(() => Create( + ct => TaskExt.Throw(exception, ct), + () => { throw new InvalidOperationException(); }, + () => { }) + ); + } + + public static IAsyncEnumerable Never() + { + return Create(() => Create( + (ct, tcs) => tcs.Task, + () => { throw new InvalidOperationException(); }, + () => { }) + ); + } + + public static IAsyncEnumerable Empty() + { + return Create(() => Create( + ct => TaskExt.Return(false, ct), + () => { throw new InvalidOperationException(); }, + () => { }) + ); + } + + public static IAsyncEnumerable Range(int start, int count) + { + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Enumerable.Range(start, count).ToAsyncEnumerable(); + } + + public static IAsyncEnumerable Repeat(TResult element, int count) + { + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Enumerable.Repeat(element, count).ToAsyncEnumerable(); + } + + public static IAsyncEnumerable Repeat(TResult element) + { + return Create(() => + { + return Create( + ct => TaskExt.Return(true, ct), + () => element, + () => { } + ); + }); + } + + public static IAsyncEnumerable Defer(Func> factory) + { + if (factory == null) + throw new ArgumentNullException("factory"); + + return Create(() => factory().GetEnumerator()); + } + + public static IAsyncEnumerable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) + { + if (condition == null) + throw new ArgumentNullException("condition"); + if (iterate == null) + throw new ArgumentNullException("iterate"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return Create(() => + { + var i = initialState; + var started = false; + var current = default(TResult); + + return Create( + ct => + { + var b = false; + try + { + if (started) + i = iterate(i); + + b = condition(i); + + if (b) + current = resultSelector(i); + } + catch (Exception ex) + { + return TaskExt.Throw(ex, ct); + } + + if (!b) + return TaskExt.Return(false, ct); + + if (!started) + started = true; + + return TaskExt.Return(true, ct); + }, + () => current, + () => { } + ); + }); + } + + public static IAsyncEnumerable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable + { + if (resourceFactory == null) + throw new ArgumentNullException("resourceFactory"); + if (enumerableFactory == null) + throw new ArgumentNullException("enumerableFactory"); + + return Create(() => + { + var resource = resourceFactory(); + var e = default(IAsyncEnumerator); + + try + { + e = enumerableFactory(resource).GetEnumerator(); + } + catch (Exception) + { + resource.Dispose(); + throw; + } + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, resource, e); + + var current = default(TSource); + + return Create( + (ct, tcs) => + { + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, + res => + { + if (res) + { + current = e.Current; + tcs.TrySetResult(true); + } + else + { + d.Dispose(); + tcs.TrySetResult(false); + } + }, + ex => + { + d.Dispose(); + tcs.TrySetException(ex); + } + ); + }); + + return tcs.Task; + }, + () => current, + d.Dispose + ); + }); + } + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs new file mode 100644 index 0000000..db33c61 --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static IAsyncEnumerable Catch(this IAsyncEnumerable source, Func> handler) + where TException : Exception + { + if (source == null) + throw new ArgumentNullException("source"); + if (handler == null) + throw new ArgumentNullException("handler"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable { Disposable = e }; + var d = new CompositeDisposable(cts, a); + var done = false; + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (!done) + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, + res => + { + tcs.TrySetResult(res); + }, + ex => + { + var err = default(IAsyncEnumerator); + + try + { + ex.Flatten().Handle(ex_ => + { + var exx = ex_ as TException; + if (exx != null) + { + err = handler(exx).GetEnumerator(); + return true; + } + + return false; + }); + } + catch (Exception ex2) + { + tcs.TrySetException(ex2); + return; + } + + if (err != null) + { + e = err; + a.Disposable = e; + + done = true; + f(tcs, ct); + } + } + ); + }); + } + else + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + tcs.TrySetResult(res); + }); + }); + } + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Catch(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Catch_(); + } + + public static IAsyncEnumerable Catch(params IAsyncEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Catch_(); + } + + public static IAsyncEnumerable Catch(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return new[] { first, second }.Catch_(); + } + + private static IAsyncEnumerable Catch_(this IEnumerable> sources) + { + return Create(() => + { + var se = sources.GetEnumerator(); + var e = default(IAsyncEnumerator); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable(); + var d = new CompositeDisposable(cts, se, a); + + var error = default(Exception); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + var b = false; + try + { + b = se.MoveNext(); + if (b) + e = se.Current.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (!b) + { + if (error != null) + { + tcs.TrySetException(error); + return; + } + + tcs.TrySetResult(false); + return; + } + + error = null; + + a.Disposable = e; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, + res => + { + tcs.TrySetResult(res); + }, + ex => + { + e.Dispose(); + e = null; + + error = ex; + f(tcs, ct); + } + ); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Finally(this IAsyncEnumerable source, Action finallyAction) + { + if (source == null) + throw new ArgumentNullException("source"); + if (finallyAction == null) + throw new ArgumentNullException("finallyAction"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var r = new Disposable(finallyAction); + var d = new CompositeDisposable(cts, e, r); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + tcs.TrySetResult(res); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumeratorSync(r); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable OnErrorResumeNext(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return OnErrorResumeNext_(new[] { first, second }); + } + + public static IAsyncEnumerable OnErrorResumeNext(params IAsyncEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return OnErrorResumeNext_(sources); + } + + public static IAsyncEnumerable OnErrorResumeNext(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return OnErrorResumeNext_(sources); + } + + private static IAsyncEnumerable OnErrorResumeNext_(IEnumerable> sources) + { + return Create(() => + { + var se = sources.GetEnumerator(); + var e = default(IAsyncEnumerator); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable(); + var d = new CompositeDisposable(cts, se, a); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + var b = false; + try + { + b = se.MoveNext(); + if (b) + e = se.Current.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (!b) + { + tcs.TrySetResult(false); + return; + } + + a.Disposable = e; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, + res => + { + if (res) + { + tcs.TrySetResult(true); + } + else + { + e.Dispose(); + e = null; + + f(tcs, ct); + } + }, + ex => + { + e.Dispose(); + e = null; + + f(tcs, ct); + } + ); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Retry(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new[] { source }.Repeat().Catch(); + } + + public static IAsyncEnumerable Retry(this IAsyncEnumerable source, int retryCount) + { + if (source == null) + throw new ArgumentNullException("source"); + if (retryCount < 0) + throw new ArgumentOutOfRangeException("retryCount"); + + return new[] { source }.Repeat(retryCount).Catch(); + } + + private static IEnumerable Repeat(this IEnumerable source) + { + while (true) + foreach (var item in source) + yield return item; + } + + private static IEnumerable Repeat(this IEnumerable source, int count) + { + for (var i = 0; i < count; i++) + foreach (var item in source) + yield return item; + } + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs new file mode 100644 index 0000000..23c6c8d --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs @@ -0,0 +1,1250 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Sum(source, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static Task Sum(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Sum(source, selector, CancellationToken.None); + } + + public static void ForEach(this IAsyncEnumerable source, Action action) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + source.ForEachAsync(action).Wait(); + } + + public static Task ForEachAsync(this IAsyncEnumerable source, Action action) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + return ForEachAsync(source, action, CancellationToken.None); + } + + public static void ForEach(this IAsyncEnumerable source, Action action) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + source.ForEachAsync(action).Wait(); + } + + public static Task ForEachAsync(this IAsyncEnumerable source, Action action) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + return ForEachAsync(source, action, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Average(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Max(source, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Max(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Min(source, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Min(source, selector, CancellationToken.None); + } + + public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return SequenceEqual(first, second, comparer, CancellationToken.None); + } + + public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return SequenceEqual(first, second, CancellationToken.None); + } + + public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, Func resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return Aggregate(source, seed, accumulator, resultSelector, CancellationToken.None); + } + + public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return Aggregate(source, seed, accumulator, CancellationToken.None); + } + + public static Task Aggregate(this IAsyncEnumerable source, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return Aggregate(source, accumulator, CancellationToken.None); + } + + public static Task Count(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Count(source, CancellationToken.None); + } + + public static Task Count(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Count(source, predicate, CancellationToken.None); + } + + public static Task LongCount(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return LongCount(source, CancellationToken.None); + } + + public static Task LongCount(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return LongCount(source, predicate, CancellationToken.None); + } + + public static Task All(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return All(source, predicate, CancellationToken.None); + } + + public static Task Any(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Any(source, predicate, CancellationToken.None); + } + + public static Task Any(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Any(source, CancellationToken.None); + } + + public static Task Contains(this IAsyncEnumerable source, TSource value, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Contains(source, value, comparer, CancellationToken.None); + } + + public static Task Contains(this IAsyncEnumerable source, TSource value) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Contains(source, value, CancellationToken.None); + } + + public static Task First(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return First(source, CancellationToken.None); + } + + public static Task First(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return First(source, predicate, CancellationToken.None); + } + + public static Task FirstOrDefault(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return FirstOrDefault(source, CancellationToken.None); + } + + public static Task FirstOrDefault(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return FirstOrDefault(source, predicate, CancellationToken.None); + } + + public static Task Last(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Last(source, CancellationToken.None); + } + + public static Task Last(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Last(source, predicate, CancellationToken.None); + } + + public static Task LastOrDefault(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return LastOrDefault(source, CancellationToken.None); + } + + public static Task LastOrDefault(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return LastOrDefault(source, predicate, CancellationToken.None); + } + + public static Task Single(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Single(source, CancellationToken.None); + } + + public static Task Single(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Single(source, predicate, CancellationToken.None); + } + + public static Task SingleOrDefault(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return SingleOrDefault(source, CancellationToken.None); + } + + public static Task SingleOrDefault(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return SingleOrDefault(source, predicate, CancellationToken.None); + } + + public static Task ElementAt(this IAsyncEnumerable source, int index) + { + if (source == null) + throw new ArgumentNullException("source"); + + return ElementAt(source, index, CancellationToken.None); + } + + public static Task ElementAtOrDefault(this IAsyncEnumerable source, int index) + { + if (source == null) + throw new ArgumentNullException("source"); + + return ElementAtOrDefault(source, index, CancellationToken.None); + } + + public static Task ToArray(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return ToArray(source, CancellationToken.None); + } + + public static Task> ToList(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return ToList(source, CancellationToken.None); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ToDictionary(source, keySelector, elementSelector, comparer, CancellationToken.None); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + + return ToDictionary(source, keySelector, elementSelector, CancellationToken.None); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ToDictionary(source, keySelector, comparer, CancellationToken.None); + } + + public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return ToDictionary(source, keySelector, CancellationToken.None); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ToLookup(source, keySelector, elementSelector, comparer, CancellationToken.None); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + + return ToLookup(source, keySelector, elementSelector, CancellationToken.None); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ToLookup(source, keySelector, comparer, CancellationToken.None); + } + + public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return ToLookup(source, keySelector, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task Average(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Average(source, CancellationToken.None); + } + + public static Task IsEmpty(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.IsEmpty(CancellationToken.None); + } + + public static Task Min(this IAsyncEnumerable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Min(comparer, CancellationToken.None); + } + + public static Task> MinBy(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.MinBy(keySelector, CancellationToken.None); + } + + public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.MinBy(keySelector, comparer, CancellationToken.None); + } + + public static Task Max(this IAsyncEnumerable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Max(comparer, CancellationToken.None); + } + + public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.MaxBy(keySelector, CancellationToken.None); + } + + public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.MaxBy(keySelector, comparer, CancellationToken.None); + } + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs new file mode 100644 index 0000000..a8069b2 --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs @@ -0,0 +1,755 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static IAsyncEnumerable Concat(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return Create(() => + { + var switched = false; + var e = first.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable { Disposable = e }; + var d = new CompositeDisposable(cts, a); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + tcs.TrySetResult(true); + } + else + { + if (switched) + { + tcs.TrySetResult(false); + } + else + { + switched = true; + + e = second.GetEnumerator(); + a.Disposable = e; + + f(tcs, ct); + } + } + }); + }); + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Zip(this IAsyncEnumerable first, IAsyncEnumerable second, Func selector) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e1 = first.GetEnumerator(); + var e2 = second.GetEnumerator(); + var current = default(TResult); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e1, e2); + + return Create( + (ct, tcs) => + { + e1.MoveNext(cts.Token).Zip(e2.MoveNext(cts.Token), (f, s) => + { + var result = f && s; + if (result) + current = selector(e1.Current, e2.Current); + return result; + }).ContinueWith(t => + { + t.Handle(tcs, x => tcs.TrySetResult(x)); + }); + + return tcs.Task.UsingEnumerator(e1).UsingEnumerator(e2); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Except(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Create(() => + { + var e = first.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var mapTask = default(Task>); + var getMapTask = new Func>>(ct => + { + if (mapTask == null) + mapTask = second.ToDictionary(x => x, comparer, ct); + return mapTask; + }); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).Zip(getMapTask(ct), (b, _) => b).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (!mapTask.Result.ContainsKey(e.Current)) + tcs.TrySetResult(true); + else + f(tcs, ct); + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Except(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.Except(second, EqualityComparer.Default); + } + + public static IAsyncEnumerable Intersect(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Create(() => + { + var e = first.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var mapTask = default(Task>); + var getMapTask = new Func>>(ct => + { + if (mapTask == null) + mapTask = second.ToDictionary(x => x, comparer, ct); + return mapTask; + }); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).Zip(getMapTask(ct), (b, _) => b).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + if (mapTask.Result.ContainsKey(e.Current)) + tcs.TrySetResult(true); + else + f(tcs, ct); + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Intersect(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.Intersect(second, EqualityComparer.Default); + } + + public static IAsyncEnumerable Union(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return first.Concat(second).Distinct(comparer); + } + + public static IAsyncEnumerable Union(this IAsyncEnumerable first, IAsyncEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.Union(second, EqualityComparer.Default); + } + + public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer, CancellationToken cancellationToken) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + var tcs = new TaskCompletionSource(); + + var e1 = first.GetEnumerator(); + var e2 = second.GetEnumerator(); + + var run = default(Action); + run = ct => + { + e1.MoveNext(ct).Zip(e2.MoveNext(ct), (f, s) => + { + if (f ^ s) + { + tcs.TrySetResult(false); + return false; + } + + if (f && s) + { + var eq = default(bool); + try + { + eq = comparer.Equals(e1.Current, e2.Current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return false; + } + + if (!eq) + { + tcs.TrySetResult(false); + return false; + } + else + return true; + } + else + { + tcs.TrySetResult(true); + return false; + } + }).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + run(ct); + }); + }); + }; + + run(cancellationToken); + + return tcs.Task.Finally(() => + { + e1.Dispose(); + e2.Dispose(); + }); + } + + public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, CancellationToken cancellationToken) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.SequenceEqual(second, EqualityComparer.Default, cancellationToken); + } + + public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector, IEqualityComparer comparer) + { + if (outer == null) + throw new ArgumentNullException("outer"); + if (inner == null) + throw new ArgumentNullException("inner"); + if (outerKeySelector == null) + throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) + throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Create(() => + { + var innerMap = default(Task>); + var getInnerMap = new Func>>(ct => + { + if (innerMap == null) + innerMap = inner.ToLookup(innerKeySelector, comparer, ct); + + return innerMap; + }); + + var outerE = outer.GetEnumerator(); + var current = default(TResult); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, outerE); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + getInnerMap(ct).ContinueWith(ti => + { + ti.Handle(tcs, map => + { + outerE.MoveNext(ct).ContinueWith(to => + { + to.Handle(tcs, res => + { + if (res) + { + var element = outerE.Current; + var key = default(TKey); + + try + { + key = outerKeySelector(element); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + var innerE = default(IAsyncEnumerable); + if (!map.Contains(key)) + innerE = AsyncEnumerable.Empty(); + else + innerE = map[key].ToAsyncEnumerable(); + + try + { + current = resultSelector(element, innerE); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + tcs.TrySetResult(true); + } + else + { + tcs.TrySetResult(false); + } + }); + }); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(outerE); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector) + { + if (outer == null) + throw new ArgumentNullException("outer"); + if (inner == null) + throw new ArgumentNullException("inner"); + if (outerKeySelector == null) + throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) + throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer.Default); + } + + public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector, IEqualityComparer comparer) + { + if (outer == null) + throw new ArgumentNullException("outer"); + if (inner == null) + throw new ArgumentNullException("inner"); + if (outerKeySelector == null) + throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) + throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Create(() => + { + var oe = outer.GetEnumerator(); + var ie = inner.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, oe, ie); + + var current = default(TResult); + var useOuter = true; + var outerMap = new Dictionary>(comparer); + var innerMap = new Dictionary>(comparer); + var q = new Queue(); + + var gate = new object(); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (q.Count > 0) + { + current = q.Dequeue(); + tcs.TrySetResult(true); + return; + } + + var b = useOuter; + if (ie == null && oe == null) + { + tcs.TrySetResult(false); + return; + } + else if (ie == null) + b = true; + else if (oe == null) + b = false; + useOuter = !useOuter; + + var enqueue = new Func((o, i) => + { + var result = default(TResult); + try + { + result = resultSelector(o, i); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + return false; + } + + q.Enqueue(result); + return true; + }); + + if (b) + oe.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var element = oe.Current; + var key = default(TKey); + + try + { + key = outerKeySelector(element); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + return; + } + + var outerList = default(List); + if (!outerMap.TryGetValue(key, out outerList)) + { + outerList = new List(); + outerMap.Add(key, outerList); + } + + outerList.Add(element); + + var innerList = default(List); + if (!innerMap.TryGetValue(key, out innerList)) + { + innerList = new List(); + innerMap.Add(key, innerList); + } + + foreach (var v in innerList) + { + if (!enqueue(element, v)) + return; + } + + f(tcs, ct); + } + else + { + oe.Dispose(); + oe = null; + f(tcs, ct); + } + }); + }); + else + ie.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var element = ie.Current; + var key = default(TKey); + + try + { + key = innerKeySelector(element); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + return; + } + + var innerList = default(List); + if (!innerMap.TryGetValue(key, out innerList)) + { + innerList = new List(); + innerMap.Add(key, innerList); + } + + innerList.Add(element); + + var outerList = default(List); + if (!outerMap.TryGetValue(key, out outerList)) + { + outerList = new List(); + outerMap.Add(key, outerList); + } + + foreach (var v in outerList) + { + if (!enqueue(v, element)) + return; + } + + f(tcs, ct); + } + else + { + ie.Dispose(); + ie = null; + f(tcs, ct); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(oe).UsingEnumerator(ie); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) + { + if (outer == null) + throw new ArgumentNullException("outer"); + if (inner == null) + throw new ArgumentNullException("inner"); + if (outerKeySelector == null) + throw new ArgumentNullException("outerKeySelector"); + if (innerKeySelector == null) + throw new ArgumentNullException("innerKeySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer.Default); + } + + public static IAsyncEnumerable Concat(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Concat_(); + } + + public static IAsyncEnumerable Concat(params IAsyncEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Concat_(); + } + + private static IAsyncEnumerable Concat_(this IEnumerable> sources) + { + return Create(() => + { + var se = sources.GetEnumerator(); + var e = default(IAsyncEnumerator); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable(); + var d = new CompositeDisposable(cts, se, a); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + var b = false; + try + { + b = se.MoveNext(); + if (b) + e = se.Current.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (!b) + { + tcs.TrySetResult(false); + return; + } + + a.Disposable = e; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + tcs.TrySetResult(true); + } + else + { + e.Dispose(); + e = null; + + f(tcs, ct); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, IAsyncEnumerable other) + { + if (source == null) + throw new ArgumentNullException("source"); + if (other == null) + throw new ArgumentNullException("other"); + + return source.SelectMany(_ => other); + } + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs new file mode 100644 index 0000000..bab56a2 --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs @@ -0,0 +1,2466 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Linq +{ + public static partial class AsyncEnumerable + { + public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e = source.GetEnumerator(); + var current = default(TResult); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + current = selector(e.Current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + tcs.TrySetResult(true); + } + else + { + tcs.TrySetResult(false); + } + }); + }); + + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e = source.GetEnumerator(); + var current = default(TResult); + var index = 0; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + current = selector(e.Current, index++); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + tcs.TrySetResult(true); + } + else + { + tcs.TrySetResult(false); + } + }); + }); + + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable AsAsyncEnumerable(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Select(x => x); + } + + public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var b = false; + try + { + b = predicate(e.Current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (b) + tcs.TrySetResult(true); + else + f(tcs, ct); + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + var index = 0; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var b = false; + try + { + b = predicate(e.Current, index++); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (b) + tcs.TrySetResult(true); + else + f(tcs, ct); + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e = source.GetEnumerator(); + var ie = default(IAsyncEnumerator); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var outer = default(Action, CancellationToken>); + var inner = default(Action, CancellationToken>); + + inner = (tcs, ct) => + { + ie.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + tcs.TrySetResult(true); + } + else + { + ie = null; + outer(tcs, ct); + } + }); + }); + }; + + outer = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + ie = selector(e.Current).GetEnumerator(); + inner(tcs, ct); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + if (ie == null) + outer(tcs, cts.Token); + else + inner(tcs, cts.Token); + + return tcs.Task.UsingEnumerator(e); + }, + () => ie.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e = source.GetEnumerator(); + var ie = default(IAsyncEnumerator); + var index = 0; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var outer = default(Action, CancellationToken>); + var inner = default(Action, CancellationToken>); + + inner = (tcs, ct) => + { + ie.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + tcs.TrySetResult(true); + } + else + { + ie = null; + outer(tcs, ct); + } + }); + }); + }; + + outer = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + ie = selector(e.Current, index++).GetEnumerator(); + inner(tcs, ct); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + } + else + tcs.TrySetResult(false); + }); + }); + }; + + return Create( + (ct, tcs) => + { + if (ie == null) + outer(tcs, cts.Token); + else + inner(tcs, cts.Token); + + return tcs.Task.UsingEnumerator(e); + }, + () => ie.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector, Func resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return source.SelectMany(x => selector(x).Select(y => resultSelector(x, y))); + } + + public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector, Func resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return source.SelectMany((x, i) => selector(x, i).Select(y => resultSelector(x, y))); + } + + public static IAsyncEnumerable OfType(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Where(x => x is TType).Cast(); + } + + public static IAsyncEnumerable Cast(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Select(x => (TResult)x); + } + + public static IAsyncEnumerable Take(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Create(() => + { + var e = source.GetEnumerator(); + var n = count; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + if (n == 0) + return TaskExt.Return(false, cts.Token); + + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + --n; + tcs.TrySetResult(res); + }); + }); + + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var b = false; + + try + { + b = predicate(e.Current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (b) + { + tcs.TrySetResult(true); + return; + } + } + tcs.TrySetResult(false); + }); + }); + + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + var index = 0; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + e.MoveNext(cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var b = false; + + try + { + b = predicate(e.Current, index++); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (b) + { + tcs.TrySetResult(true); + return; + } + } + tcs.TrySetResult(false); + }); + }); + + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Skip(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Create(() => + { + var e = source.GetEnumerator(); + var n = count; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (n == 0) + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, x => tcs.TrySetResult(x)); + }); + else + { + --n; + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (!res) + tcs.TrySetResult(false); + else + f(tcs, ct); + }); + }); + } + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + var skipping = true; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (skipping) + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var result = false; + try + { + result = predicate(e.Current); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + if (result) + f(tcs, ct); + else + { + skipping = false; + tcs.TrySetResult(true); + } + } + else + tcs.TrySetResult(false); + }); + }); + else + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, x => tcs.TrySetResult(x)); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func predicate) + { + if (source == null) + throw new ArgumentNullException("source"); + if (predicate == null) + throw new ArgumentNullException("predicate"); + + return Create(() => + { + var e = source.GetEnumerator(); + var skipping = true; + var index = 0; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (skipping) + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var result = false; + try + { + result = predicate(e.Current, index++); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + if (result) + f(tcs, ct); + else + { + skipping = false; + tcs.TrySetResult(true); + } + } + else + tcs.TrySetResult(false); + }); + }); + else + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, x => tcs.TrySetResult(x)); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => e.Current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable DefaultIfEmpty(this IAsyncEnumerable source, TSource defaultValue) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var done = false; + var hasElements = false; + var e = source.GetEnumerator(); + var current = default(TSource); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (done) + tcs.TrySetResult(false); + else + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + hasElements = true; + current = e.Current; + tcs.TrySetResult(true); + } + else + { + done = true; + + if (!hasElements) + { + current = defaultValue; + tcs.TrySetResult(true); + } + else + tcs.TrySetResult(false); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable DefaultIfEmpty(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.DefaultIfEmpty(default(TSource)); + } + + public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Defer(() => + { + var set = new HashSet(comparer); + return source.Where(set.Add); + }); + } + + public static IAsyncEnumerable Distinct(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Distinct(EqualityComparer.Default); + } + + public static IAsyncEnumerable Reverse(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var e = source.GetEnumerator(); + var stack = default(Stack); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + return Create( + (ct, tcs) => + { + if (stack == null) + { + Create(() => e).Aggregate(new Stack(), (s, x) => { s.Push(x); return s; }, cts.Token).ContinueWith(t => + { + t.Handle(tcs, res => + { + stack = res; + tcs.TrySetResult(stack.Count > 0); + }); + }, cts.Token); + } + else + { + stack.Pop(); + tcs.TrySetResult(stack.Count > 0); + } + + return tcs.Task.UsingEnumerator(e); + }, + () => stack.Peek(), + d.Dispose + ); + }); + } + + public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return new OrderedAsyncEnumerable( + Create(() => + { + var current = default(IEnumerable); + + return Create( + ct => + { + var tcs = new TaskCompletionSource(); + if (current == null) + { + source.ToList(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + current = res; + tcs.TrySetResult(true); + }); + }); + } + else + tcs.TrySetResult(false); + return tcs.Task; + }, + () => current, + () => { } + ); + }), + keySelector, + comparer + ); + } + + public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.OrderBy(keySelector, Comparer.Default); + } + + public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.OrderBy(keySelector, new ReverseComparer(comparer)); + } + + public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.OrderByDescending(keySelector, Comparer.Default); + } + + public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.ThenBy(keySelector, Comparer.Default); + } + + public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.CreateOrderedEnumerable(keySelector, comparer, false); + } + + public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.ThenByDescending(keySelector, Comparer.Default); + } + + public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.CreateOrderedEnumerable(keySelector, comparer, true); + } + + static IEnumerable> GroupUntil(this IEnumerable source, Func keySelector, Func elementSelector, IComparer comparer) + { + var group = default(EnumerableGrouping); + foreach (var x in source) + { + var key = keySelector(x); + if (group == null || comparer.Compare(group.Key, key) != 0) + { + group = new EnumerableGrouping(key); + yield return group; + } + group.Add(elementSelector(x)); + } + } + + class OrderedAsyncEnumerable : IOrderedAsyncEnumerable + { + private readonly IAsyncEnumerable> equivalenceClasses; + private readonly Func keySelector; + private readonly IComparer comparer; + + public OrderedAsyncEnumerable(IAsyncEnumerable> equivalenceClasses, Func keySelector, IComparer comparer) + { + this.equivalenceClasses = equivalenceClasses; + this.keySelector = keySelector; + this.comparer = comparer; + } + + public IOrderedAsyncEnumerable CreateOrderedEnumerable(Func keySelector, IComparer comparer, bool descending) + { + if (descending) + comparer = new ReverseComparer(comparer); + + return new OrderedAsyncEnumerable(Classes(), keySelector, comparer); + } + + IAsyncEnumerable> Classes() + { + return Create(() => + { + var e = equivalenceClasses.GetEnumerator(); + var list = new List>(); + var e1 = default(IEnumerator>); + + var cts = new CancellationTokenDisposable(); + var d1 = new AssignableDisposable(); + var d = new CompositeDisposable(cts, e, d1); + + var f = default(Action, CancellationToken>); + var g = default(Action, CancellationToken>); + + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + foreach (var group in e.Current.OrderBy(keySelector, comparer).GroupUntil(keySelector, x => x, comparer)) + list.Add(group); + f(tcs, ct); + } + catch (Exception exception) + { + tcs.TrySetException(exception); + return; + } + } + else + { + e.Dispose(); + + e1 = list.GetEnumerator(); + d1.Disposable = e1; + + g(tcs, ct); + } + }); + }); + }; + + g = (tcs, ct) => + { + var res = false; + try + { + res = e1.MoveNext(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + tcs.TrySetResult(res); + }; + + return Create( + (ct, tcs) => + { + if (e1 != null) + { + g(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e1); + } + else + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + } + }, + () => e1.Current, + d.Dispose + ); + }); + } + + public IAsyncEnumerator GetEnumerator() + { + return Classes().SelectMany(x => x.ToAsyncEnumerable()).GetEnumerator(); + } + } + + class ReverseComparer : IComparer + { + IComparer comparer; + + public ReverseComparer(IComparer comparer) + { + this.comparer = comparer; + } + + public int Compare(T x, T y) + { + return -comparer.Compare(x, y); + } + } + + public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Create(() => + { + var gate = new object(); + + var e = source.GetEnumerator(); + var count = 1; + + var map = new Dictionary>(comparer); + var list = new List>(); + + var index = 0; + + var current = default(IAsyncGrouping); + var faulted = default(Exception); + + var task = default(Task); + + var cts = new CancellationTokenDisposable(); + var refCount = new Disposable( + () => + { + if (Interlocked.Decrement(ref count) == 0) + e.Dispose(); + } + ); + var d = new CompositeDisposable(cts, refCount); + + var iterateSource = default(Func>); + iterateSource = ct => + { + var tcs = default(TaskCompletionSource); + lock (gate) + { + if (task != null) + { + return task; + } + else + { + tcs = new TaskCompletionSource(); + task = tcs.Task.UsingEnumerator(e); + } + } + + if (faulted != null) + { + tcs.TrySetException(faulted); + return task; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, + res => + { + if (res) + { + var key = default(TKey); + var element = default(TElement); + + var cur = e.Current; + try + { + key = keySelector(cur); + element = elementSelector(cur); + } + catch (Exception exception) + { + foreach (var v in map.Values) + v.Error(exception); + + tcs.TrySetException(exception); + return; + } + + var group = default(Grouping); + if (!map.TryGetValue(key, out group)) + { + group = new Grouping(key, iterateSource, refCount); + map.Add(key, group); + lock (list) + list.Add(group); + + Interlocked.Increment(ref count); + } + group.Add(element); + } + + tcs.TrySetResult(res); + }, + ex => + { + foreach (var v in map.Values) + v.Error(ex); + + faulted = ex; + tcs.TrySetException(ex); + } + ); + + lock (gate) + { + task = null; + } + }); + + return tcs.Task.UsingEnumerator(e); + }; + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + iterateSource(ct).ContinueWith(t => + { + t.Handle(tcs, + res => + { + current = null; + lock (list) + { + if (index < list.Count) + current = list[index++]; + } + + if (current != null) + { + tcs.TrySetResult(true); + } + else + { + if (res) + f(tcs, ct); + else + tcs.TrySetResult(false); + } + } + ); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task; + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + + return source.GroupBy(keySelector, elementSelector, EqualityComparer.Default); + } + + public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.GroupBy(keySelector, x => x, comparer); + } + + public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.GroupBy(keySelector, x => x, EqualityComparer.Default); + } + + public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.GroupBy(keySelector, elementSelector, comparer).Select(g => resultSelector(g.Key, g)); + } + + public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (elementSelector == null) + throw new ArgumentNullException("elementSelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return source.GroupBy(keySelector, elementSelector, EqualityComparer.Default).Select(g => resultSelector(g.Key, g)); + } + + public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func, TResult> resultSelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.GroupBy(keySelector, x => x, comparer).Select(g => resultSelector(g.Key, g)); + } + + public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func, TResult> resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return source.GroupBy(keySelector, x => x, EqualityComparer.Default).Select(g => resultSelector(g.Key, g)); + } + + class Grouping : IAsyncGrouping + { + private readonly Func> iterateSource; + private readonly IDisposable sourceDisposable; + private readonly List elements = new List(); + private bool done = false; + private Exception exception = null; + + public Grouping(TKey key, Func> iterateSource, IDisposable sourceDisposable) + { + this.iterateSource = iterateSource; + this.sourceDisposable = sourceDisposable; + Key = key; + } + + public TKey Key + { + get; + private set; + } + + public void Add(TElement element) + { + lock (elements) + elements.Add(element); + } + + public void Error(Exception exception) + { + done = true; + this.exception = exception; + } + + public IAsyncEnumerator GetEnumerator() + { + var index = -1; + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, sourceDisposable); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + var size = 0; + lock (elements) + size = elements.Count; + + if (index < size) + { + tcs.TrySetResult(true); + } + else if (done) + { + if (exception != null) + tcs.TrySetException(exception); + else + tcs.TrySetResult(false); + } + else + { + iterateSource(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + f(tcs, ct); + else + tcs.TrySetResult(false); + }); + }); + } + }; + + return Create( + (ct, tcs) => + { + ++index; + f(tcs, cts.Token); + return tcs.Task; + }, + () => elements[index], + d.Dispose + ); + } + } + + #region Ix + + public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + + return DoHelper(source, onNext, _ => { }, () => { }); + } + + public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return DoHelper(source, onNext, _ => { }, onCompleted); + } + + public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + + return DoHelper(source, onNext, onError, () => { }); + } + + public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError, Action onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return DoHelper(source, onNext, onError, onCompleted); + } + +#if !NO_RXINTERFACES + public static IAsyncEnumerable Do(this IAsyncEnumerable source, IObserver observer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (observer == null) + throw new ArgumentNullException("observer"); + + return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted); + } +#endif + + private static IAsyncEnumerable DoHelper(this IAsyncEnumerable source, Action onNext, Action onError, Action onCompleted) + { + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + if (!t.IsCanceled) + { + try + { + if (t.IsFaulted) + { + onError(t.Exception); + } + else if (!t.Result) + { + onCompleted(); + } + else + { + current = e.Current; + onNext(current); + } + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + } + + t.Handle(tcs, res => + { + tcs.TrySetResult(res); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static void ForEach(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + source.ForEachAsync(action, cancellationToken).Wait(cancellationToken); + } + + public static Task ForEachAsync(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + return source.ForEachAsync((x, i) => action(x), cancellationToken); + } + + public static void ForEach(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + source.ForEachAsync(action, cancellationToken).Wait(cancellationToken); + } + + public static Task ForEachAsync(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) + { + if (source == null) + throw new ArgumentNullException("source"); + if (action == null) + throw new ArgumentNullException("action"); + + var tcs = new TaskCompletionSource(); + + var e = source.GetEnumerator(); + + var i = 0; + + var f = default(Action); + f = ct => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + try + { + action(e.Current, i++); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + f(ct); + } + else + tcs.TrySetResult(true); + }); + }); + }; + + f(cancellationToken); + + return tcs.Task.UsingEnumerator(e); + } + + public static IAsyncEnumerable Repeat(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Create(() => + { + var e = default(IAsyncEnumerator); + var a = new AssignableDisposable(); + var n = count; + var current = default(TSource); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, a); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + if (n-- == 0) + { + tcs.TrySetResult(false); + return; + } + + try + { + e = source.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + a.Disposable = e; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + current = e.Current; + tcs.TrySetResult(true); + } + else + { + e = null; + f(tcs, ct); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(d); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Repeat(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var e = default(IAsyncEnumerator); + var a = new AssignableDisposable(); + var current = default(TSource); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, a); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + try + { + e = source.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + a.Disposable = e; + } + + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + current = e.Current; + tcs.TrySetResult(true); + } + else + { + e = null; + f(tcs, ct); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(d); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable IgnoreElements(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (!res) + { + tcs.TrySetResult(false); + return; + } + + f(tcs, ct); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => { throw new InvalidOperationException(); }, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable StartWith(this IAsyncEnumerable source, params TSource[] values) + { + if (source == null) + throw new ArgumentNullException("source"); + + return values.ToAsyncEnumerable().Concat(source); + } + + public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count <= 0) + throw new ArgumentOutOfRangeException("count"); + + return source.Buffer_(count, count); + } + + public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count, int skip) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count <= 0) + throw new ArgumentOutOfRangeException("count"); + if (skip <= 0) + throw new ArgumentOutOfRangeException("skip"); + + return source.Buffer_(count, skip); + } + + private static IAsyncEnumerable> Buffer_(this IAsyncEnumerable source, int count, int skip) + { + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var buffers = new Queue>(); + + var i = 0; + + var current = default(IList); + var stopped = false; + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (!stopped) + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var item = e.Current; + + if (i++ % skip == 0) + buffers.Enqueue(new List(count)); + + foreach (var buffer in buffers) + buffer.Add(item); + + if (buffers.Count > 0 && buffers.Peek().Count == count) + { + current = buffers.Dequeue(); + tcs.TrySetResult(true); + return; + } + + f(tcs, ct); + } + else + { + stopped = true; + e.Dispose(); + + f(tcs, ct); + } + }); + }); + } + else + { + if (buffers.Count > 0) + { + current = buffers.Dequeue(); + tcs.TrySetResult(true); + } + else + { + tcs.TrySetResult(false); + } + } + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return Defer(() => + { + var set = new HashSet(comparer); + return source.Where(item => set.Add(keySelector(item))); + }); + } + + public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Distinct(keySelector, EqualityComparer.Default); + } + + public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.DistinctUntilChanged_(x => x, EqualityComparer.Default); + } + + public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.DistinctUntilChanged_(x => x, comparer); + } + + public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.DistinctUntilChanged_(keySelector, EqualityComparer.Default); + } + + public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.DistinctUntilChanged_(keySelector, comparer); + } + + private static IAsyncEnumerable DistinctUntilChanged_(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) + { + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var currentKey = default(TKey); + var hasCurrentKey = false; + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var item = e.Current; + var key = default(TKey); + var comparerEquals = false; + + try + { + key = keySelector(item); + + if (hasCurrentKey) + { + comparerEquals = comparer.Equals(currentKey, key); + } + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + if (!hasCurrentKey || !comparerEquals) + { + hasCurrentKey = true; + currentKey = key; + + current = item; + tcs.TrySetResult(true); + } + else + { + f(tcs, ct); + } + } + else + { + tcs.TrySetResult(false); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Expand(this IAsyncEnumerable source, Func> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => + { + var e = default(IAsyncEnumerator); + + var cts = new CancellationTokenDisposable(); + var a = new AssignableDisposable(); + var d = new CompositeDisposable(cts, a); + + var queue = new Queue>(); + queue.Enqueue(source); + + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (e == null) + { + if (queue.Count > 0) + { + var src = queue.Dequeue(); + + try + { + e = src.GetEnumerator(); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + a.Disposable = e; + f(tcs, ct); + } + else + { + tcs.TrySetResult(false); + } + } + else + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var item = e.Current; + + var next = default(IAsyncEnumerable); + try + { + next = selector(item); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + queue.Enqueue(next); + current = item; + tcs.TrySetResult(true); + } + else + { + e = null; + f(tcs, ct); + } + }); + }); + } + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(a); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Scan(this IAsyncEnumerable source, TAccumulate seed, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var acc = seed; + var current = default(TAccumulate); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (!res) + { + tcs.TrySetResult(false); + return; + } + + var item = e.Current; + try + { + acc = accumulator(acc, item); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + current = acc; + tcs.TrySetResult(true); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable Scan(this IAsyncEnumerable source, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var hasSeed = false; + var acc = default(TSource); + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (!res) + { + tcs.TrySetResult(false); + return; + } + + var item = e.Current; + + if (!hasSeed) + { + hasSeed = true; + acc = item; + f(tcs, ct); + return; + } + + try + { + acc = accumulator(acc, item); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + current = acc; + tcs.TrySetResult(true); + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable TakeLast(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var q = new Queue(count); + var done = false; + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + if (!done) + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var item = e.Current; + + if (q.Count >= count) + q.Dequeue(); + q.Enqueue(item); + } + else + { + done = true; + e.Dispose(); + } + + f(tcs, ct); + }); + }); + } + else + { + if (q.Count > 0) + { + current = q.Dequeue(); + tcs.TrySetResult(true); + } + else + { + tcs.TrySetResult(false); + } + } + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + public static IAsyncEnumerable SkipLast(this IAsyncEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Create(() => + { + var e = source.GetEnumerator(); + + var cts = new CancellationTokenDisposable(); + var d = new CompositeDisposable(cts, e); + + var q = new Queue(); + var current = default(TSource); + + var f = default(Action, CancellationToken>); + f = (tcs, ct) => + { + e.MoveNext(ct).ContinueWith(t => + { + t.Handle(tcs, res => + { + if (res) + { + var item = e.Current; + + q.Enqueue(item); + if (q.Count > count) + { + current = q.Dequeue(); + tcs.TrySetResult(true); + } + else + { + f(tcs, ct); + } + } + else + { + tcs.TrySetResult(false); + } + }); + }); + }; + + return Create( + (ct, tcs) => + { + f(tcs, cts.Token); + return tcs.Task.UsingEnumerator(e); + }, + () => current, + d.Dispose + ); + }); + } + + #endregion + } +} diff --git a/Ix/System.Interactive.Async/AsyncEnumerator.cs b/Ix/System.Interactive.Async/AsyncEnumerator.cs new file mode 100644 index 0000000..003141f --- /dev/null +++ b/Ix/System.Interactive.Async/AsyncEnumerator.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Collections.Generic +{ + public static class AsyncEnumerator + { + /// + /// Advances the enumerator to the next element in the sequence, returning the result asynchronously. + /// + /// + /// Task containing the result of the operation: true if the enumerator was successfully advanced + /// to the next element; false if the enumerator has passed the end of the sequence. + /// + public static Task MoveNext(this IAsyncEnumerator enumerator) + { + if (enumerator == null) + throw new ArgumentNullException("enumerator"); + + return enumerator.MoveNext(CancellationToken.None); + } + } +} diff --git a/Ix/System.Interactive.Async/Disposables.cs b/Ix/System.Interactive.Async/Disposables.cs new file mode 100644 index 0000000..05d5554 --- /dev/null +++ b/Ix/System.Interactive.Async/Disposables.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Threading; + +namespace System.Linq +{ + class CancellationTokenDisposable : IDisposable + { + private CancellationTokenSource cts = new CancellationTokenSource(); + + public CancellationToken Token { get { return cts.Token; } } + + public void Dispose() + { + if (!cts.IsCancellationRequested) + cts.Cancel(); + } + } + + class CompositeDisposable : IDisposable + { + private readonly IDisposable[] _dispose; + + public CompositeDisposable(params IDisposable[] dispose) + { + _dispose = dispose; + } + + public void Dispose() + { + foreach (var d in _dispose) + d.Dispose(); + } + } + + class AssignableDisposable : IDisposable + { + private object _gate = new object(); + private IDisposable _disposable; + private bool _disposed; + + public IDisposable Disposable + { + set + { + lock (_gate) + { + if (_disposable != null) + _disposable.Dispose(); + + _disposable = value; + + if (_disposed) + _disposable.Dispose(); + } + } + } + + public void Dispose() + { + lock (_gate) + { + if (!_disposed) + { + _disposed = true; + + if (_disposable != null) + _disposable.Dispose(); + } + } + } + } + + class Disposable : IDisposable + { + private readonly Action _dispose; + + public Disposable(Action dispose) + { + _dispose = dispose; + } + + public void Dispose() + { + _dispose(); + } + } +} diff --git a/Ix/System.Interactive.Async/EnumerableGrouping.cs b/Ix/System.Interactive.Async/EnumerableGrouping.cs new file mode 100644 index 0000000..69469c8 --- /dev/null +++ b/Ix/System.Interactive.Async/EnumerableGrouping.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; + +namespace System.Linq +{ + class EnumerableGrouping : IGrouping + { + List elements = new List(); + + public EnumerableGrouping(TKey key) + { + Key = key; + } + + public void Add(TElement element) + { + elements.Add(element); + } + + public TKey Key { get; private set; } + + public IEnumerator GetEnumerator() + { + return elements.GetEnumerator(); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + } +} diff --git a/Ix/System.Interactive.Async/IAsyncEnumerable.cs b/Ix/System.Interactive.Async/IAsyncEnumerable.cs new file mode 100644 index 0000000..8d892e1 --- /dev/null +++ b/Ix/System.Interactive.Async/IAsyncEnumerable.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; + +namespace System.Collections.Generic +{ + /// + /// Asynchronous version of the IEnumerable<T> interface, allowing elements of the + /// enumerable sequence to be retrieved asynchronously. + /// + /// Element type. + public interface IAsyncEnumerable< +#if DESKTOPCLR40 || SILVERLIGHT4 + out +#endif + T> + { + /// + /// Gets an asynchronous enumerator over the sequence. + /// + /// Enumerator for asynchronous enumeration over the sequence. + IAsyncEnumerator GetEnumerator(); + } +} diff --git a/Ix/System.Interactive.Async/IAsyncEnumerator.cs b/Ix/System.Interactive.Async/IAsyncEnumerator.cs new file mode 100644 index 0000000..72cfdbc --- /dev/null +++ b/Ix/System.Interactive.Async/IAsyncEnumerator.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Collections.Generic +{ + /// + /// Asynchronous version of the IEnumerator<T> interface, allowing elements to be + /// retrieved asynchronously. + /// + /// Element type. + public interface IAsyncEnumerator< +#if DESKTOPCLR40 || SILVERLIGHT4 + out +#endif + T> : IDisposable + { + /// + /// Advances the enumerator to the next element in the sequence, returning the result asynchronously. + /// + /// Cancellation token that can be used to cancel the operation. + /// + /// Task containing the result of the operation: true if the enumerator was successfully advanced + /// to the next element; false if the enumerator has passed the end of the sequence. + /// + Task MoveNext(CancellationToken cancellationToken); + + /// + /// Gets the current element in the iteration. + /// + T Current { get; } + } +} diff --git a/Ix/System.Interactive.Async/IAsyncGrouping.cs b/Ix/System.Interactive.Async/IAsyncGrouping.cs new file mode 100644 index 0000000..61abc60 --- /dev/null +++ b/Ix/System.Interactive.Async/IAsyncGrouping.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; + +namespace System.Linq +{ + public interface IAsyncGrouping< +#if DESKTOPCLR4 || SILVERLIGHT4 + out +#endif + TKey, +#if DESKTOPCLR4 || SILVERLIGHT4 + out +#endif + TElement> : IAsyncEnumerable + { + TKey Key { get; } + } +} diff --git a/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs b/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs new file mode 100644 index 0000000..a1e430d --- /dev/null +++ b/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; + +namespace System.Linq +{ + public interface IOrderedAsyncEnumerable< +#if DESKTOPCLR4 || SILVERLIGHT4 + out +#endif + TElement> : IAsyncEnumerable + { + IOrderedAsyncEnumerable CreateOrderedEnumerable(Func keySelector, IComparer comparer, bool descending); + } +} diff --git a/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs b/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b887de0 --- /dev/null +++ b/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: AssemblyTitle("System.Interactive.Async")] +// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet +[assembly: AssemblyDescription("Interactive Extensions Async Library used to express queries over asynchronous enumerable sequences.")] +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Retail")] +#endif +[assembly: AssemblyCompany("Microsoft Corporation")] +#if STABLE +[assembly: AssemblyProduct("Interactive Extensions")] +#else +[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] +#endif +[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] +[assembly: NeutralResourcesLanguage("en-US")] + +#if !PLIB +[assembly: ComVisible(false)] +#endif + +[assembly: CLSCompliant(true)] + +#if DESKTOPCLR && NO_CODECOVERAGE +[assembly: AllowPartiallyTrustedCallers] +#endif + +// +// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows +// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. +// diff --git a/Ix/System.Interactive.Async/System.Interactive.Async.csproj b/Ix/System.Interactive.Async/System.Interactive.Async.csproj new file mode 100644 index 0000000..b8143b2 --- /dev/null +++ b/Ix/System.Interactive.Async/System.Interactive.Async.csproj @@ -0,0 +1,47 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {7269A578-326A-4C3E-9874-A2D2600095BC} + Library + Properties + System.Interactive.Async + System.Interactive.Async + v4.0 + 512 + + + + $(OutputPath)\$(AssemblyName).XML + + + Profile1 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix/System.Interactive.Async/TaskExt.cs b/Ix/System.Interactive.Async/TaskExt.cs new file mode 100644 index 0000000..5f714ad --- /dev/null +++ b/Ix/System.Interactive.Async/TaskExt.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; + +namespace System.Threading.Tasks +{ + static class TaskExt + { + public static Task Return(T value, CancellationToken cancellationToken) + { + var tcs = new TaskCompletionSource(); + tcs.TrySetResult(value); + return tcs.Task; + } + + public static Task Throw(Exception exception, CancellationToken cancellationToken) + { + var tcs = new TaskCompletionSource(); + tcs.TrySetException(exception); + return tcs.Task; + } + + public static void Handle(this Task task, TaskCompletionSource tcs, Action success) + { + Handle(task, tcs, success, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + } + + public static void Handle(this Task task, TaskCompletionSource tcs, Action success, Action error) + { + Handle(task, tcs, success, error, () => tcs.TrySetCanceled()); + } + + public static void Handle(this Task task, TaskCompletionSource tcs, Action success, Action error, Action canceled) + { + if (task.IsFaulted) + error(task.Exception); + else if (task.IsCanceled) + canceled(); + else if (task.IsCompleted) + success(task.Result); + } + + public static Task UsingEnumerator(this Task task, IDisposable disposable) + { + task.ContinueWith(t => + { + if (t.IsFaulted) + { + var ignored = t.Exception; // don't remove! + } + + if (t.IsFaulted || t.IsCanceled || !t.Result) + disposable.Dispose(); + }, TaskContinuationOptions.ExecuteSynchronously); + + return task; + } + + public static Task UsingEnumeratorSync(this Task task, IDisposable disposable) + { + var tcs = new TaskCompletionSource(); + + task.ContinueWith(t => + { + if (t.IsFaulted || t.IsCanceled || !t.Result) + disposable.Dispose(); // TODO: Check whether we need exception handling here! + + t.Handle(tcs, res => tcs.TrySetResult(res)); + }, TaskContinuationOptions.ExecuteSynchronously); + + return tcs.Task; + } + + public static Task Finally(this Task task, Action action) + { + task.ContinueWith(t => + { + if (t.IsFaulted) + { + var ignored = t.Exception; // don't remove! + } + + action(); + }, TaskContinuationOptions.ExecuteSynchronously); + + return task; + } + + public static Task Zip(this Task t1, Task t2, Func f) + { + var gate = new object(); + var tcs = new TaskCompletionSource(); + + var i = 2; + var complete = new Action(t => + { + if (Interlocked.Decrement(ref i) == 0) + { + var exs = new List(); + if (t1.IsFaulted) + exs.Add(t1.Exception); + if (t2.IsFaulted) + exs.Add(t2.Exception); + + if (exs.Count > 0) + tcs.TrySetException(exs); + else if (t1.IsCanceled || t2.IsCanceled) + tcs.TrySetCanceled(); + else + { + var res = default(V); + try + { + res = f(t1.Result, t2.Result); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + return; + } + + tcs.TrySetResult(res); + } + } + }); + + t1.ContinueWith(complete); + t2.ContinueWith(complete); + + return tcs.Task; + } + } +} diff --git a/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs b/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..03b49a8 --- /dev/null +++ b/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: AssemblyTitle("System.Interactive.Providers")] +// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet +[assembly: AssemblyDescription("Interactive Extensions Providers Library used to build query providers and express queries over enumerable sequences.")] +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Retail")] +#endif +[assembly: AssemblyCompany("Microsoft Corporation")] +#if STABLE +[assembly: AssemblyProduct("Interactive Extensions")] +#else +[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] +#endif +[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] +[assembly: NeutralResourcesLanguage("en-US")] + +#if !PLIB +[assembly: ComVisible(false)] +#endif + +[assembly: CLSCompliant(true)] + +#if DESKTOPCLR && NO_CODECOVERAGE +[assembly: AllowPartiallyTrustedCallers] +#endif + +// +// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows +// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. +// diff --git a/Ix/System.Interactive.Providers/QueryableEx.cs b/Ix/System.Interactive.Providers/QueryableEx.cs new file mode 100644 index 0000000..20f7ec8 --- /dev/null +++ b/Ix/System.Interactive.Providers/QueryableEx.cs @@ -0,0 +1,2327 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq.Expressions; +using System.Reflection; + +namespace System.Linq +{ + /// + /// Provides a set of additional static methods that allow querying enumerable sequences. + /// + public static class QueryableEx + { + /// + /// Determines whether an enumerable sequence is empty. + /// + /// Source sequence element type. + /// Source sequence. + /// true if the sequence is empty; false otherwise. + public static bool IsEmpty(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.Execute( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static bool IsEmpty(IEnumerable source) + { + return EnumerableEx.IsEmpty(source); + } +#pragma warning restore 1591 + + /// + /// Returns the minimum value in the enumerable sequence by using the specified comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to determine the minimum value. + /// Minimum value in the sequence. + public static TSource Min(this IQueryable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.Execute( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(comparer, typeof(IComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static TSource Min(IEnumerable source, IComparer comparer) + { + return EnumerableEx.Min(source, comparer); + } +#pragma warning restore 1591 + + /// + /// Returns the elements with the minimum key value by using the default comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// List with the elements that share the same minimum key value. + public static IList MinBy(this IQueryable source, Expression> keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Provider.Execute>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IList MinBy(IEnumerable source, Func keySelector) + { + return EnumerableEx.MinBy(source, keySelector); + } +#pragma warning restore 1591 + + /// + /// Returns the elements with the minimum key value by using the specified comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// Comparer used to determine the minimum key value. + /// List with the elements that share the same minimum key value. + public static IList MinBy(this IQueryable source, Expression> keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.Execute>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector, + Expression.Constant(comparer, typeof(IComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IList MinBy(IEnumerable source, Func keySelector, IComparer comparer) + { + return EnumerableEx.MinBy(source, keySelector, comparer); + } +#pragma warning restore 1591 + + /// + /// Returns the maximum value in the enumerable sequence by using the specified comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to determine the maximum value. + /// Maximum value in the sequence. + public static TSource Max(this IQueryable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.Execute( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(comparer, typeof(IComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static TSource Max(IEnumerable source, IComparer comparer) + { + return EnumerableEx.Max(source, comparer); + } +#pragma warning restore 1591 + + /// + /// Returns the elements with the maximum key value by using the default comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// List with the elements that share the same maximum key value. + public static IList MaxBy(this IQueryable source, Expression> keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Provider.Execute>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IList MaxBy(IEnumerable source, Func keySelector) + { + return EnumerableEx.MaxBy(source, keySelector); + } +#pragma warning restore 1591 + + /// + /// Returns the elements with the minimum key value by using the specified comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// Comparer used to determine the maximum key value. + /// List with the elements that share the same maximum key value. + public static IList MaxBy(this IQueryable source, Expression> keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.Execute>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector, + Expression.Constant(comparer, typeof(IComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IList MaxBy(IEnumerable source, Func keySelector, IComparer comparer) + { + return EnumerableEx.MaxBy(source, keySelector, comparer); + } +#pragma warning restore 1591 + + /// + /// Shares the source sequence within a selector function where each enumerator can fetch the next element from the source sequence. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with shared access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the shared view over the source sequence. + public static IQueryable Share(this IQueryable source, Expression, IEnumerable>> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + source.Expression, + selector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Share(IEnumerable source, Func, IEnumerable> selector) + { + return EnumerableEx.Share(source, selector); + } +#pragma warning restore 1591 + + /// + /// Publishes the source sequence within a selector function where each enumerator can obtain a view over a tail of the source sequence. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with published access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the published view over the source sequence. + public static IQueryable Publish(this IQueryable source, Expression, IEnumerable>> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + source.Expression, + selector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Publish(IEnumerable source, Func, IEnumerable> selector) + { + return EnumerableEx.Publish(source, selector); + } +#pragma warning restore 1591 + + /// + /// Memoizes the source sequence within a selector function where each enumerator can get access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with memoized access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the memoized view over the source sequence. + public static IQueryable Memoize(this IQueryable source, Expression, IEnumerable>> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + source.Expression, + selector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Memoize(IEnumerable source, Func, IEnumerable> selector) + { + return EnumerableEx.Memoize(source, selector); + } +#pragma warning restore 1591 + + /// + /// Memoizes the source sequence within a selector function where a specified number of enumerators can get access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. + /// Selector function with memoized access to the source sequence for a specified number of enumerators. + /// Sequence resulting from applying the selector function to the memoized view over the source sequence. + public static IQueryable Memoize(this IQueryable source, int readerCount, Expression, IEnumerable>> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + source.Expression, + Expression.Constant(readerCount, typeof(int)), + selector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Memoize(IEnumerable source, int readerCount, Func, IEnumerable> selector) + { + return EnumerableEx.Memoize(source, readerCount, selector); + } +#pragma warning restore 1591 + + /// + /// Creates an enumerable sequence based on an enumerator factory function. + /// + /// Result sequence element type. + /// Query provider. + /// Enumerator factory function. + /// Sequence that will invoke the enumerator factory upon a call to GetEnumerator. + public static IQueryable Create(this IQueryProvider provider, Expression>> getEnumerator) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (getEnumerator == null) + throw new ArgumentNullException("getEnumerator"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + getEnumerator + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Create(Func> getEnumerator) + { + return EnumerableEx.Create(getEnumerator); + } +#pragma warning restore 1591 + + /// + /// Returns a sequence with a single element. + /// + /// Result sequence element type. + /// Query provider. + /// Single element of the resulting sequence. + /// Sequence with a single element. + public static IQueryable Return(this IQueryProvider provider, TResult value) + { + if (provider == null) + throw new ArgumentNullException("provider"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(value, typeof(TResult)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Return(TResult value) + { + return EnumerableEx.Return(value).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Returns a sequence that throws an exception upon enumeration. + /// + /// Result sequence element type. + /// Query provider. + /// Exception to throw upon enumerating the resulting sequence. + /// Sequence that throws the specified exception upon enumeration. + public static IQueryable Throw(this IQueryProvider provider, Exception exception) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (exception == null) + throw new ArgumentNullException("exception"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(exception, typeof(Exception)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Throw(Exception exception) + { + return EnumerableEx.Throw(exception).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Creates an enumerable sequence based on an enumerable factory function. + /// + /// Result sequence element type. + /// Query provider. + /// Enumerable factory function. + /// Sequence that will invoke the enumerable factory upon a call to GetEnumerator. + public static IQueryable Defer(this IQueryProvider provider, Expression>> enumerableFactory) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (enumerableFactory == null) + throw new ArgumentNullException("enumerableFactory"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + enumerableFactory + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Defer(Func> enumerableFactory) + { + return EnumerableEx.Defer(enumerableFactory).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence by mimicking a for loop. + /// + /// State type. + /// Result sequence element type. + /// Query provider. + /// Initial state of the generator loop. + /// Loop condition. + /// State update function to run after every iteration of the generator loop. + /// Result selector to compute resulting sequence elements. + /// Sequence obtained by running the generator loop, yielding computed elements. + public static IQueryable Generate(this IQueryProvider provider, TState initialState, Expression> condition, Expression> iterate, Expression> resultSelector) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (condition == null) + throw new ArgumentNullException("condition"); + if (iterate == null) + throw new ArgumentNullException("iterate"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(initialState), + condition, + iterate, + resultSelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) + { + return EnumerableEx.Generate(initialState, condition, iterate, resultSelector).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence that's dependent on a resource object whose lifetime is determined by the sequence usage duration. + /// + /// Source element type. + /// Resource type. + /// Query provider. + /// Resource factory function. + /// Enumerable factory function, having access to the obtained resource. + /// Sequence whose use controls the lifetime of the associated obtained resource. + public static IQueryable Using(this IQueryProvider provider, Expression> resourceFactory, Expression>> enumerableFactory) where TResource : IDisposable + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (resourceFactory == null) + throw new ArgumentNullException("resourceFactory"); + if (enumerableFactory == null) + throw new ArgumentNullException("enumerableFactory"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResource)), + Expression.Constant(provider, typeof(IQueryProvider)), + resourceFactory, + enumerableFactory + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable + { + return EnumerableEx.Using(resourceFactory, enumerableFactory).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence by repeating the given value infinitely. + /// + /// Result sequence element type. + /// Query provider. + /// Value to repreat in the resulting sequence. + /// Sequence repeating the given value infinitely. + public static IEnumerable Repeat(this IQueryProvider provider, TResult value) + { + if (provider == null) + throw new ArgumentNullException("provider"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(value, typeof(TResult)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Repeat(TResult value) + { + return EnumerableEx.Repeat(value).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that corresponds to the source sequence, concatenating it with the sequence resulting from calling an exception handler function in case of an error. + /// + /// Source sequence element type. + /// Exception type to catch. + /// Source sequence. + /// Handler to invoke when an exception of the specified type occurs. + /// Source sequence, concatenated with an exception handler result sequence in case of an error. + public static IQueryable Catch(this IQueryable source, Expression>> handler) + where TException : Exception + { + if (source == null) + throw new ArgumentNullException("source"); + if (handler == null) + throw new ArgumentNullException("handler"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), + source.Expression, + handler + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Catch(IEnumerable source, Func> handler) + where TException : Exception + { + return EnumerableEx.Catch(source, handler); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence that continues to concatenate source sequences while errors occur. + public static IQueryable Catch(this IQueryable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + sources.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Catch(IEnumerable> sources) + { + return EnumerableEx.Catch(sources); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. + /// + /// Source sequence element type. + /// Query provider. + /// Source sequences. + /// Sequence that continues to concatenate source sequences while errors occur. + public static IQueryable Catch(this IQueryProvider provider, params IEnumerable[] sources) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (sources == null) + throw new ArgumentNullException("sources"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + Expression.Constant(provider, typeof(IQueryProvider)), + GetSourceExpression(sources) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Catch(params IEnumerable[] sources) + { + return EnumerableEx.Catch(sources).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error. + /// + /// Source sequence element type. + /// First sequence. + /// Second sequence, concatenated to the result in case the first sequence completes exceptionally. + /// The first sequence, followed by the second sequence in case an error is produced. + public static IQueryable Catch(this IQueryable first, IEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + first.Expression, + GetSourceExpression(second) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Catch(IEnumerable first, IEnumerable second) + { + return EnumerableEx.Catch(first, second); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence whose termination or disposal of an enumerator causes a finally action to be executed. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to run upon termination of the sequence, or when an enumerator is disposed. + /// Source sequence with guarantees on the invocation of the finally action. + public static IQueryable Finally(this IQueryable source, Expression finallyAction) + { + if (source == null) + throw new ArgumentNullException("source"); + if (finallyAction == null) + throw new ArgumentNullException("finallyAction"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + finallyAction + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Finally(IEnumerable source, Action finallyAction) + { + return EnumerableEx.Finally(source, finallyAction); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that concatenates both given sequences, regardless of whether an error occurs. + /// + /// Source sequence element type. + /// First sequence. + /// Second sequence. + /// Sequence concatenating the elements of both sequences, ignoring errors. + public static IQueryable OnErrorResumeNext(this IQueryable first, IEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return first.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + first.Expression, + GetSourceExpression(second) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable OnErrorResumeNext(IEnumerable first, IEnumerable second) + { + return EnumerableEx.OnErrorResumeNext(first, second); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. + /// + /// Source sequence element type. + /// Query provider. + /// Source sequences. + /// Sequence concatenating the elements of the given sequences, ignoring errors. + public static IEnumerable OnErrorResumeNext(this IQueryProvider provider, params IEnumerable[] sources) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (sources == null) + throw new ArgumentNullException("sources"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + Expression.Constant(provider, typeof(IQueryProvider)), + GetSourceExpression(sources) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable OnErrorResumeNext(params IEnumerable[] sources) + { + return EnumerableEx.OnErrorResumeNext(sources).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence concatenating the elements of the given sequences, ignoring errors. + public static IQueryable OnErrorResumeNext(this IQueryable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + sources.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable OnErrorResumeNext(IEnumerable> sources) + { + return EnumerableEx.OnErrorResumeNext(sources); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that retries enumerating the source sequence as long as an error occurs. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence concatenating the results of the source sequence as long as an error occurs. + public static IQueryable Retry(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Retry(IEnumerable source) + { + return EnumerableEx.Retry(source); + } +#pragma warning restore 1591 + + /// + /// Creates a sequence that retries enumerating the source sequence as long as an error occurs, with the specified maximum number of retries. + /// + /// Source sequence element type. + /// Source sequence. + /// Maximum number of retries. + /// Sequence concatenating the results of the source sequence as long as an error occurs. + public static IQueryable Retry(this IQueryable source, int retryCount) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(retryCount, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Retry(IEnumerable source, int retryCount) + { + return EnumerableEx.Retry(source, retryCount); + } +#pragma warning restore 1591 + + /// + /// Generates an enumerable sequence by repeating a source sequence as long as the given loop condition holds. + /// + /// Result sequence element type. + /// Query provider. + /// Loop condition. + /// Sequence to repeat while the condition evaluates true. + /// Sequence generated by repeating the given sequence while the condition evaluates to true. + public static IQueryable While(this IQueryProvider provider, Expression> condition, IEnumerable source) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (condition == null) + throw new ArgumentNullException("condition"); + if (source == null) + throw new ArgumentNullException("source"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + condition, + GetSourceExpression(source) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable While(Func condition, IEnumerable source) + { + return EnumerableEx.While(condition, source).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Returns an enumerable sequence based on the evaluation result of the given condition. + /// + /// Result sequence element type. + /// Query provider. + /// Condition to evaluate. + /// Sequence to return in case the condition evaluates true. + /// Sequence to return in case the condition evaluates false. + /// Either of the two input sequences based on the result of evaluating the condition. + public static IQueryable If(this IQueryProvider provider, Expression> condition, IEnumerable thenSource, IEnumerable elseSource) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (condition == null) + throw new ArgumentNullException("condition"); + if (thenSource == null) + throw new ArgumentNullException("thenSource"); + if (elseSource == null) + throw new ArgumentNullException("elseSource"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + condition, + GetSourceExpression(thenSource), + GetSourceExpression(elseSource) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable If(Func condition, IEnumerable thenSource, IEnumerable elseSource) + { + return EnumerableEx.If(condition, thenSource, elseSource).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Returns an enumerable sequence if the evaluation result of the given condition is true, otherwise returns an empty sequence. + /// + /// Result sequence element type. + /// Query provider. + /// Condition to evaluate. + /// Sequence to return in case the condition evaluates true. + /// The given input sequence if the condition evaluates true; otherwise, an empty sequence. + public static IQueryable If(this IQueryProvider provider, Expression> condition, IEnumerable thenSource) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (condition == null) + throw new ArgumentNullException("condition"); + if (thenSource == null) + throw new ArgumentNullException("thenSource"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + condition, + GetSourceExpression(thenSource) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable If(Func condition, IEnumerable thenSource) + { + return EnumerableEx.If(condition, thenSource).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates an enumerable sequence by repeating a source sequence as long as the given loop postcondition holds. + /// + /// Result sequence element type. + /// Source sequence to repeat while the condition evaluates true. + /// Loop condition. + /// Sequence generated by repeating the given sequence until the condition evaluates to false. + public static IQueryable DoWhile(this IQueryable source, Expression> condition) + { + if (source == null) + throw new ArgumentNullException("source"); + if (condition == null) + throw new ArgumentNullException("condition"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + source.Expression, + condition + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable DoWhile(IEnumerable source, Func condition) + { + return EnumerableEx.DoWhile(source, condition); + } +#pragma warning restore 1591 + + /// + /// Returns a sequence from a dictionary based on the result of evaluating a selector function. + /// + /// Type of the selector value. + /// Result sequence element type. + /// Query provider. + /// Selector function used to pick a sequence from the given sources. + /// Dictionary mapping selector values onto resulting sequences. + /// The source sequence corresponding with the evaluated selector value; otherwise, an empty sequence. + public static IQueryable Case(this IQueryProvider provider, Expression> selector, IDictionary> sources) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (selector == null) + throw new ArgumentNullException("selector"); + if (sources == null) + throw new ArgumentNullException("sources"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)), + selector, + Expression.Constant(sources, typeof(IDictionary>)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Case(Func selector, IDictionary> sources) + { + return EnumerableEx.Case(selector, sources).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Returns a sequence from a dictionary based on the result of evaluating a selector function, also specifying a default sequence. + /// + /// Type of the selector value. + /// Result sequence element type. + /// Query provider. + /// Selector function used to pick a sequence from the given sources. + /// Dictionary mapping selector values onto resulting sequences. + /// Default sequence to return in case there's no corresponding source for the computed selector value. + /// The source sequence corresponding with the evaluated selector value; otherwise, the default source. + public static IQueryable Case(this IQueryProvider provider, Expression> selector, IDictionary> sources, IEnumerable defaultSource) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (selector == null) + throw new ArgumentNullException("selector"); + if (sources == null) + throw new ArgumentNullException("sources"); + if (defaultSource == null) + throw new ArgumentNullException("defaultSource"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)), + selector, + Expression.Constant(sources, typeof(IDictionary>)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Case(Func selector, IDictionary> sources, IEnumerable defaultSource) + { + return EnumerableEx.Case(selector, sources, defaultSource).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence by enumerating a source sequence, mapping its elements on result sequences, and concatenating those sequences. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Query provider. + /// Source sequence. + /// Result selector to evaluate for each iteration over the source. + /// Sequence concatenating the inner sequences that result from evaluating the result selector on elements from the source. + public static IQueryable For(this IQueryProvider provider, IEnumerable source, Expression>> resultSelector) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (source == null) + throw new ArgumentNullException("source"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), + GetSourceExpression(source), + resultSelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable For(IEnumerable source, Func> resultSelector) + { + return EnumerableEx.For(source, resultSelector).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Concatenates the input sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence with the elements of the source sequences concatenated. + public static IQueryable Concat(this IQueryable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + GetSourceExpression(sources) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Concat(IEnumerable> sources) + { + return EnumerableEx.Concat(sources); + } +#pragma warning restore 1591 + + /// + /// Concatenates the input sequences. + /// + /// Source sequence element type. + /// Query provider. + /// Source sequences. + /// Sequence with the elements of the source sequences concatenated. + public static IQueryable Concat(this IQueryProvider provider, params IEnumerable[] sources) + { + if (provider == null) + throw new ArgumentNullException("provider"); + if (sources == null) + throw new ArgumentNullException("sources"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + Expression.Constant(provider, typeof(IQueryProvider)), + GetSourceExpression(sources) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Concat(params IEnumerable[] sources) + { + return EnumerableEx.Concat(sources).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Projects each element of a sequence to an given sequence and flattens the resulting sequences into one sequence. + /// + /// First source sequence element type. + /// Second source sequence element type. + /// A sequence of values to project. + /// Inner sequence each source sequenec element is projected onto. + /// Sequence flattening the sequences that result from projecting elements in the source sequence. + public static IQueryable SelectMany(this IQueryable source, IEnumerable other) + { + if (source == null) + throw new ArgumentNullException("source"); + if (other == null) + throw new ArgumentNullException("other"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), + source.Expression, + GetSourceExpression(other) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable SelectMany(IEnumerable source, IEnumerable other) + { + return EnumerableEx.SelectMany(source, other); + } +#pragma warning restore 1591 + +#if NO_ZIP + /// + /// Merges two sequences by applying the specified selector function on index-based corresponding element pairs from both sequences. + /// + /// The type of the elements of the first input sequence. + /// The type of the elements of the second input sequence. + /// The type of the elements of the result sequence. + /// The first sequence to merge. + /// The second sequence to merge. + /// Function to apply to each pair of elements from both sequences. + /// Sequence consisting of the result of pairwise application of the selector function over pairs of elements from the source sequences. + public static IQueryable Zip(this IQueryable first, IEnumerable second, Expression> resultSelector) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return first.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), + first.Expression, + GetSourceExpression(second), + resultSelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Zip(IEnumerable first, IEnumerable second, Func resultSelector) + { + return EnumerableEx.Zip(first, second, resultSelector); + } +#pragma warning restore 1591 +#endif + + /// + /// Hides the enumerable sequence object identity. + /// + /// Source sequence element type. + /// Source sequence. + /// Enumerable sequence with the same behavior as the original, but hiding the source object identity. + /// AsQueryable doesn't hide the object identity, and simply acts as a cast to the IQueryable<TSource> interface. + public static IQueryable Hide(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Hide(IEnumerable source) + { + return EnumerableEx.Hide(source); + } +#pragma warning restore 1591 + + /// + /// Lazily invokes an action for each value in the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IQueryable Do(this IQueryable source, Expression> onNext) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + onNext + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Do(IEnumerable source, Action onNext) + { + return EnumerableEx.Do(source, onNext); + } +#pragma warning restore 1591 + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action for successful termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on successful termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IQueryable Do(this IQueryable source, Expression> onNext, Expression onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + onNext, + onCompleted + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Do(IEnumerable source, Action onNext, Action onCompleted) + { + return EnumerableEx.Do(source, onNext, onCompleted); + } +#pragma warning restore 1591 + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action upon exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on exceptional termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IQueryable Do(this IQueryable source, Expression> onNext, Expression> onError) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + onNext, + onError + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Do(IEnumerable source, Action onNext, Action onError) + { + return EnumerableEx.Do(source, onNext, onError); + } +#pragma warning restore 1591 + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action upon successful or exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on exceptional termination of the sequence. + /// Action to invoke on successful termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IQueryable Do(this IQueryable source, Expression> onNext, Expression> onError, Expression onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + onNext, + onError, + onCompleted + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Do(IEnumerable source, Action onNext, Action onError, Action onCompleted) + { + return EnumerableEx.Do(source, onNext, onError, onCompleted); + } +#pragma warning restore 1591 + +#if !NO_RXINTERFACES + /// + /// Lazily invokes observer methods for each value in the sequence, and upon successful or exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Observer to invoke notification calls on. + /// Sequence exhibiting the side-effects of observer method invocation upon enumeration. + public static IQueryable Do(this IQueryable source, IObserver observer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (observer == null) + throw new ArgumentNullException("observer"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(observer, typeof(IObserver)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Do(IEnumerable source, IObserver observer) + { + return EnumerableEx.Do(source, observer); + } +#pragma warning restore 1591 +#endif + + /// + /// Generates a sequence of non-overlapping adjacent buffers over the source sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of elements for allocated buffers. + /// Sequence of buffers containing source sequence elements. + public static IQueryable> Buffer(this IQueryable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable> Buffer(IEnumerable source, int count) + { + return EnumerableEx.Buffer(source, count); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence of buffers over the source sequence, with specified length and possible overlap. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of elements for allocated buffers. + /// Number of elements to skip between the start of consecutive buffers. + /// Sequence of buffers containing source sequence elements. + public static IQueryable> Buffer(this IQueryable source, int count, int skip) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery>( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(count, typeof(int)), + Expression.Constant(skip, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable> Buffer(IEnumerable source, int count, int skip) + { + return EnumerableEx.Buffer(source, count, skip); + } +#pragma warning restore 1591 + + /// + /// Ignores all elements in the source sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Source sequence without its elements. + public static IQueryable IgnoreElements(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable IgnoreElements(IEnumerable source) + { + return EnumerableEx.IgnoreElements(source); + } +#pragma warning restore 1591 + + /// + /// Returns elements with a distinct key value by using the default equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Sequence that contains the elements from the source sequence with distinct key values. + public static IQueryable Distinct(this IQueryable source, Expression> keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Distinct(IEnumerable source, Func keySelector) + { + return EnumerableEx.Distinct(source, keySelector); + } +#pragma warning restore 1591 + + /// + /// Returns elements with a distinct key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Comparer used to compare key values. + /// Sequence that contains the elements from the source sequence with distinct key values. + public static IQueryable Distinct(this IQueryable source, Expression> keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector, + Expression.Constant(comparer, typeof(IEqualityComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Distinct(IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + return EnumerableEx.Distinct(source, keySelector, comparer); + } +#pragma warning restore 1591 + + /// + /// Returns consecutive distinct elements by using the default equality comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence without adjacent non-distinct elements. + public static IQueryable DistinctUntilChanged(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable DistinctUntilChanged(IEnumerable source) + { + return EnumerableEx.DistinctUntilChanged(source); + } +#pragma warning restore 1591 + + /// + /// Returns consecutive distinct elements by using the specified equality comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to compare values. + /// Sequence without adjacent non-distinct elements. + public static IQueryable DistinctUntilChanged(this IQueryable source, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(comparer, typeof(IEqualityComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable DistinctUntilChanged(IEnumerable source, IEqualityComparer comparer) + { + return EnumerableEx.DistinctUntilChanged(source, comparer); + } +#pragma warning restore 1591 + + /// + /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Sequence without adjacent non-distinct elements. + public static IQueryable DistinctUntilChanged(this IQueryable source, Expression> keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable DistinctUntilChanged(IEnumerable source, Func keySelector) + { + return EnumerableEx.DistinctUntilChanged(source, keySelector); + } +#pragma warning restore 1591 + + /// + /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Comparer used to compare key values. + /// Sequence without adjacent non-distinct elements. + public static IQueryable DistinctUntilChanged(this IQueryable source, Expression> keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), + source.Expression, + keySelector, + Expression.Constant(comparer, typeof(IEqualityComparer)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable DistinctUntilChanged(IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + return EnumerableEx.DistinctUntilChanged(source, keySelector, comparer); + } +#pragma warning restore 1591 + + /// + /// Expands the sequence by recursively applying a selector function. + /// + /// Source sequence element type. + /// Source sequence. + /// Selector function to retrieve the next sequence to expand. + /// Sequence with results from the recursive expansion of the source sequence. + public static IQueryable Expand(this IQueryable source, Expression>> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + selector + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Expand(IEnumerable source, Func> selector) + { + return EnumerableEx.Expand(source, selector); + } +#pragma warning restore 1591 + + /// + /// Returns the source sequence prefixed with the specified value. + /// + /// Source sequence element type. + /// Source sequence. + /// Values to prefix the sequence with. + /// Sequence starting with the specified prefix value, followed by the source sequence. + public static IQueryable StartWith(this IQueryable source, params TSource[] values) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(values, typeof(TSource[])) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable StartWith(IEnumerable source, params TSource[] values) + { + return EnumerableEx.StartWith(source, values); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. + /// + /// Source sequence element type. + /// Accumulation type. + /// Source sequence. + /// Accumulator seed value. + /// Accumulation function to apply to the current accumulation value and each element of the sequence. + /// Sequence with all intermediate accumulation values resulting from scanning the sequence. + public static IQueryable Scan(this IQueryable source, TAccumulate seed, Expression> accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), + source.Expression, + Expression.Constant(seed, typeof(TAccumulate)), + accumulator + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Scan(IEnumerable source, TAccumulate seed, Func accumulator) + { + return EnumerableEx.Scan(source, seed, accumulator); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. + /// + /// Source sequence element type. + /// Source sequence. + /// Accumulation function to apply to the current accumulation value and each element of the sequence. + /// Sequence with all intermediate accumulation values resulting from scanning the sequence. + public static IQueryable Scan(this IQueryable source, Expression> accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + accumulator + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Scan(IEnumerable source, Func accumulator) + { + return EnumerableEx.Scan(source, accumulator); + } +#pragma warning restore 1591 + + /// + /// Returns a specified number of contiguous elements from the end of the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// The number of elements to take from the end of the sequence. + /// Sequence with the specified number of elements counting from the end of the source sequence. + public static IQueryable TakeLast(this IQueryable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable TakeLast(IEnumerable source, int count) + { + return EnumerableEx.TakeLast(source, count); + } +#pragma warning restore 1591 + + /// + /// Bypasses a specified number of contiguous elements from the end of the sequence and returns the remaining elements. + /// + /// Source sequence element type. + /// Source sequence. + /// The number of elements to skip from the end of the sequence before returning the remaining elements. + /// Sequence bypassing the specified number of elements counting from the end of the source sequence. + public static IQueryable SkipLast(this IQueryable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable SkipLast(IEnumerable source, int count) + { + return EnumerableEx.SkipLast(source, count); + } +#pragma warning restore 1591 + + /// + /// Repeats and concatenates the source sequence infinitely. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence obtained by concatenating the source sequence to itself infinitely. + public static IQueryable Repeat(this IQueryable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Repeat(IEnumerable source) + { + return EnumerableEx.Repeat(source); + } +#pragma warning restore 1591 + + /// + /// Repeats and concatenates the source sequence the given number of times. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of times to repeat the source sequence. + /// Sequence obtained by concatenating the source sequence to itself the specified number of times. + public static IQueryable Repeat(this IQueryable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), + source.Expression, + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable Repeat(IEnumerable source, int count) + { + return EnumerableEx.Repeat(source, count); + } +#pragma warning restore 1591 + + /// + /// Returns a sequence with no elements. + /// + /// Result sequence element type. + /// Query provider. + /// Sequence with no elements. + public static IQueryable Empty(this IQueryProvider provider) + { + if (provider == null) + throw new ArgumentNullException("provider"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Empty() + { + return Enumerable.Empty().AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence of integral numbers within a specified range. + /// + /// Query provider. + /// The value of the first integer in the sequence. + /// The number of sequential integers to generate. + /// Sequence that contains a range of sequential integral numbers. + public static IQueryable Range(this IQueryProvider provider, int start, int count) + { + if (provider == null) + throw new ArgumentNullException("provider"); + + return provider.CreateQuery( + Expression.Call( + null, + (MethodInfo)MethodInfo.GetCurrentMethod(), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(start, typeof(int)), + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Range(int start, int count) + { + return Enumerable.Range(start, count).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Generates a sequence that contains one repeated value. + /// + /// Result sequence element type. + /// Query provider. + /// The value to be repeated. + /// The number of times to repeat the value in the generated sequence. + /// Sequence that contains a repeated value. + public static IQueryable Repeat(this IQueryProvider provider, TResult element, int count) + { + if (provider == null) + throw new ArgumentNullException("provider"); + + return provider.CreateQuery( + Expression.Call( + null, + ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), + Expression.Constant(provider, typeof(IQueryProvider)), + Expression.Constant(element, typeof(TResult)), + Expression.Constant(count, typeof(int)) + ) + ); + } + +#pragma warning disable 1591 + [EditorBrowsable(EditorBrowsableState.Never)] + public static /*!*/IQueryable Repeat(TResult element, int count) + { + return EnumerableEx.Repeat(element, count).AsQueryable(); + } +#pragma warning restore 1591 + + /// + /// Gets the local Queryable provider. + /// + public static IQueryProvider Provider + { + get + { + return new QueryProviderShim(); + } + } + + class QueryProviderShim : IQueryProvider + { + public IQueryable CreateQuery(Expression expression) + { + var provider = new TElement[0].AsQueryable().Provider; + var res = Redir(expression); + return provider.CreateQuery(res); + } + + public IQueryable CreateQuery(Expression expression) + { + return CreateQuery(expression); + } + + public TResult Execute(Expression expression) + { + var provider = new TResult[0].AsQueryable().Provider; + var res = Redir(expression); + return provider.Execute(res); + } + + public object Execute(Expression expression) + { + return Execute(expression); + } + + private static Expression Redir(Expression expression) + { + var mce = expression as MethodCallExpression; + if (mce != null && mce.Method.DeclaringType == typeof(QueryableEx)) + { + if (mce.Arguments.Count >= 1 && typeof(IQueryProvider).IsAssignableFrom(mce.Arguments[0].Type)) + { + var ce = mce.Arguments[0] as ConstantExpression; + if (ce != null) + { + if (ce.Value is QueryProviderShim) + { + var targetType = typeof(QueryableEx); + var method = mce.Method; + var methods = GetMethods(targetType); + var arguments = mce.Arguments.Skip(1).ToList(); + + // + // From all the operators with the method's name, find the one that matches all arguments. + // + var typeArgs = method.IsGenericMethod ? method.GetGenericArguments() : null; + var targetMethod = methods[method.Name].FirstOrDefault(candidateMethod => ArgsMatch(candidateMethod, arguments, typeArgs)); + if (targetMethod == null) + throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "There is no method '{0}' on type '{1}' that matches the specified arguments", method.Name, targetType.Name)); + + // + // Restore generic arguments. + // + if (typeArgs != null) + targetMethod = targetMethod.MakeGenericMethod(typeArgs); + + // + // Finally, we need to deal with mismatches on Expression> versus Func<...>. + // + var parameters = targetMethod.GetParameters(); + for (int i = 0, n = parameters.Length; i < n; i++) + { + arguments[i] = Unquote(arguments[i]); + } + + // + // Emit a new call to the discovered target method. + // + return Expression.Call(null, targetMethod, arguments); + } + } + } + } + + return expression; + } + + private static ILookup GetMethods(Type type) + { + return type.GetMethods(BindingFlags.Static | BindingFlags.Public).ToLookup(m => m.Name); + } + + private static bool ArgsMatch(MethodInfo method, IList arguments, Type[] typeArgs) + { + // + // Number of parameters should match. Notice we've sanitized IQueryProvider "this" + // parameters first (see Redir). + // + var parameters = method.GetParameters(); + if (parameters.Length != arguments.Count) + return false; + + // + // Genericity should match too. + // + if (!method.IsGenericMethod && typeArgs != null && typeArgs.Length > 0) + return false; + + // + // Reconstruct the generic method if needed. + // + if (method.IsGenericMethodDefinition) + { + if (typeArgs == null) + return false; + + if (method.GetGenericArguments().Length != typeArgs.Length) + return false; + + var result = method.MakeGenericMethod(typeArgs); + parameters = result.GetParameters(); + } + + // + // Check compatibility for the parameter types. + // + for (int i = 0, n = arguments.Count; i < n; i++) + { + var parameterType = parameters[i].ParameterType; + var argument = arguments[i]; + + // + // For operators that take a function (like Where, Select), we'll be faced + // with a quoted argument and a discrepancy between Expression> + // and the underlying Func<...>. + // + if (!parameterType.IsAssignableFrom(argument.Type)) + { + argument = Unquote(argument); + if (!parameterType.IsAssignableFrom(argument.Type)) + return false; + } + } + + return true; + } + + private static Expression Unquote(Expression expression) + { + // + // Get rid of all outer quotes around an expression. + // + while (expression.NodeType == ExpressionType.Quote) + expression = ((UnaryExpression)expression).Operand; + + return expression; + } + } + + internal static Expression GetSourceExpression(IEnumerable source) + { + var q = source as IQueryable; + if (q != null) + return q.Expression; + + return Expression.Constant(source, typeof(IEnumerable)); + } + + internal static Expression GetSourceExpression(IEnumerable[] sources) + { + return Expression.NewArrayInit( + typeof(IEnumerable), + sources.Select(source => GetSourceExpression(source)) + ); + } + } +} diff --git a/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj b/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj new file mode 100644 index 0000000..839f290 --- /dev/null +++ b/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj @@ -0,0 +1,41 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {6D62E966-469D-4A99-BD43-0A17FA14FB4F} + Library + Properties + System.Interactive.Providers + System.Interactive.Providers + v4.0 + 512 + true + + + + $(OutputPath)\$(AssemblyName).XML + + + Profile1 + + + + + + + + + + + + + + {8E4B04F0-915E-48F9-9796-76278C6094BD} + System.Interactive + + + + \ No newline at end of file diff --git a/Ix/System.Interactive/EnumerableEx.Aggregates.cs b/Ix/System.Interactive/EnumerableEx.Aggregates.cs new file mode 100644 index 0000000..204d5ee --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Aggregates.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; + +namespace System.Linq +{ + /// + /// Provides a set of additional static methods that allow querying enumerable sequences. + /// + public static partial class EnumerableEx + { + /// + /// Determines whether an enumerable sequence is empty. + /// + /// Source sequence element type. + /// Source sequence. + /// true if the sequence is empty; false otherwise. + public static bool IsEmpty(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return !source.Any(); + } + + /// + /// Returns the minimum value in the enumerable sequence by using the specified comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to determine the minimum value. + /// Minimum value in the sequence. + public static TSource Min(this IEnumerable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return MinBy(source, x => x, comparer).First(); + } + + /// + /// Returns the elements with the minimum key value by using the default comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// List with the elements that share the same minimum key value. + public static IList MinBy(this IEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return MinBy(source, keySelector, Comparer.Default); + } + + /// + /// Returns the elements with the minimum key value by using the specified comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// Comparer used to determine the minimum key value. + /// List with the elements that share the same minimum key value. + public static IList MinBy(this IEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue)); + } + + /// + /// Returns the maximum value in the enumerable sequence by using the specified comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to determine the maximum value. + /// Maximum value in the sequence. + public static TSource Max(this IEnumerable source, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return MaxBy(source, x => x, comparer).First(); + } + + /// + /// Returns the elements with the maximum key value by using the default comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// List with the elements that share the same maximum key value. + public static IList MaxBy(this IEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return MaxBy(source, keySelector, Comparer.Default); + } + + /// + /// Returns the elements with the minimum key value by using the specified comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector used to extract the key for each element in the sequence. + /// Comparer used to determine the maximum key value. + /// List with the elements that share the same maximum key value. + public static IList MaxBy(this IEnumerable source, Func keySelector, IComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue)); + } + + private static IList ExtremaBy(IEnumerable source, Func keySelector, Func compare) + { + var result = new List(); + + using (var e = source.GetEnumerator()) + { + if (!e.MoveNext()) + throw new InvalidOperationException("Source sequence doesn't contain any elements."); + + var current = e.Current; + var resKey = keySelector(current); + result.Add(current); + + while (e.MoveNext()) + { + var cur = e.Current; + var key = keySelector(cur); + + var cmp = compare(key, resKey); + if (cmp == 0) + { + result.Add(cur); + } + else if (cmp > 0) + { + result = new List { cur }; + resKey = key; + } + } + } + + return result; + } + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Buffering.cs b/Ix/System.Interactive/EnumerableEx.Buffering.cs new file mode 100644 index 0000000..35785bf --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Buffering.cs @@ -0,0 +1,647 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Creates a buffer with a shared view over the source sequence, causing each enumerator to fetch the next element from the source sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Buffer enabling each enumerator to retrieve elements from the shared source sequence. + /// + /// var rng = Enumerable.Range(0, 10).Share(); + /// + /// var e1 = rng.GetEnumerator(); // Both e1 and e2 will consume elements from + /// var e2 = rng.GetEnumerator(); // the source sequence. + /// + /// Assert.IsTrue(e1.MoveNext()); + /// Assert.AreEqual(0, e1.Current); + /// + /// Assert.IsTrue(e1.MoveNext()); + /// Assert.AreEqual(1, e1.Current); + /// + /// Assert.IsTrue(e2.MoveNext()); // e2 "steals" element 2 + /// Assert.AreEqual(2, e2.Current); + /// + /// Assert.IsTrue(e1.MoveNext()); // e1 can't see element 2 + /// Assert.AreEqual(3, e1.Current); + /// + public static IBuffer Share(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new SharedBuffer(source.GetEnumerator()); + } + + /// + /// Shares the source sequence within a selector function where each enumerator can fetch the next element from the source sequence. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with shared access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the shared view over the source sequence. + public static IEnumerable Share(this IEnumerable source, Func, IEnumerable> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => selector(source.Share()).GetEnumerator()); + } + + class SharedBuffer : IBuffer + { + private IEnumerator _source; + private bool _disposed; + + public SharedBuffer(IEnumerator source) + { + _source = source; + } + + public IEnumerator GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + return GetEnumerator_(); + } + + private IEnumerator GetEnumerator_() + { + while (true) + { + if (_disposed) + throw new ObjectDisposedException(""); + + var hasValue = default(bool); + var current = default(T); + + lock (_source) + { + hasValue = _source.MoveNext(); + if (hasValue) + current = _source.Current; + } + + if (hasValue) + yield return current; + else + break; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + return GetEnumerator(); + } + + public void Dispose() + { + lock (_source) + { + if (!_disposed) + { + _source.Dispose(); + _source = null; + } + + _disposed = true; + } + } + } + + /// + /// Creates a buffer with a view over the source sequence, causing each enumerator to obtain access to the remainder of the sequence from the current index in the buffer. + /// + /// Source sequence element type. + /// Source sequence. + /// Buffer enabling each enumerator to retrieve elements from the shared source sequence, starting from the index at the point of obtaining the enumerator. + /// + /// var rng = Enumerable.Range(0, 10).Publish(); + /// + /// var e1 = rng.GetEnumerator(); // e1 has a view on the source starting from element 0 + /// + /// Assert.IsTrue(e1.MoveNext()); + /// Assert.AreEqual(0, e1.Current); + /// + /// Assert.IsTrue(e1.MoveNext()); + /// Assert.AreEqual(1, e1.Current); + /// + /// var e2 = rng.GetEnumerator(); + /// + /// Assert.IsTrue(e2.MoveNext()); // e2 has a view on the source starting from element 2 + /// Assert.AreEqual(2, e2.Current); + /// + /// Assert.IsTrue(e1.MoveNext()); // e1 continues to enumerate over its view + /// Assert.AreEqual(2, e1.Current); + /// + public static IBuffer Publish(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new PublishedBuffer(source.GetEnumerator()); + } + + /// + /// Publishes the source sequence within a selector function where each enumerator can obtain a view over a tail of the source sequence. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with published access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the published view over the source sequence. + public static IEnumerable Publish(this IEnumerable source, Func, IEnumerable> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => selector(source.Publish()).GetEnumerator()); + } + + class PublishedBuffer : IBuffer + { + private IEnumerator _source; + private RefCountList _buffer; + private bool _stopped; + private Exception _error; + private bool _disposed; + + public PublishedBuffer(IEnumerator source) + { + _buffer = new RefCountList(0); + _source = source; + } + + public IEnumerator GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + var i = default(int); + lock (_source) + { + i = _buffer.Count; + _buffer.ReaderCount++; + } + + return GetEnumerator_(i); + } + + private IEnumerator GetEnumerator_(int i) + { + try + { + while (true) + { + if (_disposed) + throw new ObjectDisposedException(""); + + var hasValue = default(bool); + var current = default(T); + + lock (_source) + { + if (i >= _buffer.Count) + { + if (!_stopped) + { + try + { + hasValue = _source.MoveNext(); + if (hasValue) + current = _source.Current; + } + catch (Exception ex) + { + _stopped = true; + _error = ex; + + _source.Dispose(); + } + } + + if (_stopped) + { + if (_error != null) + throw _error; + else + break; + } + + if (hasValue) + { + _buffer.Add(current); + } + } + else + { + hasValue = true; + } + } + + if (hasValue) + yield return _buffer[i]; + else + break; + + i++; + } + } + finally + { + if (_buffer != null) + _buffer.Done(i + 1); + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + return GetEnumerator(); + } + + public void Dispose() + { + lock (_source) + { + if (!_disposed) + { + _source.Dispose(); + _source = null; + + _buffer.Clear(); + _buffer = null; + } + + _disposed = true; + } + } + } + + /// + /// Creates a buffer with a view over the source sequence, causing each enumerator to obtain access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Source sequence. + /// Buffer enabling each enumerator to retrieve all elements from the shared source sequence, without duplicating source enumeration side-effects. + /// + /// var rng = Enumerable.Range(0, 10).Do(x => Console.WriteLine(x)).Memoize(); + /// + /// var e1 = rng.GetEnumerator(); + /// + /// Assert.IsTrue(e1.MoveNext()); // Prints 0 + /// Assert.AreEqual(0, e1.Current); + /// + /// Assert.IsTrue(e1.MoveNext()); // Prints 1 + /// Assert.AreEqual(1, e1.Current); + /// + /// var e2 = rng.GetEnumerator(); + /// + /// Assert.IsTrue(e2.MoveNext()); // Doesn't print anything; the side-effect of Do + /// Assert.AreEqual(0, e2.Current); // has already taken place during e1's iteration. + /// + /// Assert.IsTrue(e1.MoveNext()); // Prints 2 + /// Assert.AreEqual(2, e1.Current); + /// + public static IBuffer Memoize(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new MemoizedBuffer(source.GetEnumerator()); + } + + /// + /// Memoizes the source sequence within a selector function where each enumerator can get access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Selector function with memoized access to the source sequence for each enumerator. + /// Sequence resulting from applying the selector function to the memoized view over the source sequence. + public static IEnumerable Memoize(this IEnumerable source, Func, IEnumerable> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => selector(source.Memoize()).GetEnumerator()); + } + + /// + /// Creates a buffer with a view over the source sequence, causing a specified number of enumerators to obtain access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. + /// Buffer enabling a specified number of enumerators to retrieve all elements from the shared source sequence, without duplicating source enumeration side-effects. + public static IBuffer Memoize(this IEnumerable source, int readerCount) + { + if (source == null) + throw new ArgumentNullException("source"); + if (readerCount <= 0) + throw new ArgumentOutOfRangeException("readerCount"); + + return new MemoizedBuffer(source.GetEnumerator(), readerCount); + } + + /// + /// Memoizes the source sequence within a selector function where a specified number of enumerators can get access to all of the sequence's elements without causing multiple enumerations over the source. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. + /// Selector function with memoized access to the source sequence for a specified number of enumerators. + /// Sequence resulting from applying the selector function to the memoized view over the source sequence. + public static IEnumerable Memoize(this IEnumerable source, int readerCount, Func, IEnumerable> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (readerCount <= 0) + throw new ArgumentOutOfRangeException("readerCount"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return Create(() => selector(source.Memoize(readerCount)).GetEnumerator()); + } + + class MemoizedBuffer : IBuffer + { + private IEnumerator _source; + private IRefCountList _buffer; + private bool _stopped; + private Exception _error; + private bool _disposed; + + public MemoizedBuffer(IEnumerator source) + : this(source, new MaxRefCountList()) + { + } + + public MemoizedBuffer(IEnumerator source, int readerCount) + : this(source, new RefCountList(readerCount)) + { + } + + private MemoizedBuffer(IEnumerator source, IRefCountList buffer) + { + _source = source; + _buffer = buffer; + } + + public IEnumerator GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + return GetEnumerator_(); + } + + private IEnumerator GetEnumerator_() + { + var i = 0; + + try + { + while (true) + { + if (_disposed) + throw new ObjectDisposedException(""); + + var hasValue = default(bool); + var current = default(T); + + lock (_source) + { + if (i >= _buffer.Count) + { + if (!_stopped) + { + try + { + hasValue = _source.MoveNext(); + if (hasValue) + current = _source.Current; + } + catch (Exception ex) + { + _stopped = true; + _error = ex; + + _source.Dispose(); + } + } + + if (_stopped) + { + if (_error != null) + throw _error; + else + break; + } + + if (hasValue) + { + _buffer.Add(current); + } + } + else + { + hasValue = true; + } + } + + if (hasValue) + yield return _buffer[i]; + else + break; + + i++; + } + } + finally + { + if (_buffer != null) + _buffer.Done(i + 1); + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + if (_disposed) + throw new ObjectDisposedException(""); + + return GetEnumerator(); + } + + public void Dispose() + { + lock (_source) + { + if (!_disposed) + { + _source.Dispose(); + _source = null; + + _buffer.Clear(); + _buffer = null; + } + + _disposed = true; + } + } + } + } + + /// + /// Represents a buffer exposing a shared view over an underlying enumerable sequence. + /// + /// Element type. + public interface IBuffer< +#if !NO_VARIANCE && !SILVERLIGHT4 // SL4 has defined IEnumerable with invariant T + out +#endif + T> : IEnumerable, IDisposable + { + } + + interface IRefCountList + { + void Clear(); + + int Count { get; } + + T this[int i] + { + get; + } + + void Add(T item); + + void Done(int index); + } + + class MaxRefCountList : IRefCountList + { + private IList _list = new List(); + + public void Clear() + { + _list.Clear(); + } + + public int Count + { + get { return _list.Count; } + } + + public T this[int i] + { + get { return _list[i]; } + } + + public void Add(T item) + { + _list.Add(item); + } + + public void Done(int index) + { + } + } + + class RefCountList : IRefCountList + { + private int _readerCount; + private readonly IDictionary _list; + private int _count; + + public RefCountList(int readerCount) + { + _readerCount = readerCount; + _list = new Dictionary(); + } + + public int ReaderCount + { + get + { + return _readerCount; + } + + set + { + _readerCount = value; + } + } + + public void Clear() + { + _list.Clear(); + } + + public int Count + { + get { return _count; } + } + + public T this[int i] + { + get + { + Debug.Assert(i < _count); + + var res = default(RefCount); + if (!_list.TryGetValue(i, out res)) + throw new InvalidOperationException("Element no longer available in the buffer."); + + var val = res.Value; + if (--res.Count == 0) + _list.Remove(i); + + return val; + } + } + + public void Add(T item) + { + _list[_count] = new RefCount { Value = item, Count = _readerCount }; + _count++; + } + + public void Done(int index) + { + for (int i = index; i < _count; i++) + { + var ignore = this[i]; + } + + _readerCount--; + } + + class RefCount + { + public int Count; + public T Value; + } + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Creation.cs b/Ix/System.Interactive/EnumerableEx.Creation.cs new file mode 100644 index 0000000..2ba4f16 --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Creation.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Creates an enumerable sequence based on an enumerator factory function. + /// + /// Result sequence element type. + /// Enumerator factory function. + /// Sequence that will invoke the enumerator factory upon a call to GetEnumerator. + public static IEnumerable Create(Func> getEnumerator) + { + if (getEnumerator == null) + throw new ArgumentNullException("getEnumerator"); + + return new AnonymousEnumerable(getEnumerator); + } + + class AnonymousEnumerable : IEnumerable + { + private readonly Func> _getEnumerator; + + public AnonymousEnumerable(Func> getEnumerator) + { + _getEnumerator = getEnumerator; + } + + public IEnumerator GetEnumerator() + { + return _getEnumerator(); + } + + Collections.IEnumerator Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + /// + /// Returns a sequence with a single element. + /// + /// Result sequence element type. + /// Single element of the resulting sequence. + /// Sequence with a single element. + public static IEnumerable Return(TResult value) + { + yield return value; + } + + /// + /// Returns a sequence that throws an exception upon enumeration. + /// + /// Result sequence element type. + /// Exception to throw upon enumerating the resulting sequence. + /// Sequence that throws the specified exception upon enumeration. + public static IEnumerable Throw(Exception exception) + { + if (exception == null) + throw new ArgumentNullException("exception"); + + return Throw_(exception); + } + + private static IEnumerable Throw_(Exception exception) + { + throw exception; +#pragma warning disable 0162 + yield break; +#pragma warning restore 0162 + } + + /// + /// Creates an enumerable sequence based on an enumerable factory function. + /// + /// Result sequence element type. + /// Enumerable factory function. + /// Sequence that will invoke the enumerable factory upon a call to GetEnumerator. + public static IEnumerable Defer(Func> enumerableFactory) + { + if (enumerableFactory == null) + throw new ArgumentNullException("enumerableFactory"); + + return Defer_(enumerableFactory); + } + + private static IEnumerable Defer_(Func> enumerableFactory) + { + foreach (var item in enumerableFactory()) + yield return item; + } + + /// + /// Generates a sequence by mimicking a for loop. + /// + /// State type. + /// Result sequence element type. + /// Initial state of the generator loop. + /// Loop condition. + /// State update function to run after every iteration of the generator loop. + /// Result selector to compute resulting sequence elements. + /// Sequence obtained by running the generator loop, yielding computed elements. + public static IEnumerable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) + { + if (condition == null) + throw new ArgumentNullException("condition"); + if (iterate == null) + throw new ArgumentNullException("iterate"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return Generate_(initialState, condition, iterate, resultSelector); + } + + private static IEnumerable Generate_(TState initialState, Func condition, Func iterate, Func resultSelector) + { + for (var i = initialState; condition(i); i = iterate(i)) + yield return resultSelector(i); + } + + /// + /// Generates a sequence that's dependent on a resource object whose lifetime is determined by the sequence usage duration. + /// + /// Source element type. + /// Resource type. + /// Resource factory function. + /// Enumerable factory function, having access to the obtained resource. + /// Sequence whose use controls the lifetime of the associated obtained resource. + public static IEnumerable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable + { + if (resourceFactory == null) + throw new ArgumentNullException("resourceFactory"); + if (enumerableFactory == null) + throw new ArgumentNullException("enumerableFactory"); + + return Using_(resourceFactory, enumerableFactory); + } + + private static IEnumerable Using_(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable + { + using (var res = resourceFactory()) + foreach (var item in enumerableFactory(res)) + yield return item; + } + + /// + /// Generates a sequence by repeating the given value infinitely. + /// + /// Result sequence element type. + /// Value to repreat in the resulting sequence. + /// Sequence repeating the given value infinitely. + public static IEnumerable Repeat(TResult value) + { + while (true) + yield return value; + } + + /// + /// Generates a sequence that contains one repeated value. + /// + /// Result sequence element type. + /// The value to be repeated. + /// The number of times to repeat the value in the generated sequence. + /// Sequence that contains a repeated value. + public static IEnumerable Repeat(TResult element, int count) + { + return Enumerable.Repeat(element, count); + } + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Exceptions.cs b/Ix/System.Interactive/EnumerableEx.Exceptions.cs new file mode 100644 index 0000000..a3ff330 --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Exceptions.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Creates a sequence that corresponds to the source sequence, concatenating it with the sequence resulting from calling an exception handler function in case of an error. + /// + /// Source sequence element type. + /// Exception type to catch. + /// Source sequence. + /// Handler to invoke when an exception of the specified type occurs. + /// Source sequence, concatenated with an exception handler result sequence in case of an error. + public static IEnumerable Catch(this IEnumerable source, Func> handler) + where TException : Exception + { + if (source == null) + throw new ArgumentNullException("source"); + if (handler == null) + throw new ArgumentNullException("handler"); + + return source.Catch_(handler); + } + + private static IEnumerable Catch_(this IEnumerable source, Func> handler) + where TException : Exception + { + var err = default(IEnumerable); + + using (var e = source.GetEnumerator()) + { + while (true) + { + var b = default(bool); + var c = default(TSource); + + try + { + b = e.MoveNext(); + c = e.Current; + } + catch (TException ex) + { + err = handler(ex); + break; + } + + if (!b) + break; + + yield return c; + } + } + + if (err != null) + { + foreach (var item in err) + yield return item; + } + } + + /// + /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence that continues to concatenate source sequences while errors occur. + public static IEnumerable Catch(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Catch_(); + } + + /// + /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence that continues to concatenate source sequences while errors occur. + public static IEnumerable Catch(params IEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Catch_(); + } + + /// + /// Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error. + /// + /// Source sequence element type. + /// First sequence. + /// Second sequence, concatenated to the result in case the first sequence completes exceptionally. + /// The first sequence, followed by the second sequence in case an error is produced. + public static IEnumerable Catch(this IEnumerable first, IEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return new[] { first, second }.Catch_(); + } + + private static IEnumerable Catch_(this IEnumerable> sources) + { + var error = default(Exception); + + foreach (var source in sources) + { + using (var e = source.GetEnumerator()) + { + error = null; + + while (true) + { + var b = default(bool); + var c = default(TSource); + + try + { + b = e.MoveNext(); + c = e.Current; + } + catch (Exception ex) + { + error = ex; + break; + } + + if (!b) + break; + + yield return c; + } + + if (error == null) + break; + } + } + + if (error != null) + throw error; + } + + /// + /// Creates a sequence whose termination or disposal of an enumerator causes a finally action to be executed. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to run upon termination of the sequence, or when an enumerator is disposed. + /// Source sequence with guarantees on the invocation of the finally action. + public static IEnumerable Finally(this IEnumerable source, Action finallyAction) + { + if (source == null) + throw new ArgumentNullException("source"); + if (finallyAction == null) + throw new ArgumentNullException("finallyAction"); + + return source.Finally_(finallyAction); + } + + private static IEnumerable Finally_(this IEnumerable source, Action finallyAction) + { + try + { + foreach (var item in source) + yield return item; + } + finally + { + finallyAction(); + } + } + + /// + /// Creates a sequence that concatenates both given sequences, regardless of whether an error occurs. + /// + /// Source sequence element type. + /// First sequence. + /// Second sequence. + /// Sequence concatenating the elements of both sequences, ignoring errors. + public static IEnumerable OnErrorResumeNext(this IEnumerable first, IEnumerable second) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + + return OnErrorResumeNext_(new[] { first, second }); + } + + /// + /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence concatenating the elements of the given sequences, ignoring errors. + public static IEnumerable OnErrorResumeNext(params IEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return OnErrorResumeNext_(sources); + } + + /// + /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence concatenating the elements of the given sequences, ignoring errors. + public static IEnumerable OnErrorResumeNext(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return OnErrorResumeNext_(sources); + } + + private static IEnumerable OnErrorResumeNext_(IEnumerable> sources) + { + foreach (var source in sources) + { + using (var innerEnumerator = source.GetEnumerator()) + { + while (true) + { + var value = default(TSource); + try + { + if (!innerEnumerator.MoveNext()) + break; + value = innerEnumerator.Current; + } + catch + { + break; + } + + yield return value; + } + } + } + } + + /// + /// Creates a sequence that retries enumerating the source sequence as long as an error occurs. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence concatenating the results of the source sequence as long as an error occurs. + public static IEnumerable Retry(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return new[] { source }.Repeat().Catch(); + } + + /// + /// Creates a sequence that retries enumerating the source sequence as long as an error occurs, with the specified maximum number of retries. + /// + /// Source sequence element type. + /// Source sequence. + /// Maximum number of retries. + /// Sequence concatenating the results of the source sequence as long as an error occurs. + public static IEnumerable Retry(this IEnumerable source, int retryCount) + { + if (source == null) + throw new ArgumentNullException("source"); + if (retryCount < 0) + throw new ArgumentOutOfRangeException("retryCount"); + + return new[] { source }.Repeat(retryCount).Catch(); + } + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Imperative.cs b/Ix/System.Interactive/EnumerableEx.Imperative.cs new file mode 100644 index 0000000..fff3927 --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Imperative.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Generates an enumerable sequence by repeating a source sequence as long as the given loop condition holds. + /// + /// Result sequence element type. + /// Loop condition. + /// Sequence to repeat while the condition evaluates true. + /// Sequence generated by repeating the given sequence while the condition evaluates to true. + public static IEnumerable While(Func condition, IEnumerable source) + { + if (condition == null) + throw new ArgumentNullException("condition"); + if (source == null) + throw new ArgumentNullException("source"); + + return WhileCore(condition, source).Concat(); + } + + static IEnumerable> WhileCore(Func condition, IEnumerable source) + { + while (condition()) + yield return source; + } + + /// + /// Returns an enumerable sequence based on the evaluation result of the given condition. + /// + /// Result sequence element type. + /// Condition to evaluate. + /// Sequence to return in case the condition evaluates true. + /// Sequence to return in case the condition evaluates false. + /// Either of the two input sequences based on the result of evaluating the condition. + public static IEnumerable If(Func condition, IEnumerable thenSource, IEnumerable elseSource) + { + if (condition == null) + throw new ArgumentNullException("condition"); + if (thenSource == null) + throw new ArgumentNullException("thenSource"); + if (elseSource == null) + throw new ArgumentNullException("elseSource"); + + return EnumerableEx.Defer(() => condition() ? thenSource : elseSource); + } + + /// + /// Returns an enumerable sequence if the evaluation result of the given condition is true, otherwise returns an empty sequence. + /// + /// Result sequence element type. + /// Condition to evaluate. + /// Sequence to return in case the condition evaluates true. + /// The given input sequence if the condition evaluates true; otherwise, an empty sequence. + public static IEnumerable If(Func condition, IEnumerable thenSource) + { + if (condition == null) + throw new ArgumentNullException("condition"); + if (thenSource == null) + throw new ArgumentNullException("thenSource"); + + return EnumerableEx.Defer(() => condition() ? thenSource : Enumerable.Empty()); + } + + /// + /// Generates an enumerable sequence by repeating a source sequence as long as the given loop postcondition holds. + /// + /// Result sequence element type. + /// Source sequence to repeat while the condition evaluates true. + /// Loop condition. + /// Sequence generated by repeating the given sequence until the condition evaluates to false. + public static IEnumerable DoWhile(this IEnumerable source, Func condition) + { + if (source == null) + throw new ArgumentNullException("source"); + if (condition == null) + throw new ArgumentNullException("condition"); + + return source.Concat(While(condition, source)); + } + + /// + /// Returns a sequence from a dictionary based on the result of evaluating a selector function. + /// + /// Type of the selector value. + /// Result sequence element type. + /// Selector function used to pick a sequence from the given sources. + /// Dictionary mapping selector values onto resulting sequences. + /// The source sequence corresponding with the evaluated selector value; otherwise, an empty sequence. + public static IEnumerable Case(Func selector, IDictionary> sources) + { + if (selector == null) + throw new ArgumentNullException("selector"); + if (sources == null) + throw new ArgumentNullException("sources"); + + return Case(selector, sources, Enumerable.Empty()); + } + + /// + /// Returns a sequence from a dictionary based on the result of evaluating a selector function, also specifying a default sequence. + /// + /// Type of the selector value. + /// Result sequence element type. + /// Selector function used to pick a sequence from the given sources. + /// Dictionary mapping selector values onto resulting sequences. + /// Default sequence to return in case there's no corresponding source for the computed selector value. + /// The source sequence corresponding with the evaluated selector value; otherwise, the default source. + public static IEnumerable Case(Func selector, IDictionary> sources, IEnumerable defaultSource) + { + if (selector == null) + throw new ArgumentNullException("selector"); + if (sources == null) + throw new ArgumentNullException("sources"); + if (defaultSource == null) + throw new ArgumentNullException("defaultSource"); + + return EnumerableEx.Defer(() => + { + IEnumerable result; + if (!sources.TryGetValue(selector(), out result)) + result = defaultSource; + return result; + }); + } + + /// + /// Generates a sequence by enumerating a source sequence, mapping its elements on result sequences, and concatenating those sequences. + /// + /// Source sequence element type. + /// Result sequence element type. + /// Source sequence. + /// Result selector to evaluate for each iteration over the source. + /// Sequence concatenating the inner sequences that result from evaluating the result selector on elements from the source. + public static IEnumerable For(IEnumerable source, Func> resultSelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return ForCore(source, resultSelector).Concat(); + } + + static IEnumerable> ForCore(IEnumerable source, Func> resultSelector) + { + return source.Select(resultSelector); + } + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Multiple.cs b/Ix/System.Interactive/EnumerableEx.Multiple.cs new file mode 100644 index 0000000..ffba503 --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Multiple.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Concatenates the input sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence with the elements of the source sequences concatenated. + public static IEnumerable Concat(this IEnumerable> sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Concat_(); + } + + /// + /// Concatenates the input sequences. + /// + /// Source sequence element type. + /// Source sequences. + /// Sequence with the elements of the source sequences concatenated. + public static IEnumerable Concat(params IEnumerable[] sources) + { + if (sources == null) + throw new ArgumentNullException("sources"); + + return sources.Concat_(); + } + + private static IEnumerable Concat_(this IEnumerable> sources) + { + foreach (var source in sources) + foreach (var item in source) + yield return item; + } + + /// + /// Projects each element of a sequence to an given sequence and flattens the resulting sequences into one sequence. + /// + /// First source sequence element type. + /// Second source sequence element type. + /// A sequence of values to project. + /// Inner sequence each source sequenec element is projected onto. + /// Sequence flattening the sequences that result from projecting elements in the source sequence. + public static IEnumerable SelectMany(this IEnumerable source, IEnumerable other) + { + if (source == null) + throw new ArgumentNullException("source"); + if (other == null) + throw new ArgumentNullException("other"); + + return source.SelectMany(_ => other); + } + +#if NO_ZIP + /// + /// Merges two sequences by applying the specified selector function on index-based corresponding element pairs from both sequences. + /// + /// The type of the elements of the first input sequence. + /// The type of the elements of the second input sequence. + /// The type of the elements of the result sequence. + /// The first sequence to merge. + /// The second sequence to merge. + /// Function to apply to each pair of elements from both sequences. + /// Sequence consisting of the result of pairwise application of the selector function over pairs of elements from the source sequences. + public static IEnumerable Zip(this IEnumerable first, IEnumerable second, Func resultSelector) + { + if (first == null) + throw new ArgumentNullException("first"); + if (second == null) + throw new ArgumentNullException("second"); + if (resultSelector == null) + throw new ArgumentNullException("resultSelector"); + + return Zip_(first, second, resultSelector); + } + + private static IEnumerable Zip_(this IEnumerable first, IEnumerable second, Func resultSelector) + { + using (var e1 = first.GetEnumerator()) + using (var e2 = second.GetEnumerator()) + while (e1.MoveNext() && e2.MoveNext()) + yield return resultSelector(e1.Current, e2.Current); + } +#endif + } +} diff --git a/Ix/System.Interactive/EnumerableEx.Single.cs b/Ix/System.Interactive/EnumerableEx.Single.cs new file mode 100644 index 0000000..6151ea9 --- /dev/null +++ b/Ix/System.Interactive/EnumerableEx.Single.cs @@ -0,0 +1,672 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace System.Linq +{ + public static partial class EnumerableEx + { + /// + /// Hides the enumerable sequence object identity. + /// + /// Source sequence element type. + /// Source sequence. + /// Enumerable sequence with the same behavior as the original, but hiding the source object identity. + /// AsEnumerable doesn't hide the object identity, and simply acts as a cast to the IEnumerable<TSource> interface. + public static IEnumerable Hide(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.Hide_(); + } + + private static IEnumerable Hide_(this IEnumerable source) + { + foreach (var item in source) + yield return item; + } + + /// + /// Enumerates the sequence and invokes the given action for each value in the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + public static void ForEach(this IEnumerable source, Action onNext) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + + foreach (var item in source) + onNext(item); + } + + /// + /// Enumerates the sequence and invokes the given action for each value in the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + public static void ForEach(this IEnumerable source, Action onNext) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + + var i = 0; + foreach (var item in source) + onNext(item, i++); + } + + /// + /// Lazily invokes an action for each value in the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IEnumerable Do(this IEnumerable source, Action onNext) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + + return DoHelper(source, onNext, _ => { }, () => { }); + } + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action for successful termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on successful termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IEnumerable Do(this IEnumerable source, Action onNext, Action onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return DoHelper(source, onNext, _ => { }, onCompleted); + } + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action upon exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on exceptional termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IEnumerable Do(this IEnumerable source, Action onNext, Action onError) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + + return DoHelper(source, onNext, onError, () => { }); + } + + /// + /// Lazily invokes an action for each value in the sequence, and executes an action upon successful or exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Action to invoke for each element. + /// Action to invoke on exceptional termination of the sequence. + /// Action to invoke on successful termination of the sequence. + /// Sequence exhibiting the specified side-effects upon enumeration. + public static IEnumerable Do(this IEnumerable source, Action onNext, Action onError, Action onCompleted) + { + if (source == null) + throw new ArgumentNullException("source"); + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return DoHelper(source, onNext, onError, onCompleted); + } + +#if !NO_RXINTERFACES + /// + /// Lazily invokes observer methods for each value in the sequence, and upon successful or exceptional termination. + /// + /// Source sequence element type. + /// Source sequence. + /// Observer to invoke notification calls on. + /// Sequence exhibiting the side-effects of observer method invocation upon enumeration. + public static IEnumerable Do(this IEnumerable source, IObserver observer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (observer == null) + throw new ArgumentNullException("observer"); + + return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted); + } +#endif + + private static IEnumerable DoHelper(this IEnumerable source, Action onNext, Action onError, Action onCompleted) + { + using (var e = source.GetEnumerator()) + { + while (true) + { + var current = default(TSource); + try + { + if (!e.MoveNext()) + break; + + current = e.Current; + } + catch (Exception ex) + { + onError(ex); + throw; + } + + onNext(current); + yield return current; + } + + onCompleted(); + } + } + + /// + /// Generates a sequence of non-overlapping adjacent buffers over the source sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of elements for allocated buffers. + /// Sequence of buffers containing source sequence elements. + public static IEnumerable> Buffer(this IEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count <= 0) + throw new ArgumentOutOfRangeException("count"); + + return source.Buffer_(count, count); + } + + /// + /// Generates a sequence of buffers over the source sequence, with specified length and possible overlap. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of elements for allocated buffers. + /// Number of elements to skip between the start of consecutive buffers. + /// Sequence of buffers containing source sequence elements. + public static IEnumerable> Buffer(this IEnumerable source, int count, int skip) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count <= 0) + throw new ArgumentOutOfRangeException("count"); + if (skip <= 0) + throw new ArgumentOutOfRangeException("skip"); + + return source.Buffer_(count, skip); + } + + private static IEnumerable> Buffer_(this IEnumerable source, int count, int skip) + { + var buffers = new Queue>(); + + var i = 0; + foreach (var item in source) + { + if (i % skip == 0) + buffers.Enqueue(new List(count)); + + foreach (var buffer in buffers) + buffer.Add(item); + + if (buffers.Count > 0 && buffers.Peek().Count == count) + yield return buffers.Dequeue(); + + i++; + } + + while (buffers.Count > 0) + yield return buffers.Dequeue(); + } + + /// + /// Ignores all elements in the source sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// Source sequence without its elements. + public static IEnumerable IgnoreElements(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.IgnoreElements_(); + } + + private static IEnumerable IgnoreElements_(this IEnumerable source) + { + foreach (var item in source) + ; + + yield break; + } + + /// + /// Returns elements with a distinct key value by using the default equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Sequence that contains the elements from the source sequence with distinct key values. + public static IEnumerable Distinct(this IEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.Distinct_(keySelector, EqualityComparer.Default); + } + + /// + /// Returns elements with a distinct key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Comparer used to compare key values. + /// Sequence that contains the elements from the source sequence with distinct key values. + public static IEnumerable Distinct(this IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.Distinct_(keySelector, comparer); + } + + private static IEnumerable Distinct_(this IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + var set = new HashSet(comparer); + + foreach (var item in source) + { + var key = keySelector(item); + if (set.Add(key)) + yield return item; + } + } + +#if NO_HASHSET + class HashSet + { + private Dictionary _set; + + public HashSet(IEqualityComparer comparer) + { + _set = new Dictionary(comparer); + } + + public bool Add(T value) + { + if (_set.ContainsKey(value)) + return false; + + _set[value] = null; + return true; + } + } +#endif + + /// + /// Returns consecutive distinct elements by using the default equality comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence without adjacent non-distinct elements. + public static IEnumerable DistinctUntilChanged(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.DistinctUntilChanged_(x => x, EqualityComparer.Default); + } + + /// + /// Returns consecutive distinct elements by using the specified equality comparer to compare values. + /// + /// Source sequence element type. + /// Source sequence. + /// Comparer used to compare values. + /// Sequence without adjacent non-distinct elements. + public static IEnumerable DistinctUntilChanged(this IEnumerable source, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.DistinctUntilChanged_(x => x, comparer); + } + + /// + /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Sequence without adjacent non-distinct elements. + public static IEnumerable DistinctUntilChanged(this IEnumerable source, Func keySelector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + + return source.DistinctUntilChanged_(keySelector, EqualityComparer.Default); + } + + /// + /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. + /// + /// Source sequence element type. + /// Key type. + /// Source sequence. + /// Key selector. + /// Comparer used to compare key values. + /// Sequence without adjacent non-distinct elements. + public static IEnumerable DistinctUntilChanged(this IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) + throw new ArgumentNullException("source"); + if (keySelector == null) + throw new ArgumentNullException("keySelector"); + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return source.DistinctUntilChanged_(keySelector, comparer); + } + + private static IEnumerable DistinctUntilChanged_(this IEnumerable source, Func keySelector, IEqualityComparer comparer) + { + var currentKey = default(TKey); + var hasCurrentKey = false; + + foreach (var item in source) + { + var key = keySelector(item); + + var comparerEquals = false; + if (hasCurrentKey) + { + comparerEquals = comparer.Equals(currentKey, key); + } + + if (!hasCurrentKey || !comparerEquals) + { + hasCurrentKey = true; + currentKey = key; + yield return item; + } + } + } + + /// + /// Expands the sequence by recursively applying a selector function. + /// + /// Source sequence element type. + /// Source sequence. + /// Selector function to retrieve the next sequence to expand. + /// Sequence with results from the recursive expansion of the source sequence. + public static IEnumerable Expand(this IEnumerable source, Func> selector) + { + if (source == null) + throw new ArgumentNullException("source"); + if (selector == null) + throw new ArgumentNullException("selector"); + + return source.Expand_(selector); + } + + private static IEnumerable Expand_(this IEnumerable source, Func> selector) + { + var queue = new Queue>(); + queue.Enqueue(source); + + while (queue.Count > 0) + { + var src = queue.Dequeue(); + + foreach (var item in src) + { + queue.Enqueue(selector(item)); + yield return item; + } + } + } + + /// + /// Returns the source sequence prefixed with the specified value. + /// + /// Source sequence element type. + /// Source sequence. + /// Values to prefix the sequence with. + /// Sequence starting with the specified prefix value, followed by the source sequence. + public static IEnumerable StartWith(this IEnumerable source, params TSource[] values) + { + if (source == null) + throw new ArgumentNullException("source"); + + return source.StartWith_(values); + } + + private static IEnumerable StartWith_(this IEnumerable source, params TSource[] values) + { + foreach (var x in values) + yield return x; + + foreach (var item in source) + yield return item; + } + + /// + /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. + /// + /// Source sequence element type. + /// Accumulation type. + /// Source sequence. + /// Accumulator seed value. + /// Accumulation function to apply to the current accumulation value and each element of the sequence. + /// Sequence with all intermediate accumulation values resulting from scanning the sequence. + public static IEnumerable Scan(this IEnumerable source, TAccumulate seed, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return source.Scan_(seed, accumulator); + } + + private static IEnumerable Scan_(this IEnumerable source, TAccumulate seed, Func accumulator) + { + var acc = seed; + + foreach (var item in source) + { + acc = accumulator(acc, item); + yield return acc; + } + } + + /// + /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. + /// + /// Source sequence element type. + /// Source sequence. + /// Accumulation function to apply to the current accumulation value and each element of the sequence. + /// Sequence with all intermediate accumulation values resulting from scanning the sequence. + public static IEnumerable Scan(this IEnumerable source, Func accumulator) + { + if (source == null) + throw new ArgumentNullException("source"); + if (accumulator == null) + throw new ArgumentNullException("accumulator"); + + return source.Scan_(accumulator); + } + + private static IEnumerable Scan_(this IEnumerable source, Func accumulator) + { + var hasSeed = false; + var acc = default(TSource); + + foreach (var item in source) + { + if (!hasSeed) + { + hasSeed = true; + acc = item; + continue; + } + + acc = accumulator(acc, item); + yield return acc; + } + } + + /// + /// Returns a specified number of contiguous elements from the end of the sequence. + /// + /// Source sequence element type. + /// Source sequence. + /// The number of elements to take from the end of the sequence. + /// Sequence with the specified number of elements counting from the end of the source sequence. + public static IEnumerable TakeLast(this IEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return source.TakeLast_(count); + } + + private static IEnumerable TakeLast_(this IEnumerable source, int count) + { + var q = new Queue(count); + + foreach (var item in source) + { + if (q.Count >= count) + q.Dequeue(); + q.Enqueue(item); + } + + while (q.Count > 0) + yield return q.Dequeue(); + } + + /// + /// Bypasses a specified number of contiguous elements from the end of the sequence and returns the remaining elements. + /// + /// Source sequence element type. + /// Source sequence. + /// The number of elements to skip from the end of the sequence before returning the remaining elements. + /// Sequence bypassing the specified number of elements counting from the end of the source sequence. + public static IEnumerable SkipLast(this IEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return source.SkipLast_(count); + } + + private static IEnumerable SkipLast_(this IEnumerable source, int count) + { + var q = new Queue(); + + foreach (var x in source) + { + q.Enqueue(x); + if (q.Count > count) + yield return q.Dequeue(); + } + } + + /// + /// Repeats and concatenates the source sequence infinitely. + /// + /// Source sequence element type. + /// Source sequence. + /// Sequence obtained by concatenating the source sequence to itself infinitely. + public static IEnumerable Repeat(this IEnumerable source) + { + if (source == null) + throw new ArgumentNullException("source"); + + return Repeat_(source); + } + + private static IEnumerable Repeat_(IEnumerable source) + { + while (true) + foreach (var item in source) + yield return item; + } + + /// + /// Repeats and concatenates the source sequence the given number of times. + /// + /// Source sequence element type. + /// Source sequence. + /// Number of times to repeat the source sequence. + /// Sequence obtained by concatenating the source sequence to itself the specified number of times. + public static IEnumerable Repeat(this IEnumerable source, int count) + { + if (source == null) + throw new ArgumentNullException("source"); + if (count < 0) + throw new ArgumentOutOfRangeException("count"); + + return Repeat_(source, count); + } + + private static IEnumerable Repeat_(IEnumerable source, int count) + { + for (var i = 0; i < count; i++) + foreach (var item in source) + yield return item; + } + } +} diff --git a/Ix/System.Interactive/Properties/AssemblyInfo.cs b/Ix/System.Interactive/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0bafb78 --- /dev/null +++ b/Ix/System.Interactive/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; + +[assembly: AssemblyTitle("System.Interactive")] +// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet +[assembly: AssemblyDescription("Interactive Extensions Main Library used to express queries over enumerable sequences.")] +#if DEBUG +[assembly: AssemblyConfiguration("Debug")] +#else +[assembly: AssemblyConfiguration("Retail")] +#endif +[assembly: AssemblyCompany("Microsoft Corporation")] +#if STABLE +[assembly: AssemblyProduct("Interactive Extensions")] +#else +[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] +#endif +[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] +[assembly: NeutralResourcesLanguage("en-US")] + +#if !PLIB +[assembly: ComVisible(false)] +#endif + +[assembly: CLSCompliant(true)] + +#if DESKTOPCLR && NO_CODECOVERAGE +[assembly: AllowPartiallyTrustedCallers] +#endif + +// +// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows +// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. +// diff --git a/Ix/System.Interactive/System.Interactive.csproj b/Ix/System.Interactive/System.Interactive.csproj new file mode 100644 index 0000000..a4646a5 --- /dev/null +++ b/Ix/System.Interactive/System.Interactive.csproj @@ -0,0 +1,41 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {8E4B04F0-915E-48F9-9796-76278C6094BD} + Library + Properties + System.Interactive + System.Interactive + v4.0 + 512 + true + + + + $(OutputPath)\$(AssemblyName).XML + + + Profile1 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix/Tests/App.cs b/Ix/Tests/App.cs new file mode 100644 index 0000000..3f27e96 --- /dev/null +++ b/Ix/Tests/App.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if SILVERLIGHT && !SILVERLIGHTM7 +using System; +using System.Diagnostics; +using System.Windows; +using System.Windows.Browser; +using Microsoft.Silverlight.Testing; + +namespace InteractiveTests +{ + public class App : Application + { + public App() + { + this.Startup += (o, e) => + { + // TODO: Investigate UnitTestSettings configuration of TestService and LogProviders. + // var settings = new UnitTestSettings { StartRunImmediately = true }; + RootVisual = UnitTestSystem.CreateTestPage(/* settings */); + }; + + this.UnhandledException += (o, e) => + { + if (!Debugger.IsAttached) + { + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); + } + }; + } + + private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Aggregates.cs b/Ix/Tests/AsyncTests.Aggregates.cs new file mode 100644 index 0000000..1e43178 --- /dev/null +++ b/Ix/Tests/AsyncTests.Aggregates.cs @@ -0,0 +1,2168 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections; +using System.Threading; + +namespace Tests +{ + public partial class AsyncTests + { + [TestMethod] + public void Aggregate_Null() + { + AssertThrows(() => AsyncEnumerable.Aggregate(null, (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null)); + + AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, z => z)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, z => z)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null)); + + AssertThrows(() => AsyncEnumerable.Aggregate(null, (x, y) => x + y, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, z => z, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, z => z, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null, CancellationToken.None)); + } + + [TestMethod] + public void Aggregate1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate((x, y) => x * y); + Assert.AreEqual(ys.Result, 24); + } + + [TestMethod] + public void Aggregate2() + { + var xs = new int[0].ToAsyncEnumerable(); + var ys = xs.Aggregate((x, y) => x * y); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Aggregate3() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Aggregate((x, y) => x * y); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate((x, y) => { throw ex; }); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate5() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => x * y); + Assert.AreEqual(ys.Result, 24); + } + + [TestMethod] + public void Aggregate6() + { + var xs = new int[0].ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => x * y); + Assert.AreEqual(ys.Result, 1); + } + + [TestMethod] + public void Aggregate7() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Aggregate(1, (x, y) => x * y); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate8() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => { throw ex; }); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate9() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); + Assert.AreEqual(ys.Result, 25); + } + + [TestMethod] + public void Aggregate10() + { + var xs = new int[0].ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); + Assert.AreEqual(ys.Result, 2); + } + + [TestMethod] + public void Aggregate11() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate12() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => { throw ex; }, x => x + 1); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Aggregate13() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Aggregate(1, (x, y) => x * y, x => { throw ex; }); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Count_Null() + { + AssertThrows(() => AsyncEnumerable.Count(null)); + AssertThrows(() => AsyncEnumerable.Count(null, x => true)); + AssertThrows(() => AsyncEnumerable.Count(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Count(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Count(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Count(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void Count1() + { + Assert.AreEqual(new int[0].ToAsyncEnumerable().Count().Result, 0); + Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().Count().Result, 3); + AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).Count().Wait()); + } + + [TestMethod] + public void Count2() + { + Assert.AreEqual(new int[0].ToAsyncEnumerable().Count(x => x < 3).Result, 0); + Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => x < 3).Result, 2); + AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).Count(x => x < 3).Wait()); + } + + [TestMethod] + public void Count3() + { + var ex = new Exception("Bang!"); + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => { throw ex; }); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void LongCount_Null() + { + AssertThrows(() => AsyncEnumerable.LongCount(null)); + AssertThrows(() => AsyncEnumerable.LongCount(null, x => true)); + AssertThrows(() => AsyncEnumerable.LongCount(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.LongCount(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.LongCount(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.LongCount(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void LongCount1() + { + Assert.AreEqual(new int[0].ToAsyncEnumerable().LongCount().Result, 0); + Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount().Result, 3); + AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).LongCount().Wait()); + } + + [TestMethod] + public void LongCount2() + { + Assert.AreEqual(new int[0].ToAsyncEnumerable().LongCount(x => x < 3).Result, 0); + Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => x < 3).Result, 2); + AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).LongCount(x => x < 3).Wait()); + } + + [TestMethod] + public void LongCount3() + { + var ex = new Exception("Bang!"); + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => { throw ex; }); + AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void All_Null() + { + AssertThrows(() => AsyncEnumerable.All(null, x => true)); + AssertThrows(() => AsyncEnumerable.All(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.All(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.All(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void All1() + { + var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void All2() + { + var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void All3() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).All(x => x % 2 == 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void All4() + { + var ex = new Exception("Bang!"); + var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => { throw ex; }); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Any_Null() + { + AssertThrows(() => AsyncEnumerable.Any(null)); + AssertThrows(() => AsyncEnumerable.Any(null, x => true)); + AssertThrows(() => AsyncEnumerable.Any(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Any(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Any(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Any(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void Any1() + { + var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any(x => x % 2 == 0); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void Any2() + { + var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => x % 2 != 0); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void Any3() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).Any(x => x % 2 == 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Any4() + { + var ex = new Exception("Bang!"); + var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => { throw ex; }); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Any5() + { + var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any(); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void Any6() + { + var res = new int[0].ToAsyncEnumerable().Any(); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void Contains_Null() + { + AssertThrows(() => AsyncEnumerable.Contains(null, 42)); + AssertThrows(() => AsyncEnumerable.Contains(null, 42, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Contains(AsyncEnumerable.Return(42), 42, null)); + + AssertThrows(() => AsyncEnumerable.Contains(null, 42, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Contains(null, 42, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Contains(AsyncEnumerable.Return(42), 42, null, CancellationToken.None)); + } + + [TestMethod] + public void Contains1() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); + var ys = xs.Contains(3); + Assert.IsTrue(ys.Result); + } + + [TestMethod] + public void Contains2() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); + var ys = xs.Contains(6); + Assert.IsFalse(ys.Result); + } + + [TestMethod] + public void Contains3() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); + var ys = xs.Contains(-3, new Eq()); + Assert.IsTrue(ys.Result); + } + + [TestMethod] + public void Contains4() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); + var ys = xs.Contains(-6, new Eq()); + Assert.IsFalse(ys.Result); + } + + class Eq : IEqualityComparer + { + public bool Equals(int x, int y) + { + return EqualityComparer.Default.Equals(Math.Abs(x), Math.Abs(y)); + } + + public int GetHashCode(int obj) + { + return EqualityComparer.Default.GetHashCode(Math.Abs(obj)); + } + } + + [TestMethod] + public void First_Null() + { + AssertThrows(() => AsyncEnumerable.First(null)); + AssertThrows(() => AsyncEnumerable.First(null, x => true)); + AssertThrows(() => AsyncEnumerable.First(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.First(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.First(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.First(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void First1() + { + var res = AsyncEnumerable.Empty().First(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void First2() + { + var res = AsyncEnumerable.Empty().First(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void First3() + { + var res = AsyncEnumerable.Return(42).First(x => x % 2 != 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void First4() + { + var res = AsyncEnumerable.Return(42).First(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void First5() + { + var res = AsyncEnumerable.Return(42).First(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void First6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).First(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void First7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).First(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void First8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void First9() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void FirstOrDefault_Null() + { + AssertThrows(() => AsyncEnumerable.FirstOrDefault(null)); + AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, x => true)); + AssertThrows(() => AsyncEnumerable.FirstOrDefault(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.FirstOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void FirstOrDefault1() + { + var res = AsyncEnumerable.Empty().FirstOrDefault(); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void FirstOrDefault2() + { + var res = AsyncEnumerable.Empty().FirstOrDefault(x => true); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void FirstOrDefault3() + { + var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 != 0); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void FirstOrDefault4() + { + var res = AsyncEnumerable.Return(42).FirstOrDefault(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void FirstOrDefault5() + { + var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void FirstOrDefault6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).FirstOrDefault(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void FirstOrDefault7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).FirstOrDefault(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void FirstOrDefault8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void FirstOrDefault9() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void FirstOrDefault10() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x < 10); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void Last_Null() + { + AssertThrows(() => AsyncEnumerable.Last(null)); + AssertThrows(() => AsyncEnumerable.Last(null, x => true)); + AssertThrows(() => AsyncEnumerable.Last(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Last(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Last(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Last(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void Last1() + { + var res = AsyncEnumerable.Empty().Last(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Last2() + { + var res = AsyncEnumerable.Empty().Last(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Last3() + { + var res = AsyncEnumerable.Return(42).Last(x => x % 2 != 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Last4() + { + var res = AsyncEnumerable.Return(42).Last(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void Last5() + { + var res = AsyncEnumerable.Return(42).Last(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void Last6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).Last(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Last7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).Last(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Last8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Last(); + Assert.AreEqual(90, res.Result); + } + + [TestMethod] + public void Last9() + { + var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Last(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void LastOrDefault_Null() + { + AssertThrows(() => AsyncEnumerable.LastOrDefault(null)); + AssertThrows(() => AsyncEnumerable.LastOrDefault(null, x => true)); + AssertThrows(() => AsyncEnumerable.LastOrDefault(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.LastOrDefault(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.LastOrDefault(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.LastOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void LastOrDefault1() + { + var res = AsyncEnumerable.Empty().LastOrDefault(); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void LastOrDefault2() + { + var res = AsyncEnumerable.Empty().LastOrDefault(x => true); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void LastOrDefault3() + { + var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 != 0); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void LastOrDefault4() + { + var res = AsyncEnumerable.Return(42).LastOrDefault(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void LastOrDefault5() + { + var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void LastOrDefault6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).LastOrDefault(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void LastOrDefault7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).LastOrDefault(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void LastOrDefault8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault(); + Assert.AreEqual(90, res.Result); + } + + [TestMethod] + public void LastOrDefault9() + { + var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void LastOrDefault10() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x < 10); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void Single_Null() + { + AssertThrows(() => AsyncEnumerable.Single(null)); + AssertThrows(() => AsyncEnumerable.Single(null, x => true)); + AssertThrows(() => AsyncEnumerable.Single(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Single(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Single(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Single(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void Single1() + { + var res = AsyncEnumerable.Empty().Single(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Single2() + { + var res = AsyncEnumerable.Empty().Single(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Single3() + { + var res = AsyncEnumerable.Return(42).Single(x => x % 2 != 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Single4() + { + var res = AsyncEnumerable.Return(42).Single(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void Single5() + { + var res = AsyncEnumerable.Return(42).Single(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void Single6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).Single(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Single7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).Single(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Single8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Single9() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void Single10() + { + var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void SingleOrDefault_Null() + { + AssertThrows(() => AsyncEnumerable.SingleOrDefault(null)); + AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, x => true)); + AssertThrows(() => AsyncEnumerable.SingleOrDefault(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, x => true, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.SingleOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void SingleOrDefault1() + { + var res = AsyncEnumerable.Empty().SingleOrDefault(); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void SingleOrDefault2() + { + var res = AsyncEnumerable.Empty().SingleOrDefault(x => true); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void SingleOrDefault3() + { + var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 != 0); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void SingleOrDefault4() + { + var res = AsyncEnumerable.Return(42).SingleOrDefault(); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void SingleOrDefault5() + { + var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 == 0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void SingleOrDefault6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).SingleOrDefault(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SingleOrDefault7() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).SingleOrDefault(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SingleOrDefault8() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void SingleOrDefault9() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x % 2 != 0); + Assert.AreEqual(45, res.Result); + } + + [TestMethod] + public void SingleOrDefault10() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x < 10); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void SingleOrDefault11() + { + var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => true); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void ElementAt_Null() + { + AssertThrows(() => AsyncEnumerable.ElementAt(null, 0)); + AssertThrows(() => AsyncEnumerable.ElementAt(AsyncEnumerable.Return(42), -1)); + + AssertThrows(() => AsyncEnumerable.ElementAt(null, 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ElementAt(AsyncEnumerable.Return(42), -1, CancellationToken.None)); + } + + [TestMethod] + public void ElementAt1() + { + var res = AsyncEnumerable.Empty().ElementAt(0); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); + } + + [TestMethod] + public void ElementAt2() + { + var res = AsyncEnumerable.Return(42).ElementAt(0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void ElementAt3() + { + var res = AsyncEnumerable.Return(42).ElementAt(1); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); + } + + [TestMethod] + public void ElementAt4() + { + var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(1); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void ElementAt5() + { + var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(7); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); + } + + [TestMethod] + public void ElementAt6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).ElementAt(15); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ElementAtOrDefault_Null() + { + AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(null, 0)); + AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(AsyncEnumerable.Return(42), -1)); + + AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(null, 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(AsyncEnumerable.Return(42), -1, CancellationToken.None)); + } + + [TestMethod] + public void ElementAtOrDefault1() + { + var res = AsyncEnumerable.Empty().ElementAtOrDefault(0); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void ElementAtOrDefault2() + { + var res = AsyncEnumerable.Return(42).ElementAtOrDefault(0); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void ElementAtOrDefault3() + { + var res = AsyncEnumerable.Return(42).ElementAtOrDefault(1); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void ElementAtOrDefault4() + { + var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(1); + Assert.AreEqual(42, res.Result); + } + + [TestMethod] + public void ElementAtOrDefault5() + { + var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(7); + Assert.AreEqual(0, res.Result); + } + + [TestMethod] + public void ElementAtOrDefault6() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).ElementAtOrDefault(15); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ToList_Null() + { + AssertThrows(() => AsyncEnumerable.ToList(null)); + AssertThrows(() => AsyncEnumerable.ToList(null, CancellationToken.None)); + } + + [TestMethod] + public void ToList1() + { + var xs = new[] { 42, 25, 39 }; + var res = xs.ToAsyncEnumerable().ToList(); + Assert.IsTrue(res.Result.SequenceEqual(xs)); + } + + [TestMethod] + public void ToList2() + { + var xs = AsyncEnumerable.Empty(); + var res = xs.ToList(); + Assert.IsTrue(res.Result.Count == 0); + } + + [TestMethod] + public void ToList3() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).ToList(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ToArray_Null() + { + AssertThrows(() => AsyncEnumerable.ToArray(null)); + AssertThrows(() => AsyncEnumerable.ToArray(null, CancellationToken.None)); + } + + [TestMethod] + public void ToArray1() + { + var xs = new[] { 42, 25, 39 }; + var res = xs.ToAsyncEnumerable().ToArray(); + Assert.IsTrue(res.Result.SequenceEqual(xs)); + } + + [TestMethod] + public void ToArray2() + { + var xs = AsyncEnumerable.Empty(); + var res = xs.ToArray(); + Assert.IsTrue(res.Result.Length == 0); + } + + [TestMethod] + public void ToArray3() + { + var ex = new Exception("Bang!"); + var res = AsyncEnumerable.Throw(ex).ToArray(); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ToDictionary_Null() + { + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None)); + } + + [TestMethod] + public void ToDictionary1() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToDictionary(x => x % 2).Result; + Assert.IsTrue(res[0] == 4); + Assert.IsTrue(res[1] == 1); + } + + [TestMethod] + public void ToDictionary2() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + AssertThrows(() => xs.ToDictionary(x => x % 2).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); + } + + [TestMethod] + public void ToDictionary3() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToDictionary(x => x % 2, x => x + 1).Result; + Assert.IsTrue(res[0] == 5); + Assert.IsTrue(res[1] == 2); + } + + [TestMethod] + public void ToDictionary4() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + AssertThrows(() => xs.ToDictionary(x => x % 2, x => x + 1).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); + } + + [TestMethod] + public void ToDictionary5() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToDictionary(x => x % 2, new Eq()).Result; + Assert.IsTrue(res[0] == 4); + Assert.IsTrue(res[1] == 1); + } + + [TestMethod] + public void ToDictionary6() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + AssertThrows(() => xs.ToDictionary(x => x % 2, new Eq()).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); + } + + [TestMethod] + public void ToDictionary7() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToDictionary(x => x % 2, x => x, new Eq()).Result; + Assert.IsTrue(res[0] == 4); + Assert.IsTrue(res[1] == 1); + } + + [TestMethod] + public void ToLookup_Null() + { + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, x => 0, null)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None)); + } + + [TestMethod] + public void ToLookup1() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(4)); + Assert.IsTrue(res[1].Contains(1)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup2() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(4)); + Assert.IsTrue(res[0].Contains(2)); + Assert.IsTrue(res[1].Contains(1)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup3() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2, x => x + 1).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(5)); + Assert.IsTrue(res[1].Contains(2)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup4() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2, x => x + 1).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(5)); + Assert.IsTrue(res[0].Contains(3)); + Assert.IsTrue(res[1].Contains(2)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup5() + { + var xs = new[] { 1, 4 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2, new Eq()).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(4)); + Assert.IsTrue(res[1].Contains(1)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup6() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2, new Eq()).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(4)); + Assert.IsTrue(res[0].Contains(2)); + Assert.IsTrue(res[1].Contains(1)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void ToLookup7() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2).Result; + foreach (var g in res) + Assert.IsTrue(g.Key == 0 || g.Key == 1); + } + + [TestMethod] + public void ToLookup8() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2).Result; + foreach (IGrouping g in (IEnumerable)res) + Assert.IsTrue(g.Key == 0 || g.Key == 1); + } + + [TestMethod] + public void ToLookup9() + { + var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); + var res = xs.ToLookup(x => x % 2, x => x, new Eq()).Result; + Assert.IsTrue(res.Contains(0)); + Assert.IsTrue(res.Contains(1)); + Assert.IsTrue(res[0].Contains(4)); + Assert.IsTrue(res[0].Contains(2)); + Assert.IsTrue(res[1].Contains(1)); + Assert.IsTrue(res.Count == 2); + } + + [TestMethod] + public void Average_Null() + { + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); + + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + } + + [TestMethod] + public void Average1() + { + var xs = new[] { 1, 2, 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average2() + { + var xs = new[] { 1, default(int?), 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average3() + { + var xs = new[] { 1L, 2L, 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average4() + { + var xs = new[] { 1L, default(long?), 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average5() + { + var xs = new[] { 1.0, 2.0, 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average6() + { + var xs = new[] { 1.0, default(double?), 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average7() + { + var xs = new[] { 1.0f, 2.0f, 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average8() + { + var xs = new[] { 1.0f, default(float?), 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average9() + { + var xs = new[] { 1.0m, 2.0m, 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average10() + { + var xs = new[] { 1.0m, default(decimal?), 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Average(), ys.Average().Result); + Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); + } + + [TestMethod] + public void Average11() + { + var xs = new int[0]; + var ys = xs.ToAsyncEnumerable(); + AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Average12() + { + var xs = new int?[0]; + var ys = xs.ToAsyncEnumerable(); + Assert.IsNull(ys.Average().Result); + } + + [TestMethod] + public void Average13() + { + var xs = new long[0]; + var ys = xs.ToAsyncEnumerable(); + AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Average14() + { + var xs = new long?[0]; + var ys = xs.ToAsyncEnumerable(); + Assert.IsNull(ys.Average().Result); + } + + [TestMethod] + public void Average15() + { + var xs = new double[0]; + var ys = xs.ToAsyncEnumerable(); + AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Average16() + { + var xs = new double?[0]; + var ys = xs.ToAsyncEnumerable(); + Assert.IsNull(ys.Average().Result); + } + + [TestMethod] + public void Average17() + { + var xs = new float[0]; + var ys = xs.ToAsyncEnumerable(); + AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Average18() + { + var xs = new float?[0]; + var ys = xs.ToAsyncEnumerable(); + Assert.IsNull(ys.Average().Result); + } + + [TestMethod] + public void Average19() + { + var xs = new decimal[0]; + var ys = xs.ToAsyncEnumerable(); + AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void Average20() + { + var xs = new decimal?[0]; + var ys = xs.ToAsyncEnumerable(); + Assert.IsNull(ys.Average().Result); + } + + [TestMethod] + public void Min_Null() + { + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), Comparer.Default)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(IComparer))); + + AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(IComparer), CancellationToken.None)); + } + + [TestMethod] + public void Min1() + { + var xs = new[] { 2, 1, 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min2() + { + var xs = new[] { 2, default(int?), 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min3() + { + var xs = new[] { 2L, 1L, 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min4() + { + var xs = new[] { 2L, default(long?), 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min5() + { + var xs = new[] { 2.0, 1.0, 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min6() + { + var xs = new[] { 2.0, default(double?), 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min7() + { + var xs = new[] { 2.0f, 1.0f, 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min8() + { + var xs = new[] { 2.0f, default(float?), 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min9() + { + var xs = new[] { 2.0m, 1.0m, 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min10() + { + var xs = new[] { 2.0m, default(decimal?), 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Min11() + { + var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Min(), ys.Min().Result); + Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); + } + + [TestMethod] + public void Max_Null() + { + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), Comparer.Default)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(IComparer))); + + AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(IComparer), CancellationToken.None)); + } + + [TestMethod] + public void Max1() + { + var xs = new[] { 2, 7, 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max2() + { + var xs = new[] { 2, default(int?), 3, 1 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max3() + { + var xs = new[] { 2L, 7L, 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max4() + { + var xs = new[] { 2L, default(long?), 3L, 1L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max5() + { + var xs = new[] { 2.0, 7.0, 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max6() + { + var xs = new[] { 2.0, default(double?), 3.0, 1.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max7() + { + var xs = new[] { 2.0f, 7.0f, 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max8() + { + var xs = new[] { 2.0f, default(float?), 3.0f, 1.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max9() + { + var xs = new[] { 2.0m, 7.0m, 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max10() + { + var xs = new[] { 2.0m, default(decimal?), 3.0m, 1.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Max11() + { + var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Max(), ys.Max().Result); + Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); + } + + [TestMethod] + public void Sum_Null() + { + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); + + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); + + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); + } + + [TestMethod] + public void Sum1() + { + var xs = new[] { 1, 2, 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum2() + { + var xs = new[] { 1, default(int?), 3 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum3() + { + var xs = new[] { 1L, 2L, 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum4() + { + var xs = new[] { 1L, default(long?), 3L }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum5() + { + var xs = new[] { 1.0, 2.0, 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum6() + { + var xs = new[] { 1.0, default(double?), 3.0 }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum7() + { + var xs = new[] { 1.0f, 2.0f, 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum8() + { + var xs = new[] { 1.0f, default(float?), 3.0f }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum9() + { + var xs = new[] { 1.0m, 2.0m, 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void Sum10() + { + var xs = new[] { 1.0m, default(decimal?), 3.0m }; + var ys = xs.ToAsyncEnumerable(); + Assert.AreEqual(xs.Sum(), ys.Sum().Result); + Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); + } + + [TestMethod] + public void MinBy_Null() + { + AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func))); + + AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default(IComparer))); + + AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default(IComparer), CancellationToken.None)); + } + + [TestMethod] + public void MinBy1() + { + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => x / 2); + var res = xs.Result; + + Assert.IsTrue(res.SequenceEqual(new[] { 3, 2 })); + } + + [TestMethod] + public void MinBy2() + { + var xs = new int[0].ToAsyncEnumerable().MinBy(x => x / 2); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void MinBy3() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 3) throw ex; return x; }); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void MinBy4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 4) throw ex; return x; }); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void MinBy5() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)).MinBy(x => x, Comparer.Default); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void MaxBy_Null() + { + AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func))); + + AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default(IComparer))); + + AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default(IComparer), CancellationToken.None)); + } + + [TestMethod] + public void MaxBy1() + { + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => x / 2); + var res = xs.Result; + + Assert.IsTrue(res.SequenceEqual(new[] { 7, 6 })); + } + + [TestMethod] + public void MaxBy2() + { + var xs = new int[0].ToAsyncEnumerable().MaxBy(x => x / 2); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); + } + + [TestMethod] + public void MaxBy3() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 3) throw ex; return x; }); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void MaxBy4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 4) throw ex; return x; }); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void MaxBy5() + { + var ex = new Exception("Bang!"); + var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)).MaxBy(x => x, Comparer.Default); + + AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Bugs.cs b/Ix/Tests/AsyncTests.Bugs.cs new file mode 100644 index 0000000..61ae7aa --- /dev/null +++ b/Ix/Tests/AsyncTests.Bugs.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections; +using System.Threading; +using System.Threading.Tasks; +using System.Diagnostics; +//using System.Reactive.Linq; +//using System.Reactive.Concurrency; + +namespace Tests +{ + public partial class AsyncTests + { + [TestInitialize] + public void InitTests() + { + TaskScheduler.UnobservedTaskException += (o, e) => + { + }; + } + + /* + [TestMethod] + public void TestPushPopAsync() + { + var stack = new Stack(); + var count = 10; + + var observable = Observable.Generate( + 0, + i => i < count, + i => i + 1, + i => i, + i => TimeSpan.FromMilliseconds(1), // change this to 0 to avoid the problem [1] + Scheduler.ThreadPool); + + var task = DoSomethingAsync(observable, stack); + + // we give it a timeout so the test can fail instead of hang + task.Wait(TimeSpan.FromSeconds(2)); + + Assert.AreEqual(10, stack.Count); + } + + private Task DoSomethingAsync(IObservable observable, Stack stack) + { + var ae = observable + .ToAsyncEnumerable() + //.Do(i => Debug.WriteLine("Bug-fixing side effect: " + i)) // [2] + .GetEnumerator(); + + var tcs = new TaskCompletionSource(); + + var a = default(Action); + a = new Action(() => + { + ae.MoveNext().ContinueWith(t => + { + if (t.Result) + { + var i = ae.Current; + Debug.WriteLine("Doing something with " + i); + Thread.Sleep(50); + stack.Push(i); + a(); + } + else + tcs.TrySetResult(null); + }); + }); + + a(); + + return tcs.Task; + } + */ + + static IEnumerable Xs(Action a) + { + try + { + var rnd = new Random(); + + while (true) + { + yield return rnd.Next(0, 43); + Thread.Sleep(rnd.Next(0, 500)); + } + } + finally + { + a(); + } + } + + [TestMethod] + public void CorrectDispose() + { + var disposed = false; + + var xs = new[] { 1, 2, 3 }.WithDispose(() => + { + disposed = true; + }).ToAsyncEnumerable(); + + var ys = xs.Select(x => x + 1); + + var e = ys.GetEnumerator(); + e.Dispose(); + + Assert.IsTrue(disposed); + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void DisposesUponError() + { + var disposed = false; + + var xs = new[] { 1, 2, 3 }.WithDispose(() => + { + disposed = true; + }).ToAsyncEnumerable(); + + var ex = new Exception("Bang!"); + var ys = xs.Select(x => { if (x == 1) throw ex; return x; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext()); + + Assert.IsTrue(disposed); + } + + [TestMethod] + public void CorrectCancel() + { + var disposed = false; + + var xs = new[] { 1, 2, 3 }.WithDispose(() => + { + disposed = true; + }).ToAsyncEnumerable(); + + var ys = xs.Select(x => x + 1).Where(x => true); + + var e = ys.GetEnumerator(); + var cts = new CancellationTokenSource(); + var t = e.MoveNext(cts.Token); + + cts.Cancel(); + + try + { + t.Wait(); + } + catch + { + // Don't care about the outcome; we could have made it to element 1 + // but we could also have cancelled the MoveNext-calling task. Either + // way, we want to wait for the task to be completed and check that + } + finally + { + // the cancellation bubbled all the way up to the source to dispose + // it. This design is chosen because cancelling a MoveNext call leaves + // the enumerator in an indeterminate state. Further interactions with + // it should be forbidden. + Assert.IsTrue(disposed); + } + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void CanCancelMoveNext() + { + var evt = new ManualResetEvent(false); + var xs = Blocking(evt).ToAsyncEnumerable().Select(x => x).Where(x => true); + + var e = xs.GetEnumerator(); + var cts = new CancellationTokenSource(); + var t = e.MoveNext(cts.Token); + + cts.Cancel(); + + try + { + t.Wait(); + Assert.Fail(); + } + catch + { + Assert.IsTrue(t.IsCanceled); + } + + evt.Set(); + } + + static IEnumerable Blocking(ManualResetEvent evt) + { + evt.WaitOne(); + yield return 42; + } + } + + static class MyExt + { + public static IEnumerable WithDispose(this IEnumerable source, Action a) + { + return EnumerableEx.Create(() => + { + var e = source.GetEnumerator(); + return new Enumerator(e.MoveNext, () => e.Current, () => { e.Dispose(); a(); }); + }); + } + + class Enumerator : IEnumerator + { + private readonly Func _moveNext; + private readonly Func _current; + private readonly Action _dispose; + + public Enumerator(Func moveNext, Func current, Action dispose) + { + _moveNext = moveNext; + _current = current; + _dispose = dispose; + } + + public T Current + { + get { return _current(); } + } + + public void Dispose() + { + _dispose(); + } + + object IEnumerator.Current + { + get { return Current; } + } + + public bool MoveNext() + { + return _moveNext(); + } + + public void Reset() + { + throw new NotImplementedException(); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Conversions.cs b/Ix/Tests/AsyncTests.Conversions.cs new file mode 100644 index 0000000..1c1c2a2 --- /dev/null +++ b/Ix/Tests/AsyncTests.Conversions.cs @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; + +namespace Tests +{ + public partial class AsyncTests + { + [TestMethod] + public void ToAsyncEnumerable_Null() + { + AssertThrows(() => AsyncEnumerable.ToAsyncEnumerable(default(IEnumerable))); + AssertThrows(() => AsyncEnumerable.ToAsyncEnumerable(default(IObservable))); + } + + [TestMethod] + public void ToAsyncEnumerable1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void ToAsyncEnumerable2() + { + var ex = new Exception("Bang"); + var xs = ToAsyncEnumerable_Sequence(ex).ToAsyncEnumerable(); + var e = xs.GetEnumerator(); + HasNext(e, 42); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + + private IEnumerable ToAsyncEnumerable_Sequence(Exception e) + { + yield return 42; + throw e; + } + + [TestMethod] + public void ToAsyncEnumerable3() + { + var subscribed = false; + + var xs = new MyObservable(obs => + { + subscribed = true; + + obs.OnNext(42); + obs.OnCompleted(); + + return new MyDisposable(() => { }); + }).ToAsyncEnumerable(); + + Assert.IsFalse(subscribed); + + var e = xs.GetEnumerator(); + + Assert.IsTrue(subscribed); + + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void ToAsyncEnumerable4() + { + var ex = new Exception("Bang!"); + var subscribed = false; + + var xs = new MyObservable(obs => + { + subscribed = true; + + obs.OnError(ex); + + return new MyDisposable(() => { }); + }).ToAsyncEnumerable(); + + Assert.IsFalse(subscribed); + + var e = xs.GetEnumerator(); + + Assert.IsTrue(subscribed); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + + class MyObservable : IObservable + { + private Func, IDisposable> _subscribe; + + public MyObservable(Func, IDisposable> subscribe) + { + _subscribe = subscribe; + } + + public IDisposable Subscribe(IObserver observer) + { + return _subscribe(observer); + } + } + + class MyDisposable : IDisposable + { + private Action _dispose; + + public MyDisposable(Action dispose) + { + _dispose = dispose; + } + + public void Dispose() + { + _dispose(); + } + } + + [TestMethod] + public void ToEnumerable_Null() + { + AssertThrows(() => AsyncEnumerable.ToEnumerable(null)); + } + + [TestMethod] + public void ToEnumerable1() + { + var xs = AsyncEnumerable.Return(42).ToEnumerable(); + Assert.IsTrue(xs.SequenceEqual(new[] { 42 })); + } + + [TestMethod] + public void ToEnumerable2() + { + var xs = AsyncEnumerable.Empty().ToEnumerable(); + Assert.IsTrue(xs.SequenceEqual(new int[0])); + } + + [TestMethod] + public void ToEnumerable3() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex).ToEnumerable(); + AssertThrows(() => xs.GetEnumerator().MoveNext(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + +#if !NO_RXINTERFACES + [TestMethod] + public void ToObservable_Null() + { + AssertThrows(() => AsyncEnumerable.ToObservable(null)); + } + + [TestMethod] + public void ToObservable1() + { + var fail = false; + var evt = new ManualResetEvent(false); + + var xs = AsyncEnumerable.Empty().ToObservable(); + xs.Subscribe(new MyObserver( + x => + { + fail = true; + }, + ex => + { + fail = true; + evt.Set(); + }, + () => + { + evt.Set(); + } + )); + + evt.WaitOne(); + Assert.IsFalse(fail); + } + + [TestMethod] + public void ToObservable2() + { + var lst = new List(); + var fail = false; + var evt = new ManualResetEvent(false); + + var xs = AsyncEnumerable.Return(42).ToObservable(); + xs.Subscribe(new MyObserver( + x => + { + lst.Add(x); + }, + ex => + { + fail = true; + evt.Set(); + }, + () => + { + evt.Set(); + } + )); + + evt.WaitOne(); + Assert.IsFalse(fail); + Assert.IsTrue(lst.SequenceEqual(new[] { 42 })); + } + + [TestMethod] + public void ToObservable3() + { + var lst = new List(); + var fail = false; + var evt = new ManualResetEvent(false); + + var xs = AsyncEnumerable.Range(0, 10).ToObservable(); + xs.Subscribe(new MyObserver( + x => + { + lst.Add(x); + }, + ex => + { + fail = true; + evt.Set(); + }, + () => + { + evt.Set(); + } + )); + + evt.WaitOne(); + Assert.IsFalse(fail); + Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10))); + } + + [TestMethod] + public void ToObservable4() + { + var ex1 = new Exception("Bang!"); + var ex_ = default(Exception); + var fail = false; + var evt = new ManualResetEvent(false); + + var xs = AsyncEnumerable.Throw(ex1).ToObservable(); + xs.Subscribe(new MyObserver( + x => + { + fail = true; + }, + ex => + { + ex_ = ex; + evt.Set(); + }, + () => + { + fail = true; + evt.Set(); + } + )); + + evt.WaitOne(); + Assert.IsFalse(fail); + Assert.AreEqual(ex1, ((AggregateException)ex_).InnerExceptions.Single()); + } + + class MyObserver : IObserver + { + private Action _onNext; + private Action _onError; + private Action _onCompleted; + + public MyObserver(Action onNext, Action onError, Action onCompleted) + { + _onNext = onNext; + _onError = onError; + _onCompleted = onCompleted; + } + + public void OnCompleted() + { + _onCompleted(); + } + + public void OnError(Exception error) + { + _onError(error); + } + + public void OnNext(T value) + { + _onNext(value); + } + } +#endif + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Creation.cs b/Ix/Tests/AsyncTests.Creation.cs new file mode 100644 index 0000000..32e849a --- /dev/null +++ b/Ix/Tests/AsyncTests.Creation.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading.Tasks; +using System.Threading; + +namespace Tests +{ + static class Ext + { + public static Task MoveNext(this IAsyncEnumerator enumerator) + { + return enumerator.MoveNext(CancellationToken.None); + } + } + + public partial class AsyncTests + { + [TestMethod] + public void Return() + { + var xs = AsyncEnumerable.Return(42); + HasNext(xs.GetEnumerator(), 42); + } + + [TestMethod] + public void Never() + { + var xs = AsyncEnumerable.Never(); + + var e = xs.GetEnumerator(); + Assert.IsFalse(e.MoveNext().IsCompleted); // Very rudimentary check + AssertThrows(() => Nop(e.Current)); + e.Dispose(); + } + + [TestMethod] + public void Empty1() + { + var xs = AsyncEnumerable.Empty(); + NoNext(xs.GetEnumerator()); + } + + [TestMethod] + public void Empty2() + { + var xs = AsyncEnumerable.Empty(); + + var e = xs.GetEnumerator(); + Assert.IsFalse(e.MoveNext().Result); + AssertThrows(() => Nop(e.Current)); + } + + [TestMethod] + public void Throw_Null() + { + AssertThrows(() => AsyncEnumerable.Throw(null)); + } + + [TestMethod] + public void Throw() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + AssertThrows(() => Nop(e.Current)); + } + + private void Nop(object o) + { + } + + [TestMethod] + public void Range_Null() + { + AssertThrows(() => AsyncEnumerable.Range(0, -1)); + } + + [TestMethod] + public void Range1() + { + var xs = AsyncEnumerable.Range(2, 5); + + var e = xs.GetEnumerator(); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Range2() + { + var xs = AsyncEnumerable.Range(2, 0); + + var e = xs.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Repeat_Null() + { + AssertThrows(() => AsyncEnumerable.Repeat(0, -1)); + } + + [TestMethod] + public void Repeat1() + { + var xs = AsyncEnumerable.Repeat(2, 5); + + var e = xs.GetEnumerator(); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void Repeat2() + { + var xs = AsyncEnumerable.Repeat(2, 0); + + var e = xs.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Repeat3() + { + var xs = AsyncEnumerable.Repeat(2); + + var e = xs.GetEnumerator(); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 2); + e.Dispose(); + } + + [TestMethod] + public void Defer_Null() + { + AssertThrows(() => AsyncEnumerable.Defer(null)); + } + + [TestMethod] + public void Defer1() + { + var x = 0; + var xs = AsyncEnumerable.Defer(() => new[] { x }.ToAsyncEnumerable()); + + { + var e = xs.GetEnumerator(); + HasNext(e, 0); + NoNext(e); + } + + { + x++; + var e = xs.GetEnumerator(); + HasNext(e, 1); + NoNext(e); + } + } + + [TestMethod] + public void Generate_Null() + { + AssertThrows(() => AsyncEnumerable.Generate(0, null, x => x, x => x)); + AssertThrows(() => AsyncEnumerable.Generate(0, x => true, null, x => x)); + AssertThrows(() => AsyncEnumerable.Generate(0, x => true, x => x, null)); + } + + [TestMethod] + public void Generate1() + { + var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x); + + var e = xs.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 1); + HasNext(e, 4); + HasNext(e, 9); + HasNext(e, 16); + NoNext(e); + e.Dispose(); + } + + [TestMethod] + public void Generate2() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Generate(0, x => { throw ex; }, x => x + 1, x => x * x); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Generate3() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Generate(0, x => true, x => x + 1, x => { if (x == 1) throw ex; return x * x; }); + + var e = xs.GetEnumerator(); + HasNext(e, 0); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Generate4() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Generate(0, x => true, x => { throw ex; }, x => x * x); + + var e = xs.GetEnumerator(); + HasNext(e, 0); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Using_Null() + { + AssertThrows(() => AsyncEnumerable.Using(null, _ => null)); + AssertThrows(() => AsyncEnumerable.Using(() => new MyD(null), null)); + } + + [TestMethod] + public void Using1() + { + var i = 0; + var d = 0; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { d++; }); + }, + _ => AsyncEnumerable.Return(42) + ); + + Assert.AreEqual(0, i); + + var e = xs.GetEnumerator(); + Assert.AreEqual(1, i); + } + + [TestMethod] + public void Using2() + { + var i = 0; + var d = 0; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { d++; }); + }, + _ => AsyncEnumerable.Return(42) + ); + + Assert.AreEqual(0, i); + + var e = xs.GetEnumerator(); + Assert.AreEqual(1, i); + + e.Dispose(); + Assert.AreEqual(1, d); + } + + [TestMethod] + public void Using3() + { + var ex = new Exception("Bang!"); + var i = 0; + var d = 0; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { d++; }); + }, + _ => { throw ex; } + ); + + Assert.AreEqual(0, i); + + AssertThrows(() => xs.GetEnumerator(), ex_ => ex_ == ex); + + Assert.AreEqual(1, d); + } + + [TestMethod] + public void Using4() + { + var i = 0; + var disposed = false; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { disposed = true; }); + }, + _ => AsyncEnumerable.Return(42) + ); + + Assert.AreEqual(0, i); + + var e = xs.GetEnumerator(); + Assert.AreEqual(1, i); + + HasNext(e, 42); + NoNext(e); + + Assert.IsTrue(disposed); + } + + [TestMethod] + public void Using5() + { + var ex = new Exception("Bang!"); + var i = 0; + var disposed = false; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { disposed = true; }); + }, + _ => AsyncEnumerable.Throw(ex) + ); + + Assert.AreEqual(0, i); + + var e = xs.GetEnumerator(); + Assert.AreEqual(1, i); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + + Assert.IsTrue(disposed); + } + + [TestMethod] + public void Using6() + { + var i = 0; + var disposed = false; + + var xs = AsyncEnumerable.Using( + () => + { + i++; + return new MyD(() => { disposed = true; }); + }, + _ => AsyncEnumerable.Range(0, 10) + ); + + Assert.AreEqual(0, i); + + var e = xs.GetEnumerator(); + Assert.AreEqual(1, i); + + HasNext(e, 0); + HasNext(e, 1); + + var cts = new CancellationTokenSource(); + var t = e.MoveNext(cts.Token); + cts.Cancel(); + + t.Wait(); + + Assert.IsTrue(disposed); + } + + class MyD : IDisposable + { + private readonly Action _dispose; + + public MyD(Action dispose) + { + _dispose = dispose; + } + + public void Dispose() + { + _dispose(); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Exceptions.cs b/Ix/Tests/AsyncTests.Exceptions.cs new file mode 100644 index 0000000..f7c8a8f --- /dev/null +++ b/Ix/Tests/AsyncTests.Exceptions.cs @@ -0,0 +1,551 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; + +namespace Tests +{ + public partial class AsyncTests + { + [TestMethod] + public void Catch_Null() + { + AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable), x => null)); + AssertThrows(() => AsyncEnumerable.Catch(AsyncEnumerable.Return(42), default(Func>))); + + AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.Catch(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable[]))); + AssertThrows(() => AsyncEnumerable.Catch(default(IEnumerable>))); + } + + [TestMethod] + public void Catch1() + { + var err = false; + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = xs.Catch(ex_ => { err = true; return ys; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + NoNext(e); + + Assert.IsFalse(err); + } + + [TestMethod] + public void Catch2() + { + var ex = new InvalidOperationException("Bang!"); + + var err = false; + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = xs.Catch(ex_ => { err = true; return ys; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + Assert.IsFalse(err); + + HasNext(e, 4); + + Assert.IsTrue(err); + + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Catch3() + { + var ex = new InvalidOperationException("Bang!"); + + var err = false; + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = xs.Catch(ex_ => { err = true; return ys; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + Assert.IsFalse(err); + + HasNext(e, 4); + + Assert.IsTrue(err); + + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Catch4() + { + var ex = new DivideByZeroException(); + + var err = false; + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = xs.Catch(ex_ => { err = true; return ys; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + + Assert.IsFalse(err); + } + + [TestMethod] + public void Catch5() + { + var ex = new InvalidOperationException("Bang!"); + var ex2 = new Exception("Oops!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = xs.Catch(ex_ => { if (ex_.Message == "Bang!") throw ex2; return ys; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex2); + } + + [TestMethod] + public void Catch6() + { + var ex = new InvalidOperationException("Bang!"); + + var err = false; + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + + var res = xs.Catch(ex_ => { err = true; return xs; }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + Assert.IsFalse(err); + + HasNext(e, 1); + + Assert.IsTrue(err); + + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Catch7() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.Catch(xs, ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + NoNext(e); + } + + [TestMethod] + public void Catch8() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.Catch(xs, ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Catch9() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.Catch(new[] { xs, xs, ys, ys }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Catch10() + { + var res = CatchXss().Catch(); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + } + + private IEnumerable> CatchXss() + { + yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(new Exception("!!!"))); + throw new Exception("Bang!"); + } + + [TestMethod] + public void Catch11() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + + var res = AsyncEnumerable.Catch(new[] { xs, xs }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Catch12() + { + var res = AsyncEnumerable.Catch(Enumerable.Empty>()); + + var e = res.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Finally_Null() + { + AssertThrows(() => AsyncEnumerable.Finally(default(IAsyncEnumerable), () => { })); + AssertThrows(() => AsyncEnumerable.Finally(AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Finally1() + { + var b = false; + + var xs = AsyncEnumerable.Empty().Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + Assert.IsFalse(b); + NoNext(e); + + Assert.IsTrue(b); + } + + [TestMethod] + public void Finally2() + { + var b = false; + + var xs = AsyncEnumerable.Return(42).Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + Assert.IsFalse(b); + HasNext(e, 42); + + Assert.IsFalse(b); + NoNext(e); + + Assert.IsTrue(b); + } + + [TestMethod] + public void Finally3() + { + var ex = new Exception("Bang!"); + + var b = false; + + var xs = AsyncEnumerable.Throw(ex).Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + Assert.IsFalse(b); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + + Assert.IsTrue(b); + } + + [TestMethod] + public void Finally4() + { + var b = false; + + var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + Assert.IsFalse(b); + HasNext(e, 1); + + Assert.IsFalse(b); + HasNext(e, 2); + + Assert.IsFalse(b); + NoNext(e); + + Assert.IsTrue(b); + } + + [TestMethod] + public void Finally5() + { + var b = false; + + var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + Assert.IsFalse(b); + HasNext(e, 1); + + e.Dispose(); + + Assert.IsTrue(b); + } + + [TestMethod] + public void Finally6() + { + var b = false; + + var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); + + var e = xs.GetEnumerator(); + + var cts = new CancellationTokenSource(); + + var t = e.MoveNext(cts.Token); + cts.Cancel(); + t.Wait(); + + Assert.IsTrue(b); + } + + [TestMethod] + public void OnErrorResumeNext_Null() + { + AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IAsyncEnumerable[]))); + AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IEnumerable>))); + } + + [TestMethod] + public void OnErrorResumeNext7() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.OnErrorResumeNext(xs, ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void OnErrorResumeNext8() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.OnErrorResumeNext(xs, ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void OnErrorResumeNext9() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs, ys, ys }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void OnErrorResumeNext10() + { + var res = OnErrorResumeNextXss().OnErrorResumeNext(); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + } + + private IEnumerable> OnErrorResumeNextXss() + { + yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(new Exception("!!!"))); + throw new Exception("Bang!"); + } + + [TestMethod] + public void OnErrorResumeNext11() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + + var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs }); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + NoNext(e); + } + + [TestMethod] + public void OnErrorResumeNext12() + { + var res = AsyncEnumerable.OnErrorResumeNext(Enumerable.Empty>()); + + var e = res.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Retry_Null() + { + AssertThrows(() => AsyncEnumerable.Retry(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.Retry(default(IAsyncEnumerable), 1)); + AssertThrows(() => AsyncEnumerable.Retry(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void Retry1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + + var res = xs.Retry(); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + NoNext(e); + } + + [TestMethod] + public void Retry2() + { + var ex = new InvalidOperationException("Bang!"); + + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + + var res = xs.Retry(); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Multiple.cs b/Ix/Tests/AsyncTests.Multiple.cs new file mode 100644 index 0000000..1ddd56f --- /dev/null +++ b/Ix/Tests/AsyncTests.Multiple.cs @@ -0,0 +1,787 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; + +namespace Tests +{ + public partial class AsyncTests + { + [TestMethod] + public void Concat_Null() + { + AssertThrows(() => AsyncEnumerable.Concat(null, AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.Concat(AsyncEnumerable.Return(42), null)); + AssertThrows(() => AsyncEnumerable.Concat(default(IAsyncEnumerable[]))); + AssertThrows(() => AsyncEnumerable.Concat(default(IEnumerable>))); + } + + [TestMethod] + public void Concat1() + { + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Concat2() + { + var ex = new Exception("Bang"); + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Concat3() + { + var ex = new Exception("Bang"); + var ys = AsyncEnumerable.Throw(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Concat4() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5 }.ToAsyncEnumerable(); + var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable(); + + var res = AsyncEnumerable.Concat(xs, ys, zs); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + HasNext(e, 7); + HasNext(e, 8); + NoNext(e); + } + + [TestMethod] + public void Concat5() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5 }.ToAsyncEnumerable(); + var zs = AsyncEnumerable.Throw(ex); + + var res = AsyncEnumerable.Concat(xs, ys, zs); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Concat6() + { + var res = AsyncEnumerable.Concat(ConcatXss()); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + } + + static IEnumerable> ConcatXss() + { + yield return new[] { 1, 2, 3 }.ToAsyncEnumerable(); + yield return new[] { 4, 5 }.ToAsyncEnumerable(); + throw new Exception("Bang!"); + } + + [TestMethod] + public void Zip_Null() + { + AssertThrows(() => AsyncEnumerable.Zip(null, AsyncEnumerable.Return(42), (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Zip(AsyncEnumerable.Return(42), null, (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Zip(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Zip1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + var res = xs.Zip(ys, (x, y) => x * y); + + var e = res.GetEnumerator(); + HasNext(e, 1 * 4); + HasNext(e, 2 * 5); + HasNext(e, 3 * 6); + NoNext(e); + } + + [TestMethod] + public void Zip2() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6, 7 }.ToAsyncEnumerable(); + var res = xs.Zip(ys, (x, y) => x * y); + + var e = res.GetEnumerator(); + HasNext(e, 1 * 4); + HasNext(e, 2 * 5); + HasNext(e, 3 * 6); + NoNext(e); + } + + [TestMethod] + public void Zip3() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); + var res = xs.Zip(ys, (x, y) => x * y); + + var e = res.GetEnumerator(); + HasNext(e, 1 * 4); + HasNext(e, 2 * 5); + HasNext(e, 3 * 6); + NoNext(e); + } + + [TestMethod] + public void Zip4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = AsyncEnumerable.Throw(ex); + var res = xs.Zip(ys, (x, y) => x * y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Zip5() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.Zip(ys, (x, y) => x * y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Zip6() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.Zip(ys, (x, y) => { if (x > 0) throw ex; return x * y; }); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Union_Null() + { + AssertThrows(() => AsyncEnumerable.Union(null, AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Union(null, AsyncEnumerable.Return(42), new Eq())); + AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), null, new Eq())); + AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Union1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); + var res = xs.Union(ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 5); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Union2() + { + var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); + var res = xs.Union(ys, new Eq()); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, -3); + HasNext(e, 5); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Intersect_Null() + { + AssertThrows(() => AsyncEnumerable.Intersect(null, AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Intersect(null, AsyncEnumerable.Return(42), new Eq())); + AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), null, new Eq())); + AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Intersect1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); + var res = xs.Intersect(ys); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 3); + NoNext(e); + } + + [TestMethod] + public void Intersect2() + { + var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); + var res = xs.Intersect(ys, new Eq()); + + var e = res.GetEnumerator(); + HasNext(e, 1); + HasNext(e, -3); + NoNext(e); + } + + [TestMethod] + public void Except_Null() + { + AssertThrows(() => AsyncEnumerable.Except(null, AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Except(null, AsyncEnumerable.Return(42), new Eq())); + AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), null, new Eq())); + AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Except1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); + var res = xs.Except(ys); + + var e = res.GetEnumerator(); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void Except2() + { + var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); + var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); + var res = xs.Except(ys, new Eq()); + + var e = res.GetEnumerator(); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void SequenceEqual_Null() + { + AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), new Eq())); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, new Eq())); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, CancellationToken.None)); + + AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), new Eq(), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, new Eq(), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, CancellationToken.None)); + } + + [TestMethod] + public void SequenceEqual1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(xs); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void SequenceEqual2() + { + var xs = AsyncEnumerable.Empty(); + var res = xs.SequenceEqual(xs); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void SequenceEqual3() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual4() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual5() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual6() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = AsyncEnumerable.Throw(ex); + var res = xs.SequenceEqual(ys); + + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SequenceEqual7() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys); + + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SequenceEqual8() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(xs, new Eq()); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void SequenceEqual9() + { + var xs = AsyncEnumerable.Empty(); + var res = xs.SequenceEqual(xs, new Eq()); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void SequenceEqual10() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new Eq()); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual11() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new Eq()); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual12() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new Eq()); + Assert.IsFalse(res.Result); + } + + [TestMethod] + public void SequenceEqual13() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = AsyncEnumerable.Throw(ex); + var res = xs.SequenceEqual(ys, new Eq()); + + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SequenceEqual14() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new Eq()); + + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SequenceEqual15() + { + var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new Eq()); + Assert.IsTrue(res.Result); + } + + [TestMethod] + public void SequenceEqual16() + { + var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable(); + var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable(); + var res = xs.SequenceEqual(ys, new EqEx()); + AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); + } + + class EqEx : IEqualityComparer + { + public bool Equals(int x, int y) + { + throw new NotImplementedException(); + } + + public int GetHashCode(int obj) + { + throw new NotImplementedException(); + } + } + + [TestMethod] + public void GroupJoin_Null() + { + AssertThrows(() => AsyncEnumerable.GroupJoin(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null)); + + AssertThrows(() => AsyncEnumerable.GroupJoin(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default(IEqualityComparer))); + } + + [TestMethod] + public void GroupJoin1() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 4, 7, 6, 2, 3, 4, 8, 9 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + HasNext(e, "0 - 639"); + HasNext(e, "1 - 474"); + HasNext(e, "2 - 28"); + NoNext(e); + } + + [TestMethod] + public void GroupJoin2() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + HasNext(e, "0 - 36"); + HasNext(e, "1 - 4"); + HasNext(e, "2 - "); + NoNext(e); + } + + [TestMethod] + public void GroupJoin3() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupJoin4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = AsyncEnumerable.Throw(ex); + + var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupJoin5() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => { throw ex; }, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupJoin6() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => x % 3, y => { throw ex; }, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupJoin7() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => { + if (x == 1) + throw ex; + return x + " - " + i.Aggregate("", (s, j) => s + j).Result; + }); + + var e = res.GetEnumerator(); + HasNext(e, "0 - 36"); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Join_Null() + { + AssertThrows(() => AsyncEnumerable.Join(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null)); + + AssertThrows(() => AsyncEnumerable.Join(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default(IEqualityComparer))); + } + + [TestMethod] + public void Join1() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + HasNext(e, 0 + 3); + HasNext(e, 0 + 6); + HasNext(e, 1 + 4); + NoNext(e); + } + + [TestMethod] + public void Join2() + { + var xs = new[] { 3, 6, 4 }.ToAsyncEnumerable(); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + HasNext(e, 3 + 0); + HasNext(e, 6 + 0); + HasNext(e, 4 + 1); + NoNext(e); + } + + [TestMethod] + public void Join3() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 6 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + HasNext(e, 0 + 3); + HasNext(e, 0 + 6); + NoNext(e); + } + + [TestMethod] + public void Join4() + { + var xs = new[] { 3, 6 }.ToAsyncEnumerable(); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + HasNext(e, 3 + 0); + HasNext(e, 6 + 0); + NoNext(e); + } + + [TestMethod] + public void Join5() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Join6() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = AsyncEnumerable.Throw(ex); + + var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Join7() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => { throw ex; }, y => y, (x, y) => x + y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Join8() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x, y => { throw ex; }, (x, y) => x + y); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Join9() + { + var ex = new Exception("Bang!"); + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + + var res = xs.Join(ys, x => x, y => y, (x, y) => { throw ex; }); + + var e = res.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectManyMultiple_Null() + { + AssertThrows(() => AsyncEnumerable.SelectMany(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); + } + + [TestMethod] + public void SelectManyMultiple1() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = new[] { 3, 4 }.ToAsyncEnumerable(); + + var res = xs.SelectMany(ys); + + var e = res.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Single.cs b/Ix/Tests/AsyncTests.Single.cs new file mode 100644 index 0000000..409f48a --- /dev/null +++ b/Ix/Tests/AsyncTests.Single.cs @@ -0,0 +1,2455 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Threading; + +namespace Tests +{ + public partial class AsyncTests + { + [TestMethod] + public void Select_Null() + { + AssertThrows(() => AsyncEnumerable.Select(null, x => x)); + AssertThrows(() => AsyncEnumerable.Select(null, (x, i) => x)); + AssertThrows(() => AsyncEnumerable.Select(AsyncEnumerable.Return(42), default(Func))); + AssertThrows(() => AsyncEnumerable.Select(AsyncEnumerable.Return(42), default(Func))); + } + + [TestMethod] + public void Select1() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = xs.Select(x => (char)('a' + x)); + + var e = ys.GetEnumerator(); + HasNext(e, 'a'); + HasNext(e, 'b'); + HasNext(e, 'c'); + NoNext(e); + } + + [TestMethod] + public void Select2() + { + var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable(); + var ys = xs.Select((x, i) => (char)('a' + i)); + + var e = ys.GetEnumerator(); + HasNext(e, 'a'); + HasNext(e, 'b'); + HasNext(e, 'c'); + NoNext(e); + } + + [TestMethod] + public void Select3() + { + var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); + var ys = xs.Select(x => 1 / x); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException); + } + + [TestMethod] + public void Select4() + { + var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable(); + var ys = xs.Select((x, i) => 1 / i); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException); + } + + [TestMethod] + public void Where_Null() + { + AssertThrows(() => AsyncEnumerable.Where(null, x => true)); + AssertThrows(() => AsyncEnumerable.Where(null, (x, i) => true)); + AssertThrows(() => AsyncEnumerable.Where(AsyncEnumerable.Return(42), default(Func))); + AssertThrows(() => AsyncEnumerable.Where(AsyncEnumerable.Return(42), default(Func))); + } + + [TestMethod] + public void Where1() + { + var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); + var ys = xs.Where(x => x % 2 == 0); + var e = ys.GetEnumerator(); + HasNext(e, 8); + HasNext(e, 4); + HasNext(e, 6); + HasNext(e, 2); + HasNext(e, 0); + NoNext(e); + } + + [TestMethod] + public void Where2() + { + var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); + var ys = xs.Where((x, i) => i % 2 == 0); + + var e = ys.GetEnumerator(); + HasNext(e, 8); + HasNext(e, 7); + HasNext(e, 6); + HasNext(e, 2); + HasNext(e, 0); + NoNext(e); + } + + [TestMethod] + public void Where3() + { + var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); + var ex = new Exception("Bang"); + var ys = xs.Where(x => { if (x == 4) throw ex; return true; }); + + var e = ys.GetEnumerator(); + HasNext(e, 8); + HasNext(e, 5); + HasNext(e, 7); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Where4() + { + var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); + var ex = new Exception("Bang"); + var ys = xs.Where((x, i) => { if (i == 3) throw ex; return true; }); + + var e = ys.GetEnumerator(); + HasNext(e, 8); + HasNext(e, 5); + HasNext(e, 7); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Where5() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Where(x => true); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Where6() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + var ys = xs.Where((x, i) => true); + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany_Null() + { + AssertThrows(() => AsyncEnumerable.SelectMany(null, x => null)); + AssertThrows(() => AsyncEnumerable.SelectMany(null, (x, i) => null)); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>))); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>))); + + AssertThrows(() => AsyncEnumerable.SelectMany(null, x => null, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.SelectMany(null, (x, i) => null, (x, y) => x)); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>), (x, y) => x)); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>), (x, y) => x)); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), x => null, default(Func))); + AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), (x, i) => null, default(Func))); + } + + [TestMethod] + public void SelectMany1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 0); + HasNext(e, 1); + HasNext(e, 0); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void SelectMany2() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany(x => + { + if (x < 3) + return Enumerable.Range(0, x).ToAsyncEnumerable(); + else + return AsyncEnumerable.Throw(ex); + }); + + var e = ys.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 0); + HasNext(e, 1); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany3() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany4() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany(x => + { + if (x < 3) + return Enumerable.Range(0, x).ToAsyncEnumerable(); + else + throw ex; + }); + + var e = ys.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 0); + HasNext(e, 1); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany5() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 5, x).ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + HasNext(e, 5); + HasNext(e, 6); + HasNext(e, 7); + HasNext(e, 7); + HasNext(e, 8); + HasNext(e, 9); + NoNext(e); + } + + [TestMethod] + public void SelectMany6() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany((x, i) => + { + if (i < 2) + return Enumerable.Range(0, x).ToAsyncEnumerable(); + else + return AsyncEnumerable.Throw(ex); + }); + + var e = ys.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 0); + HasNext(e, 1); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany7() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.SelectMany((x, i) => Enumerable.Range(0, x).ToAsyncEnumerable()); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany8() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany((x, i) => + { + if (i < 2) + return Enumerable.Range(0, x).ToAsyncEnumerable(); + else + throw ex; + }); + + var e = ys.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 0); + HasNext(e, 1); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany9() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => x * y); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 6); + HasNext(e, 8); + HasNext(e, 9); + HasNext(e, 12); + HasNext(e, 15); + NoNext(e); + } + + [TestMethod] + public void SelectMany10() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => x * y); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 8); + HasNext(e, 10); + HasNext(e, 15); + HasNext(e, 18); + HasNext(e, 21); + NoNext(e); + } + + [TestMethod] + public void SelectMany11() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => + { + if (x * y > 10) + throw ex; + return x * y; + }); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 6); + HasNext(e, 8); + HasNext(e, 9); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SelectMany12() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => + { + if (x * y > 10) + throw ex; + return x * y; + }); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 8); + HasNext(e, 10); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void OfType_Null() + { + AssertThrows(() => AsyncEnumerable.OfType(null)); + } + + [TestMethod] + public void OfType() + { + var xs = new object[] { 1, 1.2, true, 4, "" }.ToAsyncEnumerable(); + var ys = xs.OfType(); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Cast_Null() + { + AssertThrows(() => AsyncEnumerable.Cast(null)); + } + + [TestMethod] + public void Cast() + { + var xs = new object[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Cast(); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Do_Null() + { + AssertThrows(() => AsyncEnumerable.Do(null, x => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action))); + + AssertThrows(() => AsyncEnumerable.Do(null, x => { }, () => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), () => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action))); + + AssertThrows(() => AsyncEnumerable.Do(null, x => { }, ex => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), ex => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action))); + + AssertThrows(() => AsyncEnumerable.Do(null, x => { }, ex => { }, () => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), ex => { }, () => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action), () => { })); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, ex => { }, default(Action))); + + AssertThrows(() => AsyncEnumerable.Do(null, new MyObs())); + AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(IObserver))); + } + + class MyObs : IObserver + { + public void OnCompleted() + { + throw new NotImplementedException(); + } + + public void OnError(Exception error) + { + throw new NotImplementedException(); + } + + public void OnNext(int value) + { + throw new NotImplementedException(); + } + } + + [TestMethod] + public void Do1() + { + var sum = 0; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Do(x => sum += x); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + Assert.AreEqual(1, sum); + HasNext(e, 2); + Assert.AreEqual(3, sum); + HasNext(e, 3); + Assert.AreEqual(6, sum); + HasNext(e, 4); + Assert.AreEqual(10, sum); + NoNext(e); + } + + [TestMethod] + public void Do2() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Do(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Do3() + { + var sum = 0; + var fail = false; + var done = false; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Do(x => sum += x, ex => { fail = true; }, () => { done = true; }); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + Assert.AreEqual(1, sum); + HasNext(e, 2); + Assert.AreEqual(3, sum); + HasNext(e, 3); + Assert.AreEqual(6, sum); + HasNext(e, 4); + Assert.AreEqual(10, sum); + NoNext(e); + + Assert.IsFalse(fail); + Assert.IsTrue(done); + } + + [TestMethod] + public void Do4() + { + var sum = 0; + var done = false; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Do(x => sum += x, () => { done = true; }); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + Assert.AreEqual(1, sum); + HasNext(e, 2); + Assert.AreEqual(3, sum); + HasNext(e, 3); + Assert.AreEqual(6, sum); + HasNext(e, 4); + Assert.AreEqual(10, sum); + NoNext(e); + + Assert.IsTrue(done); + } + + [TestMethod] + public void Do5() + { + var ex = new Exception("Bang"); + var exa = default(Exception); + var done = false; + var hasv = false; + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }, () => { done = true; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + + Assert.IsFalse(hasv); + Assert.IsFalse(done); + Assert.AreSame(((AggregateException)exa).Flatten().InnerExceptions.Single(), ex); + } + + [TestMethod] + public void Do6() + { + var ex = new Exception("Bang"); + var exa = default(Exception); + var hasv = false; + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + + Assert.IsFalse(hasv); + Assert.AreSame(((AggregateException)exa).Flatten().InnerExceptions.Single(), ex); + } + + [TestMethod] + public void ForEachAsync_Null() + { + AssertThrows(() => AsyncEnumerable.ForEachAsync(null, x => { })); + AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action))); + AssertThrows(() => AsyncEnumerable.ForEachAsync(null, (x, i) => { })); + AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action))); + + AssertThrows(() => AsyncEnumerable.ForEachAsync(null, x => { }, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEachAsync(null, (x, i) => { }, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); + } + + [TestMethod] + public void ForEach_Null() + { + AssertThrows(() => AsyncEnumerable.ForEach(null, x => { })); + AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action))); + AssertThrows(() => AsyncEnumerable.ForEach(null, (x, i) => { })); + AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action))); + + AssertThrows(() => AsyncEnumerable.ForEach(null, x => { }, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEach(null, (x, i) => { }, CancellationToken.None)); + AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); + } + + [TestMethod] + public void ForEachAsync1() + { + var sum = 0; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + xs.ForEachAsync(x => sum += x).Wait(); + Assert.AreEqual(10, sum); + } + + [TestMethod] + public void ForEach1() + { + var sum = 0; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + xs.ForEach(x => sum += x); + Assert.AreEqual(10, sum); + } + + [TestMethod] + public void ForEachAsync2() + { + var sum = 0; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + xs.ForEach((x, i) => sum += x * i); + Assert.AreEqual(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum); + } + + [TestMethod] + public void ForEach2() + { + var sum = 0; + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + xs.ForEachAsync((x, i) => sum += x * i).Wait(); + Assert.AreEqual(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum); + } + + [TestMethod] + public void ForEachAsync3() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEach3() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + AssertThrows(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEachAsync4() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEach4() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + + AssertThrows(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEachAsync5() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEach5() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + AssertThrows(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEachAsync6() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ForEach6() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + + AssertThrows(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Take_Null() + { + AssertThrows(() => AsyncEnumerable.Take(null, 5)); + AssertThrows(() => AsyncEnumerable.Take(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void Take1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Take(2); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void Take2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Take(10); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Take3() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Take(0); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Take4() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Take(2); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void TakeWhile_Null() + { + AssertThrows(() => AsyncEnumerable.TakeWhile(null, x => true)); + AssertThrows(() => AsyncEnumerable.TakeWhile(null, (x, i) => true)); + AssertThrows(() => AsyncEnumerable.TakeWhile(AsyncEnumerable.Return(42), default(Func))); + AssertThrows(() => AsyncEnumerable.TakeWhile(AsyncEnumerable.Return(42), default(Func))); + } + + [TestMethod] + public void TakeWhile1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile(x => x < 3); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void TakeWhile2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile(x => false); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void TakeWhile3() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile(x => true); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void TakeWhile4() + { + var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile(x => x < 3); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void TakeWhile5() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void TakeWhile6() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile((x, i) => i < 2); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void TakeWhile7() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile((x, i) => false); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void TakeWhile8() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile((x, i) => true); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void TakeWhile9() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.TakeWhile((x, i) => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Skip_Null() + { + AssertThrows(() => AsyncEnumerable.Skip(null, 5)); + AssertThrows(() => AsyncEnumerable.Skip(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void Skip1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Skip(2); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Skip2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Skip(10); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Skip3() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.Skip(0); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Skip4() + { + var ex = new Exception("Bang"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Skip(2); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SkipWhile_Null() + { + AssertThrows(() => AsyncEnumerable.SkipWhile(null, x => true)); + AssertThrows(() => AsyncEnumerable.SkipWhile(null, (x, i) => true)); + AssertThrows(() => AsyncEnumerable.SkipWhile(AsyncEnumerable.Return(42), default(Func))); + AssertThrows(() => AsyncEnumerable.SkipWhile(AsyncEnumerable.Return(42), default(Func))); + } + + [TestMethod] + public void SkipWhile1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile(x => x < 3); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void SkipWhile2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile(x => false); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void SkipWhile3() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile(x => true); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void SkipWhile4() + { + var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile(x => x < 3); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 3); + HasNext(e, 2); + HasNext(e, 1); + NoNext(e); + } + + [TestMethod] + public void SkipWhile5() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void SkipWhile6() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile((x, i) => i < 2); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void SkipWhile7() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile((x, i) => false); + + var e = ys.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void SkipWhile8() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile((x, i) => true); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void SkipWhile9() + { + var ex = new Exception("Bang"); + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); + var ys = xs.SkipWhile((x, i) => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void DefaultIfEmpty_Null() + { + AssertThrows(() => AsyncEnumerable.DefaultIfEmpty(null)); + AssertThrows(() => AsyncEnumerable.DefaultIfEmpty(null, 42)); + } + + [TestMethod] + public void DefaultIfEmpty1() + { + var xs = AsyncEnumerable.Empty().DefaultIfEmpty(); + + var e = xs.GetEnumerator(); + HasNext(e, 0); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty2() + { + var xs = AsyncEnumerable.Empty().DefaultIfEmpty(42); + + var e = xs.GetEnumerator(); + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty3() + { + var xs = AsyncEnumerable.Return(42).DefaultIfEmpty(); + + var e = xs.GetEnumerator(); + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty4() + { + var xs = AsyncEnumerable.Return(42).DefaultIfEmpty(24); + + var e = xs.GetEnumerator(); + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty5() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty6() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void DefaultIfEmpty7() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex).DefaultIfEmpty(); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void DefaultIfEmpty8() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex).DefaultIfEmpty(24); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Distinct_Null() + { + AssertThrows(() => AsyncEnumerable.Distinct(null)); + AssertThrows(() => AsyncEnumerable.Distinct(null, new Eq())); + AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Distinct1() + { + var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 5); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Distinct2() + { + var xs = new[] { 1, -2, -1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(new Eq()); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, -2); + HasNext(e, 3); + HasNext(e, 5); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void Reverse_Null() + { + AssertThrows(() => AsyncEnumerable.Reverse(null)); + } + + [TestMethod] + public void Reverse1() + { + var xs = AsyncEnumerable.Empty(); + var ys = xs.Reverse(); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void Reverse2() + { + var xs = AsyncEnumerable.Return(42); + var ys = xs.Reverse(); + + var e = ys.GetEnumerator(); + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void Reverse3() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.Reverse(); + + var e = ys.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 2); + HasNext(e, 1); + NoNext(e); + } + + [TestMethod] + public void Reverse4() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.Reverse(); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void OrderBy_Null() + { + AssertThrows(() => AsyncEnumerable.OrderBy(null, x => x)); + AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.OrderBy(null, x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), null, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), x => x, null)); + + AssertThrows(() => AsyncEnumerable.OrderByDescending(null, x => x)); + AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.OrderByDescending(null, x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), null, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), x => x, null)); + + var xs = AsyncEnumerable.Return(42).OrderBy(x => x); + + AssertThrows(() => AsyncEnumerable.ThenBy(null, x => x)); + AssertThrows(() => AsyncEnumerable.ThenBy(xs, null)); + + AssertThrows(() => AsyncEnumerable.ThenBy(null, x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.ThenBy(xs, null, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.ThenBy(xs, x => x, null)); + + AssertThrows(() => AsyncEnumerable.ThenByDescending(null, x => x)); + AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, null)); + + AssertThrows(() => AsyncEnumerable.ThenByDescending(null, x => x, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, null, Comparer.Default)); + AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, x => x, null)); + } + + [TestMethod] + public void OrderBy1() + { + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderBy(x => x); + + var e = ys.GetEnumerator(); + for (int i = 0; i < 10; i++) + HasNext(e, i); + NoNext(e); + } + + [TestMethod] + public void OrderBy2() + { + var ex = new Exception("Bang!"); + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderBy(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ThenBy2() + { + var ex = new Exception("Bang!"); + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderBy(x => x).ThenBy(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void OrderByDescending1() + { + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderByDescending(x => x); + + var e = ys.GetEnumerator(); + for (int i = 9; i >= 0; i--) + HasNext(e, i); + NoNext(e); + } + + [TestMethod] + public void OrderByDescending2() + { + var ex = new Exception("Bang!"); + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderByDescending(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void ThenByDescending2() + { + var ex = new Exception("Bang!"); + var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); + var ys = xs.OrderBy(x => x).ThenByDescending(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void OrderByThenBy1() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var ress = xs.OrderBy(x => x.Name).ThenBy(x => x.Age); + var resa = ys.OrderBy(x => x.Name).ThenBy(x => x.Age); + + Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); + } + + [TestMethod] + public void OrderByThenBy2() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var ress = xs.OrderBy(x => x.Name).ThenByDescending(x => x.Age); + var resa = ys.OrderBy(x => x.Name).ThenByDescending(x => x.Age); + + Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); + } + + [TestMethod] + public void OrderByThenBy3() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var ress = xs.OrderByDescending(x => x.Name).ThenBy(x => x.Age); + var resa = ys.OrderByDescending(x => x.Name).ThenBy(x => x.Age); + + Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); + } + + [TestMethod] + public void OrderByThenBy4() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var ress = xs.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age); + var resa = ys.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age); + + Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); + } + + [TestMethod] + public void GroupBy_Null() + { + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(IEqualityComparer))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(IEqualityComparer))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, (x, ys) => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), (x, ys) => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func, int>))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, (x, ys) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), (x, ys) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func, int>), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, (x, ys) => x, default(IEqualityComparer))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, (x, ys) => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, (x, ys) => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), (x, ys) => x)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(Func, int>))); + + AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, (x, ys) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, (x, ys) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), (x, ys) => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(Func, int>), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, (x, ys) => x, default(IEqualityComparer))); + } + + [TestMethod] + public void GroupBy1() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var res = ys.GroupBy(x => x.Age / 10); + + var e = res.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + Assert.AreEqual(e.Current.Key, 2); + var g1 = e.Current.GetEnumerator(); + HasNext(g1, xs[0]); + HasNext(g1, xs[2]); + HasNext(g1, xs[4]); + HasNext(g1, xs[5]); + NoNext(g1); + + Assert.IsTrue(e.MoveNext().Result); + Assert.AreEqual(e.Current.Key, 6); + var g2 = e.Current.GetEnumerator(); + HasNext(g2, xs[1]); + NoNext(g2); + + Assert.IsTrue(e.MoveNext().Result); + Assert.AreEqual(e.Current.Key, 1); + var g3 = e.Current.GetEnumerator(); + HasNext(g3, xs[3]); + NoNext(g3); + + Assert.IsTrue(e.MoveNext().Result); + Assert.AreEqual(e.Current.Key, 4); + var g4 = e.Current.GetEnumerator(); + HasNext(g4, xs[6]); + NoNext(g4); + + NoNext(e); + } + + [TestMethod] + public void GroupBy2() + { + var xs = new[] { + new { Name = "Bart", Age = 27 }, + new { Name = "John", Age = 62 }, + new { Name = "Eric", Age = 27 }, + new { Name = "Lisa", Age = 14 }, + new { Name = "Brad", Age = 27 }, + new { Name = "Lisa", Age = 23 }, + new { Name = "Eric", Age = 42 }, + }; + + var ys = xs.ToAsyncEnumerable(); + + var res = ys.GroupBy(x => x.Age / 10); + + var e = res.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 2); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 6); + + Assert.IsTrue(e.MoveNext().Result); + var g3 = e.Current; + Assert.AreEqual(g3.Key, 1); + + Assert.IsTrue(e.MoveNext().Result); + var g4 = e.Current; + Assert.AreEqual(g4.Key, 4); + + NoNext(e); + + var g1e = g1.GetEnumerator(); + HasNext(g1e, xs[0]); + HasNext(g1e, xs[2]); + HasNext(g1e, xs[4]); + HasNext(g1e, xs[5]); + NoNext(g1e); + + var g2e = g2.GetEnumerator(); + HasNext(g2e, xs[1]); + NoNext(g2e); + + var g3e = g3.GetEnumerator(); + HasNext(g3e, xs[3]); + NoNext(g3e); + + var g4e = g4.GetEnumerator(); + HasNext(g4e, xs[6]); + NoNext(g4e); + } + + [TestMethod] + public void GroupBy3() + { + var xs = AsyncEnumerable.Empty(); + var ys = xs.GroupBy(x => x); + + var e = ys.GetEnumerator(); + NoNext(e); + } + + [TestMethod] + public void GroupBy4() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex); + var ys = xs.GroupBy(x => x); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupBy5() + { + var xs = GetXs().ToAsyncEnumerable(); + var ys = xs.GroupBy(x => x); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 42); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 42); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 43); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 43); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + AssertThrows(() => g2e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + } + + [TestMethod] + public void GroupBy6() + { + var xs = GetXs().ToAsyncEnumerable(); + var ys = xs.GroupBy(x => x); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 42); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 42); + AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); + } + + static IEnumerable GetXs() + { + yield return 42; + yield return 43; + throw new Exception("Bang!"); + } + + [TestMethod] + public void GroupBy7() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Return(42); + var ys = xs.GroupBy(x => { throw ex; }); + + var e = ys.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupBy8() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); + var ys = xs.GroupBy(x => { if (x == 3) throw ex; return x; }); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 1); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 1); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 2); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 2); + + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + AssertThrows(() => g2e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void GroupBy9() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x)); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 0); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 'a'); + HasNext(g1e, 'd'); + HasNext(g1e, 'g'); + HasNext(g1e, 'j'); + NoNext(g1e); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 1); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 'b'); + HasNext(g2e, 'e'); + HasNext(g2e, 'h'); + NoNext(g2e); + + Assert.IsTrue(e.MoveNext().Result); + var g3 = e.Current; + Assert.AreEqual(g3.Key, 2); + var g3e = g3.GetEnumerator(); + HasNext(g3e, 'c'); + HasNext(g3e, 'f'); + HasNext(g3e, 'i'); + NoNext(g3e); + + NoNext(e); + } + + [TestMethod] + public void GroupBy10() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result); + + var e = ys.GetEnumerator(); + HasNext(e, "0 - adgj"); + HasNext(e, "1 - beh"); + HasNext(e, "2 - cfi"); + NoNext(e); + } + + [TestMethod] + public void GroupBy11() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x % 3, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result); + + var e = ys.GetEnumerator(); + HasNext(e, "0 - 0369"); + HasNext(e, "1 - 147"); + HasNext(e, "2 - 258"); + NoNext(e); + } + + [TestMethod] + public void GroupBy12() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, new EqMod(3)); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 0); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 0); + HasNext(g1e, 3); + HasNext(g1e, 6); + HasNext(g1e, 9); + NoNext(g1e); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 1); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 1); + HasNext(g2e, 4); + HasNext(g2e, 7); + NoNext(g2e); + + Assert.IsTrue(e.MoveNext().Result); + var g3 = e.Current; + Assert.AreEqual(g3.Key, 2); + var g3e = g3.GetEnumerator(); + HasNext(g3e, 2); + HasNext(g3e, 5); + HasNext(g3e, 8); + NoNext(g3e); + + NoNext(e); + } + + [TestMethod] + public void GroupBy13() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 0); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 'a'); + HasNext(g1e, 'd'); + HasNext(g1e, 'g'); + HasNext(g1e, 'j'); + NoNext(g1e); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 1); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 'b'); + HasNext(g2e, 'e'); + HasNext(g2e, 'h'); + NoNext(g2e); + + Assert.IsTrue(e.MoveNext().Result); + var g3 = e.Current; + Assert.AreEqual(g3.Key, 2); + var g3e = g3.GetEnumerator(); + HasNext(g3e, 'c'); + HasNext(g3e, 'f'); + HasNext(g3e, 'i'); + NoNext(g3e); + + NoNext(e); + } + + [TestMethod] + public void GroupBy14() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3)); + + var e = ys.GetEnumerator(); + HasNext(e, "0 - adgj"); + HasNext(e, "1 - beh"); + HasNext(e, "2 - cfi"); + NoNext(e); + } + + [TestMethod] + public void GroupBy15() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3)); + + var e = ys.GetEnumerator(); + HasNext(e, "0 - 0369"); + HasNext(e, "1 - 147"); + HasNext(e, "2 - 258"); + NoNext(e); + } + + [TestMethod] + public void GroupBy16() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 0); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 'a'); + HasNext(g1e, 'd'); + HasNext(g1e, 'g'); + HasNext(g1e, 'j'); + NoNext(g1e); + g1e.Dispose(); + + Assert.IsTrue(e.MoveNext().Result); + var g2 = e.Current; + Assert.AreEqual(g2.Key, 1); + var g2e = g2.GetEnumerator(); + HasNext(g2e, 'b'); + HasNext(g2e, 'e'); + HasNext(g2e, 'h'); + NoNext(g2e); + g2e.Dispose(); + + Assert.IsTrue(e.MoveNext().Result); + var g3 = e.Current; + Assert.AreEqual(g3.Key, 2); + var g3e = g3.GetEnumerator(); + HasNext(g3e, 'c'); + HasNext(g3e, 'f'); + HasNext(g3e, 'i'); + NoNext(g3e); + g3e.Dispose(); + + NoNext(e); + + e.Dispose(); + } + + [TestMethod] + public void GroupBy17() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); + + var e = ys.GetEnumerator(); + e.Dispose(); + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void GroupBy18() + { + var xs = AsyncEnumerable.Range(0, 10); + var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); + + var e = ys.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + var g1 = e.Current; + Assert.AreEqual(g1.Key, 0); + var g1e = g1.GetEnumerator(); + HasNext(g1e, 'a'); + + e.Dispose(); + + HasNext(g1e, 'd'); + HasNext(g1e, 'g'); + HasNext(g1e, 'j'); + NoNext(g1e); + g1e.Dispose(); + + Assert.IsFalse(e.MoveNext().Result); + } + + class EqMod : IEqualityComparer + { + private readonly int _d; + + public EqMod(int d) + { + _d = d; + } + + public bool Equals(int x, int y) + { + return EqualityComparer.Default.Equals(x % _d, y % _d); + } + + public int GetHashCode(int obj) + { + return EqualityComparer.Default.GetHashCode(obj % _d); + } + } + + [TestMethod] + public void AsAsyncEnumerable_Null() + { + AssertThrows(() => AsyncEnumerable.AsAsyncEnumerable(null)); + } + + [TestMethod] + public void AsAsyncEnumerable1() + { + var xs = AsyncEnumerable.Return(42); + var ys = xs.AsAsyncEnumerable(); + + Assert.AreNotSame(xs, ys); + + var e = xs.GetEnumerator(); + HasNext(e, 42); + NoNext(e); + } + + [TestMethod] + public void RepeatSeq_Null() + { + AssertThrows(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable))); + AssertThrows(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable), 3)); + AssertThrows(() => AsyncEnumerable.Repeat(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void RepeatSeq1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + } + + [TestMethod] + public void RepeatSeq2() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + NoNext(e); + } + + [TestMethod] + public void RepeatSeq3() + { + var i = 0; + var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(3); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + + Assert.AreEqual(3, i); + } + + static IEnumerable RepeatXs(Action started) + { + started(); + + yield return 1; + yield return 2; + } + + [TestMethod] + public void RepeatSeq4() + { + var xs = new FailRepeat().ToAsyncEnumerable().Repeat(); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); + } + + [TestMethod] + public void RepeatSeq5() + { + var xs = new FailRepeat().ToAsyncEnumerable().Repeat(3); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); + } + + class FailRepeat : IEnumerable + { + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + } + + [TestMethod] + public void IgnoreElements_Null() + { + AssertThrows(() => AsyncEnumerable.IgnoreElements(default(IAsyncEnumerable))); + } + + [TestMethod] + public void IgnoreElements1() + { + var xs = AsyncEnumerable.Empty().IgnoreElements(); + + var e = xs.GetEnumerator(); + NoNext(e); + + AssertThrows(() => { var ignored = e.Current; }); + } + + [TestMethod] + public void IgnoreElements2() + { + var xs = AsyncEnumerable.Return(42).IgnoreElements(); + + var e = xs.GetEnumerator(); + NoNext(e); + + AssertThrows(() => { var ignored = e.Current; }); + } + + [TestMethod] + public void IgnoreElements3() + { + var xs = AsyncEnumerable.Range(0, 10).IgnoreElements(); + + var e = xs.GetEnumerator(); + NoNext(e); + + AssertThrows(() => { var ignored = e.Current; }); + } + + [TestMethod] + public void IgnoreElements4() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex).IgnoreElements(); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void StartWith_Null() + { + AssertThrows(() => AsyncEnumerable.StartWith(default(IAsyncEnumerable), new[] { 1 })); + AssertThrows(() => AsyncEnumerable.StartWith(AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void StartWith1() + { + var xs = AsyncEnumerable.Empty().StartWith(1, 2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void StartWith2() + { + var xs = AsyncEnumerable.Return(0).StartWith(1, 2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 0); + NoNext(e); + } + + [TestMethod] + public void StartWith3() + { + var ex = new Exception("Bang!"); + var xs = AsyncEnumerable.Throw(ex).StartWith(1, 2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Buffer_Null() + { + AssertThrows(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable), 1)); + AssertThrows(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable), 1, 1)); + + AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1)); + AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1, 1)); + AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), 1, -1)); + } + + [TestMethod] + public void Buffer1() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2); + + var e = xs.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2 })); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 3, 4 })); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 5 })); + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void Buffer2() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2); + + var e = xs.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2, 3 })); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 3, 4, 5 })); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 5 })); + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void Buffer3() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2, 3); + + var e = xs.GetEnumerator(); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2 })); + + Assert.IsTrue(e.MoveNext().Result); + Assert.IsTrue(e.Current.SequenceEqual(new[] { 4, 5 })); + + Assert.IsFalse(e.MoveNext().Result); + } + + [TestMethod] + public void DistinctUntilChanged_Null() + { + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable))); + + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(IEqualityComparer))); + + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(Func))); + + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), x => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(Func), EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), x => x, default(IEqualityComparer))); + } + + [TestMethod] + public void DistinctUntilChanged1() + { + var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged(); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + HasNext(e, 5); + HasNext(e, 6); + HasNext(e, 7); + HasNext(e, 3); + HasNext(e, 2); + HasNext(e, 1); + NoNext(e); + } + + [TestMethod] + public void DistinctUntilChanged2() + { + var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 3); + HasNext(e, 5); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void DistinctUntilChanged3() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => { if (x == 4) throw ex; return x; }); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Expand_Null() + { + AssertThrows(() => AsyncEnumerable.Expand(default(IAsyncEnumerable), x => null)); + AssertThrows(() => AsyncEnumerable.Expand(AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Expand1() + { + var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerable.Return(x - 1).Repeat(x - 1)); + + var e = xs.GetEnumerator(); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 2); + HasNext(e, 1); + HasNext(e, 1); + NoNext(e); + } + + [TestMethod] + public void Expand2() + { + var ex = new Exception("Bang!"); + var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => { throw ex; }); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Expand3() + { + var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => null); + + var e = xs.GetEnumerator(); + HasNext(e, 2); + HasNext(e, 3); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NullReferenceException); + } + + [TestMethod] + public void Scan_Null() + { + AssertThrows(() => AsyncEnumerable.Scan(default(IAsyncEnumerable), 3, (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), 3, null)); + + AssertThrows(() => AsyncEnumerable.Scan(default(IAsyncEnumerable), (x, y) => x + y)); + AssertThrows(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), null)); + } + + [TestMethod] + public void Scan1() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y); + + var e = xs.GetEnumerator(); + HasNext(e, 9); + HasNext(e, 11); + HasNext(e, 14); + NoNext(e); + } + + [TestMethod] + public void Scan2() + { + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y); + + var e = xs.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 6); + NoNext(e); + } + + [TestMethod] + public void Scan3() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => { throw ex; }); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void Scan4() + { + var ex = new Exception("Bang!"); + var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => { throw ex; }); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); + } + + [TestMethod] + public void DistinctKey_Null() + { + AssertThrows(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable), x => x)); + AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null)); + + AssertThrows(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable), x => x, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); + AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), x => x, null)); + } + + [TestMethod] + public void DistinctKey1() + { + var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Distinct(x => x / 2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void TakeLast_Null() + { + AssertThrows(() => AsyncEnumerable.TakeLast(default(IAsyncEnumerable), 5)); + AssertThrows(() => AsyncEnumerable.TakeLast(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void TakeLast1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(2); + + var e = xs.GetEnumerator(); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void TakeLast2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(5); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + HasNext(e, 4); + NoNext(e); + } + + [TestMethod] + public void SkipLast_Null() + { + AssertThrows(() => AsyncEnumerable.SkipLast(default(IAsyncEnumerable), 5)); + AssertThrows(() => AsyncEnumerable.SkipLast(AsyncEnumerable.Return(42), -1)); + } + + [TestMethod] + public void SkipLast1() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(2); + + var e = xs.GetEnumerator(); + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + } + + [TestMethod] + public void SkipLast2() + { + var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(5); + + var e = xs.GetEnumerator(); + NoNext(e); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.cs b/Ix/Tests/AsyncTests.cs new file mode 100644 index 0000000..9279bb7 --- /dev/null +++ b/Ix/Tests/AsyncTests.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if DESKTOPCLR40 + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + [TestClass] + public partial class AsyncTests + { + public void AssertThrows(Action a) + where E : Exception + { + try + { + a(); + Assert.Fail(); + } + catch (E) + { + } + } + + public void AssertThrows(Action a, Func assert) + where E : Exception + { + try + { + a(); + Assert.Fail(); + } + catch (E e) + { + Assert.IsTrue(assert(e)); + } + } + + public void NoNext(IAsyncEnumerator e) + { + Assert.IsFalse(e.MoveNext().Result); + } + + public void HasNext(IAsyncEnumerator e, T value) + { + Assert.IsTrue(e.MoveNext().Result); + Assert.AreEqual(value, e.Current); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/Properties/AppManifest.xml b/Ix/Tests/Properties/AppManifest.xml new file mode 100644 index 0000000..71b66f8 --- /dev/null +++ b/Ix/Tests/Properties/AppManifest.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Ix/Tests/Properties/AssemblyInfo.cs b/Ix/Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6536c5c --- /dev/null +++ b/Ix/Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Tests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("aec256c2-1e0e-48d7-a312-7184dc67b1f0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +//[assembly: AssemblyVersion("1.0.0.0")] +//[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Ix/Tests/Tests.Aggregates.cs b/Ix/Tests/Tests.Aggregates.cs new file mode 100644 index 0000000..8fd8cee --- /dev/null +++ b/Ix/Tests/Tests.Aggregates.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void IsEmtpy_Arguments() + { + AssertThrows(() => EnumerableEx.IsEmpty(null)); + } + + [TestMethod] + public void IsEmpty_Empty() + { + Assert.IsTrue(Enumerable.Empty().IsEmpty()); + } + + [TestMethod] + public void IsEmpty_NonEmpty() + { + Assert.IsFalse(new[] { 1 }.IsEmpty()); + } + + [TestMethod] + public void Min_Arguments() + { + AssertThrows(() => EnumerableEx.Min(null, Comparer.Default)); + AssertThrows(() => EnumerableEx.Min(new[] { 1 }, null)); + } + + [TestMethod] + public void Min() + { + Assert.AreEqual(3, new[] { 5, 3, 7 }.Min(new Mod3Comparer())); + } + + class Mod3Comparer : IComparer + { + public int Compare(int x, int y) + { + return Comparer.Default.Compare(x % 3, y % 3); + } + } + + [TestMethod] + public void MinBy_Arguments() + { + AssertThrows(() => EnumerableEx.MinBy(null, (int x) => x)); + AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, default(Func))); + AssertThrows(() => EnumerableEx.MinBy(null, (int x) => x, Comparer.Default)); + AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, default(Func), Comparer.Default)); + AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, (int x) => x, null)); + } + + [TestMethod] + public void MinBy() + { + var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MinBy(x => x % 3); + Assert.IsTrue(res.SequenceEqual(new[] { 0, 3, 6 })); + } + + [TestMethod] + public void MinBy_Empty() + { + AssertThrows(() => Enumerable.Empty().MinBy(x => x)); + } + + [TestMethod] + public void Max_Arguments() + { + AssertThrows(() => EnumerableEx.Max(null, Comparer.Default)); + AssertThrows(() => EnumerableEx.Max(new[] { 1 }, null)); + } + + [TestMethod] + public void Max() + { + Assert.AreEqual(5, new[] { 2, 5, 3, 7 }.Max(new Mod7Comparer())); + } + + class Mod7Comparer : IComparer + { + public int Compare(int x, int y) + { + return Comparer.Default.Compare(x % 7, y % 7); + } + } + + [TestMethod] + public void MaxBy_Arguments() + { + AssertThrows(() => EnumerableEx.MaxBy(null, (int x) => x)); + AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, default(Func))); + AssertThrows(() => EnumerableEx.MaxBy(null, (int x) => x, Comparer.Default)); + AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, default(Func), Comparer.Default)); + AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, (int x) => x, null)); + } + + [TestMethod] + public void MaxBy() + { + var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MaxBy(x => x % 3); + Assert.IsTrue(res.SequenceEqual(new[] { 2, 5, 2 })); + } + + [TestMethod] + public void MaxBy_Empty() + { + AssertThrows(() => Enumerable.Empty().MaxBy(x => x)); + } + } +} diff --git a/Ix/Tests/Tests.Buffering.cs b/Ix/Tests/Tests.Buffering.cs new file mode 100644 index 0000000..0f6e81c --- /dev/null +++ b/Ix/Tests/Tests.Buffering.cs @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Share_Arguments() + { + AssertThrows(() => EnumerableEx.Share(null)); + } + + [TestMethod] + public void Share1() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + HasNext(e1, 3); + HasNext(e1, 4); + NoNext(e1); + } + + [TestMethod] + public void Share2() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e2, 1); + HasNext(e1, 2); + HasNext(e2, 3); + HasNext(e1, 4); + NoNext(e2); + NoNext(e1); + } + + [TestMethod] + public void Share3() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e2); + NoNext(e1); + } + + [TestMethod] + public void Share4() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + e1.Dispose(); + Assert.IsFalse(e1.MoveNext()); + } + + [TestMethod] + public void Share5() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + rng.Dispose(); + AssertThrows(() => e1.MoveNext()); + AssertThrows(() => rng.GetEnumerator()); + AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); + } + + [TestMethod] + public void Share6() + { + var rng = Enumerable.Range(0, 5).Share(); + + var e1 = ((IEnumerable)rng).GetEnumerator(); + Assert.IsTrue(e1.MoveNext()); + Assert.AreEqual(0, (int)e1.Current); + } + + [TestMethod] + public void Publish_Arguments() + { + AssertThrows(() => EnumerableEx.Publish(null)); + } + + [TestMethod] + public void Publish0() + { + var n = 0; + var rng = Tick(i => n += i).Publish(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + + HasNext(e1, 0); + Assert.AreEqual(0, n); + + HasNext(e1, 1); + Assert.AreEqual(1, n); + + HasNext(e1, 2); + Assert.AreEqual(3, n); + HasNext(e2, 0); + Assert.AreEqual(3, n); + + HasNext(e1, 3); + Assert.AreEqual(6, n); + HasNext(e2, 1); + Assert.AreEqual(6, n); + + HasNext(e2, 2); + Assert.AreEqual(6, n); + HasNext(e2, 3); + Assert.AreEqual(6, n); + + HasNext(e2, 4); + Assert.AreEqual(10, n); + HasNext(e1, 4); + Assert.AreEqual(10, n); + } + + static IEnumerable Tick(Action t) + { + var i = 0; + while (true) + { + t(i); + yield return i++; + } + } + + [TestMethod] + public void Publish1() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + HasNext(e1, 3); + HasNext(e1, 4); + NoNext(e1); + } + + [TestMethod] + public void Publish2() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e2, 0); + HasNext(e1, 1); + HasNext(e2, 1); + HasNext(e1, 2); + HasNext(e2, 2); + HasNext(e1, 3); + HasNext(e2, 3); + HasNext(e1, 4); + HasNext(e2, 4); + NoNext(e1); + NoNext(e2); + } + + [TestMethod] + public void Publish3() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + HasNext(e1, 3); + HasNext(e1, 4); + HasNext(e2, 0); + HasNext(e2, 1); + HasNext(e2, 2); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e1); + NoNext(e2); + } + + [TestMethod] + public void Publish4() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + var e2 = rng.GetEnumerator(); + HasNext(e1, 3); + HasNext(e1, 4); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e1); + NoNext(e2); + } + + [TestMethod] + public void Publish5() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + e1.Dispose(); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e2); + } + + [TestMethod] + public void Publish6() + { + var ex = new MyException(); + var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)).Publish(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + AssertThrows(() => e1.MoveNext()); + + HasNext(e2, 0); + HasNext(e2, 1); + AssertThrows(() => e2.MoveNext()); + } + + class MyException : Exception + { + } + + [TestMethod] + public void Publish7() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e2); + + HasNext(e1, 3); + HasNext(e1, 4); + NoNext(e2); + + var e3 = rng.GetEnumerator(); + NoNext(e3); + } + + [TestMethod] + public void Publish8() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + rng.Dispose(); + AssertThrows(() => e1.MoveNext()); + AssertThrows(() => rng.GetEnumerator()); + AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); + } + + [TestMethod] + public void Publish9() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = ((IEnumerable)rng).GetEnumerator(); + Assert.IsTrue(e1.MoveNext()); + Assert.AreEqual(0, (int)e1.Current); + } + + [TestMethod] + public void Publish10() + { + var rnd = Rand().Take(1000).Publish(); + Assert.IsTrue(rnd.Zip(rnd, (l, r) => l == r).All(x => x)); + } + + [TestMethod] + public void Memoize_Arguments() + { + AssertThrows(() => EnumerableEx.Memoize(null)); + } + + [TestMethod] + public void MemoizeLimited_Arguments() + { + AssertThrows(() => EnumerableEx.Memoize(null, 2)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 0)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, -1)); + } + + [TestMethod] + public void Memoize0() + { + var n = 0; + var rng = Tick(i => n += i).Memoize(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + + HasNext(e1, 0); + Assert.AreEqual(0, n); + + HasNext(e1, 1); + Assert.AreEqual(1, n); + + HasNext(e1, 2); + Assert.AreEqual(3, n); + HasNext(e2, 0); + Assert.AreEqual(3, n); + + HasNext(e1, 3); + Assert.AreEqual(6, n); + HasNext(e2, 1); + Assert.AreEqual(6, n); + + HasNext(e2, 2); + Assert.AreEqual(6, n); + HasNext(e2, 3); + Assert.AreEqual(6, n); + + HasNext(e2, 4); + Assert.AreEqual(10, n); + HasNext(e1, 4); + Assert.AreEqual(10, n); + } + + [TestMethod] + public void Publish11() + { + var rng = Enumerable.Range(0, 5).Publish(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + e1.Dispose(); + + HasNext(e2, 0); + HasNext(e2, 1); + e2.Dispose(); + + var e3 = rng.GetEnumerator(); + HasNext(e3, 3); + HasNext(e3, 4); + NoNext(e3); + } + + [TestMethod] + public void Memoize1() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + HasNext(e1, 3); + HasNext(e1, 4); + NoNext(e1); + } + + [TestMethod] + public void Memoize2() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + HasNext(e1, 3); + HasNext(e1, 4); + NoNext(e1); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 0); + HasNext(e2, 1); + HasNext(e2, 2); + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e2); + } + + [TestMethod] + public void Memoize3() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + var e2 = rng.GetEnumerator(); + HasNext(e1, 3); + HasNext(e2, 0); + HasNext(e2, 1); + HasNext(e1, 4); + HasNext(e2, 2); + NoNext(e1); + + HasNext(e2, 3); + HasNext(e2, 4); + NoNext(e2); + } + + [TestMethod] + public void Memoize4() + { + var rng = Enumerable.Range(0, 5).Memoize(2); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 0); + HasNext(e2, 1); + HasNext(e2, 2); + + var e3 = rng.GetEnumerator(); + AssertThrows(() => e3.MoveNext()); + } + + [TestMethod] + public void Memoize6() + { + var ex = new MyException(); + var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)).Memoize(); + + var e1 = rng.GetEnumerator(); + var e2 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + AssertThrows(() => e1.MoveNext()); + + HasNext(e2, 0); + HasNext(e2, 1); + AssertThrows(() => e2.MoveNext()); + } + + [TestMethod] + public void Memoize7() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + e1.Dispose(); + + var e2 = rng.GetEnumerator(); + HasNext(e2, 0); + HasNext(e2, 1); + e2.Dispose(); + + var e3 = rng.GetEnumerator(); + HasNext(e3, 0); + HasNext(e3, 1); + HasNext(e3, 2); + HasNext(e3, 3); + HasNext(e3, 4); + NoNext(e3); + } + + [TestMethod] + public void Memoize8() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = rng.GetEnumerator(); + HasNext(e1, 0); + HasNext(e1, 1); + HasNext(e1, 2); + + rng.Dispose(); + AssertThrows(() => e1.MoveNext()); + AssertThrows(() => rng.GetEnumerator()); + AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); + } + + [TestMethod] + public void Memoize9() + { + var rng = Enumerable.Range(0, 5).Memoize(); + + var e1 = ((IEnumerable)rng).GetEnumerator(); + Assert.IsTrue(e1.MoveNext()); + Assert.AreEqual(0, (int)e1.Current); + } + + [TestMethod] + public void Memoize10() + { + var rnd = Rand().Take(1000).Memoize(); + Assert.IsTrue(rnd.Zip(rnd, (l, r) => l == r).All(x => x)); + } + + static Random s_rand = new Random(); + + static IEnumerable Rand() + { + while (true) + yield return s_rand.Next(); + } + + [TestMethod] + public void ShareLambda_Arguments() + { + AssertThrows(() => EnumerableEx.Share(null, xs => xs)); + AssertThrows(() => EnumerableEx.Share(new[] { 1 }, null)); + } + + [TestMethod] + public void ShareLambda() + { + var n = 0; + var res = Enumerable.Range(0, 10).Do(_ => n++).Share(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); + Assert.IsTrue(res.SequenceEqual(new[] { 0 + 1, 2 + 3, 4 + 5, 6 + 7 })); + Assert.AreEqual(8, n); + } + + [TestMethod] + public void PublishLambda_Arguments() + { + AssertThrows(() => EnumerableEx.Publish(null, xs => xs)); + AssertThrows(() => EnumerableEx.Publish(new[] { 1 }, null)); + } + + [TestMethod] + public void PublishLambda() + { + var n = 0; + var res = Enumerable.Range(0, 10).Do(_ => n++).Publish(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); + Assert.AreEqual(4, n); + } + + [TestMethod] + public void MemoizeLambda_Arguments() + { + AssertThrows(() => EnumerableEx.Memoize(null, xs => xs)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, null)); + } + + [TestMethod] + public void MemoizeLambda() + { + var n = 0; + var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); + Assert.AreEqual(4, n); + } + + [TestMethod] + public void MemoizeLimitedLambda_Arguments() + { + AssertThrows(() => EnumerableEx.Memoize(null, 2, xs => xs)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 2, null)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 0, xs => xs)); + AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, -1, xs => xs)); + } + + [TestMethod] + public void MemoizeLimitedLambda() + { + var n = 0; + var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(2, xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); + Assert.AreEqual(4, n); + } + } +} diff --git a/Ix/Tests/Tests.Creation.cs b/Ix/Tests/Tests.Creation.cs new file mode 100644 index 0000000..81fee03 --- /dev/null +++ b/Ix/Tests/Tests.Creation.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Create_Arguments() + { + AssertThrows(() => EnumerableEx.Create(default(Func>))); + } + + [TestMethod] + public void Create1() + { + var hot = false; + var res = EnumerableEx.Create(() => + { + hot = true; + return MyEnumerator(); + }); + + Assert.IsFalse(hot); + + var e = res.GetEnumerator(); + Assert.IsTrue(hot); + + HasNext(e, 1); + HasNext(e, 2); + NoNext(e); + + hot = false; + var f = ((IEnumerable)res).GetEnumerator(); + Assert.IsTrue(hot); + } + + private static IEnumerator MyEnumerator() + { + yield return 1; + yield return 2; + } + + [TestMethod] + public void Return() + { + Assert.AreEqual(42, EnumerableEx.Return(42).Single()); + } + + [TestMethod] + public void Throw_Arguments() + { + AssertThrows(() => EnumerableEx.Throw(null)); + } + + [TestMethod] + public void Throw() + { + var ex = new MyException(); + var xs = EnumerableEx.Throw(ex); + + var e = xs.GetEnumerator(); + AssertThrows(() => e.MoveNext()); + } + + [TestMethod] + public void Defer_Arguments() + { + AssertThrows(() => EnumerableEx.Defer(null)); + } + + [TestMethod] + public void Defer1() + { + var i = 0; + var n = 5; + var xs = EnumerableEx.Defer(() => + { + i++; + return Enumerable.Range(0, n); + }); + + Assert.AreEqual(0, i); + + Assert.IsTrue(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n))); + Assert.AreEqual(1, i); + + n = 3; + Assert.IsTrue(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n))); + Assert.AreEqual(2, i); + } + + [TestMethod] + public void Defer2() + { + var xs = EnumerableEx.Defer(() => + { + throw new MyException(); + }); + + AssertThrows(() => xs.GetEnumerator().MoveNext()); + } + + [TestMethod] + public void Generate_Arguments() + { + AssertThrows(() => EnumerableEx.Generate(0, null, _ => _, _ => _)); + AssertThrows(() => EnumerableEx.Generate(0, _ => true, null, _ => _)); + AssertThrows(() => EnumerableEx.Generate(0, _ => true, _ => _, null)); + } + + [TestMethod] + public void Generate() + { + var res = EnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0, 1, 4, 9, 16 })); + } + + [TestMethod] + public void Using_Arguments() + { + AssertThrows(() => EnumerableEx.Using(null, d => new[] { 1 })); + AssertThrows(() => EnumerableEx.Using(() => new MyDisposable(), null)); + } + + [TestMethod] + public void Using1() + { + var d = default(MyDisposable); + + var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => new[] { 1 }); + Assert.IsNull(d); + + var d1 = default(MyDisposable); + xs.ForEach(_ => { d1 = d; Assert.IsNotNull(d1); Assert.IsFalse(d1.Done); }); + Assert.IsTrue(d1.Done); + + var d2 = default(MyDisposable); + xs.ForEach(_ => { d2 = d; Assert.IsNotNull(d2); Assert.IsFalse(d2.Done); }); + Assert.IsTrue(d2.Done); + + Assert.AreNotSame(d1, d2); + } + + [TestMethod] + public void Using2() + { + var d = default(MyDisposable); + + var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => EnumerableEx.Throw(new MyException())); + Assert.IsNull(d); + + AssertThrows(() => xs.ForEach(_ => { })); + Assert.IsTrue(d.Done); + } + + [TestMethod] + public void Using3() + { + var d = default(MyDisposable); + + var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => { throw new MyException(); }); + Assert.IsNull(d); + + AssertThrows(() => xs.ForEach(_ => { })); + Assert.IsTrue(d.Done); + } + + class MyDisposable : IDisposable + { + public bool Done; + + public void Dispose() + { + Done = true; + } + } + + [TestMethod] + public void RepeatElementInfinite() + { + var xs = EnumerableEx.Repeat(42).Take(1000); + Assert.IsTrue(xs.All(x => x == 42)); + Assert.IsTrue(xs.Count() == 1000); + } + + [TestMethod] + public void RepeatSequence_Arguments() + { + AssertThrows(() => EnumerableEx.Repeat(null)); + AssertThrows(() => EnumerableEx.Repeat(null, 5)); + AssertThrows(() => EnumerableEx.Repeat(new[] { 1 }, -1)); + } + + [TestMethod] + public void RepeatSequence1() + { + var i = 0; + var xs = new[] { 1, 2 }.Do(_ => i++).Repeat(); + + var res = xs.Take(10).ToList(); + Assert.AreEqual(10, res.Count); + Assert.IsTrue(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3)); + Assert.AreEqual(10, i); + } + + [TestMethod] + public void RepeatSequence2() + { + var i = 0; + var xs = new[] { 1, 2 }.Do(_ => i++).Repeat(5); + + var res = xs.ToList(); + Assert.AreEqual(10, res.Count); + Assert.IsTrue(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3)); + Assert.AreEqual(10, i); + } + } +} diff --git a/Ix/Tests/Tests.Exceptions.cs b/Ix/Tests/Tests.Exceptions.cs new file mode 100644 index 0000000..38cabe4 --- /dev/null +++ b/Ix/Tests/Tests.Exceptions.cs @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Catch_Arguments() + { + AssertThrows(() => EnumerableEx.Catch(null, new[] { 1 })); + AssertThrows(() => EnumerableEx.Catch(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.Catch(default(IEnumerable[]))); + AssertThrows(() => EnumerableEx.Catch(default(IEnumerable>))); + AssertThrows(() => EnumerableEx.Catch(null, ex => new[] { 1 })); + AssertThrows(() => EnumerableEx.Catch(new[] { 1 }, null)); + } + + [TestMethod] + public void Catch1() + { + var ex = new MyException(); + var res = EnumerableEx.Throw(ex).Catch(e => { Assert.AreSame(ex, e); return new[] { 42 }; }).Single(); + Assert.AreEqual(42, res); + } + + [TestMethod] + public void Catch2() + { + var ex = new MyException(); + var res = EnumerableEx.Throw(ex).Catch(e => { Assert.AreSame(ex, e); return new[] { 42 }; }).Single(); + Assert.AreEqual(42, res); + } + + [TestMethod] + public void Catch3() + { + var ex = new MyException(); + AssertThrows(() => + { + EnumerableEx.Throw(ex).Catch(e => { Assert.Fail(); return new[] { 42 }; }).Single(); + }); + } + + [TestMethod] + public void Catch4() + { + var xs = Enumerable.Range(0, 10); + var res = xs.Catch(e => { Assert.Fail(); return new[] { 42 }; }); + Assert.IsTrue(xs.SequenceEqual(res)); + } + + [TestMethod] + public void Catch5() + { + var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; + var res = EnumerableEx.Catch(xss); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); + } + + [TestMethod] + public void Catch6() + { + var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; + var res = xss.Catch(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); + } + + [TestMethod] + public void Catch7() + { + var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; + var res = xss[0].Catch(xss[1]); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); + } + + [TestMethod] + public void Catch8() + { + var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; + var res = EnumerableEx.Catch(xss); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); + } + + [TestMethod] + public void Catch9() + { + var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; + var res = xss.Catch(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); + } + + [TestMethod] + public void Catch10() + { + var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; + var res = xss[0].Catch(xss[1]); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); + } + + [TestMethod] + public void Catch11() + { + var e1 = new MyException(); + var ex1 = EnumerableEx.Throw(e1); + + var e2 = new MyException(); + var ex2 = EnumerableEx.Throw(e2); + + var e3 = new MyException(); + var ex3 = EnumerableEx.Throw(e3); + + var xss = new[] { Enumerable.Range(0, 2).Concat(ex1), Enumerable.Range(2, 2).Concat(ex2), ex3 }; + var res = xss.Catch(); + + var e = res.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 1); + HasNext(e, 2); + HasNext(e, 3); + AssertThrows(() => e.MoveNext(), ex => ex == e3); + } + + [TestMethod] + public void Finally_Arguments() + { + AssertThrows(() => EnumerableEx.Finally(null, () => { })); + AssertThrows(() => EnumerableEx.Finally(new[] { 1 }, null)); + } + + [TestMethod] + public void Finally1() + { + var done = false; + + var xs = Enumerable.Range(0, 2).Finally(() => done = true); + Assert.IsFalse(done); + + var e = xs.GetEnumerator(); + Assert.IsFalse(done); + + HasNext(e, 0); + Assert.IsFalse(done); + + HasNext(e, 1); + Assert.IsFalse(done); + + NoNext(e); + Assert.IsTrue(done); + } + + [TestMethod] + public void Finally2() + { + var done = false; + + var xs = Enumerable.Range(0, 2).Finally(() => done = true); + Assert.IsFalse(done); + + var e = xs.GetEnumerator(); + Assert.IsFalse(done); + + HasNext(e, 0); + Assert.IsFalse(done); + + e.Dispose(); + Assert.IsTrue(done); + } + + [TestMethod] + public void Finally3() + { + var done = false; + + var ex = new MyException(); + var xs = EnumerableEx.Throw(ex).Finally(() => done = true); + Assert.IsFalse(done); + + var e = xs.GetEnumerator(); + Assert.IsFalse(done); + + try + { + HasNext(e, 0); + Assert.Fail(); + } + catch (MyException ex_) + { + Assert.AreSame(ex, ex_); + } + + Assert.IsTrue(done); + } + + [TestMethod] + public void OnErrorResumeNext_Arguments() + { + AssertThrows(() => EnumerableEx.OnErrorResumeNext(null, new[] { 1 })); + AssertThrows(() => EnumerableEx.OnErrorResumeNext(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.OnErrorResumeNext(default(IEnumerable[]))); + AssertThrows(() => EnumerableEx.OnErrorResumeNext(default(IEnumerable>))); + } + + [TestMethod] + public void OnErrorResumeNext1() + { + var xs = new[] { 1, 2 }; + var ys = new[] { 3, 4 }; + + var res = xs.OnErrorResumeNext(ys); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); + } + + [TestMethod] + public void OnErrorResumeNext2() + { + var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); + var ys = new[] { 3, 4 }; + + var res = xs.OnErrorResumeNext(ys); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); + } + + [TestMethod] + public void OnErrorResumeNext3() + { + var xs = new[] { 1, 2 }; + var ys = new[] { 3, 4 }; + var zs = new[] { 5, 6 }; + + var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 })); + } + + [TestMethod] + public void OnErrorResumeNext4() + { + var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); + var ys = new[] { 3, 4 }; + var zs = new[] { 5, 6 }; + + var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 })); + } + + [TestMethod] + public void OnErrorResumeNext5() + { + var xs = new[] { 1, 2 }; + var ys = new[] { 3, 4 }; + + var res = new[] { xs, ys }.OnErrorResumeNext(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); + } + + [TestMethod] + public void OnErrorResumeNext6() + { + var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); + var ys = new[] { 3, 4 }; + + var res = new[] { xs, ys }.OnErrorResumeNext(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); + } + + [TestMethod] + public void Retry_Arguments() + { + AssertThrows(() => EnumerableEx.Retry(null)); + AssertThrows(() => EnumerableEx.Retry(null, 5)); + AssertThrows(() => EnumerableEx.Retry(new[] { 1 }, -1)); + } + + [TestMethod] + public void Retry1() + { + var xs = Enumerable.Range(0, 10); + + var res = xs.Retry(); + Assert.IsTrue(Enumerable.SequenceEqual(res, xs)); + } + + [TestMethod] + public void Retry2() + { + var xs = Enumerable.Range(0, 10); + + var res = xs.Retry(2); + Assert.IsTrue(Enumerable.SequenceEqual(res, xs)); + } + + [TestMethod] + public void Retry3() + { + var ex = new MyException(); + var xs = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)); + + var res = xs.Retry(2); + var e = res.GetEnumerator(); + HasNext(e, 0); + HasNext(e, 1); + HasNext(e, 0); + HasNext(e, 1); + AssertThrows(() => e.MoveNext(), ex_ => ex == ex_); + } + } +} diff --git a/Ix/Tests/Tests.Imperative.cs b/Ix/Tests/Tests.Imperative.cs new file mode 100644 index 0000000..3b038c6 --- /dev/null +++ b/Ix/Tests/Tests.Imperative.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void While_Arguments() + { + AssertThrows(() => EnumerableEx.While(null, new[] { 1 })); + AssertThrows(() => EnumerableEx.While(() => true, null)); + } + + [TestMethod] + public void While1() + { + var x = 5; + var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 })); + } + + [TestMethod] + public void While2() + { + var x = 0; + var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new int[0])); + } + + [TestMethod] + public void DoWhile_Arguments() + { + AssertThrows(() => EnumerableEx.DoWhile(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.DoWhile(null, () => true)); + } + + [TestMethod] + public void DoWhile1() + { + var x = 5; + var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 })); + } + + [TestMethod] + public void DoWhile2() + { + var x = 0; + var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0 })); + } + + [TestMethod] + public void If_Arguments() + { + AssertThrows(() => EnumerableEx.If(null, new[] { 1 })); + AssertThrows(() => EnumerableEx.If(() => true, null)); + AssertThrows(() => EnumerableEx.If(null, new[] { 1 }, new[] { 1 })); + AssertThrows(() => EnumerableEx.If(() => true, null, new[] { 1 })); + AssertThrows(() => EnumerableEx.If(() => true, new[] { 1 }, null)); + } + + [TestMethod] + public void If1() + { + var x = 5; + var res = EnumerableEx.If(() => x > 0, new[] { +1 }, new[] { -1 }); + + Assert.AreEqual(+1, res.Single()); + + x = -x; + Assert.AreEqual(-1, res.Single()); + } + + [TestMethod] + public void If2() + { + var x = 5; + var res = EnumerableEx.If(() => x > 0, new[] { +1 }); + + Assert.AreEqual(+1, res.Single()); + + x = -x; + Assert.IsTrue(res.IsEmpty()); + } + + [TestMethod] + public void Case_Arguments() + { + AssertThrows(() => EnumerableEx.Case(null, new Dictionary>())); + AssertThrows(() => EnumerableEx.Case(() => 1, null)); + AssertThrows(() => EnumerableEx.Case(null, new Dictionary>(), new[] { 1 })); + AssertThrows(() => EnumerableEx.Case(() => 1, null, new[] { 1 })); + AssertThrows(() => EnumerableEx.Case(() => 1, new Dictionary>(), null)); + } + + [TestMethod] + public void Case1() + { + var x = 1; + var d = 'd'; + var res = EnumerableEx.Case(() => x, new Dictionary> + { + { 0, new[] { 'a' } }, + { 1, new[] { 'b' } }, + { 2, new[] { 'c' } }, + { 3, EnumerableEx.Defer(() => new[] { d }) }, + }); + + Assert.AreEqual('b', res.Single()); + Assert.AreEqual('b', res.Single()); + + x = 0; + Assert.AreEqual('a', res.Single()); + + x = 2; + Assert.AreEqual('c', res.Single()); + + x = 3; + Assert.AreEqual('d', res.Single()); + + d = 'e'; + Assert.AreEqual('e', res.Single()); + + x = 4; + Assert.IsTrue(res.IsEmpty()); + } + + [TestMethod] + public void Case2() + { + var x = 1; + var d = 'd'; + var res = EnumerableEx.Case(() => x, new Dictionary> + { + { 0, new[] { 'a' } }, + { 1, new[] { 'b' } }, + { 2, new[] { 'c' } }, + { 3, EnumerableEx.Defer(() => new[] { d }) }, + }, new[] { 'z' }); + + Assert.AreEqual('b', res.Single()); + Assert.AreEqual('b', res.Single()); + + x = 0; + Assert.AreEqual('a', res.Single()); + + x = 2; + Assert.AreEqual('c', res.Single()); + + x = 3; + Assert.AreEqual('d', res.Single()); + + d = 'e'; + Assert.AreEqual('e', res.Single()); + + x = 4; + Assert.AreEqual('z', res.Single()); + } + + [TestMethod] + public void For_Arguments() + { + AssertThrows(() => EnumerableEx.For(null, x => new[] { 1 })); + AssertThrows(() => EnumerableEx.For(new[] { 1 }, null)); + } + + [TestMethod] + public void For() + { + var res = EnumerableEx.For(new[] { 1, 2, 3 }, x => Enumerable.Range(0, x)).ToList(); + Assert.IsTrue(res.SequenceEqual(new[] { 0, 0, 1, 0, 1, 2 })); + } + } +} diff --git a/Ix/Tests/Tests.Multiple.cs b/Ix/Tests/Tests.Multiple.cs new file mode 100644 index 0000000..3df8927 --- /dev/null +++ b/Ix/Tests/Tests.Multiple.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Concat_Arguments() + { + AssertThrows(() => EnumerableEx.Concat(default(IEnumerable[]))); + AssertThrows(() => EnumerableEx.Concat(default(IEnumerable>))); + } + + [TestMethod] + public void Concat1() + { + var res = new[] + { + new[] { 1, 2, 3 }, + new[] { 4, 5 } + }.Concat(); + + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 })); + } + + [TestMethod] + public void Concat2() + { + var i = 0; + var xss = Enumerable.Range(0, 3).Select(x => Enumerable.Range(0, x + 1)).Do(_ => ++i); + + var res = xss.Concat().Select(x => i + " - " + x).ToList(); + + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { + "1 - 0", + "2 - 0", + "2 - 1", + "3 - 0", + "3 - 1", + "3 - 2", + })); + } + + [TestMethod] + public void Concat3() + { + var res = EnumerableEx.Concat( + new[] { 1, 2, 3 }, + new[] { 4, 5 } + ); + + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 })); + } + + [TestMethod] + public void SelectMany_Arguments() + { + AssertThrows(() => EnumerableEx.SelectMany(null, new[] { 1 })); + AssertThrows(() => EnumerableEx.SelectMany(new[] { 1 }, null)); + } + + [TestMethod] + public void SelectMany() + { + var res = new[] { 1, 2 }.SelectMany(new[] { 'a', 'b', 'c' }).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 'a', 'b', 'c', 'a', 'b', 'c' })); + } + } +} diff --git a/Ix/Tests/Tests.Qbservable.cs b/Ix/Tests/Tests.Qbservable.cs new file mode 100644 index 0000000..d174eee --- /dev/null +++ b/Ix/Tests/Tests.Qbservable.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !SILVERLIGHTM7 + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Reflection; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Runtime.CompilerServices; +using System.Linq.Expressions; +using System.ComponentModel; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Queryable_Enumerable_Parity() + { + var enu = typeof(EnumerableEx).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList(); + var qry = typeof(QueryableEx).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList(); + + var onlyInObs = enu.Select(m => m.Name).Except(qry.Select(m => m.Name)).Except(new[] { "ForEach", "ToEnumerable", "Multicast", "GetAwaiter", "ToEvent", "ToEventPattern", "ForEachAsync" }).ToList(); + var onlyInQbs = qry.Select(m => m.Name).Except(enu.Select(m => m.Name)).Except(new[] { "ToQueryable", "get_Provider", "Empty", "Range" }).ToList(); + + Assert.IsTrue(onlyInObs.Count == 0, "Missing Queryable operator: " + string.Join(", ", onlyInObs.ToArray())); + Assert.IsTrue(onlyInQbs.Count == 0, "Missing Enumerable operator: " + string.Join(", ", onlyInQbs.ToArray())); + + var enus = enu.GroupBy(m => m.Name); + var qrys = qry.GroupBy(m => m.Name); + var mtch = (from o in enus + join q in qrys on o.Key equals q.Key + select new { Name = o.Key, Enumerable = o.ToList(), Queryable = q.ToList() }) + .ToList(); + + Func filterReturn = t => + { + if (t.IsGenericType) + { + var gd = t.GetGenericTypeDefinition(); + if (gd == typeof(IBuffer<>)) + return false; + } + return true; + }; + + Func filterHelper = m => + { + return !m.IsDefined(typeof(EditorBrowsableAttribute), false); + }; + + foreach (var group in mtch) + { + var oss = group.Enumerable.Where(m => filterReturn(m.ReturnType)).Select(m => GetSignature(m, false)).OrderBy(x => x).ToList(); + var qss = group.Queryable.Where(m => filterHelper(m)).Select(m => GetSignature(m, true)).OrderBy(x => x).ToList(); + + Assert.IsTrue(oss.SequenceEqual(qss), "Mismatch between QueryableEx and EnumerableEx for " + group.Name); + } + } + + public static string GetSignature(MethodInfo m, bool correct) + { + var ps = m.GetParameters(); + var pss = ps.AsEnumerable(); + if (correct && ps.Length > 0 && ps[0].ParameterType == typeof(IQueryProvider)) + pss = pss.Skip(1); + + var gens = m.IsGenericMethod ? string.Format("<{0}>", string.Join(", ", m.GetGenericArguments().Select(a => GetTypeName(a, correct)).ToArray())) : ""; + + var pars = string.Join(", ", pss.Select(p => (Attribute.IsDefined(p, typeof(ParamArrayAttribute)) ? "params " : "") + GetTypeName(p.ParameterType, correct) + " " + p.Name).ToArray()); + if (Attribute.IsDefined(m, typeof(ExtensionAttribute))) + { + if (pars.StartsWith("IQbservable") || pars.StartsWith("IQueryable")) + pars = "this " + pars; + } + + return string.Format("{0} {1}{2}({3})", GetTypeName(m.ReturnType, correct), m.Name, gens, pars); + } + + public static string GetTypeName(Type t, bool correct) + { + if (t.IsGenericType) + { + var gtd = t.GetGenericTypeDefinition(); + if (gtd == typeof(Expression<>)) + return GetTypeName(t.GetGenericArguments()[0], false); + + var args = string.Join(", ", t.GetGenericArguments().Select(a => GetTypeName(a, false)).ToArray()); + + var len = t.Name.IndexOf('`'); + var name = len >= 0 ? t.Name.Substring(0, len) : t.Name; + if (correct && name == "IQbservable") + name = "IObservable"; + if (correct && name == "IQueryable") + name = "IEnumerable"; + + return string.Format("{0}<{1}>", name, args); + } + + if (t.IsArray) + { + return GetTypeName(t.GetElementType(), correct) + "[]"; + } + + return t.Name; + } + + [TestMethod] + public void QueryableRetarget1() + { + var res = QueryableEx.Provider.Empty().AsEnumerable().ToList(); + Assert.IsTrue(res.SequenceEqual(new int[0])); + } + + [TestMethod] + public void QueryableRetarget2() + { + var res = QueryableEx.Provider.Return(42).AsEnumerable().ToList(); + Assert.IsTrue(res.SequenceEqual(new[] { 42 })); + } + + [TestMethod] + public void QueryableRetarget3() + { + var res = Enumerable.Range(0, 10).AsQueryable().TakeLast(2).AsEnumerable().ToList(); + Assert.IsTrue(res.SequenceEqual(new[] { 8, 9 })); + } + + [TestMethod] + public void QueryableRetarget4() + { + var res = QueryableEx.Provider.Range(0, 10).AsEnumerable().ToList(); + Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); + } + } +} + +#endif \ No newline at end of file diff --git a/Ix/Tests/Tests.Single.cs b/Ix/Tests/Tests.Single.cs new file mode 100644 index 0000000..6054f54 --- /dev/null +++ b/Ix/Tests/Tests.Single.cs @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + public partial class Tests + { + [TestMethod] + public void Hide_Arguments() + { + AssertThrows(() => EnumerableEx.Hide(null)); + } + + [TestMethod] + public void Hide() + { + var xs = new List { 1, 2, 3 }; + var ys = xs.Hide(); + Assert.IsFalse(ys is List); + Assert.IsTrue(xs.SequenceEqual(ys)); + } + + [TestMethod] + public void ForEach_Arguments() + { + AssertThrows(() => EnumerableEx.ForEach(null, x => { })); + AssertThrows(() => EnumerableEx.ForEach(new[] { 1 }, default(Action))); + AssertThrows(() => EnumerableEx.ForEach(null, (x, i) => { })); + AssertThrows(() => EnumerableEx.ForEach(new[] { 1 }, default(Action))); + } + + [TestMethod] + public void ForEach1() + { + var n = 0; + Enumerable.Range(5, 3).ForEach(x => n += x); + Assert.AreEqual(5 + 6 + 7, n); + } + + [TestMethod] + public void ForEach2() + { + var n = 0; + Enumerable.Range(5, 3).ForEach((x, i) => n += x * i); + Assert.AreEqual(5 * 0 + 6 * 1 + 7 * 2, n); + } + + [TestMethod] + public void Buffer_Arguments() + { + AssertThrows(() => EnumerableEx.Buffer(null, 5)); + AssertThrows(() => EnumerableEx.Buffer(null, 5, 3)); + AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 0)); + AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 5, 0)); + AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 0, 3)); + } + + [TestMethod] + public void Buffer1() + { + var rng = Enumerable.Range(0, 10); + + var res = rng.Buffer(3).ToList(); + Assert.AreEqual(4, res.Count); + + Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); + Assert.IsTrue(res[1].SequenceEqual(new[] { 3, 4, 5 })); + Assert.IsTrue(res[2].SequenceEqual(new[] { 6, 7, 8 })); + Assert.IsTrue(res[3].SequenceEqual(new[] { 9 })); + } + + [TestMethod] + public void Buffer2() + { + var rng = Enumerable.Range(0, 10); + + var res = rng.Buffer(5).ToList(); + Assert.AreEqual(2, res.Count); + + Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2, 3, 4 })); + Assert.IsTrue(res[1].SequenceEqual(new[] { 5, 6, 7, 8, 9 })); + } + + [TestMethod] + public void Buffer3() + { + var rng = Enumerable.Empty(); + + var res = rng.Buffer(5).ToList(); + Assert.AreEqual(0, res.Count); + } + + [TestMethod] + public void Buffer4() + { + var rng = Enumerable.Range(0, 10); + + var res = rng.Buffer(3, 2).ToList(); + Assert.AreEqual(5, res.Count); + + Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); + Assert.IsTrue(res[1].SequenceEqual(new[] { 2, 3, 4 })); + Assert.IsTrue(res[2].SequenceEqual(new[] { 4, 5, 6 })); + Assert.IsTrue(res[3].SequenceEqual(new[] { 6, 7, 8 })); + Assert.IsTrue(res[4].SequenceEqual(new[] { 8, 9 })); + } + + [TestMethod] + public void Buffer5() + { + var rng = Enumerable.Range(0, 10); + + var res = rng.Buffer(3, 4).ToList(); + Assert.AreEqual(3, res.Count); + + Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); + Assert.IsTrue(res[1].SequenceEqual(new[] { 4, 5, 6 })); + Assert.IsTrue(res[2].SequenceEqual(new[] { 8, 9 })); + } + + [TestMethod] + public void Do_Arguments() + { + AssertThrows(() => EnumerableEx.Do(null, _ => { })); + AssertThrows(() => EnumerableEx.Do(null, _ => { }, () => { })); + AssertThrows(() => EnumerableEx.Do(null, _ => { }, _ => { })); + AssertThrows(() => EnumerableEx.Do(null, _ => { }, _ => { }, () => { })); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action))); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), () => { })); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action))); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), _ => { }, () => { })); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action), () => { })); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, _ => { }, default(Action))); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), _ => { })); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action))); +#if !NO_RXINTERFACES + AssertThrows(() => EnumerableEx.Do(null, new MyObserver())); + AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(IObserver))); +#endif + } + + [TestMethod] + public void Do1() + { + var n = 0; + Enumerable.Range(0, 10).Do(x => n += x).ForEach(_ => { }); + Assert.AreEqual(45, n); + } + + [TestMethod] + public void Do2() + { + var n = 0; + Enumerable.Range(0, 10).Do(x => n += x, () => n *= 2).ForEach(_ => { }); + Assert.AreEqual(90, n); + } + + [TestMethod] + public void Do3() + { + var ex = new MyException(); + var ok = false; + AssertThrows(() => + EnumerableEx.Throw(ex).Do(x => { Assert.Fail(); }, e => { Assert.AreEqual(ex, e); ok = true; }).ForEach(_ => { }) + ); + Assert.IsTrue(ok); + } + +#if !NO_RXINTERFACES + [TestMethod] + public void Do4() + { + var obs = new MyObserver(); + Enumerable.Range(0, 10).Do(obs).ForEach(_ => { }); + + Assert.IsTrue(obs.Done); + Assert.AreEqual(45, obs.Sum); + } + + class MyObserver : IObserver + { + public int Sum; + public bool Done; + + public void OnCompleted() + { + Done = true; + } + + public void OnError(Exception error) + { + throw new NotImplementedException(); + } + + public void OnNext(int value) + { + Sum += value; + } + } +#endif + + [TestMethod] + public void Do5() + { + var sum = 0; + var done = false; + Enumerable.Range(0, 10).Do(x => sum += x, ex => { throw ex; }, () => done = true).ForEach(_ => { }); + + Assert.IsTrue(done); + Assert.AreEqual(45, sum); + } + + [TestMethod] + public void StartWith_Arguments() + { + AssertThrows(() => EnumerableEx.StartWith(null, 5)); + } + + [TestMethod] + public void StartWith1() + { + var e = Enumerable.Range(1, 5); + var r = e.StartWith(0).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, Enumerable.Range(0, 6))); + } + + [TestMethod] + public void StartWith2() + { + var oops = false; + var e = Enumerable.Range(1, 5).Do(_ => oops = true); + var r = e.StartWith(0).Take(1).ToList(); + Assert.IsFalse(oops); + } + + [TestMethod] + public void Expand_Arguments() + { + AssertThrows(() => EnumerableEx.Expand(null, _ => new[] { _ })); + AssertThrows(() => EnumerableEx.Expand(new[] { 1 }, null)); + } + + [TestMethod] + public void Expand1() + { + var res = new[] { 0 }.Expand(x => new[] { x + 1 }).Take(10).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, Enumerable.Range(0, 10))); + } + + [TestMethod] + public void Expand2() + { + var res = new[] { 3 }.Expand(x => Enumerable.Range(0, x)).ToList(); + var exp = new[] { + 3, + 0, 1, 2, + 0, + 0, 1, + 0 + }; + Assert.IsTrue(Enumerable.SequenceEqual(res, exp)); + } + + [TestMethod] + public void Distinct_Arguments() + { + AssertThrows(() => EnumerableEx.Distinct(null, _ => _)); + AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.Distinct(null, _ => _, EqualityComparer.Default)); + AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, null, EqualityComparer.Default)); + AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, _ => _, null)); + } + + [TestMethod] + public void Distinct1() + { + var res = Enumerable.Range(0, 10).Distinct(x => x % 5).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, Enumerable.Range(0, 5))); + } + + [TestMethod] + public void Distinct2() + { + var res = Enumerable.Range(0, 10).Distinct(x => x % 5, new MyEqualityComparer()).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0, 1 })); + } + + class MyEqualityComparer : IEqualityComparer + { + public bool Equals(int x, int y) + { + return x % 2 == y % 2; + } + + public int GetHashCode(int obj) + { + return EqualityComparer.Default.GetHashCode(obj % 2); + } + } + + [TestMethod] + public void DistinctUntilChanged_Arguments() + { + AssertThrows(() => EnumerableEx.DistinctUntilChanged(null)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, EqualityComparer.Default)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, _ => _)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, _ => _, EqualityComparer.Default)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null, EqualityComparer.Default)); + AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, _ => _, null)); + } + + [TestMethod] + public void DistinctUntilChanged1() + { + var res = new[] { 1, 2, 2, 3, 3, 3, 2, 2, 1 }.DistinctUntilChanged().ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 2, 1 })); + } + + [TestMethod] + public void DistinctUntilChanged2() + { + var res = new[] { 1, 1, 2, 3, 4, 5, 5, 6, 7 }.DistinctUntilChanged(x => x / 2).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 4, 6 })); + } + + [TestMethod] + public void IgnoreElements_Arguments() + { + AssertThrows(() => EnumerableEx.IgnoreElements(null)); + } + + [TestMethod] + public void IgnoreElements() + { + var n = 0; + Enumerable.Range(0, 10).Do(_ => n++).IgnoreElements().Take(5).ForEach(_ => { }); + Assert.AreEqual(10, n); + } + + [TestMethod] + public void TakeLast_Arguments() + { + AssertThrows(() => EnumerableEx.TakeLast(null, 5)); + AssertThrows(() => EnumerableEx.TakeLast(new[] { 1 }, -1)); + } + + [TestMethod] + public void TakeLast_Empty() + { + var e = Enumerable.Empty(); + var r = e.TakeLast(1).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e)); + } + + [TestMethod] + public void TakeLast_All() + { + var e = Enumerable.Range(0, 5); + var r = e.TakeLast(5).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e)); + } + + [TestMethod] + public void TakeLast_Part() + { + var e = Enumerable.Range(0, 5); + var r = e.TakeLast(3).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e.Skip(2))); + } + + [TestMethod] + public void SkipLast_Arguments() + { + AssertThrows(() => EnumerableEx.SkipLast(null, 5)); + AssertThrows(() => EnumerableEx.SkipLast(new[] { 1 }, -1)); + } + + [TestMethod] + public void SkipLast_Empty() + { + var e = Enumerable.Empty(); + var r = e.SkipLast(1).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e)); + } + + [TestMethod] + public void SkipLast_All() + { + var e = Enumerable.Range(0, 5); + var r = e.SkipLast(0).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e)); + } + + [TestMethod] + public void SkipLast_Part() + { + var e = Enumerable.Range(0, 5); + var r = e.SkipLast(3).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(r, e.Take(2))); + } + + [TestMethod] + public void Scan_Arguments() + { + AssertThrows(() => EnumerableEx.Scan(null, (x, y) => x + y)); + AssertThrows(() => EnumerableEx.Scan(new[] { 1 }, null)); + AssertThrows(() => EnumerableEx.Scan(null, 0, (x, y) => x + y)); + AssertThrows(() => EnumerableEx.Scan(new[] { 1 }, 0, null)); + } + + [TestMethod] + public void Scan1() + { + var res = Enumerable.Range(0, 5).Scan((n, x) => n + x).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 3, 6, 10 })); + } + + [TestMethod] + public void Scan2() + { + var res = Enumerable.Range(0, 5).Scan(10, (n, x) => n - x).ToList(); + Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 10, 9, 7, 4, 0 })); + } + } +} diff --git a/Ix/Tests/Tests.cs b/Ix/Tests/Tests.cs new file mode 100644 index 0000000..27dca14 --- /dev/null +++ b/Ix/Tests/Tests.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + [TestClass] + public partial class Tests + { + public void AssertThrows(Action a) + where E : Exception + { + try + { + a(); + Assert.Fail(); + } + catch (E) + { + } + } + + public void AssertThrows(Action a, Func assert) + where E : Exception + { + try + { + a(); + Assert.Fail(); + } + catch (E e) + { + Assert.IsTrue(assert(e)); + } + } + + public void NoNext(IEnumerator e) + { + Assert.IsFalse(e.MoveNext()); + } + + public void HasNext(IEnumerator e, T value) + { + Assert.IsTrue(e.MoveNext()); + Assert.AreEqual(value, e.Current); + } + } +} diff --git a/Ix/Tests/Tests.csproj b/Ix/Tests/Tests.csproj new file mode 100644 index 0000000..f3f57ff --- /dev/null +++ b/Ix/Tests/Tests.csproj @@ -0,0 +1,91 @@ + + + + Debug + AnyCPU + + + 2.0 + {C4C8532A-F8D2-428B-962E-FD578A1E647C} + Library + Properties + Tests + Tests + v4.0 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + + true + true + $(AssemblyName).xap + true + Properties\AppManifest.xml + InteractiveTests.App + TestPage.html + true + + + + _$(AssemblyName) + + + + + ..\..\..\..\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll + + + + + + + + + true + + + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + {7269A578-326A-4C3E-9874-A2D2600095BC} + System.Interactive.Async + + + {6D62E966-469D-4A99-BD43-0A17FA14FB4F} + System.Interactive.Providers + + + {8E4B04F0-915E-48F9-9796-76278C6094BD} + System.Interactive + + + + \ No newline at end of file diff --git a/Ix/TraceAndTestImpact.testsettings b/Ix/TraceAndTestImpact.testsettings new file mode 100644 index 0000000..363295b --- /dev/null +++ b/Ix/TraceAndTestImpact.testsettings @@ -0,0 +1,21 @@ + + + These are test settings for Trace and Test Impact. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix/license.txt b/Ix/license.txt new file mode 100644 index 0000000..d7fd6c0 --- /dev/null +++ b/Ix/license.txt @@ -0,0 +1,15 @@ +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://aspnetwebstack.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/README.md b/README.md new file mode 100644 index 0000000..7a0a1e2 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Reactive Extensions Libraries + + +Tx is set of code samples showing how to use LINQ to events, such as: + +* **Real-Time standing queries:**. E.g. producing a histogram every second how many bytes were send/received over TCP per IP address. +* **Queries on past history from trace/log files:** E.g. from past trace of IIS find the slow requests by correlating "begin" and "end" events. + +The initial set of supported technologies is: + +* Event Tracing for Windows (ETW) +* Windows Event Logs +* SQL Server Extended Events (XEvent) + + + +* Reactive Extensions: ** Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. ** RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. ** Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. * Interactive Extensions ** Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. ** IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. ** Ix++: An implantation of LINQ for Native Developers in C++ * Bindings: ** Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. ** LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. +#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. You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. + + + + + + diff --git a/Rx++/.gitattributes b/Rx++/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/Rx++/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/Rx++/.gitignore b/Rx++/.gitignore new file mode 100644 index 0000000..5ebd21a --- /dev/null +++ b/Rx++/.gitignore @@ -0,0 +1,163 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## 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/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# 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 + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.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 + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp new file mode 100644 index 0000000..ed928a0 --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + + +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "MfcTimeFliesLikeAnArrow.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// CMainFrame + +IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + ON_WM_CREATE() +// ON_WM_SETFOCUS() + ON_WM_CLOSE() + ON_WM_MOUSEMOVE() + ON_WM_PAINT() +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here +} + +CMainFrame::~CMainFrame() +{ +} + + +// inspired by: http://minirx.codeplex.com/ +void CMainFrame::UserInit() +{ + auto mouseMove = BindEventToObservable(mouseMoveEvent); + + // set up labels and query + auto msg = L"Time flies like an arrow"; + + for (int i = 0; msg[i]; ++i) + { + auto label = CreateLabelFromLetter(msg[i], this); + + // note: distinct_until_changed is necessary; while + // Winforms filters duplicate mouse moves, + // user32 doesn't filter this for you: http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx + + auto s = rxcpp::from(mouseMove) + .select([](MouseMoveEventValue e) { return e.point; }) + .distinct_until_changed() + .delay(i * 100 + 1) + .on_dispatcher() + .subscribe([=](CPoint point) + { + label->SetWindowPos(nullptr, point.x+20*i, point.y-20, 20, 30, SWP_NOOWNERZORDER); + label->Invalidate(); + + // repaint early, for fluid animation + label->UpdateWindow(); + this->UpdateWindow(); + }); + + composableDisposable.Add(s); + } +} + +void CMainFrame::OnClose() +{ + // TODO: figure out cause of crash -- until then, exit instead + ::ExitProcess(0); + + // shutdown subscription. + composableDisposable.Dispose(); + + CFrameWnd::OnClose(); +} + + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndStatusBar.Create(this)) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); + + UserInit(); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CFrameWnd::PreCreateWindow(cs) ) + return FALSE; + + cs.dwExStyle &= ~WS_EX_CLIENTEDGE; + cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW)); + return TRUE; +} + +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} +#endif //_DEBUG + + +// CMainFrame message handlers + +void CMainFrame::OnSetFocus(CWnd* /*pOldWnd*/) +{ + // forward focus to the view window + //m_wndView.SetFocus(); +} + +BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) +{ + // let the view have first crack at the command + //if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) + // return TRUE; + + // otherwise, do default handling + return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); +} + +void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) +{ + MouseMoveEventValue v = {nFlags, point}; + this->mouseMoveEvent(v); +} + +void CMainFrame::OnPaint( ) +{ + CPaintDC dc(this); // device context for painting + + RECT rc; + this->GetClientRect(&rc); + CBrush brush; + brush.CreateSolidBrush(RGB(240,240,240)); + dc.FillRect(&rc, &brush); +} + diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h b/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h new file mode 100644 index 0000000..040bc7d --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + + +// MainFrm.h : interface of the CMainFrame class +// + +#pragma once + + +template +static std::shared_ptr> + BindEventToObservable(std::function& event) +{ + auto eSubject = rxcpp::CreateSubject(); + event = [=](const T& eventValue) { + eSubject->OnNext(eventValue); + }; + return eSubject; +} + +inline CStatic* CreateLabelFromLetter(wchar_t c, CWnd* parent) +{ + CStatic* label; + label = new CStatic(); + + RECT r = { 0, 0, }; + r.right = r.left+20; + r.bottom = r.top + 30; + + auto message = new std::wstring(&c, &c+1); + label->Create( + message->c_str(), + WS_CHILD | WS_VISIBLE, + r, + parent); + return label; +} + +class CMainFrame : public CFrameWnd +{ + +public: + CMainFrame(); +protected: + DECLARE_DYNAMIC(CMainFrame) + +// Attributes +public: + +// Operations +public: + +// Overrides +public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + + struct MouseMoveEventValue + { + UINT nFlags; + CPoint point; + }; + + std::function mouseMoveEvent; + +// Generated message map functions +protected: + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnSetFocus(CWnd *pOldWnd); + afx_msg void OnClose(); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnPaint( ); + + DECLARE_MESSAGE_MAP() + + void UserInit(); + rxcpp::ComposableDisposable composableDisposable; +}; + + diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp new file mode 100644 index 0000000..59c726a --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +// MfcTimeFliesLikeAnArrow.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "afxwinappex.h" +#include "afxdialogex.h" +#include "MfcTimeFliesLikeAnArrow.h" +#include "MainFrm.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CMfcTimeFliesLikeAnArrowApp + +BEGIN_MESSAGE_MAP(CMfcTimeFliesLikeAnArrowApp, CWinApp) + ON_COMMAND(ID_APP_ABOUT, &CMfcTimeFliesLikeAnArrowApp::OnAppAbout) +END_MESSAGE_MAP() + + +// CMfcTimeFliesLikeAnArrowApp construction + +CMfcTimeFliesLikeAnArrowApp::CMfcTimeFliesLikeAnArrowApp() +{ + // support Restart Manager + m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; +#ifdef _MANAGED + // If the application is built using Common Language Runtime support (/clr): + // 1) This additional setting is needed for Restart Manager support to work properly. + // 2) In your project, you must add a reference to System.Windows.Forms in order to build. + System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException); +#endif + + // TODO: replace application ID string below with unique ID string; recommended + // format for string is CompanyName.ProductName.SubProduct.VersionInformation + SetAppID(_T("MfcTimeFliesLikeAnArrow.AppID.NoVersion")); + + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +// The one and only CMfcTimeFliesLikeAnArrowApp object + +CMfcTimeFliesLikeAnArrowApp theApp; + + +// CMfcTimeFliesLikeAnArrowApp initialization + +BOOL CMfcTimeFliesLikeAnArrowApp::InitInstance() +{ + // InitCommonControlsEx() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + INITCOMMONCONTROLSEX InitCtrls; + InitCtrls.dwSize = sizeof(InitCtrls); + // Set this to include all the common control classes you want to use + // in your application. + InitCtrls.dwICC = ICC_WIN95_CLASSES; + InitCommonControlsEx(&InitCtrls); + + CWinApp::InitInstance(); + + + EnableTaskbarInteraction(FALSE); + + // AfxInitRichEdit2() is required to use RichEdit control + // AfxInitRichEdit2(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + + // To create the main window, this code creates a new frame window + // object and then sets it as the application's main window object + CMainFrame* pFrame = new CMainFrame; + if (!pFrame) + return FALSE; + m_pMainWnd = pFrame; + // create and load the frame with its resources + pFrame->LoadFrame(IDR_MAINFRAME, + WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, + NULL); + + + + + + // The one and only window has been initialized, so show and update it + pFrame->ShowWindow(SW_SHOW); + pFrame->UpdateWindow(); + return TRUE; +} + +int CMfcTimeFliesLikeAnArrowApp::ExitInstance() +{ + //TODO: handle additional resources you may have added + return CWinApp::ExitInstance(); +} + +// CMfcTimeFliesLikeAnArrowApp message handlers + + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialogEx +{ +public: + CAboutDlg(); + +// Dialog Data + enum { IDD = IDD_ABOUTBOX }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) +END_MESSAGE_MAP() + +// App command to run the dialog +void CMfcTimeFliesLikeAnArrowApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +// CMfcTimeFliesLikeAnArrowApp message handlers + + + diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h new file mode 100644 index 0000000..b13b068 --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + + +// MfcTimeFliesLikeAnArrow.h : main header file for the MfcTimeFliesLikeAnArrow application +// +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CMfcTimeFliesLikeAnArrowApp: +// See MfcTimeFliesLikeAnArrow.cpp for the implementation of this class +// + +class CMfcTimeFliesLikeAnArrowApp : public CWinApp +{ +public: + CMfcTimeFliesLikeAnArrowApp(); + + +// Overrides +public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + +// Implementation + +public: + afx_msg void OnAppAbout(); + DECLARE_MESSAGE_MAP() +}; + +extern CMfcTimeFliesLikeAnArrowApp theApp; diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc new file mode 100644 index 0000000..928bb2f --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc @@ -0,0 +1,276 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#include "afxres.h" +#include "verrsrc.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#ifdef APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#include ""afxres.h""\r\n" + "#include ""verrsrc.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#include ""res\\MfcTimeFliesLikeAnArrow.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +IDR_MAINFRAME ICON "res\\MfcTimeFliesLikeAnArrow.ico" +#endif +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", ID_APP_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO + MENUITEM SEPARATOR + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&View" + BEGIN + MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR + END + POPUP "&Help" + BEGIN + MENUITEM "&About MfcTimeFliesLikeAnArrow...", ID_APP_ABOUT + END +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS +BEGIN + "C", ID_EDIT_COPY, VIRTKEY,CONTROL,NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY,CONTROL,NOINVERT + VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT,NOINVERT + VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT,NOINVERT + VK_F6, ID_NEXT_PANE, VIRTKEY ,NOINVERT + VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT,NOINVERT + VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL,NOINVERT + VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT,NOINVERT + "X", ID_EDIT_CUT, VIRTKEY,CONTROL,NOINVERT + "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL,NOINVERT +END + + + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About MfcTimeFliesLikeAnArrow" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 + LTEXT "MfcTimeFliesLikeAnArrow, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX + LTEXT "Copyright (C) 2012",IDC_STATIC,42,26,114,8 + DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP +END + + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "MfcTimeFliesLikeAnArrow" + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "MfcTimeFliesLikeAnArrow.exe" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename","MfcTimeFliesLikeAnArrow.exe" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 163 + TOPMARGIN, 7 + BOTTOMMARGIN, 55 + END +END +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN +// Non-mac-targeting apps remove the two extra substrings + IDR_MAINFRAME "MfcTimeFliesLikeAnArrow" +END +STRINGTABLE +BEGIN + AFX_IDS_APP_TITLE "MfcTimeFliesLikeAnArrow" + AFX_IDS_IDLEMESSAGE "Ready" +END +STRINGTABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END +STRINGTABLE +BEGIN + ID_APP_ABOUT "Display program information, version number and copyright\nAbout" + ID_APP_EXIT "Quit the application; prompts to save documents\nExit" + ID_NEXT_PANE "Switch to the next window pane\nNext Pane" + ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" + ID_WINDOW_SPLIT "Split the active window into panes\nSplit" + ID_EDIT_CLEAR "Erase the selection\nErase" + ID_EDIT_CLEAR_ALL "Erase everything\nErase All" + ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" + ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" + ID_EDIT_FIND "Find the specified text\nFind" + ID_EDIT_PASTE "Insert Clipboard contents\nPaste" + ID_EDIT_REPEAT "Repeat the last action\nRepeat" + ID_EDIT_REPLACE "Replace specific text with different text\nReplace" + ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" + ID_EDIT_UNDO "Undo the last action\nUndo" + ID_EDIT_REDO "Redo the previously undone action\nRedo" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle Status Bar" +END + +STRINGTABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCNEXTWINDOW "Switch to the next document window" + AFX_IDS_SCPREVWINDOW "Switch to the previous document window" + AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" + AFX_IDS_SCRESTORE "Restore the window to normal size" + AFX_IDS_SCTASKLIST "Activate Task List" +END + + +#endif + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#include "res\\MfcTimeFliesLikeAnArrow.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +#endif // not APSTUDIO_INVOKED diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj new file mode 100644 index 0000000..ecef98f --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj @@ -0,0 +1,137 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + $(VCTargetsPath11) + + + {E773817F-F3E5-4E78-ADD3-B70E11F611B6} + MfcTimeFliesLikeAnArrow + MFCProj + + + + Application + true + v110 + Unicode + Static + + + Application + false + v110 + true + Unicode + Static + + + + + + + + + + + + + true + $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(SolutionDir)\bin\$(Configuration)\ + obj\$(Configuration)\ + + + false + $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(SolutionDir)\bin\$(Configuration)\ + obj\$(Configuration)\ + + + + Use + Level3 + Disabled + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + + + Windows + true + + + false + true + _DEBUG;%(PreprocessorDefinitions) + + + 0x0409 + _DEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + false + true + NDEBUG;%(PreprocessorDefinitions) + + + 0x0409 + NDEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters new file mode 100644 index 0000000..0b65204 --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters @@ -0,0 +1,63 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt b/Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt new file mode 100644 index 0000000..75971ad --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt @@ -0,0 +1,95 @@ +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : MfcTimeFliesLikeAnArrow Project Overview +=============================================================================== + +The application wizard has created this MfcTimeFliesLikeAnArrow application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your MfcTimeFliesLikeAnArrow application. + +MfcTimeFliesLikeAnArrow.vcxproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +MfcTimeFliesLikeAnArrow.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +MfcTimeFliesLikeAnArrow.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CMfcTimeFliesLikeAnArrowApp application class. + +MfcTimeFliesLikeAnArrow.cpp + This is the main application source file that contains the application + class CMfcTimeFliesLikeAnArrowApp. + +MfcTimeFliesLikeAnArrow.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\MfcTimeFliesLikeAnArrow.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file MfcTimeFliesLikeAnArrow.rc. + +res\MfcTimeFliesLikeAnArrow.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + The project includes a standard MFC interface. + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CFrameWnd and controls all SDI frame features. + +///////////////////////////////////////////////////////////////////////////// + + + +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named MfcTimeFliesLikeAnArrow.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +MfcTimeFliesLikeAnArrow.manifest + Application manifest files are used by Windows XP to describe an applications + dependency on specific versions of Side-by-Side assemblies. The loader uses this + information to load the appropriate assembly from the assembly cache or private + from the application. The Application manifest maybe included for redistribution + as an external .manifest file that is installed in the same folder as the application + executable or it may be included in the executable in the form of a resource. +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, you will need +to redistribute the MFC DLLs. If your application is in a language +other than the operating system's locale, you will also have to +redistribute the corresponding localized resources mfc110XXX.DLL. +For more information on both of these topics, please see the section on +redistributing Visual C++ applications in MSDN documentation. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Rx++/MfcTimeFliesLikeAnArrow/Resource.h b/Rx++/MfcTimeFliesLikeAnArrow/Resource.h new file mode 100644 index 0000000..f5a491a --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/Resource.h @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by MfcTimeFliesLikeAnArrow.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_MfcTimeFliesLikTYPE 130 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 310 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 310 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif diff --git a/Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico b/Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico new file mode 100644 index 0000000000000000000000000000000000000000..d56fbcdfdf6eac0f4727c34770c26689271d96af GIT binary patch literal 67777 zcmZQzU}WHBFfb5cU}Run$Y5h&xW>T1pr8QZzhGiuuw!RnkdT1#85tPVxEL4&1R#73 zMg|5x9tH*j1CTi!3@i8;7|eJ<`k{Od28MgmApH>j2{s0XHWiS52tR|Bfx%Ck0Sp)! z6c|oVW?G;u;o_;LN%>kr=-B>w6 zS)GCX`J4X!{vUX$w3C}$Lsok^tF}c)TD(aFqoSgCz~53sw*?q z^;P_6OFwq3EUhFZfuVZ2`8K0sBXi|sj`H_E@{XscA3t_1C4s@bx}&*RIXT(H$gaKP z`|+}zva+(W;|>hf%l~&3gVd{P)b;;({-!PG`LXo01cvhM{msS8)y>t7^1Ix|{$1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Fqe9S0Hir ztYk%$9>LTnr*bQ=ZTlZ{cJBZ3-Y@@e-v9Og=db_&FI@fl-_+^A|Cr1h|7CR#{ufl( z^q)asRV^gNppqG9SMdiPo>o~f`S<_-|Nj4Xi@F1j6C=B0|C0*tg4Z!hsPFpEBfAz} zN28hm;k9k}|Nq(BKmRQwAN&tWz5n0V^V0vS)@T3q9nSxk(>wHERCOy}{auIt{*Rmb z@qcp9oBvbSfBD}!|NZ~&h423-72Nx8>T>$OqTvC&`u9Hm_jC8{KmV5>|M5Sm@7;g@ zvX}oIlb-&s?0)^fb;7g%Zo%hTATGsCc5eMPDR0Jy|KYW-!0Srvq8|OX3ViV1Ch)_%ft1Br}9CWHRJ3q%ycM7%?a?=rSlU6oFOdGn6tEF(iZ8AoDUAlEJEr8S)v@7)lrv z7{VAb8HyQ784?+C7!(+s8MGO+859^&81kWd@)+{L>QWg}7&5^u5DhXtnW2OshoKVg zUXZ&%SeYS{A&nu0A(bJGL4m=MA%G#6A%r26!G*z-!Ji?X!IQy{A&kMF!JEOA!3C^a znIRSGiy{UEh7yJhu$vSZ(ik!sau`w>6rg-`w{u(h0&K^@9_`Tn7sI6owQA1%_OPM20+Q41?lJfdLkmAR2p0$pFVlDuW&vg3JWr M!Rcd=t3a*;0Hl#_rT_o{ literal 0 HcmV?d00001 diff --git a/Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp b/Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp new file mode 100644 index 0000000..4f165ae --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +// stdafx.cpp : source file that includes just the standard includes +// MfcTimeFliesLikeAnArrow.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + diff --git a/Rx++/MfcTimeFliesLikeAnArrow/stdafx.h b/Rx++/MfcTimeFliesLikeAnArrow/stdafx.h new file mode 100644 index 0000000..8b2f9dd --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/stdafx.h @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include "targetver.h" + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions + + + + + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include // MFC support for ribbons and control bars + + + + + + + + + +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + +// STL includes +#include +#include +#include +#include +#include +#include + +#include "rxcpp.h" + diff --git a/Rx++/MfcTimeFliesLikeAnArrow/targetver.h b/Rx++/MfcTimeFliesLikeAnArrow/targetver.h new file mode 100644 index 0000000..b447c86 --- /dev/null +++ b/Rx++/MfcTimeFliesLikeAnArrow/targetver.h @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/Rx++/RxCpp.sln b/Rx++/RxCpp.sln new file mode 100644 index 0000000..76d33c8 --- /dev/null +++ b/Rx++/RxCpp.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testbench", "testbench\testbench.vcxproj", "{6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MfcTimeFliesLikeAnArrow", "MfcTimeFliesLikeAnArrow\MfcTimeFliesLikeAnArrow.vcxproj", "{E773817F-F3E5-4E78-ADD3-B70E11F611B6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Debug|Win32.ActiveCfg = Debug|Win32 + {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Debug|Win32.Build.0 = Debug|Win32 + {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Release|Win32.ActiveCfg = Release|Win32 + {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Release|Win32.Build.0 = Release|Win32 + {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Debug|Win32.ActiveCfg = Debug|Win32 + {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Debug|Win32.Build.0 = Debug|Win32 + {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Release|Win32.ActiveCfg = Release|Win32 + {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Rx++/license.txt b/Rx++/license.txt new file mode 100644 index 0000000..d7fd6c0 --- /dev/null +++ b/Rx++/license.txt @@ -0,0 +1,15 @@ +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://aspnetwebstack.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++/testbench/rxcpp-binder.h b/Rx++/testbench/rxcpp-binder.h new file mode 100644 index 0000000..0c48e7d --- /dev/null +++ b/Rx++/testbench/rxcpp-binder.h @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +namespace rxcpp +{ + template + class Binder + { + Obj obj; + public: + Binder(Obj&& obj) : obj(std::move(obj)) + { + } + template + auto select(S selector) -> decltype(from(Select(obj, selector))) { + return from(Select(obj, selector)); + } + template + auto where(P predicate) -> decltype(from(Where(obj, predicate))) { + return from(Where(obj, predicate)); + } + template + auto take(Integral n) -> decltype(from(Take(obj, n))) { + return from(Take(obj, n)); + } + auto delay(int milliseconds) -> decltype(from(Delay(obj, milliseconds))) { + return from(Delay(obj, milliseconds)); + } + auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { + return from(LimitWindow(obj, milliseconds)); + } + auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { + return from(DistinctUntilChanged(obj)); + } + auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) + { + return from(ObserveOnDispatcher(obj)); + } + template + auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { + return Subscribe(obj, onNext); + } + }; + template + Binder from(Obj&& obj) { return Binder(std::move(obj)); } + +} \ No newline at end of file diff --git a/Rx++/testbench/rxcpp.h b/Rx++/testbench/rxcpp.h new file mode 100644 index 0000000..926ae68 --- /dev/null +++ b/Rx++/testbench/rxcpp.h @@ -0,0 +1,889 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +namespace rxcpp +{ + + ////////////////////////////////////////////////////////////////////// + // + // Abstract interfaces + + template + struct Observer + { + virtual void OnNext(const T&) {}; + virtual void OnCompleted() {}; + virtual void OnError(const std::exception_ptr&) {}; + + virtual ~Observer() {} + }; + + class Disposable + { + std::function dispose; + public: + Disposable(std::function dispose) : dispose(std::move(dispose)) + { + } + void Dispose() + { + if (dispose) dispose(); + } + }; + + template + struct Observable + { + virtual Disposable Subscribe(std::shared_ptr> observer) = 0; + virtual ~Observable() {} + }; + + + + ////////////////////////////////////////////////////////////////////// + // + // constructors + + template + class CreatedObservable : public Observable + { + S subscribe; + + public: + CreatedObservable(S subscribe) : subscribe(std::move(subscribe)) + { + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + return subscribe(std::move(observer)); + } + }; + + template + std::shared_ptr> CreateObservable(S subscribe) + { + return std::make_shared>(std::move(subscribe)); + } + + template + struct CreatedObserver : public Observer + { + std::function onNext; + std::function onCompleted; + std::function onError; + + virtual void OnNext(const T& element) + { + try + { + if(onNext) + { + onNext(element); + } + } + catch (...) + { + OnError(std::current_exception()); + } + } + virtual void OnCompleted() + { + if(onCompleted) + { + onCompleted(); + clear(); + } + } + virtual void OnError(const std::exception_ptr& error) + { + if(onError) + { + onError(error); + clear(); + } + } + void clear() + { + onNext = nullptr; + onCompleted = nullptr; + onError = nullptr; + } + }; + + template + std::shared_ptr> CreateObserver( + std::function onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto p = std::make_shared>(); + p->onNext = std::move(onNext); + p->onCompleted = std::move(onCompleted); + p->onError = std::move(onError); + + return p; + } + + template + class Subject : + public Observable, + public Observer, + public std::enable_shared_from_this> + { + std::vector>> observers; + public: + virtual void OnNext(const T& element) + { + for(auto& o : observers) + { + try + { + if (o) + o->OnNext(element); + } + catch (...) + { + auto o_ = std::move(o); + o_->OnError(std::current_exception()); + } + } + } + virtual void OnCompleted() + { + for(auto& o : observers) + { + if (o) { + o->OnCompleted(); + o = nullptr; + } + } + } + virtual void OnError(const std::exception_ptr& error) + { + for(auto& o : observers) + { + if (o) { + o->OnError(error); + o = nullptr; + } + } + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d = [wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }; + + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(std::move(observer)); + return d; + } + + private: + void RemoveObserver(std::shared_ptr> toRemove) + { + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } + }; + + template + std::shared_ptr> CreateSubject() + { + return std::make_shared>(); + } + + + ////////////////////////////////////////////////////////////////////// + // + // imperative functions + + template + Disposable Subscribe( + const std::shared_ptr>& source, + typename std::identity>::type onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); + + return source->Subscribe(observer); + } + + template + struct fix0_thunk { + F f; + fix0_thunk(F&& f) : f(std::move(f)) + { + } + void operator()() const + { + f(*this); + } + }; + template + fix0_thunk fix0(F f) + { + return fix0_thunk(std::move(f)); + } + + template + auto Range( + Integral start, Integral end = (Integral)-1, Integral step = 1 + ) + -> std::shared_ptr> + { + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = (end - start) / step; + + DefaultScheduler::Instance().Schedule( + fix0([=](std::function self) // TODO: + { + try { + if (state->cancel) + return; + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + ++state->i; + DefaultScheduler::Instance().Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + })); + + return [=]{ state->cancel = true; }; + }); + } + + // reference handle type for a container for composing disposables + class ComposableDisposable + { + struct State + { + std::vector disposables; + std::mutex lock; + bool isDisposed; + + State() : isDisposed(false) + { + } + void Add(Disposable&& d) + { + std::unique_lock guard(lock); + if (isDisposed) { + guard.unlock(); + d.Dispose(); + } else { + disposables.push_back(std::move(d)); + } + } + void Dispose() + { + std::unique_lock guard(lock); + + isDisposed = true; + auto v = std::move(disposables); + guard.unlock(); + + std::for_each(v.begin(), v.end(), + [](Disposable& d) { d.Dispose(); }); + } + }; + + std::shared_ptr state; + + public: + ComposableDisposable() : state(new State) + { + } + void Add(Disposable d) const + { + state->Add(std::move(d)); + } + void Dispose() const + { + state->Dispose(); + } + operator Disposable() const + { + auto d = Disposable([=]{ + state->Dispose(); + }); + return d; + } + }; + + + + ////////////////////////////////////////////////////////////////////// + // + // standard query operators + + template + auto Select( + const std::shared_ptr>& source, + S selector + ) + -> const std::shared_ptr::type>> + { + typedef typename std::result_of::type U; + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = selector(element); + observer->OnNext(std::move(result)); + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + const std::shared_ptr> Where( + const std::shared_ptr>& source, + P predicate + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = predicate(element); + if (result) + { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + template + std::shared_ptr> Take( + const std::shared_ptr>& source, + int n // TODO: long long? + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto remaining = std::make_shared(n); + + ComposableDisposable cd; + + auto d = Subscribe( + source, + // on next + [=](const T& element) + { + if (*remaining) + { + observer->OnNext(element); + if (--*remaining == 0) + { + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on completed + [=] + { + if (*remaining) + { + observer->OnCompleted(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + if (*remaining) + { + observer->OnError(error); + } + }); + cd.Add(std::move(d)); + return cd; + }); + } + + + + ////////////////////////////////////////////////////////////////////// + // + // time and schedulers + + struct DefaultScheduler + { + private: DefaultScheduler(const DefaultScheduler&); + public: + static DefaultScheduler& Instance() + { + // TODO: leaks. race condition on atexit though. + static DefaultScheduler* instance = new DefaultScheduler; + return *instance; + } + + typedef std::function Work; + + std::atomic trampoline; + + std::vector queue; + + std::thread worker_thread; + DefaultScheduler() : trampoline(0), shutdownRequested(false) + { + worker_thread = std::thread([=]{ worker(); }); + } + ~DefaultScheduler() + { + std::unique_lock guard(scheduleLock); + shutdownRequested = true; + guard.unlock(); + cv.notify_one(); + } + + void Schedule(Work work) + { + try { + if (++trampoline == 1) + { + work(); + + while(!queue.empty()) + { + work = std::move(queue.back()); + queue.pop_back(); + work(); + } + + } + else + { + queue.push_back(std::move(work)); + } + } + catch (...) + { + --trampoline; + throw; + } + } + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + typedef std::chrono::steady_clock Clock; + + bool shutdownRequested; + std::mutex scheduleLock; + std::condition_variable cv; + std::priority_queue< std::pair, + std::vector>, + compare_work > scheduledWork; + + + void Schedule(int milliseconds, Work work) + { + Clock::time_point dueTime = Clock::now() + std::chrono::duration(milliseconds); + + std::unique_lock guard(scheduleLock); + bool wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; + + scheduledWork.push(std::make_pair(dueTime, std::move(work))); + + guard.unlock(); + + if (wake) + cv.notify_one(); + } + private: + void worker() + { + std::unique_lock guard(scheduleLock); + + while(!shutdownRequested) + { + + if (scheduledWork.empty()) + { + cv.wait(guard); + continue; + } + + auto now = Clock::now(); + auto dueTime = scheduledWork.top().first; + if (dueTime > now) + { + cv.wait_until(guard, dueTime); + continue; + } + + // dispatch work + auto work = std::move(scheduledWork.top().second); + scheduledWork.pop(); + + guard.unlock(); + try { + work(); + } catch (...) { + // TODO: ??? what now? + } + guard.lock(); + } + } + }; + + template + std::shared_ptr> Delay( + const std::shared_ptr>& source, + int milliseconds) + { + // TODO: for some reason, poor interactions take place if + // on_dispatcher() dispatches from UI thread. +#if 0 + if (milliseconds == 0) + return source; +#endif + + + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ *cancel = true; })); + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + // TODO: queue + DefaultScheduler::Instance().Schedule( + milliseconds, + [=]{ + if (!*cancel) + observer->OnNext(element); + }); + }, + // on completed + [=] + { + DefaultScheduler::Instance().Schedule( + milliseconds, + [=]{ + if (!*cancel) + observer->OnCompleted(); + }); + }, + // on error + [=](const std::exception_ptr& error) + { + if (!*cancel) + observer->OnError(error); + })); + return cd; + }); + } + + // no more than one event ever 'milliseconds' + // TODO: oops, this is not the right definition for throttle. + template + std::shared_ptr> LimitWindow( + const std::shared_ptr>& source, + int milliseconds) + { + if (milliseconds == 0) + return source; + + return CreateObservable( + [=](std::shared_ptr> observer) + { + struct State { + ULONGLONG dueTime; + }; + + auto state = std::make_shared(); + state->dueTime = 0; + + return Subscribe( + source, + // on next + [=](const T& element) + { + auto now = ::GetTickCount64(); + + if (now >= state->dueTime) + { + observer->OnNext(element); + state->dueTime = now + (ULONGLONG)milliseconds; + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 + template + std::shared_ptr> DistinctUntilChanged( + const std::shared_ptr>& source) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + struct State { + T last; bool hasValue; + }; + + auto state = std::make_shared(); + state->hasValue = false; + + return Subscribe( + source, + // on next + [=](const T& element) + { + if (!state->hasValue || state->last != element) + { + observer->OnNext(element); + state->last = element; + state->hasValue = true; + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + + + + struct ObserveOnDispatcherOp + { + HWND hwnd; + + ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) + { + if (!hwnd) + throw std::exception("error"); + } + ~ObserveOnDispatcherOp() + { + // send one last message to ourselves to shutdown. + post([=]{ CloseWindow(hwnd); }); + } + + struct WindowClass + { + static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } + WindowClass() + { + WNDCLASS wndclass = {}; + wndclass.style = 0; + wndclass.lpfnWndProc = &WndProc; + wndclass.cbClsExtra; + wndclass.cbWndExtra = 0; + wndclass.hInstance = NULL; + wndclass.lpszClassName = className(); + + if (!RegisterClass(&wndclass)) + throw std::exception("error"); + + } + HWND CreateWindow_() + { + return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + } + static const int WM_USER_DISPATCH = WM_USER + 1; + + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_USER_DISPATCH: + ((void(*)(void*))wParam)((void*)lParam); + return 0; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + } + static WindowClass& Instance() { + static WindowClass instance; + return instance; + } + }; + + template + void post(Fn fn) const + { + auto p = new Fn(fn); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + } + template + static void run_proc( + void* pvfn + ) + { + auto fn = (Fn*)(void*) pvfn; + (*fn)(); + delete fn; + } + }; + + template + std::shared_ptr> ObserveOnDispatcher( + const std::shared_ptr>& source) + { + auto dispatcher = std::make_shared(); + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + *cancel = true; + })); + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnNext(element); + }); + }, + // on completed + [=] + { + dispatcher->post([=]{ + if(!*cancel) + observer->OnCompleted(); + }); + }, + // on error + [=](const std::exception_ptr& error) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnError(error); + }); + })); + return cd; + }); + } +} + +#include "rxcpp-binder.h" + +#pragma pop_macro("min") +#pragma pop_macro("max") diff --git a/Rx++/testbench/testbench.cpp b/Rx++/testbench/testbench.cpp new file mode 100644 index 0000000..ce99f97 --- /dev/null +++ b/Rx++/testbench/testbench.cpp @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +// testbench.cpp : Defines the entry point for the console application. +// + +#include "rxcpp.h" + +#include +#include + +using namespace std; + +bool IsPrime(int x); + +int main(int argc, char* argv[]) +{ + const int n = 20; + std::cout << "first " << n << " primes squared\n"; + + rxcpp::DefaultScheduler::Instance().Schedule( + [=] + { + auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values) + .where(IsPrime) + .select([](int x) { return std::make_pair(x, x*x); }) + .take(n) + .subscribe( + [](pair p) { + cout << p.first << " =square=> " << p.second << endl; + }); + }); +} + +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; +} + diff --git a/Rx++/testbench/testbench.vcxproj b/Rx++/testbench/testbench.vcxproj new file mode 100644 index 0000000..8512615 --- /dev/null +++ b/Rx++/testbench/testbench.vcxproj @@ -0,0 +1,95 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + $(VCTargetsPath11) + + + {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB} + Win32Proj + testbench + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + $(SolutionDir)\bin\$(Configuration)\ + obj\$(Configuration)\ + + + false + $(SolutionDir)\bin\$(Configuration)\ + obj\$(Configuration)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/Rx++/testbench/testbench.vcxproj.filters b/Rx++/testbench/testbench.vcxproj.filters new file mode 100644 index 0000000..2737526 --- /dev/null +++ b/Rx++/testbench/testbench.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file -- GitLab From 64e17277bfc146f97d31986cbd7a8d739693df55 Mon Sep 17 00:00:00 2001 From: claudioc Date: Tue, 6 Nov 2012 00:29:04 -0800 Subject: [PATCH 002/782] Reactive Extensions (Rx) OSS V1.0 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a0a1e2..ba574dc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ The initial set of supported technologies is: -* Reactive Extensions: ** Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. ** RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. ** Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. * Interactive Extensions ** Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. ** IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. ** Ix++: An implantation of LINQ for Native Developers in C++ * Bindings: ** Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. ** LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. +* Reactive Extensions: + ** Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. ** RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. ** Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. * Interactive Extensions ** Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. ** IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. ** Ix++: An implantation of LINQ for Native Developers in C++ * Bindings: ** Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. ** LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. #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. You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. -- GitLab From 626b68bb2e980b7f3306517949f21744f41a2b57 Mon Sep 17 00:00:00 2001 From: clca Date: Thu, 8 Nov 2012 17:38:11 -0800 Subject: [PATCH 003/782] minor fixes to the repo structure --- AUTHORS.txt | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 45 ++++++++++++++++++++------------------------- 2 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 AUTHORS.txt diff --git a/AUTHORS.txt b/AUTHORS.txt new file mode 100644 index 0000000..160efcc --- /dev/null +++ b/AUTHORS.txt @@ -0,0 +1,40 @@ +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 diff --git a/README.md b/README.md index ba574dc..bb32490 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,20 @@ -# Reactive Extensions Libraries - - -Tx is set of code samples showing how to use LINQ to events, such as: - -* **Real-Time standing queries:**. E.g. producing a histogram every second how many bytes were send/received over TCP per IP address. -* **Queries on past history from trace/log files:** E.g. from past trace of IIS find the slow requests by correlating "begin" and "end" events. - -The initial set of supported technologies is: - -* Event Tracing for Windows (ETW) -* Windows Event Logs -* SQL Server Extended Events (XEvent) - - - -* Reactive Extensions: - ** Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. ** RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. ** Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. * Interactive Extensions ** Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. ** IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. ** Ix++: An implantation of LINQ for Native Developers in C++ * Bindings: ** Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. ** LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. -#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. You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. - - - - - - +# Reactive Extensions: + +* Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. +* RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. +* Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. + +# Interactive Extensions +* Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. +* IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. +* Ix++: An implantation of LINQ for Native Developers in C++ + +# Applications: +* Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. +* LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. + +#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. + +You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. \ No newline at end of file -- GitLab From 657739c1c284f34af5ae498707f06eac6b559359 Mon Sep 17 00:00:00 2001 From: clca Date: Thu, 8 Nov 2012 21:40:10 -0800 Subject: [PATCH 004/782] fixed license files --- Ix++/{license.txt.txt => license.txt} | 2 +- Ix/license.txt | 2 +- Rx++/license.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename Ix++/{license.txt.txt => license.txt} (89%) diff --git a/Ix++/license.txt.txt b/Ix++/license.txt similarity index 89% rename from Ix++/license.txt.txt rename to Ix++/license.txt index d7fd6c0..5b47fbd 100644 --- a/Ix++/license.txt.txt +++ b/Ix++/license.txt @@ -1,6 +1,6 @@ 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://aspnetwebstack.codeplex.com/wikipage?title=Contributors. +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 diff --git a/Ix/license.txt b/Ix/license.txt index d7fd6c0..5b47fbd 100644 --- a/Ix/license.txt +++ b/Ix/license.txt @@ -1,6 +1,6 @@ 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://aspnetwebstack.codeplex.com/wikipage?title=Contributors. +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 diff --git a/Rx++/license.txt b/Rx++/license.txt index d7fd6c0..5b47fbd 100644 --- a/Rx++/license.txt +++ b/Rx++/license.txt @@ -1,6 +1,6 @@ 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://aspnetwebstack.codeplex.com/wikipage?title=Contributors. +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 -- GitLab From 5b8fbf85feb1cf5fdd15ee852b66497df6df01f4 Mon Sep 17 00:00:00 2001 From: "Scott Blomquist (MS OPEN TECH)" Date: Sat, 10 Nov 2012 23:06:25 -0800 Subject: [PATCH 005/782] Fix to work with empty STL containers --- Ix++/src/cpplinq/linq.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ix++/src/cpplinq/linq.hpp b/Ix++/src/cpplinq/linq.hpp index 64cf8fb..1070331 100644 --- a/Ix++/src/cpplinq/linq.hpp +++ b/Ix++/src/cpplinq/linq.hpp @@ -475,7 +475,7 @@ public: // -------------------- container/range methods -------------------- - iterator begin() const { return iterator(c.get_cursor()); } + 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 -- GitLab From d584db7745c65d8336f4c1860aa6a2c57a209695 Mon Sep 17 00:00:00 2001 From: "Scott Blomquist (MS OPEN TECH)" Date: Sat, 10 Nov 2012 23:40:35 -0800 Subject: [PATCH 006/782] Fix Ix++ unittest paths Note: To build the Ix++ unit tests, use nmake.exe from your Visual Studio tools path. You'll need the BOOST environment variable point to a recent set of boost libs. --- Ix++/unittest/makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ix++/unittest/makefile b/Ix++/unittest/makefile index c839943..4fea142 100644 --- a/Ix++/unittest/makefile +++ b/Ix++/unittest/makefile @@ -9,7 +9,7 @@ O=..\..\bin\$(Config) !message Building ===== $(Config) ===== program=testbench.exe -INCLUDE=$(INCLUDE);../ +INCLUDE=$(INCLUDE);../src !if "$(Config)"=="Debug" OPTIONS=/Od @@ -27,7 +27,7 @@ all : "$O/$(program)" $O : mkdir $O -"$O/$(program)" : testbench.cpp testbench.hpp ../cpplinq/*.hpp $O +"$O/$(program)" : testbench.cpp testbench.hpp ../src/cpplinq/*.hpp $O $(CPP) $(OPTIONS) /EHsc /Zi /Fe"$@" /Fo$O/ testbench.cpp clean : -- GitLab From 6aa4590ea5952d3ba5e1f99b6ede76d856f88617 Mon Sep 17 00:00:00 2001 From: georgis Date: Wed, 16 Jan 2013 14:02:54 -0800 Subject: [PATCH 007/782] removing the Tx code (it is now on http://tx.codeplex.com) --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8e354f --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +[Oo]bj +[Bb]in +TestResults +*.user +*.suo +*.[Cc]ache +*.bak +*.ncb \ No newline at end of file -- GitLab From a0f2bbe9acce9483163de730341cf89ec0331d2b Mon Sep 17 00:00:00 2001 From: Scott Blomquist Date: Thu, 17 Jan 2013 17:48:09 -0800 Subject: [PATCH 008/782] New directory structure. --- .gitignore | 8 - {Ix++ => Ix/CPP}/.gitignore | 0 {Ix++ => Ix/CPP}/license.txt | 0 {Ix++ => Ix/CPP}/projects/CppLinq.vpj | 0 {Ix++ => Ix/CPP}/projects/CppLinq.vpw | 0 .../CPP}/projects/Unittest.CppLinq.vpj | 0 .../samples/SampleCppLinq/SampleCppLinq.cpp | 0 .../samples/SampleCppLinq/SampleCppLinq.sln | 0 .../SampleCppLinq/SampleCppLinq.vcxproj | 0 .../SampleCppLinq.vcxproj.filters | 0 .../CPP}/samples/SampleCppLinq/data.txt | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_cursor.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_groupby.hpp | 0 .../CPP}/src/cpplinq/linq_iterators.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_last.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_select.hpp | 0 .../CPP}/src/cpplinq/linq_selectmany.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_skip.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_take.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/linq_where.hpp | 0 {Ix++ => Ix/CPP}/src/cpplinq/util.hpp | 0 {Ix++ => Ix/CPP}/unittest/makefile | 0 {Ix++ => Ix/CPP}/unittest/testbench.cpp | 0 {Ix++ => Ix/CPP}/unittest/testbench.hpp | 0 Ix/Common.targets | 180 -- Ix/Import.targets | 16 - Ix/Interactive Extensions.sln | 332 --- Ix/Interactive Extensions.vsmdi | 6 - Ix/Interactive Extensions.vssscc | 10 - Ix/Local.testsettings | 37 - .../AsyncEnumerable.Aggregates.cs | 2019 -------------- .../AsyncEnumerable.Conversions.cs | 262 -- .../AsyncEnumerable.Creation.cs | 283 -- .../AsyncEnumerable.Exceptions.cs | 381 --- .../AsyncEnumerable.Generated.cs | 1250 --------- .../AsyncEnumerable.Multiple.cs | 755 ----- .../AsyncEnumerable.Single.cs | 2466 ----------------- .../AsyncEnumerator.cs | 26 - Ix/System.Interactive.Async/Disposables.cs | 89 - .../EnumerableGrouping.cs | 34 - .../IAsyncEnumerable.cs | 23 - .../IAsyncEnumerator.cs | 34 - Ix/System.Interactive.Async/IAsyncGrouping.cs | 19 - .../IOrderedAsyncEnumerable.cs | 15 - .../Properties/AssemblyInfo.cs | 37 - .../System.Interactive.Async.csproj | 47 - Ix/System.Interactive.Async/TaskExt.cs | 134 - .../Properties/AssemblyInfo.cs | 37 - .../QueryableEx.cs | 2327 ---------------- .../System.Interactive.Providers.csproj | 41 - .../EnumerableEx.Aggregates.cs | 173 -- .../EnumerableEx.Buffering.cs | 647 ----- .../EnumerableEx.Creation.cs | 173 -- .../EnumerableEx.Exceptions.cs | 284 -- .../EnumerableEx.Imperative.cs | 156 -- .../EnumerableEx.Multiple.cs | 96 - Ix/System.Interactive/EnumerableEx.Single.cs | 672 ----- .../Properties/AssemblyInfo.cs | 37 - .../System.Interactive.csproj | 41 - Ix/Tests/App.cs | 47 - Ix/Tests/AsyncTests.Aggregates.cs | 2168 --------------- Ix/Tests/AsyncTests.Bugs.cs | 266 -- Ix/Tests/AsyncTests.Conversions.cs | 312 --- Ix/Tests/AsyncTests.Creation.cs | 409 --- Ix/Tests/AsyncTests.Exceptions.cs | 551 ---- Ix/Tests/AsyncTests.Multiple.cs | 787 ------ Ix/Tests/AsyncTests.Single.cs | 2455 ---------------- Ix/Tests/AsyncTests.cs | 54 - Ix/Tests/Properties/AppManifest.xml | 7 - Ix/Tests/Properties/AssemblyInfo.cs | 35 - Ix/Tests/Tests.Aggregates.cs | 118 - Ix/Tests/Tests.Buffering.cs | 625 ----- Ix/Tests/Tests.Creation.cs | 224 -- Ix/Tests/Tests.Exceptions.cs | 311 --- Ix/Tests/Tests.Imperative.cs | 180 -- Ix/Tests/Tests.Multiple.cs | 74 - Ix/Tests/Tests.Qbservable.cs | 139 - Ix/Tests/Tests.Single.cs | 431 --- Ix/Tests/Tests.cs | 51 - Ix/Tests/Tests.csproj | 91 - Ix/TraceAndTestImpact.testsettings | 21 - Rx++/.gitattributes | 22 - Rx++/.gitignore | 163 -- Rx++/license.txt | 15 - {Ix => Rx/CPP}/.gitattributes | 0 {Ix => Rx/CPP}/.gitignore | 0 .../CPP}/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 0 .../CPP}/MfcTimeFliesLikeAnArrow/MainFrm.h | 0 .../MfcTimeFliesLikeAnArrow.cpp | 0 .../MfcTimeFliesLikeAnArrow.h | 0 .../MfcTimeFliesLikeAnArrow.rc | 0 .../MfcTimeFliesLikeAnArrow.vcxproj | 0 .../MfcTimeFliesLikeAnArrow.vcxproj.filters | 0 .../CPP}/MfcTimeFliesLikeAnArrow/ReadMe.txt | 0 .../CPP}/MfcTimeFliesLikeAnArrow/Resource.h | 0 .../res/MfcTimeFliesLikeAnArrow.ico | Bin .../res/MfcTimeFliesLikeAnArrow.rc2 | Bin .../CPP}/MfcTimeFliesLikeAnArrow/stdafx.cpp | 0 .../CPP}/MfcTimeFliesLikeAnArrow/stdafx.h | 0 .../CPP}/MfcTimeFliesLikeAnArrow/targetver.h | 0 {Rx++ => Rx/CPP}/RxCpp.sln | 0 {Ix => Rx/CPP}/license.txt | 0 {Rx++ => Rx/CPP}/testbench/rxcpp-binder.h | 0 {Rx++ => Rx/CPP}/testbench/rxcpp.h | 0 {Rx++ => Rx/CPP}/testbench/testbench.cpp | 0 {Rx++ => Rx/CPP}/testbench/testbench.vcxproj | 0 .../CPP}/testbench/testbench.vcxproj.filters | 0 108 files changed, 22703 deletions(-) delete mode 100644 .gitignore rename {Ix++ => Ix/CPP}/.gitignore (100%) rename {Ix++ => Ix/CPP}/license.txt (100%) rename {Ix++ => Ix/CPP}/projects/CppLinq.vpj (100%) rename {Ix++ => Ix/CPP}/projects/CppLinq.vpw (100%) rename {Ix++ => Ix/CPP}/projects/Unittest.CppLinq.vpj (100%) rename {Ix++ => Ix/CPP}/samples/SampleCppLinq/SampleCppLinq.cpp (100%) rename {Ix++ => Ix/CPP}/samples/SampleCppLinq/SampleCppLinq.sln (100%) rename {Ix++ => Ix/CPP}/samples/SampleCppLinq/SampleCppLinq.vcxproj (100%) rename {Ix++ => Ix/CPP}/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters (100%) rename {Ix++ => Ix/CPP}/samples/SampleCppLinq/data.txt (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_cursor.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_groupby.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_iterators.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_last.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_select.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_selectmany.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_skip.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_take.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/linq_where.hpp (100%) rename {Ix++ => Ix/CPP}/src/cpplinq/util.hpp (100%) rename {Ix++ => Ix/CPP}/unittest/makefile (100%) rename {Ix++ => Ix/CPP}/unittest/testbench.cpp (100%) rename {Ix++ => Ix/CPP}/unittest/testbench.hpp (100%) delete mode 100644 Ix/Common.targets delete mode 100644 Ix/Import.targets delete mode 100644 Ix/Interactive Extensions.sln delete mode 100644 Ix/Interactive Extensions.vsmdi delete mode 100644 Ix/Interactive Extensions.vssscc delete mode 100644 Ix/Local.testsettings delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerable.Single.cs delete mode 100644 Ix/System.Interactive.Async/AsyncEnumerator.cs delete mode 100644 Ix/System.Interactive.Async/Disposables.cs delete mode 100644 Ix/System.Interactive.Async/EnumerableGrouping.cs delete mode 100644 Ix/System.Interactive.Async/IAsyncEnumerable.cs delete mode 100644 Ix/System.Interactive.Async/IAsyncEnumerator.cs delete mode 100644 Ix/System.Interactive.Async/IAsyncGrouping.cs delete mode 100644 Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs delete mode 100644 Ix/System.Interactive.Async/Properties/AssemblyInfo.cs delete mode 100644 Ix/System.Interactive.Async/System.Interactive.Async.csproj delete mode 100644 Ix/System.Interactive.Async/TaskExt.cs delete mode 100644 Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs delete mode 100644 Ix/System.Interactive.Providers/QueryableEx.cs delete mode 100644 Ix/System.Interactive.Providers/System.Interactive.Providers.csproj delete mode 100644 Ix/System.Interactive/EnumerableEx.Aggregates.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Buffering.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Creation.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Exceptions.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Imperative.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Multiple.cs delete mode 100644 Ix/System.Interactive/EnumerableEx.Single.cs delete mode 100644 Ix/System.Interactive/Properties/AssemblyInfo.cs delete mode 100644 Ix/System.Interactive/System.Interactive.csproj delete mode 100644 Ix/Tests/App.cs delete mode 100644 Ix/Tests/AsyncTests.Aggregates.cs delete mode 100644 Ix/Tests/AsyncTests.Bugs.cs delete mode 100644 Ix/Tests/AsyncTests.Conversions.cs delete mode 100644 Ix/Tests/AsyncTests.Creation.cs delete mode 100644 Ix/Tests/AsyncTests.Exceptions.cs delete mode 100644 Ix/Tests/AsyncTests.Multiple.cs delete mode 100644 Ix/Tests/AsyncTests.Single.cs delete mode 100644 Ix/Tests/AsyncTests.cs delete mode 100644 Ix/Tests/Properties/AppManifest.xml delete mode 100644 Ix/Tests/Properties/AssemblyInfo.cs delete mode 100644 Ix/Tests/Tests.Aggregates.cs delete mode 100644 Ix/Tests/Tests.Buffering.cs delete mode 100644 Ix/Tests/Tests.Creation.cs delete mode 100644 Ix/Tests/Tests.Exceptions.cs delete mode 100644 Ix/Tests/Tests.Imperative.cs delete mode 100644 Ix/Tests/Tests.Multiple.cs delete mode 100644 Ix/Tests/Tests.Qbservable.cs delete mode 100644 Ix/Tests/Tests.Single.cs delete mode 100644 Ix/Tests/Tests.cs delete mode 100644 Ix/Tests/Tests.csproj delete mode 100644 Ix/TraceAndTestImpact.testsettings delete mode 100644 Rx++/.gitattributes delete mode 100644 Rx++/.gitignore delete mode 100644 Rx++/license.txt rename {Ix => Rx/CPP}/.gitattributes (100%) rename {Ix => Rx/CPP}/.gitignore (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MainFrm.cpp (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MainFrm.h (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/ReadMe.txt (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/Resource.h (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/stdafx.cpp (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/stdafx.h (100%) rename {Rx++ => Rx/CPP}/MfcTimeFliesLikeAnArrow/targetver.h (100%) rename {Rx++ => Rx/CPP}/RxCpp.sln (100%) rename {Ix => Rx/CPP}/license.txt (100%) rename {Rx++ => Rx/CPP}/testbench/rxcpp-binder.h (100%) rename {Rx++ => Rx/CPP}/testbench/rxcpp.h (100%) rename {Rx++ => Rx/CPP}/testbench/testbench.cpp (100%) rename {Rx++ => Rx/CPP}/testbench/testbench.vcxproj (100%) rename {Rx++ => Rx/CPP}/testbench/testbench.vcxproj.filters (100%) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a8e354f..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -[Oo]bj -[Bb]in -TestResults -*.user -*.suo -*.[Cc]ache -*.bak -*.ncb \ No newline at end of file diff --git a/Ix++/.gitignore b/Ix/CPP/.gitignore similarity index 100% rename from Ix++/.gitignore rename to Ix/CPP/.gitignore diff --git a/Ix++/license.txt b/Ix/CPP/license.txt similarity index 100% rename from Ix++/license.txt rename to Ix/CPP/license.txt diff --git a/Ix++/projects/CppLinq.vpj b/Ix/CPP/projects/CppLinq.vpj similarity index 100% rename from Ix++/projects/CppLinq.vpj rename to Ix/CPP/projects/CppLinq.vpj diff --git a/Ix++/projects/CppLinq.vpw b/Ix/CPP/projects/CppLinq.vpw similarity index 100% rename from Ix++/projects/CppLinq.vpw rename to Ix/CPP/projects/CppLinq.vpw diff --git a/Ix++/projects/Unittest.CppLinq.vpj b/Ix/CPP/projects/Unittest.CppLinq.vpj similarity index 100% rename from Ix++/projects/Unittest.CppLinq.vpj rename to Ix/CPP/projects/Unittest.CppLinq.vpj diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.cpp b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp similarity index 100% rename from Ix++/samples/SampleCppLinq/SampleCppLinq.cpp rename to Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.sln b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln similarity index 100% rename from Ix++/samples/SampleCppLinq/SampleCppLinq.sln rename to Ix/CPP/samples/SampleCppLinq/SampleCppLinq.sln diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj similarity index 100% rename from Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj rename to Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj diff --git a/Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters similarity index 100% rename from Ix++/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters rename to Ix/CPP/samples/SampleCppLinq/SampleCppLinq.vcxproj.filters diff --git a/Ix++/samples/SampleCppLinq/data.txt b/Ix/CPP/samples/SampleCppLinq/data.txt similarity index 100% rename from Ix++/samples/SampleCppLinq/data.txt rename to Ix/CPP/samples/SampleCppLinq/data.txt diff --git a/Ix++/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp similarity index 100% rename from Ix++/src/cpplinq/linq.hpp rename to Ix/CPP/src/cpplinq/linq.hpp diff --git a/Ix++/src/cpplinq/linq_cursor.hpp b/Ix/CPP/src/cpplinq/linq_cursor.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_cursor.hpp rename to Ix/CPP/src/cpplinq/linq_cursor.hpp diff --git a/Ix++/src/cpplinq/linq_groupby.hpp b/Ix/CPP/src/cpplinq/linq_groupby.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_groupby.hpp rename to Ix/CPP/src/cpplinq/linq_groupby.hpp diff --git a/Ix++/src/cpplinq/linq_iterators.hpp b/Ix/CPP/src/cpplinq/linq_iterators.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_iterators.hpp rename to Ix/CPP/src/cpplinq/linq_iterators.hpp diff --git a/Ix++/src/cpplinq/linq_last.hpp b/Ix/CPP/src/cpplinq/linq_last.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_last.hpp rename to Ix/CPP/src/cpplinq/linq_last.hpp diff --git a/Ix++/src/cpplinq/linq_select.hpp b/Ix/CPP/src/cpplinq/linq_select.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_select.hpp rename to Ix/CPP/src/cpplinq/linq_select.hpp diff --git a/Ix++/src/cpplinq/linq_selectmany.hpp b/Ix/CPP/src/cpplinq/linq_selectmany.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_selectmany.hpp rename to Ix/CPP/src/cpplinq/linq_selectmany.hpp diff --git a/Ix++/src/cpplinq/linq_skip.hpp b/Ix/CPP/src/cpplinq/linq_skip.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_skip.hpp rename to Ix/CPP/src/cpplinq/linq_skip.hpp diff --git a/Ix++/src/cpplinq/linq_take.hpp b/Ix/CPP/src/cpplinq/linq_take.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_take.hpp rename to Ix/CPP/src/cpplinq/linq_take.hpp diff --git a/Ix++/src/cpplinq/linq_where.hpp b/Ix/CPP/src/cpplinq/linq_where.hpp similarity index 100% rename from Ix++/src/cpplinq/linq_where.hpp rename to Ix/CPP/src/cpplinq/linq_where.hpp diff --git a/Ix++/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp similarity index 100% rename from Ix++/src/cpplinq/util.hpp rename to Ix/CPP/src/cpplinq/util.hpp diff --git a/Ix++/unittest/makefile b/Ix/CPP/unittest/makefile similarity index 100% rename from Ix++/unittest/makefile rename to Ix/CPP/unittest/makefile diff --git a/Ix++/unittest/testbench.cpp b/Ix/CPP/unittest/testbench.cpp similarity index 100% rename from Ix++/unittest/testbench.cpp rename to Ix/CPP/unittest/testbench.cpp diff --git a/Ix++/unittest/testbench.hpp b/Ix/CPP/unittest/testbench.hpp similarity index 100% rename from Ix++/unittest/testbench.hpp rename to Ix/CPP/unittest/testbench.hpp diff --git a/Ix/Common.targets b/Ix/Common.targets deleted file mode 100644 index 032880f..0000000 --- a/Ix/Common.targets +++ /dev/null @@ -1,180 +0,0 @@ - - - - - AnyCPU - 8.0.30703 - 2.0 - - - - - true - full - false - bin\Debug40\ - $(DefineConstants);TRACE;DEBUG - prompt - 4 - v4.0 - DESKTOPCLR - DESKTOPCLR40 - - - pdbonly - true - bin\Release40\ - $(DefineConstants);TRACE - prompt - 4 - v4.0 - DESKTOPCLR - DESKTOPCLR40 - - - - true - full - false - bin\Debug35\ - $(DefineConstants);TRACE;DEBUG;NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_RXINTERFACES;NO_ZIP - prompt - 4 - v3.5 - DESKTOPCLR - DESKTOPCLR20 - - - pdbonly - true - bin\Release35\ - $(DefineConstants);TRACE;NO_VARIANCE;NO_TPL;NO_LARGEARITY;NO_RXINTERFACES;NO_ZIP - prompt - 4 - v3.5 - DESKTOPCLR - DESKTOPCLR20 - - - - true - full - false - bin\DebugSL4\ - $(DefineConstants);TRACE;DEBUG;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES - prompt - 4 - Silverlight - v4.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHT4 - - - pdbonly - true - bin\ReleaseSL4\ - $(DefineConstants);TRACE;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES - prompt - 4 - Silverlight - v4.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHT4 - - - true - full - false - bin\DebugSL5\ - $(DefineConstants);TRACE;DEBUG;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES - prompt - 4 - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHT5 - - - pdbonly - true - bin\ReleaseSL5\ - $(DefineConstants);TRACE;NO_SERIALIZABLE;NO_TPL;NO_REMOTING;NO_SEMAPHORE;NO_RXINTERFACES - prompt - 4 - Silverlight - v5.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHT5 - - - - true - full - false - bin\DebugWP7\ - $(DefineConstants);TRACE;DEBUG;WINDOWSPHONE7;NO_TLS;NO_VARIANCE;NO_SERIALIZABLE;NO_TPL;NO_HASHSET;NO_REMOTING;NO_SEMAPHORE;NO_LARGEARITY;NO_ZIP - prompt - 4 - WindowsPhone - Silverlight - v4.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHTM7 - - - pdbonly - true - bin\ReleaseWP7\ - $(DefineConstants);TRACE;WINDOWSPHONE7;NO_TLS;NO_VARIANCE;NO_SERIALIZABLE;NO_TPL;NO_HASHSET;NO_REMOTING;NO_SEMAPHORE;NO_LARGEARITY;NO_ZIP - prompt - 4 - WindowsPhone - Silverlight - v4.0 - $(TargetFrameworkVersion) - false - SILVERLIGHT - SILVERLIGHTM7 - - - - $(DefineConstants);$(BuildPlatform);$(BuildFlavor) - - - - $(DefineConstants);STABLE - - - - $(DefineConstants);SIGNED - true - ..\35MSSharedLib1024.snk - true - - - - $(DefineConstants);NO_CODECOVERAGE - - - - CP_SetBuildReferencePath - - - - $(ProjectDir)..\..\..\References\$(BuildFlavor) - - - - \ No newline at end of file diff --git a/Ix/Import.targets b/Ix/Import.targets deleted file mode 100644 index fb23483..0000000 --- a/Ix/Import.targets +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Ix/Interactive Extensions.sln b/Ix/Interactive Extensions.sln deleted file mode 100644 index 5fbfed0..0000000 --- a/Ix/Interactive Extensions.sln +++ /dev/null @@ -1,332 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive", "System.Interactive\System.Interactive.csproj", "{8E4B04F0-915E-48F9-9796-76278C6094BD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{C4C8532A-F8D2-428B-962E-FD578A1E647C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{01E445E3-2296-48ED-A70D-F64CE755E0B6}" - ProjectSection(SolutionItems) = preProject - Interactive Extensions.vsmdi = Interactive Extensions.vsmdi - Local.testsettings = Local.testsettings - TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive.Providers", "System.Interactive.Providers\System.Interactive.Providers.csproj", "{6D62E966-469D-4A99-BD43-0A17FA14FB4F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Interactive.Async", "System.Interactive.Async\System.Interactive.Async.csproj", "{7269A578-326A-4C3E-9874-A2D2600095BC}" -EndProject -Global - GlobalSection(TestCaseManagementSettings) = postSolution - CategoryFile = Interactive Extensions.vsmdi - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Debug35|Any CPU = Debug35|Any CPU - Debug35|Mixed Platforms = Debug35|Mixed Platforms - Debug35|x86 = Debug35|x86 - Debug40|Any CPU = Debug40|Any CPU - Debug40|Mixed Platforms = Debug40|Mixed Platforms - Debug40|x86 = Debug40|x86 - DebugPL|Any CPU = DebugPL|Any CPU - DebugPL|Mixed Platforms = DebugPL|Mixed Platforms - DebugPL|x86 = DebugPL|x86 - DebugSL4|Any CPU = DebugSL4|Any CPU - DebugSL4|Mixed Platforms = DebugSL4|Mixed Platforms - DebugSL4|x86 = DebugSL4|x86 - DebugSL5|Any CPU = DebugSL5|Any CPU - DebugSL5|Mixed Platforms = DebugSL5|Mixed Platforms - DebugSL5|x86 = DebugSL5|x86 - DebugWP7|Any CPU = DebugWP7|Any CPU - DebugWP7|Mixed Platforms = DebugWP7|Mixed Platforms - DebugWP7|x86 = DebugWP7|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - Release35|Any CPU = Release35|Any CPU - Release35|Mixed Platforms = Release35|Mixed Platforms - Release35|x86 = Release35|x86 - Release40|Any CPU = Release40|Any CPU - Release40|Mixed Platforms = Release40|Mixed Platforms - Release40|x86 = Release40|x86 - ReleasePL|Any CPU = ReleasePL|Any CPU - ReleasePL|Mixed Platforms = ReleasePL|Mixed Platforms - ReleasePL|x86 = ReleasePL|x86 - ReleaseSL4|Any CPU = ReleaseSL4|Any CPU - ReleaseSL4|Mixed Platforms = ReleaseSL4|Mixed Platforms - ReleaseSL4|x86 = ReleaseSL4|x86 - ReleaseSL5|Any CPU = ReleaseSL5|Any CPU - ReleaseSL5|Mixed Platforms = ReleaseSL5|Mixed Platforms - ReleaseSL5|x86 = ReleaseSL5|x86 - ReleaseWP7|Any CPU = ReleaseWP7|Any CPU - ReleaseWP7|Mixed Platforms = ReleaseWP7|Mixed Platforms - ReleaseWP7|x86 = ReleaseWP7|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Any CPU.Build.0 = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug|x86.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Any CPU.Build.0 = Debug35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug35|x86.ActiveCfg = Debug35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Any CPU.Build.0 = Debug40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Debug40|x86.ActiveCfg = Debug40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Any CPU.Build.0 = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release|x86.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Any CPU.ActiveCfg = Release35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Any CPU.Build.0 = Release35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release35|x86.ActiveCfg = Release35|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Any CPU.ActiveCfg = Release40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Any CPU.Build.0 = Release40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.Release40|x86.ActiveCfg = Release40|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU - {8E4B04F0-915E-48F9-9796-76278C6094BD}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Any CPU.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Any CPU.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|Mixed Platforms.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug|x86.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Any CPU.Build.0 = Debug35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug35|x86.ActiveCfg = Debug35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Any CPU.Build.0 = Debug40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Debug40|x86.ActiveCfg = Debug40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Any CPU.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Any CPU.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|Mixed Platforms.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugPL|x86.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Any CPU.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|Mixed Platforms.Build.0 = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Any CPU.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release|x86.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Any CPU.ActiveCfg = Release35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Any CPU.Build.0 = Release35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release35|x86.ActiveCfg = Release35|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Any CPU.ActiveCfg = Release40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Any CPU.Build.0 = Release40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.Release40|x86.ActiveCfg = Release40|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Any CPU.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleasePL|x86.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Any CPU.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|Mixed Platforms.Build.0 = ReleaseWP7|Any CPU - {C4C8532A-F8D2-428B-962E-FD578A1E647C}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Any CPU.Build.0 = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug|x86.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Any CPU.Build.0 = Debug35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|Mixed Platforms.Build.0 = Debug35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug35|x86.ActiveCfg = Debug35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Any CPU.Build.0 = Debug40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Debug40|x86.ActiveCfg = Debug40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Any CPU.Build.0 = DebugSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|Mixed Platforms.Build.0 = DebugSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Any CPU.Build.0 = DebugSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|Mixed Platforms.Build.0 = DebugSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Any CPU.Build.0 = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release|x86.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Any CPU.ActiveCfg = Release35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Any CPU.Build.0 = Release35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|Mixed Platforms.Build.0 = Release35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release35|x86.ActiveCfg = Release35|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Any CPU.ActiveCfg = Release40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Any CPU.Build.0 = Release40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.Release40|x86.ActiveCfg = Release40|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Any CPU.Build.0 = ReleaseSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|Mixed Platforms.Build.0 = ReleaseSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Any CPU.Build.0 = ReleaseSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|Mixed Platforms.Build.0 = ReleaseSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {6D62E966-469D-4A99-BD43-0A17FA14FB4F}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Any CPU.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Any CPU.Build.0 = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|Mixed Platforms.Build.0 = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug|x86.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|Any CPU.ActiveCfg = Debug35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|Mixed Platforms.ActiveCfg = Debug35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug35|x86.ActiveCfg = Debug35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Any CPU.ActiveCfg = Debug40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Any CPU.Build.0 = Debug40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Mixed Platforms.ActiveCfg = Debug40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|Mixed Platforms.Build.0 = Debug40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Debug40|x86.ActiveCfg = Debug40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Any CPU.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Any CPU.Build.0 = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Mixed Platforms.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|Mixed Platforms.Build.0 = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugPL|x86.ActiveCfg = DebugPL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|Any CPU.ActiveCfg = DebugSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|Mixed Platforms.ActiveCfg = DebugSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL4|x86.ActiveCfg = DebugSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|Any CPU.ActiveCfg = DebugSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|Mixed Platforms.ActiveCfg = DebugSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugSL5|x86.ActiveCfg = DebugSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|Any CPU.ActiveCfg = DebugWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Any CPU.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Any CPU.Build.0 = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release|x86.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|Any CPU.ActiveCfg = Release35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|Mixed Platforms.ActiveCfg = Release35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release35|x86.ActiveCfg = Release35|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Any CPU.ActiveCfg = Release40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Any CPU.Build.0 = Release40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Mixed Platforms.ActiveCfg = Release40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|Mixed Platforms.Build.0 = Release40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.Release40|x86.ActiveCfg = Release40|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Any CPU.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Any CPU.Build.0 = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Mixed Platforms.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|Mixed Platforms.Build.0 = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleasePL|x86.ActiveCfg = ReleasePL|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|Any CPU.ActiveCfg = ReleaseSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|Mixed Platforms.ActiveCfg = ReleaseSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL4|x86.ActiveCfg = ReleaseSL4|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|Any CPU.ActiveCfg = ReleaseSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|Mixed Platforms.ActiveCfg = ReleaseSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseSL5|x86.ActiveCfg = ReleaseSL5|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|Any CPU.ActiveCfg = ReleaseWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU - {7269A578-326A-4C3E-9874-A2D2600095BC}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Ix/Interactive Extensions.vsmdi b/Ix/Interactive Extensions.vsmdi deleted file mode 100644 index 3031d67..0000000 --- a/Ix/Interactive Extensions.vsmdi +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Ix/Interactive Extensions.vssscc b/Ix/Interactive Extensions.vssscc deleted file mode 100644 index 6cb031b..0000000 --- a/Ix/Interactive Extensions.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/Ix/Local.testsettings b/Ix/Local.testsettings deleted file mode 100644 index 9c078dd..0000000 --- a/Ix/Local.testsettings +++ /dev/null @@ -1,37 +0,0 @@ - - - These are default test settings for a local test run. - - - - - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs deleted file mode 100644 index 8b0f766..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Aggregates.cs +++ /dev/null @@ -1,2019 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Threading; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, Func resultSelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - var tcs = new TaskCompletionSource(); - - var acc = seed; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - acc = accumulator(acc, e.Current); - f(ct); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - } - } - else - { - var result = default(TResult); - try - { - result = resultSelector(acc); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - return; - } - - tcs.TrySetResult(result); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return source.Aggregate(seed, accumulator, x => x, cancellationToken); - } - - public static Task Aggregate(this IAsyncEnumerable source, Func accumulator, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - var tcs = new TaskCompletionSource(); - - var first = true; - var acc = default(TSource); - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - if (first) - acc = e.Current; - else - acc = accumulator(acc, e.Current); - f(ct); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - - first = false; - } - else - { - if (first) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(acc); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Count(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0, (c, _) => c + 1, cancellationToken); - } - - public static Task Count(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).Aggregate(0, (c, _) => c + 1, cancellationToken); - } - - public static Task LongCount(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0L, (c, _) => c + 1, cancellationToken); - } - - public static Task LongCount(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).Aggregate(0L, (c, _) => c + 1, cancellationToken); - } - - public static Task All(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - if (!predicate(e.Current)) - tcs.TrySetResult(false); - else - f(ct); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - } - else - { - tcs.TrySetResult(true); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Any(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - if (predicate(e.Current)) - tcs.TrySetResult(true); - else - f(ct); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - } - else - { - tcs.TrySetResult(false); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Any(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var e = source.GetEnumerator(); - return e.MoveNext(cancellationToken); - } - - public static Task Contains(this IAsyncEnumerable source, TSource value, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Any(x => comparer.Equals(x, value), cancellationToken); - } - - public static Task Contains(this IAsyncEnumerable source, TSource value, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Contains(value, EqualityComparer.Default, cancellationToken); - } - - public static Task First(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - e.MoveNext(cancellationToken).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - tcs.TrySetResult(e.Current); - else - tcs.TrySetException(new InvalidOperationException()); - }); - }); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task First(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).First(cancellationToken); - } - - public static Task FirstOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - e.MoveNext(cancellationToken).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - tcs.TrySetResult(e.Current); - else - tcs.TrySetResult(default(TSource)); - }); - }); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task FirstOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).FirstOrDefault(cancellationToken); - } - - public static Task Last(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - var last = default(TSource); - var hasLast = false; - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - hasLast = true; - last = e.Current; - f(ct); - } - else - { - if (!hasLast) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(last); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Last(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).Last(cancellationToken); - } - - public static Task LastOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - var last = default(TSource); - var hasLast = false; - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - hasLast = true; - last = e.Current; - f(ct); - } - else - { - if (!hasLast) - tcs.TrySetResult(default(TSource)); - else - tcs.TrySetResult(last); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task LastOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).LastOrDefault(cancellationToken); - } - - public static Task Single(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - e.MoveNext(cancellationToken).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var result = e.Current; - e.MoveNext(cancellationToken).ContinueWith(t1 => - { - t1.Handle(tcs, res1 => - { - if (res1) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(result); - }); - }); - } - else - tcs.TrySetException(new InvalidOperationException()); - }); - }); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Single(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).Single(cancellationToken); - } - - public static Task SingleOrDefault(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - e.MoveNext(cancellationToken).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var result = e.Current; - e.MoveNext(cancellationToken).ContinueWith(t1 => - { - t1.Handle(tcs, res1 => - { - if (res1) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(result); - }); - }); - } - else - tcs.TrySetResult(default(TSource)); - }); - }); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task SingleOrDefault(this IAsyncEnumerable source, Func predicate, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return source.Where(predicate).SingleOrDefault(cancellationToken); - } - - public static Task ElementAt(this IAsyncEnumerable source, int index, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (index < 0) - throw new ArgumentOutOfRangeException("index"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - var next = default(Action); - next = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (index == 0) - { - tcs.TrySetResult(e.Current); - } - else - { - index--; - next(ct); - } - } - else - { - tcs.TrySetException(new ArgumentOutOfRangeException()); - } - }); - }); - - next(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task ElementAtOrDefault(this IAsyncEnumerable source, int index, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (index < 0) - throw new ArgumentOutOfRangeException("index"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - var next = default(Action); - next = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (index == 0) - { - tcs.TrySetResult(e.Current); - } - else - { - index--; - next(ct); - } - } - else - { - tcs.TrySetResult(default(TSource)); - } - }); - }); - - next(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task ToArray(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(new List(), (list, x) => { list.Add(x); return list; }, list => list.ToArray(), cancellationToken); - } - - public static Task> ToList(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(new List(), (list, x) => { list.Add(x); return list; }, cancellationToken); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Aggregate(new Dictionary(comparer), (d, x) => { d.Add(keySelector(x), elementSelector(x)); return d; }, cancellationToken); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - - return source.ToDictionary(keySelector, elementSelector, EqualityComparer.Default, cancellationToken); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.ToDictionary(keySelector, x => x, comparer, cancellationToken); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.ToDictionary(keySelector, x => x, EqualityComparer.Default, cancellationToken); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Aggregate(new Lookup(comparer), (lookup, x) => { lookup.Add(keySelector(x), elementSelector(x)); return lookup; }, lookup => (ILookup)lookup, cancellationToken); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - - return source.ToLookup(keySelector, elementSelector, EqualityComparer.Default, cancellationToken); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.ToLookup(keySelector, x => x, comparer, cancellationToken); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.ToLookup(keySelector, x => x, EqualityComparer.Default, cancellationToken); - } - - class Lookup : ILookup - { - private readonly Dictionary> map; - - public Lookup(IEqualityComparer comparer) - { - map = new Dictionary>(comparer); - } - - public void Add(TKey key, TElement element) - { - var g = default(EnumerableGrouping); - if (!map.TryGetValue(key, out g)) - { - g = new EnumerableGrouping(key); - map.Add(key, g); - } - - g.Add(element); - } - - public bool Contains(TKey key) - { - return map.ContainsKey(key); - } - - public int Count - { - get { return map.Keys.Count; } - } - - public IEnumerable this[TKey key] - { - get { return map[key]; } - } - - public IEnumerator> GetEnumerator() - { - return map.Values.Cast>().GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - count++; - sum += e.Current; - f(ct); - } - else - { - if (count == 0) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (e.Current.HasValue) - { - count++; - sum += e.Current.Value; - } - f(ct); - } - else - { - if (count == 0) - tcs.TrySetResult(null); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - count++; - sum += e.Current; - f(ct); - } - else - { - if (count == 0) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (e.Current.HasValue) - { - count++; - sum += e.Current.Value; - } - f(ct); - } - else - { - if (count == 0) - tcs.TrySetResult(null); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - count++; - sum += e.Current; - f(ct); - } - else - { - if (count == 0) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0.0; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (e.Current.HasValue) - { - count++; - sum += e.Current.Value; - } - f(ct); - } - else - { - if (count == 0) - tcs.TrySetResult(null); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0f; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - count++; - sum += e.Current; - f(ct); - } - else - { - if (count == 0) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0f; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (e.Current.HasValue) - { - count++; - sum += e.Current.Value; - } - f(ct); - } - else - { - if (count == 0) - tcs.TrySetResult(null); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0m; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - count++; - sum += e.Current; - f(ct); - } - else - { - if (count == 0) - tcs.TrySetException(new InvalidOperationException()); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var tcs = new TaskCompletionSource(); - - var count = 0L; - var sum = 0m; - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (e.Current.HasValue) - { - count++; - sum += e.Current.Value; - } - f(ct); - } - else - { - if (count == 0) - tcs.TrySetResult(null); - else - tcs.TrySetResult(sum / count); - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Average(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Average(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Max, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Max, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Max, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Max, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Max, cancellationToken); - } - - static T? NullableMax(T? x, T? y) - where T : struct, IComparable - { - if (!x.HasValue) - return y; - if (!y.HasValue) - return x; - if (x.Value.CompareTo(y.Value) >= 0) - return x; - return y; - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(int?), NullableMax, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(long?), NullableMax, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(double?), NullableMax, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(float?), NullableMax, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(decimal?), NullableMax, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var comparer = Comparer.Default; - return source.Aggregate((x, y) => comparer.Compare(x, y) >= 0 ? x : y, cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Max(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Min, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Min, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Min, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Min, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(Math.Min, cancellationToken); - } - - static T? NullableMin(T? x, T? y) - where T : struct, IComparable - { - if (!x.HasValue) - return y; - if (!y.HasValue) - return x; - if (x.Value.CompareTo(y.Value) <= 0) - return x; - return y; - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(int?), NullableMin, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(long?), NullableMin, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(double?), NullableMin, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(float?), NullableMin, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(default(decimal?), NullableMin, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - var comparer = Comparer.Default; - return source.Aggregate((x, y) => comparer.Compare(x, y) <= 0 ? x : y, cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Min(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Min(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0, (x, y) => x + y, cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0L, (x, y) => x + y, cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0.0, (x, y) => x + y, cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0f, (x, y) => x + y, cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate(0m, (x, y) => x + y, cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate((int?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate((long?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate((double?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate((float?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Aggregate((decimal?)0, (x, y) => x + y.GetValueOrDefault(), cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Select(selector).Sum(cancellationToken); - } - - public static Task IsEmpty(this IAsyncEnumerable source, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Any(cancellationToken).ContinueWith(t => !t.Result); - } - - public static Task Min(this IAsyncEnumerable source, IComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return MinBy(source, x => x, comparer, cancellationToken).ContinueWith(t => t.Result.First()); - } - - public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return MinBy(source, keySelector, Comparer.Default, cancellationToken); - } - - public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue), cancellationToken); - } - - public static Task Max(this IAsyncEnumerable source, IComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return MaxBy(source, x => x, comparer, cancellationToken).ContinueWith(t => t.Result.First()); - } - - public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return MaxBy(source, keySelector, Comparer.Default, cancellationToken); - } - - public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue), cancellationToken); - } - - private static Task> ExtremaBy(IAsyncEnumerable source, Func keySelector, Func compare, CancellationToken cancellationToken) - { - var tcs = new TaskCompletionSource>(); - - var result = new List(); - - var hasFirst = false; - var current = default(TSource); - var resKey = default(TKey); - - var e = source.GetEnumerator(); - - var f = default(Action); - f = ct => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (!hasFirst) - { - if (!res) - { - tcs.TrySetException(new InvalidOperationException("Source sequence doesn't contain any elements.")); - return; - } - - current = e.Current; - - try - { - resKey = keySelector(current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - result.Add(current); - - hasFirst = true; - f(ct); - } - else - { - if (res) - { - var key = default(TKey); - var cmp = default(int); - - try - { - current = e.Current; - key = keySelector(current); - cmp = compare(key, resKey); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (cmp == 0) - { - result.Add(current); - } - else if (cmp > 0) - { - result = new List { current }; - resKey = key; - } - - f(ct); - } - else - { - tcs.TrySetResult(result); - } - } - }); - }); - - f(cancellationToken); - - return tcs.Task.Finally(e.Dispose); - } - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs deleted file mode 100644 index 2c66eec..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Conversions.cs +++ /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. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Threading; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static IAsyncEnumerable ToAsyncEnumerable(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var e = source.GetEnumerator(); - - return Create( - ct => Task.Factory.StartNew(() => - { - var res = default(bool); - try - { - res = e.MoveNext(); - } - finally - { - if (!res) - e.Dispose(); - } - return res; - }, ct), - () => e.Current, - () => e.Dispose() - ); - }); - } - - public static IEnumerable ToEnumerable(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return ToEnumerable_(source); - } - - private static IEnumerable ToEnumerable_(IAsyncEnumerable source) - { - using (var e = source.GetEnumerator()) - { - while (true) - { - var t = e.MoveNext(CancellationToken.None); - t.Wait(); - if (!t.Result) - break; - var c = e.Current; - yield return c; - } - } - } - -#if !NO_RXINTERFACES - public static IAsyncEnumerable ToAsyncEnumerable(this IObservable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var observer = new ToAsyncEnumerableObserver(); - observer.Queue = new Queue>(); - - var subscription = source.Subscribe(observer); - - return Create( - (ct, tcs) => - { - lock (observer.Queue) - { - if (observer.Queue.Count > 0) - { - var n = observer.Queue.Dequeue(); - n.Switch( - x => - { - observer.Current = x; - tcs.TrySetResult(true); - }, - ex => - { - tcs.TrySetException(ex); - }, - _ => - { - tcs.TrySetResult(false); - } - ); - } - else - observer.TaskCompletionSource = tcs; - } - - return tcs.Task; - }, - () => observer.Current, - () => - { - subscription.Dispose(); - // Should we cancel in-flight operations somehow? - }); - }); - } - - class ToAsyncEnumerableObserver : IObserver - { - public Queue> Queue { get; set; } - public T Current { get; set; } - public TaskCompletionSource TaskCompletionSource { get; set; } - - public void OnCompleted() - { - lock (Queue) - { - if (TaskCompletionSource == null) - Queue.Enqueue(new Either.Choice3(true)); - else - { - TaskCompletionSource.SetResult(false); - TaskCompletionSource = null; - } - } - } - - public void OnError(Exception error) - { - lock (Queue) - { - if (TaskCompletionSource == null) - Queue.Enqueue(new Either.Choice2(error)); - else - { - TaskCompletionSource.SetException(error); - TaskCompletionSource = null; - } - } - } - - public void OnNext(T value) - { - lock (Queue) - { - if (TaskCompletionSource == null) - Queue.Enqueue(new Either.Choice1(value)); - else - { - Current = value; - TaskCompletionSource.SetResult(true); - TaskCompletionSource = null; - } - } - } - } - - abstract class Either - { - public abstract void Switch(Action choice1, Action choice2, Action choice3); - - public class Choice1 : Either - { - public Choice1(T value) { Value = value; } - public T Value { get; private set; } - - public override void Switch(Action choice1, Action choice2, Action choice3) - { - choice1(Value); - } - } - - public class Choice2 : Either - { - public Choice2(U value) { Value = value; } - public U Value { get; private set; } - - public override void Switch(Action choice1, Action choice2, Action choice3) - { - choice2(Value); - } - } - - public class Choice3 : Either - { - public Choice3(V value) { Value = value; } - public V Value { get; private set; } - - public override void Switch(Action choice1, Action choice2, Action choice3) - { - choice3(Value); - } - } - } - - public static IObservable ToObservable(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new ToObservableObservable(source); - } - - class ToObservableObservable : IObservable - { - private readonly IAsyncEnumerable source; - - public ToObservableObservable(IAsyncEnumerable source) - { - this.source = source; - } - - public IDisposable Subscribe(IObserver observer) - { - var ctd = new CancellationTokenDisposable(); - var e = source.GetEnumerator(); - - var f = default(Action); - f = () => e.MoveNext(ctd.Token).ContinueWith(t => - { - if (t.IsFaulted) - { - observer.OnError(t.Exception); - e.Dispose(); - } - else if (t.IsCanceled) - { - e.Dispose(); - } - else if (t.IsCompleted) - { - if (t.Result) - { - observer.OnNext(e.Current); - f(); - } - else - { - observer.OnCompleted(); - e.Dispose(); - } - } - }, ctd.Token); - - f(); - - return new CompositeDisposable(ctd, e); - } - } -#endif - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs deleted file mode 100644 index f930293..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Creation.cs +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - static IAsyncEnumerable Create(Func> getEnumerator) - { - return new AnonymousAsyncEnumerable(getEnumerator); - } - - class AnonymousAsyncEnumerable : IAsyncEnumerable - { - Func> getEnumerator; - - public AnonymousAsyncEnumerable(Func> getEnumerator) - { - this.getEnumerator = getEnumerator; - } - - public IAsyncEnumerator GetEnumerator() - { - return getEnumerator(); - } - } - - static IAsyncEnumerator Create(Func> moveNext, Func current, Action dispose) - { - return new AnonymousAsyncEnumerator(moveNext, current, dispose); - } - - static IAsyncEnumerator Create(Func, Task> moveNext, Func current, Action dispose) - { - var self = default(IAsyncEnumerator); - self = new AnonymousAsyncEnumerator( - ct => - { - var tcs = new TaskCompletionSource(); - - var stop = new Action(() => - { - self.Dispose(); - tcs.TrySetCanceled(); - }); - - var ctr = ct.Register(stop); - - var res = moveNext(ct, tcs).Finally(ctr.Dispose); - return res; - }, - current, - dispose - ); - return self; - } - - class AnonymousAsyncEnumerator : IAsyncEnumerator - { - private readonly Func> _moveNext; - private readonly Func _current; - private readonly Action _dispose; - private bool _disposed; - - public AnonymousAsyncEnumerator(Func> moveNext, Func current, Action dispose) - { - _moveNext = moveNext; - _current = current; - _dispose = dispose; - } - - public Task MoveNext(CancellationToken cancellationToken) - { - if (_disposed) - return TaskExt.Return(false, CancellationToken.None); - - return _moveNext(cancellationToken); - } - - public T Current - { - get - { - return _current(); - } - } - - public void Dispose() - { - if (!_disposed) - { - _disposed = true; - _dispose(); - } - } - } - - public static IAsyncEnumerable Return(TValue value) - { - return new[] { value }.ToAsyncEnumerable(); - } - - public static IAsyncEnumerable Throw(Exception exception) - { - if (exception == null) - throw new ArgumentNullException("exception"); - - return Create(() => Create( - ct => TaskExt.Throw(exception, ct), - () => { throw new InvalidOperationException(); }, - () => { }) - ); - } - - public static IAsyncEnumerable Never() - { - return Create(() => Create( - (ct, tcs) => tcs.Task, - () => { throw new InvalidOperationException(); }, - () => { }) - ); - } - - public static IAsyncEnumerable Empty() - { - return Create(() => Create( - ct => TaskExt.Return(false, ct), - () => { throw new InvalidOperationException(); }, - () => { }) - ); - } - - public static IAsyncEnumerable Range(int start, int count) - { - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Enumerable.Range(start, count).ToAsyncEnumerable(); - } - - public static IAsyncEnumerable Repeat(TResult element, int count) - { - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Enumerable.Repeat(element, count).ToAsyncEnumerable(); - } - - public static IAsyncEnumerable Repeat(TResult element) - { - return Create(() => - { - return Create( - ct => TaskExt.Return(true, ct), - () => element, - () => { } - ); - }); - } - - public static IAsyncEnumerable Defer(Func> factory) - { - if (factory == null) - throw new ArgumentNullException("factory"); - - return Create(() => factory().GetEnumerator()); - } - - public static IAsyncEnumerable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) - { - if (condition == null) - throw new ArgumentNullException("condition"); - if (iterate == null) - throw new ArgumentNullException("iterate"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return Create(() => - { - var i = initialState; - var started = false; - var current = default(TResult); - - return Create( - ct => - { - var b = false; - try - { - if (started) - i = iterate(i); - - b = condition(i); - - if (b) - current = resultSelector(i); - } - catch (Exception ex) - { - return TaskExt.Throw(ex, ct); - } - - if (!b) - return TaskExt.Return(false, ct); - - if (!started) - started = true; - - return TaskExt.Return(true, ct); - }, - () => current, - () => { } - ); - }); - } - - public static IAsyncEnumerable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable - { - if (resourceFactory == null) - throw new ArgumentNullException("resourceFactory"); - if (enumerableFactory == null) - throw new ArgumentNullException("enumerableFactory"); - - return Create(() => - { - var resource = resourceFactory(); - var e = default(IAsyncEnumerator); - - try - { - e = enumerableFactory(resource).GetEnumerator(); - } - catch (Exception) - { - resource.Dispose(); - throw; - } - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, resource, e); - - var current = default(TSource); - - return Create( - (ct, tcs) => - { - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, - res => - { - if (res) - { - current = e.Current; - tcs.TrySetResult(true); - } - else - { - d.Dispose(); - tcs.TrySetResult(false); - } - }, - ex => - { - d.Dispose(); - tcs.TrySetException(ex); - } - ); - }); - - return tcs.Task; - }, - () => current, - d.Dispose - ); - }); - } - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs deleted file mode 100644 index db33c61..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Exceptions.cs +++ /dev/null @@ -1,381 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static IAsyncEnumerable Catch(this IAsyncEnumerable source, Func> handler) - where TException : Exception - { - if (source == null) - throw new ArgumentNullException("source"); - if (handler == null) - throw new ArgumentNullException("handler"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable { Disposable = e }; - var d = new CompositeDisposable(cts, a); - var done = false; - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (!done) - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, - res => - { - tcs.TrySetResult(res); - }, - ex => - { - var err = default(IAsyncEnumerator); - - try - { - ex.Flatten().Handle(ex_ => - { - var exx = ex_ as TException; - if (exx != null) - { - err = handler(exx).GetEnumerator(); - return true; - } - - return false; - }); - } - catch (Exception ex2) - { - tcs.TrySetException(ex2); - return; - } - - if (err != null) - { - e = err; - a.Disposable = e; - - done = true; - f(tcs, ct); - } - } - ); - }); - } - else - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - tcs.TrySetResult(res); - }); - }); - } - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Catch(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Catch_(); - } - - public static IAsyncEnumerable Catch(params IAsyncEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Catch_(); - } - - public static IAsyncEnumerable Catch(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return new[] { first, second }.Catch_(); - } - - private static IAsyncEnumerable Catch_(this IEnumerable> sources) - { - return Create(() => - { - var se = sources.GetEnumerator(); - var e = default(IAsyncEnumerator); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable(); - var d = new CompositeDisposable(cts, se, a); - - var error = default(Exception); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - var b = false; - try - { - b = se.MoveNext(); - if (b) - e = se.Current.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (!b) - { - if (error != null) - { - tcs.TrySetException(error); - return; - } - - tcs.TrySetResult(false); - return; - } - - error = null; - - a.Disposable = e; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, - res => - { - tcs.TrySetResult(res); - }, - ex => - { - e.Dispose(); - e = null; - - error = ex; - f(tcs, ct); - } - ); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Finally(this IAsyncEnumerable source, Action finallyAction) - { - if (source == null) - throw new ArgumentNullException("source"); - if (finallyAction == null) - throw new ArgumentNullException("finallyAction"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var r = new Disposable(finallyAction); - var d = new CompositeDisposable(cts, e, r); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - tcs.TrySetResult(res); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumeratorSync(r); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable OnErrorResumeNext(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return OnErrorResumeNext_(new[] { first, second }); - } - - public static IAsyncEnumerable OnErrorResumeNext(params IAsyncEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return OnErrorResumeNext_(sources); - } - - public static IAsyncEnumerable OnErrorResumeNext(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return OnErrorResumeNext_(sources); - } - - private static IAsyncEnumerable OnErrorResumeNext_(IEnumerable> sources) - { - return Create(() => - { - var se = sources.GetEnumerator(); - var e = default(IAsyncEnumerator); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable(); - var d = new CompositeDisposable(cts, se, a); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - var b = false; - try - { - b = se.MoveNext(); - if (b) - e = se.Current.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (!b) - { - tcs.TrySetResult(false); - return; - } - - a.Disposable = e; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, - res => - { - if (res) - { - tcs.TrySetResult(true); - } - else - { - e.Dispose(); - e = null; - - f(tcs, ct); - } - }, - ex => - { - e.Dispose(); - e = null; - - f(tcs, ct); - } - ); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Retry(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new[] { source }.Repeat().Catch(); - } - - public static IAsyncEnumerable Retry(this IAsyncEnumerable source, int retryCount) - { - if (source == null) - throw new ArgumentNullException("source"); - if (retryCount < 0) - throw new ArgumentOutOfRangeException("retryCount"); - - return new[] { source }.Repeat(retryCount).Catch(); - } - - private static IEnumerable Repeat(this IEnumerable source) - { - while (true) - foreach (var item in source) - yield return item; - } - - private static IEnumerable Repeat(this IEnumerable source, int count) - { - for (var i = 0; i < count; i++) - foreach (var item in source) - yield return item; - } - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs deleted file mode 100644 index 23c6c8d..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Generated.cs +++ /dev/null @@ -1,1250 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Sum(source, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static Task Sum(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Sum(source, selector, CancellationToken.None); - } - - public static void ForEach(this IAsyncEnumerable source, Action action) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - source.ForEachAsync(action).Wait(); - } - - public static Task ForEachAsync(this IAsyncEnumerable source, Action action) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - return ForEachAsync(source, action, CancellationToken.None); - } - - public static void ForEach(this IAsyncEnumerable source, Action action) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - source.ForEachAsync(action).Wait(); - } - - public static Task ForEachAsync(this IAsyncEnumerable source, Action action) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - return ForEachAsync(source, action, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Average(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Max(source, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Max(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Min(source, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Min(source, selector, CancellationToken.None); - } - - public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return SequenceEqual(first, second, comparer, CancellationToken.None); - } - - public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return SequenceEqual(first, second, CancellationToken.None); - } - - public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator, Func resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return Aggregate(source, seed, accumulator, resultSelector, CancellationToken.None); - } - - public static Task Aggregate(this IAsyncEnumerable source, TAccumulate seed, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return Aggregate(source, seed, accumulator, CancellationToken.None); - } - - public static Task Aggregate(this IAsyncEnumerable source, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return Aggregate(source, accumulator, CancellationToken.None); - } - - public static Task Count(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Count(source, CancellationToken.None); - } - - public static Task Count(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Count(source, predicate, CancellationToken.None); - } - - public static Task LongCount(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return LongCount(source, CancellationToken.None); - } - - public static Task LongCount(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return LongCount(source, predicate, CancellationToken.None); - } - - public static Task All(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return All(source, predicate, CancellationToken.None); - } - - public static Task Any(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Any(source, predicate, CancellationToken.None); - } - - public static Task Any(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Any(source, CancellationToken.None); - } - - public static Task Contains(this IAsyncEnumerable source, TSource value, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Contains(source, value, comparer, CancellationToken.None); - } - - public static Task Contains(this IAsyncEnumerable source, TSource value) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Contains(source, value, CancellationToken.None); - } - - public static Task First(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return First(source, CancellationToken.None); - } - - public static Task First(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return First(source, predicate, CancellationToken.None); - } - - public static Task FirstOrDefault(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return FirstOrDefault(source, CancellationToken.None); - } - - public static Task FirstOrDefault(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return FirstOrDefault(source, predicate, CancellationToken.None); - } - - public static Task Last(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Last(source, CancellationToken.None); - } - - public static Task Last(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Last(source, predicate, CancellationToken.None); - } - - public static Task LastOrDefault(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return LastOrDefault(source, CancellationToken.None); - } - - public static Task LastOrDefault(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return LastOrDefault(source, predicate, CancellationToken.None); - } - - public static Task Single(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Single(source, CancellationToken.None); - } - - public static Task Single(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Single(source, predicate, CancellationToken.None); - } - - public static Task SingleOrDefault(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return SingleOrDefault(source, CancellationToken.None); - } - - public static Task SingleOrDefault(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return SingleOrDefault(source, predicate, CancellationToken.None); - } - - public static Task ElementAt(this IAsyncEnumerable source, int index) - { - if (source == null) - throw new ArgumentNullException("source"); - - return ElementAt(source, index, CancellationToken.None); - } - - public static Task ElementAtOrDefault(this IAsyncEnumerable source, int index) - { - if (source == null) - throw new ArgumentNullException("source"); - - return ElementAtOrDefault(source, index, CancellationToken.None); - } - - public static Task ToArray(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return ToArray(source, CancellationToken.None); - } - - public static Task> ToList(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return ToList(source, CancellationToken.None); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ToDictionary(source, keySelector, elementSelector, comparer, CancellationToken.None); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, Func elementSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - - return ToDictionary(source, keySelector, elementSelector, CancellationToken.None); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ToDictionary(source, keySelector, comparer, CancellationToken.None); - } - - public static Task> ToDictionary(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return ToDictionary(source, keySelector, CancellationToken.None); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ToLookup(source, keySelector, elementSelector, comparer, CancellationToken.None); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, Func elementSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - - return ToLookup(source, keySelector, elementSelector, CancellationToken.None); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ToLookup(source, keySelector, comparer, CancellationToken.None); - } - - public static Task> ToLookup(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return ToLookup(source, keySelector, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task Average(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Average(source, CancellationToken.None); - } - - public static Task IsEmpty(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.IsEmpty(CancellationToken.None); - } - - public static Task Min(this IAsyncEnumerable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Min(comparer, CancellationToken.None); - } - - public static Task> MinBy(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.MinBy(keySelector, CancellationToken.None); - } - - public static Task> MinBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.MinBy(keySelector, comparer, CancellationToken.None); - } - - public static Task Max(this IAsyncEnumerable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Max(comparer, CancellationToken.None); - } - - public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.MaxBy(keySelector, CancellationToken.None); - } - - public static Task> MaxBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.MaxBy(keySelector, comparer, CancellationToken.None); - } - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs deleted file mode 100644 index a8069b2..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Multiple.cs +++ /dev/null @@ -1,755 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Threading; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static IAsyncEnumerable Concat(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return Create(() => - { - var switched = false; - var e = first.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable { Disposable = e }; - var d = new CompositeDisposable(cts, a); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - tcs.TrySetResult(true); - } - else - { - if (switched) - { - tcs.TrySetResult(false); - } - else - { - switched = true; - - e = second.GetEnumerator(); - a.Disposable = e; - - f(tcs, ct); - } - } - }); - }); - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Zip(this IAsyncEnumerable first, IAsyncEnumerable second, Func selector) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e1 = first.GetEnumerator(); - var e2 = second.GetEnumerator(); - var current = default(TResult); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e1, e2); - - return Create( - (ct, tcs) => - { - e1.MoveNext(cts.Token).Zip(e2.MoveNext(cts.Token), (f, s) => - { - var result = f && s; - if (result) - current = selector(e1.Current, e2.Current); - return result; - }).ContinueWith(t => - { - t.Handle(tcs, x => tcs.TrySetResult(x)); - }); - - return tcs.Task.UsingEnumerator(e1).UsingEnumerator(e2); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Except(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Create(() => - { - var e = first.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var mapTask = default(Task>); - var getMapTask = new Func>>(ct => - { - if (mapTask == null) - mapTask = second.ToDictionary(x => x, comparer, ct); - return mapTask; - }); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).Zip(getMapTask(ct), (b, _) => b).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (!mapTask.Result.ContainsKey(e.Current)) - tcs.TrySetResult(true); - else - f(tcs, ct); - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Except(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.Except(second, EqualityComparer.Default); - } - - public static IAsyncEnumerable Intersect(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Create(() => - { - var e = first.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var mapTask = default(Task>); - var getMapTask = new Func>>(ct => - { - if (mapTask == null) - mapTask = second.ToDictionary(x => x, comparer, ct); - return mapTask; - }); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).Zip(getMapTask(ct), (b, _) => b).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - if (mapTask.Result.ContainsKey(e.Current)) - tcs.TrySetResult(true); - else - f(tcs, ct); - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Intersect(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.Intersect(second, EqualityComparer.Default); - } - - public static IAsyncEnumerable Union(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return first.Concat(second).Distinct(comparer); - } - - public static IAsyncEnumerable Union(this IAsyncEnumerable first, IAsyncEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.Union(second, EqualityComparer.Default); - } - - public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, IEqualityComparer comparer, CancellationToken cancellationToken) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - var tcs = new TaskCompletionSource(); - - var e1 = first.GetEnumerator(); - var e2 = second.GetEnumerator(); - - var run = default(Action); - run = ct => - { - e1.MoveNext(ct).Zip(e2.MoveNext(ct), (f, s) => - { - if (f ^ s) - { - tcs.TrySetResult(false); - return false; - } - - if (f && s) - { - var eq = default(bool); - try - { - eq = comparer.Equals(e1.Current, e2.Current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return false; - } - - if (!eq) - { - tcs.TrySetResult(false); - return false; - } - else - return true; - } - else - { - tcs.TrySetResult(true); - return false; - } - }).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - run(ct); - }); - }); - }; - - run(cancellationToken); - - return tcs.Task.Finally(() => - { - e1.Dispose(); - e2.Dispose(); - }); - } - - public static Task SequenceEqual(this IAsyncEnumerable first, IAsyncEnumerable second, CancellationToken cancellationToken) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.SequenceEqual(second, EqualityComparer.Default, cancellationToken); - } - - public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector, IEqualityComparer comparer) - { - if (outer == null) - throw new ArgumentNullException("outer"); - if (inner == null) - throw new ArgumentNullException("inner"); - if (outerKeySelector == null) - throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) - throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Create(() => - { - var innerMap = default(Task>); - var getInnerMap = new Func>>(ct => - { - if (innerMap == null) - innerMap = inner.ToLookup(innerKeySelector, comparer, ct); - - return innerMap; - }); - - var outerE = outer.GetEnumerator(); - var current = default(TResult); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, outerE); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - getInnerMap(ct).ContinueWith(ti => - { - ti.Handle(tcs, map => - { - outerE.MoveNext(ct).ContinueWith(to => - { - to.Handle(tcs, res => - { - if (res) - { - var element = outerE.Current; - var key = default(TKey); - - try - { - key = outerKeySelector(element); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - var innerE = default(IAsyncEnumerable); - if (!map.Contains(key)) - innerE = AsyncEnumerable.Empty(); - else - innerE = map[key].ToAsyncEnumerable(); - - try - { - current = resultSelector(element, innerE); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - tcs.TrySetResult(true); - } - else - { - tcs.TrySetResult(false); - } - }); - }); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(outerE); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable GroupJoin(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector) - { - if (outer == null) - throw new ArgumentNullException("outer"); - if (inner == null) - throw new ArgumentNullException("inner"); - if (outerKeySelector == null) - throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) - throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer.Default); - } - - public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector, IEqualityComparer comparer) - { - if (outer == null) - throw new ArgumentNullException("outer"); - if (inner == null) - throw new ArgumentNullException("inner"); - if (outerKeySelector == null) - throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) - throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Create(() => - { - var oe = outer.GetEnumerator(); - var ie = inner.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, oe, ie); - - var current = default(TResult); - var useOuter = true; - var outerMap = new Dictionary>(comparer); - var innerMap = new Dictionary>(comparer); - var q = new Queue(); - - var gate = new object(); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (q.Count > 0) - { - current = q.Dequeue(); - tcs.TrySetResult(true); - return; - } - - var b = useOuter; - if (ie == null && oe == null) - { - tcs.TrySetResult(false); - return; - } - else if (ie == null) - b = true; - else if (oe == null) - b = false; - useOuter = !useOuter; - - var enqueue = new Func((o, i) => - { - var result = default(TResult); - try - { - result = resultSelector(o, i); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - return false; - } - - q.Enqueue(result); - return true; - }); - - if (b) - oe.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var element = oe.Current; - var key = default(TKey); - - try - { - key = outerKeySelector(element); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - return; - } - - var outerList = default(List); - if (!outerMap.TryGetValue(key, out outerList)) - { - outerList = new List(); - outerMap.Add(key, outerList); - } - - outerList.Add(element); - - var innerList = default(List); - if (!innerMap.TryGetValue(key, out innerList)) - { - innerList = new List(); - innerMap.Add(key, innerList); - } - - foreach (var v in innerList) - { - if (!enqueue(element, v)) - return; - } - - f(tcs, ct); - } - else - { - oe.Dispose(); - oe = null; - f(tcs, ct); - } - }); - }); - else - ie.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var element = ie.Current; - var key = default(TKey); - - try - { - key = innerKeySelector(element); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - return; - } - - var innerList = default(List); - if (!innerMap.TryGetValue(key, out innerList)) - { - innerList = new List(); - innerMap.Add(key, innerList); - } - - innerList.Add(element); - - var outerList = default(List); - if (!outerMap.TryGetValue(key, out outerList)) - { - outerList = new List(); - outerMap.Add(key, outerList); - } - - foreach (var v in outerList) - { - if (!enqueue(v, element)) - return; - } - - f(tcs, ct); - } - else - { - ie.Dispose(); - ie = null; - f(tcs, ct); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(oe).UsingEnumerator(ie); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Join(this IAsyncEnumerable outer, IAsyncEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) - { - if (outer == null) - throw new ArgumentNullException("outer"); - if (inner == null) - throw new ArgumentNullException("inner"); - if (outerKeySelector == null) - throw new ArgumentNullException("outerKeySelector"); - if (innerKeySelector == null) - throw new ArgumentNullException("innerKeySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, EqualityComparer.Default); - } - - public static IAsyncEnumerable Concat(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Concat_(); - } - - public static IAsyncEnumerable Concat(params IAsyncEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Concat_(); - } - - private static IAsyncEnumerable Concat_(this IEnumerable> sources) - { - return Create(() => - { - var se = sources.GetEnumerator(); - var e = default(IAsyncEnumerator); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable(); - var d = new CompositeDisposable(cts, se, a); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - var b = false; - try - { - b = se.MoveNext(); - if (b) - e = se.Current.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (!b) - { - tcs.TrySetResult(false); - return; - } - - a.Disposable = e; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - tcs.TrySetResult(true); - } - else - { - e.Dispose(); - e = null; - - f(tcs, ct); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, IAsyncEnumerable other) - { - if (source == null) - throw new ArgumentNullException("source"); - if (other == null) - throw new ArgumentNullException("other"); - - return source.SelectMany(_ => other); - } - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs b/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs deleted file mode 100644 index bab56a2..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerable.Single.cs +++ /dev/null @@ -1,2466 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Linq -{ - public static partial class AsyncEnumerable - { - public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e = source.GetEnumerator(); - var current = default(TResult); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - current = selector(e.Current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - tcs.TrySetResult(true); - } - else - { - tcs.TrySetResult(false); - } - }); - }); - - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Select(this IAsyncEnumerable source, Func selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e = source.GetEnumerator(); - var current = default(TResult); - var index = 0; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - current = selector(e.Current, index++); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - tcs.TrySetResult(true); - } - else - { - tcs.TrySetResult(false); - } - }); - }); - - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable AsAsyncEnumerable(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Select(x => x); - } - - public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var b = false; - try - { - b = predicate(e.Current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (b) - tcs.TrySetResult(true); - else - f(tcs, ct); - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Where(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - var index = 0; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var b = false; - try - { - b = predicate(e.Current, index++); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (b) - tcs.TrySetResult(true); - else - f(tcs, ct); - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e = source.GetEnumerator(); - var ie = default(IAsyncEnumerator); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var outer = default(Action, CancellationToken>); - var inner = default(Action, CancellationToken>); - - inner = (tcs, ct) => - { - ie.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - tcs.TrySetResult(true); - } - else - { - ie = null; - outer(tcs, ct); - } - }); - }); - }; - - outer = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - ie = selector(e.Current).GetEnumerator(); - inner(tcs, ct); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - if (ie == null) - outer(tcs, cts.Token); - else - inner(tcs, cts.Token); - - return tcs.Task.UsingEnumerator(e); - }, - () => ie.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e = source.GetEnumerator(); - var ie = default(IAsyncEnumerator); - var index = 0; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var outer = default(Action, CancellationToken>); - var inner = default(Action, CancellationToken>); - - inner = (tcs, ct) => - { - ie.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - tcs.TrySetResult(true); - } - else - { - ie = null; - outer(tcs, ct); - } - }); - }); - }; - - outer = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - ie = selector(e.Current, index++).GetEnumerator(); - inner(tcs, ct); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - } - } - else - tcs.TrySetResult(false); - }); - }); - }; - - return Create( - (ct, tcs) => - { - if (ie == null) - outer(tcs, cts.Token); - else - inner(tcs, cts.Token); - - return tcs.Task.UsingEnumerator(e); - }, - () => ie.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector, Func resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return source.SelectMany(x => selector(x).Select(y => resultSelector(x, y))); - } - - public static IAsyncEnumerable SelectMany(this IAsyncEnumerable source, Func> selector, Func resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return source.SelectMany((x, i) => selector(x, i).Select(y => resultSelector(x, y))); - } - - public static IAsyncEnumerable OfType(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Where(x => x is TType).Cast(); - } - - public static IAsyncEnumerable Cast(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Select(x => (TResult)x); - } - - public static IAsyncEnumerable Take(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Create(() => - { - var e = source.GetEnumerator(); - var n = count; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - if (n == 0) - return TaskExt.Return(false, cts.Token); - - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - --n; - tcs.TrySetResult(res); - }); - }); - - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var b = false; - - try - { - b = predicate(e.Current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (b) - { - tcs.TrySetResult(true); - return; - } - } - tcs.TrySetResult(false); - }); - }); - - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable TakeWhile(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - var index = 0; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - e.MoveNext(cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var b = false; - - try - { - b = predicate(e.Current, index++); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (b) - { - tcs.TrySetResult(true); - return; - } - } - tcs.TrySetResult(false); - }); - }); - - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Skip(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Create(() => - { - var e = source.GetEnumerator(); - var n = count; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (n == 0) - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, x => tcs.TrySetResult(x)); - }); - else - { - --n; - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (!res) - tcs.TrySetResult(false); - else - f(tcs, ct); - }); - }); - } - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - var skipping = true; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (skipping) - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var result = false; - try - { - result = predicate(e.Current); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - if (result) - f(tcs, ct); - else - { - skipping = false; - tcs.TrySetResult(true); - } - } - else - tcs.TrySetResult(false); - }); - }); - else - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, x => tcs.TrySetResult(x)); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SkipWhile(this IAsyncEnumerable source, Func predicate) - { - if (source == null) - throw new ArgumentNullException("source"); - if (predicate == null) - throw new ArgumentNullException("predicate"); - - return Create(() => - { - var e = source.GetEnumerator(); - var skipping = true; - var index = 0; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (skipping) - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var result = false; - try - { - result = predicate(e.Current, index++); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - if (result) - f(tcs, ct); - else - { - skipping = false; - tcs.TrySetResult(true); - } - } - else - tcs.TrySetResult(false); - }); - }); - else - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, x => tcs.TrySetResult(x)); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => e.Current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable DefaultIfEmpty(this IAsyncEnumerable source, TSource defaultValue) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var done = false; - var hasElements = false; - var e = source.GetEnumerator(); - var current = default(TSource); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (done) - tcs.TrySetResult(false); - else - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - hasElements = true; - current = e.Current; - tcs.TrySetResult(true); - } - else - { - done = true; - - if (!hasElements) - { - current = defaultValue; - tcs.TrySetResult(true); - } - else - tcs.TrySetResult(false); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable DefaultIfEmpty(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.DefaultIfEmpty(default(TSource)); - } - - public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Defer(() => - { - var set = new HashSet(comparer); - return source.Where(set.Add); - }); - } - - public static IAsyncEnumerable Distinct(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Distinct(EqualityComparer.Default); - } - - public static IAsyncEnumerable Reverse(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var e = source.GetEnumerator(); - var stack = default(Stack); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - return Create( - (ct, tcs) => - { - if (stack == null) - { - Create(() => e).Aggregate(new Stack(), (s, x) => { s.Push(x); return s; }, cts.Token).ContinueWith(t => - { - t.Handle(tcs, res => - { - stack = res; - tcs.TrySetResult(stack.Count > 0); - }); - }, cts.Token); - } - else - { - stack.Pop(); - tcs.TrySetResult(stack.Count > 0); - } - - return tcs.Task.UsingEnumerator(e); - }, - () => stack.Peek(), - d.Dispose - ); - }); - } - - public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return new OrderedAsyncEnumerable( - Create(() => - { - var current = default(IEnumerable); - - return Create( - ct => - { - var tcs = new TaskCompletionSource(); - if (current == null) - { - source.ToList(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - current = res; - tcs.TrySetResult(true); - }); - }); - } - else - tcs.TrySetResult(false); - return tcs.Task; - }, - () => current, - () => { } - ); - }), - keySelector, - comparer - ); - } - - public static IOrderedAsyncEnumerable OrderBy(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.OrderBy(keySelector, Comparer.Default); - } - - public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.OrderBy(keySelector, new ReverseComparer(comparer)); - } - - public static IOrderedAsyncEnumerable OrderByDescending(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.OrderByDescending(keySelector, Comparer.Default); - } - - public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.ThenBy(keySelector, Comparer.Default); - } - - public static IOrderedAsyncEnumerable ThenBy(this IOrderedAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.CreateOrderedEnumerable(keySelector, comparer, false); - } - - public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.ThenByDescending(keySelector, Comparer.Default); - } - - public static IOrderedAsyncEnumerable ThenByDescending(this IOrderedAsyncEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.CreateOrderedEnumerable(keySelector, comparer, true); - } - - static IEnumerable> GroupUntil(this IEnumerable source, Func keySelector, Func elementSelector, IComparer comparer) - { - var group = default(EnumerableGrouping); - foreach (var x in source) - { - var key = keySelector(x); - if (group == null || comparer.Compare(group.Key, key) != 0) - { - group = new EnumerableGrouping(key); - yield return group; - } - group.Add(elementSelector(x)); - } - } - - class OrderedAsyncEnumerable : IOrderedAsyncEnumerable - { - private readonly IAsyncEnumerable> equivalenceClasses; - private readonly Func keySelector; - private readonly IComparer comparer; - - public OrderedAsyncEnumerable(IAsyncEnumerable> equivalenceClasses, Func keySelector, IComparer comparer) - { - this.equivalenceClasses = equivalenceClasses; - this.keySelector = keySelector; - this.comparer = comparer; - } - - public IOrderedAsyncEnumerable CreateOrderedEnumerable(Func keySelector, IComparer comparer, bool descending) - { - if (descending) - comparer = new ReverseComparer(comparer); - - return new OrderedAsyncEnumerable(Classes(), keySelector, comparer); - } - - IAsyncEnumerable> Classes() - { - return Create(() => - { - var e = equivalenceClasses.GetEnumerator(); - var list = new List>(); - var e1 = default(IEnumerator>); - - var cts = new CancellationTokenDisposable(); - var d1 = new AssignableDisposable(); - var d = new CompositeDisposable(cts, e, d1); - - var f = default(Action, CancellationToken>); - var g = default(Action, CancellationToken>); - - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - foreach (var group in e.Current.OrderBy(keySelector, comparer).GroupUntil(keySelector, x => x, comparer)) - list.Add(group); - f(tcs, ct); - } - catch (Exception exception) - { - tcs.TrySetException(exception); - return; - } - } - else - { - e.Dispose(); - - e1 = list.GetEnumerator(); - d1.Disposable = e1; - - g(tcs, ct); - } - }); - }); - }; - - g = (tcs, ct) => - { - var res = false; - try - { - res = e1.MoveNext(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - tcs.TrySetResult(res); - }; - - return Create( - (ct, tcs) => - { - if (e1 != null) - { - g(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e1); - } - else - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - } - }, - () => e1.Current, - d.Dispose - ); - }); - } - - public IAsyncEnumerator GetEnumerator() - { - return Classes().SelectMany(x => x.ToAsyncEnumerable()).GetEnumerator(); - } - } - - class ReverseComparer : IComparer - { - IComparer comparer; - - public ReverseComparer(IComparer comparer) - { - this.comparer = comparer; - } - - public int Compare(T x, T y) - { - return -comparer.Compare(x, y); - } - } - - public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Create(() => - { - var gate = new object(); - - var e = source.GetEnumerator(); - var count = 1; - - var map = new Dictionary>(comparer); - var list = new List>(); - - var index = 0; - - var current = default(IAsyncGrouping); - var faulted = default(Exception); - - var task = default(Task); - - var cts = new CancellationTokenDisposable(); - var refCount = new Disposable( - () => - { - if (Interlocked.Decrement(ref count) == 0) - e.Dispose(); - } - ); - var d = new CompositeDisposable(cts, refCount); - - var iterateSource = default(Func>); - iterateSource = ct => - { - var tcs = default(TaskCompletionSource); - lock (gate) - { - if (task != null) - { - return task; - } - else - { - tcs = new TaskCompletionSource(); - task = tcs.Task.UsingEnumerator(e); - } - } - - if (faulted != null) - { - tcs.TrySetException(faulted); - return task; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, - res => - { - if (res) - { - var key = default(TKey); - var element = default(TElement); - - var cur = e.Current; - try - { - key = keySelector(cur); - element = elementSelector(cur); - } - catch (Exception exception) - { - foreach (var v in map.Values) - v.Error(exception); - - tcs.TrySetException(exception); - return; - } - - var group = default(Grouping); - if (!map.TryGetValue(key, out group)) - { - group = new Grouping(key, iterateSource, refCount); - map.Add(key, group); - lock (list) - list.Add(group); - - Interlocked.Increment(ref count); - } - group.Add(element); - } - - tcs.TrySetResult(res); - }, - ex => - { - foreach (var v in map.Values) - v.Error(ex); - - faulted = ex; - tcs.TrySetException(ex); - } - ); - - lock (gate) - { - task = null; - } - }); - - return tcs.Task.UsingEnumerator(e); - }; - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - iterateSource(ct).ContinueWith(t => - { - t.Handle(tcs, - res => - { - current = null; - lock (list) - { - if (index < list.Count) - current = list[index++]; - } - - if (current != null) - { - tcs.TrySetResult(true); - } - else - { - if (res) - f(tcs, ct); - else - tcs.TrySetResult(false); - } - } - ); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task; - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - - return source.GroupBy(keySelector, elementSelector, EqualityComparer.Default); - } - - public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.GroupBy(keySelector, x => x, comparer); - } - - public static IAsyncEnumerable> GroupBy(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.GroupBy(keySelector, x => x, EqualityComparer.Default); - } - - public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.GroupBy(keySelector, elementSelector, comparer).Select(g => resultSelector(g.Key, g)); - } - - public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (elementSelector == null) - throw new ArgumentNullException("elementSelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return source.GroupBy(keySelector, elementSelector, EqualityComparer.Default).Select(g => resultSelector(g.Key, g)); - } - - public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func, TResult> resultSelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.GroupBy(keySelector, x => x, comparer).Select(g => resultSelector(g.Key, g)); - } - - public static IAsyncEnumerable GroupBy(this IAsyncEnumerable source, Func keySelector, Func, TResult> resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return source.GroupBy(keySelector, x => x, EqualityComparer.Default).Select(g => resultSelector(g.Key, g)); - } - - class Grouping : IAsyncGrouping - { - private readonly Func> iterateSource; - private readonly IDisposable sourceDisposable; - private readonly List elements = new List(); - private bool done = false; - private Exception exception = null; - - public Grouping(TKey key, Func> iterateSource, IDisposable sourceDisposable) - { - this.iterateSource = iterateSource; - this.sourceDisposable = sourceDisposable; - Key = key; - } - - public TKey Key - { - get; - private set; - } - - public void Add(TElement element) - { - lock (elements) - elements.Add(element); - } - - public void Error(Exception exception) - { - done = true; - this.exception = exception; - } - - public IAsyncEnumerator GetEnumerator() - { - var index = -1; - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, sourceDisposable); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - var size = 0; - lock (elements) - size = elements.Count; - - if (index < size) - { - tcs.TrySetResult(true); - } - else if (done) - { - if (exception != null) - tcs.TrySetException(exception); - else - tcs.TrySetResult(false); - } - else - { - iterateSource(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - f(tcs, ct); - else - tcs.TrySetResult(false); - }); - }); - } - }; - - return Create( - (ct, tcs) => - { - ++index; - f(tcs, cts.Token); - return tcs.Task; - }, - () => elements[index], - d.Dispose - ); - } - } - - #region Ix - - public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - - return DoHelper(source, onNext, _ => { }, () => { }); - } - - public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return DoHelper(source, onNext, _ => { }, onCompleted); - } - - public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - - return DoHelper(source, onNext, onError, () => { }); - } - - public static IAsyncEnumerable Do(this IAsyncEnumerable source, Action onNext, Action onError, Action onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return DoHelper(source, onNext, onError, onCompleted); - } - -#if !NO_RXINTERFACES - public static IAsyncEnumerable Do(this IAsyncEnumerable source, IObserver observer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (observer == null) - throw new ArgumentNullException("observer"); - - return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted); - } -#endif - - private static IAsyncEnumerable DoHelper(this IAsyncEnumerable source, Action onNext, Action onError, Action onCompleted) - { - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - if (!t.IsCanceled) - { - try - { - if (t.IsFaulted) - { - onError(t.Exception); - } - else if (!t.Result) - { - onCompleted(); - } - else - { - current = e.Current; - onNext(current); - } - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - } - - t.Handle(tcs, res => - { - tcs.TrySetResult(res); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static void ForEach(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - source.ForEachAsync(action, cancellationToken).Wait(cancellationToken); - } - - public static Task ForEachAsync(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - return source.ForEachAsync((x, i) => action(x), cancellationToken); - } - - public static void ForEach(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - source.ForEachAsync(action, cancellationToken).Wait(cancellationToken); - } - - public static Task ForEachAsync(this IAsyncEnumerable source, Action action, CancellationToken cancellationToken) - { - if (source == null) - throw new ArgumentNullException("source"); - if (action == null) - throw new ArgumentNullException("action"); - - var tcs = new TaskCompletionSource(); - - var e = source.GetEnumerator(); - - var i = 0; - - var f = default(Action); - f = ct => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - try - { - action(e.Current, i++); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - f(ct); - } - else - tcs.TrySetResult(true); - }); - }); - }; - - f(cancellationToken); - - return tcs.Task.UsingEnumerator(e); - } - - public static IAsyncEnumerable Repeat(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Create(() => - { - var e = default(IAsyncEnumerator); - var a = new AssignableDisposable(); - var n = count; - var current = default(TSource); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, a); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - if (n-- == 0) - { - tcs.TrySetResult(false); - return; - } - - try - { - e = source.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - a.Disposable = e; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - current = e.Current; - tcs.TrySetResult(true); - } - else - { - e = null; - f(tcs, ct); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(d); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Repeat(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var e = default(IAsyncEnumerator); - var a = new AssignableDisposable(); - var current = default(TSource); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, a); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - try - { - e = source.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - a.Disposable = e; - } - - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - current = e.Current; - tcs.TrySetResult(true); - } - else - { - e = null; - f(tcs, ct); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(d); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable IgnoreElements(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (!res) - { - tcs.TrySetResult(false); - return; - } - - f(tcs, ct); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => { throw new InvalidOperationException(); }, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable StartWith(this IAsyncEnumerable source, params TSource[] values) - { - if (source == null) - throw new ArgumentNullException("source"); - - return values.ToAsyncEnumerable().Concat(source); - } - - public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count <= 0) - throw new ArgumentOutOfRangeException("count"); - - return source.Buffer_(count, count); - } - - public static IAsyncEnumerable> Buffer(this IAsyncEnumerable source, int count, int skip) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count <= 0) - throw new ArgumentOutOfRangeException("count"); - if (skip <= 0) - throw new ArgumentOutOfRangeException("skip"); - - return source.Buffer_(count, skip); - } - - private static IAsyncEnumerable> Buffer_(this IAsyncEnumerable source, int count, int skip) - { - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var buffers = new Queue>(); - - var i = 0; - - var current = default(IList); - var stopped = false; - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (!stopped) - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var item = e.Current; - - if (i++ % skip == 0) - buffers.Enqueue(new List(count)); - - foreach (var buffer in buffers) - buffer.Add(item); - - if (buffers.Count > 0 && buffers.Peek().Count == count) - { - current = buffers.Dequeue(); - tcs.TrySetResult(true); - return; - } - - f(tcs, ct); - } - else - { - stopped = true; - e.Dispose(); - - f(tcs, ct); - } - }); - }); - } - else - { - if (buffers.Count > 0) - { - current = buffers.Dequeue(); - tcs.TrySetResult(true); - } - else - { - tcs.TrySetResult(false); - } - } - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return Defer(() => - { - var set = new HashSet(comparer); - return source.Where(item => set.Add(keySelector(item))); - }); - } - - public static IAsyncEnumerable Distinct(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Distinct(keySelector, EqualityComparer.Default); - } - - public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.DistinctUntilChanged_(x => x, EqualityComparer.Default); - } - - public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.DistinctUntilChanged_(x => x, comparer); - } - - public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.DistinctUntilChanged_(keySelector, EqualityComparer.Default); - } - - public static IAsyncEnumerable DistinctUntilChanged(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.DistinctUntilChanged_(keySelector, comparer); - } - - private static IAsyncEnumerable DistinctUntilChanged_(this IAsyncEnumerable source, Func keySelector, IEqualityComparer comparer) - { - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var currentKey = default(TKey); - var hasCurrentKey = false; - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var item = e.Current; - var key = default(TKey); - var comparerEquals = false; - - try - { - key = keySelector(item); - - if (hasCurrentKey) - { - comparerEquals = comparer.Equals(currentKey, key); - } - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - if (!hasCurrentKey || !comparerEquals) - { - hasCurrentKey = true; - currentKey = key; - - current = item; - tcs.TrySetResult(true); - } - else - { - f(tcs, ct); - } - } - else - { - tcs.TrySetResult(false); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Expand(this IAsyncEnumerable source, Func> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => - { - var e = default(IAsyncEnumerator); - - var cts = new CancellationTokenDisposable(); - var a = new AssignableDisposable(); - var d = new CompositeDisposable(cts, a); - - var queue = new Queue>(); - queue.Enqueue(source); - - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (e == null) - { - if (queue.Count > 0) - { - var src = queue.Dequeue(); - - try - { - e = src.GetEnumerator(); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - a.Disposable = e; - f(tcs, ct); - } - else - { - tcs.TrySetResult(false); - } - } - else - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var item = e.Current; - - var next = default(IAsyncEnumerable); - try - { - next = selector(item); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - queue.Enqueue(next); - current = item; - tcs.TrySetResult(true); - } - else - { - e = null; - f(tcs, ct); - } - }); - }); - } - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(a); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Scan(this IAsyncEnumerable source, TAccumulate seed, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var acc = seed; - var current = default(TAccumulate); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (!res) - { - tcs.TrySetResult(false); - return; - } - - var item = e.Current; - try - { - acc = accumulator(acc, item); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - current = acc; - tcs.TrySetResult(true); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable Scan(this IAsyncEnumerable source, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var hasSeed = false; - var acc = default(TSource); - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (!res) - { - tcs.TrySetResult(false); - return; - } - - var item = e.Current; - - if (!hasSeed) - { - hasSeed = true; - acc = item; - f(tcs, ct); - return; - } - - try - { - acc = accumulator(acc, item); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - current = acc; - tcs.TrySetResult(true); - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable TakeLast(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var q = new Queue(count); - var done = false; - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - if (!done) - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var item = e.Current; - - if (q.Count >= count) - q.Dequeue(); - q.Enqueue(item); - } - else - { - done = true; - e.Dispose(); - } - - f(tcs, ct); - }); - }); - } - else - { - if (q.Count > 0) - { - current = q.Dequeue(); - tcs.TrySetResult(true); - } - else - { - tcs.TrySetResult(false); - } - } - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - public static IAsyncEnumerable SkipLast(this IAsyncEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Create(() => - { - var e = source.GetEnumerator(); - - var cts = new CancellationTokenDisposable(); - var d = new CompositeDisposable(cts, e); - - var q = new Queue(); - var current = default(TSource); - - var f = default(Action, CancellationToken>); - f = (tcs, ct) => - { - e.MoveNext(ct).ContinueWith(t => - { - t.Handle(tcs, res => - { - if (res) - { - var item = e.Current; - - q.Enqueue(item); - if (q.Count > count) - { - current = q.Dequeue(); - tcs.TrySetResult(true); - } - else - { - f(tcs, ct); - } - } - else - { - tcs.TrySetResult(false); - } - }); - }); - }; - - return Create( - (ct, tcs) => - { - f(tcs, cts.Token); - return tcs.Task.UsingEnumerator(e); - }, - () => current, - d.Dispose - ); - }); - } - - #endregion - } -} diff --git a/Ix/System.Interactive.Async/AsyncEnumerator.cs b/Ix/System.Interactive.Async/AsyncEnumerator.cs deleted file mode 100644 index 003141f..0000000 --- a/Ix/System.Interactive.Async/AsyncEnumerator.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Linq; -using System.Threading.Tasks; -using System.Threading; - -namespace System.Collections.Generic -{ - public static class AsyncEnumerator - { - /// - /// Advances the enumerator to the next element in the sequence, returning the result asynchronously. - /// - /// - /// Task containing the result of the operation: true if the enumerator was successfully advanced - /// to the next element; false if the enumerator has passed the end of the sequence. - /// - public static Task MoveNext(this IAsyncEnumerator enumerator) - { - if (enumerator == null) - throw new ArgumentNullException("enumerator"); - - return enumerator.MoveNext(CancellationToken.None); - } - } -} diff --git a/Ix/System.Interactive.Async/Disposables.cs b/Ix/System.Interactive.Async/Disposables.cs deleted file mode 100644 index 05d5554..0000000 --- a/Ix/System.Interactive.Async/Disposables.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Threading; - -namespace System.Linq -{ - class CancellationTokenDisposable : IDisposable - { - private CancellationTokenSource cts = new CancellationTokenSource(); - - public CancellationToken Token { get { return cts.Token; } } - - public void Dispose() - { - if (!cts.IsCancellationRequested) - cts.Cancel(); - } - } - - class CompositeDisposable : IDisposable - { - private readonly IDisposable[] _dispose; - - public CompositeDisposable(params IDisposable[] dispose) - { - _dispose = dispose; - } - - public void Dispose() - { - foreach (var d in _dispose) - d.Dispose(); - } - } - - class AssignableDisposable : IDisposable - { - private object _gate = new object(); - private IDisposable _disposable; - private bool _disposed; - - public IDisposable Disposable - { - set - { - lock (_gate) - { - if (_disposable != null) - _disposable.Dispose(); - - _disposable = value; - - if (_disposed) - _disposable.Dispose(); - } - } - } - - public void Dispose() - { - lock (_gate) - { - if (!_disposed) - { - _disposed = true; - - if (_disposable != null) - _disposable.Dispose(); - } - } - } - } - - class Disposable : IDisposable - { - private readonly Action _dispose; - - public Disposable(Action dispose) - { - _dispose = dispose; - } - - public void Dispose() - { - _dispose(); - } - } -} diff --git a/Ix/System.Interactive.Async/EnumerableGrouping.cs b/Ix/System.Interactive.Async/EnumerableGrouping.cs deleted file mode 100644 index 69469c8..0000000 --- a/Ix/System.Interactive.Async/EnumerableGrouping.cs +++ /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. -using System; -using System.Collections.Generic; -using System.Linq; - -namespace System.Linq -{ - class EnumerableGrouping : IGrouping - { - List elements = new List(); - - public EnumerableGrouping(TKey key) - { - Key = key; - } - - public void Add(TElement element) - { - elements.Add(element); - } - - public TKey Key { get; private set; } - - public IEnumerator GetEnumerator() - { - return elements.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - } -} diff --git a/Ix/System.Interactive.Async/IAsyncEnumerable.cs b/Ix/System.Interactive.Async/IAsyncEnumerable.cs deleted file mode 100644 index 8d892e1..0000000 --- a/Ix/System.Interactive.Async/IAsyncEnumerable.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; - -namespace System.Collections.Generic -{ - /// - /// Asynchronous version of the IEnumerable<T> interface, allowing elements of the - /// enumerable sequence to be retrieved asynchronously. - /// - /// Element type. - public interface IAsyncEnumerable< -#if DESKTOPCLR40 || SILVERLIGHT4 - out -#endif - T> - { - /// - /// Gets an asynchronous enumerator over the sequence. - /// - /// Enumerator for asynchronous enumeration over the sequence. - IAsyncEnumerator GetEnumerator(); - } -} diff --git a/Ix/System.Interactive.Async/IAsyncEnumerator.cs b/Ix/System.Interactive.Async/IAsyncEnumerator.cs deleted file mode 100644 index 72cfdbc..0000000 --- a/Ix/System.Interactive.Async/IAsyncEnumerator.cs +++ /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. -using System; -using System.Threading.Tasks; -using System.Threading; - -namespace System.Collections.Generic -{ - /// - /// Asynchronous version of the IEnumerator<T> interface, allowing elements to be - /// retrieved asynchronously. - /// - /// Element type. - public interface IAsyncEnumerator< -#if DESKTOPCLR40 || SILVERLIGHT4 - out -#endif - T> : IDisposable - { - /// - /// Advances the enumerator to the next element in the sequence, returning the result asynchronously. - /// - /// Cancellation token that can be used to cancel the operation. - /// - /// Task containing the result of the operation: true if the enumerator was successfully advanced - /// to the next element; false if the enumerator has passed the end of the sequence. - /// - Task MoveNext(CancellationToken cancellationToken); - - /// - /// Gets the current element in the iteration. - /// - T Current { get; } - } -} diff --git a/Ix/System.Interactive.Async/IAsyncGrouping.cs b/Ix/System.Interactive.Async/IAsyncGrouping.cs deleted file mode 100644 index 61abc60..0000000 --- a/Ix/System.Interactive.Async/IAsyncGrouping.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; - -namespace System.Linq -{ - public interface IAsyncGrouping< -#if DESKTOPCLR4 || SILVERLIGHT4 - out -#endif - TKey, -#if DESKTOPCLR4 || SILVERLIGHT4 - out -#endif - TElement> : IAsyncEnumerable - { - TKey Key { get; } - } -} diff --git a/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs b/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs deleted file mode 100644 index a1e430d..0000000 --- a/Ix/System.Interactive.Async/IOrderedAsyncEnumerable.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; - -namespace System.Linq -{ - public interface IOrderedAsyncEnumerable< -#if DESKTOPCLR4 || SILVERLIGHT4 - out -#endif - TElement> : IAsyncEnumerable - { - IOrderedAsyncEnumerable CreateOrderedEnumerable(Func keySelector, IComparer comparer, bool descending); - } -} diff --git a/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs b/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs deleted file mode 100644 index b887de0..0000000 --- a/Ix/System.Interactive.Async/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; -using System.Security; - -[assembly: AssemblyTitle("System.Interactive.Async")] -// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet -[assembly: AssemblyDescription("Interactive Extensions Async Library used to express queries over asynchronous enumerable sequences.")] -#if DEBUG -[assembly: AssemblyConfiguration("Debug")] -#else -[assembly: AssemblyConfiguration("Retail")] -#endif -[assembly: AssemblyCompany("Microsoft Corporation")] -#if STABLE -[assembly: AssemblyProduct("Interactive Extensions")] -#else -[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] -#endif -[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] -[assembly: NeutralResourcesLanguage("en-US")] - -#if !PLIB -[assembly: ComVisible(false)] -#endif - -[assembly: CLSCompliant(true)] - -#if DESKTOPCLR && NO_CODECOVERAGE -[assembly: AllowPartiallyTrustedCallers] -#endif - -// -// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows -// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. -// diff --git a/Ix/System.Interactive.Async/System.Interactive.Async.csproj b/Ix/System.Interactive.Async/System.Interactive.Async.csproj deleted file mode 100644 index b8143b2..0000000 --- a/Ix/System.Interactive.Async/System.Interactive.Async.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {7269A578-326A-4C3E-9874-A2D2600095BC} - Library - Properties - System.Interactive.Async - System.Interactive.Async - v4.0 - 512 - - - - $(OutputPath)\$(AssemblyName).XML - - - Profile1 - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ix/System.Interactive.Async/TaskExt.cs b/Ix/System.Interactive.Async/TaskExt.cs deleted file mode 100644 index 5f714ad..0000000 --- a/Ix/System.Interactive.Async/TaskExt.cs +++ /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. -using System; -using System.Collections.Generic; -using System.Linq; - -namespace System.Threading.Tasks -{ - static class TaskExt - { - public static Task Return(T value, CancellationToken cancellationToken) - { - var tcs = new TaskCompletionSource(); - tcs.TrySetResult(value); - return tcs.Task; - } - - public static Task Throw(Exception exception, CancellationToken cancellationToken) - { - var tcs = new TaskCompletionSource(); - tcs.TrySetException(exception); - return tcs.Task; - } - - public static void Handle(this Task task, TaskCompletionSource tcs, Action success) - { - Handle(task, tcs, success, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); - } - - public static void Handle(this Task task, TaskCompletionSource tcs, Action success, Action error) - { - Handle(task, tcs, success, error, () => tcs.TrySetCanceled()); - } - - public static void Handle(this Task task, TaskCompletionSource tcs, Action success, Action error, Action canceled) - { - if (task.IsFaulted) - error(task.Exception); - else if (task.IsCanceled) - canceled(); - else if (task.IsCompleted) - success(task.Result); - } - - public static Task UsingEnumerator(this Task task, IDisposable disposable) - { - task.ContinueWith(t => - { - if (t.IsFaulted) - { - var ignored = t.Exception; // don't remove! - } - - if (t.IsFaulted || t.IsCanceled || !t.Result) - disposable.Dispose(); - }, TaskContinuationOptions.ExecuteSynchronously); - - return task; - } - - public static Task UsingEnumeratorSync(this Task task, IDisposable disposable) - { - var tcs = new TaskCompletionSource(); - - task.ContinueWith(t => - { - if (t.IsFaulted || t.IsCanceled || !t.Result) - disposable.Dispose(); // TODO: Check whether we need exception handling here! - - t.Handle(tcs, res => tcs.TrySetResult(res)); - }, TaskContinuationOptions.ExecuteSynchronously); - - return tcs.Task; - } - - public static Task Finally(this Task task, Action action) - { - task.ContinueWith(t => - { - if (t.IsFaulted) - { - var ignored = t.Exception; // don't remove! - } - - action(); - }, TaskContinuationOptions.ExecuteSynchronously); - - return task; - } - - public static Task Zip(this Task t1, Task t2, Func f) - { - var gate = new object(); - var tcs = new TaskCompletionSource(); - - var i = 2; - var complete = new Action(t => - { - if (Interlocked.Decrement(ref i) == 0) - { - var exs = new List(); - if (t1.IsFaulted) - exs.Add(t1.Exception); - if (t2.IsFaulted) - exs.Add(t2.Exception); - - if (exs.Count > 0) - tcs.TrySetException(exs); - else if (t1.IsCanceled || t2.IsCanceled) - tcs.TrySetCanceled(); - else - { - var res = default(V); - try - { - res = f(t1.Result, t2.Result); - } - catch (Exception ex) - { - tcs.TrySetException(ex); - return; - } - - tcs.TrySetResult(res); - } - } - }); - - t1.ContinueWith(complete); - t2.ContinueWith(complete); - - return tcs.Task; - } - } -} diff --git a/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs b/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs deleted file mode 100644 index 03b49a8..0000000 --- a/Ix/System.Interactive.Providers/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; -using System.Security; - -[assembly: AssemblyTitle("System.Interactive.Providers")] -// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet -[assembly: AssemblyDescription("Interactive Extensions Providers Library used to build query providers and express queries over enumerable sequences.")] -#if DEBUG -[assembly: AssemblyConfiguration("Debug")] -#else -[assembly: AssemblyConfiguration("Retail")] -#endif -[assembly: AssemblyCompany("Microsoft Corporation")] -#if STABLE -[assembly: AssemblyProduct("Interactive Extensions")] -#else -[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] -#endif -[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] -[assembly: NeutralResourcesLanguage("en-US")] - -#if !PLIB -[assembly: ComVisible(false)] -#endif - -[assembly: CLSCompliant(true)] - -#if DESKTOPCLR && NO_CODECOVERAGE -[assembly: AllowPartiallyTrustedCallers] -#endif - -// -// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows -// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. -// diff --git a/Ix/System.Interactive.Providers/QueryableEx.cs b/Ix/System.Interactive.Providers/QueryableEx.cs deleted file mode 100644 index 20f7ec8..0000000 --- a/Ix/System.Interactive.Providers/QueryableEx.cs +++ /dev/null @@ -1,2327 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.ComponentModel; -using System.Globalization; -using System.Linq.Expressions; -using System.Reflection; - -namespace System.Linq -{ - /// - /// Provides a set of additional static methods that allow querying enumerable sequences. - /// - public static class QueryableEx - { - /// - /// Determines whether an enumerable sequence is empty. - /// - /// Source sequence element type. - /// Source sequence. - /// true if the sequence is empty; false otherwise. - public static bool IsEmpty(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.Execute( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static bool IsEmpty(IEnumerable source) - { - return EnumerableEx.IsEmpty(source); - } -#pragma warning restore 1591 - - /// - /// Returns the minimum value in the enumerable sequence by using the specified comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to determine the minimum value. - /// Minimum value in the sequence. - public static TSource Min(this IQueryable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.Execute( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(comparer, typeof(IComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static TSource Min(IEnumerable source, IComparer comparer) - { - return EnumerableEx.Min(source, comparer); - } -#pragma warning restore 1591 - - /// - /// Returns the elements with the minimum key value by using the default comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// List with the elements that share the same minimum key value. - public static IList MinBy(this IQueryable source, Expression> keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Provider.Execute>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IList MinBy(IEnumerable source, Func keySelector) - { - return EnumerableEx.MinBy(source, keySelector); - } -#pragma warning restore 1591 - - /// - /// Returns the elements with the minimum key value by using the specified comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// Comparer used to determine the minimum key value. - /// List with the elements that share the same minimum key value. - public static IList MinBy(this IQueryable source, Expression> keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.Execute>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector, - Expression.Constant(comparer, typeof(IComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IList MinBy(IEnumerable source, Func keySelector, IComparer comparer) - { - return EnumerableEx.MinBy(source, keySelector, comparer); - } -#pragma warning restore 1591 - - /// - /// Returns the maximum value in the enumerable sequence by using the specified comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to determine the maximum value. - /// Maximum value in the sequence. - public static TSource Max(this IQueryable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.Execute( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(comparer, typeof(IComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static TSource Max(IEnumerable source, IComparer comparer) - { - return EnumerableEx.Max(source, comparer); - } -#pragma warning restore 1591 - - /// - /// Returns the elements with the maximum key value by using the default comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// List with the elements that share the same maximum key value. - public static IList MaxBy(this IQueryable source, Expression> keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Provider.Execute>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IList MaxBy(IEnumerable source, Func keySelector) - { - return EnumerableEx.MaxBy(source, keySelector); - } -#pragma warning restore 1591 - - /// - /// Returns the elements with the minimum key value by using the specified comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// Comparer used to determine the maximum key value. - /// List with the elements that share the same maximum key value. - public static IList MaxBy(this IQueryable source, Expression> keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.Execute>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector, - Expression.Constant(comparer, typeof(IComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IList MaxBy(IEnumerable source, Func keySelector, IComparer comparer) - { - return EnumerableEx.MaxBy(source, keySelector, comparer); - } -#pragma warning restore 1591 - - /// - /// Shares the source sequence within a selector function where each enumerator can fetch the next element from the source sequence. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with shared access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the shared view over the source sequence. - public static IQueryable Share(this IQueryable source, Expression, IEnumerable>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), - source.Expression, - selector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Share(IEnumerable source, Func, IEnumerable> selector) - { - return EnumerableEx.Share(source, selector); - } -#pragma warning restore 1591 - - /// - /// Publishes the source sequence within a selector function where each enumerator can obtain a view over a tail of the source sequence. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with published access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the published view over the source sequence. - public static IQueryable Publish(this IQueryable source, Expression, IEnumerable>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), - source.Expression, - selector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Publish(IEnumerable source, Func, IEnumerable> selector) - { - return EnumerableEx.Publish(source, selector); - } -#pragma warning restore 1591 - - /// - /// Memoizes the source sequence within a selector function where each enumerator can get access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with memoized access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the memoized view over the source sequence. - public static IQueryable Memoize(this IQueryable source, Expression, IEnumerable>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), - source.Expression, - selector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Memoize(IEnumerable source, Func, IEnumerable> selector) - { - return EnumerableEx.Memoize(source, selector); - } -#pragma warning restore 1591 - - /// - /// Memoizes the source sequence within a selector function where a specified number of enumerators can get access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. - /// Selector function with memoized access to the source sequence for a specified number of enumerators. - /// Sequence resulting from applying the selector function to the memoized view over the source sequence. - public static IQueryable Memoize(this IQueryable source, int readerCount, Expression, IEnumerable>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), - source.Expression, - Expression.Constant(readerCount, typeof(int)), - selector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Memoize(IEnumerable source, int readerCount, Func, IEnumerable> selector) - { - return EnumerableEx.Memoize(source, readerCount, selector); - } -#pragma warning restore 1591 - - /// - /// Creates an enumerable sequence based on an enumerator factory function. - /// - /// Result sequence element type. - /// Query provider. - /// Enumerator factory function. - /// Sequence that will invoke the enumerator factory upon a call to GetEnumerator. - public static IQueryable Create(this IQueryProvider provider, Expression>> getEnumerator) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (getEnumerator == null) - throw new ArgumentNullException("getEnumerator"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - getEnumerator - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Create(Func> getEnumerator) - { - return EnumerableEx.Create(getEnumerator); - } -#pragma warning restore 1591 - - /// - /// Returns a sequence with a single element. - /// - /// Result sequence element type. - /// Query provider. - /// Single element of the resulting sequence. - /// Sequence with a single element. - public static IQueryable Return(this IQueryProvider provider, TResult value) - { - if (provider == null) - throw new ArgumentNullException("provider"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(value, typeof(TResult)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Return(TResult value) - { - return EnumerableEx.Return(value).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Returns a sequence that throws an exception upon enumeration. - /// - /// Result sequence element type. - /// Query provider. - /// Exception to throw upon enumerating the resulting sequence. - /// Sequence that throws the specified exception upon enumeration. - public static IQueryable Throw(this IQueryProvider provider, Exception exception) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (exception == null) - throw new ArgumentNullException("exception"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(exception, typeof(Exception)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Throw(Exception exception) - { - return EnumerableEx.Throw(exception).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Creates an enumerable sequence based on an enumerable factory function. - /// - /// Result sequence element type. - /// Query provider. - /// Enumerable factory function. - /// Sequence that will invoke the enumerable factory upon a call to GetEnumerator. - public static IQueryable Defer(this IQueryProvider provider, Expression>> enumerableFactory) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (enumerableFactory == null) - throw new ArgumentNullException("enumerableFactory"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - enumerableFactory - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Defer(Func> enumerableFactory) - { - return EnumerableEx.Defer(enumerableFactory).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence by mimicking a for loop. - /// - /// State type. - /// Result sequence element type. - /// Query provider. - /// Initial state of the generator loop. - /// Loop condition. - /// State update function to run after every iteration of the generator loop. - /// Result selector to compute resulting sequence elements. - /// Sequence obtained by running the generator loop, yielding computed elements. - public static IQueryable Generate(this IQueryProvider provider, TState initialState, Expression> condition, Expression> iterate, Expression> resultSelector) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (condition == null) - throw new ArgumentNullException("condition"); - if (iterate == null) - throw new ArgumentNullException("iterate"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TState), typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(initialState), - condition, - iterate, - resultSelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) - { - return EnumerableEx.Generate(initialState, condition, iterate, resultSelector).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence that's dependent on a resource object whose lifetime is determined by the sequence usage duration. - /// - /// Source element type. - /// Resource type. - /// Query provider. - /// Resource factory function. - /// Enumerable factory function, having access to the obtained resource. - /// Sequence whose use controls the lifetime of the associated obtained resource. - public static IQueryable Using(this IQueryProvider provider, Expression> resourceFactory, Expression>> enumerableFactory) where TResource : IDisposable - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (resourceFactory == null) - throw new ArgumentNullException("resourceFactory"); - if (enumerableFactory == null) - throw new ArgumentNullException("enumerableFactory"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResource)), - Expression.Constant(provider, typeof(IQueryProvider)), - resourceFactory, - enumerableFactory - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable - { - return EnumerableEx.Using(resourceFactory, enumerableFactory).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence by repeating the given value infinitely. - /// - /// Result sequence element type. - /// Query provider. - /// Value to repreat in the resulting sequence. - /// Sequence repeating the given value infinitely. - public static IEnumerable Repeat(this IQueryProvider provider, TResult value) - { - if (provider == null) - throw new ArgumentNullException("provider"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(value, typeof(TResult)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Repeat(TResult value) - { - return EnumerableEx.Repeat(value).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that corresponds to the source sequence, concatenating it with the sequence resulting from calling an exception handler function in case of an error. - /// - /// Source sequence element type. - /// Exception type to catch. - /// Source sequence. - /// Handler to invoke when an exception of the specified type occurs. - /// Source sequence, concatenated with an exception handler result sequence in case of an error. - public static IQueryable Catch(this IQueryable source, Expression>> handler) - where TException : Exception - { - if (source == null) - throw new ArgumentNullException("source"); - if (handler == null) - throw new ArgumentNullException("handler"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), - source.Expression, - handler - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Catch(IEnumerable source, Func> handler) - where TException : Exception - { - return EnumerableEx.Catch(source, handler); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence that continues to concatenate source sequences while errors occur. - public static IQueryable Catch(this IQueryable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - sources.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Catch(IEnumerable> sources) - { - return EnumerableEx.Catch(sources); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. - /// - /// Source sequence element type. - /// Query provider. - /// Source sequences. - /// Sequence that continues to concatenate source sequences while errors occur. - public static IQueryable Catch(this IQueryProvider provider, params IEnumerable[] sources) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (sources == null) - throw new ArgumentNullException("sources"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - Expression.Constant(provider, typeof(IQueryProvider)), - GetSourceExpression(sources) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Catch(params IEnumerable[] sources) - { - return EnumerableEx.Catch(sources).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error. - /// - /// Source sequence element type. - /// First sequence. - /// Second sequence, concatenated to the result in case the first sequence completes exceptionally. - /// The first sequence, followed by the second sequence in case an error is produced. - public static IQueryable Catch(this IQueryable first, IEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - first.Expression, - GetSourceExpression(second) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Catch(IEnumerable first, IEnumerable second) - { - return EnumerableEx.Catch(first, second); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence whose termination or disposal of an enumerator causes a finally action to be executed. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to run upon termination of the sequence, or when an enumerator is disposed. - /// Source sequence with guarantees on the invocation of the finally action. - public static IQueryable Finally(this IQueryable source, Expression finallyAction) - { - if (source == null) - throw new ArgumentNullException("source"); - if (finallyAction == null) - throw new ArgumentNullException("finallyAction"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - finallyAction - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Finally(IEnumerable source, Action finallyAction) - { - return EnumerableEx.Finally(source, finallyAction); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that concatenates both given sequences, regardless of whether an error occurs. - /// - /// Source sequence element type. - /// First sequence. - /// Second sequence. - /// Sequence concatenating the elements of both sequences, ignoring errors. - public static IQueryable OnErrorResumeNext(this IQueryable first, IEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return first.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - first.Expression, - GetSourceExpression(second) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable OnErrorResumeNext(IEnumerable first, IEnumerable second) - { - return EnumerableEx.OnErrorResumeNext(first, second); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. - /// - /// Source sequence element type. - /// Query provider. - /// Source sequences. - /// Sequence concatenating the elements of the given sequences, ignoring errors. - public static IEnumerable OnErrorResumeNext(this IQueryProvider provider, params IEnumerable[] sources) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (sources == null) - throw new ArgumentNullException("sources"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - Expression.Constant(provider, typeof(IQueryProvider)), - GetSourceExpression(sources) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable OnErrorResumeNext(params IEnumerable[] sources) - { - return EnumerableEx.OnErrorResumeNext(sources).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence concatenating the elements of the given sequences, ignoring errors. - public static IQueryable OnErrorResumeNext(this IQueryable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - sources.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable OnErrorResumeNext(IEnumerable> sources) - { - return EnumerableEx.OnErrorResumeNext(sources); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that retries enumerating the source sequence as long as an error occurs. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence concatenating the results of the source sequence as long as an error occurs. - public static IQueryable Retry(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Retry(IEnumerable source) - { - return EnumerableEx.Retry(source); - } -#pragma warning restore 1591 - - /// - /// Creates a sequence that retries enumerating the source sequence as long as an error occurs, with the specified maximum number of retries. - /// - /// Source sequence element type. - /// Source sequence. - /// Maximum number of retries. - /// Sequence concatenating the results of the source sequence as long as an error occurs. - public static IQueryable Retry(this IQueryable source, int retryCount) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(retryCount, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Retry(IEnumerable source, int retryCount) - { - return EnumerableEx.Retry(source, retryCount); - } -#pragma warning restore 1591 - - /// - /// Generates an enumerable sequence by repeating a source sequence as long as the given loop condition holds. - /// - /// Result sequence element type. - /// Query provider. - /// Loop condition. - /// Sequence to repeat while the condition evaluates true. - /// Sequence generated by repeating the given sequence while the condition evaluates to true. - public static IQueryable While(this IQueryProvider provider, Expression> condition, IEnumerable source) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (condition == null) - throw new ArgumentNullException("condition"); - if (source == null) - throw new ArgumentNullException("source"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - condition, - GetSourceExpression(source) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable While(Func condition, IEnumerable source) - { - return EnumerableEx.While(condition, source).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Returns an enumerable sequence based on the evaluation result of the given condition. - /// - /// Result sequence element type. - /// Query provider. - /// Condition to evaluate. - /// Sequence to return in case the condition evaluates true. - /// Sequence to return in case the condition evaluates false. - /// Either of the two input sequences based on the result of evaluating the condition. - public static IQueryable If(this IQueryProvider provider, Expression> condition, IEnumerable thenSource, IEnumerable elseSource) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (condition == null) - throw new ArgumentNullException("condition"); - if (thenSource == null) - throw new ArgumentNullException("thenSource"); - if (elseSource == null) - throw new ArgumentNullException("elseSource"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - condition, - GetSourceExpression(thenSource), - GetSourceExpression(elseSource) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable If(Func condition, IEnumerable thenSource, IEnumerable elseSource) - { - return EnumerableEx.If(condition, thenSource, elseSource).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Returns an enumerable sequence if the evaluation result of the given condition is true, otherwise returns an empty sequence. - /// - /// Result sequence element type. - /// Query provider. - /// Condition to evaluate. - /// Sequence to return in case the condition evaluates true. - /// The given input sequence if the condition evaluates true; otherwise, an empty sequence. - public static IQueryable If(this IQueryProvider provider, Expression> condition, IEnumerable thenSource) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (condition == null) - throw new ArgumentNullException("condition"); - if (thenSource == null) - throw new ArgumentNullException("thenSource"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - condition, - GetSourceExpression(thenSource) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable If(Func condition, IEnumerable thenSource) - { - return EnumerableEx.If(condition, thenSource).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates an enumerable sequence by repeating a source sequence as long as the given loop postcondition holds. - /// - /// Result sequence element type. - /// Source sequence to repeat while the condition evaluates true. - /// Loop condition. - /// Sequence generated by repeating the given sequence until the condition evaluates to false. - public static IQueryable DoWhile(this IQueryable source, Expression> condition) - { - if (source == null) - throw new ArgumentNullException("source"); - if (condition == null) - throw new ArgumentNullException("condition"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - source.Expression, - condition - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable DoWhile(IEnumerable source, Func condition) - { - return EnumerableEx.DoWhile(source, condition); - } -#pragma warning restore 1591 - - /// - /// Returns a sequence from a dictionary based on the result of evaluating a selector function. - /// - /// Type of the selector value. - /// Result sequence element type. - /// Query provider. - /// Selector function used to pick a sequence from the given sources. - /// Dictionary mapping selector values onto resulting sequences. - /// The source sequence corresponding with the evaluated selector value; otherwise, an empty sequence. - public static IQueryable Case(this IQueryProvider provider, Expression> selector, IDictionary> sources) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (selector == null) - throw new ArgumentNullException("selector"); - if (sources == null) - throw new ArgumentNullException("sources"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)), - selector, - Expression.Constant(sources, typeof(IDictionary>)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Case(Func selector, IDictionary> sources) - { - return EnumerableEx.Case(selector, sources).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Returns a sequence from a dictionary based on the result of evaluating a selector function, also specifying a default sequence. - /// - /// Type of the selector value. - /// Result sequence element type. - /// Query provider. - /// Selector function used to pick a sequence from the given sources. - /// Dictionary mapping selector values onto resulting sequences. - /// Default sequence to return in case there's no corresponding source for the computed selector value. - /// The source sequence corresponding with the evaluated selector value; otherwise, the default source. - public static IQueryable Case(this IQueryProvider provider, Expression> selector, IDictionary> sources, IEnumerable defaultSource) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (selector == null) - throw new ArgumentNullException("selector"); - if (sources == null) - throw new ArgumentNullException("sources"); - if (defaultSource == null) - throw new ArgumentNullException("defaultSource"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TValue), typeof(TResult)), - selector, - Expression.Constant(sources, typeof(IDictionary>)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Case(Func selector, IDictionary> sources, IEnumerable defaultSource) - { - return EnumerableEx.Case(selector, sources, defaultSource).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence by enumerating a source sequence, mapping its elements on result sequences, and concatenating those sequences. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Query provider. - /// Source sequence. - /// Result selector to evaluate for each iteration over the source. - /// Sequence concatenating the inner sequences that result from evaluating the result selector on elements from the source. - public static IQueryable For(this IQueryProvider provider, IEnumerable source, Expression>> resultSelector) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (source == null) - throw new ArgumentNullException("source"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), - GetSourceExpression(source), - resultSelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable For(IEnumerable source, Func> resultSelector) - { - return EnumerableEx.For(source, resultSelector).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Concatenates the input sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence with the elements of the source sequences concatenated. - public static IQueryable Concat(this IQueryable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - GetSourceExpression(sources) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Concat(IEnumerable> sources) - { - return EnumerableEx.Concat(sources); - } -#pragma warning restore 1591 - - /// - /// Concatenates the input sequences. - /// - /// Source sequence element type. - /// Query provider. - /// Source sequences. - /// Sequence with the elements of the source sequences concatenated. - public static IQueryable Concat(this IQueryProvider provider, params IEnumerable[] sources) - { - if (provider == null) - throw new ArgumentNullException("provider"); - if (sources == null) - throw new ArgumentNullException("sources"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - Expression.Constant(provider, typeof(IQueryProvider)), - GetSourceExpression(sources) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Concat(params IEnumerable[] sources) - { - return EnumerableEx.Concat(sources).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Projects each element of a sequence to an given sequence and flattens the resulting sequences into one sequence. - /// - /// First source sequence element type. - /// Second source sequence element type. - /// A sequence of values to project. - /// Inner sequence each source sequenec element is projected onto. - /// Sequence flattening the sequences that result from projecting elements in the source sequence. - public static IQueryable SelectMany(this IQueryable source, IEnumerable other) - { - if (source == null) - throw new ArgumentNullException("source"); - if (other == null) - throw new ArgumentNullException("other"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), - source.Expression, - GetSourceExpression(other) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable SelectMany(IEnumerable source, IEnumerable other) - { - return EnumerableEx.SelectMany(source, other); - } -#pragma warning restore 1591 - -#if NO_ZIP - /// - /// Merges two sequences by applying the specified selector function on index-based corresponding element pairs from both sequences. - /// - /// The type of the elements of the first input sequence. - /// The type of the elements of the second input sequence. - /// The type of the elements of the result sequence. - /// The first sequence to merge. - /// The second sequence to merge. - /// Function to apply to each pair of elements from both sequences. - /// Sequence consisting of the result of pairwise application of the selector function over pairs of elements from the source sequences. - public static IQueryable Zip(this IQueryable first, IEnumerable second, Expression> resultSelector) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return first.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), - first.Expression, - GetSourceExpression(second), - resultSelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Zip(IEnumerable first, IEnumerable second, Func resultSelector) - { - return EnumerableEx.Zip(first, second, resultSelector); - } -#pragma warning restore 1591 -#endif - - /// - /// Hides the enumerable sequence object identity. - /// - /// Source sequence element type. - /// Source sequence. - /// Enumerable sequence with the same behavior as the original, but hiding the source object identity. - /// AsQueryable doesn't hide the object identity, and simply acts as a cast to the IQueryable<TSource> interface. - public static IQueryable Hide(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Hide(IEnumerable source) - { - return EnumerableEx.Hide(source); - } -#pragma warning restore 1591 - - /// - /// Lazily invokes an action for each value in the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IQueryable Do(this IQueryable source, Expression> onNext) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - onNext - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Do(IEnumerable source, Action onNext) - { - return EnumerableEx.Do(source, onNext); - } -#pragma warning restore 1591 - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action for successful termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on successful termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IQueryable Do(this IQueryable source, Expression> onNext, Expression onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - onNext, - onCompleted - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Do(IEnumerable source, Action onNext, Action onCompleted) - { - return EnumerableEx.Do(source, onNext, onCompleted); - } -#pragma warning restore 1591 - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action upon exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on exceptional termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IQueryable Do(this IQueryable source, Expression> onNext, Expression> onError) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - onNext, - onError - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Do(IEnumerable source, Action onNext, Action onError) - { - return EnumerableEx.Do(source, onNext, onError); - } -#pragma warning restore 1591 - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action upon successful or exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on exceptional termination of the sequence. - /// Action to invoke on successful termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IQueryable Do(this IQueryable source, Expression> onNext, Expression> onError, Expression onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - onNext, - onError, - onCompleted - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Do(IEnumerable source, Action onNext, Action onError, Action onCompleted) - { - return EnumerableEx.Do(source, onNext, onError, onCompleted); - } -#pragma warning restore 1591 - -#if !NO_RXINTERFACES - /// - /// Lazily invokes observer methods for each value in the sequence, and upon successful or exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Observer to invoke notification calls on. - /// Sequence exhibiting the side-effects of observer method invocation upon enumeration. - public static IQueryable Do(this IQueryable source, IObserver observer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (observer == null) - throw new ArgumentNullException("observer"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(observer, typeof(IObserver)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Do(IEnumerable source, IObserver observer) - { - return EnumerableEx.Do(source, observer); - } -#pragma warning restore 1591 -#endif - - /// - /// Generates a sequence of non-overlapping adjacent buffers over the source sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of elements for allocated buffers. - /// Sequence of buffers containing source sequence elements. - public static IQueryable> Buffer(this IQueryable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable> Buffer(IEnumerable source, int count) - { - return EnumerableEx.Buffer(source, count); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence of buffers over the source sequence, with specified length and possible overlap. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of elements for allocated buffers. - /// Number of elements to skip between the start of consecutive buffers. - /// Sequence of buffers containing source sequence elements. - public static IQueryable> Buffer(this IQueryable source, int count, int skip) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery>( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(count, typeof(int)), - Expression.Constant(skip, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable> Buffer(IEnumerable source, int count, int skip) - { - return EnumerableEx.Buffer(source, count, skip); - } -#pragma warning restore 1591 - - /// - /// Ignores all elements in the source sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Source sequence without its elements. - public static IQueryable IgnoreElements(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable IgnoreElements(IEnumerable source) - { - return EnumerableEx.IgnoreElements(source); - } -#pragma warning restore 1591 - - /// - /// Returns elements with a distinct key value by using the default equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Sequence that contains the elements from the source sequence with distinct key values. - public static IQueryable Distinct(this IQueryable source, Expression> keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Distinct(IEnumerable source, Func keySelector) - { - return EnumerableEx.Distinct(source, keySelector); - } -#pragma warning restore 1591 - - /// - /// Returns elements with a distinct key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Comparer used to compare key values. - /// Sequence that contains the elements from the source sequence with distinct key values. - public static IQueryable Distinct(this IQueryable source, Expression> keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector, - Expression.Constant(comparer, typeof(IEqualityComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Distinct(IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - return EnumerableEx.Distinct(source, keySelector, comparer); - } -#pragma warning restore 1591 - - /// - /// Returns consecutive distinct elements by using the default equality comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence without adjacent non-distinct elements. - public static IQueryable DistinctUntilChanged(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable DistinctUntilChanged(IEnumerable source) - { - return EnumerableEx.DistinctUntilChanged(source); - } -#pragma warning restore 1591 - - /// - /// Returns consecutive distinct elements by using the specified equality comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to compare values. - /// Sequence without adjacent non-distinct elements. - public static IQueryable DistinctUntilChanged(this IQueryable source, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(comparer, typeof(IEqualityComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable DistinctUntilChanged(IEnumerable source, IEqualityComparer comparer) - { - return EnumerableEx.DistinctUntilChanged(source, comparer); - } -#pragma warning restore 1591 - - /// - /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Sequence without adjacent non-distinct elements. - public static IQueryable DistinctUntilChanged(this IQueryable source, Expression> keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable DistinctUntilChanged(IEnumerable source, Func keySelector) - { - return EnumerableEx.DistinctUntilChanged(source, keySelector); - } -#pragma warning restore 1591 - - /// - /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Comparer used to compare key values. - /// Sequence without adjacent non-distinct elements. - public static IQueryable DistinctUntilChanged(this IQueryable source, Expression> keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), - source.Expression, - keySelector, - Expression.Constant(comparer, typeof(IEqualityComparer)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable DistinctUntilChanged(IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - return EnumerableEx.DistinctUntilChanged(source, keySelector, comparer); - } -#pragma warning restore 1591 - - /// - /// Expands the sequence by recursively applying a selector function. - /// - /// Source sequence element type. - /// Source sequence. - /// Selector function to retrieve the next sequence to expand. - /// Sequence with results from the recursive expansion of the source sequence. - public static IQueryable Expand(this IQueryable source, Expression>> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - selector - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Expand(IEnumerable source, Func> selector) - { - return EnumerableEx.Expand(source, selector); - } -#pragma warning restore 1591 - - /// - /// Returns the source sequence prefixed with the specified value. - /// - /// Source sequence element type. - /// Source sequence. - /// Values to prefix the sequence with. - /// Sequence starting with the specified prefix value, followed by the source sequence. - public static IQueryable StartWith(this IQueryable source, params TSource[] values) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(values, typeof(TSource[])) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable StartWith(IEnumerable source, params TSource[] values) - { - return EnumerableEx.StartWith(source, values); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. - /// - /// Source sequence element type. - /// Accumulation type. - /// Source sequence. - /// Accumulator seed value. - /// Accumulation function to apply to the current accumulation value and each element of the sequence. - /// Sequence with all intermediate accumulation values resulting from scanning the sequence. - public static IQueryable Scan(this IQueryable source, TAccumulate seed, Expression> accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), - source.Expression, - Expression.Constant(seed, typeof(TAccumulate)), - accumulator - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Scan(IEnumerable source, TAccumulate seed, Func accumulator) - { - return EnumerableEx.Scan(source, seed, accumulator); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. - /// - /// Source sequence element type. - /// Source sequence. - /// Accumulation function to apply to the current accumulation value and each element of the sequence. - /// Sequence with all intermediate accumulation values resulting from scanning the sequence. - public static IQueryable Scan(this IQueryable source, Expression> accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - accumulator - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Scan(IEnumerable source, Func accumulator) - { - return EnumerableEx.Scan(source, accumulator); - } -#pragma warning restore 1591 - - /// - /// Returns a specified number of contiguous elements from the end of the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// The number of elements to take from the end of the sequence. - /// Sequence with the specified number of elements counting from the end of the source sequence. - public static IQueryable TakeLast(this IQueryable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable TakeLast(IEnumerable source, int count) - { - return EnumerableEx.TakeLast(source, count); - } -#pragma warning restore 1591 - - /// - /// Bypasses a specified number of contiguous elements from the end of the sequence and returns the remaining elements. - /// - /// Source sequence element type. - /// Source sequence. - /// The number of elements to skip from the end of the sequence before returning the remaining elements. - /// Sequence bypassing the specified number of elements counting from the end of the source sequence. - public static IQueryable SkipLast(this IQueryable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable SkipLast(IEnumerable source, int count) - { - return EnumerableEx.SkipLast(source, count); - } -#pragma warning restore 1591 - - /// - /// Repeats and concatenates the source sequence infinitely. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence obtained by concatenating the source sequence to itself infinitely. - public static IQueryable Repeat(this IQueryable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Repeat(IEnumerable source) - { - return EnumerableEx.Repeat(source); - } -#pragma warning restore 1591 - - /// - /// Repeats and concatenates the source sequence the given number of times. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of times to repeat the source sequence. - /// Sequence obtained by concatenating the source sequence to itself the specified number of times. - public static IQueryable Repeat(this IQueryable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), - source.Expression, - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static IEnumerable Repeat(IEnumerable source, int count) - { - return EnumerableEx.Repeat(source, count); - } -#pragma warning restore 1591 - - /// - /// Returns a sequence with no elements. - /// - /// Result sequence element type. - /// Query provider. - /// Sequence with no elements. - public static IQueryable Empty(this IQueryProvider provider) - { - if (provider == null) - throw new ArgumentNullException("provider"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Empty() - { - return Enumerable.Empty().AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence of integral numbers within a specified range. - /// - /// Query provider. - /// The value of the first integer in the sequence. - /// The number of sequential integers to generate. - /// Sequence that contains a range of sequential integral numbers. - public static IQueryable Range(this IQueryProvider provider, int start, int count) - { - if (provider == null) - throw new ArgumentNullException("provider"); - - return provider.CreateQuery( - Expression.Call( - null, - (MethodInfo)MethodInfo.GetCurrentMethod(), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(start, typeof(int)), - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Range(int start, int count) - { - return Enumerable.Range(start, count).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Generates a sequence that contains one repeated value. - /// - /// Result sequence element type. - /// Query provider. - /// The value to be repeated. - /// The number of times to repeat the value in the generated sequence. - /// Sequence that contains a repeated value. - public static IQueryable Repeat(this IQueryProvider provider, TResult element, int count) - { - if (provider == null) - throw new ArgumentNullException("provider"); - - return provider.CreateQuery( - Expression.Call( - null, - ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), - Expression.Constant(provider, typeof(IQueryProvider)), - Expression.Constant(element, typeof(TResult)), - Expression.Constant(count, typeof(int)) - ) - ); - } - -#pragma warning disable 1591 - [EditorBrowsable(EditorBrowsableState.Never)] - public static /*!*/IQueryable Repeat(TResult element, int count) - { - return EnumerableEx.Repeat(element, count).AsQueryable(); - } -#pragma warning restore 1591 - - /// - /// Gets the local Queryable provider. - /// - public static IQueryProvider Provider - { - get - { - return new QueryProviderShim(); - } - } - - class QueryProviderShim : IQueryProvider - { - public IQueryable CreateQuery(Expression expression) - { - var provider = new TElement[0].AsQueryable().Provider; - var res = Redir(expression); - return provider.CreateQuery(res); - } - - public IQueryable CreateQuery(Expression expression) - { - return CreateQuery(expression); - } - - public TResult Execute(Expression expression) - { - var provider = new TResult[0].AsQueryable().Provider; - var res = Redir(expression); - return provider.Execute(res); - } - - public object Execute(Expression expression) - { - return Execute(expression); - } - - private static Expression Redir(Expression expression) - { - var mce = expression as MethodCallExpression; - if (mce != null && mce.Method.DeclaringType == typeof(QueryableEx)) - { - if (mce.Arguments.Count >= 1 && typeof(IQueryProvider).IsAssignableFrom(mce.Arguments[0].Type)) - { - var ce = mce.Arguments[0] as ConstantExpression; - if (ce != null) - { - if (ce.Value is QueryProviderShim) - { - var targetType = typeof(QueryableEx); - var method = mce.Method; - var methods = GetMethods(targetType); - var arguments = mce.Arguments.Skip(1).ToList(); - - // - // From all the operators with the method's name, find the one that matches all arguments. - // - var typeArgs = method.IsGenericMethod ? method.GetGenericArguments() : null; - var targetMethod = methods[method.Name].FirstOrDefault(candidateMethod => ArgsMatch(candidateMethod, arguments, typeArgs)); - if (targetMethod == null) - throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "There is no method '{0}' on type '{1}' that matches the specified arguments", method.Name, targetType.Name)); - - // - // Restore generic arguments. - // - if (typeArgs != null) - targetMethod = targetMethod.MakeGenericMethod(typeArgs); - - // - // Finally, we need to deal with mismatches on Expression> versus Func<...>. - // - var parameters = targetMethod.GetParameters(); - for (int i = 0, n = parameters.Length; i < n; i++) - { - arguments[i] = Unquote(arguments[i]); - } - - // - // Emit a new call to the discovered target method. - // - return Expression.Call(null, targetMethod, arguments); - } - } - } - } - - return expression; - } - - private static ILookup GetMethods(Type type) - { - return type.GetMethods(BindingFlags.Static | BindingFlags.Public).ToLookup(m => m.Name); - } - - private static bool ArgsMatch(MethodInfo method, IList arguments, Type[] typeArgs) - { - // - // Number of parameters should match. Notice we've sanitized IQueryProvider "this" - // parameters first (see Redir). - // - var parameters = method.GetParameters(); - if (parameters.Length != arguments.Count) - return false; - - // - // Genericity should match too. - // - if (!method.IsGenericMethod && typeArgs != null && typeArgs.Length > 0) - return false; - - // - // Reconstruct the generic method if needed. - // - if (method.IsGenericMethodDefinition) - { - if (typeArgs == null) - return false; - - if (method.GetGenericArguments().Length != typeArgs.Length) - return false; - - var result = method.MakeGenericMethod(typeArgs); - parameters = result.GetParameters(); - } - - // - // Check compatibility for the parameter types. - // - for (int i = 0, n = arguments.Count; i < n; i++) - { - var parameterType = parameters[i].ParameterType; - var argument = arguments[i]; - - // - // For operators that take a function (like Where, Select), we'll be faced - // with a quoted argument and a discrepancy between Expression> - // and the underlying Func<...>. - // - if (!parameterType.IsAssignableFrom(argument.Type)) - { - argument = Unquote(argument); - if (!parameterType.IsAssignableFrom(argument.Type)) - return false; - } - } - - return true; - } - - private static Expression Unquote(Expression expression) - { - // - // Get rid of all outer quotes around an expression. - // - while (expression.NodeType == ExpressionType.Quote) - expression = ((UnaryExpression)expression).Operand; - - return expression; - } - } - - internal static Expression GetSourceExpression(IEnumerable source) - { - var q = source as IQueryable; - if (q != null) - return q.Expression; - - return Expression.Constant(source, typeof(IEnumerable)); - } - - internal static Expression GetSourceExpression(IEnumerable[] sources) - { - return Expression.NewArrayInit( - typeof(IEnumerable), - sources.Select(source => GetSourceExpression(source)) - ); - } - } -} diff --git a/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj b/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj deleted file mode 100644 index 839f290..0000000 --- a/Ix/System.Interactive.Providers/System.Interactive.Providers.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {6D62E966-469D-4A99-BD43-0A17FA14FB4F} - Library - Properties - System.Interactive.Providers - System.Interactive.Providers - v4.0 - 512 - true - - - - $(OutputPath)\$(AssemblyName).XML - - - Profile1 - - - - - - - - - - - - - - {8E4B04F0-915E-48F9-9796-76278C6094BD} - System.Interactive - - - - \ No newline at end of file diff --git a/Ix/System.Interactive/EnumerableEx.Aggregates.cs b/Ix/System.Interactive/EnumerableEx.Aggregates.cs deleted file mode 100644 index 204d5ee..0000000 --- a/Ix/System.Interactive/EnumerableEx.Aggregates.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; - -namespace System.Linq -{ - /// - /// Provides a set of additional static methods that allow querying enumerable sequences. - /// - public static partial class EnumerableEx - { - /// - /// Determines whether an enumerable sequence is empty. - /// - /// Source sequence element type. - /// Source sequence. - /// true if the sequence is empty; false otherwise. - public static bool IsEmpty(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return !source.Any(); - } - - /// - /// Returns the minimum value in the enumerable sequence by using the specified comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to determine the minimum value. - /// Minimum value in the sequence. - public static TSource Min(this IEnumerable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return MinBy(source, x => x, comparer).First(); - } - - /// - /// Returns the elements with the minimum key value by using the default comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// List with the elements that share the same minimum key value. - public static IList MinBy(this IEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return MinBy(source, keySelector, Comparer.Default); - } - - /// - /// Returns the elements with the minimum key value by using the specified comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// Comparer used to determine the minimum key value. - /// List with the elements that share the same minimum key value. - public static IList MinBy(this IEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ExtremaBy(source, keySelector, (key, minValue) => -comparer.Compare(key, minValue)); - } - - /// - /// Returns the maximum value in the enumerable sequence by using the specified comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to determine the maximum value. - /// Maximum value in the sequence. - public static TSource Max(this IEnumerable source, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return MaxBy(source, x => x, comparer).First(); - } - - /// - /// Returns the elements with the maximum key value by using the default comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// List with the elements that share the same maximum key value. - public static IList MaxBy(this IEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return MaxBy(source, keySelector, Comparer.Default); - } - - /// - /// Returns the elements with the minimum key value by using the specified comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector used to extract the key for each element in the sequence. - /// Comparer used to determine the maximum key value. - /// List with the elements that share the same maximum key value. - public static IList MaxBy(this IEnumerable source, Func keySelector, IComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return ExtremaBy(source, keySelector, (key, minValue) => comparer.Compare(key, minValue)); - } - - private static IList ExtremaBy(IEnumerable source, Func keySelector, Func compare) - { - var result = new List(); - - using (var e = source.GetEnumerator()) - { - if (!e.MoveNext()) - throw new InvalidOperationException("Source sequence doesn't contain any elements."); - - var current = e.Current; - var resKey = keySelector(current); - result.Add(current); - - while (e.MoveNext()) - { - var cur = e.Current; - var key = keySelector(cur); - - var cmp = compare(key, resKey); - if (cmp == 0) - { - result.Add(cur); - } - else if (cmp > 0) - { - result = new List { cur }; - resKey = key; - } - } - } - - return result; - } - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Buffering.cs b/Ix/System.Interactive/EnumerableEx.Buffering.cs deleted file mode 100644 index 35785bf..0000000 --- a/Ix/System.Interactive/EnumerableEx.Buffering.cs +++ /dev/null @@ -1,647 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Creates a buffer with a shared view over the source sequence, causing each enumerator to fetch the next element from the source sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Buffer enabling each enumerator to retrieve elements from the shared source sequence. - /// - /// var rng = Enumerable.Range(0, 10).Share(); - /// - /// var e1 = rng.GetEnumerator(); // Both e1 and e2 will consume elements from - /// var e2 = rng.GetEnumerator(); // the source sequence. - /// - /// Assert.IsTrue(e1.MoveNext()); - /// Assert.AreEqual(0, e1.Current); - /// - /// Assert.IsTrue(e1.MoveNext()); - /// Assert.AreEqual(1, e1.Current); - /// - /// Assert.IsTrue(e2.MoveNext()); // e2 "steals" element 2 - /// Assert.AreEqual(2, e2.Current); - /// - /// Assert.IsTrue(e1.MoveNext()); // e1 can't see element 2 - /// Assert.AreEqual(3, e1.Current); - /// - public static IBuffer Share(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new SharedBuffer(source.GetEnumerator()); - } - - /// - /// Shares the source sequence within a selector function where each enumerator can fetch the next element from the source sequence. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with shared access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the shared view over the source sequence. - public static IEnumerable Share(this IEnumerable source, Func, IEnumerable> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => selector(source.Share()).GetEnumerator()); - } - - class SharedBuffer : IBuffer - { - private IEnumerator _source; - private bool _disposed; - - public SharedBuffer(IEnumerator source) - { - _source = source; - } - - public IEnumerator GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - return GetEnumerator_(); - } - - private IEnumerator GetEnumerator_() - { - while (true) - { - if (_disposed) - throw new ObjectDisposedException(""); - - var hasValue = default(bool); - var current = default(T); - - lock (_source) - { - hasValue = _source.MoveNext(); - if (hasValue) - current = _source.Current; - } - - if (hasValue) - yield return current; - else - break; - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - return GetEnumerator(); - } - - public void Dispose() - { - lock (_source) - { - if (!_disposed) - { - _source.Dispose(); - _source = null; - } - - _disposed = true; - } - } - } - - /// - /// Creates a buffer with a view over the source sequence, causing each enumerator to obtain access to the remainder of the sequence from the current index in the buffer. - /// - /// Source sequence element type. - /// Source sequence. - /// Buffer enabling each enumerator to retrieve elements from the shared source sequence, starting from the index at the point of obtaining the enumerator. - /// - /// var rng = Enumerable.Range(0, 10).Publish(); - /// - /// var e1 = rng.GetEnumerator(); // e1 has a view on the source starting from element 0 - /// - /// Assert.IsTrue(e1.MoveNext()); - /// Assert.AreEqual(0, e1.Current); - /// - /// Assert.IsTrue(e1.MoveNext()); - /// Assert.AreEqual(1, e1.Current); - /// - /// var e2 = rng.GetEnumerator(); - /// - /// Assert.IsTrue(e2.MoveNext()); // e2 has a view on the source starting from element 2 - /// Assert.AreEqual(2, e2.Current); - /// - /// Assert.IsTrue(e1.MoveNext()); // e1 continues to enumerate over its view - /// Assert.AreEqual(2, e1.Current); - /// - public static IBuffer Publish(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new PublishedBuffer(source.GetEnumerator()); - } - - /// - /// Publishes the source sequence within a selector function where each enumerator can obtain a view over a tail of the source sequence. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with published access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the published view over the source sequence. - public static IEnumerable Publish(this IEnumerable source, Func, IEnumerable> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => selector(source.Publish()).GetEnumerator()); - } - - class PublishedBuffer : IBuffer - { - private IEnumerator _source; - private RefCountList _buffer; - private bool _stopped; - private Exception _error; - private bool _disposed; - - public PublishedBuffer(IEnumerator source) - { - _buffer = new RefCountList(0); - _source = source; - } - - public IEnumerator GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - var i = default(int); - lock (_source) - { - i = _buffer.Count; - _buffer.ReaderCount++; - } - - return GetEnumerator_(i); - } - - private IEnumerator GetEnumerator_(int i) - { - try - { - while (true) - { - if (_disposed) - throw new ObjectDisposedException(""); - - var hasValue = default(bool); - var current = default(T); - - lock (_source) - { - if (i >= _buffer.Count) - { - if (!_stopped) - { - try - { - hasValue = _source.MoveNext(); - if (hasValue) - current = _source.Current; - } - catch (Exception ex) - { - _stopped = true; - _error = ex; - - _source.Dispose(); - } - } - - if (_stopped) - { - if (_error != null) - throw _error; - else - break; - } - - if (hasValue) - { - _buffer.Add(current); - } - } - else - { - hasValue = true; - } - } - - if (hasValue) - yield return _buffer[i]; - else - break; - - i++; - } - } - finally - { - if (_buffer != null) - _buffer.Done(i + 1); - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - return GetEnumerator(); - } - - public void Dispose() - { - lock (_source) - { - if (!_disposed) - { - _source.Dispose(); - _source = null; - - _buffer.Clear(); - _buffer = null; - } - - _disposed = true; - } - } - } - - /// - /// Creates a buffer with a view over the source sequence, causing each enumerator to obtain access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Source sequence. - /// Buffer enabling each enumerator to retrieve all elements from the shared source sequence, without duplicating source enumeration side-effects. - /// - /// var rng = Enumerable.Range(0, 10).Do(x => Console.WriteLine(x)).Memoize(); - /// - /// var e1 = rng.GetEnumerator(); - /// - /// Assert.IsTrue(e1.MoveNext()); // Prints 0 - /// Assert.AreEqual(0, e1.Current); - /// - /// Assert.IsTrue(e1.MoveNext()); // Prints 1 - /// Assert.AreEqual(1, e1.Current); - /// - /// var e2 = rng.GetEnumerator(); - /// - /// Assert.IsTrue(e2.MoveNext()); // Doesn't print anything; the side-effect of Do - /// Assert.AreEqual(0, e2.Current); // has already taken place during e1's iteration. - /// - /// Assert.IsTrue(e1.MoveNext()); // Prints 2 - /// Assert.AreEqual(2, e1.Current); - /// - public static IBuffer Memoize(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new MemoizedBuffer(source.GetEnumerator()); - } - - /// - /// Memoizes the source sequence within a selector function where each enumerator can get access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Selector function with memoized access to the source sequence for each enumerator. - /// Sequence resulting from applying the selector function to the memoized view over the source sequence. - public static IEnumerable Memoize(this IEnumerable source, Func, IEnumerable> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => selector(source.Memoize()).GetEnumerator()); - } - - /// - /// Creates a buffer with a view over the source sequence, causing a specified number of enumerators to obtain access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. - /// Buffer enabling a specified number of enumerators to retrieve all elements from the shared source sequence, without duplicating source enumeration side-effects. - public static IBuffer Memoize(this IEnumerable source, int readerCount) - { - if (source == null) - throw new ArgumentNullException("source"); - if (readerCount <= 0) - throw new ArgumentOutOfRangeException("readerCount"); - - return new MemoizedBuffer(source.GetEnumerator(), readerCount); - } - - /// - /// Memoizes the source sequence within a selector function where a specified number of enumerators can get access to all of the sequence's elements without causing multiple enumerations over the source. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Number of enumerators that can access the underlying buffer. Once every enumerator has obtained an element from the buffer, the element is removed from the buffer. - /// Selector function with memoized access to the source sequence for a specified number of enumerators. - /// Sequence resulting from applying the selector function to the memoized view over the source sequence. - public static IEnumerable Memoize(this IEnumerable source, int readerCount, Func, IEnumerable> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (readerCount <= 0) - throw new ArgumentOutOfRangeException("readerCount"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return Create(() => selector(source.Memoize(readerCount)).GetEnumerator()); - } - - class MemoizedBuffer : IBuffer - { - private IEnumerator _source; - private IRefCountList _buffer; - private bool _stopped; - private Exception _error; - private bool _disposed; - - public MemoizedBuffer(IEnumerator source) - : this(source, new MaxRefCountList()) - { - } - - public MemoizedBuffer(IEnumerator source, int readerCount) - : this(source, new RefCountList(readerCount)) - { - } - - private MemoizedBuffer(IEnumerator source, IRefCountList buffer) - { - _source = source; - _buffer = buffer; - } - - public IEnumerator GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - return GetEnumerator_(); - } - - private IEnumerator GetEnumerator_() - { - var i = 0; - - try - { - while (true) - { - if (_disposed) - throw new ObjectDisposedException(""); - - var hasValue = default(bool); - var current = default(T); - - lock (_source) - { - if (i >= _buffer.Count) - { - if (!_stopped) - { - try - { - hasValue = _source.MoveNext(); - if (hasValue) - current = _source.Current; - } - catch (Exception ex) - { - _stopped = true; - _error = ex; - - _source.Dispose(); - } - } - - if (_stopped) - { - if (_error != null) - throw _error; - else - break; - } - - if (hasValue) - { - _buffer.Add(current); - } - } - else - { - hasValue = true; - } - } - - if (hasValue) - yield return _buffer[i]; - else - break; - - i++; - } - } - finally - { - if (_buffer != null) - _buffer.Done(i + 1); - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - if (_disposed) - throw new ObjectDisposedException(""); - - return GetEnumerator(); - } - - public void Dispose() - { - lock (_source) - { - if (!_disposed) - { - _source.Dispose(); - _source = null; - - _buffer.Clear(); - _buffer = null; - } - - _disposed = true; - } - } - } - } - - /// - /// Represents a buffer exposing a shared view over an underlying enumerable sequence. - /// - /// Element type. - public interface IBuffer< -#if !NO_VARIANCE && !SILVERLIGHT4 // SL4 has defined IEnumerable with invariant T - out -#endif - T> : IEnumerable, IDisposable - { - } - - interface IRefCountList - { - void Clear(); - - int Count { get; } - - T this[int i] - { - get; - } - - void Add(T item); - - void Done(int index); - } - - class MaxRefCountList : IRefCountList - { - private IList _list = new List(); - - public void Clear() - { - _list.Clear(); - } - - public int Count - { - get { return _list.Count; } - } - - public T this[int i] - { - get { return _list[i]; } - } - - public void Add(T item) - { - _list.Add(item); - } - - public void Done(int index) - { - } - } - - class RefCountList : IRefCountList - { - private int _readerCount; - private readonly IDictionary _list; - private int _count; - - public RefCountList(int readerCount) - { - _readerCount = readerCount; - _list = new Dictionary(); - } - - public int ReaderCount - { - get - { - return _readerCount; - } - - set - { - _readerCount = value; - } - } - - public void Clear() - { - _list.Clear(); - } - - public int Count - { - get { return _count; } - } - - public T this[int i] - { - get - { - Debug.Assert(i < _count); - - var res = default(RefCount); - if (!_list.TryGetValue(i, out res)) - throw new InvalidOperationException("Element no longer available in the buffer."); - - var val = res.Value; - if (--res.Count == 0) - _list.Remove(i); - - return val; - } - } - - public void Add(T item) - { - _list[_count] = new RefCount { Value = item, Count = _readerCount }; - _count++; - } - - public void Done(int index) - { - for (int i = index; i < _count; i++) - { - var ignore = this[i]; - } - - _readerCount--; - } - - class RefCount - { - public int Count; - public T Value; - } - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Creation.cs b/Ix/System.Interactive/EnumerableEx.Creation.cs deleted file mode 100644 index 2ba4f16..0000000 --- a/Ix/System.Interactive/EnumerableEx.Creation.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Creates an enumerable sequence based on an enumerator factory function. - /// - /// Result sequence element type. - /// Enumerator factory function. - /// Sequence that will invoke the enumerator factory upon a call to GetEnumerator. - public static IEnumerable Create(Func> getEnumerator) - { - if (getEnumerator == null) - throw new ArgumentNullException("getEnumerator"); - - return new AnonymousEnumerable(getEnumerator); - } - - class AnonymousEnumerable : IEnumerable - { - private readonly Func> _getEnumerator; - - public AnonymousEnumerable(Func> getEnumerator) - { - _getEnumerator = getEnumerator; - } - - public IEnumerator GetEnumerator() - { - return _getEnumerator(); - } - - Collections.IEnumerator Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } - - /// - /// Returns a sequence with a single element. - /// - /// Result sequence element type. - /// Single element of the resulting sequence. - /// Sequence with a single element. - public static IEnumerable Return(TResult value) - { - yield return value; - } - - /// - /// Returns a sequence that throws an exception upon enumeration. - /// - /// Result sequence element type. - /// Exception to throw upon enumerating the resulting sequence. - /// Sequence that throws the specified exception upon enumeration. - public static IEnumerable Throw(Exception exception) - { - if (exception == null) - throw new ArgumentNullException("exception"); - - return Throw_(exception); - } - - private static IEnumerable Throw_(Exception exception) - { - throw exception; -#pragma warning disable 0162 - yield break; -#pragma warning restore 0162 - } - - /// - /// Creates an enumerable sequence based on an enumerable factory function. - /// - /// Result sequence element type. - /// Enumerable factory function. - /// Sequence that will invoke the enumerable factory upon a call to GetEnumerator. - public static IEnumerable Defer(Func> enumerableFactory) - { - if (enumerableFactory == null) - throw new ArgumentNullException("enumerableFactory"); - - return Defer_(enumerableFactory); - } - - private static IEnumerable Defer_(Func> enumerableFactory) - { - foreach (var item in enumerableFactory()) - yield return item; - } - - /// - /// Generates a sequence by mimicking a for loop. - /// - /// State type. - /// Result sequence element type. - /// Initial state of the generator loop. - /// Loop condition. - /// State update function to run after every iteration of the generator loop. - /// Result selector to compute resulting sequence elements. - /// Sequence obtained by running the generator loop, yielding computed elements. - public static IEnumerable Generate(TState initialState, Func condition, Func iterate, Func resultSelector) - { - if (condition == null) - throw new ArgumentNullException("condition"); - if (iterate == null) - throw new ArgumentNullException("iterate"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return Generate_(initialState, condition, iterate, resultSelector); - } - - private static IEnumerable Generate_(TState initialState, Func condition, Func iterate, Func resultSelector) - { - for (var i = initialState; condition(i); i = iterate(i)) - yield return resultSelector(i); - } - - /// - /// Generates a sequence that's dependent on a resource object whose lifetime is determined by the sequence usage duration. - /// - /// Source element type. - /// Resource type. - /// Resource factory function. - /// Enumerable factory function, having access to the obtained resource. - /// Sequence whose use controls the lifetime of the associated obtained resource. - public static IEnumerable Using(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable - { - if (resourceFactory == null) - throw new ArgumentNullException("resourceFactory"); - if (enumerableFactory == null) - throw new ArgumentNullException("enumerableFactory"); - - return Using_(resourceFactory, enumerableFactory); - } - - private static IEnumerable Using_(Func resourceFactory, Func> enumerableFactory) where TResource : IDisposable - { - using (var res = resourceFactory()) - foreach (var item in enumerableFactory(res)) - yield return item; - } - - /// - /// Generates a sequence by repeating the given value infinitely. - /// - /// Result sequence element type. - /// Value to repreat in the resulting sequence. - /// Sequence repeating the given value infinitely. - public static IEnumerable Repeat(TResult value) - { - while (true) - yield return value; - } - - /// - /// Generates a sequence that contains one repeated value. - /// - /// Result sequence element type. - /// The value to be repeated. - /// The number of times to repeat the value in the generated sequence. - /// Sequence that contains a repeated value. - public static IEnumerable Repeat(TResult element, int count) - { - return Enumerable.Repeat(element, count); - } - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Exceptions.cs b/Ix/System.Interactive/EnumerableEx.Exceptions.cs deleted file mode 100644 index a3ff330..0000000 --- a/Ix/System.Interactive/EnumerableEx.Exceptions.cs +++ /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. -using System; -using System.Collections.Generic; -using System.Linq; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Creates a sequence that corresponds to the source sequence, concatenating it with the sequence resulting from calling an exception handler function in case of an error. - /// - /// Source sequence element type. - /// Exception type to catch. - /// Source sequence. - /// Handler to invoke when an exception of the specified type occurs. - /// Source sequence, concatenated with an exception handler result sequence in case of an error. - public static IEnumerable Catch(this IEnumerable source, Func> handler) - where TException : Exception - { - if (source == null) - throw new ArgumentNullException("source"); - if (handler == null) - throw new ArgumentNullException("handler"); - - return source.Catch_(handler); - } - - private static IEnumerable Catch_(this IEnumerable source, Func> handler) - where TException : Exception - { - var err = default(IEnumerable); - - using (var e = source.GetEnumerator()) - { - while (true) - { - var b = default(bool); - var c = default(TSource); - - try - { - b = e.MoveNext(); - c = e.Current; - } - catch (TException ex) - { - err = handler(ex); - break; - } - - if (!b) - break; - - yield return c; - } - } - - if (err != null) - { - foreach (var item in err) - yield return item; - } - } - - /// - /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence that continues to concatenate source sequences while errors occur. - public static IEnumerable Catch(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Catch_(); - } - - /// - /// Creates a sequence by concatenating source sequences until a source sequence completes successfully. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence that continues to concatenate source sequences while errors occur. - public static IEnumerable Catch(params IEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Catch_(); - } - - /// - /// Creates a sequence that returns the elements of the first sequence, switching to the second in case of an error. - /// - /// Source sequence element type. - /// First sequence. - /// Second sequence, concatenated to the result in case the first sequence completes exceptionally. - /// The first sequence, followed by the second sequence in case an error is produced. - public static IEnumerable Catch(this IEnumerable first, IEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return new[] { first, second }.Catch_(); - } - - private static IEnumerable Catch_(this IEnumerable> sources) - { - var error = default(Exception); - - foreach (var source in sources) - { - using (var e = source.GetEnumerator()) - { - error = null; - - while (true) - { - var b = default(bool); - var c = default(TSource); - - try - { - b = e.MoveNext(); - c = e.Current; - } - catch (Exception ex) - { - error = ex; - break; - } - - if (!b) - break; - - yield return c; - } - - if (error == null) - break; - } - } - - if (error != null) - throw error; - } - - /// - /// Creates a sequence whose termination or disposal of an enumerator causes a finally action to be executed. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to run upon termination of the sequence, or when an enumerator is disposed. - /// Source sequence with guarantees on the invocation of the finally action. - public static IEnumerable Finally(this IEnumerable source, Action finallyAction) - { - if (source == null) - throw new ArgumentNullException("source"); - if (finallyAction == null) - throw new ArgumentNullException("finallyAction"); - - return source.Finally_(finallyAction); - } - - private static IEnumerable Finally_(this IEnumerable source, Action finallyAction) - { - try - { - foreach (var item in source) - yield return item; - } - finally - { - finallyAction(); - } - } - - /// - /// Creates a sequence that concatenates both given sequences, regardless of whether an error occurs. - /// - /// Source sequence element type. - /// First sequence. - /// Second sequence. - /// Sequence concatenating the elements of both sequences, ignoring errors. - public static IEnumerable OnErrorResumeNext(this IEnumerable first, IEnumerable second) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - - return OnErrorResumeNext_(new[] { first, second }); - } - - /// - /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence concatenating the elements of the given sequences, ignoring errors. - public static IEnumerable OnErrorResumeNext(params IEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return OnErrorResumeNext_(sources); - } - - /// - /// Creates a sequence that concatenates the given sequences, regardless of whether an error occurs in any of the sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence concatenating the elements of the given sequences, ignoring errors. - public static IEnumerable OnErrorResumeNext(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return OnErrorResumeNext_(sources); - } - - private static IEnumerable OnErrorResumeNext_(IEnumerable> sources) - { - foreach (var source in sources) - { - using (var innerEnumerator = source.GetEnumerator()) - { - while (true) - { - var value = default(TSource); - try - { - if (!innerEnumerator.MoveNext()) - break; - value = innerEnumerator.Current; - } - catch - { - break; - } - - yield return value; - } - } - } - } - - /// - /// Creates a sequence that retries enumerating the source sequence as long as an error occurs. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence concatenating the results of the source sequence as long as an error occurs. - public static IEnumerable Retry(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return new[] { source }.Repeat().Catch(); - } - - /// - /// Creates a sequence that retries enumerating the source sequence as long as an error occurs, with the specified maximum number of retries. - /// - /// Source sequence element type. - /// Source sequence. - /// Maximum number of retries. - /// Sequence concatenating the results of the source sequence as long as an error occurs. - public static IEnumerable Retry(this IEnumerable source, int retryCount) - { - if (source == null) - throw new ArgumentNullException("source"); - if (retryCount < 0) - throw new ArgumentOutOfRangeException("retryCount"); - - return new[] { source }.Repeat(retryCount).Catch(); - } - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Imperative.cs b/Ix/System.Interactive/EnumerableEx.Imperative.cs deleted file mode 100644 index fff3927..0000000 --- a/Ix/System.Interactive/EnumerableEx.Imperative.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Generates an enumerable sequence by repeating a source sequence as long as the given loop condition holds. - /// - /// Result sequence element type. - /// Loop condition. - /// Sequence to repeat while the condition evaluates true. - /// Sequence generated by repeating the given sequence while the condition evaluates to true. - public static IEnumerable While(Func condition, IEnumerable source) - { - if (condition == null) - throw new ArgumentNullException("condition"); - if (source == null) - throw new ArgumentNullException("source"); - - return WhileCore(condition, source).Concat(); - } - - static IEnumerable> WhileCore(Func condition, IEnumerable source) - { - while (condition()) - yield return source; - } - - /// - /// Returns an enumerable sequence based on the evaluation result of the given condition. - /// - /// Result sequence element type. - /// Condition to evaluate. - /// Sequence to return in case the condition evaluates true. - /// Sequence to return in case the condition evaluates false. - /// Either of the two input sequences based on the result of evaluating the condition. - public static IEnumerable If(Func condition, IEnumerable thenSource, IEnumerable elseSource) - { - if (condition == null) - throw new ArgumentNullException("condition"); - if (thenSource == null) - throw new ArgumentNullException("thenSource"); - if (elseSource == null) - throw new ArgumentNullException("elseSource"); - - return EnumerableEx.Defer(() => condition() ? thenSource : elseSource); - } - - /// - /// Returns an enumerable sequence if the evaluation result of the given condition is true, otherwise returns an empty sequence. - /// - /// Result sequence element type. - /// Condition to evaluate. - /// Sequence to return in case the condition evaluates true. - /// The given input sequence if the condition evaluates true; otherwise, an empty sequence. - public static IEnumerable If(Func condition, IEnumerable thenSource) - { - if (condition == null) - throw new ArgumentNullException("condition"); - if (thenSource == null) - throw new ArgumentNullException("thenSource"); - - return EnumerableEx.Defer(() => condition() ? thenSource : Enumerable.Empty()); - } - - /// - /// Generates an enumerable sequence by repeating a source sequence as long as the given loop postcondition holds. - /// - /// Result sequence element type. - /// Source sequence to repeat while the condition evaluates true. - /// Loop condition. - /// Sequence generated by repeating the given sequence until the condition evaluates to false. - public static IEnumerable DoWhile(this IEnumerable source, Func condition) - { - if (source == null) - throw new ArgumentNullException("source"); - if (condition == null) - throw new ArgumentNullException("condition"); - - return source.Concat(While(condition, source)); - } - - /// - /// Returns a sequence from a dictionary based on the result of evaluating a selector function. - /// - /// Type of the selector value. - /// Result sequence element type. - /// Selector function used to pick a sequence from the given sources. - /// Dictionary mapping selector values onto resulting sequences. - /// The source sequence corresponding with the evaluated selector value; otherwise, an empty sequence. - public static IEnumerable Case(Func selector, IDictionary> sources) - { - if (selector == null) - throw new ArgumentNullException("selector"); - if (sources == null) - throw new ArgumentNullException("sources"); - - return Case(selector, sources, Enumerable.Empty()); - } - - /// - /// Returns a sequence from a dictionary based on the result of evaluating a selector function, also specifying a default sequence. - /// - /// Type of the selector value. - /// Result sequence element type. - /// Selector function used to pick a sequence from the given sources. - /// Dictionary mapping selector values onto resulting sequences. - /// Default sequence to return in case there's no corresponding source for the computed selector value. - /// The source sequence corresponding with the evaluated selector value; otherwise, the default source. - public static IEnumerable Case(Func selector, IDictionary> sources, IEnumerable defaultSource) - { - if (selector == null) - throw new ArgumentNullException("selector"); - if (sources == null) - throw new ArgumentNullException("sources"); - if (defaultSource == null) - throw new ArgumentNullException("defaultSource"); - - return EnumerableEx.Defer(() => - { - IEnumerable result; - if (!sources.TryGetValue(selector(), out result)) - result = defaultSource; - return result; - }); - } - - /// - /// Generates a sequence by enumerating a source sequence, mapping its elements on result sequences, and concatenating those sequences. - /// - /// Source sequence element type. - /// Result sequence element type. - /// Source sequence. - /// Result selector to evaluate for each iteration over the source. - /// Sequence concatenating the inner sequences that result from evaluating the result selector on elements from the source. - public static IEnumerable For(IEnumerable source, Func> resultSelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return ForCore(source, resultSelector).Concat(); - } - - static IEnumerable> ForCore(IEnumerable source, Func> resultSelector) - { - return source.Select(resultSelector); - } - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Multiple.cs b/Ix/System.Interactive/EnumerableEx.Multiple.cs deleted file mode 100644 index ffba503..0000000 --- a/Ix/System.Interactive/EnumerableEx.Multiple.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Concatenates the input sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence with the elements of the source sequences concatenated. - public static IEnumerable Concat(this IEnumerable> sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Concat_(); - } - - /// - /// Concatenates the input sequences. - /// - /// Source sequence element type. - /// Source sequences. - /// Sequence with the elements of the source sequences concatenated. - public static IEnumerable Concat(params IEnumerable[] sources) - { - if (sources == null) - throw new ArgumentNullException("sources"); - - return sources.Concat_(); - } - - private static IEnumerable Concat_(this IEnumerable> sources) - { - foreach (var source in sources) - foreach (var item in source) - yield return item; - } - - /// - /// Projects each element of a sequence to an given sequence and flattens the resulting sequences into one sequence. - /// - /// First source sequence element type. - /// Second source sequence element type. - /// A sequence of values to project. - /// Inner sequence each source sequenec element is projected onto. - /// Sequence flattening the sequences that result from projecting elements in the source sequence. - public static IEnumerable SelectMany(this IEnumerable source, IEnumerable other) - { - if (source == null) - throw new ArgumentNullException("source"); - if (other == null) - throw new ArgumentNullException("other"); - - return source.SelectMany(_ => other); - } - -#if NO_ZIP - /// - /// Merges two sequences by applying the specified selector function on index-based corresponding element pairs from both sequences. - /// - /// The type of the elements of the first input sequence. - /// The type of the elements of the second input sequence. - /// The type of the elements of the result sequence. - /// The first sequence to merge. - /// The second sequence to merge. - /// Function to apply to each pair of elements from both sequences. - /// Sequence consisting of the result of pairwise application of the selector function over pairs of elements from the source sequences. - public static IEnumerable Zip(this IEnumerable first, IEnumerable second, Func resultSelector) - { - if (first == null) - throw new ArgumentNullException("first"); - if (second == null) - throw new ArgumentNullException("second"); - if (resultSelector == null) - throw new ArgumentNullException("resultSelector"); - - return Zip_(first, second, resultSelector); - } - - private static IEnumerable Zip_(this IEnumerable first, IEnumerable second, Func resultSelector) - { - using (var e1 = first.GetEnumerator()) - using (var e2 = second.GetEnumerator()) - while (e1.MoveNext() && e2.MoveNext()) - yield return resultSelector(e1.Current, e2.Current); - } -#endif - } -} diff --git a/Ix/System.Interactive/EnumerableEx.Single.cs b/Ix/System.Interactive/EnumerableEx.Single.cs deleted file mode 100644 index 6151ea9..0000000 --- a/Ix/System.Interactive/EnumerableEx.Single.cs +++ /dev/null @@ -1,672 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; - -namespace System.Linq -{ - public static partial class EnumerableEx - { - /// - /// Hides the enumerable sequence object identity. - /// - /// Source sequence element type. - /// Source sequence. - /// Enumerable sequence with the same behavior as the original, but hiding the source object identity. - /// AsEnumerable doesn't hide the object identity, and simply acts as a cast to the IEnumerable<TSource> interface. - public static IEnumerable Hide(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.Hide_(); - } - - private static IEnumerable Hide_(this IEnumerable source) - { - foreach (var item in source) - yield return item; - } - - /// - /// Enumerates the sequence and invokes the given action for each value in the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - public static void ForEach(this IEnumerable source, Action onNext) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - - foreach (var item in source) - onNext(item); - } - - /// - /// Enumerates the sequence and invokes the given action for each value in the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - public static void ForEach(this IEnumerable source, Action onNext) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - - var i = 0; - foreach (var item in source) - onNext(item, i++); - } - - /// - /// Lazily invokes an action for each value in the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IEnumerable Do(this IEnumerable source, Action onNext) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - - return DoHelper(source, onNext, _ => { }, () => { }); - } - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action for successful termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on successful termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IEnumerable Do(this IEnumerable source, Action onNext, Action onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return DoHelper(source, onNext, _ => { }, onCompleted); - } - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action upon exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on exceptional termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IEnumerable Do(this IEnumerable source, Action onNext, Action onError) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - - return DoHelper(source, onNext, onError, () => { }); - } - - /// - /// Lazily invokes an action for each value in the sequence, and executes an action upon successful or exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Action to invoke for each element. - /// Action to invoke on exceptional termination of the sequence. - /// Action to invoke on successful termination of the sequence. - /// Sequence exhibiting the specified side-effects upon enumeration. - public static IEnumerable Do(this IEnumerable source, Action onNext, Action onError, Action onCompleted) - { - if (source == null) - throw new ArgumentNullException("source"); - if (onNext == null) - throw new ArgumentNullException("onNext"); - if (onError == null) - throw new ArgumentNullException("onError"); - if (onCompleted == null) - throw new ArgumentNullException("onCompleted"); - - return DoHelper(source, onNext, onError, onCompleted); - } - -#if !NO_RXINTERFACES - /// - /// Lazily invokes observer methods for each value in the sequence, and upon successful or exceptional termination. - /// - /// Source sequence element type. - /// Source sequence. - /// Observer to invoke notification calls on. - /// Sequence exhibiting the side-effects of observer method invocation upon enumeration. - public static IEnumerable Do(this IEnumerable source, IObserver observer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (observer == null) - throw new ArgumentNullException("observer"); - - return DoHelper(source, observer.OnNext, observer.OnError, observer.OnCompleted); - } -#endif - - private static IEnumerable DoHelper(this IEnumerable source, Action onNext, Action onError, Action onCompleted) - { - using (var e = source.GetEnumerator()) - { - while (true) - { - var current = default(TSource); - try - { - if (!e.MoveNext()) - break; - - current = e.Current; - } - catch (Exception ex) - { - onError(ex); - throw; - } - - onNext(current); - yield return current; - } - - onCompleted(); - } - } - - /// - /// Generates a sequence of non-overlapping adjacent buffers over the source sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of elements for allocated buffers. - /// Sequence of buffers containing source sequence elements. - public static IEnumerable> Buffer(this IEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count <= 0) - throw new ArgumentOutOfRangeException("count"); - - return source.Buffer_(count, count); - } - - /// - /// Generates a sequence of buffers over the source sequence, with specified length and possible overlap. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of elements for allocated buffers. - /// Number of elements to skip between the start of consecutive buffers. - /// Sequence of buffers containing source sequence elements. - public static IEnumerable> Buffer(this IEnumerable source, int count, int skip) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count <= 0) - throw new ArgumentOutOfRangeException("count"); - if (skip <= 0) - throw new ArgumentOutOfRangeException("skip"); - - return source.Buffer_(count, skip); - } - - private static IEnumerable> Buffer_(this IEnumerable source, int count, int skip) - { - var buffers = new Queue>(); - - var i = 0; - foreach (var item in source) - { - if (i % skip == 0) - buffers.Enqueue(new List(count)); - - foreach (var buffer in buffers) - buffer.Add(item); - - if (buffers.Count > 0 && buffers.Peek().Count == count) - yield return buffers.Dequeue(); - - i++; - } - - while (buffers.Count > 0) - yield return buffers.Dequeue(); - } - - /// - /// Ignores all elements in the source sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// Source sequence without its elements. - public static IEnumerable IgnoreElements(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.IgnoreElements_(); - } - - private static IEnumerable IgnoreElements_(this IEnumerable source) - { - foreach (var item in source) - ; - - yield break; - } - - /// - /// Returns elements with a distinct key value by using the default equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Sequence that contains the elements from the source sequence with distinct key values. - public static IEnumerable Distinct(this IEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.Distinct_(keySelector, EqualityComparer.Default); - } - - /// - /// Returns elements with a distinct key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Comparer used to compare key values. - /// Sequence that contains the elements from the source sequence with distinct key values. - public static IEnumerable Distinct(this IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.Distinct_(keySelector, comparer); - } - - private static IEnumerable Distinct_(this IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - var set = new HashSet(comparer); - - foreach (var item in source) - { - var key = keySelector(item); - if (set.Add(key)) - yield return item; - } - } - -#if NO_HASHSET - class HashSet - { - private Dictionary _set; - - public HashSet(IEqualityComparer comparer) - { - _set = new Dictionary(comparer); - } - - public bool Add(T value) - { - if (_set.ContainsKey(value)) - return false; - - _set[value] = null; - return true; - } - } -#endif - - /// - /// Returns consecutive distinct elements by using the default equality comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence without adjacent non-distinct elements. - public static IEnumerable DistinctUntilChanged(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.DistinctUntilChanged_(x => x, EqualityComparer.Default); - } - - /// - /// Returns consecutive distinct elements by using the specified equality comparer to compare values. - /// - /// Source sequence element type. - /// Source sequence. - /// Comparer used to compare values. - /// Sequence without adjacent non-distinct elements. - public static IEnumerable DistinctUntilChanged(this IEnumerable source, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.DistinctUntilChanged_(x => x, comparer); - } - - /// - /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Sequence without adjacent non-distinct elements. - public static IEnumerable DistinctUntilChanged(this IEnumerable source, Func keySelector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - - return source.DistinctUntilChanged_(keySelector, EqualityComparer.Default); - } - - /// - /// Returns consecutive distinct elements based on a key value by using the specified equality comparer to compare key values. - /// - /// Source sequence element type. - /// Key type. - /// Source sequence. - /// Key selector. - /// Comparer used to compare key values. - /// Sequence without adjacent non-distinct elements. - public static IEnumerable DistinctUntilChanged(this IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - if (source == null) - throw new ArgumentNullException("source"); - if (keySelector == null) - throw new ArgumentNullException("keySelector"); - if (comparer == null) - throw new ArgumentNullException("comparer"); - - return source.DistinctUntilChanged_(keySelector, comparer); - } - - private static IEnumerable DistinctUntilChanged_(this IEnumerable source, Func keySelector, IEqualityComparer comparer) - { - var currentKey = default(TKey); - var hasCurrentKey = false; - - foreach (var item in source) - { - var key = keySelector(item); - - var comparerEquals = false; - if (hasCurrentKey) - { - comparerEquals = comparer.Equals(currentKey, key); - } - - if (!hasCurrentKey || !comparerEquals) - { - hasCurrentKey = true; - currentKey = key; - yield return item; - } - } - } - - /// - /// Expands the sequence by recursively applying a selector function. - /// - /// Source sequence element type. - /// Source sequence. - /// Selector function to retrieve the next sequence to expand. - /// Sequence with results from the recursive expansion of the source sequence. - public static IEnumerable Expand(this IEnumerable source, Func> selector) - { - if (source == null) - throw new ArgumentNullException("source"); - if (selector == null) - throw new ArgumentNullException("selector"); - - return source.Expand_(selector); - } - - private static IEnumerable Expand_(this IEnumerable source, Func> selector) - { - var queue = new Queue>(); - queue.Enqueue(source); - - while (queue.Count > 0) - { - var src = queue.Dequeue(); - - foreach (var item in src) - { - queue.Enqueue(selector(item)); - yield return item; - } - } - } - - /// - /// Returns the source sequence prefixed with the specified value. - /// - /// Source sequence element type. - /// Source sequence. - /// Values to prefix the sequence with. - /// Sequence starting with the specified prefix value, followed by the source sequence. - public static IEnumerable StartWith(this IEnumerable source, params TSource[] values) - { - if (source == null) - throw new ArgumentNullException("source"); - - return source.StartWith_(values); - } - - private static IEnumerable StartWith_(this IEnumerable source, params TSource[] values) - { - foreach (var x in values) - yield return x; - - foreach (var item in source) - yield return item; - } - - /// - /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. - /// - /// Source sequence element type. - /// Accumulation type. - /// Source sequence. - /// Accumulator seed value. - /// Accumulation function to apply to the current accumulation value and each element of the sequence. - /// Sequence with all intermediate accumulation values resulting from scanning the sequence. - public static IEnumerable Scan(this IEnumerable source, TAccumulate seed, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return source.Scan_(seed, accumulator); - } - - private static IEnumerable Scan_(this IEnumerable source, TAccumulate seed, Func accumulator) - { - var acc = seed; - - foreach (var item in source) - { - acc = accumulator(acc, item); - yield return acc; - } - } - - /// - /// Generates a sequence of accumulated values by scanning the source sequence and applying an accumulator function. - /// - /// Source sequence element type. - /// Source sequence. - /// Accumulation function to apply to the current accumulation value and each element of the sequence. - /// Sequence with all intermediate accumulation values resulting from scanning the sequence. - public static IEnumerable Scan(this IEnumerable source, Func accumulator) - { - if (source == null) - throw new ArgumentNullException("source"); - if (accumulator == null) - throw new ArgumentNullException("accumulator"); - - return source.Scan_(accumulator); - } - - private static IEnumerable Scan_(this IEnumerable source, Func accumulator) - { - var hasSeed = false; - var acc = default(TSource); - - foreach (var item in source) - { - if (!hasSeed) - { - hasSeed = true; - acc = item; - continue; - } - - acc = accumulator(acc, item); - yield return acc; - } - } - - /// - /// Returns a specified number of contiguous elements from the end of the sequence. - /// - /// Source sequence element type. - /// Source sequence. - /// The number of elements to take from the end of the sequence. - /// Sequence with the specified number of elements counting from the end of the source sequence. - public static IEnumerable TakeLast(this IEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return source.TakeLast_(count); - } - - private static IEnumerable TakeLast_(this IEnumerable source, int count) - { - var q = new Queue(count); - - foreach (var item in source) - { - if (q.Count >= count) - q.Dequeue(); - q.Enqueue(item); - } - - while (q.Count > 0) - yield return q.Dequeue(); - } - - /// - /// Bypasses a specified number of contiguous elements from the end of the sequence and returns the remaining elements. - /// - /// Source sequence element type. - /// Source sequence. - /// The number of elements to skip from the end of the sequence before returning the remaining elements. - /// Sequence bypassing the specified number of elements counting from the end of the source sequence. - public static IEnumerable SkipLast(this IEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return source.SkipLast_(count); - } - - private static IEnumerable SkipLast_(this IEnumerable source, int count) - { - var q = new Queue(); - - foreach (var x in source) - { - q.Enqueue(x); - if (q.Count > count) - yield return q.Dequeue(); - } - } - - /// - /// Repeats and concatenates the source sequence infinitely. - /// - /// Source sequence element type. - /// Source sequence. - /// Sequence obtained by concatenating the source sequence to itself infinitely. - public static IEnumerable Repeat(this IEnumerable source) - { - if (source == null) - throw new ArgumentNullException("source"); - - return Repeat_(source); - } - - private static IEnumerable Repeat_(IEnumerable source) - { - while (true) - foreach (var item in source) - yield return item; - } - - /// - /// Repeats and concatenates the source sequence the given number of times. - /// - /// Source sequence element type. - /// Source sequence. - /// Number of times to repeat the source sequence. - /// Sequence obtained by concatenating the source sequence to itself the specified number of times. - public static IEnumerable Repeat(this IEnumerable source, int count) - { - if (source == null) - throw new ArgumentNullException("source"); - if (count < 0) - throw new ArgumentOutOfRangeException("count"); - - return Repeat_(source, count); - } - - private static IEnumerable Repeat_(IEnumerable source, int count) - { - for (var i = 0; i < count; i++) - foreach (var item in source) - yield return item; - } - } -} diff --git a/Ix/System.Interactive/Properties/AssemblyInfo.cs b/Ix/System.Interactive/Properties/AssemblyInfo.cs deleted file mode 100644 index 0bafb78..0000000 --- a/Ix/System.Interactive/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; -using System.Security; - -[assembly: AssemblyTitle("System.Interactive")] -// Notice: same description as in the .nuspec files; see Source/Interactive Extensions/Setup/NuGet -[assembly: AssemblyDescription("Interactive Extensions Main Library used to express queries over enumerable sequences.")] -#if DEBUG -[assembly: AssemblyConfiguration("Debug")] -#else -[assembly: AssemblyConfiguration("Retail")] -#endif -[assembly: AssemblyCompany("Microsoft Corporation")] -#if STABLE -[assembly: AssemblyProduct("Interactive Extensions")] -#else -[assembly: AssemblyProduct("Interactive Extensions (Experimental Release)")] -#endif -[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")] -[assembly: NeutralResourcesLanguage("en-US")] - -#if !PLIB -[assembly: ComVisible(false)] -#endif - -[assembly: CLSCompliant(true)] - -#if DESKTOPCLR && NO_CODECOVERAGE -[assembly: AllowPartiallyTrustedCallers] -#endif - -// -// Note: Assembly (file) version numbers get inserted by the build system on the fly. Inspect the Team Build workflows -// and the custom activity in Build/Source/Activities/AppendVersionInfo.cs for more information. -// diff --git a/Ix/System.Interactive/System.Interactive.csproj b/Ix/System.Interactive/System.Interactive.csproj deleted file mode 100644 index a4646a5..0000000 --- a/Ix/System.Interactive/System.Interactive.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {8E4B04F0-915E-48F9-9796-76278C6094BD} - Library - Properties - System.Interactive - System.Interactive - v4.0 - 512 - true - - - - $(OutputPath)\$(AssemblyName).XML - - - Profile1 - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ix/Tests/App.cs b/Ix/Tests/App.cs deleted file mode 100644 index 3f27e96..0000000 --- a/Ix/Tests/App.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if SILVERLIGHT && !SILVERLIGHTM7 -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Browser; -using Microsoft.Silverlight.Testing; - -namespace InteractiveTests -{ - public class App : Application - { - public App() - { - this.Startup += (o, e) => - { - // TODO: Investigate UnitTestSettings configuration of TestService and LogProviders. - // var settings = new UnitTestSettings { StartRunImmediately = true }; - RootVisual = UnitTestSystem.CreateTestPage(/* settings */); - }; - - this.UnhandledException += (o, e) => - { - if (!Debugger.IsAttached) - { - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - }; - } - - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Aggregates.cs b/Ix/Tests/AsyncTests.Aggregates.cs deleted file mode 100644 index 1e43178..0000000 --- a/Ix/Tests/AsyncTests.Aggregates.cs +++ /dev/null @@ -1,2168 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections; -using System.Threading; - -namespace Tests -{ - public partial class AsyncTests - { - [TestMethod] - public void Aggregate_Null() - { - AssertThrows(() => AsyncEnumerable.Aggregate(null, (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null)); - - AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, z => z)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, z => z)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null)); - - AssertThrows(() => AsyncEnumerable.Aggregate(null, (x, y) => x + y, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Aggregate(null, 0, (x, y) => x + y, z => z, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, null, z => z, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Aggregate(AsyncEnumerable.Return(42), 0, (x, y) => x + y, null, CancellationToken.None)); - } - - [TestMethod] - public void Aggregate1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate((x, y) => x * y); - Assert.AreEqual(ys.Result, 24); - } - - [TestMethod] - public void Aggregate2() - { - var xs = new int[0].ToAsyncEnumerable(); - var ys = xs.Aggregate((x, y) => x * y); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Aggregate3() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Aggregate((x, y) => x * y); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate((x, y) => { throw ex; }); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate5() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => x * y); - Assert.AreEqual(ys.Result, 24); - } - - [TestMethod] - public void Aggregate6() - { - var xs = new int[0].ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => x * y); - Assert.AreEqual(ys.Result, 1); - } - - [TestMethod] - public void Aggregate7() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Aggregate(1, (x, y) => x * y); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate8() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => { throw ex; }); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate9() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); - Assert.AreEqual(ys.Result, 25); - } - - [TestMethod] - public void Aggregate10() - { - var xs = new int[0].ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); - Assert.AreEqual(ys.Result, 2); - } - - [TestMethod] - public void Aggregate11() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate12() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => { throw ex; }, x => x + 1); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Aggregate13() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Aggregate(1, (x, y) => x * y, x => { throw ex; }); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Count_Null() - { - AssertThrows(() => AsyncEnumerable.Count(null)); - AssertThrows(() => AsyncEnumerable.Count(null, x => true)); - AssertThrows(() => AsyncEnumerable.Count(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Count(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Count(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Count(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void Count1() - { - Assert.AreEqual(new int[0].ToAsyncEnumerable().Count().Result, 0); - Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().Count().Result, 3); - AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).Count().Wait()); - } - - [TestMethod] - public void Count2() - { - Assert.AreEqual(new int[0].ToAsyncEnumerable().Count(x => x < 3).Result, 0); - Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => x < 3).Result, 2); - AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).Count(x => x < 3).Wait()); - } - - [TestMethod] - public void Count3() - { - var ex = new Exception("Bang!"); - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => { throw ex; }); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void LongCount_Null() - { - AssertThrows(() => AsyncEnumerable.LongCount(null)); - AssertThrows(() => AsyncEnumerable.LongCount(null, x => true)); - AssertThrows(() => AsyncEnumerable.LongCount(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.LongCount(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.LongCount(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.LongCount(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void LongCount1() - { - Assert.AreEqual(new int[0].ToAsyncEnumerable().LongCount().Result, 0); - Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount().Result, 3); - AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).LongCount().Wait()); - } - - [TestMethod] - public void LongCount2() - { - Assert.AreEqual(new int[0].ToAsyncEnumerable().LongCount(x => x < 3).Result, 0); - Assert.AreEqual(new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => x < 3).Result, 2); - AssertThrows(() => AsyncEnumerable.Throw(new Exception("Bang!")).LongCount(x => x < 3).Wait()); - } - - [TestMethod] - public void LongCount3() - { - var ex = new Exception("Bang!"); - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => { throw ex; }); - AssertThrows(() => ys.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void All_Null() - { - AssertThrows(() => AsyncEnumerable.All(null, x => true)); - AssertThrows(() => AsyncEnumerable.All(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.All(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.All(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void All1() - { - var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void All2() - { - var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => x % 2 == 0); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void All3() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).All(x => x % 2 == 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void All4() - { - var ex = new Exception("Bang!"); - var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(x => { throw ex; }); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Any_Null() - { - AssertThrows(() => AsyncEnumerable.Any(null)); - AssertThrows(() => AsyncEnumerable.Any(null, x => true)); - AssertThrows(() => AsyncEnumerable.Any(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Any(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Any(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Any(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void Any1() - { - var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any(x => x % 2 == 0); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void Any2() - { - var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => x % 2 != 0); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void Any3() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).Any(x => x % 2 == 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Any4() - { - var ex = new Exception("Bang!"); - var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(x => { throw ex; }); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Any5() - { - var res = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().Any(); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void Any6() - { - var res = new int[0].ToAsyncEnumerable().Any(); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void Contains_Null() - { - AssertThrows(() => AsyncEnumerable.Contains(null, 42)); - AssertThrows(() => AsyncEnumerable.Contains(null, 42, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Contains(AsyncEnumerable.Return(42), 42, null)); - - AssertThrows(() => AsyncEnumerable.Contains(null, 42, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Contains(null, 42, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Contains(AsyncEnumerable.Return(42), 42, null, CancellationToken.None)); - } - - [TestMethod] - public void Contains1() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); - var ys = xs.Contains(3); - Assert.IsTrue(ys.Result); - } - - [TestMethod] - public void Contains2() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); - var ys = xs.Contains(6); - Assert.IsFalse(ys.Result); - } - - [TestMethod] - public void Contains3() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); - var ys = xs.Contains(-3, new Eq()); - Assert.IsTrue(ys.Result); - } - - [TestMethod] - public void Contains4() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable(); - var ys = xs.Contains(-6, new Eq()); - Assert.IsFalse(ys.Result); - } - - class Eq : IEqualityComparer - { - public bool Equals(int x, int y) - { - return EqualityComparer.Default.Equals(Math.Abs(x), Math.Abs(y)); - } - - public int GetHashCode(int obj) - { - return EqualityComparer.Default.GetHashCode(Math.Abs(obj)); - } - } - - [TestMethod] - public void First_Null() - { - AssertThrows(() => AsyncEnumerable.First(null)); - AssertThrows(() => AsyncEnumerable.First(null, x => true)); - AssertThrows(() => AsyncEnumerable.First(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.First(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.First(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.First(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void First1() - { - var res = AsyncEnumerable.Empty().First(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void First2() - { - var res = AsyncEnumerable.Empty().First(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void First3() - { - var res = AsyncEnumerable.Return(42).First(x => x % 2 != 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void First4() - { - var res = AsyncEnumerable.Return(42).First(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void First5() - { - var res = AsyncEnumerable.Return(42).First(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void First6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).First(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void First7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).First(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void First8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void First9() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().First(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void FirstOrDefault_Null() - { - AssertThrows(() => AsyncEnumerable.FirstOrDefault(null)); - AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, x => true)); - AssertThrows(() => AsyncEnumerable.FirstOrDefault(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.FirstOrDefault(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.FirstOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void FirstOrDefault1() - { - var res = AsyncEnumerable.Empty().FirstOrDefault(); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void FirstOrDefault2() - { - var res = AsyncEnumerable.Empty().FirstOrDefault(x => true); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void FirstOrDefault3() - { - var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 != 0); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void FirstOrDefault4() - { - var res = AsyncEnumerable.Return(42).FirstOrDefault(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void FirstOrDefault5() - { - var res = AsyncEnumerable.Return(42).FirstOrDefault(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void FirstOrDefault6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).FirstOrDefault(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void FirstOrDefault7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).FirstOrDefault(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void FirstOrDefault8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void FirstOrDefault9() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void FirstOrDefault10() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().FirstOrDefault(x => x < 10); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void Last_Null() - { - AssertThrows(() => AsyncEnumerable.Last(null)); - AssertThrows(() => AsyncEnumerable.Last(null, x => true)); - AssertThrows(() => AsyncEnumerable.Last(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Last(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Last(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Last(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void Last1() - { - var res = AsyncEnumerable.Empty().Last(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Last2() - { - var res = AsyncEnumerable.Empty().Last(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Last3() - { - var res = AsyncEnumerable.Return(42).Last(x => x % 2 != 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Last4() - { - var res = AsyncEnumerable.Return(42).Last(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void Last5() - { - var res = AsyncEnumerable.Return(42).Last(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void Last6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).Last(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Last7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).Last(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Last8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Last(); - Assert.AreEqual(90, res.Result); - } - - [TestMethod] - public void Last9() - { - var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Last(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void LastOrDefault_Null() - { - AssertThrows(() => AsyncEnumerable.LastOrDefault(null)); - AssertThrows(() => AsyncEnumerable.LastOrDefault(null, x => true)); - AssertThrows(() => AsyncEnumerable.LastOrDefault(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.LastOrDefault(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.LastOrDefault(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.LastOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void LastOrDefault1() - { - var res = AsyncEnumerable.Empty().LastOrDefault(); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void LastOrDefault2() - { - var res = AsyncEnumerable.Empty().LastOrDefault(x => true); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void LastOrDefault3() - { - var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 != 0); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void LastOrDefault4() - { - var res = AsyncEnumerable.Return(42).LastOrDefault(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void LastOrDefault5() - { - var res = AsyncEnumerable.Return(42).LastOrDefault(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void LastOrDefault6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).LastOrDefault(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void LastOrDefault7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).LastOrDefault(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void LastOrDefault8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault(); - Assert.AreEqual(90, res.Result); - } - - [TestMethod] - public void LastOrDefault9() - { - var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void LastOrDefault10() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().LastOrDefault(x => x < 10); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void Single_Null() - { - AssertThrows(() => AsyncEnumerable.Single(null)); - AssertThrows(() => AsyncEnumerable.Single(null, x => true)); - AssertThrows(() => AsyncEnumerable.Single(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Single(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Single(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Single(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void Single1() - { - var res = AsyncEnumerable.Empty().Single(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Single2() - { - var res = AsyncEnumerable.Empty().Single(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Single3() - { - var res = AsyncEnumerable.Return(42).Single(x => x % 2 != 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Single4() - { - var res = AsyncEnumerable.Return(42).Single(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void Single5() - { - var res = AsyncEnumerable.Return(42).Single(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void Single6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).Single(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Single7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).Single(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Single8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Single9() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void Single10() - { - var res = new[] { 42, 23, 45, 90 }.ToAsyncEnumerable().Single(x => x % 2 != 0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void SingleOrDefault_Null() - { - AssertThrows(() => AsyncEnumerable.SingleOrDefault(null)); - AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, x => true)); - AssertThrows(() => AsyncEnumerable.SingleOrDefault(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.SingleOrDefault(null, x => true, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.SingleOrDefault(AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void SingleOrDefault1() - { - var res = AsyncEnumerable.Empty().SingleOrDefault(); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void SingleOrDefault2() - { - var res = AsyncEnumerable.Empty().SingleOrDefault(x => true); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void SingleOrDefault3() - { - var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 != 0); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void SingleOrDefault4() - { - var res = AsyncEnumerable.Return(42).SingleOrDefault(); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void SingleOrDefault5() - { - var res = AsyncEnumerable.Return(42).SingleOrDefault(x => x % 2 == 0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void SingleOrDefault6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).SingleOrDefault(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SingleOrDefault7() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).SingleOrDefault(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SingleOrDefault8() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void SingleOrDefault9() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x % 2 != 0); - Assert.AreEqual(45, res.Result); - } - - [TestMethod] - public void SingleOrDefault10() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => x < 10); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void SingleOrDefault11() - { - var res = new[] { 42, 45, 90 }.ToAsyncEnumerable().SingleOrDefault(x => true); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void ElementAt_Null() - { - AssertThrows(() => AsyncEnumerable.ElementAt(null, 0)); - AssertThrows(() => AsyncEnumerable.ElementAt(AsyncEnumerable.Return(42), -1)); - - AssertThrows(() => AsyncEnumerable.ElementAt(null, 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ElementAt(AsyncEnumerable.Return(42), -1, CancellationToken.None)); - } - - [TestMethod] - public void ElementAt1() - { - var res = AsyncEnumerable.Empty().ElementAt(0); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); - } - - [TestMethod] - public void ElementAt2() - { - var res = AsyncEnumerable.Return(42).ElementAt(0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void ElementAt3() - { - var res = AsyncEnumerable.Return(42).ElementAt(1); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); - } - - [TestMethod] - public void ElementAt4() - { - var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(1); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void ElementAt5() - { - var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAt(7); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentOutOfRangeException); - } - - [TestMethod] - public void ElementAt6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).ElementAt(15); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ElementAtOrDefault_Null() - { - AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(null, 0)); - AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(AsyncEnumerable.Return(42), -1)); - - AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(null, 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ElementAtOrDefault(AsyncEnumerable.Return(42), -1, CancellationToken.None)); - } - - [TestMethod] - public void ElementAtOrDefault1() - { - var res = AsyncEnumerable.Empty().ElementAtOrDefault(0); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void ElementAtOrDefault2() - { - var res = AsyncEnumerable.Return(42).ElementAtOrDefault(0); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void ElementAtOrDefault3() - { - var res = AsyncEnumerable.Return(42).ElementAtOrDefault(1); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void ElementAtOrDefault4() - { - var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(1); - Assert.AreEqual(42, res.Result); - } - - [TestMethod] - public void ElementAtOrDefault5() - { - var res = new[] { 1, 42, 3 }.ToAsyncEnumerable().ElementAtOrDefault(7); - Assert.AreEqual(0, res.Result); - } - - [TestMethod] - public void ElementAtOrDefault6() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).ElementAtOrDefault(15); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ToList_Null() - { - AssertThrows(() => AsyncEnumerable.ToList(null)); - AssertThrows(() => AsyncEnumerable.ToList(null, CancellationToken.None)); - } - - [TestMethod] - public void ToList1() - { - var xs = new[] { 42, 25, 39 }; - var res = xs.ToAsyncEnumerable().ToList(); - Assert.IsTrue(res.Result.SequenceEqual(xs)); - } - - [TestMethod] - public void ToList2() - { - var xs = AsyncEnumerable.Empty(); - var res = xs.ToList(); - Assert.IsTrue(res.Result.Count == 0); - } - - [TestMethod] - public void ToList3() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).ToList(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ToArray_Null() - { - AssertThrows(() => AsyncEnumerable.ToArray(null)); - AssertThrows(() => AsyncEnumerable.ToArray(null, CancellationToken.None)); - } - - [TestMethod] - public void ToArray1() - { - var xs = new[] { 42, 25, 39 }; - var res = xs.ToAsyncEnumerable().ToArray(); - Assert.IsTrue(res.Result.SequenceEqual(xs)); - } - - [TestMethod] - public void ToArray2() - { - var xs = AsyncEnumerable.Empty(); - var res = xs.ToArray(); - Assert.IsTrue(res.Result.Length == 0); - } - - [TestMethod] - public void ToArray3() - { - var ex = new Exception("Bang!"); - var res = AsyncEnumerable.Throw(ex).ToArray(); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ToDictionary_Null() - { - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToDictionary(null, x => 0, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToDictionary(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None)); - } - - [TestMethod] - public void ToDictionary1() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToDictionary(x => x % 2).Result; - Assert.IsTrue(res[0] == 4); - Assert.IsTrue(res[1] == 1); - } - - [TestMethod] - public void ToDictionary2() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - AssertThrows(() => xs.ToDictionary(x => x % 2).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); - } - - [TestMethod] - public void ToDictionary3() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToDictionary(x => x % 2, x => x + 1).Result; - Assert.IsTrue(res[0] == 5); - Assert.IsTrue(res[1] == 2); - } - - [TestMethod] - public void ToDictionary4() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - AssertThrows(() => xs.ToDictionary(x => x % 2, x => x + 1).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); - } - - [TestMethod] - public void ToDictionary5() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToDictionary(x => x % 2, new Eq()).Result; - Assert.IsTrue(res[0] == 4); - Assert.IsTrue(res[1] == 1); - } - - [TestMethod] - public void ToDictionary6() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - AssertThrows(() => xs.ToDictionary(x => x % 2, new Eq()).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is ArgumentException); - } - - [TestMethod] - public void ToDictionary7() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToDictionary(x => x % 2, x => x, new Eq()).Result; - Assert.IsTrue(res[0] == 4); - Assert.IsTrue(res[1] == 1); - } - - [TestMethod] - public void ToLookup_Null() - { - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, x => 0, null)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.ToLookup(null, x => 0, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), null, x => 0, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, null, EqualityComparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ToLookup(AsyncEnumerable.Return(42), x => 0, x => 0, null, CancellationToken.None)); - } - - [TestMethod] - public void ToLookup1() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(4)); - Assert.IsTrue(res[1].Contains(1)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup2() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(4)); - Assert.IsTrue(res[0].Contains(2)); - Assert.IsTrue(res[1].Contains(1)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup3() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2, x => x + 1).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(5)); - Assert.IsTrue(res[1].Contains(2)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup4() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2, x => x + 1).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(5)); - Assert.IsTrue(res[0].Contains(3)); - Assert.IsTrue(res[1].Contains(2)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup5() - { - var xs = new[] { 1, 4 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2, new Eq()).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(4)); - Assert.IsTrue(res[1].Contains(1)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup6() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2, new Eq()).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(4)); - Assert.IsTrue(res[0].Contains(2)); - Assert.IsTrue(res[1].Contains(1)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void ToLookup7() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2).Result; - foreach (var g in res) - Assert.IsTrue(g.Key == 0 || g.Key == 1); - } - - [TestMethod] - public void ToLookup8() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2).Result; - foreach (IGrouping g in (IEnumerable)res) - Assert.IsTrue(g.Key == 0 || g.Key == 1); - } - - [TestMethod] - public void ToLookup9() - { - var xs = new[] { 1, 4, 2 }.ToAsyncEnumerable(); - var res = xs.ToLookup(x => x % 2, x => x, new Eq()).Result; - Assert.IsTrue(res.Contains(0)); - Assert.IsTrue(res.Contains(1)); - Assert.IsTrue(res[0].Contains(4)); - Assert.IsTrue(res[0].Contains(2)); - Assert.IsTrue(res[1].Contains(1)); - Assert.IsTrue(res.Count == 2); - } - - [TestMethod] - public void Average_Null() - { - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x)); - - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(default(IAsyncEnumerable), x => x, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Average(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - } - - [TestMethod] - public void Average1() - { - var xs = new[] { 1, 2, 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average2() - { - var xs = new[] { 1, default(int?), 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average3() - { - var xs = new[] { 1L, 2L, 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average4() - { - var xs = new[] { 1L, default(long?), 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average5() - { - var xs = new[] { 1.0, 2.0, 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average6() - { - var xs = new[] { 1.0, default(double?), 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average7() - { - var xs = new[] { 1.0f, 2.0f, 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average8() - { - var xs = new[] { 1.0f, default(float?), 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average9() - { - var xs = new[] { 1.0m, 2.0m, 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average10() - { - var xs = new[] { 1.0m, default(decimal?), 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Average(), ys.Average().Result); - Assert.AreEqual(xs.Average(), ys.Average(x => x).Result); - } - - [TestMethod] - public void Average11() - { - var xs = new int[0]; - var ys = xs.ToAsyncEnumerable(); - AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Average12() - { - var xs = new int?[0]; - var ys = xs.ToAsyncEnumerable(); - Assert.IsNull(ys.Average().Result); - } - - [TestMethod] - public void Average13() - { - var xs = new long[0]; - var ys = xs.ToAsyncEnumerable(); - AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Average14() - { - var xs = new long?[0]; - var ys = xs.ToAsyncEnumerable(); - Assert.IsNull(ys.Average().Result); - } - - [TestMethod] - public void Average15() - { - var xs = new double[0]; - var ys = xs.ToAsyncEnumerable(); - AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Average16() - { - var xs = new double?[0]; - var ys = xs.ToAsyncEnumerable(); - Assert.IsNull(ys.Average().Result); - } - - [TestMethod] - public void Average17() - { - var xs = new float[0]; - var ys = xs.ToAsyncEnumerable(); - AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Average18() - { - var xs = new float?[0]; - var ys = xs.ToAsyncEnumerable(); - Assert.IsNull(ys.Average().Result); - } - - [TestMethod] - public void Average19() - { - var xs = new decimal[0]; - var ys = xs.ToAsyncEnumerable(); - AssertThrows(() => ys.Average().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void Average20() - { - var xs = new decimal?[0]; - var ys = xs.ToAsyncEnumerable(); - Assert.IsNull(ys.Average().Result); - } - - [TestMethod] - public void Min_Null() - { - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), Comparer.Default)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(IComparer))); - - AssertThrows(() => AsyncEnumerable.Min(default(IAsyncEnumerable), Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Min(AsyncEnumerable.Empty(), default(IComparer), CancellationToken.None)); - } - - [TestMethod] - public void Min1() - { - var xs = new[] { 2, 1, 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min2() - { - var xs = new[] { 2, default(int?), 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min3() - { - var xs = new[] { 2L, 1L, 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min4() - { - var xs = new[] { 2L, default(long?), 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min5() - { - var xs = new[] { 2.0, 1.0, 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min6() - { - var xs = new[] { 2.0, default(double?), 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min7() - { - var xs = new[] { 2.0f, 1.0f, 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min8() - { - var xs = new[] { 2.0f, default(float?), 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min9() - { - var xs = new[] { 2.0m, 1.0m, 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min10() - { - var xs = new[] { 2.0m, default(decimal?), 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Min11() - { - var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Min(), ys.Min().Result); - Assert.AreEqual(xs.Min(), ys.Min(x => x).Result); - } - - [TestMethod] - public void Max_Null() - { - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), Comparer.Default)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(IComparer))); - - AssertThrows(() => AsyncEnumerable.Max(default(IAsyncEnumerable), Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Max(AsyncEnumerable.Empty(), default(IComparer), CancellationToken.None)); - } - - [TestMethod] - public void Max1() - { - var xs = new[] { 2, 7, 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max2() - { - var xs = new[] { 2, default(int?), 3, 1 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max3() - { - var xs = new[] { 2L, 7L, 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max4() - { - var xs = new[] { 2L, default(long?), 3L, 1L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max5() - { - var xs = new[] { 2.0, 7.0, 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max6() - { - var xs = new[] { 2.0, default(double?), 3.0, 1.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max7() - { - var xs = new[] { 2.0f, 7.0f, 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max8() - { - var xs = new[] { 2.0f, default(float?), 3.0f, 1.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max9() - { - var xs = new[] { 2.0m, 7.0m, 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max10() - { - var xs = new[] { 2.0m, default(decimal?), 3.0m, 1.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Max11() - { - var xs = new[] { DateTime.Now.AddDays(1), DateTime.Now.Subtract(TimeSpan.FromDays(1)), DateTime.Now.AddDays(2), DateTime.Now }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Max(), ys.Max().Result); - Assert.AreEqual(xs.Max(), ys.Max(x => x).Result); - } - - [TestMethod] - public void Sum_Null() - { - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x)); - - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func))); - - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(default(IAsyncEnumerable), x => x, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.Sum(AsyncEnumerable.Empty(), default(Func), CancellationToken.None)); - } - - [TestMethod] - public void Sum1() - { - var xs = new[] { 1, 2, 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum2() - { - var xs = new[] { 1, default(int?), 3 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum3() - { - var xs = new[] { 1L, 2L, 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum4() - { - var xs = new[] { 1L, default(long?), 3L }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum5() - { - var xs = new[] { 1.0, 2.0, 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum6() - { - var xs = new[] { 1.0, default(double?), 3.0 }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum7() - { - var xs = new[] { 1.0f, 2.0f, 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum8() - { - var xs = new[] { 1.0f, default(float?), 3.0f }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum9() - { - var xs = new[] { 1.0m, 2.0m, 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void Sum10() - { - var xs = new[] { 1.0m, default(decimal?), 3.0m }; - var ys = xs.ToAsyncEnumerable(); - Assert.AreEqual(xs.Sum(), ys.Sum().Result); - Assert.AreEqual(xs.Sum(), ys.Sum(x => x).Result); - } - - [TestMethod] - public void MinBy_Null() - { - AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func))); - - AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default(IComparer))); - - AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.MinBy(default(IAsyncEnumerable), x => x, Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MinBy(AsyncEnumerable.Return(42), x => x, default(IComparer), CancellationToken.None)); - } - - [TestMethod] - public void MinBy1() - { - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => x / 2); - var res = xs.Result; - - Assert.IsTrue(res.SequenceEqual(new[] { 3, 2 })); - } - - [TestMethod] - public void MinBy2() - { - var xs = new int[0].ToAsyncEnumerable().MinBy(x => x / 2); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void MinBy3() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 3) throw ex; return x; }); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void MinBy4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MinBy(x => { if (x == 4) throw ex; return x; }); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void MinBy5() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)).MinBy(x => x, Comparer.Default); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void MaxBy_Null() - { - AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func))); - - AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default(IComparer))); - - AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.MaxBy(default(IAsyncEnumerable), x => x, Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), default(Func), Comparer.Default, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.MaxBy(AsyncEnumerable.Return(42), x => x, default(IComparer), CancellationToken.None)); - } - - [TestMethod] - public void MaxBy1() - { - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => x / 2); - var res = xs.Result; - - Assert.IsTrue(res.SequenceEqual(new[] { 7, 6 })); - } - - [TestMethod] - public void MaxBy2() - { - var xs = new int[0].ToAsyncEnumerable().MaxBy(x => x / 2); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is InvalidOperationException); - } - - [TestMethod] - public void MaxBy3() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 3) throw ex; return x; }); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void MaxBy4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().MaxBy(x => { if (x == 4) throw ex; return x; }); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void MaxBy5() - { - var ex = new Exception("Bang!"); - var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)).MaxBy(x => x, Comparer.Default); - - AssertThrows(() => xs.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Bugs.cs b/Ix/Tests/AsyncTests.Bugs.cs deleted file mode 100644 index 61ae7aa..0000000 --- a/Ix/Tests/AsyncTests.Bugs.cs +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections; -using System.Threading; -using System.Threading.Tasks; -using System.Diagnostics; -//using System.Reactive.Linq; -//using System.Reactive.Concurrency; - -namespace Tests -{ - public partial class AsyncTests - { - [TestInitialize] - public void InitTests() - { - TaskScheduler.UnobservedTaskException += (o, e) => - { - }; - } - - /* - [TestMethod] - public void TestPushPopAsync() - { - var stack = new Stack(); - var count = 10; - - var observable = Observable.Generate( - 0, - i => i < count, - i => i + 1, - i => i, - i => TimeSpan.FromMilliseconds(1), // change this to 0 to avoid the problem [1] - Scheduler.ThreadPool); - - var task = DoSomethingAsync(observable, stack); - - // we give it a timeout so the test can fail instead of hang - task.Wait(TimeSpan.FromSeconds(2)); - - Assert.AreEqual(10, stack.Count); - } - - private Task DoSomethingAsync(IObservable observable, Stack stack) - { - var ae = observable - .ToAsyncEnumerable() - //.Do(i => Debug.WriteLine("Bug-fixing side effect: " + i)) // [2] - .GetEnumerator(); - - var tcs = new TaskCompletionSource(); - - var a = default(Action); - a = new Action(() => - { - ae.MoveNext().ContinueWith(t => - { - if (t.Result) - { - var i = ae.Current; - Debug.WriteLine("Doing something with " + i); - Thread.Sleep(50); - stack.Push(i); - a(); - } - else - tcs.TrySetResult(null); - }); - }); - - a(); - - return tcs.Task; - } - */ - - static IEnumerable Xs(Action a) - { - try - { - var rnd = new Random(); - - while (true) - { - yield return rnd.Next(0, 43); - Thread.Sleep(rnd.Next(0, 500)); - } - } - finally - { - a(); - } - } - - [TestMethod] - public void CorrectDispose() - { - var disposed = false; - - var xs = new[] { 1, 2, 3 }.WithDispose(() => - { - disposed = true; - }).ToAsyncEnumerable(); - - var ys = xs.Select(x => x + 1); - - var e = ys.GetEnumerator(); - e.Dispose(); - - Assert.IsTrue(disposed); - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void DisposesUponError() - { - var disposed = false; - - var xs = new[] { 1, 2, 3 }.WithDispose(() => - { - disposed = true; - }).ToAsyncEnumerable(); - - var ex = new Exception("Bang!"); - var ys = xs.Select(x => { if (x == 1) throw ex; return x; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext()); - - Assert.IsTrue(disposed); - } - - [TestMethod] - public void CorrectCancel() - { - var disposed = false; - - var xs = new[] { 1, 2, 3 }.WithDispose(() => - { - disposed = true; - }).ToAsyncEnumerable(); - - var ys = xs.Select(x => x + 1).Where(x => true); - - var e = ys.GetEnumerator(); - var cts = new CancellationTokenSource(); - var t = e.MoveNext(cts.Token); - - cts.Cancel(); - - try - { - t.Wait(); - } - catch - { - // Don't care about the outcome; we could have made it to element 1 - // but we could also have cancelled the MoveNext-calling task. Either - // way, we want to wait for the task to be completed and check that - } - finally - { - // the cancellation bubbled all the way up to the source to dispose - // it. This design is chosen because cancelling a MoveNext call leaves - // the enumerator in an indeterminate state. Further interactions with - // it should be forbidden. - Assert.IsTrue(disposed); - } - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void CanCancelMoveNext() - { - var evt = new ManualResetEvent(false); - var xs = Blocking(evt).ToAsyncEnumerable().Select(x => x).Where(x => true); - - var e = xs.GetEnumerator(); - var cts = new CancellationTokenSource(); - var t = e.MoveNext(cts.Token); - - cts.Cancel(); - - try - { - t.Wait(); - Assert.Fail(); - } - catch - { - Assert.IsTrue(t.IsCanceled); - } - - evt.Set(); - } - - static IEnumerable Blocking(ManualResetEvent evt) - { - evt.WaitOne(); - yield return 42; - } - } - - static class MyExt - { - public static IEnumerable WithDispose(this IEnumerable source, Action a) - { - return EnumerableEx.Create(() => - { - var e = source.GetEnumerator(); - return new Enumerator(e.MoveNext, () => e.Current, () => { e.Dispose(); a(); }); - }); - } - - class Enumerator : IEnumerator - { - private readonly Func _moveNext; - private readonly Func _current; - private readonly Action _dispose; - - public Enumerator(Func moveNext, Func current, Action dispose) - { - _moveNext = moveNext; - _current = current; - _dispose = dispose; - } - - public T Current - { - get { return _current(); } - } - - public void Dispose() - { - _dispose(); - } - - object IEnumerator.Current - { - get { return Current; } - } - - public bool MoveNext() - { - return _moveNext(); - } - - public void Reset() - { - throw new NotImplementedException(); - } - } - - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Conversions.cs b/Ix/Tests/AsyncTests.Conversions.cs deleted file mode 100644 index 1c1c2a2..0000000 --- a/Ix/Tests/AsyncTests.Conversions.cs +++ /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. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading; - -namespace Tests -{ - public partial class AsyncTests - { - [TestMethod] - public void ToAsyncEnumerable_Null() - { - AssertThrows(() => AsyncEnumerable.ToAsyncEnumerable(default(IEnumerable))); - AssertThrows(() => AsyncEnumerable.ToAsyncEnumerable(default(IObservable))); - } - - [TestMethod] - public void ToAsyncEnumerable1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void ToAsyncEnumerable2() - { - var ex = new Exception("Bang"); - var xs = ToAsyncEnumerable_Sequence(ex).ToAsyncEnumerable(); - var e = xs.GetEnumerator(); - HasNext(e, 42); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - - private IEnumerable ToAsyncEnumerable_Sequence(Exception e) - { - yield return 42; - throw e; - } - - [TestMethod] - public void ToAsyncEnumerable3() - { - var subscribed = false; - - var xs = new MyObservable(obs => - { - subscribed = true; - - obs.OnNext(42); - obs.OnCompleted(); - - return new MyDisposable(() => { }); - }).ToAsyncEnumerable(); - - Assert.IsFalse(subscribed); - - var e = xs.GetEnumerator(); - - Assert.IsTrue(subscribed); - - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void ToAsyncEnumerable4() - { - var ex = new Exception("Bang!"); - var subscribed = false; - - var xs = new MyObservable(obs => - { - subscribed = true; - - obs.OnError(ex); - - return new MyDisposable(() => { }); - }).ToAsyncEnumerable(); - - Assert.IsFalse(subscribed); - - var e = xs.GetEnumerator(); - - Assert.IsTrue(subscribed); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - - class MyObservable : IObservable - { - private Func, IDisposable> _subscribe; - - public MyObservable(Func, IDisposable> subscribe) - { - _subscribe = subscribe; - } - - public IDisposable Subscribe(IObserver observer) - { - return _subscribe(observer); - } - } - - class MyDisposable : IDisposable - { - private Action _dispose; - - public MyDisposable(Action dispose) - { - _dispose = dispose; - } - - public void Dispose() - { - _dispose(); - } - } - - [TestMethod] - public void ToEnumerable_Null() - { - AssertThrows(() => AsyncEnumerable.ToEnumerable(null)); - } - - [TestMethod] - public void ToEnumerable1() - { - var xs = AsyncEnumerable.Return(42).ToEnumerable(); - Assert.IsTrue(xs.SequenceEqual(new[] { 42 })); - } - - [TestMethod] - public void ToEnumerable2() - { - var xs = AsyncEnumerable.Empty().ToEnumerable(); - Assert.IsTrue(xs.SequenceEqual(new int[0])); - } - - [TestMethod] - public void ToEnumerable3() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex).ToEnumerable(); - AssertThrows(() => xs.GetEnumerator().MoveNext(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - -#if !NO_RXINTERFACES - [TestMethod] - public void ToObservable_Null() - { - AssertThrows(() => AsyncEnumerable.ToObservable(null)); - } - - [TestMethod] - public void ToObservable1() - { - var fail = false; - var evt = new ManualResetEvent(false); - - var xs = AsyncEnumerable.Empty().ToObservable(); - xs.Subscribe(new MyObserver( - x => - { - fail = true; - }, - ex => - { - fail = true; - evt.Set(); - }, - () => - { - evt.Set(); - } - )); - - evt.WaitOne(); - Assert.IsFalse(fail); - } - - [TestMethod] - public void ToObservable2() - { - var lst = new List(); - var fail = false; - var evt = new ManualResetEvent(false); - - var xs = AsyncEnumerable.Return(42).ToObservable(); - xs.Subscribe(new MyObserver( - x => - { - lst.Add(x); - }, - ex => - { - fail = true; - evt.Set(); - }, - () => - { - evt.Set(); - } - )); - - evt.WaitOne(); - Assert.IsFalse(fail); - Assert.IsTrue(lst.SequenceEqual(new[] { 42 })); - } - - [TestMethod] - public void ToObservable3() - { - var lst = new List(); - var fail = false; - var evt = new ManualResetEvent(false); - - var xs = AsyncEnumerable.Range(0, 10).ToObservable(); - xs.Subscribe(new MyObserver( - x => - { - lst.Add(x); - }, - ex => - { - fail = true; - evt.Set(); - }, - () => - { - evt.Set(); - } - )); - - evt.WaitOne(); - Assert.IsFalse(fail); - Assert.IsTrue(lst.SequenceEqual(Enumerable.Range(0, 10))); - } - - [TestMethod] - public void ToObservable4() - { - var ex1 = new Exception("Bang!"); - var ex_ = default(Exception); - var fail = false; - var evt = new ManualResetEvent(false); - - var xs = AsyncEnumerable.Throw(ex1).ToObservable(); - xs.Subscribe(new MyObserver( - x => - { - fail = true; - }, - ex => - { - ex_ = ex; - evt.Set(); - }, - () => - { - fail = true; - evt.Set(); - } - )); - - evt.WaitOne(); - Assert.IsFalse(fail); - Assert.AreEqual(ex1, ((AggregateException)ex_).InnerExceptions.Single()); - } - - class MyObserver : IObserver - { - private Action _onNext; - private Action _onError; - private Action _onCompleted; - - public MyObserver(Action onNext, Action onError, Action onCompleted) - { - _onNext = onNext; - _onError = onError; - _onCompleted = onCompleted; - } - - public void OnCompleted() - { - _onCompleted(); - } - - public void OnError(Exception error) - { - _onError(error); - } - - public void OnNext(T value) - { - _onNext(value); - } - } -#endif - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Creation.cs b/Ix/Tests/AsyncTests.Creation.cs deleted file mode 100644 index 32e849a..0000000 --- a/Ix/Tests/AsyncTests.Creation.cs +++ /dev/null @@ -1,409 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading.Tasks; -using System.Threading; - -namespace Tests -{ - static class Ext - { - public static Task MoveNext(this IAsyncEnumerator enumerator) - { - return enumerator.MoveNext(CancellationToken.None); - } - } - - public partial class AsyncTests - { - [TestMethod] - public void Return() - { - var xs = AsyncEnumerable.Return(42); - HasNext(xs.GetEnumerator(), 42); - } - - [TestMethod] - public void Never() - { - var xs = AsyncEnumerable.Never(); - - var e = xs.GetEnumerator(); - Assert.IsFalse(e.MoveNext().IsCompleted); // Very rudimentary check - AssertThrows(() => Nop(e.Current)); - e.Dispose(); - } - - [TestMethod] - public void Empty1() - { - var xs = AsyncEnumerable.Empty(); - NoNext(xs.GetEnumerator()); - } - - [TestMethod] - public void Empty2() - { - var xs = AsyncEnumerable.Empty(); - - var e = xs.GetEnumerator(); - Assert.IsFalse(e.MoveNext().Result); - AssertThrows(() => Nop(e.Current)); - } - - [TestMethod] - public void Throw_Null() - { - AssertThrows(() => AsyncEnumerable.Throw(null)); - } - - [TestMethod] - public void Throw() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - AssertThrows(() => Nop(e.Current)); - } - - private void Nop(object o) - { - } - - [TestMethod] - public void Range_Null() - { - AssertThrows(() => AsyncEnumerable.Range(0, -1)); - } - - [TestMethod] - public void Range1() - { - var xs = AsyncEnumerable.Range(2, 5); - - var e = xs.GetEnumerator(); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Range2() - { - var xs = AsyncEnumerable.Range(2, 0); - - var e = xs.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Repeat_Null() - { - AssertThrows(() => AsyncEnumerable.Repeat(0, -1)); - } - - [TestMethod] - public void Repeat1() - { - var xs = AsyncEnumerable.Repeat(2, 5); - - var e = xs.GetEnumerator(); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void Repeat2() - { - var xs = AsyncEnumerable.Repeat(2, 0); - - var e = xs.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Repeat3() - { - var xs = AsyncEnumerable.Repeat(2); - - var e = xs.GetEnumerator(); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 2); - e.Dispose(); - } - - [TestMethod] - public void Defer_Null() - { - AssertThrows(() => AsyncEnumerable.Defer(null)); - } - - [TestMethod] - public void Defer1() - { - var x = 0; - var xs = AsyncEnumerable.Defer(() => new[] { x }.ToAsyncEnumerable()); - - { - var e = xs.GetEnumerator(); - HasNext(e, 0); - NoNext(e); - } - - { - x++; - var e = xs.GetEnumerator(); - HasNext(e, 1); - NoNext(e); - } - } - - [TestMethod] - public void Generate_Null() - { - AssertThrows(() => AsyncEnumerable.Generate(0, null, x => x, x => x)); - AssertThrows(() => AsyncEnumerable.Generate(0, x => true, null, x => x)); - AssertThrows(() => AsyncEnumerable.Generate(0, x => true, x => x, null)); - } - - [TestMethod] - public void Generate1() - { - var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x); - - var e = xs.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 1); - HasNext(e, 4); - HasNext(e, 9); - HasNext(e, 16); - NoNext(e); - e.Dispose(); - } - - [TestMethod] - public void Generate2() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Generate(0, x => { throw ex; }, x => x + 1, x => x * x); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Generate3() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Generate(0, x => true, x => x + 1, x => { if (x == 1) throw ex; return x * x; }); - - var e = xs.GetEnumerator(); - HasNext(e, 0); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Generate4() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Generate(0, x => true, x => { throw ex; }, x => x * x); - - var e = xs.GetEnumerator(); - HasNext(e, 0); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Using_Null() - { - AssertThrows(() => AsyncEnumerable.Using(null, _ => null)); - AssertThrows(() => AsyncEnumerable.Using(() => new MyD(null), null)); - } - - [TestMethod] - public void Using1() - { - var i = 0; - var d = 0; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { d++; }); - }, - _ => AsyncEnumerable.Return(42) - ); - - Assert.AreEqual(0, i); - - var e = xs.GetEnumerator(); - Assert.AreEqual(1, i); - } - - [TestMethod] - public void Using2() - { - var i = 0; - var d = 0; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { d++; }); - }, - _ => AsyncEnumerable.Return(42) - ); - - Assert.AreEqual(0, i); - - var e = xs.GetEnumerator(); - Assert.AreEqual(1, i); - - e.Dispose(); - Assert.AreEqual(1, d); - } - - [TestMethod] - public void Using3() - { - var ex = new Exception("Bang!"); - var i = 0; - var d = 0; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { d++; }); - }, - _ => { throw ex; } - ); - - Assert.AreEqual(0, i); - - AssertThrows(() => xs.GetEnumerator(), ex_ => ex_ == ex); - - Assert.AreEqual(1, d); - } - - [TestMethod] - public void Using4() - { - var i = 0; - var disposed = false; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { disposed = true; }); - }, - _ => AsyncEnumerable.Return(42) - ); - - Assert.AreEqual(0, i); - - var e = xs.GetEnumerator(); - Assert.AreEqual(1, i); - - HasNext(e, 42); - NoNext(e); - - Assert.IsTrue(disposed); - } - - [TestMethod] - public void Using5() - { - var ex = new Exception("Bang!"); - var i = 0; - var disposed = false; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { disposed = true; }); - }, - _ => AsyncEnumerable.Throw(ex) - ); - - Assert.AreEqual(0, i); - - var e = xs.GetEnumerator(); - Assert.AreEqual(1, i); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - - Assert.IsTrue(disposed); - } - - [TestMethod] - public void Using6() - { - var i = 0; - var disposed = false; - - var xs = AsyncEnumerable.Using( - () => - { - i++; - return new MyD(() => { disposed = true; }); - }, - _ => AsyncEnumerable.Range(0, 10) - ); - - Assert.AreEqual(0, i); - - var e = xs.GetEnumerator(); - Assert.AreEqual(1, i); - - HasNext(e, 0); - HasNext(e, 1); - - var cts = new CancellationTokenSource(); - var t = e.MoveNext(cts.Token); - cts.Cancel(); - - t.Wait(); - - Assert.IsTrue(disposed); - } - - class MyD : IDisposable - { - private readonly Action _dispose; - - public MyD(Action dispose) - { - _dispose = dispose; - } - - public void Dispose() - { - _dispose(); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Exceptions.cs b/Ix/Tests/AsyncTests.Exceptions.cs deleted file mode 100644 index f7c8a8f..0000000 --- a/Ix/Tests/AsyncTests.Exceptions.cs +++ /dev/null @@ -1,551 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading; - -namespace Tests -{ - public partial class AsyncTests - { - [TestMethod] - public void Catch_Null() - { - AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable), x => null)); - AssertThrows(() => AsyncEnumerable.Catch(AsyncEnumerable.Return(42), default(Func>))); - - AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.Catch(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Catch(default(IAsyncEnumerable[]))); - AssertThrows(() => AsyncEnumerable.Catch(default(IEnumerable>))); - } - - [TestMethod] - public void Catch1() - { - var err = false; - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = xs.Catch(ex_ => { err = true; return ys; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - NoNext(e); - - Assert.IsFalse(err); - } - - [TestMethod] - public void Catch2() - { - var ex = new InvalidOperationException("Bang!"); - - var err = false; - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = xs.Catch(ex_ => { err = true; return ys; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - Assert.IsFalse(err); - - HasNext(e, 4); - - Assert.IsTrue(err); - - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Catch3() - { - var ex = new InvalidOperationException("Bang!"); - - var err = false; - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = xs.Catch(ex_ => { err = true; return ys; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - Assert.IsFalse(err); - - HasNext(e, 4); - - Assert.IsTrue(err); - - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Catch4() - { - var ex = new DivideByZeroException(); - - var err = false; - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = xs.Catch(ex_ => { err = true; return ys; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - - Assert.IsFalse(err); - } - - [TestMethod] - public void Catch5() - { - var ex = new InvalidOperationException("Bang!"); - var ex2 = new Exception("Oops!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = xs.Catch(ex_ => { if (ex_.Message == "Bang!") throw ex2; return ys; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex2); - } - - [TestMethod] - public void Catch6() - { - var ex = new InvalidOperationException("Bang!"); - - var err = false; - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - - var res = xs.Catch(ex_ => { err = true; return xs; }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - Assert.IsFalse(err); - - HasNext(e, 1); - - Assert.IsTrue(err); - - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Catch7() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.Catch(xs, ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - NoNext(e); - } - - [TestMethod] - public void Catch8() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.Catch(xs, ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Catch9() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.Catch(new[] { xs, xs, ys, ys }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Catch10() - { - var res = CatchXss().Catch(); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - } - - private IEnumerable> CatchXss() - { - yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(new Exception("!!!"))); - throw new Exception("Bang!"); - } - - [TestMethod] - public void Catch11() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - - var res = AsyncEnumerable.Catch(new[] { xs, xs }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Catch12() - { - var res = AsyncEnumerable.Catch(Enumerable.Empty>()); - - var e = res.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Finally_Null() - { - AssertThrows(() => AsyncEnumerable.Finally(default(IAsyncEnumerable), () => { })); - AssertThrows(() => AsyncEnumerable.Finally(AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Finally1() - { - var b = false; - - var xs = AsyncEnumerable.Empty().Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - Assert.IsFalse(b); - NoNext(e); - - Assert.IsTrue(b); - } - - [TestMethod] - public void Finally2() - { - var b = false; - - var xs = AsyncEnumerable.Return(42).Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - Assert.IsFalse(b); - HasNext(e, 42); - - Assert.IsFalse(b); - NoNext(e); - - Assert.IsTrue(b); - } - - [TestMethod] - public void Finally3() - { - var ex = new Exception("Bang!"); - - var b = false; - - var xs = AsyncEnumerable.Throw(ex).Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - Assert.IsFalse(b); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - - Assert.IsTrue(b); - } - - [TestMethod] - public void Finally4() - { - var b = false; - - var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - Assert.IsFalse(b); - HasNext(e, 1); - - Assert.IsFalse(b); - HasNext(e, 2); - - Assert.IsFalse(b); - NoNext(e); - - Assert.IsTrue(b); - } - - [TestMethod] - public void Finally5() - { - var b = false; - - var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - Assert.IsFalse(b); - HasNext(e, 1); - - e.Dispose(); - - Assert.IsTrue(b); - } - - [TestMethod] - public void Finally6() - { - var b = false; - - var xs = new[] { 1, 2 }.ToAsyncEnumerable().Finally(() => { b = true; }); - - var e = xs.GetEnumerator(); - - var cts = new CancellationTokenSource(); - - var t = e.MoveNext(cts.Token); - cts.Cancel(); - t.Wait(); - - Assert.IsTrue(b); - } - - [TestMethod] - public void OnErrorResumeNext_Null() - { - AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IAsyncEnumerable[]))); - AssertThrows(() => AsyncEnumerable.OnErrorResumeNext(default(IEnumerable>))); - } - - [TestMethod] - public void OnErrorResumeNext7() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.OnErrorResumeNext(xs, ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void OnErrorResumeNext8() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.OnErrorResumeNext(xs, ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void OnErrorResumeNext9() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs, ys, ys }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void OnErrorResumeNext10() - { - var res = OnErrorResumeNextXss().OnErrorResumeNext(); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - } - - private IEnumerable> OnErrorResumeNextXss() - { - yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(new Exception("!!!"))); - throw new Exception("Bang!"); - } - - [TestMethod] - public void OnErrorResumeNext11() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - - var res = AsyncEnumerable.OnErrorResumeNext(new[] { xs, xs }); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - NoNext(e); - } - - [TestMethod] - public void OnErrorResumeNext12() - { - var res = AsyncEnumerable.OnErrorResumeNext(Enumerable.Empty>()); - - var e = res.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Retry_Null() - { - AssertThrows(() => AsyncEnumerable.Retry(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.Retry(default(IAsyncEnumerable), 1)); - AssertThrows(() => AsyncEnumerable.Retry(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void Retry1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - - var res = xs.Retry(); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - NoNext(e); - } - - [TestMethod] - public void Retry2() - { - var ex = new InvalidOperationException("Bang!"); - - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - - var res = xs.Retry(); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Multiple.cs b/Ix/Tests/AsyncTests.Multiple.cs deleted file mode 100644 index 1ddd56f..0000000 --- a/Ix/Tests/AsyncTests.Multiple.cs +++ /dev/null @@ -1,787 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading; - -namespace Tests -{ - public partial class AsyncTests - { - [TestMethod] - public void Concat_Null() - { - AssertThrows(() => AsyncEnumerable.Concat(null, AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.Concat(AsyncEnumerable.Return(42), null)); - AssertThrows(() => AsyncEnumerable.Concat(default(IAsyncEnumerable[]))); - AssertThrows(() => AsyncEnumerable.Concat(default(IEnumerable>))); - } - - [TestMethod] - public void Concat1() - { - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Concat2() - { - var ex = new Exception("Bang"); - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw(ex)); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Concat3() - { - var ex = new Exception("Bang"); - var ys = AsyncEnumerable.Throw(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Concat4() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5 }.ToAsyncEnumerable(); - var zs = new[] { 6, 7, 8 }.ToAsyncEnumerable(); - - var res = AsyncEnumerable.Concat(xs, ys, zs); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - HasNext(e, 7); - HasNext(e, 8); - NoNext(e); - } - - [TestMethod] - public void Concat5() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5 }.ToAsyncEnumerable(); - var zs = AsyncEnumerable.Throw(ex); - - var res = AsyncEnumerable.Concat(xs, ys, zs); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Concat6() - { - var res = AsyncEnumerable.Concat(ConcatXss()); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - } - - static IEnumerable> ConcatXss() - { - yield return new[] { 1, 2, 3 }.ToAsyncEnumerable(); - yield return new[] { 4, 5 }.ToAsyncEnumerable(); - throw new Exception("Bang!"); - } - - [TestMethod] - public void Zip_Null() - { - AssertThrows(() => AsyncEnumerable.Zip(null, AsyncEnumerable.Return(42), (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Zip(AsyncEnumerable.Return(42), null, (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Zip(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Zip1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - var res = xs.Zip(ys, (x, y) => x * y); - - var e = res.GetEnumerator(); - HasNext(e, 1 * 4); - HasNext(e, 2 * 5); - HasNext(e, 3 * 6); - NoNext(e); - } - - [TestMethod] - public void Zip2() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6, 7 }.ToAsyncEnumerable(); - var res = xs.Zip(ys, (x, y) => x * y); - - var e = res.GetEnumerator(); - HasNext(e, 1 * 4); - HasNext(e, 2 * 5); - HasNext(e, 3 * 6); - NoNext(e); - } - - [TestMethod] - public void Zip3() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable(); - var res = xs.Zip(ys, (x, y) => x * y); - - var e = res.GetEnumerator(); - HasNext(e, 1 * 4); - HasNext(e, 2 * 5); - HasNext(e, 3 * 6); - NoNext(e); - } - - [TestMethod] - public void Zip4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = AsyncEnumerable.Throw(ex); - var res = xs.Zip(ys, (x, y) => x * y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Zip5() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.Zip(ys, (x, y) => x * y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Zip6() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.Zip(ys, (x, y) => { if (x > 0) throw ex; return x * y; }); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Union_Null() - { - AssertThrows(() => AsyncEnumerable.Union(null, AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Union(null, AsyncEnumerable.Return(42), new Eq())); - AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), null, new Eq())); - AssertThrows(() => AsyncEnumerable.Union(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Union1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); - var res = xs.Union(ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 5); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Union2() - { - var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); - var res = xs.Union(ys, new Eq()); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, -3); - HasNext(e, 5); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Intersect_Null() - { - AssertThrows(() => AsyncEnumerable.Intersect(null, AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Intersect(null, AsyncEnumerable.Return(42), new Eq())); - AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), null, new Eq())); - AssertThrows(() => AsyncEnumerable.Intersect(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Intersect1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); - var res = xs.Intersect(ys); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 3); - NoNext(e); - } - - [TestMethod] - public void Intersect2() - { - var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); - var res = xs.Intersect(ys, new Eq()); - - var e = res.GetEnumerator(); - HasNext(e, 1); - HasNext(e, -3); - NoNext(e); - } - - [TestMethod] - public void Except_Null() - { - AssertThrows(() => AsyncEnumerable.Except(null, AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Except(null, AsyncEnumerable.Return(42), new Eq())); - AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), null, new Eq())); - AssertThrows(() => AsyncEnumerable.Except(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Except1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, 1, 4 }.ToAsyncEnumerable(); - var res = xs.Except(ys); - - var e = res.GetEnumerator(); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void Except2() - { - var xs = new[] { 1, 2, -3 }.ToAsyncEnumerable(); - var ys = new[] { 3, 5, -1, 4 }.ToAsyncEnumerable(); - var res = xs.Except(ys, new Eq()); - - var e = res.GetEnumerator(); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void SequenceEqual_Null() - { - AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), new Eq())); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, new Eq())); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, CancellationToken.None)); - - AssertThrows(() => AsyncEnumerable.SequenceEqual(null, AsyncEnumerable.Return(42), new Eq(), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), null, new Eq(), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.SequenceEqual(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, CancellationToken.None)); - } - - [TestMethod] - public void SequenceEqual1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(xs); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void SequenceEqual2() - { - var xs = AsyncEnumerable.Empty(); - var res = xs.SequenceEqual(xs); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void SequenceEqual3() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual4() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual5() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual6() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = AsyncEnumerable.Throw(ex); - var res = xs.SequenceEqual(ys); - - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SequenceEqual7() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys); - - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SequenceEqual8() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(xs, new Eq()); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void SequenceEqual9() - { - var xs = AsyncEnumerable.Empty(); - var res = xs.SequenceEqual(xs, new Eq()); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void SequenceEqual10() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 1, 3, 2 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new Eq()); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual11() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new Eq()); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual12() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new Eq()); - Assert.IsFalse(res.Result); - } - - [TestMethod] - public void SequenceEqual13() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = AsyncEnumerable.Throw(ex); - var res = xs.SequenceEqual(ys, new Eq()); - - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SequenceEqual14() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new Eq()); - - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SequenceEqual15() - { - var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new Eq()); - Assert.IsTrue(res.Result); - } - - [TestMethod] - public void SequenceEqual16() - { - var xs = new[] { 1, 2, -3, 4 }.ToAsyncEnumerable(); - var ys = new[] { 1, -2, 3, 4 }.ToAsyncEnumerable(); - var res = xs.SequenceEqual(ys, new EqEx()); - AssertThrows(() => res.Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); - } - - class EqEx : IEqualityComparer - { - public bool Equals(int x, int y) - { - throw new NotImplementedException(); - } - - public int GetHashCode(int obj) - { - throw new NotImplementedException(); - } - } - - [TestMethod] - public void GroupJoin_Null() - { - AssertThrows(() => AsyncEnumerable.GroupJoin(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null)); - - AssertThrows(() => AsyncEnumerable.GroupJoin(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupJoin(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default(IEqualityComparer))); - } - - [TestMethod] - public void GroupJoin1() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 4, 7, 6, 2, 3, 4, 8, 9 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - HasNext(e, "0 - 639"); - HasNext(e, "1 - 474"); - HasNext(e, "2 - 28"); - NoNext(e); - } - - [TestMethod] - public void GroupJoin2() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - HasNext(e, "0 - 36"); - HasNext(e, "1 - 4"); - HasNext(e, "2 - "); - NoNext(e); - } - - [TestMethod] - public void GroupJoin3() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupJoin4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = AsyncEnumerable.Throw(ex); - - var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupJoin5() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => { throw ex; }, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupJoin6() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => x % 3, y => { throw ex; }, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupJoin7() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => { - if (x == 1) - throw ex; - return x + " - " + i.Aggregate("", (s, j) => s + j).Result; - }); - - var e = res.GetEnumerator(); - HasNext(e, "0 - 36"); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Join_Null() - { - AssertThrows(() => AsyncEnumerable.Join(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null)); - - AssertThrows(() => AsyncEnumerable.Join(null, AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), null, x => x, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), null, x => x, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, null, (x, y) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Join(AsyncEnumerable.Return(42), AsyncEnumerable.Return(42), x => x, x => x, (x, y) => x, default(IEqualityComparer))); - } - - [TestMethod] - public void Join1() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - HasNext(e, 0 + 3); - HasNext(e, 0 + 6); - HasNext(e, 1 + 4); - NoNext(e); - } - - [TestMethod] - public void Join2() - { - var xs = new[] { 3, 6, 4 }.ToAsyncEnumerable(); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - HasNext(e, 3 + 0); - HasNext(e, 6 + 0); - HasNext(e, 4 + 1); - NoNext(e); - } - - [TestMethod] - public void Join3() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 6 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - HasNext(e, 0 + 3); - HasNext(e, 0 + 6); - NoNext(e); - } - - [TestMethod] - public void Join4() - { - var xs = new[] { 3, 6 }.ToAsyncEnumerable(); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - HasNext(e, 3 + 0); - HasNext(e, 6 + 0); - NoNext(e); - } - - [TestMethod] - public void Join5() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Join6() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = AsyncEnumerable.Throw(ex); - - var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Join7() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => { throw ex; }, y => y, (x, y) => x + y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Join8() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x, y => { throw ex; }, (x, y) => x + y); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Join9() - { - var ex = new Exception("Bang!"); - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - - var res = xs.Join(ys, x => x, y => y, (x, y) => { throw ex; }); - - var e = res.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectManyMultiple_Null() - { - AssertThrows(() => AsyncEnumerable.SelectMany(default(IAsyncEnumerable), AsyncEnumerable.Return(42))); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(IAsyncEnumerable))); - } - - [TestMethod] - public void SelectManyMultiple1() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = new[] { 3, 4 }.ToAsyncEnumerable(); - - var res = xs.SelectMany(ys); - - var e = res.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.Single.cs b/Ix/Tests/AsyncTests.Single.cs deleted file mode 100644 index 409f48a..0000000 --- a/Ix/Tests/AsyncTests.Single.cs +++ /dev/null @@ -1,2455 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Threading; - -namespace Tests -{ - public partial class AsyncTests - { - [TestMethod] - public void Select_Null() - { - AssertThrows(() => AsyncEnumerable.Select(null, x => x)); - AssertThrows(() => AsyncEnumerable.Select(null, (x, i) => x)); - AssertThrows(() => AsyncEnumerable.Select(AsyncEnumerable.Return(42), default(Func))); - AssertThrows(() => AsyncEnumerable.Select(AsyncEnumerable.Return(42), default(Func))); - } - - [TestMethod] - public void Select1() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = xs.Select(x => (char)('a' + x)); - - var e = ys.GetEnumerator(); - HasNext(e, 'a'); - HasNext(e, 'b'); - HasNext(e, 'c'); - NoNext(e); - } - - [TestMethod] - public void Select2() - { - var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable(); - var ys = xs.Select((x, i) => (char)('a' + i)); - - var e = ys.GetEnumerator(); - HasNext(e, 'a'); - HasNext(e, 'b'); - HasNext(e, 'c'); - NoNext(e); - } - - [TestMethod] - public void Select3() - { - var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable(); - var ys = xs.Select(x => 1 / x); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException); - } - - [TestMethod] - public void Select4() - { - var xs = new[] { 8, 5, 7 }.ToAsyncEnumerable(); - var ys = xs.Select((x, i) => 1 / i); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is DivideByZeroException); - } - - [TestMethod] - public void Where_Null() - { - AssertThrows(() => AsyncEnumerable.Where(null, x => true)); - AssertThrows(() => AsyncEnumerable.Where(null, (x, i) => true)); - AssertThrows(() => AsyncEnumerable.Where(AsyncEnumerable.Return(42), default(Func))); - AssertThrows(() => AsyncEnumerable.Where(AsyncEnumerable.Return(42), default(Func))); - } - - [TestMethod] - public void Where1() - { - var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); - var ys = xs.Where(x => x % 2 == 0); - var e = ys.GetEnumerator(); - HasNext(e, 8); - HasNext(e, 4); - HasNext(e, 6); - HasNext(e, 2); - HasNext(e, 0); - NoNext(e); - } - - [TestMethod] - public void Where2() - { - var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); - var ys = xs.Where((x, i) => i % 2 == 0); - - var e = ys.GetEnumerator(); - HasNext(e, 8); - HasNext(e, 7); - HasNext(e, 6); - HasNext(e, 2); - HasNext(e, 0); - NoNext(e); - } - - [TestMethod] - public void Where3() - { - var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); - var ex = new Exception("Bang"); - var ys = xs.Where(x => { if (x == 4) throw ex; return true; }); - - var e = ys.GetEnumerator(); - HasNext(e, 8); - HasNext(e, 5); - HasNext(e, 7); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Where4() - { - var xs = new[] { 8, 5, 7, 4, 6, 9, 2, 1, 0 }.ToAsyncEnumerable(); - var ex = new Exception("Bang"); - var ys = xs.Where((x, i) => { if (i == 3) throw ex; return true; }); - - var e = ys.GetEnumerator(); - HasNext(e, 8); - HasNext(e, 5); - HasNext(e, 7); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Where5() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Where(x => true); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Where6() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - var ys = xs.Where((x, i) => true); - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany_Null() - { - AssertThrows(() => AsyncEnumerable.SelectMany(null, x => null)); - AssertThrows(() => AsyncEnumerable.SelectMany(null, (x, i) => null)); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>))); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>))); - - AssertThrows(() => AsyncEnumerable.SelectMany(null, x => null, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.SelectMany(null, (x, i) => null, (x, y) => x)); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>), (x, y) => x)); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), default(Func>), (x, y) => x)); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), x => null, default(Func))); - AssertThrows(() => AsyncEnumerable.SelectMany(AsyncEnumerable.Return(42), (x, i) => null, default(Func))); - } - - [TestMethod] - public void SelectMany1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 0); - HasNext(e, 1); - HasNext(e, 0); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void SelectMany2() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany(x => - { - if (x < 3) - return Enumerable.Range(0, x).ToAsyncEnumerable(); - else - return AsyncEnumerable.Throw(ex); - }); - - var e = ys.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 0); - HasNext(e, 1); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany3() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany4() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany(x => - { - if (x < 3) - return Enumerable.Range(0, x).ToAsyncEnumerable(); - else - throw ex; - }); - - var e = ys.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 0); - HasNext(e, 1); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany5() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 5, x).ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - HasNext(e, 5); - HasNext(e, 6); - HasNext(e, 7); - HasNext(e, 7); - HasNext(e, 8); - HasNext(e, 9); - NoNext(e); - } - - [TestMethod] - public void SelectMany6() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany((x, i) => - { - if (i < 2) - return Enumerable.Range(0, x).ToAsyncEnumerable(); - else - return AsyncEnumerable.Throw(ex); - }); - - var e = ys.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 0); - HasNext(e, 1); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany7() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.SelectMany((x, i) => Enumerable.Range(0, x).ToAsyncEnumerable()); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany8() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany((x, i) => - { - if (i < 2) - return Enumerable.Range(0, x).ToAsyncEnumerable(); - else - throw ex; - }); - - var e = ys.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 0); - HasNext(e, 1); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany9() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => x * y); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 6); - HasNext(e, 8); - HasNext(e, 9); - HasNext(e, 12); - HasNext(e, 15); - NoNext(e); - } - - [TestMethod] - public void SelectMany10() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => x * y); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 8); - HasNext(e, 10); - HasNext(e, 15); - HasNext(e, 18); - HasNext(e, 21); - NoNext(e); - } - - [TestMethod] - public void SelectMany11() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany(x => Enumerable.Range(3, x).ToAsyncEnumerable(), (x, y) => - { - if (x * y > 10) - throw ex; - return x * y; - }); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 6); - HasNext(e, 8); - HasNext(e, 9); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SelectMany12() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.SelectMany((x, i) => Enumerable.Range(i + 3, x).ToAsyncEnumerable(), (x, y) => - { - if (x * y > 10) - throw ex; - return x * y; - }); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 8); - HasNext(e, 10); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void OfType_Null() - { - AssertThrows(() => AsyncEnumerable.OfType(null)); - } - - [TestMethod] - public void OfType() - { - var xs = new object[] { 1, 1.2, true, 4, "" }.ToAsyncEnumerable(); - var ys = xs.OfType(); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Cast_Null() - { - AssertThrows(() => AsyncEnumerable.Cast(null)); - } - - [TestMethod] - public void Cast() - { - var xs = new object[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Cast(); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Do_Null() - { - AssertThrows(() => AsyncEnumerable.Do(null, x => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action))); - - AssertThrows(() => AsyncEnumerable.Do(null, x => { }, () => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), () => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action))); - - AssertThrows(() => AsyncEnumerable.Do(null, x => { }, ex => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), ex => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action))); - - AssertThrows(() => AsyncEnumerable.Do(null, x => { }, ex => { }, () => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(Action), ex => { }, () => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, default(Action), () => { })); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), x => { }, ex => { }, default(Action))); - - AssertThrows(() => AsyncEnumerable.Do(null, new MyObs())); - AssertThrows(() => AsyncEnumerable.Do(AsyncEnumerable.Return(42), default(IObserver))); - } - - class MyObs : IObserver - { - public void OnCompleted() - { - throw new NotImplementedException(); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnNext(int value) - { - throw new NotImplementedException(); - } - } - - [TestMethod] - public void Do1() - { - var sum = 0; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Do(x => sum += x); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - Assert.AreEqual(1, sum); - HasNext(e, 2); - Assert.AreEqual(3, sum); - HasNext(e, 3); - Assert.AreEqual(6, sum); - HasNext(e, 4); - Assert.AreEqual(10, sum); - NoNext(e); - } - - [TestMethod] - public void Do2() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Do(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Do3() - { - var sum = 0; - var fail = false; - var done = false; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Do(x => sum += x, ex => { fail = true; }, () => { done = true; }); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - Assert.AreEqual(1, sum); - HasNext(e, 2); - Assert.AreEqual(3, sum); - HasNext(e, 3); - Assert.AreEqual(6, sum); - HasNext(e, 4); - Assert.AreEqual(10, sum); - NoNext(e); - - Assert.IsFalse(fail); - Assert.IsTrue(done); - } - - [TestMethod] - public void Do4() - { - var sum = 0; - var done = false; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Do(x => sum += x, () => { done = true; }); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - Assert.AreEqual(1, sum); - HasNext(e, 2); - Assert.AreEqual(3, sum); - HasNext(e, 3); - Assert.AreEqual(6, sum); - HasNext(e, 4); - Assert.AreEqual(10, sum); - NoNext(e); - - Assert.IsTrue(done); - } - - [TestMethod] - public void Do5() - { - var ex = new Exception("Bang"); - var exa = default(Exception); - var done = false; - var hasv = false; - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }, () => { done = true; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - - Assert.IsFalse(hasv); - Assert.IsFalse(done); - Assert.AreSame(((AggregateException)exa).Flatten().InnerExceptions.Single(), ex); - } - - [TestMethod] - public void Do6() - { - var ex = new Exception("Bang"); - var exa = default(Exception); - var hasv = false; - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - - Assert.IsFalse(hasv); - Assert.AreSame(((AggregateException)exa).Flatten().InnerExceptions.Single(), ex); - } - - [TestMethod] - public void ForEachAsync_Null() - { - AssertThrows(() => AsyncEnumerable.ForEachAsync(null, x => { })); - AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action))); - AssertThrows(() => AsyncEnumerable.ForEachAsync(null, (x, i) => { })); - AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action))); - - AssertThrows(() => AsyncEnumerable.ForEachAsync(null, x => { }, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEachAsync(null, (x, i) => { }, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEachAsync(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); - } - - [TestMethod] - public void ForEach_Null() - { - AssertThrows(() => AsyncEnumerable.ForEach(null, x => { })); - AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action))); - AssertThrows(() => AsyncEnumerable.ForEach(null, (x, i) => { })); - AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action))); - - AssertThrows(() => AsyncEnumerable.ForEach(null, x => { }, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEach(null, (x, i) => { }, CancellationToken.None)); - AssertThrows(() => AsyncEnumerable.ForEach(AsyncEnumerable.Return(42), default(Action), CancellationToken.None)); - } - - [TestMethod] - public void ForEachAsync1() - { - var sum = 0; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - xs.ForEachAsync(x => sum += x).Wait(); - Assert.AreEqual(10, sum); - } - - [TestMethod] - public void ForEach1() - { - var sum = 0; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - xs.ForEach(x => sum += x); - Assert.AreEqual(10, sum); - } - - [TestMethod] - public void ForEachAsync2() - { - var sum = 0; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - xs.ForEach((x, i) => sum += x * i); - Assert.AreEqual(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum); - } - - [TestMethod] - public void ForEach2() - { - var sum = 0; - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - xs.ForEachAsync((x, i) => sum += x * i).Wait(); - Assert.AreEqual(1 * 0 + 2 * 1 + 3 * 2 + 4 * 3, sum); - } - - [TestMethod] - public void ForEachAsync3() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEach3() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - AssertThrows(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEachAsync4() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEach4() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - - AssertThrows(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEachAsync5() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEach5() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - AssertThrows(() => xs.ForEach(x => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEachAsync6() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ForEach6() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - - AssertThrows(() => xs.ForEach((x, i) => { throw ex; }), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Take_Null() - { - AssertThrows(() => AsyncEnumerable.Take(null, 5)); - AssertThrows(() => AsyncEnumerable.Take(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void Take1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Take(2); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void Take2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Take(10); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Take3() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Take(0); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Take4() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Take(2); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void TakeWhile_Null() - { - AssertThrows(() => AsyncEnumerable.TakeWhile(null, x => true)); - AssertThrows(() => AsyncEnumerable.TakeWhile(null, (x, i) => true)); - AssertThrows(() => AsyncEnumerable.TakeWhile(AsyncEnumerable.Return(42), default(Func))); - AssertThrows(() => AsyncEnumerable.TakeWhile(AsyncEnumerable.Return(42), default(Func))); - } - - [TestMethod] - public void TakeWhile1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile(x => x < 3); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void TakeWhile2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile(x => false); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void TakeWhile3() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile(x => true); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void TakeWhile4() - { - var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile(x => x < 3); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void TakeWhile5() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void TakeWhile6() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile((x, i) => i < 2); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void TakeWhile7() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile((x, i) => false); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void TakeWhile8() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile((x, i) => true); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void TakeWhile9() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.TakeWhile((x, i) => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Skip_Null() - { - AssertThrows(() => AsyncEnumerable.Skip(null, 5)); - AssertThrows(() => AsyncEnumerable.Skip(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void Skip1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Skip(2); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Skip2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Skip(10); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Skip3() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.Skip(0); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Skip4() - { - var ex = new Exception("Bang"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Skip(2); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SkipWhile_Null() - { - AssertThrows(() => AsyncEnumerable.SkipWhile(null, x => true)); - AssertThrows(() => AsyncEnumerable.SkipWhile(null, (x, i) => true)); - AssertThrows(() => AsyncEnumerable.SkipWhile(AsyncEnumerable.Return(42), default(Func))); - AssertThrows(() => AsyncEnumerable.SkipWhile(AsyncEnumerable.Return(42), default(Func))); - } - - [TestMethod] - public void SkipWhile1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile(x => x < 3); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void SkipWhile2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile(x => false); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void SkipWhile3() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile(x => true); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void SkipWhile4() - { - var xs = new[] { 1, 2, 3, 4, 3, 2, 1 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile(x => x < 3); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 3); - HasNext(e, 2); - HasNext(e, 1); - NoNext(e); - } - - [TestMethod] - public void SkipWhile5() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void SkipWhile6() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile((x, i) => i < 2); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void SkipWhile7() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile((x, i) => false); - - var e = ys.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void SkipWhile8() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile((x, i) => true); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void SkipWhile9() - { - var ex = new Exception("Bang"); - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable(); - var ys = xs.SkipWhile((x, i) => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void DefaultIfEmpty_Null() - { - AssertThrows(() => AsyncEnumerable.DefaultIfEmpty(null)); - AssertThrows(() => AsyncEnumerable.DefaultIfEmpty(null, 42)); - } - - [TestMethod] - public void DefaultIfEmpty1() - { - var xs = AsyncEnumerable.Empty().DefaultIfEmpty(); - - var e = xs.GetEnumerator(); - HasNext(e, 0); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty2() - { - var xs = AsyncEnumerable.Empty().DefaultIfEmpty(42); - - var e = xs.GetEnumerator(); - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty3() - { - var xs = AsyncEnumerable.Return(42).DefaultIfEmpty(); - - var e = xs.GetEnumerator(); - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty4() - { - var xs = AsyncEnumerable.Return(42).DefaultIfEmpty(24); - - var e = xs.GetEnumerator(); - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty5() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty6() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().DefaultIfEmpty(24); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void DefaultIfEmpty7() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex).DefaultIfEmpty(); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void DefaultIfEmpty8() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex).DefaultIfEmpty(24); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Distinct_Null() - { - AssertThrows(() => AsyncEnumerable.Distinct(null)); - AssertThrows(() => AsyncEnumerable.Distinct(null, new Eq())); - AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Distinct1() - { - var xs = new[] { 1, 2, 1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 5); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Distinct2() - { - var xs = new[] { 1, -2, -1, 3, 5, 2, 1, 4 }.ToAsyncEnumerable().Distinct(new Eq()); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, -2); - HasNext(e, 3); - HasNext(e, 5); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void Reverse_Null() - { - AssertThrows(() => AsyncEnumerable.Reverse(null)); - } - - [TestMethod] - public void Reverse1() - { - var xs = AsyncEnumerable.Empty(); - var ys = xs.Reverse(); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void Reverse2() - { - var xs = AsyncEnumerable.Return(42); - var ys = xs.Reverse(); - - var e = ys.GetEnumerator(); - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void Reverse3() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.Reverse(); - - var e = ys.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 2); - HasNext(e, 1); - NoNext(e); - } - - [TestMethod] - public void Reverse4() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.Reverse(); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void OrderBy_Null() - { - AssertThrows(() => AsyncEnumerable.OrderBy(null, x => x)); - AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.OrderBy(null, x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), null, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.OrderBy(AsyncEnumerable.Return(42), x => x, null)); - - AssertThrows(() => AsyncEnumerable.OrderByDescending(null, x => x)); - AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.OrderByDescending(null, x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), null, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.OrderByDescending(AsyncEnumerable.Return(42), x => x, null)); - - var xs = AsyncEnumerable.Return(42).OrderBy(x => x); - - AssertThrows(() => AsyncEnumerable.ThenBy(null, x => x)); - AssertThrows(() => AsyncEnumerable.ThenBy(xs, null)); - - AssertThrows(() => AsyncEnumerable.ThenBy(null, x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.ThenBy(xs, null, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.ThenBy(xs, x => x, null)); - - AssertThrows(() => AsyncEnumerable.ThenByDescending(null, x => x)); - AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, null)); - - AssertThrows(() => AsyncEnumerable.ThenByDescending(null, x => x, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, null, Comparer.Default)); - AssertThrows(() => AsyncEnumerable.ThenByDescending(xs, x => x, null)); - } - - [TestMethod] - public void OrderBy1() - { - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderBy(x => x); - - var e = ys.GetEnumerator(); - for (int i = 0; i < 10; i++) - HasNext(e, i); - NoNext(e); - } - - [TestMethod] - public void OrderBy2() - { - var ex = new Exception("Bang!"); - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderBy(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ThenBy2() - { - var ex = new Exception("Bang!"); - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderBy(x => x).ThenBy(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void OrderByDescending1() - { - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderByDescending(x => x); - - var e = ys.GetEnumerator(); - for (int i = 9; i >= 0; i--) - HasNext(e, i); - NoNext(e); - } - - [TestMethod] - public void OrderByDescending2() - { - var ex = new Exception("Bang!"); - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderByDescending(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void ThenByDescending2() - { - var ex = new Exception("Bang!"); - var xs = new[] { 2, 6, 1, 5, 7, 8, 9, 3, 4, 0 }.ToAsyncEnumerable(); - var ys = xs.OrderBy(x => x).ThenByDescending(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void OrderByThenBy1() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var ress = xs.OrderBy(x => x.Name).ThenBy(x => x.Age); - var resa = ys.OrderBy(x => x.Name).ThenBy(x => x.Age); - - Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); - } - - [TestMethod] - public void OrderByThenBy2() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var ress = xs.OrderBy(x => x.Name).ThenByDescending(x => x.Age); - var resa = ys.OrderBy(x => x.Name).ThenByDescending(x => x.Age); - - Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); - } - - [TestMethod] - public void OrderByThenBy3() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var ress = xs.OrderByDescending(x => x.Name).ThenBy(x => x.Age); - var resa = ys.OrderByDescending(x => x.Name).ThenBy(x => x.Age); - - Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); - } - - [TestMethod] - public void OrderByThenBy4() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var ress = xs.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age); - var resa = ys.OrderByDescending(x => x.Name).ThenByDescending(x => x.Age); - - Assert.IsTrue(ress.SequenceEqual(resa.ToEnumerable())); - } - - [TestMethod] - public void GroupBy_Null() - { - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(IEqualityComparer))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(IEqualityComparer))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, (x, ys) => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), (x, ys) => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func, int>))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, (x, ys) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), (x, ys) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func, int>), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, (x, ys) => x, default(IEqualityComparer))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, (x, ys) => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, (x, ys) => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), (x, ys) => x)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(Func, int>))); - - AssertThrows(() => AsyncEnumerable.GroupBy(null, x => x, x => x, (x, ys) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), default(Func), x => x, (x, ys) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, default(Func), (x, ys) => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, default(Func, int>), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.GroupBy(AsyncEnumerable.Return(42), x => x, x => x, (x, ys) => x, default(IEqualityComparer))); - } - - [TestMethod] - public void GroupBy1() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var res = ys.GroupBy(x => x.Age / 10); - - var e = res.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - Assert.AreEqual(e.Current.Key, 2); - var g1 = e.Current.GetEnumerator(); - HasNext(g1, xs[0]); - HasNext(g1, xs[2]); - HasNext(g1, xs[4]); - HasNext(g1, xs[5]); - NoNext(g1); - - Assert.IsTrue(e.MoveNext().Result); - Assert.AreEqual(e.Current.Key, 6); - var g2 = e.Current.GetEnumerator(); - HasNext(g2, xs[1]); - NoNext(g2); - - Assert.IsTrue(e.MoveNext().Result); - Assert.AreEqual(e.Current.Key, 1); - var g3 = e.Current.GetEnumerator(); - HasNext(g3, xs[3]); - NoNext(g3); - - Assert.IsTrue(e.MoveNext().Result); - Assert.AreEqual(e.Current.Key, 4); - var g4 = e.Current.GetEnumerator(); - HasNext(g4, xs[6]); - NoNext(g4); - - NoNext(e); - } - - [TestMethod] - public void GroupBy2() - { - var xs = new[] { - new { Name = "Bart", Age = 27 }, - new { Name = "John", Age = 62 }, - new { Name = "Eric", Age = 27 }, - new { Name = "Lisa", Age = 14 }, - new { Name = "Brad", Age = 27 }, - new { Name = "Lisa", Age = 23 }, - new { Name = "Eric", Age = 42 }, - }; - - var ys = xs.ToAsyncEnumerable(); - - var res = ys.GroupBy(x => x.Age / 10); - - var e = res.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 2); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 6); - - Assert.IsTrue(e.MoveNext().Result); - var g3 = e.Current; - Assert.AreEqual(g3.Key, 1); - - Assert.IsTrue(e.MoveNext().Result); - var g4 = e.Current; - Assert.AreEqual(g4.Key, 4); - - NoNext(e); - - var g1e = g1.GetEnumerator(); - HasNext(g1e, xs[0]); - HasNext(g1e, xs[2]); - HasNext(g1e, xs[4]); - HasNext(g1e, xs[5]); - NoNext(g1e); - - var g2e = g2.GetEnumerator(); - HasNext(g2e, xs[1]); - NoNext(g2e); - - var g3e = g3.GetEnumerator(); - HasNext(g3e, xs[3]); - NoNext(g3e); - - var g4e = g4.GetEnumerator(); - HasNext(g4e, xs[6]); - NoNext(g4e); - } - - [TestMethod] - public void GroupBy3() - { - var xs = AsyncEnumerable.Empty(); - var ys = xs.GroupBy(x => x); - - var e = ys.GetEnumerator(); - NoNext(e); - } - - [TestMethod] - public void GroupBy4() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex); - var ys = xs.GroupBy(x => x); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupBy5() - { - var xs = GetXs().ToAsyncEnumerable(); - var ys = xs.GroupBy(x => x); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 42); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 42); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 43); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 43); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - AssertThrows(() => g2e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - } - - [TestMethod] - public void GroupBy6() - { - var xs = GetXs().ToAsyncEnumerable(); - var ys = xs.GroupBy(x => x); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 42); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 42); - AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single().Message == "Bang!"); - } - - static IEnumerable GetXs() - { - yield return 42; - yield return 43; - throw new Exception("Bang!"); - } - - [TestMethod] - public void GroupBy7() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Return(42); - var ys = xs.GroupBy(x => { throw ex; }); - - var e = ys.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupBy8() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); - var ys = xs.GroupBy(x => { if (x == 3) throw ex; return x; }); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 1); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 1); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 2); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 2); - - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - AssertThrows(() => g1e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - AssertThrows(() => g2e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void GroupBy9() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x)); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 0); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 'a'); - HasNext(g1e, 'd'); - HasNext(g1e, 'g'); - HasNext(g1e, 'j'); - NoNext(g1e); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 1); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 'b'); - HasNext(g2e, 'e'); - HasNext(g2e, 'h'); - NoNext(g2e); - - Assert.IsTrue(e.MoveNext().Result); - var g3 = e.Current; - Assert.AreEqual(g3.Key, 2); - var g3e = g3.GetEnumerator(); - HasNext(g3e, 'c'); - HasNext(g3e, 'f'); - HasNext(g3e, 'i'); - NoNext(g3e); - - NoNext(e); - } - - [TestMethod] - public void GroupBy10() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x % 3, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result); - - var e = ys.GetEnumerator(); - HasNext(e, "0 - adgj"); - HasNext(e, "1 - beh"); - HasNext(e, "2 - cfi"); - NoNext(e); - } - - [TestMethod] - public void GroupBy11() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x % 3, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result); - - var e = ys.GetEnumerator(); - HasNext(e, "0 - 0369"); - HasNext(e, "1 - 147"); - HasNext(e, "2 - 258"); - NoNext(e); - } - - [TestMethod] - public void GroupBy12() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, new EqMod(3)); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 0); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 0); - HasNext(g1e, 3); - HasNext(g1e, 6); - HasNext(g1e, 9); - NoNext(g1e); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 1); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 1); - HasNext(g2e, 4); - HasNext(g2e, 7); - NoNext(g2e); - - Assert.IsTrue(e.MoveNext().Result); - var g3 = e.Current; - Assert.AreEqual(g3.Key, 2); - var g3e = g3.GetEnumerator(); - HasNext(g3e, 2); - HasNext(g3e, 5); - HasNext(g3e, 8); - NoNext(g3e); - - NoNext(e); - } - - [TestMethod] - public void GroupBy13() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 0); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 'a'); - HasNext(g1e, 'd'); - HasNext(g1e, 'g'); - HasNext(g1e, 'j'); - NoNext(g1e); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 1); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 'b'); - HasNext(g2e, 'e'); - HasNext(g2e, 'h'); - NoNext(g2e); - - Assert.IsTrue(e.MoveNext().Result); - var g3 = e.Current; - Assert.AreEqual(g3.Key, 2); - var g3e = g3.GetEnumerator(); - HasNext(g3e, 'c'); - HasNext(g3e, 'f'); - HasNext(g3e, 'i'); - NoNext(g3e); - - NoNext(e); - } - - [TestMethod] - public void GroupBy14() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, x => (char)('a' + x), (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3)); - - var e = ys.GetEnumerator(); - HasNext(e, "0 - adgj"); - HasNext(e, "1 - beh"); - HasNext(e, "2 - cfi"); - NoNext(e); - } - - [TestMethod] - public void GroupBy15() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, (k, cs) => k + " - " + cs.Aggregate("", (a, c) => a + c).Result, new EqMod(3)); - - var e = ys.GetEnumerator(); - HasNext(e, "0 - 0369"); - HasNext(e, "1 - 147"); - HasNext(e, "2 - 258"); - NoNext(e); - } - - [TestMethod] - public void GroupBy16() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 0); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 'a'); - HasNext(g1e, 'd'); - HasNext(g1e, 'g'); - HasNext(g1e, 'j'); - NoNext(g1e); - g1e.Dispose(); - - Assert.IsTrue(e.MoveNext().Result); - var g2 = e.Current; - Assert.AreEqual(g2.Key, 1); - var g2e = g2.GetEnumerator(); - HasNext(g2e, 'b'); - HasNext(g2e, 'e'); - HasNext(g2e, 'h'); - NoNext(g2e); - g2e.Dispose(); - - Assert.IsTrue(e.MoveNext().Result); - var g3 = e.Current; - Assert.AreEqual(g3.Key, 2); - var g3e = g3.GetEnumerator(); - HasNext(g3e, 'c'); - HasNext(g3e, 'f'); - HasNext(g3e, 'i'); - NoNext(g3e); - g3e.Dispose(); - - NoNext(e); - - e.Dispose(); - } - - [TestMethod] - public void GroupBy17() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); - - var e = ys.GetEnumerator(); - e.Dispose(); - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void GroupBy18() - { - var xs = AsyncEnumerable.Range(0, 10); - var ys = xs.GroupBy(x => x, x => (char)('a' + x), new EqMod(3)); - - var e = ys.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - var g1 = e.Current; - Assert.AreEqual(g1.Key, 0); - var g1e = g1.GetEnumerator(); - HasNext(g1e, 'a'); - - e.Dispose(); - - HasNext(g1e, 'd'); - HasNext(g1e, 'g'); - HasNext(g1e, 'j'); - NoNext(g1e); - g1e.Dispose(); - - Assert.IsFalse(e.MoveNext().Result); - } - - class EqMod : IEqualityComparer - { - private readonly int _d; - - public EqMod(int d) - { - _d = d; - } - - public bool Equals(int x, int y) - { - return EqualityComparer.Default.Equals(x % _d, y % _d); - } - - public int GetHashCode(int obj) - { - return EqualityComparer.Default.GetHashCode(obj % _d); - } - } - - [TestMethod] - public void AsAsyncEnumerable_Null() - { - AssertThrows(() => AsyncEnumerable.AsAsyncEnumerable(null)); - } - - [TestMethod] - public void AsAsyncEnumerable1() - { - var xs = AsyncEnumerable.Return(42); - var ys = xs.AsAsyncEnumerable(); - - Assert.AreNotSame(xs, ys); - - var e = xs.GetEnumerator(); - HasNext(e, 42); - NoNext(e); - } - - [TestMethod] - public void RepeatSeq_Null() - { - AssertThrows(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable))); - AssertThrows(() => AsyncEnumerable.Repeat(default(IAsyncEnumerable), 3)); - AssertThrows(() => AsyncEnumerable.Repeat(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void RepeatSeq1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - } - - [TestMethod] - public void RepeatSeq2() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Repeat(3); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - NoNext(e); - } - - [TestMethod] - public void RepeatSeq3() - { - var i = 0; - var xs = RepeatXs(() => i++).ToAsyncEnumerable().Repeat(3); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - - Assert.AreEqual(3, i); - } - - static IEnumerable RepeatXs(Action started) - { - started(); - - yield return 1; - yield return 2; - } - - [TestMethod] - public void RepeatSeq4() - { - var xs = new FailRepeat().ToAsyncEnumerable().Repeat(); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); - } - - [TestMethod] - public void RepeatSeq5() - { - var xs = new FailRepeat().ToAsyncEnumerable().Repeat(3); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NotImplementedException); - } - - class FailRepeat : IEnumerable - { - public IEnumerator GetEnumerator() - { - throw new NotImplementedException(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } - } - - [TestMethod] - public void IgnoreElements_Null() - { - AssertThrows(() => AsyncEnumerable.IgnoreElements(default(IAsyncEnumerable))); - } - - [TestMethod] - public void IgnoreElements1() - { - var xs = AsyncEnumerable.Empty().IgnoreElements(); - - var e = xs.GetEnumerator(); - NoNext(e); - - AssertThrows(() => { var ignored = e.Current; }); - } - - [TestMethod] - public void IgnoreElements2() - { - var xs = AsyncEnumerable.Return(42).IgnoreElements(); - - var e = xs.GetEnumerator(); - NoNext(e); - - AssertThrows(() => { var ignored = e.Current; }); - } - - [TestMethod] - public void IgnoreElements3() - { - var xs = AsyncEnumerable.Range(0, 10).IgnoreElements(); - - var e = xs.GetEnumerator(); - NoNext(e); - - AssertThrows(() => { var ignored = e.Current; }); - } - - [TestMethod] - public void IgnoreElements4() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex).IgnoreElements(); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void StartWith_Null() - { - AssertThrows(() => AsyncEnumerable.StartWith(default(IAsyncEnumerable), new[] { 1 })); - AssertThrows(() => AsyncEnumerable.StartWith(AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void StartWith1() - { - var xs = AsyncEnumerable.Empty().StartWith(1, 2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void StartWith2() - { - var xs = AsyncEnumerable.Return(0).StartWith(1, 2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 0); - NoNext(e); - } - - [TestMethod] - public void StartWith3() - { - var ex = new Exception("Bang!"); - var xs = AsyncEnumerable.Throw(ex).StartWith(1, 2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Buffer_Null() - { - AssertThrows(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable), 1)); - AssertThrows(() => AsyncEnumerable.Buffer(default(IAsyncEnumerable), 1, 1)); - - AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1)); - AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), -1, 1)); - AssertThrows(() => AsyncEnumerable.Buffer(AsyncEnumerable.Return(42), 1, -1)); - } - - [TestMethod] - public void Buffer1() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2); - - var e = xs.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2 })); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 3, 4 })); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 5 })); - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void Buffer2() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(3, 2); - - var e = xs.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2, 3 })); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 3, 4, 5 })); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 5 })); - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void Buffer3() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Buffer(2, 3); - - var e = xs.GetEnumerator(); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 1, 2 })); - - Assert.IsTrue(e.MoveNext().Result); - Assert.IsTrue(e.Current.SequenceEqual(new[] { 4, 5 })); - - Assert.IsFalse(e.MoveNext().Result); - } - - [TestMethod] - public void DistinctUntilChanged_Null() - { - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable))); - - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(IEqualityComparer))); - - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(Func))); - - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(default(IAsyncEnumerable), x => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), default(Func), EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.DistinctUntilChanged(AsyncEnumerable.Return(42), x => x, default(IEqualityComparer))); - } - - [TestMethod] - public void DistinctUntilChanged1() - { - var xs = new[] { 1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 3, 2, 2, 1, 1 }.ToAsyncEnumerable().DistinctUntilChanged(); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - HasNext(e, 5); - HasNext(e, 6); - HasNext(e, 7); - HasNext(e, 3); - HasNext(e, 2); - HasNext(e, 1); - NoNext(e); - } - - [TestMethod] - public void DistinctUntilChanged2() - { - var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => (x + 1) / 2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 3); - HasNext(e, 5); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void DistinctUntilChanged3() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3, 4, 3, 5, 2 }.ToAsyncEnumerable().DistinctUntilChanged(x => { if (x == 4) throw ex; return x; }); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Expand_Null() - { - AssertThrows(() => AsyncEnumerable.Expand(default(IAsyncEnumerable), x => null)); - AssertThrows(() => AsyncEnumerable.Expand(AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Expand1() - { - var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => AsyncEnumerable.Return(x - 1).Repeat(x - 1)); - - var e = xs.GetEnumerator(); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 2); - HasNext(e, 1); - HasNext(e, 1); - NoNext(e); - } - - [TestMethod] - public void Expand2() - { - var ex = new Exception("Bang!"); - var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => { throw ex; }); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Expand3() - { - var xs = new[] { 2, 3 }.ToAsyncEnumerable().Expand(x => null); - - var e = xs.GetEnumerator(); - HasNext(e, 2); - HasNext(e, 3); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() is NullReferenceException); - } - - [TestMethod] - public void Scan_Null() - { - AssertThrows(() => AsyncEnumerable.Scan(default(IAsyncEnumerable), 3, (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), 3, null)); - - AssertThrows(() => AsyncEnumerable.Scan(default(IAsyncEnumerable), (x, y) => x + y)); - AssertThrows(() => AsyncEnumerable.Scan(AsyncEnumerable.Return(42), null)); - } - - [TestMethod] - public void Scan1() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => x + y); - - var e = xs.GetEnumerator(); - HasNext(e, 9); - HasNext(e, 11); - HasNext(e, 14); - NoNext(e); - } - - [TestMethod] - public void Scan2() - { - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => x + y); - - var e = xs.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 6); - NoNext(e); - } - - [TestMethod] - public void Scan3() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan(8, (x, y) => { throw ex; }); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void Scan4() - { - var ex = new Exception("Bang!"); - var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Scan((x, y) => { throw ex; }); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext().Wait(), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex); - } - - [TestMethod] - public void DistinctKey_Null() - { - AssertThrows(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable), x => x)); - AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null)); - - AssertThrows(() => AsyncEnumerable.Distinct(default(IAsyncEnumerable), x => x, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), null, EqualityComparer.Default)); - AssertThrows(() => AsyncEnumerable.Distinct(AsyncEnumerable.Return(42), x => x, null)); - } - - [TestMethod] - public void DistinctKey1() - { - var xs = new[] { 1, 2, 3, 4, 5 }.ToAsyncEnumerable().Distinct(x => x / 2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void TakeLast_Null() - { - AssertThrows(() => AsyncEnumerable.TakeLast(default(IAsyncEnumerable), 5)); - AssertThrows(() => AsyncEnumerable.TakeLast(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void TakeLast1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(2); - - var e = xs.GetEnumerator(); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void TakeLast2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().TakeLast(5); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - HasNext(e, 4); - NoNext(e); - } - - [TestMethod] - public void SkipLast_Null() - { - AssertThrows(() => AsyncEnumerable.SkipLast(default(IAsyncEnumerable), 5)); - AssertThrows(() => AsyncEnumerable.SkipLast(AsyncEnumerable.Return(42), -1)); - } - - [TestMethod] - public void SkipLast1() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(2); - - var e = xs.GetEnumerator(); - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - } - - [TestMethod] - public void SkipLast2() - { - var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable().SkipLast(5); - - var e = xs.GetEnumerator(); - NoNext(e); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/AsyncTests.cs b/Ix/Tests/AsyncTests.cs deleted file mode 100644 index 9279bb7..0000000 --- a/Ix/Tests/AsyncTests.cs +++ /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 DESKTOPCLR40 - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - [TestClass] - public partial class AsyncTests - { - public void AssertThrows(Action a) - where E : Exception - { - try - { - a(); - Assert.Fail(); - } - catch (E) - { - } - } - - public void AssertThrows(Action a, Func assert) - where E : Exception - { - try - { - a(); - Assert.Fail(); - } - catch (E e) - { - Assert.IsTrue(assert(e)); - } - } - - public void NoNext(IAsyncEnumerator e) - { - Assert.IsFalse(e.MoveNext().Result); - } - - public void HasNext(IAsyncEnumerator e, T value) - { - Assert.IsTrue(e.MoveNext().Result); - Assert.AreEqual(value, e.Current); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/Properties/AppManifest.xml b/Ix/Tests/Properties/AppManifest.xml deleted file mode 100644 index 71b66f8..0000000 --- a/Ix/Tests/Properties/AppManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Ix/Tests/Properties/AssemblyInfo.cs b/Ix/Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 6536c5c..0000000 --- a/Ix/Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Tests")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("aec256c2-1e0e-48d7-a312-7184dc67b1f0")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -//[assembly: AssemblyVersion("1.0.0.0")] -//[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Ix/Tests/Tests.Aggregates.cs b/Ix/Tests/Tests.Aggregates.cs deleted file mode 100644 index 8fd8cee..0000000 --- a/Ix/Tests/Tests.Aggregates.cs +++ /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. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void IsEmtpy_Arguments() - { - AssertThrows(() => EnumerableEx.IsEmpty(null)); - } - - [TestMethod] - public void IsEmpty_Empty() - { - Assert.IsTrue(Enumerable.Empty().IsEmpty()); - } - - [TestMethod] - public void IsEmpty_NonEmpty() - { - Assert.IsFalse(new[] { 1 }.IsEmpty()); - } - - [TestMethod] - public void Min_Arguments() - { - AssertThrows(() => EnumerableEx.Min(null, Comparer.Default)); - AssertThrows(() => EnumerableEx.Min(new[] { 1 }, null)); - } - - [TestMethod] - public void Min() - { - Assert.AreEqual(3, new[] { 5, 3, 7 }.Min(new Mod3Comparer())); - } - - class Mod3Comparer : IComparer - { - public int Compare(int x, int y) - { - return Comparer.Default.Compare(x % 3, y % 3); - } - } - - [TestMethod] - public void MinBy_Arguments() - { - AssertThrows(() => EnumerableEx.MinBy(null, (int x) => x)); - AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, default(Func))); - AssertThrows(() => EnumerableEx.MinBy(null, (int x) => x, Comparer.Default)); - AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, default(Func), Comparer.Default)); - AssertThrows(() => EnumerableEx.MinBy(new[] { 1 }, (int x) => x, null)); - } - - [TestMethod] - public void MinBy() - { - var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MinBy(x => x % 3); - Assert.IsTrue(res.SequenceEqual(new[] { 0, 3, 6 })); - } - - [TestMethod] - public void MinBy_Empty() - { - AssertThrows(() => Enumerable.Empty().MinBy(x => x)); - } - - [TestMethod] - public void Max_Arguments() - { - AssertThrows(() => EnumerableEx.Max(null, Comparer.Default)); - AssertThrows(() => EnumerableEx.Max(new[] { 1 }, null)); - } - - [TestMethod] - public void Max() - { - Assert.AreEqual(5, new[] { 2, 5, 3, 7 }.Max(new Mod7Comparer())); - } - - class Mod7Comparer : IComparer - { - public int Compare(int x, int y) - { - return Comparer.Default.Compare(x % 7, y % 7); - } - } - - [TestMethod] - public void MaxBy_Arguments() - { - AssertThrows(() => EnumerableEx.MaxBy(null, (int x) => x)); - AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, default(Func))); - AssertThrows(() => EnumerableEx.MaxBy(null, (int x) => x, Comparer.Default)); - AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, default(Func), Comparer.Default)); - AssertThrows(() => EnumerableEx.MaxBy(new[] { 1 }, (int x) => x, null)); - } - - [TestMethod] - public void MaxBy() - { - var res = new[] { 2, 5, 0, 7, 4, 3, 6, 2, 1 }.MaxBy(x => x % 3); - Assert.IsTrue(res.SequenceEqual(new[] { 2, 5, 2 })); - } - - [TestMethod] - public void MaxBy_Empty() - { - AssertThrows(() => Enumerable.Empty().MaxBy(x => x)); - } - } -} diff --git a/Ix/Tests/Tests.Buffering.cs b/Ix/Tests/Tests.Buffering.cs deleted file mode 100644 index 0f6e81c..0000000 --- a/Ix/Tests/Tests.Buffering.cs +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Share_Arguments() - { - AssertThrows(() => EnumerableEx.Share(null)); - } - - [TestMethod] - public void Share1() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - HasNext(e1, 3); - HasNext(e1, 4); - NoNext(e1); - } - - [TestMethod] - public void Share2() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e2, 1); - HasNext(e1, 2); - HasNext(e2, 3); - HasNext(e1, 4); - NoNext(e2); - NoNext(e1); - } - - [TestMethod] - public void Share3() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e2); - NoNext(e1); - } - - [TestMethod] - public void Share4() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - e1.Dispose(); - Assert.IsFalse(e1.MoveNext()); - } - - [TestMethod] - public void Share5() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - rng.Dispose(); - AssertThrows(() => e1.MoveNext()); - AssertThrows(() => rng.GetEnumerator()); - AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); - } - - [TestMethod] - public void Share6() - { - var rng = Enumerable.Range(0, 5).Share(); - - var e1 = ((IEnumerable)rng).GetEnumerator(); - Assert.IsTrue(e1.MoveNext()); - Assert.AreEqual(0, (int)e1.Current); - } - - [TestMethod] - public void Publish_Arguments() - { - AssertThrows(() => EnumerableEx.Publish(null)); - } - - [TestMethod] - public void Publish0() - { - var n = 0; - var rng = Tick(i => n += i).Publish(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - - HasNext(e1, 0); - Assert.AreEqual(0, n); - - HasNext(e1, 1); - Assert.AreEqual(1, n); - - HasNext(e1, 2); - Assert.AreEqual(3, n); - HasNext(e2, 0); - Assert.AreEqual(3, n); - - HasNext(e1, 3); - Assert.AreEqual(6, n); - HasNext(e2, 1); - Assert.AreEqual(6, n); - - HasNext(e2, 2); - Assert.AreEqual(6, n); - HasNext(e2, 3); - Assert.AreEqual(6, n); - - HasNext(e2, 4); - Assert.AreEqual(10, n); - HasNext(e1, 4); - Assert.AreEqual(10, n); - } - - static IEnumerable Tick(Action t) - { - var i = 0; - while (true) - { - t(i); - yield return i++; - } - } - - [TestMethod] - public void Publish1() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - HasNext(e1, 3); - HasNext(e1, 4); - NoNext(e1); - } - - [TestMethod] - public void Publish2() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e2, 0); - HasNext(e1, 1); - HasNext(e2, 1); - HasNext(e1, 2); - HasNext(e2, 2); - HasNext(e1, 3); - HasNext(e2, 3); - HasNext(e1, 4); - HasNext(e2, 4); - NoNext(e1); - NoNext(e2); - } - - [TestMethod] - public void Publish3() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - HasNext(e1, 3); - HasNext(e1, 4); - HasNext(e2, 0); - HasNext(e2, 1); - HasNext(e2, 2); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e1); - NoNext(e2); - } - - [TestMethod] - public void Publish4() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - var e2 = rng.GetEnumerator(); - HasNext(e1, 3); - HasNext(e1, 4); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e1); - NoNext(e2); - } - - [TestMethod] - public void Publish5() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - e1.Dispose(); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e2); - } - - [TestMethod] - public void Publish6() - { - var ex = new MyException(); - var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)).Publish(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - AssertThrows(() => e1.MoveNext()); - - HasNext(e2, 0); - HasNext(e2, 1); - AssertThrows(() => e2.MoveNext()); - } - - class MyException : Exception - { - } - - [TestMethod] - public void Publish7() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e2); - - HasNext(e1, 3); - HasNext(e1, 4); - NoNext(e2); - - var e3 = rng.GetEnumerator(); - NoNext(e3); - } - - [TestMethod] - public void Publish8() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - rng.Dispose(); - AssertThrows(() => e1.MoveNext()); - AssertThrows(() => rng.GetEnumerator()); - AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); - } - - [TestMethod] - public void Publish9() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = ((IEnumerable)rng).GetEnumerator(); - Assert.IsTrue(e1.MoveNext()); - Assert.AreEqual(0, (int)e1.Current); - } - - [TestMethod] - public void Publish10() - { - var rnd = Rand().Take(1000).Publish(); - Assert.IsTrue(rnd.Zip(rnd, (l, r) => l == r).All(x => x)); - } - - [TestMethod] - public void Memoize_Arguments() - { - AssertThrows(() => EnumerableEx.Memoize(null)); - } - - [TestMethod] - public void MemoizeLimited_Arguments() - { - AssertThrows(() => EnumerableEx.Memoize(null, 2)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 0)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, -1)); - } - - [TestMethod] - public void Memoize0() - { - var n = 0; - var rng = Tick(i => n += i).Memoize(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - - HasNext(e1, 0); - Assert.AreEqual(0, n); - - HasNext(e1, 1); - Assert.AreEqual(1, n); - - HasNext(e1, 2); - Assert.AreEqual(3, n); - HasNext(e2, 0); - Assert.AreEqual(3, n); - - HasNext(e1, 3); - Assert.AreEqual(6, n); - HasNext(e2, 1); - Assert.AreEqual(6, n); - - HasNext(e2, 2); - Assert.AreEqual(6, n); - HasNext(e2, 3); - Assert.AreEqual(6, n); - - HasNext(e2, 4); - Assert.AreEqual(10, n); - HasNext(e1, 4); - Assert.AreEqual(10, n); - } - - [TestMethod] - public void Publish11() - { - var rng = Enumerable.Range(0, 5).Publish(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - e1.Dispose(); - - HasNext(e2, 0); - HasNext(e2, 1); - e2.Dispose(); - - var e3 = rng.GetEnumerator(); - HasNext(e3, 3); - HasNext(e3, 4); - NoNext(e3); - } - - [TestMethod] - public void Memoize1() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - HasNext(e1, 3); - HasNext(e1, 4); - NoNext(e1); - } - - [TestMethod] - public void Memoize2() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - HasNext(e1, 3); - HasNext(e1, 4); - NoNext(e1); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 0); - HasNext(e2, 1); - HasNext(e2, 2); - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e2); - } - - [TestMethod] - public void Memoize3() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - var e2 = rng.GetEnumerator(); - HasNext(e1, 3); - HasNext(e2, 0); - HasNext(e2, 1); - HasNext(e1, 4); - HasNext(e2, 2); - NoNext(e1); - - HasNext(e2, 3); - HasNext(e2, 4); - NoNext(e2); - } - - [TestMethod] - public void Memoize4() - { - var rng = Enumerable.Range(0, 5).Memoize(2); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 0); - HasNext(e2, 1); - HasNext(e2, 2); - - var e3 = rng.GetEnumerator(); - AssertThrows(() => e3.MoveNext()); - } - - [TestMethod] - public void Memoize6() - { - var ex = new MyException(); - var rng = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)).Memoize(); - - var e1 = rng.GetEnumerator(); - var e2 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - AssertThrows(() => e1.MoveNext()); - - HasNext(e2, 0); - HasNext(e2, 1); - AssertThrows(() => e2.MoveNext()); - } - - [TestMethod] - public void Memoize7() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - e1.Dispose(); - - var e2 = rng.GetEnumerator(); - HasNext(e2, 0); - HasNext(e2, 1); - e2.Dispose(); - - var e3 = rng.GetEnumerator(); - HasNext(e3, 0); - HasNext(e3, 1); - HasNext(e3, 2); - HasNext(e3, 3); - HasNext(e3, 4); - NoNext(e3); - } - - [TestMethod] - public void Memoize8() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = rng.GetEnumerator(); - HasNext(e1, 0); - HasNext(e1, 1); - HasNext(e1, 2); - - rng.Dispose(); - AssertThrows(() => e1.MoveNext()); - AssertThrows(() => rng.GetEnumerator()); - AssertThrows(() => ((IEnumerable)rng).GetEnumerator()); - } - - [TestMethod] - public void Memoize9() - { - var rng = Enumerable.Range(0, 5).Memoize(); - - var e1 = ((IEnumerable)rng).GetEnumerator(); - Assert.IsTrue(e1.MoveNext()); - Assert.AreEqual(0, (int)e1.Current); - } - - [TestMethod] - public void Memoize10() - { - var rnd = Rand().Take(1000).Memoize(); - Assert.IsTrue(rnd.Zip(rnd, (l, r) => l == r).All(x => x)); - } - - static Random s_rand = new Random(); - - static IEnumerable Rand() - { - while (true) - yield return s_rand.Next(); - } - - [TestMethod] - public void ShareLambda_Arguments() - { - AssertThrows(() => EnumerableEx.Share(null, xs => xs)); - AssertThrows(() => EnumerableEx.Share(new[] { 1 }, null)); - } - - [TestMethod] - public void ShareLambda() - { - var n = 0; - var res = Enumerable.Range(0, 10).Do(_ => n++).Share(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); - Assert.IsTrue(res.SequenceEqual(new[] { 0 + 1, 2 + 3, 4 + 5, 6 + 7 })); - Assert.AreEqual(8, n); - } - - [TestMethod] - public void PublishLambda_Arguments() - { - AssertThrows(() => EnumerableEx.Publish(null, xs => xs)); - AssertThrows(() => EnumerableEx.Publish(new[] { 1 }, null)); - } - - [TestMethod] - public void PublishLambda() - { - var n = 0; - var res = Enumerable.Range(0, 10).Do(_ => n++).Publish(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); - Assert.AreEqual(4, n); - } - - [TestMethod] - public void MemoizeLambda_Arguments() - { - AssertThrows(() => EnumerableEx.Memoize(null, xs => xs)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, null)); - } - - [TestMethod] - public void MemoizeLambda() - { - var n = 0; - var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); - Assert.AreEqual(4, n); - } - - [TestMethod] - public void MemoizeLimitedLambda_Arguments() - { - AssertThrows(() => EnumerableEx.Memoize(null, 2, xs => xs)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 2, null)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, 0, xs => xs)); - AssertThrows(() => EnumerableEx.Memoize(new[] { 1 }, -1, xs => xs)); - } - - [TestMethod] - public void MemoizeLimitedLambda() - { - var n = 0; - var res = Enumerable.Range(0, 10).Do(_ => n++).Memoize(2, xs => xs.Zip(xs, (l, r) => l + r).Take(4)).ToList(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 4).Select(x => x * 2))); - Assert.AreEqual(4, n); - } - } -} diff --git a/Ix/Tests/Tests.Creation.cs b/Ix/Tests/Tests.Creation.cs deleted file mode 100644 index 81fee03..0000000 --- a/Ix/Tests/Tests.Creation.cs +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Create_Arguments() - { - AssertThrows(() => EnumerableEx.Create(default(Func>))); - } - - [TestMethod] - public void Create1() - { - var hot = false; - var res = EnumerableEx.Create(() => - { - hot = true; - return MyEnumerator(); - }); - - Assert.IsFalse(hot); - - var e = res.GetEnumerator(); - Assert.IsTrue(hot); - - HasNext(e, 1); - HasNext(e, 2); - NoNext(e); - - hot = false; - var f = ((IEnumerable)res).GetEnumerator(); - Assert.IsTrue(hot); - } - - private static IEnumerator MyEnumerator() - { - yield return 1; - yield return 2; - } - - [TestMethod] - public void Return() - { - Assert.AreEqual(42, EnumerableEx.Return(42).Single()); - } - - [TestMethod] - public void Throw_Arguments() - { - AssertThrows(() => EnumerableEx.Throw(null)); - } - - [TestMethod] - public void Throw() - { - var ex = new MyException(); - var xs = EnumerableEx.Throw(ex); - - var e = xs.GetEnumerator(); - AssertThrows(() => e.MoveNext()); - } - - [TestMethod] - public void Defer_Arguments() - { - AssertThrows(() => EnumerableEx.Defer(null)); - } - - [TestMethod] - public void Defer1() - { - var i = 0; - var n = 5; - var xs = EnumerableEx.Defer(() => - { - i++; - return Enumerable.Range(0, n); - }); - - Assert.AreEqual(0, i); - - Assert.IsTrue(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n))); - Assert.AreEqual(1, i); - - n = 3; - Assert.IsTrue(Enumerable.SequenceEqual(xs, Enumerable.Range(0, n))); - Assert.AreEqual(2, i); - } - - [TestMethod] - public void Defer2() - { - var xs = EnumerableEx.Defer(() => - { - throw new MyException(); - }); - - AssertThrows(() => xs.GetEnumerator().MoveNext()); - } - - [TestMethod] - public void Generate_Arguments() - { - AssertThrows(() => EnumerableEx.Generate(0, null, _ => _, _ => _)); - AssertThrows(() => EnumerableEx.Generate(0, _ => true, null, _ => _)); - AssertThrows(() => EnumerableEx.Generate(0, _ => true, _ => _, null)); - } - - [TestMethod] - public void Generate() - { - var res = EnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0, 1, 4, 9, 16 })); - } - - [TestMethod] - public void Using_Arguments() - { - AssertThrows(() => EnumerableEx.Using(null, d => new[] { 1 })); - AssertThrows(() => EnumerableEx.Using(() => new MyDisposable(), null)); - } - - [TestMethod] - public void Using1() - { - var d = default(MyDisposable); - - var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => new[] { 1 }); - Assert.IsNull(d); - - var d1 = default(MyDisposable); - xs.ForEach(_ => { d1 = d; Assert.IsNotNull(d1); Assert.IsFalse(d1.Done); }); - Assert.IsTrue(d1.Done); - - var d2 = default(MyDisposable); - xs.ForEach(_ => { d2 = d; Assert.IsNotNull(d2); Assert.IsFalse(d2.Done); }); - Assert.IsTrue(d2.Done); - - Assert.AreNotSame(d1, d2); - } - - [TestMethod] - public void Using2() - { - var d = default(MyDisposable); - - var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => EnumerableEx.Throw(new MyException())); - Assert.IsNull(d); - - AssertThrows(() => xs.ForEach(_ => { })); - Assert.IsTrue(d.Done); - } - - [TestMethod] - public void Using3() - { - var d = default(MyDisposable); - - var xs = EnumerableEx.Using(() => d = new MyDisposable(), d_ => { throw new MyException(); }); - Assert.IsNull(d); - - AssertThrows(() => xs.ForEach(_ => { })); - Assert.IsTrue(d.Done); - } - - class MyDisposable : IDisposable - { - public bool Done; - - public void Dispose() - { - Done = true; - } - } - - [TestMethod] - public void RepeatElementInfinite() - { - var xs = EnumerableEx.Repeat(42).Take(1000); - Assert.IsTrue(xs.All(x => x == 42)); - Assert.IsTrue(xs.Count() == 1000); - } - - [TestMethod] - public void RepeatSequence_Arguments() - { - AssertThrows(() => EnumerableEx.Repeat(null)); - AssertThrows(() => EnumerableEx.Repeat(null, 5)); - AssertThrows(() => EnumerableEx.Repeat(new[] { 1 }, -1)); - } - - [TestMethod] - public void RepeatSequence1() - { - var i = 0; - var xs = new[] { 1, 2 }.Do(_ => i++).Repeat(); - - var res = xs.Take(10).ToList(); - Assert.AreEqual(10, res.Count); - Assert.IsTrue(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3)); - Assert.AreEqual(10, i); - } - - [TestMethod] - public void RepeatSequence2() - { - var i = 0; - var xs = new[] { 1, 2 }.Do(_ => i++).Repeat(5); - - var res = xs.ToList(); - Assert.AreEqual(10, res.Count); - Assert.IsTrue(res.Buffer(2).Select(b => b.Sum()).All(x => x == 3)); - Assert.AreEqual(10, i); - } - } -} diff --git a/Ix/Tests/Tests.Exceptions.cs b/Ix/Tests/Tests.Exceptions.cs deleted file mode 100644 index 38cabe4..0000000 --- a/Ix/Tests/Tests.Exceptions.cs +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Catch_Arguments() - { - AssertThrows(() => EnumerableEx.Catch(null, new[] { 1 })); - AssertThrows(() => EnumerableEx.Catch(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.Catch(default(IEnumerable[]))); - AssertThrows(() => EnumerableEx.Catch(default(IEnumerable>))); - AssertThrows(() => EnumerableEx.Catch(null, ex => new[] { 1 })); - AssertThrows(() => EnumerableEx.Catch(new[] { 1 }, null)); - } - - [TestMethod] - public void Catch1() - { - var ex = new MyException(); - var res = EnumerableEx.Throw(ex).Catch(e => { Assert.AreSame(ex, e); return new[] { 42 }; }).Single(); - Assert.AreEqual(42, res); - } - - [TestMethod] - public void Catch2() - { - var ex = new MyException(); - var res = EnumerableEx.Throw(ex).Catch(e => { Assert.AreSame(ex, e); return new[] { 42 }; }).Single(); - Assert.AreEqual(42, res); - } - - [TestMethod] - public void Catch3() - { - var ex = new MyException(); - AssertThrows(() => - { - EnumerableEx.Throw(ex).Catch(e => { Assert.Fail(); return new[] { 42 }; }).Single(); - }); - } - - [TestMethod] - public void Catch4() - { - var xs = Enumerable.Range(0, 10); - var res = xs.Catch(e => { Assert.Fail(); return new[] { 42 }; }); - Assert.IsTrue(xs.SequenceEqual(res)); - } - - [TestMethod] - public void Catch5() - { - var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; - var res = EnumerableEx.Catch(xss); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); - } - - [TestMethod] - public void Catch6() - { - var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; - var res = xss.Catch(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); - } - - [TestMethod] - public void Catch7() - { - var xss = new[] { Enumerable.Range(0, 5), Enumerable.Range(5, 5) }; - var res = xss[0].Catch(xss[1]); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 5))); - } - - [TestMethod] - public void Catch8() - { - var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; - var res = EnumerableEx.Catch(xss); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); - } - - [TestMethod] - public void Catch9() - { - var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; - var res = xss.Catch(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); - } - - [TestMethod] - public void Catch10() - { - var xss = new[] { Enumerable.Range(0, 5).Concat(EnumerableEx.Throw(new MyException())), Enumerable.Range(5, 5) }; - var res = xss[0].Catch(xss[1]); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); - } - - [TestMethod] - public void Catch11() - { - var e1 = new MyException(); - var ex1 = EnumerableEx.Throw(e1); - - var e2 = new MyException(); - var ex2 = EnumerableEx.Throw(e2); - - var e3 = new MyException(); - var ex3 = EnumerableEx.Throw(e3); - - var xss = new[] { Enumerable.Range(0, 2).Concat(ex1), Enumerable.Range(2, 2).Concat(ex2), ex3 }; - var res = xss.Catch(); - - var e = res.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 1); - HasNext(e, 2); - HasNext(e, 3); - AssertThrows(() => e.MoveNext(), ex => ex == e3); - } - - [TestMethod] - public void Finally_Arguments() - { - AssertThrows(() => EnumerableEx.Finally(null, () => { })); - AssertThrows(() => EnumerableEx.Finally(new[] { 1 }, null)); - } - - [TestMethod] - public void Finally1() - { - var done = false; - - var xs = Enumerable.Range(0, 2).Finally(() => done = true); - Assert.IsFalse(done); - - var e = xs.GetEnumerator(); - Assert.IsFalse(done); - - HasNext(e, 0); - Assert.IsFalse(done); - - HasNext(e, 1); - Assert.IsFalse(done); - - NoNext(e); - Assert.IsTrue(done); - } - - [TestMethod] - public void Finally2() - { - var done = false; - - var xs = Enumerable.Range(0, 2).Finally(() => done = true); - Assert.IsFalse(done); - - var e = xs.GetEnumerator(); - Assert.IsFalse(done); - - HasNext(e, 0); - Assert.IsFalse(done); - - e.Dispose(); - Assert.IsTrue(done); - } - - [TestMethod] - public void Finally3() - { - var done = false; - - var ex = new MyException(); - var xs = EnumerableEx.Throw(ex).Finally(() => done = true); - Assert.IsFalse(done); - - var e = xs.GetEnumerator(); - Assert.IsFalse(done); - - try - { - HasNext(e, 0); - Assert.Fail(); - } - catch (MyException ex_) - { - Assert.AreSame(ex, ex_); - } - - Assert.IsTrue(done); - } - - [TestMethod] - public void OnErrorResumeNext_Arguments() - { - AssertThrows(() => EnumerableEx.OnErrorResumeNext(null, new[] { 1 })); - AssertThrows(() => EnumerableEx.OnErrorResumeNext(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.OnErrorResumeNext(default(IEnumerable[]))); - AssertThrows(() => EnumerableEx.OnErrorResumeNext(default(IEnumerable>))); - } - - [TestMethod] - public void OnErrorResumeNext1() - { - var xs = new[] { 1, 2 }; - var ys = new[] { 3, 4 }; - - var res = xs.OnErrorResumeNext(ys); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); - } - - [TestMethod] - public void OnErrorResumeNext2() - { - var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); - var ys = new[] { 3, 4 }; - - var res = xs.OnErrorResumeNext(ys); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); - } - - [TestMethod] - public void OnErrorResumeNext3() - { - var xs = new[] { 1, 2 }; - var ys = new[] { 3, 4 }; - var zs = new[] { 5, 6 }; - - var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 })); - } - - [TestMethod] - public void OnErrorResumeNext4() - { - var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); - var ys = new[] { 3, 4 }; - var zs = new[] { 5, 6 }; - - var res = EnumerableEx.OnErrorResumeNext(xs, ys, zs); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5, 6 })); - } - - [TestMethod] - public void OnErrorResumeNext5() - { - var xs = new[] { 1, 2 }; - var ys = new[] { 3, 4 }; - - var res = new[] { xs, ys }.OnErrorResumeNext(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); - } - - [TestMethod] - public void OnErrorResumeNext6() - { - var xs = new[] { 1, 2 }.Concat(EnumerableEx.Throw(new MyException())); - var ys = new[] { 3, 4 }; - - var res = new[] { xs, ys }.OnErrorResumeNext(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4 })); - } - - [TestMethod] - public void Retry_Arguments() - { - AssertThrows(() => EnumerableEx.Retry(null)); - AssertThrows(() => EnumerableEx.Retry(null, 5)); - AssertThrows(() => EnumerableEx.Retry(new[] { 1 }, -1)); - } - - [TestMethod] - public void Retry1() - { - var xs = Enumerable.Range(0, 10); - - var res = xs.Retry(); - Assert.IsTrue(Enumerable.SequenceEqual(res, xs)); - } - - [TestMethod] - public void Retry2() - { - var xs = Enumerable.Range(0, 10); - - var res = xs.Retry(2); - Assert.IsTrue(Enumerable.SequenceEqual(res, xs)); - } - - [TestMethod] - public void Retry3() - { - var ex = new MyException(); - var xs = Enumerable.Range(0, 2).Concat(EnumerableEx.Throw(ex)); - - var res = xs.Retry(2); - var e = res.GetEnumerator(); - HasNext(e, 0); - HasNext(e, 1); - HasNext(e, 0); - HasNext(e, 1); - AssertThrows(() => e.MoveNext(), ex_ => ex == ex_); - } - } -} diff --git a/Ix/Tests/Tests.Imperative.cs b/Ix/Tests/Tests.Imperative.cs deleted file mode 100644 index 3b038c6..0000000 --- a/Ix/Tests/Tests.Imperative.cs +++ /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. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void While_Arguments() - { - AssertThrows(() => EnumerableEx.While(null, new[] { 1 })); - AssertThrows(() => EnumerableEx.While(() => true, null)); - } - - [TestMethod] - public void While1() - { - var x = 5; - var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 })); - } - - [TestMethod] - public void While2() - { - var x = 0; - var res = EnumerableEx.While(() => x > 0, EnumerableEx.Defer(() => new[] { x }).Do(_ => x--)).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new int[0])); - } - - [TestMethod] - public void DoWhile_Arguments() - { - AssertThrows(() => EnumerableEx.DoWhile(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.DoWhile(null, () => true)); - } - - [TestMethod] - public void DoWhile1() - { - var x = 5; - var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 5, 4, 3, 2, 1 })); - } - - [TestMethod] - public void DoWhile2() - { - var x = 0; - var res = EnumerableEx.DoWhile(EnumerableEx.Defer(() => new[] { x }).Do(_ => x--), () => x > 0).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0 })); - } - - [TestMethod] - public void If_Arguments() - { - AssertThrows(() => EnumerableEx.If(null, new[] { 1 })); - AssertThrows(() => EnumerableEx.If(() => true, null)); - AssertThrows(() => EnumerableEx.If(null, new[] { 1 }, new[] { 1 })); - AssertThrows(() => EnumerableEx.If(() => true, null, new[] { 1 })); - AssertThrows(() => EnumerableEx.If(() => true, new[] { 1 }, null)); - } - - [TestMethod] - public void If1() - { - var x = 5; - var res = EnumerableEx.If(() => x > 0, new[] { +1 }, new[] { -1 }); - - Assert.AreEqual(+1, res.Single()); - - x = -x; - Assert.AreEqual(-1, res.Single()); - } - - [TestMethod] - public void If2() - { - var x = 5; - var res = EnumerableEx.If(() => x > 0, new[] { +1 }); - - Assert.AreEqual(+1, res.Single()); - - x = -x; - Assert.IsTrue(res.IsEmpty()); - } - - [TestMethod] - public void Case_Arguments() - { - AssertThrows(() => EnumerableEx.Case(null, new Dictionary>())); - AssertThrows(() => EnumerableEx.Case(() => 1, null)); - AssertThrows(() => EnumerableEx.Case(null, new Dictionary>(), new[] { 1 })); - AssertThrows(() => EnumerableEx.Case(() => 1, null, new[] { 1 })); - AssertThrows(() => EnumerableEx.Case(() => 1, new Dictionary>(), null)); - } - - [TestMethod] - public void Case1() - { - var x = 1; - var d = 'd'; - var res = EnumerableEx.Case(() => x, new Dictionary> - { - { 0, new[] { 'a' } }, - { 1, new[] { 'b' } }, - { 2, new[] { 'c' } }, - { 3, EnumerableEx.Defer(() => new[] { d }) }, - }); - - Assert.AreEqual('b', res.Single()); - Assert.AreEqual('b', res.Single()); - - x = 0; - Assert.AreEqual('a', res.Single()); - - x = 2; - Assert.AreEqual('c', res.Single()); - - x = 3; - Assert.AreEqual('d', res.Single()); - - d = 'e'; - Assert.AreEqual('e', res.Single()); - - x = 4; - Assert.IsTrue(res.IsEmpty()); - } - - [TestMethod] - public void Case2() - { - var x = 1; - var d = 'd'; - var res = EnumerableEx.Case(() => x, new Dictionary> - { - { 0, new[] { 'a' } }, - { 1, new[] { 'b' } }, - { 2, new[] { 'c' } }, - { 3, EnumerableEx.Defer(() => new[] { d }) }, - }, new[] { 'z' }); - - Assert.AreEqual('b', res.Single()); - Assert.AreEqual('b', res.Single()); - - x = 0; - Assert.AreEqual('a', res.Single()); - - x = 2; - Assert.AreEqual('c', res.Single()); - - x = 3; - Assert.AreEqual('d', res.Single()); - - d = 'e'; - Assert.AreEqual('e', res.Single()); - - x = 4; - Assert.AreEqual('z', res.Single()); - } - - [TestMethod] - public void For_Arguments() - { - AssertThrows(() => EnumerableEx.For(null, x => new[] { 1 })); - AssertThrows(() => EnumerableEx.For(new[] { 1 }, null)); - } - - [TestMethod] - public void For() - { - var res = EnumerableEx.For(new[] { 1, 2, 3 }, x => Enumerable.Range(0, x)).ToList(); - Assert.IsTrue(res.SequenceEqual(new[] { 0, 0, 1, 0, 1, 2 })); - } - } -} diff --git a/Ix/Tests/Tests.Multiple.cs b/Ix/Tests/Tests.Multiple.cs deleted file mode 100644 index 3df8927..0000000 --- a/Ix/Tests/Tests.Multiple.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Concat_Arguments() - { - AssertThrows(() => EnumerableEx.Concat(default(IEnumerable[]))); - AssertThrows(() => EnumerableEx.Concat(default(IEnumerable>))); - } - - [TestMethod] - public void Concat1() - { - var res = new[] - { - new[] { 1, 2, 3 }, - new[] { 4, 5 } - }.Concat(); - - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 })); - } - - [TestMethod] - public void Concat2() - { - var i = 0; - var xss = Enumerable.Range(0, 3).Select(x => Enumerable.Range(0, x + 1)).Do(_ => ++i); - - var res = xss.Concat().Select(x => i + " - " + x).ToList(); - - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { - "1 - 0", - "2 - 0", - "2 - 1", - "3 - 0", - "3 - 1", - "3 - 2", - })); - } - - [TestMethod] - public void Concat3() - { - var res = EnumerableEx.Concat( - new[] { 1, 2, 3 }, - new[] { 4, 5 } - ); - - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 4, 5 })); - } - - [TestMethod] - public void SelectMany_Arguments() - { - AssertThrows(() => EnumerableEx.SelectMany(null, new[] { 1 })); - AssertThrows(() => EnumerableEx.SelectMany(new[] { 1 }, null)); - } - - [TestMethod] - public void SelectMany() - { - var res = new[] { 1, 2 }.SelectMany(new[] { 'a', 'b', 'c' }).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 'a', 'b', 'c', 'a', 'b', 'c' })); - } - } -} diff --git a/Ix/Tests/Tests.Qbservable.cs b/Ix/Tests/Tests.Qbservable.cs deleted file mode 100644 index d174eee..0000000 --- a/Ix/Tests/Tests.Qbservable.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if !SILVERLIGHTM7 - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Runtime.CompilerServices; -using System.Linq.Expressions; -using System.ComponentModel; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Queryable_Enumerable_Parity() - { - var enu = typeof(EnumerableEx).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList(); - var qry = typeof(QueryableEx).GetMethods(BindingFlags.Public | BindingFlags.Static).ToList(); - - var onlyInObs = enu.Select(m => m.Name).Except(qry.Select(m => m.Name)).Except(new[] { "ForEach", "ToEnumerable", "Multicast", "GetAwaiter", "ToEvent", "ToEventPattern", "ForEachAsync" }).ToList(); - var onlyInQbs = qry.Select(m => m.Name).Except(enu.Select(m => m.Name)).Except(new[] { "ToQueryable", "get_Provider", "Empty", "Range" }).ToList(); - - Assert.IsTrue(onlyInObs.Count == 0, "Missing Queryable operator: " + string.Join(", ", onlyInObs.ToArray())); - Assert.IsTrue(onlyInQbs.Count == 0, "Missing Enumerable operator: " + string.Join(", ", onlyInQbs.ToArray())); - - var enus = enu.GroupBy(m => m.Name); - var qrys = qry.GroupBy(m => m.Name); - var mtch = (from o in enus - join q in qrys on o.Key equals q.Key - select new { Name = o.Key, Enumerable = o.ToList(), Queryable = q.ToList() }) - .ToList(); - - Func filterReturn = t => - { - if (t.IsGenericType) - { - var gd = t.GetGenericTypeDefinition(); - if (gd == typeof(IBuffer<>)) - return false; - } - return true; - }; - - Func filterHelper = m => - { - return !m.IsDefined(typeof(EditorBrowsableAttribute), false); - }; - - foreach (var group in mtch) - { - var oss = group.Enumerable.Where(m => filterReturn(m.ReturnType)).Select(m => GetSignature(m, false)).OrderBy(x => x).ToList(); - var qss = group.Queryable.Where(m => filterHelper(m)).Select(m => GetSignature(m, true)).OrderBy(x => x).ToList(); - - Assert.IsTrue(oss.SequenceEqual(qss), "Mismatch between QueryableEx and EnumerableEx for " + group.Name); - } - } - - public static string GetSignature(MethodInfo m, bool correct) - { - var ps = m.GetParameters(); - var pss = ps.AsEnumerable(); - if (correct && ps.Length > 0 && ps[0].ParameterType == typeof(IQueryProvider)) - pss = pss.Skip(1); - - var gens = m.IsGenericMethod ? string.Format("<{0}>", string.Join(", ", m.GetGenericArguments().Select(a => GetTypeName(a, correct)).ToArray())) : ""; - - var pars = string.Join(", ", pss.Select(p => (Attribute.IsDefined(p, typeof(ParamArrayAttribute)) ? "params " : "") + GetTypeName(p.ParameterType, correct) + " " + p.Name).ToArray()); - if (Attribute.IsDefined(m, typeof(ExtensionAttribute))) - { - if (pars.StartsWith("IQbservable") || pars.StartsWith("IQueryable")) - pars = "this " + pars; - } - - return string.Format("{0} {1}{2}({3})", GetTypeName(m.ReturnType, correct), m.Name, gens, pars); - } - - public static string GetTypeName(Type t, bool correct) - { - if (t.IsGenericType) - { - var gtd = t.GetGenericTypeDefinition(); - if (gtd == typeof(Expression<>)) - return GetTypeName(t.GetGenericArguments()[0], false); - - var args = string.Join(", ", t.GetGenericArguments().Select(a => GetTypeName(a, false)).ToArray()); - - var len = t.Name.IndexOf('`'); - var name = len >= 0 ? t.Name.Substring(0, len) : t.Name; - if (correct && name == "IQbservable") - name = "IObservable"; - if (correct && name == "IQueryable") - name = "IEnumerable"; - - return string.Format("{0}<{1}>", name, args); - } - - if (t.IsArray) - { - return GetTypeName(t.GetElementType(), correct) + "[]"; - } - - return t.Name; - } - - [TestMethod] - public void QueryableRetarget1() - { - var res = QueryableEx.Provider.Empty().AsEnumerable().ToList(); - Assert.IsTrue(res.SequenceEqual(new int[0])); - } - - [TestMethod] - public void QueryableRetarget2() - { - var res = QueryableEx.Provider.Return(42).AsEnumerable().ToList(); - Assert.IsTrue(res.SequenceEqual(new[] { 42 })); - } - - [TestMethod] - public void QueryableRetarget3() - { - var res = Enumerable.Range(0, 10).AsQueryable().TakeLast(2).AsEnumerable().ToList(); - Assert.IsTrue(res.SequenceEqual(new[] { 8, 9 })); - } - - [TestMethod] - public void QueryableRetarget4() - { - var res = QueryableEx.Provider.Range(0, 10).AsEnumerable().ToList(); - Assert.IsTrue(res.SequenceEqual(Enumerable.Range(0, 10))); - } - } -} - -#endif \ No newline at end of file diff --git a/Ix/Tests/Tests.Single.cs b/Ix/Tests/Tests.Single.cs deleted file mode 100644 index 6054f54..0000000 --- a/Ix/Tests/Tests.Single.cs +++ /dev/null @@ -1,431 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - public partial class Tests - { - [TestMethod] - public void Hide_Arguments() - { - AssertThrows(() => EnumerableEx.Hide(null)); - } - - [TestMethod] - public void Hide() - { - var xs = new List { 1, 2, 3 }; - var ys = xs.Hide(); - Assert.IsFalse(ys is List); - Assert.IsTrue(xs.SequenceEqual(ys)); - } - - [TestMethod] - public void ForEach_Arguments() - { - AssertThrows(() => EnumerableEx.ForEach(null, x => { })); - AssertThrows(() => EnumerableEx.ForEach(new[] { 1 }, default(Action))); - AssertThrows(() => EnumerableEx.ForEach(null, (x, i) => { })); - AssertThrows(() => EnumerableEx.ForEach(new[] { 1 }, default(Action))); - } - - [TestMethod] - public void ForEach1() - { - var n = 0; - Enumerable.Range(5, 3).ForEach(x => n += x); - Assert.AreEqual(5 + 6 + 7, n); - } - - [TestMethod] - public void ForEach2() - { - var n = 0; - Enumerable.Range(5, 3).ForEach((x, i) => n += x * i); - Assert.AreEqual(5 * 0 + 6 * 1 + 7 * 2, n); - } - - [TestMethod] - public void Buffer_Arguments() - { - AssertThrows(() => EnumerableEx.Buffer(null, 5)); - AssertThrows(() => EnumerableEx.Buffer(null, 5, 3)); - AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 0)); - AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 5, 0)); - AssertThrows(() => EnumerableEx.Buffer(new[] { 1 }, 0, 3)); - } - - [TestMethod] - public void Buffer1() - { - var rng = Enumerable.Range(0, 10); - - var res = rng.Buffer(3).ToList(); - Assert.AreEqual(4, res.Count); - - Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); - Assert.IsTrue(res[1].SequenceEqual(new[] { 3, 4, 5 })); - Assert.IsTrue(res[2].SequenceEqual(new[] { 6, 7, 8 })); - Assert.IsTrue(res[3].SequenceEqual(new[] { 9 })); - } - - [TestMethod] - public void Buffer2() - { - var rng = Enumerable.Range(0, 10); - - var res = rng.Buffer(5).ToList(); - Assert.AreEqual(2, res.Count); - - Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2, 3, 4 })); - Assert.IsTrue(res[1].SequenceEqual(new[] { 5, 6, 7, 8, 9 })); - } - - [TestMethod] - public void Buffer3() - { - var rng = Enumerable.Empty(); - - var res = rng.Buffer(5).ToList(); - Assert.AreEqual(0, res.Count); - } - - [TestMethod] - public void Buffer4() - { - var rng = Enumerable.Range(0, 10); - - var res = rng.Buffer(3, 2).ToList(); - Assert.AreEqual(5, res.Count); - - Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); - Assert.IsTrue(res[1].SequenceEqual(new[] { 2, 3, 4 })); - Assert.IsTrue(res[2].SequenceEqual(new[] { 4, 5, 6 })); - Assert.IsTrue(res[3].SequenceEqual(new[] { 6, 7, 8 })); - Assert.IsTrue(res[4].SequenceEqual(new[] { 8, 9 })); - } - - [TestMethod] - public void Buffer5() - { - var rng = Enumerable.Range(0, 10); - - var res = rng.Buffer(3, 4).ToList(); - Assert.AreEqual(3, res.Count); - - Assert.IsTrue(res[0].SequenceEqual(new[] { 0, 1, 2 })); - Assert.IsTrue(res[1].SequenceEqual(new[] { 4, 5, 6 })); - Assert.IsTrue(res[2].SequenceEqual(new[] { 8, 9 })); - } - - [TestMethod] - public void Do_Arguments() - { - AssertThrows(() => EnumerableEx.Do(null, _ => { })); - AssertThrows(() => EnumerableEx.Do(null, _ => { }, () => { })); - AssertThrows(() => EnumerableEx.Do(null, _ => { }, _ => { })); - AssertThrows(() => EnumerableEx.Do(null, _ => { }, _ => { }, () => { })); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action))); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), () => { })); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action))); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), _ => { }, () => { })); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action), () => { })); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, _ => { }, default(Action))); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(Action), _ => { })); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, _ => { }, default(Action))); -#if !NO_RXINTERFACES - AssertThrows(() => EnumerableEx.Do(null, new MyObserver())); - AssertThrows(() => EnumerableEx.Do(new[] { 1 }, default(IObserver))); -#endif - } - - [TestMethod] - public void Do1() - { - var n = 0; - Enumerable.Range(0, 10).Do(x => n += x).ForEach(_ => { }); - Assert.AreEqual(45, n); - } - - [TestMethod] - public void Do2() - { - var n = 0; - Enumerable.Range(0, 10).Do(x => n += x, () => n *= 2).ForEach(_ => { }); - Assert.AreEqual(90, n); - } - - [TestMethod] - public void Do3() - { - var ex = new MyException(); - var ok = false; - AssertThrows(() => - EnumerableEx.Throw(ex).Do(x => { Assert.Fail(); }, e => { Assert.AreEqual(ex, e); ok = true; }).ForEach(_ => { }) - ); - Assert.IsTrue(ok); - } - -#if !NO_RXINTERFACES - [TestMethod] - public void Do4() - { - var obs = new MyObserver(); - Enumerable.Range(0, 10).Do(obs).ForEach(_ => { }); - - Assert.IsTrue(obs.Done); - Assert.AreEqual(45, obs.Sum); - } - - class MyObserver : IObserver - { - public int Sum; - public bool Done; - - public void OnCompleted() - { - Done = true; - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnNext(int value) - { - Sum += value; - } - } -#endif - - [TestMethod] - public void Do5() - { - var sum = 0; - var done = false; - Enumerable.Range(0, 10).Do(x => sum += x, ex => { throw ex; }, () => done = true).ForEach(_ => { }); - - Assert.IsTrue(done); - Assert.AreEqual(45, sum); - } - - [TestMethod] - public void StartWith_Arguments() - { - AssertThrows(() => EnumerableEx.StartWith(null, 5)); - } - - [TestMethod] - public void StartWith1() - { - var e = Enumerable.Range(1, 5); - var r = e.StartWith(0).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, Enumerable.Range(0, 6))); - } - - [TestMethod] - public void StartWith2() - { - var oops = false; - var e = Enumerable.Range(1, 5).Do(_ => oops = true); - var r = e.StartWith(0).Take(1).ToList(); - Assert.IsFalse(oops); - } - - [TestMethod] - public void Expand_Arguments() - { - AssertThrows(() => EnumerableEx.Expand(null, _ => new[] { _ })); - AssertThrows(() => EnumerableEx.Expand(new[] { 1 }, null)); - } - - [TestMethod] - public void Expand1() - { - var res = new[] { 0 }.Expand(x => new[] { x + 1 }).Take(10).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, Enumerable.Range(0, 10))); - } - - [TestMethod] - public void Expand2() - { - var res = new[] { 3 }.Expand(x => Enumerable.Range(0, x)).ToList(); - var exp = new[] { - 3, - 0, 1, 2, - 0, - 0, 1, - 0 - }; - Assert.IsTrue(Enumerable.SequenceEqual(res, exp)); - } - - [TestMethod] - public void Distinct_Arguments() - { - AssertThrows(() => EnumerableEx.Distinct(null, _ => _)); - AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.Distinct(null, _ => _, EqualityComparer.Default)); - AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, null, EqualityComparer.Default)); - AssertThrows(() => EnumerableEx.Distinct(new[] { 1 }, _ => _, null)); - } - - [TestMethod] - public void Distinct1() - { - var res = Enumerable.Range(0, 10).Distinct(x => x % 5).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, Enumerable.Range(0, 5))); - } - - [TestMethod] - public void Distinct2() - { - var res = Enumerable.Range(0, 10).Distinct(x => x % 5, new MyEqualityComparer()).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 0, 1 })); - } - - class MyEqualityComparer : IEqualityComparer - { - public bool Equals(int x, int y) - { - return x % 2 == y % 2; - } - - public int GetHashCode(int obj) - { - return EqualityComparer.Default.GetHashCode(obj % 2); - } - } - - [TestMethod] - public void DistinctUntilChanged_Arguments() - { - AssertThrows(() => EnumerableEx.DistinctUntilChanged(null)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, EqualityComparer.Default)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, _ => _)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(null, _ => _, EqualityComparer.Default)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, null, EqualityComparer.Default)); - AssertThrows(() => EnumerableEx.DistinctUntilChanged(new[] { 1 }, _ => _, null)); - } - - [TestMethod] - public void DistinctUntilChanged1() - { - var res = new[] { 1, 2, 2, 3, 3, 3, 2, 2, 1 }.DistinctUntilChanged().ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 3, 2, 1 })); - } - - [TestMethod] - public void DistinctUntilChanged2() - { - var res = new[] { 1, 1, 2, 3, 4, 5, 5, 6, 7 }.DistinctUntilChanged(x => x / 2).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 2, 4, 6 })); - } - - [TestMethod] - public void IgnoreElements_Arguments() - { - AssertThrows(() => EnumerableEx.IgnoreElements(null)); - } - - [TestMethod] - public void IgnoreElements() - { - var n = 0; - Enumerable.Range(0, 10).Do(_ => n++).IgnoreElements().Take(5).ForEach(_ => { }); - Assert.AreEqual(10, n); - } - - [TestMethod] - public void TakeLast_Arguments() - { - AssertThrows(() => EnumerableEx.TakeLast(null, 5)); - AssertThrows(() => EnumerableEx.TakeLast(new[] { 1 }, -1)); - } - - [TestMethod] - public void TakeLast_Empty() - { - var e = Enumerable.Empty(); - var r = e.TakeLast(1).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e)); - } - - [TestMethod] - public void TakeLast_All() - { - var e = Enumerable.Range(0, 5); - var r = e.TakeLast(5).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e)); - } - - [TestMethod] - public void TakeLast_Part() - { - var e = Enumerable.Range(0, 5); - var r = e.TakeLast(3).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e.Skip(2))); - } - - [TestMethod] - public void SkipLast_Arguments() - { - AssertThrows(() => EnumerableEx.SkipLast(null, 5)); - AssertThrows(() => EnumerableEx.SkipLast(new[] { 1 }, -1)); - } - - [TestMethod] - public void SkipLast_Empty() - { - var e = Enumerable.Empty(); - var r = e.SkipLast(1).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e)); - } - - [TestMethod] - public void SkipLast_All() - { - var e = Enumerable.Range(0, 5); - var r = e.SkipLast(0).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e)); - } - - [TestMethod] - public void SkipLast_Part() - { - var e = Enumerable.Range(0, 5); - var r = e.SkipLast(3).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(r, e.Take(2))); - } - - [TestMethod] - public void Scan_Arguments() - { - AssertThrows(() => EnumerableEx.Scan(null, (x, y) => x + y)); - AssertThrows(() => EnumerableEx.Scan(new[] { 1 }, null)); - AssertThrows(() => EnumerableEx.Scan(null, 0, (x, y) => x + y)); - AssertThrows(() => EnumerableEx.Scan(new[] { 1 }, 0, null)); - } - - [TestMethod] - public void Scan1() - { - var res = Enumerable.Range(0, 5).Scan((n, x) => n + x).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 1, 3, 6, 10 })); - } - - [TestMethod] - public void Scan2() - { - var res = Enumerable.Range(0, 5).Scan(10, (n, x) => n - x).ToList(); - Assert.IsTrue(Enumerable.SequenceEqual(res, new[] { 10, 9, 7, 4, 0 })); - } - } -} diff --git a/Ix/Tests/Tests.cs b/Ix/Tests/Tests.cs deleted file mode 100644 index 27dca14..0000000 --- a/Ix/Tests/Tests.cs +++ /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. -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Tests -{ - [TestClass] - public partial class Tests - { - public void AssertThrows(Action a) - where E : Exception - { - try - { - a(); - Assert.Fail(); - } - catch (E) - { - } - } - - public void AssertThrows(Action a, Func assert) - where E : Exception - { - try - { - a(); - Assert.Fail(); - } - catch (E e) - { - Assert.IsTrue(assert(e)); - } - } - - public void NoNext(IEnumerator e) - { - Assert.IsFalse(e.MoveNext()); - } - - public void HasNext(IEnumerator e, T value) - { - Assert.IsTrue(e.MoveNext()); - Assert.AreEqual(value, e.Current); - } - } -} diff --git a/Ix/Tests/Tests.csproj b/Ix/Tests/Tests.csproj deleted file mode 100644 index f3f57ff..0000000 --- a/Ix/Tests/Tests.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - Debug - AnyCPU - - - 2.0 - {C4C8532A-F8D2-428B-962E-FD578A1E647C} - Library - Properties - Tests - Tests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - - true - true - $(AssemblyName).xap - true - Properties\AppManifest.xml - InteractiveTests.App - TestPage.html - true - - - - _$(AssemblyName) - - - - - ..\..\..\..\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll - - - - - - - - - true - - - - - - - False - - - - - - - - - - - - - - - - - - - - - - - - - - {7269A578-326A-4C3E-9874-A2D2600095BC} - System.Interactive.Async - - - {6D62E966-469D-4A99-BD43-0A17FA14FB4F} - System.Interactive.Providers - - - {8E4B04F0-915E-48F9-9796-76278C6094BD} - System.Interactive - - - - \ No newline at end of file diff --git a/Ix/TraceAndTestImpact.testsettings b/Ix/TraceAndTestImpact.testsettings deleted file mode 100644 index 363295b..0000000 --- a/Ix/TraceAndTestImpact.testsettings +++ /dev/null @@ -1,21 +0,0 @@ - - - These are test settings for Trace and Test Impact. - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Rx++/.gitattributes b/Rx++/.gitattributes deleted file mode 100644 index 412eeda..0000000 --- a/Rx++/.gitattributes +++ /dev/null @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/Rx++/.gitignore b/Rx++/.gitignore deleted file mode 100644 index 5ebd21a..0000000 --- a/Rx++/.gitignore +++ /dev/null @@ -1,163 +0,0 @@ -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## 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/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# 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 - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.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 - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store diff --git a/Rx++/license.txt b/Rx++/license.txt deleted file mode 100644 index 5b47fbd..0000000 --- a/Rx++/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/.gitattributes b/Rx/CPP/.gitattributes similarity index 100% rename from Ix/.gitattributes rename to Rx/CPP/.gitattributes diff --git a/Ix/.gitignore b/Rx/CPP/.gitignore similarity index 100% rename from Ix/.gitignore rename to Rx/CPP/.gitignore diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MainFrm.cpp rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MainFrm.h rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj diff --git a/Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters rename to Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters diff --git a/Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt b/Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/ReadMe.txt rename to Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt diff --git a/Rx++/MfcTimeFliesLikeAnArrow/Resource.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/Resource.h rename to Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h diff --git a/Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico b/Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico rename to Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico diff --git a/Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 b/Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 rename to Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 diff --git a/Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/stdafx.cpp rename to Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp diff --git a/Rx++/MfcTimeFliesLikeAnArrow/stdafx.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/stdafx.h rename to Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h diff --git a/Rx++/MfcTimeFliesLikeAnArrow/targetver.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h similarity index 100% rename from Rx++/MfcTimeFliesLikeAnArrow/targetver.h rename to Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h diff --git a/Rx++/RxCpp.sln b/Rx/CPP/RxCpp.sln similarity index 100% rename from Rx++/RxCpp.sln rename to Rx/CPP/RxCpp.sln diff --git a/Ix/license.txt b/Rx/CPP/license.txt similarity index 100% rename from Ix/license.txt rename to Rx/CPP/license.txt diff --git a/Rx++/testbench/rxcpp-binder.h b/Rx/CPP/testbench/rxcpp-binder.h similarity index 100% rename from Rx++/testbench/rxcpp-binder.h rename to Rx/CPP/testbench/rxcpp-binder.h diff --git a/Rx++/testbench/rxcpp.h b/Rx/CPP/testbench/rxcpp.h similarity index 100% rename from Rx++/testbench/rxcpp.h rename to Rx/CPP/testbench/rxcpp.h diff --git a/Rx++/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp similarity index 100% rename from Rx++/testbench/testbench.cpp rename to Rx/CPP/testbench/testbench.cpp diff --git a/Rx++/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj similarity index 100% rename from Rx++/testbench/testbench.vcxproj rename to Rx/CPP/testbench/testbench.vcxproj diff --git a/Rx++/testbench/testbench.vcxproj.filters b/Rx/CPP/testbench/testbench.vcxproj.filters similarity index 100% rename from Rx++/testbench/testbench.vcxproj.filters rename to Rx/CPP/testbench/testbench.vcxproj.filters -- GitLab From e6a9df4ff6a4e3e9ab9fc5dcea4137d6dcf324ab Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 7 Feb 2013 01:11:48 -0800 Subject: [PATCH 009/782] Get the CPP linq sample compiling on clang 4.1 (OSX) --- .../samples/SampleCppLinq/SampleCppLinq.cpp | 8 +++---- Ix/CPP/src/cpplinq/linq.hpp | 21 +++++++++++++++---- Ix/CPP/src/cpplinq/linq_iterators.hpp | 8 +++---- Ix/CPP/src/cpplinq/util.hpp | 13 ++++++++++-- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp index e459e4b..3e6483e 100644 --- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp +++ b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp @@ -3,8 +3,6 @@ // SampleCppLinq.cpp : Defines the entry point for the console application. // -#include - #include #include #include @@ -16,6 +14,8 @@ #include #include +#include + using namespace std; vector load_data(); @@ -52,7 +52,7 @@ void run() for (auto giter = data.begin(), end = data.end(); giter != end; ++giter) { - auto& g = *giter; + const auto& g = *giter; cout << "arguments: " << g.key << endl; @@ -63,7 +63,7 @@ void run() for (auto giter = seq.begin(), end = seq.end(); giter != end; ++giter) { - auto& g = *giter; + const auto& g = *giter; cout << g.key << ", "; diff --git a/Ix/CPP/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp index 1070331..7a7f6c2 100644 --- a/Ix/CPP/src/cpplinq/linq.hpp +++ b/Ix/CPP/src/cpplinq/linq.hpp @@ -149,6 +149,15 @@ #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" @@ -242,7 +251,7 @@ public: template linq_driver< linq_where > where(Predicate p) const { - return typename linq_where(c, std::move(p) ); + return linq_where(c, std::move(p) ); } @@ -266,7 +275,7 @@ public: return std::accumulate(begin(), end(), initialValue, fn); } - bool any() const { return !empty(cur); } + bool any() const { auto cur = c.get_cursor(); return !cur.empty(); } template bool any(Predicate p) const { @@ -282,12 +291,16 @@ public: // 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 auto cast() -> decltype(static_cast(0)->select(detail::cast_to())) { return this->select(detail::cast_to()); } +#endif // TODO: concat @@ -295,12 +308,12 @@ public: return std::find(begin(), end(), value) != end(); } - typename std::iterator_traits::distance_type count() const { + typename std::iterator_traits::difference_type count() const { return std::distance(begin(), end()); } template - typename std::iterator_traits::distance_type count(Predicate p) const { + typename std::iterator_traits::difference_type count(Predicate p) const { auto filtered = this->where(p); return std::distance(begin(filtered), end(filtered)); } diff --git a/Ix/CPP/src/cpplinq/linq_iterators.hpp b/Ix/CPP/src/cpplinq/linq_iterators.hpp index ed267ec..a04b217 100644 --- a/Ix/CPP/src/cpplinq/linq_iterators.hpp +++ b/Ix/CPP/src/cpplinq/linq_iterators.hpp @@ -74,16 +74,16 @@ namespace cpplinq { namespace util { template typename std::iterator_traits::pointer deref_iterator(const Iter& it) { - return detail::deref_iterator(it, std::identity::reference>()); + return deref_iterator(it, util::identity::reference>()); } template - T* deref_iterator(const Iter& it, std::identity) { + T* deref_iterator(const Iter& it, util::identity) { return &*it; } template - util::value_ptr deref_iterator(const Iter& it, std::identity) { + util::value_ptr deref_iterator(const Iter& it, util::identity) { return util::value_ptr(*it); } } @@ -137,7 +137,7 @@ namespace cpplinq { return cur->get(); } - pointer operator->() const { + typename cursor_iterator::pointer operator->() const { auto& v = **this; return &v; } diff --git a/Ix/CPP/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp index 6fb62ff..f1e5222 100644 --- a/Ix/CPP/src/cpplinq/util.hpp +++ b/Ix/CPP/src/cpplinq/util.hpp @@ -104,17 +104,26 @@ namespace cpplinq { namespace util { detail::instance(), detail::instance())) type; }; -#else +#elif defined(_MSC_VER) template struct result_of : std::tr1::result_of {}; +#else + using std::result_of; #endif + template + 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 struct value_ptr { T value; - value_ptr(const T& pvalue) : value(value) + value_ptr(const T& value) : value(value) {} value_ptr(const T* pvalue) : value(*pvalue) {} -- GitLab From 58d879ed4e3b1224f37e3e8dd1f565379cdd21ae Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 7 Feb 2013 08:40:25 -0800 Subject: [PATCH 010/782] Restore the intended include dependencies clang commandline: clang++ -stdlib=libc++ -std=c++0x -I/Rx/rx/Ix/CPP/src/ SampleCppLinq.cpp --- Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp | 4 ++-- Ix/CPP/src/cpplinq/linq.hpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp index 3e6483e..4a1b499 100644 --- a/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp +++ b/Ix/CPP/samples/SampleCppLinq/SampleCppLinq.cpp @@ -3,6 +3,8 @@ // SampleCppLinq.cpp : Defines the entry point for the console application. // +#include + #include #include #include @@ -14,8 +16,6 @@ #include #include -#include - using namespace std; vector load_data(); diff --git a/Ix/CPP/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp index 7a7f6c2..2d7c1e7 100644 --- a/Ix/CPP/src/cpplinq/linq.hpp +++ b/Ix/CPP/src/cpplinq/linq.hpp @@ -131,6 +131,8 @@ #include #include +#include +#include #include #include #include -- GitLab From e703693c1b5c7e28c08d65007ed2c05de4675e44 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Feb 2013 14:19:55 -0800 Subject: [PATCH 011/782] publish Rx CPP a little more formally --- Ix/CPP/.gitignore | 7 +++- Rx/CPP/.gitignore | 2 ++ .../MfcTimeFliesLikeAnArrow.vcxproj | 4 +-- Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h | 2 +- .../rxcpp.h => src/cpprx/rx-base.hpp} | 29 ++-------------- .../rxcpp-binder.h => src/cpprx/rx.hpp} | 33 ++++++++++++++++++- Rx/CPP/testbench/testbench.cpp | 2 +- Rx/CPP/testbench/testbench.vcxproj | 6 ++-- 8 files changed, 49 insertions(+), 36 deletions(-) rename Rx/CPP/{testbench/rxcpp.h => src/cpprx/rx-base.hpp} (98%) rename Rx/CPP/{testbench/rxcpp-binder.h => src/cpprx/rx.hpp} (76%) diff --git a/Ix/CPP/.gitignore b/Ix/CPP/.gitignore index 8bbd318..579772e 100644 --- a/Ix/CPP/.gitignore +++ b/Ix/CPP/.gitignore @@ -106,4 +106,9 @@ Generated_Code #added for RIA/Silverlight projects # Visual Studio version. Backup files are not needed, because we have git ;-) _UpgradeReport_Files/ Backup*/ -UpgradeLog*.XML \ No newline at end of file +UpgradeLog*.XML + +# Mac crap +.DS_Store + +a.out diff --git a/Rx/CPP/.gitignore b/Rx/CPP/.gitignore index 5ebd21a..4822a56 100644 --- a/Rx/CPP/.gitignore +++ b/Rx/CPP/.gitignore @@ -161,3 +161,5 @@ pip-log.txt # Mac crap .DS_Store + +a.out diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj index ecef98f..01bf711 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj @@ -46,13 +46,13 @@ true - $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false - $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h index 8b2f9dd..32ab5ac 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h @@ -60,5 +60,5 @@ #include #include -#include "rxcpp.h" +#include "cpprx/rx.hpp" diff --git a/Rx/CPP/testbench/rxcpp.h b/Rx/CPP/src/cpprx/rx-base.hpp similarity index 98% rename from Rx/CPP/testbench/rxcpp.h rename to Rx/CPP/src/cpprx/rx-base.hpp index 926ae68..3b649a9 100644 --- a/Rx/CPP/testbench/rxcpp.h +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -1,29 +1,9 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !defined(CPPRX_RX_BASE_HPP) +#define CPPRX_RX_BASE_HPP #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - namespace rxcpp { @@ -883,7 +863,4 @@ namespace rxcpp } } -#include "rxcpp-binder.h" - -#pragma pop_macro("min") -#pragma pop_macro("max") +#endif diff --git a/Rx/CPP/testbench/rxcpp-binder.h b/Rx/CPP/src/cpprx/rx.hpp similarity index 76% rename from Rx/CPP/testbench/rxcpp-binder.h rename to Rx/CPP/src/cpprx/rx.hpp index 0c48e7d..045e4aa 100644 --- a/Rx/CPP/testbench/rxcpp-binder.h +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -1,7 +1,33 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !defined(CPPRX_RX_HPP) +#define CPPRX_RX_HPP #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include "rx-base.hpp" + namespace rxcpp { template @@ -45,4 +71,9 @@ namespace rxcpp template Binder from(Obj&& obj) { return Binder(std::move(obj)); } -} \ No newline at end of file +} + +#pragma pop_macro("min") +#pragma pop_macro("max") + +#endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index ce99f97..cd6d162 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -3,7 +3,7 @@ // testbench.cpp : Defines the entry point for the console application. // -#include "rxcpp.h" +#include "cpprx/rx.hpp" #include #include diff --git a/Rx/CPP/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj index 8512615..e357456 100644 --- a/Rx/CPP/testbench/testbench.vcxproj +++ b/Rx/CPP/testbench/testbench.vcxproj @@ -44,11 +44,13 @@ true + $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false + $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ @@ -85,10 +87,6 @@ - - - - -- GitLab From 06b9f884ea8b9c644f73073572c95da40c73a12d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 09:19:01 -0800 Subject: [PATCH 012/782] get testbench compiling with clang on os.x --- Rx/CPP/src/cpprx/rx-base.hpp | 297 ++++++++++++++++---------------- Rx/CPP/src/cpprx/rx-util.hpp | 18 ++ Rx/CPP/src/cpprx/rx-windows.hpp | 94 ++++++++++ Rx/CPP/src/cpprx/rx.hpp | 48 ++++-- Rx/CPP/testbench/testbench.cpp | 41 +++-- 5 files changed, 325 insertions(+), 173 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-util.hpp create mode 100644 Rx/CPP/src/cpprx/rx-windows.hpp diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 3b649a9..29c45ee 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -6,7 +6,6 @@ namespace rxcpp { - ////////////////////////////////////////////////////////////////////// // // Abstract interfaces @@ -218,7 +217,7 @@ namespace rxcpp template Disposable Subscribe( const std::shared_ptr>& source, - typename std::identity>::type onNext, + typename util::identity>::type onNext, std::function onCompleted = nullptr, std::function onError = nullptr ) @@ -228,70 +227,6 @@ namespace rxcpp return source->Subscribe(observer); } - template - struct fix0_thunk { - F f; - fix0_thunk(F&& f) : f(std::move(f)) - { - } - void operator()() const - { - f(*this); - } - }; - template - fix0_thunk fix0(F f) - { - return fix0_thunk(std::move(f)); - } - - template - auto Range( - Integral start, Integral end = (Integral)-1, Integral step = 1 - ) - -> std::shared_ptr> - { - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = (end - start) / step; - - DefaultScheduler::Instance().Schedule( - fix0([=](std::function self) // TODO: - { - try { - if (state->cancel) - return; - - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - ++state->i; - DefaultScheduler::Instance().Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } - })); - - return [=]{ state->cancel = true; }; - }); - } - // reference handle type for a container for composing disposables class ComposableDisposable { @@ -427,7 +362,8 @@ namespace rxcpp ) { return CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observer) + -> Disposable { auto remaining = std::make_shared(n); @@ -499,12 +435,17 @@ namespace rxcpp } ~DefaultScheduler() { - std::unique_lock guard(scheduleLock); - shutdownRequested = true; - guard.unlock(); - cv.notify_one(); + { + std::unique_lock guard(scheduleLock); + shutdownRequested = true; + } + cv.notify_all(); } + + void ScopeEnter() {++trampoline;} + void ScopeExit() {--trampoline; Schedule([]{});} + void Schedule(Work work) { try { @@ -524,9 +465,9 @@ namespace rxcpp { queue.push_back(std::move(work)); } + --trampoline; } - catch (...) - { + catch (...) { --trampoline; throw; } @@ -554,12 +495,14 @@ namespace rxcpp { Clock::time_point dueTime = Clock::now() + std::chrono::duration(milliseconds); - std::unique_lock guard(scheduleLock); - bool wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; + bool wake = false; - scheduledWork.push(std::make_pair(dueTime, std::move(work))); + { + std::unique_lock guard(scheduleLock); + wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; - guard.unlock(); + scheduledWork.push(std::make_pair(dueTime, std::move(work))); + } if (wake) cv.notify_one(); @@ -571,7 +514,6 @@ namespace rxcpp while(!shutdownRequested) { - if (scheduledWork.empty()) { cv.wait(guard); @@ -592,15 +534,83 @@ namespace rxcpp guard.unlock(); try { - work(); + Schedule([=]{work();}); } catch (...) { - // TODO: ??? what now? + // work must catch all expected exceptions + // (yes, expected exceptions is an oxymoron) + std::unexpected(); } guard.lock(); } } }; + template + struct fix0_thunk { + F f; + fix0_thunk(F&& f) : f(std::move(f)) + { + } + void operator()() const + { + f(*this); + } + }; + template + fix0_thunk fix0(F f) + { + return fix0_thunk(std::move(f)); + } + + template + auto Range( + Integral start, Integral end = std::numeric_limits::max(), Integral step = 1 + ) + -> std::shared_ptr> + { + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = ((end - start) + step) / step; + + DefaultScheduler::Instance().Schedule( + fix0([=](std::function self) // TODO: + { + try { + if (state->cancel) + return; + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + DefaultScheduler::Instance().Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + })); + + return Disposable([=]{ + state->cancel = true; + }); + }); + } + template std::shared_ptr> Delay( const std::shared_ptr>& source, @@ -616,6 +626,7 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { auto cancel = std::make_shared(false); @@ -667,25 +678,25 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { struct State { - ULONGLONG dueTime; + std::chrono::steady_clock::time_point dueTime; }; auto state = std::make_shared(); - state->dueTime = 0; return Subscribe( source, // on next [=](const T& element) { - auto now = ::GetTickCount64(); + auto now = std::chrono::steady_clock::now(); if (now >= state->dueTime) { observer->OnNext(element); - state->dueTime = now + (ULONGLONG)milliseconds; + state->dueTime = now + std::chrono::duration(milliseconds); } }, // on completed @@ -708,6 +719,7 @@ namespace rxcpp { return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { struct State { T last; bool hasValue; @@ -741,89 +753,86 @@ namespace rxcpp }); } - - - - struct ObserveOnDispatcherOp + class StdQueueDispatcher { - HWND hwnd; + mutable std::queue> pending; + mutable std::condition_variable wake; + mutable std::mutex pendingLock; - ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) + std::function get() const { - if (!hwnd) - throw std::exception("error"); - } - ~ObserveOnDispatcherOp() - { - // send one last message to ourselves to shutdown. - post([=]{ CloseWindow(hwnd); }); + std::function fn; + fn = std::move(pending.front()); + pending.pop(); + return std::move(fn); } - struct WindowClass + void dispatch(std::function fn) const { - static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } - WindowClass() + if (fn) { - WNDCLASS wndclass = {}; - wndclass.style = 0; - wndclass.lpfnWndProc = &WndProc; - wndclass.cbClsExtra; - wndclass.cbWndExtra = 0; - wndclass.hInstance = NULL; - wndclass.lpszClassName = className(); - - if (!RegisterClass(&wndclass)) - throw std::exception("error"); - + try { + fn(); + } + catch(...) { + std::unexpected(); + } } - HWND CreateWindow_() + } + + public: + template + void post(Fn fn) const + { { - return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + std::unique_lock guard(pendingLock); + pending.push(std::move(fn)); } - static const int WM_USER_DISPATCH = WM_USER + 1; + wake.notify_one(); + } - static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + void try_dispatch() const + { + std::function fn; { - switch (message) + std::unique_lock guard(pendingLock); + if (!pending.empty()) { - // TODO: shatter attack surface. should validate the message, e.g. using a handle table. - case WM_USER_DISPATCH: - ((void(*)(void*))wParam)((void*)lParam); - return 0; - default: - return DefWindowProc(hwnd, message, wParam, lParam); + fn = get(); } } - static WindowClass& Instance() { - static WindowClass instance; - return instance; - } - }; - - template - void post(Fn fn) const - { - auto p = new Fn(fn); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + dispatch(std::move(fn)); } - template - static void run_proc( - void* pvfn - ) + + bool dispatch_one() const { - auto fn = (Fn*)(void*) pvfn; - (*fn)(); - delete fn; + std::function fn; + { + std::unique_lock guard(pendingLock); + wake.wait(guard, [this]{ return !pending.empty();}); + fn = get(); + } + bool result = !!fn; + dispatch(std::move(fn)); + return result; } }; +#if !defined(OBSERVE_ON_DISPATCHER_OP) + typedef StdQueueDispatcher ObserveOnDispatcherOp; +#endif - template + template std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source) + const std::shared_ptr>& source, + std::shared_ptr dispatcher = nullptr) { - auto dispatcher = std::make_shared(); + if (!dispatcher) + { + dispatcher = std::make_shared(); + } return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { auto cancel = std::make_shared(false); @@ -861,6 +870,6 @@ namespace rxcpp return cd; }); } -} +} #endif diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp new file mode 100644 index 0000000..00148fb --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_UTIL_HPP) +#define CPPRX_RX_UTIL_HPP +#pragma once + +namespace rxcpp { namespace util { + + template + struct identity + { + typedef Type type; + Type operator()(const Type& left) const {return left;} + }; + +}} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp new file mode 100644 index 0000000..b20c645 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_WINDOWS_HPP) +#define CPPRX_RX_WINDOWS_HPP +#pragma once + +#if defined(WINDOWS) || defined(WIN32) || defined(_WIN32) + +#define NOMINMAX +#include + +namespace rxcpp +{ + +#define OBSERVE_ON_DISPATCHER_OP + + struct ObserveOnDispatcherOp + { + HWND hwnd; + + ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) + { + if (!hwnd) + throw std::exception("error"); + } + ~ObserveOnDispatcherOp() + { + // send one last message to ourselves to shutdown. + post([=]{ CloseWindow(hwnd); }); + } + + struct WindowClass + { + static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } + WindowClass() + { + WNDCLASS wndclass = {}; + wndclass.style = 0; + wndclass.lpfnWndProc = &WndProc; + wndclass.cbClsExtra; + wndclass.cbWndExtra = 0; + wndclass.hInstance = NULL; + wndclass.lpszClassName = className(); + + if (!RegisterClass(&wndclass)) + throw std::exception("error"); + + } + HWND CreateWindow_() + { + return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + } + static const int WM_USER_DISPATCH = WM_USER + 1; + + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_USER_DISPATCH: + ((void(*)(void*))wParam)((void*)lParam); + return 0; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + } + static WindowClass& Instance() { + static WindowClass instance; + return instance; + } + }; + + template + void post(Fn fn) const + { + auto p = new Fn(fn); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + } + template + static void run_proc( + void* pvfn + ) + { + auto fn = (Fn*)(void*) pvfn; + (*fn)(); + delete fn; + } + }; + +} + +#endif + +#endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 045e4aa..ce1864e 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -14,22 +14,19 @@ #include #include #include +#include #include #include #include #include -#include - -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max +#include "rx-util.hpp" +#include "rx-windows.hpp" #include "rx-base.hpp" namespace rxcpp -{ +{ template class Binder { @@ -59,21 +56,44 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } - auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) + template + auto observe_on(std::shared_ptr dispatcher) + -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) + { + return from(ObserveOnDispatcher(obj, std::move(dispatcher))); + } + auto on_dispatcher(std::shared_ptr dispatcher = nullptr) + -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) { - return from(ObserveOnDispatcher(obj)); + return from(ObserveOnDispatcher(obj, std::move(dispatcher))); } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - return Subscribe(obj, onNext); + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext); + DefaultScheduler::Instance().ScopeExit(); + return result; + } + template + auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext, onComplete); + DefaultScheduler::Instance().ScopeExit(); + return result; + } + template + auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) + -> decltype(Subscribe(obj, onNext, onComplete, onError)) { + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext, onComplete, onError); + DefaultScheduler::Instance().ScopeExit(); + return result; } }; template - Binder from(Obj&& obj) { return Binder(std::move(obj)); } + Binder::type> from(Obj&& obj) { + return Binder::type>(std::move(obj)); } } -#pragma pop_macro("min") -#pragma pop_macro("max") - #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index cd6d162..1aeb807 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -6,30 +6,41 @@ #include "cpprx/rx.hpp" #include +#include #include +#include +#include +#include using namespace std; bool IsPrime(int x); -int main(int argc, char* argv[]) +void PrintPrimes(int n) { - const int n = 20; - std::cout << "first " << n << " primes squared\n"; - - rxcpp::DefaultScheduler::Instance().Schedule( - [=] - { - auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values) - .where(IsPrime) - .select([](int x) { return std::make_pair(x, x*x); }) - .take(n) - .subscribe( + bool done = false; + auto dispatcher = std::make_shared(); + auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values) + .where(IsPrime) + .select([](int x) { return std::make_pair(x, x*x); }) + .take(n) + .on_dispatcher(dispatcher) + .subscribe( [](pair p) { cout << p.first << " =square=> " << p.second << endl; - }); - }); + }, + [&done](){done = true;}, + [&done](const std::exception_ptr&){done = true;}); + + std::cout << "first " << n << " primes squared" << endl; + while(!done){dispatcher->dispatch_one();} +} + + +int main(int argc, char* argv[]) +{ + PrintPrimes(20); } bool IsPrime(int x) -- GitLab From 2bd57bcfc3dac65c2ef335d3968288963ed0b07e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 18:52:20 -0800 Subject: [PATCH 013/782] fix windows bugs --- Rx/CPP/src/cpprx/rx-base.hpp | 15 ++++++--------- Rx/CPP/src/cpprx/rx.hpp | 24 +++++++++++++----------- Rx/CPP/testbench/testbench.cpp | 11 ++--------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 29c45ee..f677c71 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -818,19 +818,16 @@ namespace rxcpp } }; #if !defined(OBSERVE_ON_DISPATCHER_OP) - typedef StdQueueDispatcher ObserveOnDispatcherOp; + typedef StdQueueDispatcher c; #endif - template + template std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source, - std::shared_ptr dispatcher = nullptr) + const std::shared_ptr>& source) { - if (!dispatcher) - { - dispatcher = std::make_shared(); - } - return CreateObservable( + auto dispatcher = std::make_shared(); + + return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index ce1864e..6d8ffd9 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -4,6 +4,11 @@ #define CPPRX_RX_HPP #pragma once +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + #include #include #include @@ -32,7 +37,7 @@ namespace rxcpp { Obj obj; public: - Binder(Obj&& obj) : obj(std::move(obj)) + Binder(Obj obj) : obj(std::move(obj)) { } template @@ -56,16 +61,10 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } - template - auto observe_on(std::shared_ptr dispatcher) - -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) - { - return from(ObserveOnDispatcher(obj, std::move(dispatcher))); - } - auto on_dispatcher(std::shared_ptr dispatcher = nullptr) - -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) + auto on_dispatcher() + -> decltype(from(ObserveOnDispatcher(obj))) { - return from(ObserveOnDispatcher(obj, std::move(dispatcher))); + return from(ObserveOnDispatcher(obj)); } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { @@ -92,8 +91,11 @@ namespace rxcpp }; template Binder::type> from(Obj&& obj) { - return Binder::type>(std::move(obj)); } + return Binder::type>(std::forward(obj)); } } +#pragma pop_macro("min") +#pragma pop_macro("max") + #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 1aeb807..23a4000 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -18,23 +18,16 @@ bool IsPrime(int x); void PrintPrimes(int n) { - bool done = false; - auto dispatcher = std::make_shared(); + std::cout << "first " << n << " primes squared" << endl; auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers auto s1 = rxcpp::from(values) .where(IsPrime) .select([](int x) { return std::make_pair(x, x*x); }) .take(n) - .on_dispatcher(dispatcher) .subscribe( [](pair p) { cout << p.first << " =square=> " << p.second << endl; - }, - [&done](){done = true;}, - [&done](const std::exception_ptr&){done = true;}); - - std::cout << "first " << n << " primes squared" << endl; - while(!done){dispatcher->dispatch_one();} + }); } -- GitLab From 62b675aae67ac373171f4412daa9d3349449ae9a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 20:55:11 -0800 Subject: [PATCH 014/782] add thread local and unwinder --- Rx/CPP/src/cpprx/rx-util.hpp | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 00148fb..d1f69c7 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -4,6 +4,19 @@ #define CPPRX_RX_UTIL_HPP #pragma once +#if !defined(RXCPP_THREAD_LOCAL) +#if defined(_MSC_VER) +#define RXCPP_THREAD_LOCAL __declspec(thread) +#else +#define RXCPP_THREAD_LOCAL __thread +#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__) + namespace rxcpp { namespace util { template @@ -13,6 +26,50 @@ namespace rxcpp { namespace util { Type operator()(const Type& left) const {return left;} }; + template + class unwinder + { + public: + ~unwinder() + { + if (!!function) + { + try { + (*function)(); + } catch (...) { + std::unexpected(); + } + } + } + + explicit unwinder(Function* functionArg) + : function(functionArg) + { + } + + void dismiss() + { + function = nullptr; + } + + private: + unwinder(); + unwinder(const unwinder&); + unwinder& operator=(const unwinder&); + + Function* function; + }; + }} +#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::unwinder UnwinderName(std::addressof(FunctionName)) + #endif \ No newline at end of file -- GitLab From 9cf8501513d922a2ced4dbe355712103a7cd9aa4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 21:13:29 -0800 Subject: [PATCH 015/782] changes to Disposable --- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 2 +- Rx/CPP/src/cpprx/rx-base.hpp | 30 +++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index ed928a0..f86d500 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -76,7 +76,7 @@ void CMainFrame::UserInit() this->UpdateWindow(); }); - composableDisposable.Add(s); + composableDisposable.Add(std::move(s)); } } diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index f677c71..3349a91 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -22,16 +22,32 @@ namespace rxcpp class Disposable { - std::function dispose; + Disposable(); + Disposable(const Disposable&); + typedef std::function dispose_type; + dispose_type dispose; public: - Disposable(std::function dispose) : dispose(std::move(dispose)) - { + explicit Disposable(dispose_type disposearg) + : dispose(std::move(disposearg)) { + disposearg = nullptr;} + Disposable(Disposable&& other) + : dispose(std::move(other.dispose)) { + other.dispose = nullptr; } + Disposable& operator=(Disposable other) { + swap(other); + return *this; } void Dispose() { - if (dispose) dispose(); + if (dispose) { + dispose(); + dispose = nullptr; + } } + void swap(Disposable& rhs) {{using std::swap; swap(dispose, rhs.dispose);}} + static Disposable Empty() { return Disposable(nullptr); } }; + void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} template struct Observable @@ -176,12 +192,12 @@ namespace rxcpp std::weak_ptr> wptr = observer; std::weak_ptr wself = this->shared_from_this(); - Disposable d = [wptr, wself]{ + Disposable d([wptr, wself]{ if (auto self = wself.lock()) { self->RemoveObserver(wptr.lock()); } - }; + }); for(auto& o : observers) { @@ -827,7 +843,7 @@ namespace rxcpp { auto dispatcher = std::make_shared(); - return CreateObservable( + return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { -- GitLab From d5bc1514115a070212b01b9ed966ca98aa52810c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 21:18:34 -0800 Subject: [PATCH 016/782] add Scheduler and more disposables --- Rx/CPP/src/cpprx/rx-base.hpp | 248 ++++++++++++++++++++++++++--------- 1 file changed, 189 insertions(+), 59 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 3349a91..15584ae 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -56,6 +56,195 @@ namespace rxcpp virtual ~Observable() {} }; + struct Scheduler : public std::enable_shared_from_this + { + typedef std::chrono::steady_clock clock; + typedef std::shared_ptr shared; + typedef std::function Work; + + shared get() {return shared_from_this();} + + virtual ~Scheduler() {} + + virtual clock::time_point Now() =0; + virtual Disposable Schedule(Work work) = 0; + virtual Disposable Schedule(clock::duration due, Work work) = 0; + virtual Disposable Schedule(clock::time_point due, Work work) = 0; + }; + + ////////////////////////////////////////////////////////////////////// + // + // disposables + + + // reference handle type for a container for composing disposables + class ComposableDisposable + { + struct State + { + std::vector disposables; + std::mutex lock; + bool isDisposed; + + State() : isDisposed(false) + { + } + void Add(Disposable&& d) + { + std::unique_lock guard(lock); + if (isDisposed) { + guard.unlock(); + d.Dispose(); + } else { + disposables.emplace_back(std::move(d)); + } + } + void Dispose() + { + std::unique_lock guard(lock); + + if (!isDisposed) + { + isDisposed = true; + auto v = std::move(disposables); + guard.unlock(); + + std::for_each(v.begin(), v.end(), + [](Disposable& d) { + d.Dispose(); }); + } + } + }; + + std::shared_ptr state; + + public: + + ComposableDisposable() : state(new State) + { + } + void Add(Disposable d) const + { + state->Add(std::move(d)); + } + void Dispose() const + { + state->Dispose(); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; + + class ScheduledDisposable + { + struct State : public std::enable_shared_from_this + { + Scheduler::shared scheduler; + Disposable disposable; + + State(Scheduler::shared scheduler, Disposable disposable) + : scheduler(std::move(scheduler)) + , disposable(std::move(disposable)) + { + } + void Dispose() + { + auto local = std::move(scheduler); + if (local) { + auto keepAlive = shared_from_this(); + local->Schedule([keepAlive] (Scheduler::shared) { + keepAlive->disposable.Dispose(); + return Disposable::Empty(); + }); + } + } + }; + + std::shared_ptr state; + + ScheduledDisposable(); + public: + + ScheduledDisposable(Scheduler::shared scheduler, Disposable disposable) + : state(new State(std::move(scheduler), std::move(disposable))) + { + } + void Dispose() const + { + state->Dispose(); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; + + class SharedDisposable + { + typedef std::function dispose_type; + + struct State : public std::enable_shared_from_this + { + mutable Disposable disposable; + mutable std::mutex lock; + + State() : disposable(Disposable::Empty()) {} + + void Set(Disposable disposeArg) const + { + std::unique_lock guard(lock); + {using std::swap; swap(disposable, disposeArg);} + } + void Dispose() + { + std::unique_lock guard(lock); + auto local = std::move(disposable); + guard.unlock(); + local.Dispose(); + } + }; + + std::shared_ptr state; + + public: + + SharedDisposable() + : state(new State()) + { + } + void Dispose() const + { + state->Dispose(); + } + void Set(Disposable disposeArg) const + { + state->Set(std::move(disposeArg)); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; ////////////////////////////////////////////////////////////////////// @@ -243,65 +432,6 @@ namespace rxcpp return source->Subscribe(observer); } - // reference handle type for a container for composing disposables - class ComposableDisposable - { - struct State - { - std::vector disposables; - std::mutex lock; - bool isDisposed; - - State() : isDisposed(false) - { - } - void Add(Disposable&& d) - { - std::unique_lock guard(lock); - if (isDisposed) { - guard.unlock(); - d.Dispose(); - } else { - disposables.push_back(std::move(d)); - } - } - void Dispose() - { - std::unique_lock guard(lock); - - isDisposed = true; - auto v = std::move(disposables); - guard.unlock(); - - std::for_each(v.begin(), v.end(), - [](Disposable& d) { d.Dispose(); }); - } - }; - - std::shared_ptr state; - - public: - ComposableDisposable() : state(new State) - { - } - void Add(Disposable d) const - { - state->Add(std::move(d)); - } - void Dispose() const - { - state->Dispose(); - } - operator Disposable() const - { - auto d = Disposable([=]{ - state->Dispose(); - }); - return d; - } - }; - - ////////////////////////////////////////////////////////////////////// // -- GitLab From 7eda5b02daff5e70198def84e2df530426781b14 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 1 Mar 2013 10:51:44 -0800 Subject: [PATCH 017/782] add scheduler impl and usage added basic schedulers (Immediate, CurrentThread, EventLoop, NewThread) added subscribe_on and observe_on used these in the test and sample code added WindowScheduler --- Ix/CPP/src/cpplinq/util.hpp | 8 + Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 6 +- Rx/CPP/src/cpprx/rx-base.hpp | 770 +-------------------- Rx/CPP/src/cpprx/rx-operators.hpp | 752 ++++++++++++++++++++ Rx/CPP/src/cpprx/rx-scheduler.h | 395 +++++++++++ Rx/CPP/src/cpprx/rx-util.hpp | 110 ++- Rx/CPP/src/cpprx/rx-windows.hpp | 95 ++- Rx/CPP/src/cpprx/rx.hpp | 27 +- Rx/CPP/testbench/data.txt | 655 ++++++++++++++++++ Rx/CPP/testbench/testbench.cpp | 200 ++++++ Rx/CPP/testbench/testbench.vcxproj | 4 +- Rx/CPP/testbench/testbench.vcxproj.filters | 8 - 12 files changed, 2255 insertions(+), 775 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-operators.hpp create mode 100644 Rx/CPP/src/cpprx/rx-scheduler.h create mode 100644 Rx/CPP/testbench/data.txt diff --git a/Ix/CPP/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp index f1e5222..953a48a 100644 --- a/Ix/CPP/src/cpplinq/util.hpp +++ b/Ix/CPP/src/cpplinq/util.hpp @@ -200,6 +200,14 @@ namespace cpplinq { namespace util { is_set = true; } } + void set(T&& value) { + if (is_set) { + *reinterpret_cast(&storage) = std::move(value); + } else { + new (reinterpret_cast(&storage)) T(std::move(value)); + is_set = true; + } + } T& operator*() { return *get(); } const T& operator*() const { return *get(); } diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index f86d500..da3d39a 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -48,6 +48,8 @@ CMainFrame::~CMainFrame() // inspired by: http://minirx.codeplex.com/ void CMainFrame::UserInit() { + auto worker = std::make_shared(); + auto mainFormScheduler = std::make_shared(); auto mouseMove = BindEventToObservable(mouseMoveEvent); // set up labels and query @@ -64,8 +66,8 @@ void CMainFrame::UserInit() auto s = rxcpp::from(mouseMove) .select([](MouseMoveEventValue e) { return e.point; }) .distinct_until_changed() - .delay(i * 100 + 1) - .on_dispatcher() + .delay(std::chrono::milliseconds(i * 100 + 1), worker) + .observe_on(mainFormScheduler) .subscribe([=](CPoint point) { label->SetWindowPos(nullptr, point.x+20*i, point.y-20, 20, 30, SWP_NOOWNERZORDER); diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 15584ae..cf6642b 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -47,7 +47,7 @@ namespace rxcpp void swap(Disposable& rhs) {{using std::swap; swap(dispose, rhs.dispose);}} static Disposable Empty() { return Disposable(nullptr); } }; - void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} + inline void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} template struct Observable @@ -246,773 +246,55 @@ namespace rxcpp } }; - - ////////////////////////////////////////////////////////////////////// - // - // constructors - - template - class CreatedObservable : public Observable - { - S subscribe; - - public: - CreatedObservable(S subscribe) : subscribe(std::move(subscribe)) - { - } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - return subscribe(std::move(observer)); - } - }; - - template - std::shared_ptr> CreateObservable(S subscribe) - { - return std::make_shared>(std::move(subscribe)); - } - - template - struct CreatedObserver : public Observer - { - std::function onNext; - std::function onCompleted; - std::function onError; - - virtual void OnNext(const T& element) - { - try - { - if(onNext) - { - onNext(element); - } - } - catch (...) - { - OnError(std::current_exception()); - } - } - virtual void OnCompleted() - { - if(onCompleted) - { - onCompleted(); - clear(); - } - } - virtual void OnError(const std::exception_ptr& error) - { - if(onError) - { - onError(error); - clear(); - } - } - void clear() - { - onNext = nullptr; - onCompleted = nullptr; - onError = nullptr; - } - }; - - template - std::shared_ptr> CreateObserver( - std::function onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) + struct LocalScheduler : public Scheduler { - auto p = std::make_shared>(); - p->onNext = std::move(onNext); - p->onCompleted = std::move(onCompleted); - p->onError = std::move(onError); - - return p; - } - - template - class Subject : - public Observable, - public Observer, - public std::enable_shared_from_this> - { - std::vector>> observers; - public: - virtual void OnNext(const T& element) - { - for(auto& o : observers) - { - try - { - if (o) - o->OnNext(element); - } - catch (...) - { - auto o_ = std::move(o); - o_->OnError(std::current_exception()); - } - } - } - virtual void OnCompleted() - { - for(auto& o : observers) - { - if (o) { - o->OnCompleted(); - o = nullptr; - } - } - } - virtual void OnError(const std::exception_ptr& error) - { - for(auto& o : observers) - { - if (o) { - o->OnError(error); - o = nullptr; - } - } - } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; - } - } - observers.push_back(std::move(observer)); - return d; - } - private: - void RemoveObserver(std::shared_ptr> toRemove) - { - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - *it = nullptr; - } - }; - - template - std::shared_ptr> CreateSubject() - { - return std::make_shared>(); - } - - - ////////////////////////////////////////////////////////////////////// - // - // imperative functions - - template - Disposable Subscribe( - const std::shared_ptr>& source, - typename util::identity>::type onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) - { - auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); - - return source->Subscribe(observer); - } - + LocalScheduler(const LocalScheduler&); - ////////////////////////////////////////////////////////////////////// - // - // standard query operators - - template - auto Select( - const std::shared_ptr>& source, - S selector - ) - -> const std::shared_ptr::type>> - { - typedef typename std::result_of::type U; - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - auto result = selector(element); - observer->OnNext(std::move(result)); - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - template - const std::shared_ptr> Where( - const std::shared_ptr>& source, - P predicate - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - auto result = predicate(element); - if (result) - { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - template - std::shared_ptr> Take( - const std::shared_ptr>& source, - int n // TODO: long long? - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto remaining = std::make_shared(n); - - ComposableDisposable cd; - - auto d = Subscribe( - source, - // on next - [=](const T& element) - { - if (*remaining) - { - observer->OnNext(element); - if (--*remaining == 0) - { - observer->OnCompleted(); - cd.Dispose(); - } - } - }, - // on completed - [=] - { - if (*remaining) - { - observer->OnCompleted(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - if (*remaining) - { - observer->OnError(error); - } - }); - cd.Add(std::move(d)); - return cd; - }); - } - - - - ////////////////////////////////////////////////////////////////////// - // - // time and schedulers - - struct DefaultScheduler - { - private: DefaultScheduler(const DefaultScheduler&); public: - static DefaultScheduler& Instance() - { - // TODO: leaks. race condition on atexit though. - static DefaultScheduler* instance = new DefaultScheduler; - return *instance; - } - - typedef std::function Work; - - std::atomic trampoline; - - std::vector queue; - - std::thread worker_thread; - DefaultScheduler() : trampoline(0), shutdownRequested(false) - { - worker_thread = std::thread([=]{ worker(); }); - } - ~DefaultScheduler() + static void DoNoThrow(Work& work, Scheduler::shared scheduler) throw() { + if (work) { - std::unique_lock guard(scheduleLock); - shutdownRequested = true; + work(std::move(scheduler)); } - cv.notify_all(); } - - - void ScopeEnter() {++trampoline;} - void ScopeExit() {--trampoline; Schedule([]{});} - - void Schedule(Work work) + static void Do(Work& work, Scheduler::shared scheduler) { try { - if (++trampoline == 1) - { - work(); - - while(!queue.empty()) - { - work = std::move(queue.back()); - queue.pop_back(); - work(); - } - - } - else - { - queue.push_back(std::move(work)); - } - --trampoline; - } - catch (...) { - --trampoline; - throw; - } - } - - struct compare_work - { - template - bool operator()(const T& work1, const T& work2) const { - return work1.first > work2.first; - } - }; - - typedef std::chrono::steady_clock Clock; - - bool shutdownRequested; - std::mutex scheduleLock; - std::condition_variable cv; - std::priority_queue< std::pair, - std::vector>, - compare_work > scheduledWork; - - - void Schedule(int milliseconds, Work work) - { - Clock::time_point dueTime = Clock::now() + std::chrono::duration(milliseconds); - - bool wake = false; - - { - std::unique_lock guard(scheduleLock); - wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; - - scheduledWork.push(std::make_pair(dueTime, std::move(work))); - } - - if (wake) - cv.notify_one(); - } - private: - void worker() - { - std::unique_lock guard(scheduleLock); - - while(!shutdownRequested) - { - if (scheduledWork.empty()) - { - cv.wait(guard); - continue; - } - - auto now = Clock::now(); - auto dueTime = scheduledWork.top().first; - if (dueTime > now) - { - cv.wait_until(guard, dueTime); - continue; - } - - // dispatch work - auto work = std::move(scheduledWork.top().second); - scheduledWork.pop(); - - guard.unlock(); - try { - Schedule([=]{work();}); - } catch (...) { - // work must catch all expected exceptions - // (yes, expected exceptions is an oxymoron) - std::unexpected(); - } - guard.lock(); + DoNoThrow(work, std::move(scheduler)); + } catch (const std::exception& ) { + // work must catch all expected exceptions + std::unexpected(); + } catch (...) { + // work must catch all expected exceptions + std::unexpected(); } } - }; - - template - struct fix0_thunk { - F f; - fix0_thunk(F&& f) : f(std::move(f)) - { - } - void operator()() const - { - f(*this); - } - }; - template - fix0_thunk fix0(F f) - { - return fix0_thunk(std::move(f)); - } - - template - auto Range( - Integral start, Integral end = std::numeric_limits::max(), Integral step = 1 - ) - -> std::shared_ptr> - { - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = ((end - start) + step) / step; - - DefaultScheduler::Instance().Schedule( - fix0([=](std::function self) // TODO: - { - try { - if (state->cancel) - return; - - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - state->i += step; - DefaultScheduler::Instance().Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } - })); - return Disposable([=]{ - state->cancel = true; - }); - }); - } - - template - std::shared_ptr> Delay( - const std::shared_ptr>& source, - int milliseconds) - { - // TODO: for some reason, poor interactions take place if - // on_dispatcher() dispatches from UI thread. -#if 0 - if (milliseconds == 0) - return source; -#endif - - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ *cancel = true; })); - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - // TODO: queue - DefaultScheduler::Instance().Schedule( - milliseconds, - [=]{ - if (!*cancel) - observer->OnNext(element); - }); - }, - // on completed - [=] - { - DefaultScheduler::Instance().Schedule( - milliseconds, - [=]{ - if (!*cancel) - observer->OnCompleted(); - }); - }, - // on error - [=](const std::exception_ptr& error) - { - if (!*cancel) - observer->OnError(error); - })); - return cd; - }); - } - - // no more than one event ever 'milliseconds' - // TODO: oops, this is not the right definition for throttle. - template - std::shared_ptr> LimitWindow( - const std::shared_ptr>& source, - int milliseconds) - { - if (milliseconds == 0) - return source; - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - std::chrono::steady_clock::time_point dueTime; - }; - - auto state = std::make_shared(); - - return Subscribe( - source, - // on next - [=](const T& element) - { - auto now = std::chrono::steady_clock::now(); - - if (now >= state->dueTime) - { - observer->OnNext(element); - state->dueTime = now + std::chrono::duration(milliseconds); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 - template - std::shared_ptr> DistinctUntilChanged( - const std::shared_ptr>& source) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - T last; bool hasValue; - }; - - auto state = std::make_shared(); - state->hasValue = false; - - return Subscribe( - source, - // on next - [=](const T& element) - { - if (!state->hasValue || state->last != element) - { - observer->OnNext(element); - state->last = element; - state->hasValue = true; - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - class StdQueueDispatcher - { - mutable std::queue> pending; - mutable std::condition_variable wake; - mutable std::mutex pendingLock; - - std::function get() const + public: + LocalScheduler() { - std::function fn; - fn = std::move(pending.front()); - pending.pop(); - return std::move(fn); } - - void dispatch(std::function fn) const + virtual ~LocalScheduler() { - if (fn) - { - try { - fn(); - } - catch(...) { - std::unexpected(); - } - } } - public: - template - void post(Fn fn) const - { - { - std::unique_lock guard(pendingLock); - pending.push(std::move(fn)); - } - wake.notify_one(); - } + virtual clock::time_point Now() {return clock::now();} - void try_dispatch() const + using Scheduler::Schedule; + virtual Disposable Schedule(Work work) { - std::function fn; - { - std::unique_lock guard(pendingLock); - if (!pending.empty()) - { - fn = get(); - } - } - dispatch(std::move(fn)); + clock::time_point dueTime = clock::now(); + return Schedule(dueTime, std::move(work)); } - - bool dispatch_one() const + + virtual Disposable Schedule(clock::duration due, Work work) { - std::function fn; - { - std::unique_lock guard(pendingLock); - wake.wait(guard, [this]{ return !pending.empty();}); - fn = get(); - } - bool result = !!fn; - dispatch(std::move(fn)); - return result; + clock::time_point dueTime = clock::now() + due; + return Schedule(dueTime, std::move(work)); } }; -#if !defined(OBSERVE_ON_DISPATCHER_OP) - typedef StdQueueDispatcher c; -#endif - - template - std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source) - { - auto dispatcher = std::make_shared(); - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - *cancel = true; - })); - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnNext(element); - }); - }, - // on completed - [=] - { - dispatcher->post([=]{ - if(!*cancel) - observer->OnCompleted(); - }); - }, - // on error - [=](const std::exception_ptr& error) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnError(error); - }); - })); - return cd; - }); - } } #endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp new file mode 100644 index 0000000..e4250b1 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -0,0 +1,752 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_OPERATORS_HPP) +#define CPPRX_RX_OPERATORS_HPP +#pragma once + +namespace rxcpp +{ + + ////////////////////////////////////////////////////////////////////// + // + // constructors + + template + class CreatedObservable : public Observable + { + S subscribe; + + public: + CreatedObservable(S subscribe) + : subscribe(std::move(subscribe)) + { + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + if (CurrentThreadScheduler::IsScheduleRequired()) { + auto scheduler = std::make_shared(); + return scheduler->Schedule( + [=](Scheduler::shared){ + try { + return subscribe(observer); + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + } + ); + } + try { + return subscribe(observer); + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + } + }; + + template + std::shared_ptr> CreateObservable(S subscribe) + { + return std::make_shared>(std::move(subscribe)); + } + + template + struct CreatedObserver : public Observer + { + std::function onNext; + std::function onCompleted; + std::function onError; + + virtual void OnNext(const T& element) + { + try + { + if(onNext) + { + onNext(element); + } + } + catch (...) + { + OnError(std::current_exception()); + } + } + virtual void OnCompleted() + { + if(onCompleted) + { + onCompleted(); + clear(); + } + } + virtual void OnError(const std::exception_ptr& error) + { + if(onError) + { + onError(error); + clear(); + } + } + void clear() + { + onNext = nullptr; + onCompleted = nullptr; + onError = nullptr; + } + }; + + template + std::shared_ptr> CreateObserver( + std::function onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto p = std::make_shared>(); + p->onNext = std::move(onNext); + p->onCompleted = std::move(onCompleted); + p->onError = std::move(onError); + + return p; + } + + template + class Subject : + public Observable, + public Observer, + public std::enable_shared_from_this> + { + std::vector>> observers; + public: + virtual void OnNext(const T& element) + { + for(auto& o : observers) + { + try + { + if (o) + o->OnNext(element); + } + catch (...) + { + auto o_ = std::move(o); + o_->OnError(std::current_exception()); + } + } + } + virtual void OnCompleted() + { + for(auto& o : observers) + { + if (o) { + o->OnCompleted(); + o = nullptr; + } + } + } + virtual void OnError(const std::exception_ptr& error) + { + for(auto& o : observers) + { + if (o) { + o->OnError(error); + o = nullptr; + } + } + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(std::move(observer)); + return d; + } + + private: + void RemoveObserver(std::shared_ptr> toRemove) + { + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } + }; + + template + std::shared_ptr> CreateSubject() + { + return std::make_shared>(); + } + + template + struct fix0_thunk { + F f; + fix0_thunk(F&& f) : f(std::move(f)) + { + } + Disposable operator()(Scheduler::shared s) const + { + return f(s, *this); + } + }; + template + fix0_thunk fix0(F f) + { + return fix0_thunk(std::move(f)); + } + + template + auto Range( + Integral start, Integral end = std::numeric_limits::max(), Integral step = 1, + Scheduler::shared scheduler = nullptr) + -> std::shared_ptr> + { + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = ((end - start) + step) / step; + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + try { + if (state->cancel) + return Disposable::Empty(); + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + return s->Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + }))); + + return cd; + }); + } + + + ////////////////////////////////////////////////////////////////////// + // + // imperative functions + + template + Disposable Subscribe( + const std::shared_ptr>& source, + typename util::identity>::type onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); + + return source->Subscribe(observer); + } + + + ////////////////////////////////////////////////////////////////////// + // + // standard query operators + + template + auto Select( + const std::shared_ptr>& source, + S selector + ) + -> const std::shared_ptr::type>> + { + typedef typename std::result_of::type U; + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = selector(element); + observer->OnNext(std::move(result)); + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + const std::shared_ptr> Where( + const std::shared_ptr>& source, + P predicate + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = predicate(element); + if (result) + { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + std::shared_ptr> Take( + const std::shared_ptr>& source, + int n // TODO: long long? + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto remaining = std::make_shared(n); + + ComposableDisposable cd; + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (*remaining) + { + observer->OnNext(element); + if (--*remaining == 0) + { + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on completed + [=] + { + if (*remaining) + { + observer->OnCompleted(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + if (*remaining) + { + observer->OnError(error); + } + })); + return cd; + }); + } + + + ////////////////////////////////////////////////////////////////////// + // + // time + + template + std::shared_ptr> Delay( + const std::shared_ptr>& source, + Scheduler::clock::duration due, + Scheduler::shared scheduler = nullptr) + { + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ *cancel = true; })); + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + sd.Set(scheduler->Schedule( + due, + [=] (Scheduler::shared){ + if (!*cancel) + observer->OnNext(element); + return Disposable::Empty(); + } + )); + }, + // on completed + [=] + { + sd.Set(scheduler->Schedule( + due, + [=](Scheduler::shared){ + if (!*cancel) + observer->OnCompleted(); + return Disposable::Empty(); + } + )); + }, + // on error + [=](const std::exception_ptr& error) + { + if (!*cancel) + observer->OnError(error); + })); + return cd; + }); + } + + // no more than one event ever 'milliseconds' + // TODO: oops, this is not the right definition for throttle. + template + std::shared_ptr> LimitWindow( + const std::shared_ptr>& source, + int milliseconds) + { + if (milliseconds == 0) + return source; + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + std::chrono::steady_clock::time_point dueTime; + }; + + auto state = std::make_shared(); + + return Subscribe( + source, + // on next + [=](const T& element) + { + auto now = std::chrono::steady_clock::now(); + + if (now >= state->dueTime) + { + observer->OnNext(element); + state->dueTime = now + std::chrono::duration(milliseconds); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 + template + std::shared_ptr> DistinctUntilChanged( + const std::shared_ptr>& source) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + T last; bool hasValue; + }; + + auto state = std::make_shared(); + state->hasValue = false; + + return Subscribe( + source, + // on next + [=](const T& element) + { + if (!state->hasValue || state->last != element) + { + observer->OnNext(element); + state->last = element; + state->hasValue = true; + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + std::shared_ptr> SubscribeOnObservable( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + ComposableDisposable cd; + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(scheduler->Schedule([=](Scheduler::shared){ + sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); + return Disposable::Empty(); + })); + return cd; + }); + } + + template + std::shared_ptr> ObserveOnObserver( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto queue = std::make_shared(); + auto queueScheduler = queue->GetScheduler(); + + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + queue->Dispose(); + })); + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + sd.Set(queueScheduler->Schedule([=](Scheduler::shared){ + observer->OnNext(element); + return Disposable::Empty(); + })); + queue->RunOnScheduler(scheduler); + }, + // on completed + [=] + { + sd.Set(queueScheduler->Schedule( + [=](Scheduler::shared){ + observer->OnCompleted(); + return Disposable::Empty(); + } + )); + queue->RunOnScheduler(scheduler); + }, + // on error + [=](const std::exception_ptr& error) + { + queueScheduler->Schedule([=](Scheduler::shared){ + observer->OnError(error); + queue->Dispose(); + return Disposable::Empty(); + }); + queue->RunOnScheduler(scheduler); + })); + return cd; + }); + } + + class StdQueueDispatcher + { + mutable std::queue> pending; + mutable std::condition_variable wake; + mutable std::mutex pendingLock; + + std::function get() const + { + std::function fn; + fn = std::move(pending.front()); + pending.pop(); + return std::move(fn); + } + + void dispatch(std::function fn) const + { + if (fn) + { + try { + fn(); + } + catch(...) { + std::unexpected(); + } + } + } + + public: + template + void post(Fn fn) const + { + { + std::unique_lock guard(pendingLock); + pending.push(std::move(fn)); + } + wake.notify_one(); + } + + void try_dispatch() const + { + std::function fn; + { + std::unique_lock guard(pendingLock); + if (!pending.empty()) + { + fn = get(); + } + } + dispatch(std::move(fn)); + } + + bool dispatch_one() const + { + std::function fn; + { + std::unique_lock guard(pendingLock); + wake.wait(guard, [this]{ return !pending.empty();}); + fn = get(); + } + bool result = !!fn; + dispatch(std::move(fn)); + return result; + } + }; +#if defined(OBSERVE_ON_DISPATCHER_OP) + typedef OBSERVE_ON_DISPATCHER_OP ObserveOnDispatcherOp; +#else + typedef StdQueueDispatcher ObserveOnDispatcherOp; +#endif + + template + std::shared_ptr> ObserveOnDispatcher( + const std::shared_ptr>& source) + { + auto dispatcher = std::make_shared(); + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + *cancel = true; + })); + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnNext(element); + }); + }, + // on completed + [=] + { + dispatcher->post([=]{ + if(!*cancel) + observer->OnCompleted(); + }); + }, + // on error + [=](const std::exception_ptr& error) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnError(error); + }); + })); + return cd; + }); + } + +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-scheduler.h b/Rx/CPP/src/cpprx/rx-scheduler.h new file mode 100644 index 0000000..c2c16d6 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-scheduler.h @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_SCHEDULERS_HPP) +#define CPPRX_RX_SCHEDULERS_HPP +#pragma once + +namespace rxcpp +{ + + ////////////////////////////////////////////////////////////////////// + // + // schedulers + + struct CurrentThreadScheduler : public LocalScheduler + { + private: + CurrentThreadScheduler(const CurrentThreadScheduler&); + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + typedef std::priority_queue< + std::pair>, + std::vector>>, + compare_work + > ScheduledWork; + + RXCPP_THREAD_LOCAL static ScheduledWork* scheduledWork; + + public: + CurrentThreadScheduler() + { + } + virtual ~CurrentThreadScheduler() + { + } + + static bool IsScheduleRequired() { return scheduledWork == nullptr; } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto cancelable = std::make_shared(std::move(work)); + // check trampoline + if (!!scheduledWork) + { + scheduledWork->push(std::make_pair(dueTime, cancelable)); + return Disposable([=]{(*cancelable.get()) = nullptr;}); + } + + // create and publish new queue + scheduledWork = new ScheduledWork(); + RXCPP_UNWIND_AUTO([]{ + delete scheduledWork; + scheduledWork = nullptr; + }); + + scheduledWork->push(std::make_pair(dueTime, cancelable)); + + // loop until queue is empty + for ( + auto dueTime = scheduledWork->top().first; + std::this_thread::sleep_until(dueTime), true; + dueTime = scheduledWork->top().first + ) + { + // dispatch work + auto work = std::move(*scheduledWork->top().second.get()); + scheduledWork->pop(); + + Do(work, get()); + + if (scheduledWork->empty()) {break;} + } + + return Disposable::Empty(); + } + }; + // static + RXCPP_SELECT_ANY RXCPP_THREAD_LOCAL CurrentThreadScheduler::ScheduledWork* CurrentThreadScheduler::scheduledWork = nullptr; + + struct ImmediateScheduler : public LocalScheduler + { + private: + ImmediateScheduler(const ImmediateScheduler&); + + public: + ImmediateScheduler() + { + } + virtual ~ImmediateScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto ct = std::make_shared(); + Do(work, ct); + return Disposable::Empty(); + } + }; + + + class WorkQueue : public std::enable_shared_from_this + { + typedef LocalScheduler::Work Work; + typedef LocalScheduler::clock clock; + typedef std::pair Item; + typedef std::shared_ptr shared; + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + std::atomic trampoline; + std::priority_queue< + std::pair>, + std::vector>>, + compare_work > scheduledWork; + mutable std::mutex lock; + mutable std::condition_variable wake; + mutable std::atomic exit; + + struct WorkQueueScheduler : public LocalScheduler + { + private: + WorkQueueScheduler(); + WorkQueueScheduler(const WorkQueueScheduler&); + + WorkQueue::shared queue; + + public: + WorkQueueScheduler(WorkQueue::shared queue) : queue(queue) + { + } + virtual ~WorkQueueScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto cancelable = std::make_shared(std::make_pair(get(), std::move(work))); + { + std::unique_lock guard(queue->lock); + queue->scheduledWork.push(std::make_pair(dueTime, cancelable)); + } + queue->wake.notify_one(); + auto local = queue; + return Disposable([local, cancelable]{ + std::unique_lock guard(local->lock); + cancelable.get()->second = nullptr;}); + } + }; + + public: + typedef std::function RunLoop; + typedef std::function Factory; + + WorkQueue() + : trampoline(0) + , exit(false) + { + } + + util::maybe EnsureThread(Factory& factory) + { + util::maybe result; + std::unique_lock guard(lock); + RXCPP_UNWIND(unwindTrampoline, [&]{--trampoline;}); + if (++trampoline == 1) + { + auto local = shared_from_this(); + result.set(factory([local]{local->Run();})); + // trampoline lifetime is now owned by the thread + unwindTrampoline.dismiss(); + } + return result; + } + + void Dispose() const + { + std::unique_lock guard(lock); + if (trampoline > 0) + { + exit = true; + wake.notify_one(); + } + } + operator Disposable() const + { + auto local = shared_from_this(); + return Disposable([local]{ + local->Dispose(); + }); + } + Scheduler::shared GetScheduler() + { + return std::make_shared(shared_from_this()); + } + void Run() + { + auto keepAlive = shared_from_this(); + { + RXCPP_UNWIND_AUTO([&]{--trampoline;}); + + std::unique_lock guard(lock); + + while(!exit && !scheduledWork.empty()) + { + // wait until there is work + wake.wait(guard, [this]{ return this->exit || !this->scheduledWork.empty();}); + if (exit || scheduledWork.empty()) {break;} + + auto item = &scheduledWork.top(); + if (!item->second) {scheduledWork.pop(); continue;} + + // wait until the work is due + while (!exit && item->second && item->second.get()->first->Now() < item->first) + { + wake.wait_until(guard, item->first); + item = &scheduledWork.top(); + } + if (exit || scheduledWork.empty()) {break;} + if (!item->second) {scheduledWork.pop(); continue;} + + // dispatch work + auto work = std::move(item->second.get()->second); + auto scheduler = std::move(item->second.get()->first); + scheduledWork.pop(); + + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, scheduler); + } + } + exit = false; + } + + Disposable RunOnScheduler(Scheduler::shared scheduler) + { + RXCPP_UNWIND_AUTO([&]{--trampoline;}); + if (++trampoline == 1) + { + // this is decremented when no further work is scheduled + ++trampoline; + auto keepAlive = shared_from_this(); + return scheduler->Schedule( + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + return Disposable::Empty(); + } + private: + Disposable RunOnSchedulerWork(Scheduler::shared scheduler) + { + auto keepAlive = shared_from_this(); + + std::unique_lock guard(lock); + + if(!exit && !scheduledWork.empty()) + { + auto& item = scheduledWork.top(); + + // wait until the work is due + if(!exit && item.second.get()->first->Now() < item.first) + { + return scheduler->Schedule( + item.first, + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + + if(!exit) + { + // dispatch work + auto work = std::move(item.second.get()->second); + auto scheduler = std::move(item.second.get()->first); + scheduledWork.pop(); + + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, scheduler); + } + } + + if(!exit && !scheduledWork.empty()) + { + return scheduler->Schedule( + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + + // only decrement when no further work is scheduled + --trampoline; + exit = false; + return Disposable::Empty(); + } + }; + + + struct EventLoopScheduler : public LocalScheduler + { + private: + EventLoopScheduler(const EventLoopScheduler&); + + std::shared_ptr queue; + Scheduler::shared scheduler; + std::thread worker; + WorkQueue::Factory factory; + + public: + EventLoopScheduler() + : queue(std::make_shared()) + , scheduler(queue->GetScheduler()) + { + auto local = queue; + factory = [local] (WorkQueue::RunLoop rl) -> std::thread { + return std::thread([local, rl]{rl();}); + }; + } + template + EventLoopScheduler(Factory factoryarg) + : queue(std::make_shared()) + , scheduler(queue->GetScheduler()) + { + auto local = queue; + factory = std::move(factoryarg); + } + virtual ~EventLoopScheduler() + { + if (worker.joinable()) { + worker.detach(); + } + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + Disposable result = scheduler->Schedule(dueTime, std::move(work)); + + auto maybeThread = queue->EnsureThread(factory); + if (maybeThread) + { + if (worker.joinable()) + { + worker.join(); + } + worker = std::move(*maybeThread.get()); + } + return std::move(result); + } + }; + + struct NewThreadScheduler : public LocalScheduler + { + public: + typedef std::function)> Factory; + private: + NewThreadScheduler(const NewThreadScheduler&); + + Factory factory; + public: + + + NewThreadScheduler() : factory([](std::function start){return std::thread(std::move(start));}) + { + } + NewThreadScheduler(Factory factory) : factory(factory) + { + } + virtual ~NewThreadScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto scheduler = std::make_shared(factory); + return scheduler->Schedule(dueTime, work); + } + }; +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index d1f69c7..32c4cd0 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -12,6 +12,14 @@ #endif #endif +#if !defined(RXCPP_SELECT_ANY) +#if defined(_MSC_VER) +#define RXCPP_SELECT_ANY __declspec(selectany) +#else +#define RXCPP_SELECT_ANY +#endif +#endif + #define RXCPP_CONCAT(Prefix, Suffix) Prefix ## Suffix #define RXCPP_CONCAT_EVALUATE(Prefix, Suffix) RXCPP_CONCAT(Prefix, Suffix) @@ -26,7 +34,107 @@ namespace rxcpp { namespace util { Type operator()(const Type& left) const {return left;} }; - template + template + class maybe + { + bool is_set; + typename std::aligned_storage::value>::type + storage; + public: + maybe() + : is_set(false) + { + } + + maybe(T value) + : is_set(false) + { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + + maybe(const maybe& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(*other.get()); + is_set = true; + } + } + maybe(maybe&& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(std::move(*other.get())); + is_set = true; + other.reset(); + } + } + + ~maybe() + { + reset(); + } + + void reset() + { + if (is_set) { + is_set = false; + reinterpret_cast(&storage)->~T(); + } + } + + T* get() { + return is_set ? reinterpret_cast(&storage) : 0; + } + + const T* get() const { + return is_set ? reinterpret_cast(&storage) : 0; + } + + void set(const T& value) { + if (is_set) { + *reinterpret_cast(&storage) = value; + } else { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + } + void set(T&& value) { + if (is_set) { + *reinterpret_cast(&storage) = std::move(value); + } else { + new (reinterpret_cast(&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: + + }; + + template class unwinder { public: diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index b20c645..2c9bac9 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -9,10 +9,12 @@ #define NOMINMAX #include -namespace rxcpp -{ +namespace rxcpp { namespace win32 { + -#define OBSERVE_ON_DISPATCHER_OP +#if !defined(OBSERVE_ON_DISPATCHER_OP) +#define OBSERVE_ON_DISPATCHER_OP rxcpp::win32::ObserveOnDispatcherOp +#endif struct ObserveOnDispatcherOp { @@ -73,21 +75,96 @@ namespace rxcpp template void post(Fn fn) const { - auto p = new Fn(fn); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + std::unique_ptr f(new Fn(fn)); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); } template static void run_proc( void* pvfn ) { - auto fn = (Fn*)(void*) pvfn; - (*fn)(); - delete fn; + std::unique_ptr f((Fn*)(void*) pvfn); + (*f.get())(); } }; -} + class WindowScheduler : public rxcpp::LocalScheduler + { + HWND hwnd; + Scheduler::shared ct; + typedef std::pair Item; + + struct WindowClass + { + static const wchar_t* const className(){ return L"rxcpp::win32::WindowScheduler::WindowClass"; } + WindowClass() + { + WNDCLASS wndclass = {}; + wndclass.style = 0; + wndclass.lpfnWndProc = &WndProc; + wndclass.cbClsExtra; + wndclass.cbWndExtra = 0; + wndclass.hInstance = NULL; + wndclass.lpszClassName = className(); + + if (!RegisterClass(&wndclass)) + throw std::exception("failed to register windows class"); + + } + HWND CreateWindow_() + { + return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + } + static const int WM_USER_DISPATCH = WM_USER + 1; + + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_USER_DISPATCH: + ((void(*)(void*))wParam)((void*)lParam); + return 0; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + } + static WindowClass& Instance() { + static WindowClass instance; + return instance; + } + }; + static void run_proc( + void* pvfn + ) + { + std::unique_ptr f((Item*)(void*) pvfn); + Do(f->second, f->first); + } + + public: + WindowScheduler() + : hwnd(WindowClass::Instance().CreateWindow_()) + , ct(std::make_shared()) + { + if (!hwnd) + throw std::exception("create window failed"); + } + ~WindowScheduler() + { + // send one last message to ourselves to shutdown. + Schedule([=](Scheduler::shared){ CloseWindow(hwnd); return Disposable::Empty();}); + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + std::unique_ptr f(new Item(ct, std::move(work))); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); + return Disposable::Empty(); + } + }; +} } #endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 6d8ffd9..f596bd0 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -27,8 +27,10 @@ #include "rx-util.hpp" -#include "rx-windows.hpp" #include "rx-base.hpp" +#include "rx-scheduler.h" +#include "rx-windows.hpp" +#include "rx-operators.hpp" namespace rxcpp { @@ -52,8 +54,11 @@ namespace rxcpp auto take(Integral n) -> decltype(from(Take(obj, n))) { return from(Take(obj, n)); } - auto delay(int milliseconds) -> decltype(from(Delay(obj, milliseconds))) { - return from(Delay(obj, milliseconds)); + auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { + return from(Delay(obj, due)); + } + auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { + return from(Delay(obj, due, scheduler)); } auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { return from(LimitWindow(obj, milliseconds)); @@ -61,6 +66,16 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } + auto subscribe_on(Scheduler::shared scheduler) + -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) + { + return from(SubscribeOnObservable(obj, std::move(scheduler))); + } + auto observe_on(Scheduler::shared scheduler) + -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) + { + return from(ObserveOnObserver(obj, std::move(scheduler))); + } auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) { @@ -68,24 +83,18 @@ namespace rxcpp } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext); - DefaultScheduler::Instance().ScopeExit(); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext, onComplete); - DefaultScheduler::Instance().ScopeExit(); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext, onComplete, onError); - DefaultScheduler::Instance().ScopeExit(); return result; } }; diff --git a/Rx/CPP/testbench/data.txt b/Rx/CPP/testbench/data.txt new file mode 100644 index 0000000..b16aea6 --- /dev/null +++ b/Rx/CPP/testbench/data.txt @@ -0,0 +1,655 @@ +{'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/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 23a4000..f09f0d9 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -4,6 +4,7 @@ // #include "cpprx/rx.hpp" +#include "cpplinq/linq.hpp" #include #include @@ -30,10 +31,135 @@ void PrintPrimes(int n) }); } +std::shared_ptr> Data( + string filename, + rxcpp::Scheduler::shared scheduler = std::make_shared() +); +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() ); + } + }; + + cout << "data >input ^parse and >(); + { + std::exception_ptr error; + std::condition_variable cv; + + std::mutex coutLock; + int inID = 0; + int parseID = 0; + int outID = 0; + + auto dataLines = Data( + "data.txt" +// , std::make_shared() + ); + auto input = std::make_shared(); + auto parsing = std::make_shared(); + auto output = std::make_shared(); + auto exp = rxcpp::from(dataLines) + .subscribe_on(input) + .select([&coutLock, &inID](const string& line) { + { + std::unique_lock guard(coutLock); + if (inID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '>' << std::flush; + } + return line; }) + .observe_on(parsing) + .select([&coutLock, &parseID](const string& line) { + { + std::unique_lock guard(coutLock); + if (parseID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '^' << std::flush; + } + return item(line); }) + .observe_on(output) +// .delay(std::chrono::milliseconds(10), output) + .subscribe( + [=, &coutLock, &outID](const item& i){ + { + std::unique_lock guard(coutLock); + if (outID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '<' << std::flush; + } + shared_data_parsed->push_back(i); }, + [&cv](){ + cv.notify_one();}, + [&cv, &error](const std::exception_ptr& e){ + error = e; cv.notify_one();}); + + std::mutex doneLock; + std::unique_lock guard(doneLock); + cv.wait(guard); + if (error != std::exception_ptr()) {std::rethrow_exception(error);} + cout << endl << "data loaded" << endl; + } + + auto data_parsed = shared_data_parsed.get(); + 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(int argc, char* argv[]) { PrintPrimes(20); + + try { + run(); + } catch (exception& e) { + cerr << "exception: " << e.what() << endl; + } } bool IsPrime(int x) @@ -47,3 +173,77 @@ bool IsPrime(int x) return true; } +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"); +} + +std::shared_ptr> Data( + string filename, + rxcpp::Scheduler::shared scheduler +) +{ + return rxcpp::CreateObservable( + [=](std::shared_ptr> observer) + -> rxcpp::Disposable + { + struct State + { + State(string filename) + : cancel(false), data(filename) { + if (data.fail()) { + throw logic_error("could not find file"); + } + } + bool cancel; + ifstream data; + }; + auto state = std::make_shared(std::move(filename)); + + rxcpp::ComposableDisposable cd; + + cd.Add(rxcpp::Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + rxcpp::fix0([=](rxcpp::Scheduler::shared s, std::function self) -> rxcpp::Disposable + { + try { + if (state->cancel) + return rxcpp::Disposable::Empty(); + + string line; + if (!!getline(state->data, line)) + { + observer->OnNext(std::move(line)); + return s->Schedule(std::move(self)); + } + else + { + observer->OnCompleted(); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + return rxcpp::Disposable::Empty(); + }) + )); + + return cd; + } + ); +} + diff --git a/Rx/CPP/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj index e357456..3f0ae00 100644 --- a/Rx/CPP/testbench/testbench.vcxproj +++ b/Rx/CPP/testbench/testbench.vcxproj @@ -44,13 +44,13 @@ true - $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false - $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ diff --git a/Rx/CPP/testbench/testbench.vcxproj.filters b/Rx/CPP/testbench/testbench.vcxproj.filters index 2737526..8afd620 100644 --- a/Rx/CPP/testbench/testbench.vcxproj.filters +++ b/Rx/CPP/testbench/testbench.vcxproj.filters @@ -19,12 +19,4 @@ Source Files - - - Header Files - - - Header Files - - \ No newline at end of file -- GitLab From 49764f97b88acc9c255987cdbaebe0e299b65c18 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 2 Mar 2013 22:46:57 -0800 Subject: [PATCH 018/782] added - orderby, foreach, publish and usage thereof --- Rx/CPP/src/cpprx/rx-base.hpp | 13 +- Rx/CPP/src/cpprx/rx-includes.hpp | 38 +++ Rx/CPP/src/cpprx/rx-operators.hpp | 244 +++++++++++++++--- .../{rx-scheduler.h => rx-scheduler.hpp} | 4 +- Rx/CPP/src/cpprx/rx-util.hpp | 4 +- Rx/CPP/src/cpprx/rx-windows.hpp | 3 + Rx/CPP/src/cpprx/rx.hpp | 145 ++++++----- Rx/CPP/testbench/testbench.cpp | 176 ++++++------- 8 files changed, 426 insertions(+), 201 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-includes.hpp rename Rx/CPP/src/cpprx/{rx-scheduler.h => rx-scheduler.hpp} (99%) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index cf6642b..e5af503 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_BASE_HPP) #define CPPRX_RX_BASE_HPP -#pragma once namespace rxcpp { @@ -56,7 +58,14 @@ namespace rxcpp virtual ~Observable() {} }; - struct Scheduler : public std::enable_shared_from_this + template + struct GroupedObservable : Observable + { + virtual K Key() = 0; + virtual ~GroupedObservable() {} + }; + + struct Scheduler : public std::enable_shared_from_this { typedef std::chrono::steady_clock clock; typedef std::shared_ptr shared; diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp new file mode 100644 index 0000000..d5be690 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#if !defined(CPPRX_RX_INCLUDES_HPP) +#define CPPRX_RX_INCLUDES_HPP + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rx-util.hpp" +#include "rx-base.hpp" +#include "rx-scheduler.hpp" +#include "rx-windows.hpp" +#include "rx-operators.hpp" + +#pragma pop_macro("min") +#pragma pop_macro("max") + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index e4250b1..cfd100d 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_OPERATORS_HPP) #define CPPRX_RX_OPERATORS_HPP -#pragma once namespace rxcpp { @@ -111,17 +113,60 @@ namespace rxcpp return p; } - template - class Subject : - public Observable, - public Observer, - public std::enable_shared_from_this> + + template + class ObservableSubject : + public Base, + public std::enable_shared_from_this { + protected: std::vector>> observers; + + void RemoveObserver(std::shared_ptr> toRemove) + { + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } public: - virtual void OnNext(const T& element) + + virtual Disposable Subscribe(std::shared_ptr> observer) { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(std::move(observer)); + return d; + } + }; + + template + class ObserverSubject : + public Base + { + public: + ObserverSubject() {} + + template + explicit ObserverSubject(A&& a) : Base(std::forward(a)) {} + + virtual void OnNext(const T& element) + { + for(auto& o : Base::observers) { try { @@ -137,7 +182,7 @@ namespace rxcpp } virtual void OnCompleted() { - for(auto& o : observers) + for(auto& o : Base::observers) { if (o) { o->OnCompleted(); @@ -147,7 +192,7 @@ namespace rxcpp } virtual void OnError(const std::exception_ptr& error) { - for(auto& o : observers) + for(auto& o : Base::observers) { if (o) { o->OnError(error); @@ -155,36 +200,12 @@ namespace rxcpp } } } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; - } - } - observers.push_back(std::move(observer)); - return d; - } + }; - private: - void RemoveObserver(std::shared_ptr> toRemove) - { - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - *it = nullptr; - } + template + class Subject : + public ObserverSubject, Subject>> + { }; template @@ -193,6 +214,32 @@ namespace rxcpp return std::make_shared>(); } + template + class GroupedObservableSubject : + public Base + { + K key; + public: + GroupedObservableSubject(K key) : key(std::move(key)) {} + + virtual K Key() {return key;} + }; + + template + class GroupedSubject : + public ObserverSubject, GroupedSubject>>> + { + typedef ObserverSubject, GroupedSubject>>> base; + public: + GroupedSubject(K key) : base(std::move(key)) {} + }; + + template + std::shared_ptr> CreateGroupedSubject(K key) + { + return std::make_shared>(std::move(key)); + } + template struct fix0_thunk { F f; @@ -283,6 +330,36 @@ namespace rxcpp return source->Subscribe(observer); } + template + void ForEach( + const std::shared_ptr>& source, + typename util::identity>::type onNext + ) + { + std::mutex lock; + std::condition_variable wake; + bool done = false; + std::exception_ptr error; + auto observer = CreateObserver(std::move(onNext), [&]{ + std::unique_lock guard(lock); + done = true; + wake.notify_one(); + }, [&](const std::exception_ptr& e){ + std::unique_lock guard(lock); + done = true; + error = std::move(e); + wake.notify_one(); + }); + + source->Subscribe(observer); + + { + std::unique_lock guard(lock); + wake.wait(guard, [&]{return done;}); + } + + if (error != std::exception_ptr()) {std::rethrow_exception(error);} + } ////////////////////////////////////////////////////////////////////// // @@ -299,7 +376,7 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) { - return Subscribe( + return Subscribe( source, // on next [=](const T& element) @@ -353,6 +430,95 @@ namespace rxcpp }); } + template + auto GroupBy( + const std::shared_ptr>& source, + KS keySelector, + VS valueSelector, + L less) + -> std::shared_ptr::type, + typename std::decay::type>>>> + { + typedef typename std::decay::type Key; + typedef typename std::decay::type Value; + + typedef std::shared_ptr> LocalGroupObservable; + + return CreateObservable( + [=](std::shared_ptr> observer) + { + typedef std::function OnNext; + typedef std::function OnCompleted; + typedef std::function OnError; + + struct GroupValue + { + OnNext onNext; + OnCompleted onCompleted; + OnError onError; + }; + typedef std::map Groups; + + struct State + { + State(L less) : groups(std::move(less)) {} + std::mutex lock; + Groups groups; + }; + auto state = std::make_shared(std::move(less)); + + return Subscribe( + source, + // on next + [=](const T& element) + { + auto key = keySelector(element); + auto keySubject = CreateGroupedSubject(key); + + typename Groups::iterator groupIt; + bool newGroup = false; + GroupValue value; + value.onNext = [keySubject](Value v){ + keySubject->OnNext(std::move(v));}; + value.onCompleted = [keySubject](){ + keySubject->OnCompleted();}; + value.onError = [keySubject](const std::exception_ptr& e){ + keySubject->OnError(std::move(e));}; + + { + std::unique_lock guard(state->lock); + std::tie(groupIt, newGroup) = state->groups.insert(std::make_pair( + key,std::move(value)) + ); + } + + if (newGroup) + { + LocalGroupObservable nextGroup(std::move(keySubject)); + observer->OnNext(nextGroup); + } + groupIt->second.onNext(valueSelector(element)); + }, + // on completed + [=] + { + for(auto& group : state->groups) { + group.second.onCompleted(); + } + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + for(auto& group : state->groups) { + group.second.onError(error); + } + observer->OnError(error); + }); + }); + } + template std::shared_ptr> Take( const std::shared_ptr>& source, diff --git a/Rx/CPP/src/cpprx/rx-scheduler.h b/Rx/CPP/src/cpprx/rx-scheduler.hpp similarity index 99% rename from Rx/CPP/src/cpprx/rx-scheduler.h rename to Rx/CPP/src/cpprx/rx-scheduler.hpp index c2c16d6..5fcef15 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.h +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_SCHEDULERS_HPP) #define CPPRX_RX_SCHEDULERS_HPP -#pragma once namespace rxcpp { diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 32c4cd0..144fbc6 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_UTIL_HPP) #define CPPRX_RX_UTIL_HPP -#pragma once #if !defined(RXCPP_THREAD_LOCAL) #if defined(_MSC_VER) diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 2c9bac9..72e636f 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -1,5 +1,8 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_WINDOWS_HPP) #define CPPRX_RX_WINDOWS_HPP #pragma once diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index f596bd0..848e945 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -1,110 +1,131 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if !defined(CPPRX_RX_HPP) -#define CPPRX_RX_HPP #pragma once +#include "rx-includes.hpp" -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "rx-util.hpp" -#include "rx-base.hpp" -#include "rx-scheduler.h" -#include "rx-windows.hpp" -#include "rx-operators.hpp" +#if !defined(CPPRX_RX_HPP) +#define CPPRX_RX_HPP namespace rxcpp { - template + template class Binder { Obj obj; + static T defaultValueSelector(T t){return std::move(t);} public: Binder(Obj obj) : obj(std::move(obj)) { } template - auto select(S selector) -> decltype(from(Select(obj, selector))) { - return from(Select(obj, selector)); + auto select(S selector) -> decltype(from(Select(obj, selector))) { + return from(Select(obj, selector)); } template - auto where(P predicate) -> decltype(from(Where(obj, predicate))) { - return from(Where(obj, predicate)); + auto where(P predicate) -> decltype(from(Where(obj, predicate))) { + return from(Where(obj, predicate)); + } + Obj publish() { + return obj; + } + template + auto group_by( + KS keySelector) + -> decltype(from(GroupBy(obj, keySelector, defaultValueSelector, std::less()))) { + return from(GroupBy(obj, keySelector, defaultValueSelector, std::less())); + } + template + auto group_by( + KS keySelector, + VS valueSelector) + -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { + return from(GroupBy(obj, keySelector, valueSelector, std::less())); + } + template + auto group_by( + KS keySelector, + VS valueSelector, + L less) + -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { + return from(GroupBy(obj, keySelector, valueSelector, less)); } template - auto take(Integral n) -> decltype(from(Take(obj, n))) { - return from(Take(obj, n)); + auto take(Integral n) -> decltype(from(Take(obj, n))) { + return from(Take(obj, n)); } - auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { - return from(Delay(obj, due)); + auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { + return from(Delay(obj, due)); } - auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { - return from(Delay(obj, due, scheduler)); + auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { + return from(Delay(obj, due, scheduler)); } - auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { - return from(LimitWindow(obj, milliseconds)); + auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { + return from(LimitWindow(obj, milliseconds)); } - auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { - return from(DistinctUntilChanged(obj)); + auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { + return from(DistinctUntilChanged(obj)); } auto subscribe_on(Scheduler::shared scheduler) - -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) + -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) { - return from(SubscribeOnObservable(obj, std::move(scheduler))); + return from(SubscribeOnObservable(obj, std::move(scheduler))); } auto observe_on(Scheduler::shared scheduler) - -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) + -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) { - return from(ObserveOnObserver(obj, std::move(scheduler))); + return from(ObserveOnObserver(obj, std::move(scheduler))); } auto on_dispatcher() - -> decltype(from(ObserveOnDispatcher(obj))) + -> decltype(from(ObserveOnDispatcher(obj))) { - return from(ObserveOnDispatcher(obj)); + return from(ObserveOnDispatcher(obj)); + } + template + void for_each(OnNext onNext) { + ForEach(obj, onNext); } template - auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - auto result = Subscribe(obj, onNext); + auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { + auto result = Subscribe(obj, onNext); return result; } template - auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { - auto result = Subscribe(obj, onNext, onComplete); + auto subscribe(OnNext onNext, OnComplete onComplete) + -> decltype(Subscribe(obj, onNext, onComplete)) { + auto result = Subscribe(obj, onNext, onComplete); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) - -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - auto result = Subscribe(obj, onNext, onComplete, onError); + -> decltype(Subscribe(obj, onNext, onComplete, onError)) { + auto result = Subscribe(obj, onNext, onComplete, onError); return result; } }; - template - Binder::type> from(Obj&& obj) { - return Binder::type>(std::forward(obj)); } -} + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } + + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } -#pragma pop_macro("min") -#pragma pop_macro("max") + template + Binder from(Binder binder) { + return std::move(binder); } + + template + T item(const Binder>>&); + + template + T item(const Binder>>&); + + template + T item(const std::shared_ptr>&); + + template + T item(const std::shared_ptr>&); +} #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index f09f0d9..01f08c8 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -7,6 +7,7 @@ #include "cpplinq/linq.hpp" #include +#include #include #include #include @@ -37,7 +38,6 @@ std::shared_ptr> Data( ); string extract_value(const string& input, const string& key); - void run() { using namespace cpplinq; @@ -54,101 +54,85 @@ void run() } }; - cout << "data >input ^parse and >(); - { - std::exception_ptr error; - std::condition_variable cv; - - std::mutex coutLock; - int inID = 0; - int parseID = 0; - int outID = 0; - - auto dataLines = Data( - "data.txt" -// , std::make_shared() - ); - auto input = std::make_shared(); - auto parsing = std::make_shared(); - auto output = std::make_shared(); - auto exp = rxcpp::from(dataLines) - .subscribe_on(input) - .select([&coutLock, &inID](const string& line) { - { - std::unique_lock guard(coutLock); - if (inID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '>' << std::flush; - } - return line; }) - .observe_on(parsing) - .select([&coutLock, &parseID](const string& line) { - { - std::unique_lock guard(coutLock); - if (parseID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '^' << std::flush; - } - return item(line); }) - .observe_on(output) -// .delay(std::chrono::milliseconds(10), output) - .subscribe( - [=, &coutLock, &outID](const item& i){ - { - std::unique_lock guard(coutLock); - if (outID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '<' << std::flush; - } - shared_data_parsed->push_back(i); }, - [&cv](){ - cv.notify_one();}, - [&cv, &error](const std::exception_ptr& e){ - error = e; cv.notify_one();}); - - std::mutex doneLock; - std::unique_lock guard(doneLock); - cv.wait(guard); - if (error != std::exception_ptr()) {std::rethrow_exception(error);} - cout << endl << "data loaded" << endl; - } - - auto data_parsed = shared_data_parsed.get(); - 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; - } - } + auto input = std::make_shared(); + auto output = std::make_shared(); + + auto dataLines = Data("data.txt"); + + int arggroupcount = 0; + + rxcpp::from(dataLines) + .subscribe_on(input) + // parse input into items + .select([](const string& line) { + return item(line);} + ) + // group items by args field + .group_by([](const item& i) { + return i.args;} + ) + .select([=](const std::shared_ptr> & gob){ + return std::make_pair( + gob->Key(), // keep args key + rxcpp::from(gob) + // group items by concurrency field + .group_by([](const item& i){ + return i.concurrency;} + ) + // select only the times field + .select([=] (const std::shared_ptr> & gob){ + return std::make_pair( + gob->Key(), // keep concurrency key + rxcpp::from(gob) + .select([](const item& i){ + return i.time;} + ) + .publish());} + ) + .publish());} + ) + .observe_on(output) + // print the grouped results + // for_each the args to block until the nested subscribes have finished + .for_each([&](const std::pair, std::shared_ptr > > > > >& ob){ + auto argsstate = std::make_shared>(false, ob.first, arggroupcount++); + rxcpp::from(ob.second) + // subscribe the concurrencies within each args + .subscribe([=](const std::pair > >& ob){ + auto linestate = std::make_shared>>(ob.first, std::vector()); + rxcpp::from(ob.second) + // subscribe the times within each concurrency + .subscribe([=](const double& i){ + // collect the times + linestate->second.push_back(i); + },[=]{ + // this concurrency's times are complete + // output a line to the console. + + if (!std::get<0>(*argsstate)) + { + std::get<0>(*argsstate) = true; + cout<<"arguments: "<(*argsstate)<first << ", "; + + auto n = from(linestate->second).count(); + auto sum = std::accumulate(linestate->second.begin(), linestate->second.end(), 0.0); + + cout << (sum / n) << ", |"; + + for (auto timeIter = linestate->second.begin(), end = linestate->second.end(); + timeIter != end; + ++timeIter) + { + cout << ", " << *timeIter; + } + cout << endl; + }); + }); + }); } int main(int argc, char* argv[]) -- GitLab From 1bd7dadd9ba9f1dd344c55b26156810d563d329d Mon Sep 17 00:00:00 2001 From: malayeri Date: Wed, 6 Mar 2013 12:06:02 -0800 Subject: [PATCH 019/782] Merge branch 'master' of https://git01.codeplex.com/forks/martsyn/rx into martsyn/rx -- GitLab From 4a9eb331aca8294a1930d684ffbc3ad0531f2c71 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Feb 2013 14:19:55 -0800 Subject: [PATCH 020/782] publish Rx CPP a little more formally --- Ix/CPP/.gitignore | 7 +++- Rx/CPP/.gitignore | 2 ++ .../MfcTimeFliesLikeAnArrow.vcxproj | 4 +-- Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h | 2 +- .../rxcpp.h => src/cpprx/rx-base.hpp} | 29 ++-------------- .../rxcpp-binder.h => src/cpprx/rx.hpp} | 33 ++++++++++++++++++- Rx/CPP/testbench/testbench.cpp | 2 +- Rx/CPP/testbench/testbench.vcxproj | 6 ++-- 8 files changed, 49 insertions(+), 36 deletions(-) rename Rx/CPP/{testbench/rxcpp.h => src/cpprx/rx-base.hpp} (98%) rename Rx/CPP/{testbench/rxcpp-binder.h => src/cpprx/rx.hpp} (76%) diff --git a/Ix/CPP/.gitignore b/Ix/CPP/.gitignore index 8bbd318..579772e 100644 --- a/Ix/CPP/.gitignore +++ b/Ix/CPP/.gitignore @@ -106,4 +106,9 @@ Generated_Code #added for RIA/Silverlight projects # Visual Studio version. Backup files are not needed, because we have git ;-) _UpgradeReport_Files/ Backup*/ -UpgradeLog*.XML \ No newline at end of file +UpgradeLog*.XML + +# Mac crap +.DS_Store + +a.out diff --git a/Rx/CPP/.gitignore b/Rx/CPP/.gitignore index 5ebd21a..4822a56 100644 --- a/Rx/CPP/.gitignore +++ b/Rx/CPP/.gitignore @@ -161,3 +161,5 @@ pip-log.txt # Mac crap .DS_Store + +a.out diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj index ecef98f..01bf711 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj @@ -46,13 +46,13 @@ true - $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false - $(VCInstallDir)include;..\testbench;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h index 8b2f9dd..32ab5ac 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h @@ -60,5 +60,5 @@ #include #include -#include "rxcpp.h" +#include "cpprx/rx.hpp" diff --git a/Rx/CPP/testbench/rxcpp.h b/Rx/CPP/src/cpprx/rx-base.hpp similarity index 98% rename from Rx/CPP/testbench/rxcpp.h rename to Rx/CPP/src/cpprx/rx-base.hpp index 926ae68..3b649a9 100644 --- a/Rx/CPP/testbench/rxcpp.h +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -1,29 +1,9 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !defined(CPPRX_RX_BASE_HPP) +#define CPPRX_RX_BASE_HPP #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - namespace rxcpp { @@ -883,7 +863,4 @@ namespace rxcpp } } -#include "rxcpp-binder.h" - -#pragma pop_macro("min") -#pragma pop_macro("max") +#endif diff --git a/Rx/CPP/testbench/rxcpp-binder.h b/Rx/CPP/src/cpprx/rx.hpp similarity index 76% rename from Rx/CPP/testbench/rxcpp-binder.h rename to Rx/CPP/src/cpprx/rx.hpp index 0c48e7d..045e4aa 100644 --- a/Rx/CPP/testbench/rxcpp-binder.h +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -1,7 +1,33 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !defined(CPPRX_RX_HPP) +#define CPPRX_RX_HPP #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include "rx-base.hpp" + namespace rxcpp { template @@ -45,4 +71,9 @@ namespace rxcpp template Binder from(Obj&& obj) { return Binder(std::move(obj)); } -} \ No newline at end of file +} + +#pragma pop_macro("min") +#pragma pop_macro("max") + +#endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index ce99f97..cd6d162 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -3,7 +3,7 @@ // testbench.cpp : Defines the entry point for the console application. // -#include "rxcpp.h" +#include "cpprx/rx.hpp" #include #include diff --git a/Rx/CPP/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj index 8512615..e357456 100644 --- a/Rx/CPP/testbench/testbench.vcxproj +++ b/Rx/CPP/testbench/testbench.vcxproj @@ -44,11 +44,13 @@ true + $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false + $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ @@ -85,10 +87,6 @@ - - - - -- GitLab From dec7a2282678ece0bab4708d05b73d12e0967292 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 09:19:01 -0800 Subject: [PATCH 021/782] get testbench compiling with clang on os.x --- Rx/CPP/src/cpprx/rx-base.hpp | 297 ++++++++++++++++---------------- Rx/CPP/src/cpprx/rx-util.hpp | 18 ++ Rx/CPP/src/cpprx/rx-windows.hpp | 94 ++++++++++ Rx/CPP/src/cpprx/rx.hpp | 48 ++++-- Rx/CPP/testbench/testbench.cpp | 41 +++-- 5 files changed, 325 insertions(+), 173 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-util.hpp create mode 100644 Rx/CPP/src/cpprx/rx-windows.hpp diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 3b649a9..29c45ee 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -6,7 +6,6 @@ namespace rxcpp { - ////////////////////////////////////////////////////////////////////// // // Abstract interfaces @@ -218,7 +217,7 @@ namespace rxcpp template Disposable Subscribe( const std::shared_ptr>& source, - typename std::identity>::type onNext, + typename util::identity>::type onNext, std::function onCompleted = nullptr, std::function onError = nullptr ) @@ -228,70 +227,6 @@ namespace rxcpp return source->Subscribe(observer); } - template - struct fix0_thunk { - F f; - fix0_thunk(F&& f) : f(std::move(f)) - { - } - void operator()() const - { - f(*this); - } - }; - template - fix0_thunk fix0(F f) - { - return fix0_thunk(std::move(f)); - } - - template - auto Range( - Integral start, Integral end = (Integral)-1, Integral step = 1 - ) - -> std::shared_ptr> - { - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = (end - start) / step; - - DefaultScheduler::Instance().Schedule( - fix0([=](std::function self) // TODO: - { - try { - if (state->cancel) - return; - - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - ++state->i; - DefaultScheduler::Instance().Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } - })); - - return [=]{ state->cancel = true; }; - }); - } - // reference handle type for a container for composing disposables class ComposableDisposable { @@ -427,7 +362,8 @@ namespace rxcpp ) { return CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observer) + -> Disposable { auto remaining = std::make_shared(n); @@ -499,12 +435,17 @@ namespace rxcpp } ~DefaultScheduler() { - std::unique_lock guard(scheduleLock); - shutdownRequested = true; - guard.unlock(); - cv.notify_one(); + { + std::unique_lock guard(scheduleLock); + shutdownRequested = true; + } + cv.notify_all(); } + + void ScopeEnter() {++trampoline;} + void ScopeExit() {--trampoline; Schedule([]{});} + void Schedule(Work work) { try { @@ -524,9 +465,9 @@ namespace rxcpp { queue.push_back(std::move(work)); } + --trampoline; } - catch (...) - { + catch (...) { --trampoline; throw; } @@ -554,12 +495,14 @@ namespace rxcpp { Clock::time_point dueTime = Clock::now() + std::chrono::duration(milliseconds); - std::unique_lock guard(scheduleLock); - bool wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; + bool wake = false; - scheduledWork.push(std::make_pair(dueTime, std::move(work))); + { + std::unique_lock guard(scheduleLock); + wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; - guard.unlock(); + scheduledWork.push(std::make_pair(dueTime, std::move(work))); + } if (wake) cv.notify_one(); @@ -571,7 +514,6 @@ namespace rxcpp while(!shutdownRequested) { - if (scheduledWork.empty()) { cv.wait(guard); @@ -592,15 +534,83 @@ namespace rxcpp guard.unlock(); try { - work(); + Schedule([=]{work();}); } catch (...) { - // TODO: ??? what now? + // work must catch all expected exceptions + // (yes, expected exceptions is an oxymoron) + std::unexpected(); } guard.lock(); } } }; + template + struct fix0_thunk { + F f; + fix0_thunk(F&& f) : f(std::move(f)) + { + } + void operator()() const + { + f(*this); + } + }; + template + fix0_thunk fix0(F f) + { + return fix0_thunk(std::move(f)); + } + + template + auto Range( + Integral start, Integral end = std::numeric_limits::max(), Integral step = 1 + ) + -> std::shared_ptr> + { + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = ((end - start) + step) / step; + + DefaultScheduler::Instance().Schedule( + fix0([=](std::function self) // TODO: + { + try { + if (state->cancel) + return; + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + DefaultScheduler::Instance().Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + })); + + return Disposable([=]{ + state->cancel = true; + }); + }); + } + template std::shared_ptr> Delay( const std::shared_ptr>& source, @@ -616,6 +626,7 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { auto cancel = std::make_shared(false); @@ -667,25 +678,25 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { struct State { - ULONGLONG dueTime; + std::chrono::steady_clock::time_point dueTime; }; auto state = std::make_shared(); - state->dueTime = 0; return Subscribe( source, // on next [=](const T& element) { - auto now = ::GetTickCount64(); + auto now = std::chrono::steady_clock::now(); if (now >= state->dueTime) { observer->OnNext(element); - state->dueTime = now + (ULONGLONG)milliseconds; + state->dueTime = now + std::chrono::duration(milliseconds); } }, // on completed @@ -708,6 +719,7 @@ namespace rxcpp { return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { struct State { T last; bool hasValue; @@ -741,89 +753,86 @@ namespace rxcpp }); } - - - - struct ObserveOnDispatcherOp + class StdQueueDispatcher { - HWND hwnd; + mutable std::queue> pending; + mutable std::condition_variable wake; + mutable std::mutex pendingLock; - ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) + std::function get() const { - if (!hwnd) - throw std::exception("error"); - } - ~ObserveOnDispatcherOp() - { - // send one last message to ourselves to shutdown. - post([=]{ CloseWindow(hwnd); }); + std::function fn; + fn = std::move(pending.front()); + pending.pop(); + return std::move(fn); } - struct WindowClass + void dispatch(std::function fn) const { - static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } - WindowClass() + if (fn) { - WNDCLASS wndclass = {}; - wndclass.style = 0; - wndclass.lpfnWndProc = &WndProc; - wndclass.cbClsExtra; - wndclass.cbWndExtra = 0; - wndclass.hInstance = NULL; - wndclass.lpszClassName = className(); - - if (!RegisterClass(&wndclass)) - throw std::exception("error"); - + try { + fn(); + } + catch(...) { + std::unexpected(); + } } - HWND CreateWindow_() + } + + public: + template + void post(Fn fn) const + { { - return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + std::unique_lock guard(pendingLock); + pending.push(std::move(fn)); } - static const int WM_USER_DISPATCH = WM_USER + 1; + wake.notify_one(); + } - static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + void try_dispatch() const + { + std::function fn; { - switch (message) + std::unique_lock guard(pendingLock); + if (!pending.empty()) { - // TODO: shatter attack surface. should validate the message, e.g. using a handle table. - case WM_USER_DISPATCH: - ((void(*)(void*))wParam)((void*)lParam); - return 0; - default: - return DefWindowProc(hwnd, message, wParam, lParam); + fn = get(); } } - static WindowClass& Instance() { - static WindowClass instance; - return instance; - } - }; - - template - void post(Fn fn) const - { - auto p = new Fn(fn); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + dispatch(std::move(fn)); } - template - static void run_proc( - void* pvfn - ) + + bool dispatch_one() const { - auto fn = (Fn*)(void*) pvfn; - (*fn)(); - delete fn; + std::function fn; + { + std::unique_lock guard(pendingLock); + wake.wait(guard, [this]{ return !pending.empty();}); + fn = get(); + } + bool result = !!fn; + dispatch(std::move(fn)); + return result; } }; +#if !defined(OBSERVE_ON_DISPATCHER_OP) + typedef StdQueueDispatcher ObserveOnDispatcherOp; +#endif - template + template std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source) + const std::shared_ptr>& source, + std::shared_ptr dispatcher = nullptr) { - auto dispatcher = std::make_shared(); + if (!dispatcher) + { + dispatcher = std::make_shared(); + } return CreateObservable( [=](std::shared_ptr> observer) + -> Disposable { auto cancel = std::make_shared(false); @@ -861,6 +870,6 @@ namespace rxcpp return cd; }); } -} +} #endif diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp new file mode 100644 index 0000000..00148fb --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_UTIL_HPP) +#define CPPRX_RX_UTIL_HPP +#pragma once + +namespace rxcpp { namespace util { + + template + struct identity + { + typedef Type type; + Type operator()(const Type& left) const {return left;} + }; + +}} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp new file mode 100644 index 0000000..b20c645 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_WINDOWS_HPP) +#define CPPRX_RX_WINDOWS_HPP +#pragma once + +#if defined(WINDOWS) || defined(WIN32) || defined(_WIN32) + +#define NOMINMAX +#include + +namespace rxcpp +{ + +#define OBSERVE_ON_DISPATCHER_OP + + struct ObserveOnDispatcherOp + { + HWND hwnd; + + ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) + { + if (!hwnd) + throw std::exception("error"); + } + ~ObserveOnDispatcherOp() + { + // send one last message to ourselves to shutdown. + post([=]{ CloseWindow(hwnd); }); + } + + struct WindowClass + { + static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } + WindowClass() + { + WNDCLASS wndclass = {}; + wndclass.style = 0; + wndclass.lpfnWndProc = &WndProc; + wndclass.cbClsExtra; + wndclass.cbWndExtra = 0; + wndclass.hInstance = NULL; + wndclass.lpszClassName = className(); + + if (!RegisterClass(&wndclass)) + throw std::exception("error"); + + } + HWND CreateWindow_() + { + return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + } + static const int WM_USER_DISPATCH = WM_USER + 1; + + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_USER_DISPATCH: + ((void(*)(void*))wParam)((void*)lParam); + return 0; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + } + static WindowClass& Instance() { + static WindowClass instance; + return instance; + } + }; + + template + void post(Fn fn) const + { + auto p = new Fn(fn); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + } + template + static void run_proc( + void* pvfn + ) + { + auto fn = (Fn*)(void*) pvfn; + (*fn)(); + delete fn; + } + }; + +} + +#endif + +#endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 045e4aa..ce1864e 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -14,22 +14,19 @@ #include #include #include +#include #include #include #include #include -#include - -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max +#include "rx-util.hpp" +#include "rx-windows.hpp" #include "rx-base.hpp" namespace rxcpp -{ +{ template class Binder { @@ -59,21 +56,44 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } - auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) + template + auto observe_on(std::shared_ptr dispatcher) + -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) + { + return from(ObserveOnDispatcher(obj, std::move(dispatcher))); + } + auto on_dispatcher(std::shared_ptr dispatcher = nullptr) + -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) { - return from(ObserveOnDispatcher(obj)); + return from(ObserveOnDispatcher(obj, std::move(dispatcher))); } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - return Subscribe(obj, onNext); + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext); + DefaultScheduler::Instance().ScopeExit(); + return result; + } + template + auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext, onComplete); + DefaultScheduler::Instance().ScopeExit(); + return result; + } + template + auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) + -> decltype(Subscribe(obj, onNext, onComplete, onError)) { + DefaultScheduler::Instance().ScopeEnter(); + auto result = Subscribe(obj, onNext, onComplete, onError); + DefaultScheduler::Instance().ScopeExit(); + return result; } }; template - Binder from(Obj&& obj) { return Binder(std::move(obj)); } + Binder::type> from(Obj&& obj) { + return Binder::type>(std::move(obj)); } } -#pragma pop_macro("min") -#pragma pop_macro("max") - #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index cd6d162..1aeb807 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -6,30 +6,41 @@ #include "cpprx/rx.hpp" #include +#include #include +#include +#include +#include using namespace std; bool IsPrime(int x); -int main(int argc, char* argv[]) +void PrintPrimes(int n) { - const int n = 20; - std::cout << "first " << n << " primes squared\n"; - - rxcpp::DefaultScheduler::Instance().Schedule( - [=] - { - auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values) - .where(IsPrime) - .select([](int x) { return std::make_pair(x, x*x); }) - .take(n) - .subscribe( + bool done = false; + auto dispatcher = std::make_shared(); + auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values) + .where(IsPrime) + .select([](int x) { return std::make_pair(x, x*x); }) + .take(n) + .on_dispatcher(dispatcher) + .subscribe( [](pair p) { cout << p.first << " =square=> " << p.second << endl; - }); - }); + }, + [&done](){done = true;}, + [&done](const std::exception_ptr&){done = true;}); + + std::cout << "first " << n << " primes squared" << endl; + while(!done){dispatcher->dispatch_one();} +} + + +int main(int argc, char* argv[]) +{ + PrintPrimes(20); } bool IsPrime(int x) -- GitLab From cf81ed7b7fa6fc4a63b1094aad318584574713e7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 18:52:20 -0800 Subject: [PATCH 022/782] fix windows bugs --- Rx/CPP/src/cpprx/rx-base.hpp | 15 ++++++--------- Rx/CPP/src/cpprx/rx.hpp | 24 +++++++++++++----------- Rx/CPP/testbench/testbench.cpp | 11 ++--------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 29c45ee..f677c71 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -818,19 +818,16 @@ namespace rxcpp } }; #if !defined(OBSERVE_ON_DISPATCHER_OP) - typedef StdQueueDispatcher ObserveOnDispatcherOp; + typedef StdQueueDispatcher c; #endif - template + template std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source, - std::shared_ptr dispatcher = nullptr) + const std::shared_ptr>& source) { - if (!dispatcher) - { - dispatcher = std::make_shared(); - } - return CreateObservable( + auto dispatcher = std::make_shared(); + + return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index ce1864e..6d8ffd9 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -4,6 +4,11 @@ #define CPPRX_RX_HPP #pragma once +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + #include #include #include @@ -32,7 +37,7 @@ namespace rxcpp { Obj obj; public: - Binder(Obj&& obj) : obj(std::move(obj)) + Binder(Obj obj) : obj(std::move(obj)) { } template @@ -56,16 +61,10 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } - template - auto observe_on(std::shared_ptr dispatcher) - -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) - { - return from(ObserveOnDispatcher(obj, std::move(dispatcher))); - } - auto on_dispatcher(std::shared_ptr dispatcher = nullptr) - -> decltype(from(ObserveOnDispatcher(obj, std::move(dispatcher)))) + auto on_dispatcher() + -> decltype(from(ObserveOnDispatcher(obj))) { - return from(ObserveOnDispatcher(obj, std::move(dispatcher))); + return from(ObserveOnDispatcher(obj)); } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { @@ -92,8 +91,11 @@ namespace rxcpp }; template Binder::type> from(Obj&& obj) { - return Binder::type>(std::move(obj)); } + return Binder::type>(std::forward(obj)); } } +#pragma pop_macro("min") +#pragma pop_macro("max") + #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 1aeb807..23a4000 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -18,23 +18,16 @@ bool IsPrime(int x); void PrintPrimes(int n) { - bool done = false; - auto dispatcher = std::make_shared(); + std::cout << "first " << n << " primes squared" << endl; auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers auto s1 = rxcpp::from(values) .where(IsPrime) .select([](int x) { return std::make_pair(x, x*x); }) .take(n) - .on_dispatcher(dispatcher) .subscribe( [](pair p) { cout << p.first << " =square=> " << p.second << endl; - }, - [&done](){done = true;}, - [&done](const std::exception_ptr&){done = true;}); - - std::cout << "first " << n << " primes squared" << endl; - while(!done){dispatcher->dispatch_one();} + }); } -- GitLab From e84e1fbf1acd19fa3dc1e352e4ca920418dee6aa Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 20:55:11 -0800 Subject: [PATCH 023/782] add thread local and unwinder --- Rx/CPP/src/cpprx/rx-util.hpp | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 00148fb..d1f69c7 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -4,6 +4,19 @@ #define CPPRX_RX_UTIL_HPP #pragma once +#if !defined(RXCPP_THREAD_LOCAL) +#if defined(_MSC_VER) +#define RXCPP_THREAD_LOCAL __declspec(thread) +#else +#define RXCPP_THREAD_LOCAL __thread +#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__) + namespace rxcpp { namespace util { template @@ -13,6 +26,50 @@ namespace rxcpp { namespace util { Type operator()(const Type& left) const {return left;} }; + template + class unwinder + { + public: + ~unwinder() + { + if (!!function) + { + try { + (*function)(); + } catch (...) { + std::unexpected(); + } + } + } + + explicit unwinder(Function* functionArg) + : function(functionArg) + { + } + + void dismiss() + { + function = nullptr; + } + + private: + unwinder(); + unwinder(const unwinder&); + unwinder& operator=(const unwinder&); + + Function* function; + }; + }} +#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::unwinder UnwinderName(std::addressof(FunctionName)) + #endif \ No newline at end of file -- GitLab From 663c6065a3119101d0e5ee929691bdde475f8800 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 21:13:29 -0800 Subject: [PATCH 024/782] changes to Disposable --- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 2 +- Rx/CPP/src/cpprx/rx-base.hpp | 30 +++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index ed928a0..f86d500 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -76,7 +76,7 @@ void CMainFrame::UserInit() this->UpdateWindow(); }); - composableDisposable.Add(s); + composableDisposable.Add(std::move(s)); } } diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index f677c71..3349a91 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -22,16 +22,32 @@ namespace rxcpp class Disposable { - std::function dispose; + Disposable(); + Disposable(const Disposable&); + typedef std::function dispose_type; + dispose_type dispose; public: - Disposable(std::function dispose) : dispose(std::move(dispose)) - { + explicit Disposable(dispose_type disposearg) + : dispose(std::move(disposearg)) { + disposearg = nullptr;} + Disposable(Disposable&& other) + : dispose(std::move(other.dispose)) { + other.dispose = nullptr; } + Disposable& operator=(Disposable other) { + swap(other); + return *this; } void Dispose() { - if (dispose) dispose(); + if (dispose) { + dispose(); + dispose = nullptr; + } } + void swap(Disposable& rhs) {{using std::swap; swap(dispose, rhs.dispose);}} + static Disposable Empty() { return Disposable(nullptr); } }; + void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} template struct Observable @@ -176,12 +192,12 @@ namespace rxcpp std::weak_ptr> wptr = observer; std::weak_ptr wself = this->shared_from_this(); - Disposable d = [wptr, wself]{ + Disposable d([wptr, wself]{ if (auto self = wself.lock()) { self->RemoveObserver(wptr.lock()); } - }; + }); for(auto& o : observers) { @@ -827,7 +843,7 @@ namespace rxcpp { auto dispatcher = std::make_shared(); - return CreateObservable( + return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { -- GitLab From 7c07b1ad8e998c07ea46e0fb3ec5070c06aabc84 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Feb 2013 21:18:34 -0800 Subject: [PATCH 025/782] add Scheduler and more disposables --- Rx/CPP/src/cpprx/rx-base.hpp | 248 ++++++++++++++++++++++++++--------- 1 file changed, 189 insertions(+), 59 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 3349a91..15584ae 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -56,6 +56,195 @@ namespace rxcpp virtual ~Observable() {} }; + struct Scheduler : public std::enable_shared_from_this + { + typedef std::chrono::steady_clock clock; + typedef std::shared_ptr shared; + typedef std::function Work; + + shared get() {return shared_from_this();} + + virtual ~Scheduler() {} + + virtual clock::time_point Now() =0; + virtual Disposable Schedule(Work work) = 0; + virtual Disposable Schedule(clock::duration due, Work work) = 0; + virtual Disposable Schedule(clock::time_point due, Work work) = 0; + }; + + ////////////////////////////////////////////////////////////////////// + // + // disposables + + + // reference handle type for a container for composing disposables + class ComposableDisposable + { + struct State + { + std::vector disposables; + std::mutex lock; + bool isDisposed; + + State() : isDisposed(false) + { + } + void Add(Disposable&& d) + { + std::unique_lock guard(lock); + if (isDisposed) { + guard.unlock(); + d.Dispose(); + } else { + disposables.emplace_back(std::move(d)); + } + } + void Dispose() + { + std::unique_lock guard(lock); + + if (!isDisposed) + { + isDisposed = true; + auto v = std::move(disposables); + guard.unlock(); + + std::for_each(v.begin(), v.end(), + [](Disposable& d) { + d.Dispose(); }); + } + } + }; + + std::shared_ptr state; + + public: + + ComposableDisposable() : state(new State) + { + } + void Add(Disposable d) const + { + state->Add(std::move(d)); + } + void Dispose() const + { + state->Dispose(); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; + + class ScheduledDisposable + { + struct State : public std::enable_shared_from_this + { + Scheduler::shared scheduler; + Disposable disposable; + + State(Scheduler::shared scheduler, Disposable disposable) + : scheduler(std::move(scheduler)) + , disposable(std::move(disposable)) + { + } + void Dispose() + { + auto local = std::move(scheduler); + if (local) { + auto keepAlive = shared_from_this(); + local->Schedule([keepAlive] (Scheduler::shared) { + keepAlive->disposable.Dispose(); + return Disposable::Empty(); + }); + } + } + }; + + std::shared_ptr state; + + ScheduledDisposable(); + public: + + ScheduledDisposable(Scheduler::shared scheduler, Disposable disposable) + : state(new State(std::move(scheduler), std::move(disposable))) + { + } + void Dispose() const + { + state->Dispose(); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; + + class SharedDisposable + { + typedef std::function dispose_type; + + struct State : public std::enable_shared_from_this + { + mutable Disposable disposable; + mutable std::mutex lock; + + State() : disposable(Disposable::Empty()) {} + + void Set(Disposable disposeArg) const + { + std::unique_lock guard(lock); + {using std::swap; swap(disposable, disposeArg);} + } + void Dispose() + { + std::unique_lock guard(lock); + auto local = std::move(disposable); + guard.unlock(); + local.Dispose(); + } + }; + + std::shared_ptr state; + + public: + + SharedDisposable() + : state(new State()) + { + } + void Dispose() const + { + state->Dispose(); + } + void Set(Disposable disposeArg) const + { + state->Set(std::move(disposeArg)); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; ////////////////////////////////////////////////////////////////////// @@ -243,65 +432,6 @@ namespace rxcpp return source->Subscribe(observer); } - // reference handle type for a container for composing disposables - class ComposableDisposable - { - struct State - { - std::vector disposables; - std::mutex lock; - bool isDisposed; - - State() : isDisposed(false) - { - } - void Add(Disposable&& d) - { - std::unique_lock guard(lock); - if (isDisposed) { - guard.unlock(); - d.Dispose(); - } else { - disposables.push_back(std::move(d)); - } - } - void Dispose() - { - std::unique_lock guard(lock); - - isDisposed = true; - auto v = std::move(disposables); - guard.unlock(); - - std::for_each(v.begin(), v.end(), - [](Disposable& d) { d.Dispose(); }); - } - }; - - std::shared_ptr state; - - public: - ComposableDisposable() : state(new State) - { - } - void Add(Disposable d) const - { - state->Add(std::move(d)); - } - void Dispose() const - { - state->Dispose(); - } - operator Disposable() const - { - auto d = Disposable([=]{ - state->Dispose(); - }); - return d; - } - }; - - ////////////////////////////////////////////////////////////////////// // -- GitLab From cc7340a8dffa18a65fd8b2d1e390691fc87446e9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 1 Mar 2013 10:51:44 -0800 Subject: [PATCH 026/782] add scheduler impl and usage added basic schedulers (Immediate, CurrentThread, EventLoop, NewThread) added subscribe_on and observe_on used these in the test and sample code added WindowScheduler --- Ix/CPP/src/cpplinq/util.hpp | 8 + Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 6 +- Rx/CPP/src/cpprx/rx-base.hpp | 770 +-------------------- Rx/CPP/src/cpprx/rx-operators.hpp | 752 ++++++++++++++++++++ Rx/CPP/src/cpprx/rx-scheduler.h | 395 +++++++++++ Rx/CPP/src/cpprx/rx-util.hpp | 110 ++- Rx/CPP/src/cpprx/rx-windows.hpp | 95 ++- Rx/CPP/src/cpprx/rx.hpp | 27 +- Rx/CPP/testbench/data.txt | 655 ++++++++++++++++++ Rx/CPP/testbench/testbench.cpp | 200 ++++++ Rx/CPP/testbench/testbench.vcxproj | 4 +- Rx/CPP/testbench/testbench.vcxproj.filters | 8 - 12 files changed, 2255 insertions(+), 775 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-operators.hpp create mode 100644 Rx/CPP/src/cpprx/rx-scheduler.h create mode 100644 Rx/CPP/testbench/data.txt diff --git a/Ix/CPP/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp index f1e5222..953a48a 100644 --- a/Ix/CPP/src/cpplinq/util.hpp +++ b/Ix/CPP/src/cpplinq/util.hpp @@ -200,6 +200,14 @@ namespace cpplinq { namespace util { is_set = true; } } + void set(T&& value) { + if (is_set) { + *reinterpret_cast(&storage) = std::move(value); + } else { + new (reinterpret_cast(&storage)) T(std::move(value)); + is_set = true; + } + } T& operator*() { return *get(); } const T& operator*() const { return *get(); } diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index f86d500..da3d39a 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -48,6 +48,8 @@ CMainFrame::~CMainFrame() // inspired by: http://minirx.codeplex.com/ void CMainFrame::UserInit() { + auto worker = std::make_shared(); + auto mainFormScheduler = std::make_shared(); auto mouseMove = BindEventToObservable(mouseMoveEvent); // set up labels and query @@ -64,8 +66,8 @@ void CMainFrame::UserInit() auto s = rxcpp::from(mouseMove) .select([](MouseMoveEventValue e) { return e.point; }) .distinct_until_changed() - .delay(i * 100 + 1) - .on_dispatcher() + .delay(std::chrono::milliseconds(i * 100 + 1), worker) + .observe_on(mainFormScheduler) .subscribe([=](CPoint point) { label->SetWindowPos(nullptr, point.x+20*i, point.y-20, 20, 30, SWP_NOOWNERZORDER); diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 15584ae..cf6642b 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -47,7 +47,7 @@ namespace rxcpp void swap(Disposable& rhs) {{using std::swap; swap(dispose, rhs.dispose);}} static Disposable Empty() { return Disposable(nullptr); } }; - void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} + inline void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} template struct Observable @@ -246,773 +246,55 @@ namespace rxcpp } }; - - ////////////////////////////////////////////////////////////////////// - // - // constructors - - template - class CreatedObservable : public Observable - { - S subscribe; - - public: - CreatedObservable(S subscribe) : subscribe(std::move(subscribe)) - { - } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - return subscribe(std::move(observer)); - } - }; - - template - std::shared_ptr> CreateObservable(S subscribe) - { - return std::make_shared>(std::move(subscribe)); - } - - template - struct CreatedObserver : public Observer - { - std::function onNext; - std::function onCompleted; - std::function onError; - - virtual void OnNext(const T& element) - { - try - { - if(onNext) - { - onNext(element); - } - } - catch (...) - { - OnError(std::current_exception()); - } - } - virtual void OnCompleted() - { - if(onCompleted) - { - onCompleted(); - clear(); - } - } - virtual void OnError(const std::exception_ptr& error) - { - if(onError) - { - onError(error); - clear(); - } - } - void clear() - { - onNext = nullptr; - onCompleted = nullptr; - onError = nullptr; - } - }; - - template - std::shared_ptr> CreateObserver( - std::function onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) + struct LocalScheduler : public Scheduler { - auto p = std::make_shared>(); - p->onNext = std::move(onNext); - p->onCompleted = std::move(onCompleted); - p->onError = std::move(onError); - - return p; - } - - template - class Subject : - public Observable, - public Observer, - public std::enable_shared_from_this> - { - std::vector>> observers; - public: - virtual void OnNext(const T& element) - { - for(auto& o : observers) - { - try - { - if (o) - o->OnNext(element); - } - catch (...) - { - auto o_ = std::move(o); - o_->OnError(std::current_exception()); - } - } - } - virtual void OnCompleted() - { - for(auto& o : observers) - { - if (o) { - o->OnCompleted(); - o = nullptr; - } - } - } - virtual void OnError(const std::exception_ptr& error) - { - for(auto& o : observers) - { - if (o) { - o->OnError(error); - o = nullptr; - } - } - } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; - } - } - observers.push_back(std::move(observer)); - return d; - } - private: - void RemoveObserver(std::shared_ptr> toRemove) - { - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - *it = nullptr; - } - }; - - template - std::shared_ptr> CreateSubject() - { - return std::make_shared>(); - } - - - ////////////////////////////////////////////////////////////////////// - // - // imperative functions - - template - Disposable Subscribe( - const std::shared_ptr>& source, - typename util::identity>::type onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) - { - auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); - - return source->Subscribe(observer); - } - + LocalScheduler(const LocalScheduler&); - ////////////////////////////////////////////////////////////////////// - // - // standard query operators - - template - auto Select( - const std::shared_ptr>& source, - S selector - ) - -> const std::shared_ptr::type>> - { - typedef typename std::result_of::type U; - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - auto result = selector(element); - observer->OnNext(std::move(result)); - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - template - const std::shared_ptr> Where( - const std::shared_ptr>& source, - P predicate - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - auto result = predicate(element); - if (result) - { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - template - std::shared_ptr> Take( - const std::shared_ptr>& source, - int n // TODO: long long? - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto remaining = std::make_shared(n); - - ComposableDisposable cd; - - auto d = Subscribe( - source, - // on next - [=](const T& element) - { - if (*remaining) - { - observer->OnNext(element); - if (--*remaining == 0) - { - observer->OnCompleted(); - cd.Dispose(); - } - } - }, - // on completed - [=] - { - if (*remaining) - { - observer->OnCompleted(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - if (*remaining) - { - observer->OnError(error); - } - }); - cd.Add(std::move(d)); - return cd; - }); - } - - - - ////////////////////////////////////////////////////////////////////// - // - // time and schedulers - - struct DefaultScheduler - { - private: DefaultScheduler(const DefaultScheduler&); public: - static DefaultScheduler& Instance() - { - // TODO: leaks. race condition on atexit though. - static DefaultScheduler* instance = new DefaultScheduler; - return *instance; - } - - typedef std::function Work; - - std::atomic trampoline; - - std::vector queue; - - std::thread worker_thread; - DefaultScheduler() : trampoline(0), shutdownRequested(false) - { - worker_thread = std::thread([=]{ worker(); }); - } - ~DefaultScheduler() + static void DoNoThrow(Work& work, Scheduler::shared scheduler) throw() { + if (work) { - std::unique_lock guard(scheduleLock); - shutdownRequested = true; + work(std::move(scheduler)); } - cv.notify_all(); } - - - void ScopeEnter() {++trampoline;} - void ScopeExit() {--trampoline; Schedule([]{});} - - void Schedule(Work work) + static void Do(Work& work, Scheduler::shared scheduler) { try { - if (++trampoline == 1) - { - work(); - - while(!queue.empty()) - { - work = std::move(queue.back()); - queue.pop_back(); - work(); - } - - } - else - { - queue.push_back(std::move(work)); - } - --trampoline; - } - catch (...) { - --trampoline; - throw; - } - } - - struct compare_work - { - template - bool operator()(const T& work1, const T& work2) const { - return work1.first > work2.first; - } - }; - - typedef std::chrono::steady_clock Clock; - - bool shutdownRequested; - std::mutex scheduleLock; - std::condition_variable cv; - std::priority_queue< std::pair, - std::vector>, - compare_work > scheduledWork; - - - void Schedule(int milliseconds, Work work) - { - Clock::time_point dueTime = Clock::now() + std::chrono::duration(milliseconds); - - bool wake = false; - - { - std::unique_lock guard(scheduleLock); - wake = scheduledWork.empty() || dueTime < scheduledWork.top().first; - - scheduledWork.push(std::make_pair(dueTime, std::move(work))); - } - - if (wake) - cv.notify_one(); - } - private: - void worker() - { - std::unique_lock guard(scheduleLock); - - while(!shutdownRequested) - { - if (scheduledWork.empty()) - { - cv.wait(guard); - continue; - } - - auto now = Clock::now(); - auto dueTime = scheduledWork.top().first; - if (dueTime > now) - { - cv.wait_until(guard, dueTime); - continue; - } - - // dispatch work - auto work = std::move(scheduledWork.top().second); - scheduledWork.pop(); - - guard.unlock(); - try { - Schedule([=]{work();}); - } catch (...) { - // work must catch all expected exceptions - // (yes, expected exceptions is an oxymoron) - std::unexpected(); - } - guard.lock(); + DoNoThrow(work, std::move(scheduler)); + } catch (const std::exception& ) { + // work must catch all expected exceptions + std::unexpected(); + } catch (...) { + // work must catch all expected exceptions + std::unexpected(); } } - }; - - template - struct fix0_thunk { - F f; - fix0_thunk(F&& f) : f(std::move(f)) - { - } - void operator()() const - { - f(*this); - } - }; - template - fix0_thunk fix0(F f) - { - return fix0_thunk(std::move(f)); - } - - template - auto Range( - Integral start, Integral end = std::numeric_limits::max(), Integral step = 1 - ) - -> std::shared_ptr> - { - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = ((end - start) + step) / step; - - DefaultScheduler::Instance().Schedule( - fix0([=](std::function self) // TODO: - { - try { - if (state->cancel) - return; - - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - state->i += step; - DefaultScheduler::Instance().Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } - })); - return Disposable([=]{ - state->cancel = true; - }); - }); - } - - template - std::shared_ptr> Delay( - const std::shared_ptr>& source, - int milliseconds) - { - // TODO: for some reason, poor interactions take place if - // on_dispatcher() dispatches from UI thread. -#if 0 - if (milliseconds == 0) - return source; -#endif - - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ *cancel = true; })); - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - // TODO: queue - DefaultScheduler::Instance().Schedule( - milliseconds, - [=]{ - if (!*cancel) - observer->OnNext(element); - }); - }, - // on completed - [=] - { - DefaultScheduler::Instance().Schedule( - milliseconds, - [=]{ - if (!*cancel) - observer->OnCompleted(); - }); - }, - // on error - [=](const std::exception_ptr& error) - { - if (!*cancel) - observer->OnError(error); - })); - return cd; - }); - } - - // no more than one event ever 'milliseconds' - // TODO: oops, this is not the right definition for throttle. - template - std::shared_ptr> LimitWindow( - const std::shared_ptr>& source, - int milliseconds) - { - if (milliseconds == 0) - return source; - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - std::chrono::steady_clock::time_point dueTime; - }; - - auto state = std::make_shared(); - - return Subscribe( - source, - // on next - [=](const T& element) - { - auto now = std::chrono::steady_clock::now(); - - if (now >= state->dueTime) - { - observer->OnNext(element); - state->dueTime = now + std::chrono::duration(milliseconds); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 - template - std::shared_ptr> DistinctUntilChanged( - const std::shared_ptr>& source) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - T last; bool hasValue; - }; - - auto state = std::make_shared(); - state->hasValue = false; - - return Subscribe( - source, - // on next - [=](const T& element) - { - if (!state->hasValue || state->last != element) - { - observer->OnNext(element); - state->last = element; - state->hasValue = true; - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - class StdQueueDispatcher - { - mutable std::queue> pending; - mutable std::condition_variable wake; - mutable std::mutex pendingLock; - - std::function get() const + public: + LocalScheduler() { - std::function fn; - fn = std::move(pending.front()); - pending.pop(); - return std::move(fn); } - - void dispatch(std::function fn) const + virtual ~LocalScheduler() { - if (fn) - { - try { - fn(); - } - catch(...) { - std::unexpected(); - } - } } - public: - template - void post(Fn fn) const - { - { - std::unique_lock guard(pendingLock); - pending.push(std::move(fn)); - } - wake.notify_one(); - } + virtual clock::time_point Now() {return clock::now();} - void try_dispatch() const + using Scheduler::Schedule; + virtual Disposable Schedule(Work work) { - std::function fn; - { - std::unique_lock guard(pendingLock); - if (!pending.empty()) - { - fn = get(); - } - } - dispatch(std::move(fn)); + clock::time_point dueTime = clock::now(); + return Schedule(dueTime, std::move(work)); } - - bool dispatch_one() const + + virtual Disposable Schedule(clock::duration due, Work work) { - std::function fn; - { - std::unique_lock guard(pendingLock); - wake.wait(guard, [this]{ return !pending.empty();}); - fn = get(); - } - bool result = !!fn; - dispatch(std::move(fn)); - return result; + clock::time_point dueTime = clock::now() + due; + return Schedule(dueTime, std::move(work)); } }; -#if !defined(OBSERVE_ON_DISPATCHER_OP) - typedef StdQueueDispatcher c; -#endif - - template - std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source) - { - auto dispatcher = std::make_shared(); - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - *cancel = true; - })); - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnNext(element); - }); - }, - // on completed - [=] - { - dispatcher->post([=]{ - if(!*cancel) - observer->OnCompleted(); - }); - }, - // on error - [=](const std::exception_ptr& error) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnError(error); - }); - })); - return cd; - }); - } } #endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp new file mode 100644 index 0000000..e4250b1 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -0,0 +1,752 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_OPERATORS_HPP) +#define CPPRX_RX_OPERATORS_HPP +#pragma once + +namespace rxcpp +{ + + ////////////////////////////////////////////////////////////////////// + // + // constructors + + template + class CreatedObservable : public Observable + { + S subscribe; + + public: + CreatedObservable(S subscribe) + : subscribe(std::move(subscribe)) + { + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + if (CurrentThreadScheduler::IsScheduleRequired()) { + auto scheduler = std::make_shared(); + return scheduler->Schedule( + [=](Scheduler::shared){ + try { + return subscribe(observer); + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + } + ); + } + try { + return subscribe(observer); + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + } + }; + + template + std::shared_ptr> CreateObservable(S subscribe) + { + return std::make_shared>(std::move(subscribe)); + } + + template + struct CreatedObserver : public Observer + { + std::function onNext; + std::function onCompleted; + std::function onError; + + virtual void OnNext(const T& element) + { + try + { + if(onNext) + { + onNext(element); + } + } + catch (...) + { + OnError(std::current_exception()); + } + } + virtual void OnCompleted() + { + if(onCompleted) + { + onCompleted(); + clear(); + } + } + virtual void OnError(const std::exception_ptr& error) + { + if(onError) + { + onError(error); + clear(); + } + } + void clear() + { + onNext = nullptr; + onCompleted = nullptr; + onError = nullptr; + } + }; + + template + std::shared_ptr> CreateObserver( + std::function onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto p = std::make_shared>(); + p->onNext = std::move(onNext); + p->onCompleted = std::move(onCompleted); + p->onError = std::move(onError); + + return p; + } + + template + class Subject : + public Observable, + public Observer, + public std::enable_shared_from_this> + { + std::vector>> observers; + public: + virtual void OnNext(const T& element) + { + for(auto& o : observers) + { + try + { + if (o) + o->OnNext(element); + } + catch (...) + { + auto o_ = std::move(o); + o_->OnError(std::current_exception()); + } + } + } + virtual void OnCompleted() + { + for(auto& o : observers) + { + if (o) { + o->OnCompleted(); + o = nullptr; + } + } + } + virtual void OnError(const std::exception_ptr& error) + { + for(auto& o : observers) + { + if (o) { + o->OnError(error); + o = nullptr; + } + } + } + virtual Disposable Subscribe(std::shared_ptr> observer) + { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(std::move(observer)); + return d; + } + + private: + void RemoveObserver(std::shared_ptr> toRemove) + { + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } + }; + + template + std::shared_ptr> CreateSubject() + { + return std::make_shared>(); + } + + template + struct fix0_thunk { + F f; + fix0_thunk(F&& f) : f(std::move(f)) + { + } + Disposable operator()(Scheduler::shared s) const + { + return f(s, *this); + } + }; + template + fix0_thunk fix0(F f) + { + return fix0_thunk(std::move(f)); + } + + template + auto Range( + Integral start, Integral end = std::numeric_limits::max(), Integral step = 1, + Scheduler::shared scheduler = nullptr) + -> std::shared_ptr> + { + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = ((end - start) + step) / step; + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + try { + if (state->cancel) + return Disposable::Empty(); + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + return s->Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + }))); + + return cd; + }); + } + + + ////////////////////////////////////////////////////////////////////// + // + // imperative functions + + template + Disposable Subscribe( + const std::shared_ptr>& source, + typename util::identity>::type onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); + + return source->Subscribe(observer); + } + + + ////////////////////////////////////////////////////////////////////// + // + // standard query operators + + template + auto Select( + const std::shared_ptr>& source, + S selector + ) + -> const std::shared_ptr::type>> + { + typedef typename std::result_of::type U; + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = selector(element); + observer->OnNext(std::move(result)); + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + const std::shared_ptr> Where( + const std::shared_ptr>& source, + P predicate + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + auto result = predicate(element); + if (result) + { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + std::shared_ptr> Take( + const std::shared_ptr>& source, + int n // TODO: long long? + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto remaining = std::make_shared(n); + + ComposableDisposable cd; + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (*remaining) + { + observer->OnNext(element); + if (--*remaining == 0) + { + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on completed + [=] + { + if (*remaining) + { + observer->OnCompleted(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + if (*remaining) + { + observer->OnError(error); + } + })); + return cd; + }); + } + + + ////////////////////////////////////////////////////////////////////// + // + // time + + template + std::shared_ptr> Delay( + const std::shared_ptr>& source, + Scheduler::clock::duration due, + Scheduler::shared scheduler = nullptr) + { + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ *cancel = true; })); + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + sd.Set(scheduler->Schedule( + due, + [=] (Scheduler::shared){ + if (!*cancel) + observer->OnNext(element); + return Disposable::Empty(); + } + )); + }, + // on completed + [=] + { + sd.Set(scheduler->Schedule( + due, + [=](Scheduler::shared){ + if (!*cancel) + observer->OnCompleted(); + return Disposable::Empty(); + } + )); + }, + // on error + [=](const std::exception_ptr& error) + { + if (!*cancel) + observer->OnError(error); + })); + return cd; + }); + } + + // no more than one event ever 'milliseconds' + // TODO: oops, this is not the right definition for throttle. + template + std::shared_ptr> LimitWindow( + const std::shared_ptr>& source, + int milliseconds) + { + if (milliseconds == 0) + return source; + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + std::chrono::steady_clock::time_point dueTime; + }; + + auto state = std::make_shared(); + + return Subscribe( + source, + // on next + [=](const T& element) + { + auto now = std::chrono::steady_clock::now(); + + if (now >= state->dueTime) + { + observer->OnNext(element); + state->dueTime = now + std::chrono::duration(milliseconds); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 + template + std::shared_ptr> DistinctUntilChanged( + const std::shared_ptr>& source) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + T last; bool hasValue; + }; + + auto state = std::make_shared(); + state->hasValue = false; + + return Subscribe( + source, + // on next + [=](const T& element) + { + if (!state->hasValue || state->last != element) + { + observer->OnNext(element); + state->last = element; + state->hasValue = true; + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } + + template + std::shared_ptr> SubscribeOnObservable( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + ComposableDisposable cd; + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(scheduler->Schedule([=](Scheduler::shared){ + sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); + return Disposable::Empty(); + })); + return cd; + }); + } + + template + std::shared_ptr> ObserveOnObserver( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto queue = std::make_shared(); + auto queueScheduler = queue->GetScheduler(); + + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + queue->Dispose(); + })); + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + sd.Set(queueScheduler->Schedule([=](Scheduler::shared){ + observer->OnNext(element); + return Disposable::Empty(); + })); + queue->RunOnScheduler(scheduler); + }, + // on completed + [=] + { + sd.Set(queueScheduler->Schedule( + [=](Scheduler::shared){ + observer->OnCompleted(); + return Disposable::Empty(); + } + )); + queue->RunOnScheduler(scheduler); + }, + // on error + [=](const std::exception_ptr& error) + { + queueScheduler->Schedule([=](Scheduler::shared){ + observer->OnError(error); + queue->Dispose(); + return Disposable::Empty(); + }); + queue->RunOnScheduler(scheduler); + })); + return cd; + }); + } + + class StdQueueDispatcher + { + mutable std::queue> pending; + mutable std::condition_variable wake; + mutable std::mutex pendingLock; + + std::function get() const + { + std::function fn; + fn = std::move(pending.front()); + pending.pop(); + return std::move(fn); + } + + void dispatch(std::function fn) const + { + if (fn) + { + try { + fn(); + } + catch(...) { + std::unexpected(); + } + } + } + + public: + template + void post(Fn fn) const + { + { + std::unique_lock guard(pendingLock); + pending.push(std::move(fn)); + } + wake.notify_one(); + } + + void try_dispatch() const + { + std::function fn; + { + std::unique_lock guard(pendingLock); + if (!pending.empty()) + { + fn = get(); + } + } + dispatch(std::move(fn)); + } + + bool dispatch_one() const + { + std::function fn; + { + std::unique_lock guard(pendingLock); + wake.wait(guard, [this]{ return !pending.empty();}); + fn = get(); + } + bool result = !!fn; + dispatch(std::move(fn)); + return result; + } + }; +#if defined(OBSERVE_ON_DISPATCHER_OP) + typedef OBSERVE_ON_DISPATCHER_OP ObserveOnDispatcherOp; +#else + typedef StdQueueDispatcher ObserveOnDispatcherOp; +#endif + + template + std::shared_ptr> ObserveOnDispatcher( + const std::shared_ptr>& source) + { + auto dispatcher = std::make_shared(); + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + *cancel = true; + })); + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnNext(element); + }); + }, + // on completed + [=] + { + dispatcher->post([=]{ + if(!*cancel) + observer->OnCompleted(); + }); + }, + // on error + [=](const std::exception_ptr& error) + { + dispatcher->post([=]{ + if (!*cancel) + observer->OnError(error); + }); + })); + return cd; + }); + } + +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-scheduler.h b/Rx/CPP/src/cpprx/rx-scheduler.h new file mode 100644 index 0000000..c2c16d6 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-scheduler.h @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if !defined(CPPRX_RX_SCHEDULERS_HPP) +#define CPPRX_RX_SCHEDULERS_HPP +#pragma once + +namespace rxcpp +{ + + ////////////////////////////////////////////////////////////////////// + // + // schedulers + + struct CurrentThreadScheduler : public LocalScheduler + { + private: + CurrentThreadScheduler(const CurrentThreadScheduler&); + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + typedef std::priority_queue< + std::pair>, + std::vector>>, + compare_work + > ScheduledWork; + + RXCPP_THREAD_LOCAL static ScheduledWork* scheduledWork; + + public: + CurrentThreadScheduler() + { + } + virtual ~CurrentThreadScheduler() + { + } + + static bool IsScheduleRequired() { return scheduledWork == nullptr; } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto cancelable = std::make_shared(std::move(work)); + // check trampoline + if (!!scheduledWork) + { + scheduledWork->push(std::make_pair(dueTime, cancelable)); + return Disposable([=]{(*cancelable.get()) = nullptr;}); + } + + // create and publish new queue + scheduledWork = new ScheduledWork(); + RXCPP_UNWIND_AUTO([]{ + delete scheduledWork; + scheduledWork = nullptr; + }); + + scheduledWork->push(std::make_pair(dueTime, cancelable)); + + // loop until queue is empty + for ( + auto dueTime = scheduledWork->top().first; + std::this_thread::sleep_until(dueTime), true; + dueTime = scheduledWork->top().first + ) + { + // dispatch work + auto work = std::move(*scheduledWork->top().second.get()); + scheduledWork->pop(); + + Do(work, get()); + + if (scheduledWork->empty()) {break;} + } + + return Disposable::Empty(); + } + }; + // static + RXCPP_SELECT_ANY RXCPP_THREAD_LOCAL CurrentThreadScheduler::ScheduledWork* CurrentThreadScheduler::scheduledWork = nullptr; + + struct ImmediateScheduler : public LocalScheduler + { + private: + ImmediateScheduler(const ImmediateScheduler&); + + public: + ImmediateScheduler() + { + } + virtual ~ImmediateScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto ct = std::make_shared(); + Do(work, ct); + return Disposable::Empty(); + } + }; + + + class WorkQueue : public std::enable_shared_from_this + { + typedef LocalScheduler::Work Work; + typedef LocalScheduler::clock clock; + typedef std::pair Item; + typedef std::shared_ptr shared; + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + std::atomic trampoline; + std::priority_queue< + std::pair>, + std::vector>>, + compare_work > scheduledWork; + mutable std::mutex lock; + mutable std::condition_variable wake; + mutable std::atomic exit; + + struct WorkQueueScheduler : public LocalScheduler + { + private: + WorkQueueScheduler(); + WorkQueueScheduler(const WorkQueueScheduler&); + + WorkQueue::shared queue; + + public: + WorkQueueScheduler(WorkQueue::shared queue) : queue(queue) + { + } + virtual ~WorkQueueScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto cancelable = std::make_shared(std::make_pair(get(), std::move(work))); + { + std::unique_lock guard(queue->lock); + queue->scheduledWork.push(std::make_pair(dueTime, cancelable)); + } + queue->wake.notify_one(); + auto local = queue; + return Disposable([local, cancelable]{ + std::unique_lock guard(local->lock); + cancelable.get()->second = nullptr;}); + } + }; + + public: + typedef std::function RunLoop; + typedef std::function Factory; + + WorkQueue() + : trampoline(0) + , exit(false) + { + } + + util::maybe EnsureThread(Factory& factory) + { + util::maybe result; + std::unique_lock guard(lock); + RXCPP_UNWIND(unwindTrampoline, [&]{--trampoline;}); + if (++trampoline == 1) + { + auto local = shared_from_this(); + result.set(factory([local]{local->Run();})); + // trampoline lifetime is now owned by the thread + unwindTrampoline.dismiss(); + } + return result; + } + + void Dispose() const + { + std::unique_lock guard(lock); + if (trampoline > 0) + { + exit = true; + wake.notify_one(); + } + } + operator Disposable() const + { + auto local = shared_from_this(); + return Disposable([local]{ + local->Dispose(); + }); + } + Scheduler::shared GetScheduler() + { + return std::make_shared(shared_from_this()); + } + void Run() + { + auto keepAlive = shared_from_this(); + { + RXCPP_UNWIND_AUTO([&]{--trampoline;}); + + std::unique_lock guard(lock); + + while(!exit && !scheduledWork.empty()) + { + // wait until there is work + wake.wait(guard, [this]{ return this->exit || !this->scheduledWork.empty();}); + if (exit || scheduledWork.empty()) {break;} + + auto item = &scheduledWork.top(); + if (!item->second) {scheduledWork.pop(); continue;} + + // wait until the work is due + while (!exit && item->second && item->second.get()->first->Now() < item->first) + { + wake.wait_until(guard, item->first); + item = &scheduledWork.top(); + } + if (exit || scheduledWork.empty()) {break;} + if (!item->second) {scheduledWork.pop(); continue;} + + // dispatch work + auto work = std::move(item->second.get()->second); + auto scheduler = std::move(item->second.get()->first); + scheduledWork.pop(); + + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, scheduler); + } + } + exit = false; + } + + Disposable RunOnScheduler(Scheduler::shared scheduler) + { + RXCPP_UNWIND_AUTO([&]{--trampoline;}); + if (++trampoline == 1) + { + // this is decremented when no further work is scheduled + ++trampoline; + auto keepAlive = shared_from_this(); + return scheduler->Schedule( + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + return Disposable::Empty(); + } + private: + Disposable RunOnSchedulerWork(Scheduler::shared scheduler) + { + auto keepAlive = shared_from_this(); + + std::unique_lock guard(lock); + + if(!exit && !scheduledWork.empty()) + { + auto& item = scheduledWork.top(); + + // wait until the work is due + if(!exit && item.second.get()->first->Now() < item.first) + { + return scheduler->Schedule( + item.first, + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + + if(!exit) + { + // dispatch work + auto work = std::move(item.second.get()->second); + auto scheduler = std::move(item.second.get()->first); + scheduledWork.pop(); + + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, scheduler); + } + } + + if(!exit && !scheduledWork.empty()) + { + return scheduler->Schedule( + [keepAlive, scheduler](Scheduler::shared){ + return keepAlive->RunOnSchedulerWork(scheduler);}); + } + + // only decrement when no further work is scheduled + --trampoline; + exit = false; + return Disposable::Empty(); + } + }; + + + struct EventLoopScheduler : public LocalScheduler + { + private: + EventLoopScheduler(const EventLoopScheduler&); + + std::shared_ptr queue; + Scheduler::shared scheduler; + std::thread worker; + WorkQueue::Factory factory; + + public: + EventLoopScheduler() + : queue(std::make_shared()) + , scheduler(queue->GetScheduler()) + { + auto local = queue; + factory = [local] (WorkQueue::RunLoop rl) -> std::thread { + return std::thread([local, rl]{rl();}); + }; + } + template + EventLoopScheduler(Factory factoryarg) + : queue(std::make_shared()) + , scheduler(queue->GetScheduler()) + { + auto local = queue; + factory = std::move(factoryarg); + } + virtual ~EventLoopScheduler() + { + if (worker.joinable()) { + worker.detach(); + } + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + Disposable result = scheduler->Schedule(dueTime, std::move(work)); + + auto maybeThread = queue->EnsureThread(factory); + if (maybeThread) + { + if (worker.joinable()) + { + worker.join(); + } + worker = std::move(*maybeThread.get()); + } + return std::move(result); + } + }; + + struct NewThreadScheduler : public LocalScheduler + { + public: + typedef std::function)> Factory; + private: + NewThreadScheduler(const NewThreadScheduler&); + + Factory factory; + public: + + + NewThreadScheduler() : factory([](std::function start){return std::thread(std::move(start));}) + { + } + NewThreadScheduler(Factory factory) : factory(factory) + { + } + virtual ~NewThreadScheduler() + { + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto scheduler = std::make_shared(factory); + return scheduler->Schedule(dueTime, work); + } + }; +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index d1f69c7..32c4cd0 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -12,6 +12,14 @@ #endif #endif +#if !defined(RXCPP_SELECT_ANY) +#if defined(_MSC_VER) +#define RXCPP_SELECT_ANY __declspec(selectany) +#else +#define RXCPP_SELECT_ANY +#endif +#endif + #define RXCPP_CONCAT(Prefix, Suffix) Prefix ## Suffix #define RXCPP_CONCAT_EVALUATE(Prefix, Suffix) RXCPP_CONCAT(Prefix, Suffix) @@ -26,7 +34,107 @@ namespace rxcpp { namespace util { Type operator()(const Type& left) const {return left;} }; - template + template + class maybe + { + bool is_set; + typename std::aligned_storage::value>::type + storage; + public: + maybe() + : is_set(false) + { + } + + maybe(T value) + : is_set(false) + { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + + maybe(const maybe& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(*other.get()); + is_set = true; + } + } + maybe(maybe&& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(std::move(*other.get())); + is_set = true; + other.reset(); + } + } + + ~maybe() + { + reset(); + } + + void reset() + { + if (is_set) { + is_set = false; + reinterpret_cast(&storage)->~T(); + } + } + + T* get() { + return is_set ? reinterpret_cast(&storage) : 0; + } + + const T* get() const { + return is_set ? reinterpret_cast(&storage) : 0; + } + + void set(const T& value) { + if (is_set) { + *reinterpret_cast(&storage) = value; + } else { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + } + void set(T&& value) { + if (is_set) { + *reinterpret_cast(&storage) = std::move(value); + } else { + new (reinterpret_cast(&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: + + }; + + template class unwinder { public: diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index b20c645..2c9bac9 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -9,10 +9,12 @@ #define NOMINMAX #include -namespace rxcpp -{ +namespace rxcpp { namespace win32 { + -#define OBSERVE_ON_DISPATCHER_OP +#if !defined(OBSERVE_ON_DISPATCHER_OP) +#define OBSERVE_ON_DISPATCHER_OP rxcpp::win32::ObserveOnDispatcherOp +#endif struct ObserveOnDispatcherOp { @@ -73,21 +75,96 @@ namespace rxcpp template void post(Fn fn) const { - auto p = new Fn(fn); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)p); + std::unique_ptr f(new Fn(fn)); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); } template static void run_proc( void* pvfn ) { - auto fn = (Fn*)(void*) pvfn; - (*fn)(); - delete fn; + std::unique_ptr f((Fn*)(void*) pvfn); + (*f.get())(); } }; -} + class WindowScheduler : public rxcpp::LocalScheduler + { + HWND hwnd; + Scheduler::shared ct; + typedef std::pair Item; + + struct WindowClass + { + static const wchar_t* const className(){ return L"rxcpp::win32::WindowScheduler::WindowClass"; } + WindowClass() + { + WNDCLASS wndclass = {}; + wndclass.style = 0; + wndclass.lpfnWndProc = &WndProc; + wndclass.cbClsExtra; + wndclass.cbWndExtra = 0; + wndclass.hInstance = NULL; + wndclass.lpszClassName = className(); + + if (!RegisterClass(&wndclass)) + throw std::exception("failed to register windows class"); + + } + HWND CreateWindow_() + { + return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); + } + static const int WM_USER_DISPATCH = WM_USER + 1; + + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + switch (message) + { + // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_USER_DISPATCH: + ((void(*)(void*))wParam)((void*)lParam); + return 0; + default: + return DefWindowProc(hwnd, message, wParam, lParam); + } + } + static WindowClass& Instance() { + static WindowClass instance; + return instance; + } + }; + static void run_proc( + void* pvfn + ) + { + std::unique_ptr f((Item*)(void*) pvfn); + Do(f->second, f->first); + } + + public: + WindowScheduler() + : hwnd(WindowClass::Instance().CreateWindow_()) + , ct(std::make_shared()) + { + if (!hwnd) + throw std::exception("create window failed"); + } + ~WindowScheduler() + { + // send one last message to ourselves to shutdown. + Schedule([=](Scheduler::shared){ CloseWindow(hwnd); return Disposable::Empty();}); + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + std::unique_ptr f(new Item(ct, std::move(work))); + ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); + return Disposable::Empty(); + } + }; +} } #endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 6d8ffd9..f596bd0 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -27,8 +27,10 @@ #include "rx-util.hpp" -#include "rx-windows.hpp" #include "rx-base.hpp" +#include "rx-scheduler.h" +#include "rx-windows.hpp" +#include "rx-operators.hpp" namespace rxcpp { @@ -52,8 +54,11 @@ namespace rxcpp auto take(Integral n) -> decltype(from(Take(obj, n))) { return from(Take(obj, n)); } - auto delay(int milliseconds) -> decltype(from(Delay(obj, milliseconds))) { - return from(Delay(obj, milliseconds)); + auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { + return from(Delay(obj, due)); + } + auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { + return from(Delay(obj, due, scheduler)); } auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { return from(LimitWindow(obj, milliseconds)); @@ -61,6 +66,16 @@ namespace rxcpp auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } + auto subscribe_on(Scheduler::shared scheduler) + -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) + { + return from(SubscribeOnObservable(obj, std::move(scheduler))); + } + auto observe_on(Scheduler::shared scheduler) + -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) + { + return from(ObserveOnObserver(obj, std::move(scheduler))); + } auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) { @@ -68,24 +83,18 @@ namespace rxcpp } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext); - DefaultScheduler::Instance().ScopeExit(); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext, onComplete); - DefaultScheduler::Instance().ScopeExit(); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - DefaultScheduler::Instance().ScopeEnter(); auto result = Subscribe(obj, onNext, onComplete, onError); - DefaultScheduler::Instance().ScopeExit(); return result; } }; diff --git a/Rx/CPP/testbench/data.txt b/Rx/CPP/testbench/data.txt new file mode 100644 index 0000000..b16aea6 --- /dev/null +++ b/Rx/CPP/testbench/data.txt @@ -0,0 +1,655 @@ +{'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/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 23a4000..f09f0d9 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -4,6 +4,7 @@ // #include "cpprx/rx.hpp" +#include "cpplinq/linq.hpp" #include #include @@ -30,10 +31,135 @@ void PrintPrimes(int n) }); } +std::shared_ptr> Data( + string filename, + rxcpp::Scheduler::shared scheduler = std::make_shared() +); +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() ); + } + }; + + cout << "data >input ^parse and >(); + { + std::exception_ptr error; + std::condition_variable cv; + + std::mutex coutLock; + int inID = 0; + int parseID = 0; + int outID = 0; + + auto dataLines = Data( + "data.txt" +// , std::make_shared() + ); + auto input = std::make_shared(); + auto parsing = std::make_shared(); + auto output = std::make_shared(); + auto exp = rxcpp::from(dataLines) + .subscribe_on(input) + .select([&coutLock, &inID](const string& line) { + { + std::unique_lock guard(coutLock); + if (inID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '>' << std::flush; + } + return line; }) + .observe_on(parsing) + .select([&coutLock, &parseID](const string& line) { + { + std::unique_lock guard(coutLock); + if (parseID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '^' << std::flush; + } + return item(line); }) + .observe_on(output) +// .delay(std::chrono::milliseconds(10), output) + .subscribe( + [=, &coutLock, &outID](const item& i){ + { + std::unique_lock guard(coutLock); + if (outID++ == 0) std::cout << std::this_thread::get_id(); + std::cout << '<' << std::flush; + } + shared_data_parsed->push_back(i); }, + [&cv](){ + cv.notify_one();}, + [&cv, &error](const std::exception_ptr& e){ + error = e; cv.notify_one();}); + + std::mutex doneLock; + std::unique_lock guard(doneLock); + cv.wait(guard); + if (error != std::exception_ptr()) {std::rethrow_exception(error);} + cout << endl << "data loaded" << endl; + } + + auto data_parsed = shared_data_parsed.get(); + 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(int argc, char* argv[]) { PrintPrimes(20); + + try { + run(); + } catch (exception& e) { + cerr << "exception: " << e.what() << endl; + } } bool IsPrime(int x) @@ -47,3 +173,77 @@ bool IsPrime(int x) return true; } +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"); +} + +std::shared_ptr> Data( + string filename, + rxcpp::Scheduler::shared scheduler +) +{ + return rxcpp::CreateObservable( + [=](std::shared_ptr> observer) + -> rxcpp::Disposable + { + struct State + { + State(string filename) + : cancel(false), data(filename) { + if (data.fail()) { + throw logic_error("could not find file"); + } + } + bool cancel; + ifstream data; + }; + auto state = std::make_shared(std::move(filename)); + + rxcpp::ComposableDisposable cd; + + cd.Add(rxcpp::Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + rxcpp::fix0([=](rxcpp::Scheduler::shared s, std::function self) -> rxcpp::Disposable + { + try { + if (state->cancel) + return rxcpp::Disposable::Empty(); + + string line; + if (!!getline(state->data, line)) + { + observer->OnNext(std::move(line)); + return s->Schedule(std::move(self)); + } + else + { + observer->OnCompleted(); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + return rxcpp::Disposable::Empty(); + }) + )); + + return cd; + } + ); +} + diff --git a/Rx/CPP/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj index e357456..3f0ae00 100644 --- a/Rx/CPP/testbench/testbench.vcxproj +++ b/Rx/CPP/testbench/testbench.vcxproj @@ -44,13 +44,13 @@ true - $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ false - $(VCInstallDir)include;..\src;$(WindowsSDK_IncludePath); + $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); $(SolutionDir)\bin\$(Configuration)\ obj\$(Configuration)\ diff --git a/Rx/CPP/testbench/testbench.vcxproj.filters b/Rx/CPP/testbench/testbench.vcxproj.filters index 2737526..8afd620 100644 --- a/Rx/CPP/testbench/testbench.vcxproj.filters +++ b/Rx/CPP/testbench/testbench.vcxproj.filters @@ -19,12 +19,4 @@ Source Files - - - Header Files - - - Header Files - - \ No newline at end of file -- GitLab From 803c2b5a9e68bacde47962cbbc86c875bdfb32ed Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 2 Mar 2013 22:46:57 -0800 Subject: [PATCH 027/782] added - orderby, foreach, publish and usage thereof --- Rx/CPP/src/cpprx/rx-base.hpp | 13 +- Rx/CPP/src/cpprx/rx-includes.hpp | 38 +++ Rx/CPP/src/cpprx/rx-operators.hpp | 244 +++++++++++++++--- .../{rx-scheduler.h => rx-scheduler.hpp} | 4 +- Rx/CPP/src/cpprx/rx-util.hpp | 4 +- Rx/CPP/src/cpprx/rx-windows.hpp | 3 + Rx/CPP/src/cpprx/rx.hpp | 145 ++++++----- Rx/CPP/testbench/testbench.cpp | 176 ++++++------- 8 files changed, 426 insertions(+), 201 deletions(-) create mode 100644 Rx/CPP/src/cpprx/rx-includes.hpp rename Rx/CPP/src/cpprx/{rx-scheduler.h => rx-scheduler.hpp} (99%) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index cf6642b..e5af503 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_BASE_HPP) #define CPPRX_RX_BASE_HPP -#pragma once namespace rxcpp { @@ -56,7 +58,14 @@ namespace rxcpp virtual ~Observable() {} }; - struct Scheduler : public std::enable_shared_from_this + template + struct GroupedObservable : Observable + { + virtual K Key() = 0; + virtual ~GroupedObservable() {} + }; + + struct Scheduler : public std::enable_shared_from_this { typedef std::chrono::steady_clock clock; typedef std::shared_ptr shared; diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp new file mode 100644 index 0000000..d5be690 --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#if !defined(CPPRX_RX_INCLUDES_HPP) +#define CPPRX_RX_INCLUDES_HPP + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rx-util.hpp" +#include "rx-base.hpp" +#include "rx-scheduler.hpp" +#include "rx-windows.hpp" +#include "rx-operators.hpp" + +#pragma pop_macro("min") +#pragma pop_macro("max") + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index e4250b1..cfd100d 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_OPERATORS_HPP) #define CPPRX_RX_OPERATORS_HPP -#pragma once namespace rxcpp { @@ -111,17 +113,60 @@ namespace rxcpp return p; } - template - class Subject : - public Observable, - public Observer, - public std::enable_shared_from_this> + + template + class ObservableSubject : + public Base, + public std::enable_shared_from_this { + protected: std::vector>> observers; + + void RemoveObserver(std::shared_ptr> toRemove) + { + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } public: - virtual void OnNext(const T& element) + + virtual Disposable Subscribe(std::shared_ptr> observer) { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(std::move(observer)); + return d; + } + }; + + template + class ObserverSubject : + public Base + { + public: + ObserverSubject() {} + + template + explicit ObserverSubject(A&& a) : Base(std::forward(a)) {} + + virtual void OnNext(const T& element) + { + for(auto& o : Base::observers) { try { @@ -137,7 +182,7 @@ namespace rxcpp } virtual void OnCompleted() { - for(auto& o : observers) + for(auto& o : Base::observers) { if (o) { o->OnCompleted(); @@ -147,7 +192,7 @@ namespace rxcpp } virtual void OnError(const std::exception_ptr& error) { - for(auto& o : observers) + for(auto& o : Base::observers) { if (o) { o->OnError(error); @@ -155,36 +200,12 @@ namespace rxcpp } } } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; - } - } - observers.push_back(std::move(observer)); - return d; - } + }; - private: - void RemoveObserver(std::shared_ptr> toRemove) - { - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - *it = nullptr; - } + template + class Subject : + public ObserverSubject, Subject>> + { }; template @@ -193,6 +214,32 @@ namespace rxcpp return std::make_shared>(); } + template + class GroupedObservableSubject : + public Base + { + K key; + public: + GroupedObservableSubject(K key) : key(std::move(key)) {} + + virtual K Key() {return key;} + }; + + template + class GroupedSubject : + public ObserverSubject, GroupedSubject>>> + { + typedef ObserverSubject, GroupedSubject>>> base; + public: + GroupedSubject(K key) : base(std::move(key)) {} + }; + + template + std::shared_ptr> CreateGroupedSubject(K key) + { + return std::make_shared>(std::move(key)); + } + template struct fix0_thunk { F f; @@ -283,6 +330,36 @@ namespace rxcpp return source->Subscribe(observer); } + template + void ForEach( + const std::shared_ptr>& source, + typename util::identity>::type onNext + ) + { + std::mutex lock; + std::condition_variable wake; + bool done = false; + std::exception_ptr error; + auto observer = CreateObserver(std::move(onNext), [&]{ + std::unique_lock guard(lock); + done = true; + wake.notify_one(); + }, [&](const std::exception_ptr& e){ + std::unique_lock guard(lock); + done = true; + error = std::move(e); + wake.notify_one(); + }); + + source->Subscribe(observer); + + { + std::unique_lock guard(lock); + wake.wait(guard, [&]{return done;}); + } + + if (error != std::exception_ptr()) {std::rethrow_exception(error);} + } ////////////////////////////////////////////////////////////////////// // @@ -299,7 +376,7 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) { - return Subscribe( + return Subscribe( source, // on next [=](const T& element) @@ -353,6 +430,95 @@ namespace rxcpp }); } + template + auto GroupBy( + const std::shared_ptr>& source, + KS keySelector, + VS valueSelector, + L less) + -> std::shared_ptr::type, + typename std::decay::type>>>> + { + typedef typename std::decay::type Key; + typedef typename std::decay::type Value; + + typedef std::shared_ptr> LocalGroupObservable; + + return CreateObservable( + [=](std::shared_ptr> observer) + { + typedef std::function OnNext; + typedef std::function OnCompleted; + typedef std::function OnError; + + struct GroupValue + { + OnNext onNext; + OnCompleted onCompleted; + OnError onError; + }; + typedef std::map Groups; + + struct State + { + State(L less) : groups(std::move(less)) {} + std::mutex lock; + Groups groups; + }; + auto state = std::make_shared(std::move(less)); + + return Subscribe( + source, + // on next + [=](const T& element) + { + auto key = keySelector(element); + auto keySubject = CreateGroupedSubject(key); + + typename Groups::iterator groupIt; + bool newGroup = false; + GroupValue value; + value.onNext = [keySubject](Value v){ + keySubject->OnNext(std::move(v));}; + value.onCompleted = [keySubject](){ + keySubject->OnCompleted();}; + value.onError = [keySubject](const std::exception_ptr& e){ + keySubject->OnError(std::move(e));}; + + { + std::unique_lock guard(state->lock); + std::tie(groupIt, newGroup) = state->groups.insert(std::make_pair( + key,std::move(value)) + ); + } + + if (newGroup) + { + LocalGroupObservable nextGroup(std::move(keySubject)); + observer->OnNext(nextGroup); + } + groupIt->second.onNext(valueSelector(element)); + }, + // on completed + [=] + { + for(auto& group : state->groups) { + group.second.onCompleted(); + } + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + for(auto& group : state->groups) { + group.second.onError(error); + } + observer->OnError(error); + }); + }); + } + template std::shared_ptr> Take( const std::shared_ptr>& source, diff --git a/Rx/CPP/src/cpprx/rx-scheduler.h b/Rx/CPP/src/cpprx/rx-scheduler.hpp similarity index 99% rename from Rx/CPP/src/cpprx/rx-scheduler.h rename to Rx/CPP/src/cpprx/rx-scheduler.hpp index c2c16d6..5fcef15 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.h +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_SCHEDULERS_HPP) #define CPPRX_RX_SCHEDULERS_HPP -#pragma once namespace rxcpp { diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 32c4cd0..144fbc6 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_UTIL_HPP) #define CPPRX_RX_UTIL_HPP -#pragma once #if !defined(RXCPP_THREAD_LOCAL) #if defined(_MSC_VER) diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 2c9bac9..72e636f 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -1,5 +1,8 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#pragma once +#include "rx-includes.hpp" + #if !defined(CPPRX_RX_WINDOWS_HPP) #define CPPRX_RX_WINDOWS_HPP #pragma once diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index f596bd0..848e945 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -1,110 +1,131 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. -#if !defined(CPPRX_RX_HPP) -#define CPPRX_RX_HPP #pragma once +#include "rx-includes.hpp" -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "rx-util.hpp" -#include "rx-base.hpp" -#include "rx-scheduler.h" -#include "rx-windows.hpp" -#include "rx-operators.hpp" +#if !defined(CPPRX_RX_HPP) +#define CPPRX_RX_HPP namespace rxcpp { - template + template class Binder { Obj obj; + static T defaultValueSelector(T t){return std::move(t);} public: Binder(Obj obj) : obj(std::move(obj)) { } template - auto select(S selector) -> decltype(from(Select(obj, selector))) { - return from(Select(obj, selector)); + auto select(S selector) -> decltype(from(Select(obj, selector))) { + return from(Select(obj, selector)); } template - auto where(P predicate) -> decltype(from(Where(obj, predicate))) { - return from(Where(obj, predicate)); + auto where(P predicate) -> decltype(from(Where(obj, predicate))) { + return from(Where(obj, predicate)); + } + Obj publish() { + return obj; + } + template + auto group_by( + KS keySelector) + -> decltype(from(GroupBy(obj, keySelector, defaultValueSelector, std::less()))) { + return from(GroupBy(obj, keySelector, defaultValueSelector, std::less())); + } + template + auto group_by( + KS keySelector, + VS valueSelector) + -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { + return from(GroupBy(obj, keySelector, valueSelector, std::less())); + } + template + auto group_by( + KS keySelector, + VS valueSelector, + L less) + -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { + return from(GroupBy(obj, keySelector, valueSelector, less)); } template - auto take(Integral n) -> decltype(from(Take(obj, n))) { - return from(Take(obj, n)); + auto take(Integral n) -> decltype(from(Take(obj, n))) { + return from(Take(obj, n)); } - auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { - return from(Delay(obj, due)); + auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { + return from(Delay(obj, due)); } - auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { - return from(Delay(obj, due, scheduler)); + auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { + return from(Delay(obj, due, scheduler)); } - auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { - return from(LimitWindow(obj, milliseconds)); + auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { + return from(LimitWindow(obj, milliseconds)); } - auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { - return from(DistinctUntilChanged(obj)); + auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { + return from(DistinctUntilChanged(obj)); } auto subscribe_on(Scheduler::shared scheduler) - -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) + -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) { - return from(SubscribeOnObservable(obj, std::move(scheduler))); + return from(SubscribeOnObservable(obj, std::move(scheduler))); } auto observe_on(Scheduler::shared scheduler) - -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) + -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) { - return from(ObserveOnObserver(obj, std::move(scheduler))); + return from(ObserveOnObserver(obj, std::move(scheduler))); } auto on_dispatcher() - -> decltype(from(ObserveOnDispatcher(obj))) + -> decltype(from(ObserveOnDispatcher(obj))) { - return from(ObserveOnDispatcher(obj)); + return from(ObserveOnDispatcher(obj)); + } + template + void for_each(OnNext onNext) { + ForEach(obj, onNext); } template - auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - auto result = Subscribe(obj, onNext); + auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { + auto result = Subscribe(obj, onNext); return result; } template - auto subscribe(OnNext onNext, OnComplete onComplete) -> decltype(Subscribe(obj, onNext, onComplete)) { - auto result = Subscribe(obj, onNext, onComplete); + auto subscribe(OnNext onNext, OnComplete onComplete) + -> decltype(Subscribe(obj, onNext, onComplete)) { + auto result = Subscribe(obj, onNext, onComplete); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) - -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - auto result = Subscribe(obj, onNext, onComplete, onError); + -> decltype(Subscribe(obj, onNext, onComplete, onError)) { + auto result = Subscribe(obj, onNext, onComplete, onError); return result; } }; - template - Binder::type> from(Obj&& obj) { - return Binder::type>(std::forward(obj)); } -} + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } + + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } -#pragma pop_macro("min") -#pragma pop_macro("max") + template + Binder from(Binder binder) { + return std::move(binder); } + + template + T item(const Binder>>&); + + template + T item(const Binder>>&); + + template + T item(const std::shared_ptr>&); + + template + T item(const std::shared_ptr>&); +} #endif diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index f09f0d9..01f08c8 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -7,6 +7,7 @@ #include "cpplinq/linq.hpp" #include +#include #include #include #include @@ -37,7 +38,6 @@ std::shared_ptr> Data( ); string extract_value(const string& input, const string& key); - void run() { using namespace cpplinq; @@ -54,101 +54,85 @@ void run() } }; - cout << "data >input ^parse and >(); - { - std::exception_ptr error; - std::condition_variable cv; - - std::mutex coutLock; - int inID = 0; - int parseID = 0; - int outID = 0; - - auto dataLines = Data( - "data.txt" -// , std::make_shared() - ); - auto input = std::make_shared(); - auto parsing = std::make_shared(); - auto output = std::make_shared(); - auto exp = rxcpp::from(dataLines) - .subscribe_on(input) - .select([&coutLock, &inID](const string& line) { - { - std::unique_lock guard(coutLock); - if (inID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '>' << std::flush; - } - return line; }) - .observe_on(parsing) - .select([&coutLock, &parseID](const string& line) { - { - std::unique_lock guard(coutLock); - if (parseID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '^' << std::flush; - } - return item(line); }) - .observe_on(output) -// .delay(std::chrono::milliseconds(10), output) - .subscribe( - [=, &coutLock, &outID](const item& i){ - { - std::unique_lock guard(coutLock); - if (outID++ == 0) std::cout << std::this_thread::get_id(); - std::cout << '<' << std::flush; - } - shared_data_parsed->push_back(i); }, - [&cv](){ - cv.notify_one();}, - [&cv, &error](const std::exception_ptr& e){ - error = e; cv.notify_one();}); - - std::mutex doneLock; - std::unique_lock guard(doneLock); - cv.wait(guard); - if (error != std::exception_ptr()) {std::rethrow_exception(error);} - cout << endl << "data loaded" << endl; - } - - auto data_parsed = shared_data_parsed.get(); - 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; - } - } + auto input = std::make_shared(); + auto output = std::make_shared(); + + auto dataLines = Data("data.txt"); + + int arggroupcount = 0; + + rxcpp::from(dataLines) + .subscribe_on(input) + // parse input into items + .select([](const string& line) { + return item(line);} + ) + // group items by args field + .group_by([](const item& i) { + return i.args;} + ) + .select([=](const std::shared_ptr> & gob){ + return std::make_pair( + gob->Key(), // keep args key + rxcpp::from(gob) + // group items by concurrency field + .group_by([](const item& i){ + return i.concurrency;} + ) + // select only the times field + .select([=] (const std::shared_ptr> & gob){ + return std::make_pair( + gob->Key(), // keep concurrency key + rxcpp::from(gob) + .select([](const item& i){ + return i.time;} + ) + .publish());} + ) + .publish());} + ) + .observe_on(output) + // print the grouped results + // for_each the args to block until the nested subscribes have finished + .for_each([&](const std::pair, std::shared_ptr > > > > >& ob){ + auto argsstate = std::make_shared>(false, ob.first, arggroupcount++); + rxcpp::from(ob.second) + // subscribe the concurrencies within each args + .subscribe([=](const std::pair > >& ob){ + auto linestate = std::make_shared>>(ob.first, std::vector()); + rxcpp::from(ob.second) + // subscribe the times within each concurrency + .subscribe([=](const double& i){ + // collect the times + linestate->second.push_back(i); + },[=]{ + // this concurrency's times are complete + // output a line to the console. + + if (!std::get<0>(*argsstate)) + { + std::get<0>(*argsstate) = true; + cout<<"arguments: "<(*argsstate)<first << ", "; + + auto n = from(linestate->second).count(); + auto sum = std::accumulate(linestate->second.begin(), linestate->second.end(), 0.0); + + cout << (sum / n) << ", |"; + + for (auto timeIter = linestate->second.begin(), end = linestate->second.end(); + timeIter != end; + ++timeIter) + { + cout << ", " << *timeIter; + } + cout << endl; + }); + }); + }); } int main(int argc, char* argv[]) -- GitLab From e786ae6cfda6021e88a05182023aea6c62affe4c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 8 Mar 2013 14:42:37 -0800 Subject: [PATCH 028/782] added select_many, traits and ADL chain also fix threading bugs and improve operator syntax and fixes for bugs found on windows --- Ix/CPP/src/IxCpp.vcxproj | 65 ++++++++++ Ix/CPP/src/IxCpp.vcxproj.filters | 55 +++++++++ Rx/CPP/src/RxCpp.vcxproj | 61 ++++++++++ Rx/CPP/src/RxCpp.vcxproj.filters | 43 +++++++ Rx/CPP/src/cpprx/rx-base.hpp | 37 ++++-- Rx/CPP/src/cpprx/rx-includes.hpp | 27 +++++ Rx/CPP/src/cpprx/rx-operators.hpp | 194 +++++++++++++++++++++++++++--- Rx/CPP/src/cpprx/rx-scheduler.hpp | 4 +- Rx/CPP/src/cpprx/rx-windows.hpp | 165 ++++++++++++++++++++----- Rx/CPP/src/cpprx/rx.hpp | 188 +++++++++++++++++++++-------- 10 files changed, 722 insertions(+), 117 deletions(-) create mode 100644 Ix/CPP/src/IxCpp.vcxproj create mode 100644 Ix/CPP/src/IxCpp.vcxproj.filters create mode 100644 Rx/CPP/src/RxCpp.vcxproj create mode 100644 Rx/CPP/src/RxCpp.vcxproj.filters diff --git a/Ix/CPP/src/IxCpp.vcxproj b/Ix/CPP/src/IxCpp.vcxproj new file mode 100644 index 0000000..9367080 --- /dev/null +++ b/Ix/CPP/src/IxCpp.vcxproj @@ -0,0 +1,65 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {65483A0D-1D72-47CC-B147-27415FFC1FC3} + MakeFileProj + + + + Makefile + true + v110 + + + Makefile + false + v110 + + + + + + + + + + + + + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + + + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ix/CPP/src/IxCpp.vcxproj.filters b/Ix/CPP/src/IxCpp.vcxproj.filters new file mode 100644 index 0000000..dd7d5bc --- /dev/null +++ b/Ix/CPP/src/IxCpp.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Rx/CPP/src/RxCpp.vcxproj b/Rx/CPP/src/RxCpp.vcxproj new file mode 100644 index 0000000..7a7398f --- /dev/null +++ b/Rx/CPP/src/RxCpp.vcxproj @@ -0,0 +1,61 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A912FB36-33A7-4DDA-A7D6-D17F9495A623} + MakeFileProj + + + + Makefile + true + v110 + + + Makefile + false + v110 + + + + + + + + + + + + + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + + + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Rx/CPP/src/RxCpp.vcxproj.filters b/Rx/CPP/src/RxCpp.vcxproj.filters new file mode 100644 index 0000000..2ce3d34 --- /dev/null +++ b/Rx/CPP/src/RxCpp.vcxproj.filters @@ -0,0 +1,43 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index e5af503..6182d0c 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -261,25 +261,13 @@ namespace rxcpp LocalScheduler(const LocalScheduler&); public: - static void DoNoThrow(Work& work, Scheduler::shared scheduler) throw() + static void Do(Work& work, Scheduler::shared scheduler) throw() { if (work) { work(std::move(scheduler)); } } - static void Do(Work& work, Scheduler::shared scheduler) - { - try { - DoNoThrow(work, std::move(scheduler)); - } catch (const std::exception& ) { - // work must catch all expected exceptions - std::unexpected(); - } catch (...) { - // work must catch all expected exceptions - std::unexpected(); - } - } public: LocalScheduler() @@ -305,5 +293,28 @@ namespace rxcpp } }; + template + T item(const std::shared_ptr>&); + + template + T item(const std::shared_ptr>&); + + template + struct is_observable {static const bool value = false;}; + + template + struct is_observable>> {static const bool value = true;}; + + template + struct is_observable>> {static const bool value = true;}; + + template + struct observable_item; + + template + struct observable_item>> {typedef T type;}; + + template + struct observable_item>> {typedef T type;}; } #endif diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index d5be690..e0574aa 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -26,6 +26,33 @@ #include #include +// some configuration macros +#if defined(_MSC_VER) + +#if _MSC_VER > 1600 +#define RXCPP_USE_RVALUEREF 1 +#define RXCPP_USE_VARIADIC_TEMPLATES 0 +#endif + +#if _CPPRTTI +#define RXCPP_USE_RTTI 1 +#endif + +#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 + +#endif + + #include "rx-util.hpp" #include "rx-base.hpp" #include "rx-scheduler.hpp" diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index cfd100d..29b489f 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -120,10 +120,12 @@ namespace rxcpp public std::enable_shared_from_this { protected: + std::mutex lock; std::vector>> observers; void RemoveObserver(std::shared_ptr> toRemove) { + std::unique_lock guard(lock); auto it = std::find(begin(observers), end(observers), toRemove); if (it != end(observers)) *it = nullptr; @@ -142,14 +144,17 @@ namespace rxcpp } }); - for(auto& o : observers) { - if (!o){ - o = std::move(observer); - return d; + std::unique_lock guard(lock); + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } } + observers.push_back(std::move(observer)); } - observers.push_back(std::move(observer)); return d; } }; @@ -166,37 +171,45 @@ namespace rxcpp virtual void OnNext(const T& element) { - for(auto& o : Base::observers) + std::unique_lock guard(Base::lock); + auto local = Base::observers; + guard.unlock(); + for(auto& o : local) { try { - if (o) + if (o) { o->OnNext(element); + } } catch (...) { - auto o_ = std::move(o); - o_->OnError(std::current_exception()); + o->OnError(std::current_exception()); + Base::RemoveObserver(o); } } } virtual void OnCompleted() { - for(auto& o : Base::observers) + std::unique_lock guard(Base::lock); + auto local = std::move(Base::observers); + guard.unlock(); + for(auto& o : local) { if (o) { o->OnCompleted(); - o = nullptr; } } } virtual void OnError(const std::exception_ptr& error) { - for(auto& o : Base::observers) + std::unique_lock guard(Base::lock); + auto local = std::move(Base::observers); + guard.unlock(); + for(auto& o : local) { if (o) { o->OnError(error); - o = nullptr; } } } @@ -317,15 +330,16 @@ namespace rxcpp // // imperative functions - template + template Disposable Subscribe( - const std::shared_ptr>& source, - typename util::identity>::type onNext, + const S& source, + typename util::identity::type&)>>::type onNext, std::function onCompleted = nullptr, std::function onError = nullptr ) { - auto observer = CreateObserver(std::move(onNext), std::move(onCompleted), std::move(onError)); + auto observer = CreateObserver::type>( + std::move(onNext), std::move(onCompleted), std::move(onError)); return source->Subscribe(observer); } @@ -376,7 +390,7 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) { - return Subscribe( + return Subscribe( source, // on next [=](const T& element) @@ -396,6 +410,146 @@ namespace rxcpp }); }); } + + template + struct reveal_type {private: reveal_type();}; + + template + auto SelectMany( + const std::shared_ptr>& source, + CS collectionSelector, + RS resultSelector) + -> const std::shared_ptr::type>::type&)>::type>> + { + typedef typename std::result_of::type C; + typedef typename observable_item::type CI; + typedef typename std::result_of::type U; + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + size_t subscribed; + bool cancel; + std::mutex lock; + }; + auto state = std::make_shared(); + state->cancel = false; + state->subscribed = 0; + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + std::unique_lock guard(state->lock); + state->cancel = true; }) + ); + + ++state->subscribed; + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + if (!cancel) ++state->subscribed; + } + if (!cancel) { + try { + auto collection = collectionSelector(element); + cd.Add(Subscribe( + collection, + // on next + [=](const CI& element) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + try { + if (!cancel) { + auto result = resultSelector(element); + observer->OnNext(std::move(result)); + } + } catch (...) { + observer->OnError(std::current_exception()); + cd.Dispose(); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + cd.Dispose(); + })); + } catch (...) { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + } + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + })); + return cd; + }); + } template const std::shared_ptr> Where( @@ -577,9 +731,8 @@ namespace rxcpp std::shared_ptr> Delay( const std::shared_ptr>& source, Scheduler::clock::duration due, - Scheduler::shared scheduler = nullptr) + Scheduler::shared scheduler) { - if (!scheduler) {scheduler = std::make_shared();} return CreateObservable( [=](std::shared_ptr> observer) -> Disposable @@ -685,6 +838,7 @@ namespace rxcpp -> Disposable { struct State { + State() : last(), hasValue(false) {} T last; bool hasValue; }; diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 5fcef15..037e41e 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -103,6 +103,7 @@ namespace rxcpp virtual Disposable Schedule(clock::time_point dueTime, Work work) { auto ct = std::make_shared(); + std::this_thread::sleep_until(dueTime); Do(work, ct); return Disposable::Empty(); } @@ -183,7 +184,8 @@ namespace rxcpp if (++trampoline == 1) { auto local = shared_from_this(); - result.set(factory([local]{local->Run();})); + result.set(factory([local]{ + local->Run();})); // trampoline lifetime is now owned by the thread unwindTrampoline.dismiss(); } diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 72e636f..31b932b 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -93,78 +93,181 @@ namespace rxcpp { namespace win32 { class WindowScheduler : public rxcpp::LocalScheduler { - HWND hwnd; - Scheduler::shared ct; + + struct compare_work + { + template + bool operator()(const T& work1, const T& work2) const { + return work1.first > work2.first; + } + }; + + struct Queue; + typedef std::pair Item; + typedef std::priority_queue< + std::pair>, + std::vector>>, + compare_work + > ScheduledWork; + + struct Queue + { + Queue() : exit(false), window(NULL) {} + bool exit; + HWND window; + ScheduledWork scheduledWork; + mutable std::mutex lock; + }; + struct WindowClass { + std::shared_ptr queue; + static const wchar_t* const className(){ return L"rxcpp::win32::WindowScheduler::WindowClass"; } WindowClass() { - WNDCLASS wndclass = {}; + } + + static void Create(const std::shared_ptr& queue) + { + WNDCLASSW wndclass = {}; wndclass.style = 0; wndclass.lpfnWndProc = &WndProc; - wndclass.cbClsExtra; wndclass.cbWndExtra = 0; wndclass.hInstance = NULL; wndclass.lpszClassName = className(); - if (!RegisterClass(&wndclass)) + if (!RegisterClassW(&wndclass)) throw std::exception("failed to register windows class"); + std::unique_ptr that(new WindowClass); + that->queue = queue; + + queue->window = CreateWindowExW(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, reinterpret_cast(that.get())); + if (!queue->window) + throw std::exception("create window failed"); + + that.release(); } - HWND CreateWindow_() - { - return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); - } + static const int WM_USER_DISPATCH = WM_USER + 1; static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { + static WindowClass* windowClass; switch (message) { - // TODO: shatter attack surface. should validate the message, e.g. using a handle table. + case WM_NCCREATE: + { + windowClass = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); + } + break; + case WM_NCDESTROY: + { + delete windowClass; + windowClass = nullptr; + } + break; + case WM_TIMER: case WM_USER_DISPATCH: - ((void(*)(void*))wParam)((void*)lParam); + { + bool destroy = false; + HWND window = NULL; + { + std::unique_lock guard(windowClass->queue->lock); + + while (!windowClass->queue->scheduledWork.empty() && !windowClass->queue->scheduledWork.top().second.get()->second) + { + // discard the disposed items + windowClass->queue->scheduledWork.pop(); + } + + if (!windowClass->queue->scheduledWork.empty()) + { + auto& item = windowClass->queue->scheduledWork.top(); + auto now = item.second.get()->first->Now(); + + // wait until the work is due + if(now < item.first) + { + auto remaining = std::chrono::duration_cast(item.first - now).count(); + if (remaining >= USER_TIMER_MINIMUM) + { + return SetTimer(hwnd, 0, static_cast(remaining), nullptr); + } + std::this_thread::sleep_until(item.first); + } + + // dispatch work + auto work = std::move(item.second.get()->second); + auto scheduler = std::move(item.second.get()->first); + windowClass->queue->scheduledWork.pop(); + + { + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, scheduler); + work = nullptr; + scheduler = nullptr; + } + + if (!windowClass->queue->scheduledWork.empty()) + { + ::PostMessageW(windowClass->queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); + } + } + + destroy = windowClass->queue->exit && windowClass->queue->scheduledWork.empty(); + window = windowClass->queue->window; + } + + if (destroy) + { + DestroyWindow(window); + } + } return 0; default: - return DefWindowProc(hwnd, message, wParam, lParam); + break; } - } - static WindowClass& Instance() { - static WindowClass instance; - return instance; + return DefWindowProcW(hwnd, message, wParam, lParam); } }; - static void run_proc( - void* pvfn - ) - { - std::unique_ptr f((Item*)(void*) pvfn); - Do(f->second, f->first); - } + std::shared_ptr queue; public: WindowScheduler() - : hwnd(WindowClass::Instance().CreateWindow_()) - , ct(std::make_shared()) + : queue(std::make_shared()) { - if (!hwnd) - throw std::exception("create window failed"); + WindowClass::Create(queue); } ~WindowScheduler() { // send one last message to ourselves to shutdown. - Schedule([=](Scheduler::shared){ CloseWindow(hwnd); return Disposable::Empty();}); + { + std::unique_lock guard(queue->lock); + queue->exit = true; + } + ::PostMessageW(queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); } using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { - std::unique_ptr f(new Item(ct, std::move(work))); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); - return Disposable::Empty(); + auto cancelable = std::make_shared(std::make_pair(get(), std::move(work))); + { + std::unique_lock guard(queue->lock); + queue->scheduledWork.push(std::make_pair(dueTime, cancelable)); + } + ::PostMessageW(queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); + auto local = queue; + return Disposable([local, cancelable]{ + std::unique_lock guard(local->lock); + cancelable.get()->second = nullptr; + ::PostMessageW(local->window, WindowClass::WM_USER_DISPATCH, 0, 0); + }); } }; } } diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 848e945..b5a75cb 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -7,23 +7,101 @@ #define CPPRX_RX_HPP namespace rxcpp -{ +{ template - class Binder + class BinderBase { + protected: Obj obj; - static T defaultValueSelector(T t){return std::move(t);} + + struct pass_through { + template + X operator()(X x) const {return std::move(x);} + }; + public: + typedef T item_type; + typedef Obj observable_type; + + BinderBase(Obj obj) : obj(std::move(obj)) + { + } + }; + + template + class BinderNested; + + template + class BinderNested : public BinderBase + { + protected: + typedef BinderBase base; + typedef typename base::item_type item_type; + typedef typename base::pass_through pass_through; + using base::obj; public: - Binder(Obj obj) : obj(std::move(obj)) + static const bool is_item_observable = false; + BinderNested(Obj obj) : BinderBase(std::move(obj)) { } + }; + + template + class BinderNested : public BinderBase + { + protected: + typedef BinderBase base; + typedef typename base::item_type item_type; + typedef typename base::pass_through pass_through; + using base::obj; + public: + static const bool is_item_observable = true; + + BinderNested(Obj obj) : base(std::move(obj)) + { + } + + auto select_many() + -> decltype(from(SelectMany(obj, pass_through(), pass_through()))) { + return from(SelectMany(obj, pass_through(), pass_through())); + } + template + auto select_many(CS collectionSelector) + -> decltype(from(SelectMany(obj, std::move(collectionSelector), pass_through()))) { + return from(SelectMany(obj, std::move(collectionSelector), pass_through())); + } + template + auto select_many(CS collectionSelector, RS resultSelector) + -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { + return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); + } + }; + + template + class Binder : public BinderNested< + typename observable_item::type, + Obj, + is_observable::type>::value> + { + typedef BinderNested< + typename observable_item::type, + Obj, + is_observable::type>::value> base; + typedef typename base::item_type item_type; + typedef typename base::pass_through pass_through; + using base::obj; + public: + + Binder(Obj obj) : base(std::move(obj)) + { + } + template - auto select(S selector) -> decltype(from(Select(obj, selector))) { - return from(Select(obj, selector)); + auto select(S selector) -> decltype(from(Select(obj, selector))) { + return from(Select(obj, selector)); } template - auto where(P predicate) -> decltype(from(Where(obj, predicate))) { - return from(Where(obj, predicate)); + auto where(P predicate) -> decltype(from(Where(obj, predicate))) { + return from(Where(obj, predicate)); } Obj publish() { return obj; @@ -31,101 +109,107 @@ namespace rxcpp template auto group_by( KS keySelector) - -> decltype(from(GroupBy(obj, keySelector, defaultValueSelector, std::less()))) { - return from(GroupBy(obj, keySelector, defaultValueSelector, std::less())); + -> decltype(from(GroupBy(obj, keySelector, pass_through(), std::less()))) { + return from(GroupBy(obj, keySelector, pass_through(), std::less())); } template auto group_by( KS keySelector, VS valueSelector) - -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { - return from(GroupBy(obj, keySelector, valueSelector, std::less())); + -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { + return from(GroupBy(obj, keySelector, valueSelector, std::less())); } template auto group_by( KS keySelector, VS valueSelector, L less) - -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { - return from(GroupBy(obj, keySelector, valueSelector, less)); + -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { + return from(GroupBy(obj, keySelector, valueSelector, less)); } template - auto take(Integral n) -> decltype(from(Take(obj, n))) { - return from(Take(obj, n)); + auto take(Integral n) -> decltype(from(Take(obj, n))) { + return from(Take(obj, n)); } - auto delay(Scheduler::clock::duration due) -> decltype(from(Delay(obj, due))) { - return from(Delay(obj, due)); + auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { + return from(Delay(obj, due, scheduler)); } - auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { - return from(Delay(obj, due, scheduler)); + auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { + return from(LimitWindow(obj, milliseconds)); } - auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { - return from(LimitWindow(obj, milliseconds)); - } - auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { - return from(DistinctUntilChanged(obj)); + auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { + return from(DistinctUntilChanged(obj)); } auto subscribe_on(Scheduler::shared scheduler) - -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) + -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) { - return from(SubscribeOnObservable(obj, std::move(scheduler))); + return from(SubscribeOnObservable(obj, std::move(scheduler))); } auto observe_on(Scheduler::shared scheduler) - -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) + -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) { - return from(ObserveOnObserver(obj, std::move(scheduler))); + return from(ObserveOnObserver(obj, std::move(scheduler))); } auto on_dispatcher() - -> decltype(from(ObserveOnDispatcher(obj))) + -> decltype(from(ObserveOnDispatcher(obj))) { - return from(ObserveOnDispatcher(obj)); + return from(ObserveOnDispatcher(obj)); } template void for_each(OnNext onNext) { - ForEach(obj, onNext); + ForEach(obj, onNext); } template - auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - auto result = Subscribe(obj, onNext); + auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { + auto result = Subscribe(obj, onNext); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete) - -> decltype(Subscribe(obj, onNext, onComplete)) { - auto result = Subscribe(obj, onNext, onComplete); + -> decltype(Subscribe(obj, onNext, onComplete)) { + auto result = Subscribe(obj, onNext, onComplete); return result; } template auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) - -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - auto result = Subscribe(obj, onNext, onComplete, onError); + -> decltype(Subscribe(obj, onNext, onComplete, onError)) { + auto result = Subscribe(obj, onNext, onComplete, onError); return result; } +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto chain(Arg&& ...arg) + -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)...))) { + return from(rxcpp_chain(Tag(), obj, std::forward(arg)...)); + } +#endif }; template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } - - template - Binder from(Binder binder) { - return std::move(binder); } + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } template - T item(const Binder>>&); + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } + + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } - template - T item(const Binder>>&); + template + Binder from(Binder binder) { + return std::move(binder); } template - T item(const std::shared_ptr>&); + T item(const Binder>>&); - template - T item(const std::shared_ptr>&); + template + T item(const Binder>>&); } #endif -- GitLab From c401e4c4d61da2c75ef6f28d43b7848ecf708267 Mon Sep 17 00:00:00 2001 From: malayeri Date: Fri, 22 Mar 2013 22:58:05 -0700 Subject: [PATCH 029/782] Merge remote-tracking branch 'codeplex/master' into codeplex -- GitLab From 61c8ef9f314f6e83f2c07f1145852e210a83e1e3 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 23 Mar 2013 00:44:56 -0700 Subject: [PATCH 030/782] Add zip, combine_latest and merge - rewrite schedulers --- Rx/CPP/src/cpprx/rx-operators.hpp | 414 +++++++++++++++++++++--- Rx/CPP/src/cpprx/rx-scheduler.hpp | 521 ++++++++++++++++++------------ Rx/CPP/src/cpprx/rx-util.hpp | 56 ++++ Rx/CPP/src/cpprx/rx-windows.hpp | 2 + Rx/CPP/src/cpprx/rx.hpp | 52 ++- Rx/CPP/testbench/testbench.cpp | 188 ++++++++++- 6 files changed, 979 insertions(+), 254 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 29b489f..a2e8b3c 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -28,7 +28,7 @@ namespace rxcpp if (CurrentThreadScheduler::IsScheduleRequired()) { auto scheduler = std::make_shared(); return scheduler->Schedule( - [=](Scheduler::shared){ + [=](Scheduler::shared) -> Disposable { try { return subscribe(observer); } catch (...) { @@ -60,6 +60,10 @@ namespace rxcpp std::function onCompleted; std::function onError; + virtual ~CreatedObserver() { + clear(); + } + virtual void OnNext(const T& element) { try @@ -122,6 +126,16 @@ namespace rxcpp protected: std::mutex lock; std::vector>> observers; + + virtual ~ObservableSubject() { + // putting this first means that the observers + // will be destructed outside the lock + std::vector>> empty; + + std::unique_lock guard(lock); + using std::swap; + swap(observers, empty); + } void RemoveObserver(std::shared_ptr> toRemove) { @@ -161,6 +175,7 @@ namespace rxcpp template class ObserverSubject : + public Observer, public Base { public: @@ -411,9 +426,6 @@ namespace rxcpp }); } - template - struct reveal_type {private: reveal_type();}; - template auto SelectMany( const std::shared_ptr>& source, @@ -551,6 +563,332 @@ namespace rxcpp }); } +#if RXCPP_USE_VARIADIC_TEMPLATES + namespace detail{ + template + struct CombineLatestSubscriber { + typedef typename SubscribeState::Latest Latest; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const typename std::tuple_element::type& element) + { + static bool pending = true; + auto local = state; + std::unique_lock guard(local->lock); + std::get(local->latest) = element; + if (pending) { + --local->pendingFirst; + pending = false; + } + if (local->pendingFirst == 0) { + Latest args = local->latest; + auto result = util::tuple_dispatch(local->selector, args); + ++state->pendingIssue; + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(result)); + } + --state->pendingIssue; + if (state->done && state->pendingIssue == 0) { + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on completed + [=] + { + std::unique_lock guard(state->lock); + --state->pendingComplete; + if (state->pendingComplete == 0) { + state->done = true; + if (state->pendingIssue == 0) { + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + CombineLatestSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct CombineLatestSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } + template + auto CombineLatest( + S selector, + const std::shared_ptr>&... source + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>...> Sources; + typedef std::tuple Latest; + struct State { + typedef Latest Latest; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : pendingFirst(SourcesSize::value) + , pendingIssue(0) + , pendingComplete(SourcesSize::value) + , done(false) + , selector(std::move(selector)) + {} + std::mutex lock; + size_t pendingFirst; + size_t pendingIssue; + size_t pendingComplete; + bool done; + S selector; + Latest latest; + }; + Sources sources(source...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } + + namespace detail{ + template + struct ZipSubscriber { + typedef typename std::tuple_element::type::value_type Item; + typedef std::shared_ptr> ResultObserver; + struct Next + { + std::unique_lock& guard; + std::shared_ptr state; + const ResultObserver& observer; + const ComposableDisposable& cd; + explicit Next( + std::unique_lock& guard, + std::shared_ptr state, + const ResultObserver& observer, + const ComposableDisposable& cd) + : guard(guard) + , state(std::move(state)) + , observer(observer) + , cd(cd) { + } + template + void operator()(ZipQueue&... queue) { + // build array of bool that we can iterate to detect empty queues + bool empties[] = {queue.empty()...}; + if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { + // all queues have an item. + // + // copy front of each queue + auto args = std::make_tuple(queue.front()...); + + // cause side-effect of pop on each queue + std::make_tuple((queue.pop(), true)...); + + ++state->pending; + auto result = util::tuple_dispatch(state->selector, args); + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(result)); + } + --state->pending; + } + // build new array to check for any empty queue + bool post_empties[] = {queue.empty()...}; + if (state->completed && state->pending == 0 && + std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + // at least one queue is empty and at least one of the sources has completed. + // it is time to stop. + + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } + }; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const Item& element) + { + std::unique_lock guard(state->lock); + std::get(state->queues).push(element); + Next next(guard, state, observer, cd); + util::tuple_dispatch(next, state->queues); + }, + // on completed + [=] + { + std::unique_lock guard(state->lock); + state->completed = true; + Next next(guard, state, observer, cd); + util::tuple_dispatch(next, state->queues); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + ZipSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct ZipSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } + template + auto Zip( + S selector, + const std::shared_ptr>&... source + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>...> Sources; + typedef std::tuple>>...> Queues; + struct State { + typedef Queues Queues; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : selector(std::move(selector)) + , pending(0) + , completed(false) + {} + std::mutex lock; + S selector; + size_t pending; + bool completed; + Queues queues; + }; + Sources sources(source...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } + + namespace detail{ + template + struct MergeSubscriber { + typedef typename SubscribeState::result_type Item; + typedef std::shared_ptr> ResultObserver; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const Item& element) + { + observer->OnNext(element); + }, + // on completed + [=] + { + if (--state->pendingComplete == 0) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + MergeSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct MergeSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } + template + std::shared_ptr> Merge( + const std::shared_ptr>& firstSource, + const std::shared_ptr>&... otherSource + ) + { + typedef MergeSource result_type; + typedef decltype(std::make_tuple(firstSource, otherSource...)) Sources; + struct State { + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + State() + : pendingComplete(SourcesSize::value) + {} + std::atomic pendingComplete; + }; + Sources sources(firstSource, otherSource...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES + template const std::shared_ptr> Where( const std::shared_ptr>& source, @@ -683,7 +1021,8 @@ namespace rxcpp [=](std::shared_ptr> observer) -> Disposable { - auto remaining = std::make_shared(n); + // keep count of remaining calls received OnNext and count of OnNext calls issued. + auto remaining = std::make_shared, std::atomic>>(n, n); ComposableDisposable cd; @@ -692,30 +1031,33 @@ namespace rxcpp // on next [=](const T& element) { - if (*remaining) - { + auto local = --std::get<0>(*remaining); + RXCPP_UNWIND_AUTO([&](){ + if (local >= 0){ + // all elements received + if (--std::get<1>(*remaining) == 0) { + // all elements passed on to observer. + observer->OnCompleted(); + cd.Dispose();}}}); + + if (local >= 0) { observer->OnNext(element); - if (--*remaining == 0) - { - observer->OnCompleted(); - cd.Dispose(); - } - } + } }, // on completed [=] { - if (*remaining) - { + if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { observer->OnCompleted(); + cd.Dispose(); } }, // on error [=](const std::exception_ptr& error) { - if (*remaining) - { + if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { observer->OnError(error); + cd.Dispose(); } })); return cd; @@ -898,53 +1240,35 @@ namespace rxcpp Scheduler::shared scheduler) { return CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observerArg) -> Disposable { - auto queue = std::make_shared(); - auto queueScheduler = queue->GetScheduler(); - + std::shared_ptr> observer( + new ScheduledObserver(scheduler, std::move(observerArg))); ComposableDisposable cd; - cd.Add(Disposable([=]{ - queue->Dispose(); - })); - - SharedDisposable sd; - cd.Add(sd); + cd.Add(*observer.get()); cd.Add(Subscribe( source, // on next [=](const T& element) { - sd.Set(queueScheduler->Schedule([=](Scheduler::shared){ - observer->OnNext(element); - return Disposable::Empty(); - })); - queue->RunOnScheduler(scheduler); + observer->OnNext(std::move(element)); + observer->EnsureActive(); }, // on completed [=] { - sd.Set(queueScheduler->Schedule( - [=](Scheduler::shared){ - observer->OnCompleted(); - return Disposable::Empty(); - } - )); - queue->RunOnScheduler(scheduler); + observer->OnCompleted(); + observer->EnsureActive(); }, // on error [=](const std::exception_ptr& error) { - queueScheduler->Schedule([=](Scheduler::shared){ - observer->OnError(error); - queue->Dispose(); - return Disposable::Empty(); - }); - queue->RunOnScheduler(scheduler); + observer->OnError(std::move(error)); + observer->EnsureActive(); })); return cd; }); diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 037e41e..7ecd850 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -13,27 +13,138 @@ namespace rxcpp // // schedulers - struct CurrentThreadScheduler : public LocalScheduler + struct CurrentThreadQueue { + typedef Scheduler::clock clock; + typedef Scheduler::Work Work; + struct QueueItem { + QueueItem(clock::time_point due, std::shared_ptr work) + : due(due) + , work(std::move(work)) + {} + clock::time_point due; + std::shared_ptr work; + }; + private: - CurrentThreadScheduler(const CurrentThreadScheduler&); + ~CurrentThreadQueue(); struct compare_work { - template - bool operator()(const T& work1, const T& work2) const { - return work1.first > work2.first; + bool operator()(const QueueItem& work1, const QueueItem& work2) const { + return work1.due > work2.due; } }; typedef std::priority_queue< - std::pair>, - std::vector>>, + QueueItem, + std::vector, compare_work > ScheduledWork; - RXCPP_THREAD_LOCAL static ScheduledWork* scheduledWork; + public: + struct ThreadLocalQueue { + Scheduler::shared scheduler; + ScheduledWork queue; + }; + + private: + RXCPP_THREAD_LOCAL static ThreadLocalQueue* threadLocalQueue; + + public: + + static Scheduler::shared GetScheduler() { + return !!threadLocalQueue ? threadLocalQueue->scheduler : Scheduler::shared(); + } + static bool empty() { + if (!threadLocalQueue) { + throw std::logic_error("this thread does not have a queue!"); + } + return threadLocalQueue->queue.empty(); + } + static ScheduledWork::const_reference top() { + if (!threadLocalQueue) { + throw std::logic_error("this thread does not have a queue!"); + } + return threadLocalQueue->queue.top(); + } + static void pop() { + if (!threadLocalQueue) { + throw std::logic_error("this thread does not have a queue!"); + } + threadLocalQueue->queue.pop(); + } + static void push(QueueItem item) { + if (!threadLocalQueue) { + throw std::logic_error("this thread does not have a queue!"); + } + threadLocalQueue->queue.push(std::move(item)); + } + static void EnsureQueue(Scheduler::shared scheduler) { + if (!!threadLocalQueue) { + throw std::logic_error("this thread already has a queue!"); + } + // create and publish new queue + threadLocalQueue = new ThreadLocalQueue(); + threadLocalQueue->scheduler = scheduler; + } + static std::unique_ptr CreateQueue(Scheduler::shared scheduler) { + std::unique_ptr result(new ThreadLocalQueue()); + result->scheduler = std::move(scheduler); + return result; + } + static void SetQueue(ThreadLocalQueue* queue) { + if (!!threadLocalQueue) { + throw std::logic_error("this thread already has a queue!"); + } + // create and publish new queue + threadLocalQueue = queue; + } + static void DestroyQueue(ThreadLocalQueue* queue) { + delete queue; + } + static void DestroyQueue() { + if (!threadLocalQueue) { + throw std::logic_error("this thread does not have a queue!"); + } + DestroyQueue(threadLocalQueue); + threadLocalQueue = nullptr; + } + }; + // static + RXCPP_SELECT_ANY RXCPP_THREAD_LOCAL CurrentThreadQueue::ThreadLocalQueue* CurrentThreadQueue::threadLocalQueue = nullptr; + + struct CurrentThreadScheduler : public LocalScheduler + { + private: + CurrentThreadScheduler(const CurrentThreadScheduler&); + + struct Derecurser : public LocalScheduler + { + private: + Derecurser(const Derecurser&); + public: + Derecurser() + { + } + virtual ~Derecurser() + { + } + + static bool IsScheduleRequired() { return false; } + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto cancelable = std::make_shared(std::move(work)); + + CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, cancelable)); + + return Disposable([cancelable]{ + *cancelable.get() = nullptr;}); + } + }; + public: CurrentThreadScheduler() { @@ -42,49 +153,50 @@ namespace rxcpp { } - static bool IsScheduleRequired() { return scheduledWork == nullptr; } + static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { - auto cancelable = std::make_shared(std::move(work)); - // check trampoline - if (!!scheduledWork) + auto localScheduler = CurrentThreadQueue::GetScheduler(); + // check ownership + if (!!localScheduler) { - scheduledWork->push(std::make_pair(dueTime, cancelable)); - return Disposable([=]{(*cancelable.get()) = nullptr;}); + // already has an owner - delegate + return localScheduler->Schedule(dueTime, std::move(work)); } - // create and publish new queue - scheduledWork = new ScheduledWork(); + // take ownership + + auto cancelable = std::make_shared(std::move(work)); + + CurrentThreadQueue::EnsureQueue(std::make_shared()); RXCPP_UNWIND_AUTO([]{ - delete scheduledWork; - scheduledWork = nullptr; + CurrentThreadQueue::DestroyQueue(); }); - scheduledWork->push(std::make_pair(dueTime, cancelable)); + CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); // loop until queue is empty for ( - auto dueTime = scheduledWork->top().first; + auto dueTime = CurrentThreadQueue::top().due; std::this_thread::sleep_until(dueTime), true; - dueTime = scheduledWork->top().first + dueTime = CurrentThreadQueue::top().due ) { // dispatch work - auto work = std::move(*scheduledWork->top().second.get()); - scheduledWork->pop(); + auto work = std::move(*CurrentThreadQueue::top().work.get()); + *CurrentThreadQueue::top().work.get() = nullptr; + CurrentThreadQueue::pop(); Do(work, get()); - - if (scheduledWork->empty()) {break;} + + if (CurrentThreadQueue::empty()) {break;} } return Disposable::Empty(); } }; - // static - RXCPP_SELECT_ANY RXCPP_THREAD_LOCAL CurrentThreadScheduler::ScheduledWork* CurrentThreadScheduler::scheduledWork = nullptr; struct ImmediateScheduler : public LocalScheduler { @@ -109,237 +221,248 @@ namespace rxcpp } }; - - class WorkQueue : public std::enable_shared_from_this + template + class ScheduledObserver : + public Observer, + public std::enable_shared_from_this> { - typedef LocalScheduler::Work Work; - typedef LocalScheduler::clock clock; - typedef std::pair Item; - typedef std::shared_ptr shared; + typedef std::function Action; - struct compare_work - { - template - bool operator()(const T& work1, const T& work2) const { - return work1.first > work2.first; - } - }; - + Scheduler::shared scheduler; + std::shared_ptr> observer; std::atomic trampoline; - std::priority_queue< - std::pair>, - std::vector>>, - compare_work > scheduledWork; + SharedDisposable sd; + mutable std::queue queue; mutable std::mutex lock; - mutable std::condition_variable wake; - mutable std::atomic exit; - - struct WorkQueueScheduler : public LocalScheduler - { - private: - WorkQueueScheduler(); - WorkQueueScheduler(const WorkQueueScheduler&); - - WorkQueue::shared queue; - - public: - WorkQueueScheduler(WorkQueue::shared queue) : queue(queue) - { - } - virtual ~WorkQueueScheduler() - { - } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto cancelable = std::make_shared(std::make_pair(get(), std::move(work))); - { - std::unique_lock guard(queue->lock); - queue->scheduledWork.push(std::make_pair(dueTime, cancelable)); - } - queue->wake.notify_one(); - auto local = queue; - return Disposable([local, cancelable]{ - std::unique_lock guard(local->lock); - cancelable.get()->second = nullptr;}); - } - }; public: - typedef std::function RunLoop; - typedef std::function Factory; - - WorkQueue() - : trampoline(0) - , exit(false) - { - } - - util::maybe EnsureThread(Factory& factory) + ScheduledObserver(Scheduler::shared scheduler, std::shared_ptr> observer) + : scheduler(std::move(scheduler)) + , observer(std::move(observer)) + , trampoline(0) { - util::maybe result; - std::unique_lock guard(lock); - RXCPP_UNWIND(unwindTrampoline, [&]{--trampoline;}); - if (++trampoline == 1) - { - auto local = shared_from_this(); - result.set(factory([local]{ - local->Run();})); - // trampoline lifetime is now owned by the thread - unwindTrampoline.dismiss(); - } - return result; } void Dispose() const { std::unique_lock guard(lock); - if (trampoline > 0) - { - exit = true; - wake.notify_one(); - } + while (!queue.empty()) {queue.pop();} + sd.Dispose(); } operator Disposable() const { - auto local = shared_from_this(); + auto local = this->shared_from_this(); return Disposable([local]{ local->Dispose(); }); } - Scheduler::shared GetScheduler() + + virtual void OnNext(const T& element) { - return std::make_shared(shared_from_this()); + std::unique_lock guard(lock); + auto local = this->shared_from_this(); + queue.push(Action([=](){ + local->observer->OnNext(std::move(element));})); } - void Run() + virtual void OnCompleted() { - auto keepAlive = shared_from_this(); - { - RXCPP_UNWIND_AUTO([&]{--trampoline;}); - - std::unique_lock guard(lock); - - while(!exit && !scheduledWork.empty()) - { - // wait until there is work - wake.wait(guard, [this]{ return this->exit || !this->scheduledWork.empty();}); - if (exit || scheduledWork.empty()) {break;} - - auto item = &scheduledWork.top(); - if (!item->second) {scheduledWork.pop(); continue;} - - // wait until the work is due - while (!exit && item->second && item->second.get()->first->Now() < item->first) - { - wake.wait_until(guard, item->first); - item = &scheduledWork.top(); - } - if (exit || scheduledWork.empty()) {break;} - if (!item->second) {scheduledWork.pop(); continue;} - - // dispatch work - auto work = std::move(item->second.get()->second); - auto scheduler = std::move(item->second.get()->first); - scheduledWork.pop(); - - RXCPP_UNWIND_AUTO([&]{guard.lock();}); - guard.unlock(); - LocalScheduler::Do(work, scheduler); - } - } - exit = false; + std::unique_lock guard(lock); + auto local = this->shared_from_this(); + queue.push(Action([=](){ + local->observer->OnCompleted();})); + } + virtual void OnError(const std::exception_ptr& error) + { + std::unique_lock guard(lock); + auto local = this->shared_from_this(); + queue.push(Action([=](){ + local->observer->OnError(std::move(error));})); } - Disposable RunOnScheduler(Scheduler::shared scheduler) + void EnsureActive() { RXCPP_UNWIND_AUTO([&]{--trampoline;}); if (++trampoline == 1) { // this is decremented when no further work is scheduled ++trampoline; - auto keepAlive = shared_from_this(); - return scheduler->Schedule( - [keepAlive, scheduler](Scheduler::shared){ - return keepAlive->RunOnSchedulerWork(scheduler);}); + auto keepAlive = this->shared_from_this(); + sd.Set(scheduler->Schedule( + [keepAlive](Scheduler::shared sched){ + return keepAlive->Run(sched);})); } - return Disposable::Empty(); } private: - Disposable RunOnSchedulerWork(Scheduler::shared scheduler) + Disposable Run(Scheduler::shared sched) { - auto keepAlive = shared_from_this(); + auto keepAlive = this->shared_from_this(); std::unique_lock guard(lock); - if(!exit && !scheduledWork.empty()) - { - auto& item = scheduledWork.top(); - - // wait until the work is due - if(!exit && item.second.get()->first->Now() < item.first) - { - return scheduler->Schedule( - item.first, - [keepAlive, scheduler](Scheduler::shared){ - return keepAlive->RunOnSchedulerWork(scheduler);}); - } + if(!queue.empty()) + { + auto& item = queue.front(); - if(!exit) - { - // dispatch work - auto work = std::move(item.second.get()->second); - auto scheduler = std::move(item.second.get()->first); - scheduledWork.pop(); + // dispatch action + auto action = std::move(item); + item = nullptr; + queue.pop(); - RXCPP_UNWIND_AUTO([&]{guard.lock();}); - guard.unlock(); - LocalScheduler::Do(work, scheduler); - } + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + action(); } - if(!exit && !scheduledWork.empty()) + if(!queue.empty()) { - return scheduler->Schedule( - [keepAlive, scheduler](Scheduler::shared){ - return keepAlive->RunOnSchedulerWork(scheduler);}); + guard.unlock(); + sd.Set(sched->Schedule( + [keepAlive](Scheduler::shared sched){ + return keepAlive->Run(sched);})); + return Disposable::Empty(); } // only decrement when no further work is scheduled --trampoline; - exit = false; return Disposable::Empty(); } }; - struct EventLoopScheduler : public LocalScheduler { private: EventLoopScheduler(const EventLoopScheduler&); + + struct Derecurser : public std::enable_shared_from_this + { + private: + Derecurser(const Derecurser&); + + std::atomic trampoline; + mutable std::mutex lock; + mutable std::condition_variable wake; + mutable std::atomic exit; + CurrentThreadQueue::ThreadLocalQueue* queue; + + public: + Derecurser() + : trampoline(0) + , exit(false) + { + } + virtual ~Derecurser() + { + } + + typedef std::function RunLoop; + typedef std::function Factory; + + static bool IsScheduleRequired() { return false; } - std::shared_ptr queue; - Scheduler::shared scheduler; + typedef std::tuple, Disposable> EnsureThreadResult; + EnsureThreadResult EnsureThread(Factory& factory, Scheduler::shared owner, clock::time_point dueTime, Work work) + { + EnsureThreadResult result(util::maybe(), Disposable::Empty()); + + auto cancelable = std::make_shared(std::move(work)); + + std::unique_lock guard(lock); + RXCPP_UNWIND(unwindTrampoline, [&]{--trampoline;}); + + if (++trampoline == 1) + { + RXCPP_UNWIND(unwindQueue, [&](){ + CurrentThreadQueue::DestroyQueue(queue); queue = nullptr;}); + queue = CurrentThreadQueue::CreateQueue(owner).release(); + + std::get<1>(result) = Disposable([cancelable]{ + *cancelable.get() = nullptr;}); + queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); + + auto local = std::static_pointer_cast(shared_from_this()); + auto localQueue = queue; + std::get<0>(result).set(factory([local, localQueue]{ + local->Run(localQueue);})); + + // trampoline and queue lifetime is now owned by the thread + unwindTrampoline.dismiss(); + unwindQueue.dismiss(); + } + else + { + std::get<1>(result) = Disposable([cancelable]{ + *cancelable.get() = nullptr;}); + queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); + wake.notify_one(); + } + return std::move(result); + } + + private: + void Run(CurrentThreadQueue::ThreadLocalQueue* queue) { + auto keepAlive = shared_from_this(); + { + RXCPP_UNWIND_AUTO([&]{--trampoline;}); + + std::unique_lock guard(lock); + + CurrentThreadQueue::SetQueue(queue); + RXCPP_UNWIND(unwindQueue, [&](){ + CurrentThreadQueue::DestroyQueue(); + queue = nullptr;}); + + while(!exit && (!CurrentThreadQueue::empty() || trampoline > 1)) + { + if (CurrentThreadQueue::empty()) { + wake.wait(guard, [&](){ + return exit || !CurrentThreadQueue::empty() || trampoline == 1;}); + continue; + } + + auto item = &CurrentThreadQueue::top(); + if (!item->work || !*item->work.get()) {CurrentThreadQueue::pop(); continue;} + + // wait until the work is due + if (!exit && queue->scheduler->Now() < item->due) + { + wake.wait_until(guard, item->due); + continue; + } + if (exit || CurrentThreadQueue::empty()) {break;} + if (!item->work || !*item->work.get()) {CurrentThreadQueue::pop(); continue;} + + // dispatch work + auto work = std::move(*item->work.get()); + *item->work.get() = nullptr; + CurrentThreadQueue::pop(); + + RXCPP_UNWIND_AUTO([&]{guard.lock();}); + guard.unlock(); + LocalScheduler::Do(work, queue->scheduler); + } + } + exit = false; + } + }; + std::thread worker; - WorkQueue::Factory factory; - + Derecurser::Factory factory; + std::shared_ptr derecurser; + public: EventLoopScheduler() - : queue(std::make_shared()) - , scheduler(queue->GetScheduler()) + : derecurser(std::make_shared()) { - auto local = queue; - factory = [local] (WorkQueue::RunLoop rl) -> std::thread { + auto local = derecurser; + factory = [local] (Derecurser::RunLoop rl) -> std::thread { return std::thread([local, rl]{rl();}); }; } template EventLoopScheduler(Factory factoryarg) - : queue(std::make_shared()) - , scheduler(queue->GetScheduler()) + : derecurser(std::make_shared()) + , factory(std::move(factoryarg)) { - auto local = queue; - factory = std::move(factoryarg); } virtual ~EventLoopScheduler() { @@ -347,22 +470,22 @@ namespace rxcpp worker.detach(); } } + + static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { - Disposable result = scheduler->Schedule(dueTime, std::move(work)); - - auto maybeThread = queue->EnsureThread(factory); - if (maybeThread) + auto maybeThread = derecurser->EnsureThread(factory, this->shared_from_this(), dueTime, std::move(work)); + if (std::get<0>(maybeThread)) { if (worker.joinable()) { worker.join(); } - worker = std::move(*maybeThread.get()); + worker = std::move(*std::get<0>(maybeThread).get()); } - return std::move(result); + return std::move(std::get<1>(maybeThread)); } }; diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 144fbc6..9a0eb29 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -136,6 +136,62 @@ namespace rxcpp { namespace util { }; + template + struct reveal_type {private: reveal_type();}; + +#if RXCPP_USE_VARIADIC_TEMPLATES + template + struct tuple_indices; + template <> + struct tuple_indices<-1> { // for an empty std::tuple<> there is no entry + typedef tuple_indices<> type; + }; + template + struct tuple_indices<0, Indices...> { // stop the recursion when 0 is reached + typedef tuple_indices<0, Indices...> type; + }; + template + struct tuple_indices { // recursively build a sequence of indices + typedef typename tuple_indices::type type; + }; + + template + struct make_tuple_indices { + typedef typename tuple_indices::value - 1>::type type; + }; + + namespace detail { + template + struct tuple_dispatch; + template + struct tuple_dispatch> { + template + static + auto call(F&& f, T&& t) + -> decltype (std::forward(f)(std::get(std::forward(t))...)) { + return std::forward(f)(std::get(std::forward(t))...); + } + };} + + template + auto tuple_dispatch(F&& f, T&& t) + -> decltype(detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t))) { + return detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t)); + } + + struct as_tuple { + template + auto operator()(AsTupleNext... x) + -> decltype(std::make_tuple(std::move(x)...)) const { + return std::make_tuple(std::move(x)...);} + }; +#endif //RXCPP_USE_VARIADIC_TEMPLATES + + struct pass_through { + template + X operator()(X x) const {return std::move(x);} + }; + template class unwinder { diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 31b932b..a2cb3fc 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -9,6 +9,8 @@ #if defined(WINDOWS) || defined(WIN32) || defined(_WIN32) +#pragma comment(lib, "user32.lib") + #define NOMINMAX #include diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index b5a75cb..c76a21c 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -14,13 +14,13 @@ namespace rxcpp protected: Obj obj; - struct pass_through { - template - X operator()(X x) const {return std::move(x);} - }; public: typedef T item_type; typedef Obj observable_type; + typedef util::pass_through pass_through; +#if RXCPP_USE_VARIADIC_TEMPLATES + typedef util::as_tuple as_tuple; +#endif //RXCPP_USE_VARIADIC_TEMPLATES BinderBase(Obj obj) : obj(std::move(obj)) { @@ -37,6 +37,9 @@ namespace rxcpp typedef BinderBase base; typedef typename base::item_type item_type; typedef typename base::pass_through pass_through; +#if RXCPP_USE_VARIADIC_TEMPLATES + typedef typename base::as_tuple as_tuple; +#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: static const bool is_item_observable = false; @@ -52,6 +55,9 @@ namespace rxcpp typedef BinderBase base; typedef typename base::item_type item_type; typedef typename base::pass_through pass_through; +#if RXCPP_USE_VARIADIC_TEMPLATES + typedef typename base::as_tuple as_tuple; +#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: static const bool is_item_observable = true; @@ -88,6 +94,9 @@ namespace rxcpp is_observable::type>::value> base; typedef typename base::item_type item_type; typedef typename base::pass_through pass_through; +#if RXCPP_USE_VARIADIC_TEMPLATES + typedef typename base::as_tuple as_tuple; +#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: @@ -99,6 +108,33 @@ namespace rxcpp auto select(S selector) -> decltype(from(Select(obj, selector))) { return from(Select(obj, selector)); } +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto merge(const MergeSource&... source) + -> decltype(from(Merge(obj, source...))) { + return from(Merge(obj, source...)); + } + template + auto zip(S selector, const ZipSource&... source) + -> decltype(from(Zip(selector, obj, source...))) { + return from(Zip(selector, obj, source...)); + } + template + auto zip(const Zip1Source&... source) + -> decltype(from(Zip(as_tuple(), obj, source...))) { + return from(Zip(as_tuple(), obj, source...)); + } + template + auto combine_latest(S selector, const CombineLSource&... source) + -> decltype(from(CombineLatest(selector, obj, source...))) { + return from(CombineLatest(selector, obj, source...)); + } + template + auto combine_latest(const CombineL1Source&... source) + -> decltype(from(CombineLatest(as_tuple(), obj, source...))) { + return from(CombineLatest(as_tuple(), obj, source...)); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES template auto where(P predicate) -> decltype(from(Where(obj, predicate))) { return from(Where(obj, predicate)); @@ -177,10 +213,10 @@ namespace rxcpp return result; } #if RXCPP_USE_VARIADIC_TEMPLATES - template - auto chain(Arg&& ...arg) - -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)...))) { - return from(rxcpp_chain(Tag(), obj, std::forward(arg)...)); + template + auto chain(ChainArg&&... arg) + -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)...))) { + return from(rxcpp_chain(Tag(), obj, std::forward(arg)...)); } #endif }; diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 01f08c8..b282fbd 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -32,6 +32,164 @@ void PrintPrimes(int n) }); } +void Combine(int n) +{ +#if RXCPP_USE_VARIADIC_TEMPLATES + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .where(IsPrime) + .select([](int prime){this_thread::yield(); return prime;}) + .publish(); + + auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers + rxcpp::from(values2) + .subscribe_on(input2) + .where(IsPrime) + .select([](int prime){this_thread::yield(); return prime;}) + .combine_latest(s1) + .take(n) + .observe_on(output) + .for_each( + [](tuple p) { + cout << get<0>(p) << " =combined=> " << get<1>(p) << endl; + }); +#else + (void)n; +#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + +struct Count { + Count() : nexts(0), completions(0), errors(0), disposals(0) {} + std::atomic nexts; + std::atomic completions; + std::atomic errors; + std::atomic disposals; +}; +template +std::shared_ptr> Record( + const std::shared_ptr>& source, + Count* count + ) +{ + return rxcpp::CreateObservable( + [=](std::shared_ptr> observer) + { + rxcpp::ComposableDisposable cd; + cd.Add(rxcpp::Disposable([=](){ + ++count->disposals;})); + cd.Add(rxcpp::Subscribe( + source, + // on next + [=](T element) + { + ++count->nexts; + observer->OnNext(std::move(element)); + }, + // on completed + [=] + { + ++count->completions; + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + ++count->errors; + observer->OnError(error); + })); + return cd; + }); +} +struct record {}; +template +rxcpp::Binder>> rxcpp_chain(record&&, const std::shared_ptr>& source, Count* count) { + return rxcpp::from(Record(source, count)); +} + +template +void Zip(int n) +{ +#if RXCPP_USE_VARIADIC_TEMPLATES + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + Count s1count, s2count, zipcount, takecount, outputcount; + + auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .where(IsPrime) + .template chain(&s1count) + .select([](int prime){this_thread::yield(); return prime;}) + .publish(); + + auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers + rxcpp::from(values2) + .subscribe_on(input2) + .where(IsPrime) + .template chain(&s2count) + .select([](int prime){this_thread::yield(); return prime;}) + .zip(s1) + .template chain(&zipcount) + .take(n) + .template chain(&takecount) + .observe_on(output) + .template chain(&outputcount) + .for_each( + [](tuple p) { + cout << get<0>(p) << " =zipped=> " << get<1>(p) << endl; + }); + + cout << "location: nexts, completions, errors, disposals" << endl; + cout << "s1count:" << s1count.nexts << ", " << s1count.completions << ", " << s1count.errors << ", " << s1count.disposals << endl; + cout << "s2count:" << s2count.nexts << ", " << s2count.completions << ", " << s2count.errors << ", " << s2count.disposals << endl; + cout << "zipcount:" << zipcount.nexts << ", " << zipcount.completions << ", " << zipcount.errors << ", " << zipcount.disposals << endl; + cout << "takecount:" << takecount.nexts << ", " << takecount.completions << ", " << takecount.errors << ", " << takecount.disposals << endl; + cout << "outputcount:" << outputcount.nexts << ", " << outputcount.completions << ", " << outputcount.errors << ", " << outputcount.disposals << endl; +#else + (void)n; +#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + +void Merge(int n) +{ +#if RXCPP_USE_VARIADIC_TEMPLATES + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + cout << "merge==> : " << endl; + + auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .where(IsPrime) + .select([](int prime1) {this_thread::yield(); return std::make_tuple("1: ", prime1);}) + .publish(); + + auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers + rxcpp::from(values2) + .subscribe_on(input2) + .where(IsPrime) + .select([](int prime2) {this_thread::yield(); return std::make_tuple("2: ", prime2);}) + .merge(s1) + .take(n) + .observe_on(output) + .for_each( + [](tuple p) { + cout << get<0>(p) << get<1>(p) << endl; + }); +#else + (void)n; +#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + std::shared_ptr> Data( string filename, rxcpp::Scheduler::shared scheduler = std::make_shared() @@ -135,12 +293,38 @@ void run() }); } +template +void innerScheduler() { + auto outer = std::make_shared(); + rxcpp::Scheduler::shared inner; + outer->Schedule([&](rxcpp::Scheduler::shared s){ + inner = s; return rxcpp::Disposable::Empty();}); + while(!inner); + inner->Schedule([&](rxcpp::Scheduler::shared s){ + inner = nullptr; return rxcpp::Disposable::Empty();}); + while(!!inner); + cout << "innerScheduler test succeeded" << endl; +} + int main(int argc, char* argv[]) { - PrintPrimes(20); - try { + PrintPrimes(20); + cout << "Zip Immediate" << endl; + Zip(20); + cout << "Zip Current" << endl; + Zip(20); + cout << "Zip EventLoop" << endl; + Zip(20); + Combine(20); + Merge(20); + + innerScheduler(); + innerScheduler(); + innerScheduler(); + run(); + } catch (exception& e) { cerr << "exception: " << e.what() << endl; } -- GitLab From 8fd8c0e79ca0030b95e78e8f776e291872da9515 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Mar 2013 22:37:12 -0700 Subject: [PATCH 031/782] adds to_vector and to_list and fixes select_many --- Rx/CPP/src/cpprx/rx-base.hpp | 77 ++++++++++++++++ Rx/CPP/src/cpprx/rx-includes.hpp | 1 + Rx/CPP/src/cpprx/rx-operators.hpp | 77 +++++++++------- Rx/CPP/src/cpprx/rx-util.hpp | 148 +++++++++++++++++++++++++++++- Rx/CPP/src/cpprx/rx-windows.hpp | 3 +- Rx/CPP/src/cpprx/rx.hpp | 62 +++++++------ Rx/CPP/testbench/testbench.cpp | 125 +++++++++++-------------- 7 files changed, 360 insertions(+), 133 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 6182d0c..970c3c0 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -293,6 +293,44 @@ namespace rxcpp } }; + template + class TupleDispatch { + Target target; + public: + TupleDispatch(Target target) : target(std::move(target)) { + } + template + auto operator()(const Tuple& tuple) -> decltype(util::tuple_dispatch(target, tuple)) { + return util::tuple_dispatch(target, tuple);} + }; + + template + TupleDispatch MakeTupleDispatch(Target&& target) { + return TupleDispatch(std::forward(target));} + + template + auto DispatchTuple(Tuple&& tuple, Target&& target) -> + decltype(util::tuple_dispatch(std::forward(target), std::forward(tuple))) { + return util::tuple_dispatch(std::forward(target), std::forward(tuple));} + +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto ConcatTuple(Lhs&& lhs, Rhs&& rhs) -> + decltype(util::tuple_concat(std::forward(lhs), std::forward(rhs))) { + return util::tuple_concat(std::forward(lhs), std::forward(rhs));} + + template + auto TieTuple(T&& t) -> + decltype(util::tuple_tie(std::forward(t))) { + return util::tuple_tie(std::forward(t));} +#endif //RXCPP_USE_VARIADIC_TEMPLATES + + template + class Subject; + + template + class GroupedSubject; + template T item(const std::shared_ptr>&); @@ -305,9 +343,15 @@ namespace rxcpp template struct is_observable>> {static const bool value = true;}; + template + struct is_observable>> {static const bool value = true;}; + template struct is_observable>> {static const bool value = true;}; + template + struct is_observable>> {static const bool value = true;}; + template struct observable_item; @@ -316,5 +360,38 @@ namespace rxcpp template struct observable_item>> {typedef T type;}; + + template + struct observable_observer; + + template + struct observable_observer>> {typedef std::shared_ptr> type;}; + + template + struct observable_observer>> {typedef std::shared_ptr> type;}; + + template + struct observer_item; + + template + struct observer_item>> {typedef T type;}; + + template + struct subject_item; + + template + struct subject_item>> {typedef T type;}; + + template + struct subject_observer; + + template + struct subject_observer>> {typedef std::shared_ptr> type;}; + + template + struct subject_observable; + + template + struct subject_observable>> {typedef std::shared_ptr> type;}; } #endif diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index e0574aa..8c861f0 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index a2e8b3c..8ee85e1 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -387,7 +387,8 @@ namespace rxcpp wake.wait(guard, [&]{return done;}); } - if (error != std::exception_ptr()) {std::rethrow_exception(error);} + if (error != std::exception_ptr()) { + std::rethrow_exception(error);} } ////////////////////////////////////////////////////////////////////// @@ -432,13 +433,13 @@ namespace rxcpp CS collectionSelector, RS resultSelector) -> const std::shared_ptr::type>::type&)>::type>> { typedef typename std::result_of::type C; typedef typename observable_item::type CI; - typedef typename std::result_of::type U; + typedef typename std::result_of::type U; return CreateObservable( [=](std::shared_ptr> observer) @@ -464,7 +465,7 @@ namespace rxcpp cd.Add(Subscribe( source, // on next - [=](const T& element) + [=](const T& sourceElement) { bool cancel = false; { @@ -474,11 +475,11 @@ namespace rxcpp } if (!cancel) { try { - auto collection = collectionSelector(element); + auto collection = collectionSelector(sourceElement); cd.Add(Subscribe( collection, // on next - [=](const CI& element) + [=](const CI& collectionElement) { bool cancel = false; { @@ -487,7 +488,7 @@ namespace rxcpp } try { if (!cancel) { - auto result = resultSelector(element); + auto result = resultSelector(sourceElement, collectionElement); observer->OnNext(std::move(result)); } } catch (...) { @@ -940,21 +941,11 @@ namespace rxcpp return CreateObservable( [=](std::shared_ptr> observer) { - typedef std::function OnNext; - typedef std::function OnCompleted; - typedef std::function OnError; - - struct GroupValue - { - OnNext onNext; - OnCompleted onCompleted; - OnError onError; - }; - typedef std::map Groups; + typedef std::map>, L> Groups; struct State { - State(L less) : groups(std::move(less)) {} + explicit State(L less) : groups(std::move(less)) {} std::mutex lock; Groups groups; }; @@ -970,18 +961,11 @@ namespace rxcpp typename Groups::iterator groupIt; bool newGroup = false; - GroupValue value; - value.onNext = [keySubject](Value v){ - keySubject->OnNext(std::move(v));}; - value.onCompleted = [keySubject](){ - keySubject->OnCompleted();}; - value.onError = [keySubject](const std::exception_ptr& e){ - keySubject->OnError(std::move(e));}; { std::unique_lock guard(state->lock); - std::tie(groupIt, newGroup) = state->groups.insert(std::make_pair( - key,std::move(value)) + std::tie(groupIt, newGroup) = state->groups.insert( + std::make_pair(key,keySubject) ); } @@ -990,13 +974,14 @@ namespace rxcpp LocalGroupObservable nextGroup(std::move(keySubject)); observer->OnNext(nextGroup); } - groupIt->second.onNext(valueSelector(element)); + auto result = valueSelector(element); + groupIt->second->OnNext(std::move(result)); }, // on completed [=] { for(auto& group : state->groups) { - group.second.onCompleted(); + group.second->OnCompleted(); } observer->OnCompleted(); }, @@ -1004,7 +989,7 @@ namespace rxcpp [=](const std::exception_ptr& error) { for(auto& group : state->groups) { - group.second.onError(error); + group.second->OnError(error); } observer->OnError(error); }); @@ -1064,6 +1049,36 @@ namespace rxcpp }); } + template + const std::shared_ptr> ToStdCollection( + const std::shared_ptr>& source + ) + { + typedef typename StdCollection::value_type Value; + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto stdCollection = std::make_shared(); + return Subscribe( + source, + // on next + [=](const Value& element) + { + stdCollection->insert(stdCollection->end(), element); + }, + // on completed + [=] + { + observer->OnNext(std::move(*stdCollection.get())); + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } ////////////////////////////////////////////////////////////////////// // diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 9a0eb29..d869577 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -179,19 +179,165 @@ namespace rxcpp { namespace util { return detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t)); } + namespace detail { + template + struct tuple_concat; + template + struct tuple_concat, tuple_indices> { + template + static + auto concatenate(LhsTuple&& lhs, RhsTuple&& rhs) + -> decltype (std::tuple< + typename std::tuple_element::type>::type..., + typename std::tuple_element::type>::type...>( + std::get(std::forward(lhs))..., + std::get(std::forward(rhs))...)) { + return std::tuple< + typename std::tuple_element::type>::type..., + typename std::tuple_element::type>::type...>( + std::get(std::forward(lhs))..., + std::get(std::forward(rhs))...); + } + };} + + template + auto tuple_concat(LhsTuple&& lhs, RhsTuple&& rhs) + -> decltype(detail::tuple_concat< + typename make_tuple_indices::type>::type, + typename make_tuple_indices::type>::type>:: + concatenate(std::forward(lhs), std::forward(rhs))) { + return detail::tuple_concat< + typename make_tuple_indices::type>::type, + typename make_tuple_indices::type>::type>:: + concatenate(std::forward(lhs), std::forward(rhs)); + } + + namespace detail { + template + struct tuple_tie; + template + struct tuple_tie> { + template + static + auto tie(T&& t) + -> decltype (std::tie(std::get(std::forward(t))...)) { + return std::tie(std::get(std::forward(t))...); + } + };} + + template + auto tuple_tie(T&& t) + -> decltype(detail::tuple_tie::type>::type>::tie(std::forward(t))) { + return detail::tuple_tie::type>::type>::tie(std::forward(t)); + } + struct as_tuple { template auto operator()(AsTupleNext... x) - -> decltype(std::make_tuple(std::move(x)...)) const { + -> decltype(std::make_tuple(std::move(x)...)) { + return std::make_tuple(std::move(x)...);} + template + auto operator()(AsTupleNext... x) const + -> decltype(std::make_tuple(std::move(x)...)) { return std::make_tuple(std::move(x)...);} }; +#else + namespace detail { + template + struct tuple_dispatch; + template<> + struct tuple_dispatch<0> { + template + static auto call(F&& f, T&& ) + -> decltype (std::forward(f)()) { + return std::forward(f)();} + }; + template<> + struct tuple_dispatch<1> { + template + static auto call(F&& f, T&& t) + -> decltype (std::forward(f)(std::get<0>(std::forward(t)))) { + return std::forward(f)(std::get<0>(std::forward(t)));} + }; + template<> + struct tuple_dispatch<2> { + template + static auto call(F&& f, T&& t) + -> decltype (std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)))) { + return std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)));} + }; + template<> + struct tuple_dispatch<3> { + template + static auto call(F&& f, T&& t) + -> decltype (std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)))) { + return std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)));} + }; + template<> + struct tuple_dispatch<4> { + template + static auto call(F&& f, T&& t) + -> decltype (std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)), + std::get<3>(std::forward(t)))) { + return std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)), + std::get<3>(std::forward(t)));} + }; + template<> + struct tuple_dispatch<5> { + template + static auto call(F&& f, T&& t) + -> decltype (std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)), + std::get<3>(std::forward(t)), + std::get<4>(std::forward(t)))) { + return std::forward(f)( + std::get<0>(std::forward(t)), + std::get<1>(std::forward(t)), + std::get<2>(std::forward(t)), + std::get<3>(std::forward(t)), + std::get<4>(std::forward(t)));} + }; + } + + template + auto tuple_dispatch(F&& f, T&& t) + -> decltype(detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t))) { + return detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t)); + } #endif //RXCPP_USE_VARIADIC_TEMPLATES struct pass_through { + template + X operator()(X x) {return std::move(x);} template X operator()(X x) const {return std::move(x);} }; + struct pass_through_second { + template + Y operator()(X , Y y) {return std::move(y);} + template + Y operator()(X , Y y) const {return std::move(y);} + }; + template class unwinder { diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index a2cb3fc..7d64a1b 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -141,8 +141,7 @@ namespace rxcpp { namespace win32 { wndclass.hInstance = NULL; wndclass.lpszClassName = className(); - if (!RegisterClassW(&wndclass)) - throw std::exception("failed to register windows class"); + RegisterClassW(&wndclass); std::unique_ptr that(new WindowClass); that->queue = queue; diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index c76a21c..a51f3ef 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -17,10 +17,6 @@ namespace rxcpp public: typedef T item_type; typedef Obj observable_type; - typedef util::pass_through pass_through; -#if RXCPP_USE_VARIADIC_TEMPLATES - typedef util::as_tuple as_tuple; -#endif //RXCPP_USE_VARIADIC_TEMPLATES BinderBase(Obj obj) : obj(std::move(obj)) { @@ -36,10 +32,6 @@ namespace rxcpp protected: typedef BinderBase base; typedef typename base::item_type item_type; - typedef typename base::pass_through pass_through; -#if RXCPP_USE_VARIADIC_TEMPLATES - typedef typename base::as_tuple as_tuple; -#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: static const bool is_item_observable = false; @@ -54,10 +46,6 @@ namespace rxcpp protected: typedef BinderBase base; typedef typename base::item_type item_type; - typedef typename base::pass_through pass_through; -#if RXCPP_USE_VARIADIC_TEMPLATES - typedef typename base::as_tuple as_tuple; -#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: static const bool is_item_observable = true; @@ -67,18 +55,18 @@ namespace rxcpp } auto select_many() - -> decltype(from(SelectMany(obj, pass_through(), pass_through()))) { - return from(SelectMany(obj, pass_through(), pass_through())); + -> decltype(from(SelectMany(obj, util::pass_through(), util::pass_through_second()))) { + return from(SelectMany(obj, util::pass_through(), util::pass_through_second())); } template auto select_many(CS collectionSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), pass_through()))) { - return from(SelectMany(obj, std::move(collectionSelector), pass_through())); + -> decltype(from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second()))) { + return from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second())); } template auto select_many(CS collectionSelector, RS resultSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { - return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); + -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { + return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); } }; @@ -93,10 +81,6 @@ namespace rxcpp Obj, is_observable::type>::value> base; typedef typename base::item_type item_type; - typedef typename base::pass_through pass_through; -#if RXCPP_USE_VARIADIC_TEMPLATES - typedef typename base::as_tuple as_tuple; -#endif //RXCPP_USE_VARIADIC_TEMPLATES using base::obj; public: @@ -121,8 +105,8 @@ namespace rxcpp } template auto zip(const Zip1Source&... source) - -> decltype(from(Zip(as_tuple(), obj, source...))) { - return from(Zip(as_tuple(), obj, source...)); + -> decltype(from(Zip(util::as_tuple(), obj, source...))) { + return from(Zip(util::as_tuple(), obj, source...)); } template auto combine_latest(S selector, const CombineLSource&... source) @@ -131,8 +115,8 @@ namespace rxcpp } template auto combine_latest(const CombineL1Source&... source) - -> decltype(from(CombineLatest(as_tuple(), obj, source...))) { - return from(CombineLatest(as_tuple(), obj, source...)); + -> decltype(from(CombineLatest(util::as_tuple(), obj, source...))) { + return from(CombineLatest(util::as_tuple(), obj, source...)); } #endif //RXCPP_USE_VARIADIC_TEMPLATES template @@ -145,15 +129,15 @@ namespace rxcpp template auto group_by( KS keySelector) - -> decltype(from(GroupBy(obj, keySelector, pass_through(), std::less()))) { - return from(GroupBy(obj, keySelector, pass_through(), std::less())); + -> decltype(from(GroupBy(obj, keySelector, util::pass_through(), std::less()))) { + return from(GroupBy(obj, keySelector, util::pass_through(), std::less())); } template auto group_by( KS keySelector, VS valueSelector) -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { - return from(GroupBy(obj, keySelector, valueSelector, std::less())); + return from(GroupBy(obj, keySelector, valueSelector, std::less())); } template auto group_by( @@ -161,12 +145,30 @@ namespace rxcpp VS valueSelector, L less) -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { - return from(GroupBy(obj, keySelector, valueSelector, less)); + return from(GroupBy(obj, keySelector, valueSelector, less)); } template auto take(Integral n) -> decltype(from(Take(obj, n))) { return from(Take(obj, n)); } + templateclass Allocator> + auto to_vector() + -> decltype(from(ToStdCollection>>(obj))) { + return from(ToStdCollection>>(obj)); + } + auto to_vector() + -> decltype(from(ToStdCollection>(obj))) { + return from(ToStdCollection>(obj)); + } + templateclass Allocator> + auto to_list() + -> decltype(from(ToStdCollection>>(obj))) { + return from(ToStdCollection>>(obj)); + } + auto to_list() + -> decltype(from(ToStdCollection>(obj))) { + return from(ToStdCollection>(obj)); + } auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { return from(Delay(obj, due, scheduler)); } diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index b282fbd..c1913ae 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -26,10 +26,10 @@ void PrintPrimes(int n) .where(IsPrime) .select([](int x) { return std::make_pair(x, x*x); }) .take(n) - .subscribe( - [](pair p) { - cout << p.first << " =square=> " << p.second << endl; - }); + .subscribe(rxcpp::MakeTupleDispatch( + [](int p, int s) { + cout << p << " =square=> " << s << endl; + })); } void Combine(int n) @@ -54,10 +54,10 @@ void Combine(int n) .combine_latest(s1) .take(n) .observe_on(output) - .for_each( - [](tuple p) { - cout << get<0>(p) << " =combined=> " << get<1>(p) << endl; - }); + .for_each(rxcpp::MakeTupleDispatch( + [](int p2, int p1) { + cout << p2 << " =combined=> " << p1 << endl; + })); #else (void)n; #endif //RXCPP_USE_VARIADIC_TEMPLATES @@ -141,10 +141,10 @@ void Zip(int n) .template chain(&takecount) .observe_on(output) .template chain(&outputcount) - .for_each( - [](tuple p) { - cout << get<0>(p) << " =zipped=> " << get<1>(p) << endl; - }); + .for_each(rxcpp::MakeTupleDispatch( + [](int p2, int p1) { + cout << p2 << " =zipped=> " << p1 << endl; + })); cout << "location: nexts, completions, errors, disposals" << endl; cout << "s1count:" << s1count.nexts << ", " << s1count.completions << ", " << s1count.errors << ", " << s1count.disposals << endl; @@ -181,10 +181,10 @@ void Merge(int n) .merge(s1) .take(n) .observe_on(output) - .for_each( - [](tuple p) { - cout << get<0>(p) << get<1>(p) << endl; - }); + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout << s << p << endl; + })); #else (void)n; #endif //RXCPP_USE_VARIADIC_TEMPLATES @@ -229,68 +229,55 @@ void run() .group_by([](const item& i) { return i.args;} ) - .select([=](const std::shared_ptr> & gob){ - return std::make_pair( - gob->Key(), // keep args key - rxcpp::from(gob) + // flatten concurrencies in the same args + .select_many( + [](const std::shared_ptr> & argsGroup){ + return rxcpp::from(argsGroup) // group items by concurrency field .group_by([](const item& i){ return i.concurrency;} ) - // select only the times field - .select([=] (const std::shared_ptr> & gob){ - return std::make_pair( - gob->Key(), // keep concurrency key - rxcpp::from(gob) + // flatten times in the same concurrency + .select_many( + [](const std::shared_ptr> & concurrencyGroup){ + return rxcpp::from(concurrencyGroup) .select([](const item& i){ - return i.time;} - ) - .publish());} + return i.time;}) + .to_vector() + .publish();}, + [](const std::shared_ptr> & concurrencyGroup, + const std::vector & times){ + return std::make_tuple(concurrencyGroup->Key(), times);} ) - .publish());} + .to_vector() + .publish();}, + [](const std::shared_ptr> & argsGroup, + const std::vector>> & ouputGroup){ + return std::make_tuple(argsGroup->Key(), ouputGroup);} ) .observe_on(output) - // print the grouped results - // for_each the args to block until the nested subscribes have finished - .for_each([&](const std::pair, std::shared_ptr > > > > >& ob){ - auto argsstate = std::make_shared>(false, ob.first, arggroupcount++); - rxcpp::from(ob.second) - // subscribe the concurrencies within each args - .subscribe([=](const std::pair > >& ob){ - auto linestate = std::make_shared>>(ob.first, std::vector()); - rxcpp::from(ob.second) - // subscribe the times within each concurrency - .subscribe([=](const double& i){ - // collect the times - linestate->second.push_back(i); - },[=]{ - // this concurrency's times are complete - // output a line to the console. - - if (!std::get<0>(*argsstate)) - { - std::get<0>(*argsstate) = true; - cout<<"arguments: "<(*argsstate)<first << ", "; + .for_each(rxcpp::MakeTupleDispatch( + [](const std::string& args, const std::vector>>& concurrencyGroup){ + cout<<"arguments: "<< args << endl; + cout << "concurrency, mean, |, raw_data," << endl; + for(auto& concurrencyItem : concurrencyGroup) { + rxcpp::MakeTupleDispatch( + [](int concurrency, const std::vector& rawtimes){ + cout << concurrency << ", "; - auto n = from(linestate->second).count(); - auto sum = std::accumulate(linestate->second.begin(), linestate->second.end(), 0.0); - - cout << (sum / n) << ", |"; - - for (auto timeIter = linestate->second.begin(), end = linestate->second.end(); - timeIter != end; - ++timeIter) - { - cout << ", " << *timeIter; - } - cout << endl; - }); - }); - }); + auto n = from(rawtimes).count(); + auto sum = std::accumulate(rawtimes.begin(), rawtimes.end(), 0.0); + + cout << (sum / n) << ", |"; + + for (auto timeIter = rawtimes.begin(), end = rawtimes.end(); + timeIter != end; + ++timeIter) + { + cout << ", " << *timeIter; + } + cout << endl;})(concurrencyItem);}}) + ); } template -- GitLab From 3ea208dcdbd615939292b2fae265ff1310a121ad Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Mar 2013 23:14:37 -0700 Subject: [PATCH 032/782] add take_until, skip and skip_until --- Rx/CPP/src/cpprx/rx-operators.hpp | 218 +++++++++++++++++++++++++++++- Rx/CPP/src/cpprx/rx.hpp | 40 ++++-- 2 files changed, 241 insertions(+), 17 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 8ee85e1..bbd4668 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -234,6 +234,9 @@ namespace rxcpp class Subject : public ObserverSubject, Subject>> { + public: + std::shared_ptr> observable(){return std::static_pointer_cast>(this->shared_from_this());} + std::shared_ptr> observer(){return std::static_pointer_cast>(this->shared_from_this());} }; template @@ -260,6 +263,9 @@ namespace rxcpp typedef ObserverSubject, GroupedSubject>>> base; public: GroupedSubject(K key) : base(std::move(key)) {} + std::shared_ptr> observable(){return std::static_pointer_cast>(this->shared_from_this());} + std::shared_ptr> observer(){return std::static_pointer_cast>(this->shared_from_this());} + std::shared_ptr> grouped_observable(){return std::static_pointer_cast>(this->shared_from_this());} }; template @@ -996,10 +1002,10 @@ namespace rxcpp }); } - template + template std::shared_ptr> Take( const std::shared_ptr>& source, - int n // TODO: long long? + Integral n ) { return CreateObservable( @@ -1007,7 +1013,7 @@ namespace rxcpp -> Disposable { // keep count of remaining calls received OnNext and count of OnNext calls issued. - auto remaining = std::make_shared, std::atomic>>(n, n); + auto remaining = std::make_shared, std::atomic>>(n, n); ComposableDisposable cd; @@ -1040,15 +1046,217 @@ namespace rxcpp // on error [=](const std::exception_ptr& error) { - if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { - observer->OnError(error); + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + template + std::shared_ptr> TakeUntil( + const std::shared_ptr>& source, + const std::shared_ptr>& terminus + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + + struct TerminusState { + enum type { + Live, + Terminated + }; + }; + struct TakeState { + enum type { + Taking, + Completed + }; + }; + struct State { + State() : terminusState(TerminusState::Live), takeState(TakeState::Taking) {} + std::atomic terminusState; + std::atomic takeState; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + cd.Add(Subscribe( + terminus, + // on next + [=](const T& element) + { + state->terminusState = TerminusState::Terminated; + }, + // on completed + [=] + { + state->terminusState = TerminusState::Terminated; + }, + // on error + [=](const std::exception_ptr& error) + { + state->terminusState = TerminusState::Terminated; + })); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (state->terminusState == TerminusState::Live) { + observer->OnNext(element); + } else if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { + observer->OnCompleted(); cd.Dispose(); } + }, + // on completed + [=] + { + if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { + state->terminusState = TerminusState::Terminated; + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + state->takeState = TakeState::Completed; + state->terminusState = TerminusState::Terminated; + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + template + std::shared_ptr> Skip( + const std::shared_ptr>& source, + Integral n + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + enum type { + Skipping, + Forwarding + }; + }; + // keep count of remaining OnNext calls to skip and state. + auto remaining = std::make_shared, std::atomic>>(n, State::Skipping); + + ComposableDisposable cd; + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (std::get<1>(*remaining) == State::Forwarding) { + observer->OnNext(element); + } else { + auto local = --std::get<0>(*remaining); + + if (local == 0) { + std::get<1>(*remaining) = State::Forwarding; + observer->OnNext(element); + } + } + }, + // on completed + [=] + { + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + template + std::shared_ptr> SkipUntil( + const std::shared_ptr>& source, + const std::shared_ptr>& terminus + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct SkipState { + enum type { + Skipping, + Taking + }; + }; + struct State { + State() : skipState(SkipState::Skipping) {} + std::atomic skipState; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + cd.Add(Subscribe( + terminus, + // on next + [=](const T& element) + { + state->skipState = SkipState::Taking; + }, + // on completed + [=] + { + state->skipState = SkipState::Taking; + }, + // on error + [=](const std::exception_ptr& error) + { + state->skipState = SkipState::Taking; + })); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (state->skipState == SkipState::Taking) { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); })); return cd; }); } + template const std::shared_ptr> ToStdCollection( const std::shared_ptr>& source diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index a51f3ef..cc1e88b 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -58,16 +58,6 @@ namespace rxcpp -> decltype(from(SelectMany(obj, util::pass_through(), util::pass_through_second()))) { return from(SelectMany(obj, util::pass_through(), util::pass_through_second())); } - template - auto select_many(CS collectionSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second()))) { - return from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second())); - } - template - auto select_many(CS collectionSelector, RS resultSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { - return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); - } }; template @@ -92,6 +82,16 @@ namespace rxcpp auto select(S selector) -> decltype(from(Select(obj, selector))) { return from(Select(obj, selector)); } + template + auto select_many(CS collectionSelector) + -> decltype(from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second()))) { + return from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second())); + } + template + auto select_many(CS collectionSelector, RS resultSelector) + -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { + return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); + } #if RXCPP_USE_VARIADIC_TEMPLATES template auto merge(const MergeSource&... source) @@ -148,8 +148,24 @@ namespace rxcpp return from(GroupBy(obj, keySelector, valueSelector, less)); } template - auto take(Integral n) -> decltype(from(Take(obj, n))) { - return from(Take(obj, n)); + auto take(Integral n) + -> decltype(from(Take(obj, n))) { + return from(Take(obj, n)); + } + template + auto take_until(std::shared_ptr> terminus) + -> decltype(from(TakeUntil(obj, terminus))) { + return from(TakeUntil(obj, terminus)); + } + template + auto skip(Integral n) + -> decltype(from(Skip(obj, n))) { + return from(Skip(obj, n)); + } + template + auto skip_until(std::shared_ptr> terminus) + -> decltype(from(SkipUntil(obj, terminus))) { + return from(SkipUntil(obj, terminus)); } templateclass Allocator> auto to_vector() -- GitLab From 75908d25adab4f935209e272a3ee1287be325038 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 30 Mar 2013 00:03:52 -0700 Subject: [PATCH 033/782] adds interval and throttle --- Rx/CPP/src/cpprx/rx-base.hpp | 9 +- Rx/CPP/src/cpprx/rx-operators.hpp | 293 +++++++++++++++++++++++++++++- Rx/CPP/src/cpprx/rx-util.hpp | 162 +++++++++++++++++ Rx/CPP/src/cpprx/rx.hpp | 125 ++++++++++++- Rx/CPP/testbench/testbench.cpp | 55 ++++-- 5 files changed, 626 insertions(+), 18 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 970c3c0..091e6e5 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -300,8 +300,13 @@ namespace rxcpp TupleDispatch(Target target) : target(std::move(target)) { } template - auto operator()(const Tuple& tuple) -> decltype(util::tuple_dispatch(target, tuple)) { - return util::tuple_dispatch(target, tuple);} + auto operator()(const Tuple& tuple) + -> decltype(util::tuple_dispatch(target, tuple)) { + return util::tuple_dispatch(target, tuple);} + template + auto operator()(const Tuple& tuple) const + -> decltype(util::tuple_dispatch(target, tuple)) { + return util::tuple_dispatch(target, tuple);} }; template diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index bbd4668..293d2b5 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -346,6 +346,55 @@ namespace rxcpp }); } + std::shared_ptr> Interval( + Scheduler::clock::duration due, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State : public std::enable_shared_from_this { + State(Scheduler::clock::duration due, + Scheduler::clock::time_point last, + std::shared_ptr> observer) : due(due), last(last), cursor(0), observer(observer) { + cd.Add(sd);} + + Scheduler::clock::duration due; + Scheduler::clock::time_point last; + size_t cursor; + std::shared_ptr> observer; + ComposableDisposable cd; + SharedDisposable sd; + + void Tick(Scheduler::shared s){ + observer->OnNext(cursor); + last += due; + ++cursor; + auto keepAlive = this->shared_from_this(); + sd.Set(s->Schedule( + last, + [this, keepAlive] (Scheduler::shared s){ + Tick(s); + return Disposable::Empty(); + } + )); + } + }; + auto state = std::make_shared(due, scheduler->Now(), observer); + + state->last += state->due; + state->sd.Set(scheduler->Schedule( + state->last, + [=] (Scheduler::shared s){ + state->Tick(s); + return Disposable::Empty(); + } + )); + return state->cd; + }); + } + ////////////////////////////////////////////////////////////////////// // @@ -570,7 +619,6 @@ namespace rxcpp }); } -#if RXCPP_USE_VARIADIC_TEMPLATES namespace detail{ template struct CombineLatestSubscriber { @@ -643,6 +691,8 @@ namespace rxcpp const typename SubscribeState::Sources& ) {} }; } + +#if RXCPP_USE_VARIADIC_TEMPLATES template auto CombineLatest( S selector, @@ -684,6 +734,50 @@ namespace rxcpp return cd; }); } +#else + template + auto CombineLatest( + S selector, + const std::shared_ptr>& source1, + const std::shared_ptr>& source2 + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>, std::shared_ptr>> Sources; + typedef std::tuple Latest; + struct State { + typedef Latest Latest; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : pendingFirst(SourcesSize::value) + , pendingIssue(0) + , pendingComplete(SourcesSize::value) + , done(false) + , selector(std::move(selector)) + {} + std::mutex lock; + size_t pendingFirst; + size_t pendingIssue; + size_t pendingComplete; + bool done; + S selector; + Latest latest; + }; + Sources sources(source1, source2); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif namespace detail{ template @@ -706,6 +800,7 @@ namespace rxcpp , observer(observer) , cd(cd) { } +#if RXCPP_USE_VARIADIC_TEMPLATES template void operator()(ZipQueue&... queue) { // build array of bool that we can iterate to detect empty queues @@ -741,6 +836,43 @@ namespace rxcpp cd.Dispose(); } } +#else + template + void operator()(ZipQueue1& queue1, ZipQueue2& queue2) { + // build array of bool that we can iterate to detect empty queues + bool empties[] = {queue1.empty(), queue2.empty()}; + if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { + // all queues have an item. + // + // copy front of each queue + auto args = std::make_tuple(queue1.front(), queue2.front()); + + queue1.pop(); + queue2.pop(); + + ++state->pending; + auto result = util::tuple_dispatch(state->selector, args); + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(result)); + } + --state->pending; + } + // build new array to check for any empty queue + bool post_empties[] = {queue1.empty(), queue2.empty()}; + if (state->completed && state->pending == 0 && + std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + // at least one queue is empty and at least one of the sources has completed. + // it is time to stop. + + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES }; static void subscribe( ComposableDisposable& cd, @@ -784,6 +916,7 @@ namespace rxcpp const typename SubscribeState::Sources& ) {} }; } +#if RXCPP_USE_VARIADIC_TEMPLATES template auto Zip( S selector, @@ -793,7 +926,7 @@ namespace rxcpp { typedef typename std::result_of::type result_type; typedef std::tuple>...> Sources; - typedef std::tuple>>...> Queues; + typedef std::tuple...> Queues; struct State { typedef Queues Queues; typedef Sources Sources; @@ -821,6 +954,46 @@ namespace rxcpp return cd; }); } +#else + template + auto Zip( + S selector, + const std::shared_ptr>& source1, + const std::shared_ptr>& source2 + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>, std::shared_ptr>> Sources; + typedef std::tuple, std::queue> Queues; + struct State { + typedef Queues Queues; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : selector(std::move(selector)) + , pending(0) + , completed(false) + {} + std::mutex lock; + S selector; + size_t pending; + bool completed; + Queues queues; + }; + Sources sources(source1, source2); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES namespace detail{ template @@ -866,6 +1039,7 @@ namespace rxcpp const typename SubscribeState::Sources& ) {} }; } +#if RXCPP_USE_VARIADIC_TEMPLATES template std::shared_ptr> Merge( const std::shared_ptr>& firstSource, @@ -894,6 +1068,35 @@ namespace rxcpp return cd; }); } +#else + template + std::shared_ptr> Merge( + const std::shared_ptr>& firstSource, + const std::shared_ptr>& otherSource + ) + { + typedef MergeSource result_type; + typedef decltype(std::make_tuple(firstSource, otherSource)) Sources; + struct State { + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + State() + : pendingComplete(SourcesSize::value) + {} + std::atomic pendingComplete; + }; + Sources sources(firstSource, otherSource); + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } #endif //RXCPP_USE_VARIADIC_TEMPLATES template @@ -1169,7 +1372,6 @@ namespace rxcpp if (local == 0) { std::get<1>(*remaining) = State::Forwarding; - observer->OnNext(element); } } }, @@ -1347,6 +1549,91 @@ namespace rxcpp }); } + template + std::shared_ptr> Throttle( + const std::shared_ptr>& source, + Scheduler::clock::duration due, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + State() : hasValue(false), id(0) {} + std::mutex lock; + T value; + bool hasValue; + size_t id; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + size_t current = 0; + { + std::unique_lock guard(state->lock); + state->hasValue = true; + state->value = std::move(element); + current = ++state->id; + } + sd.Set(scheduler->Schedule( + due, + [=] (Scheduler::shared){ + { + std::unique_lock guard(state->lock); + if (state->hasValue && state->id == current) { + observer->OnNext(std::move(state->value)); + } + state->hasValue = false; + } + + return Disposable::Empty(); + } + )); + }, + // on completed + [=] + { + bool sendValue = false; + T value; + { + std::unique_lock guard(state->lock); + sendValue = state->hasValue; + if (sendValue) { + value = std::move(state->value);} + state->hasValue = false; + ++state->id; + } + if (sendValue) { + observer->OnNext(std::move(value));} + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + { + std::unique_lock guard(state->lock); + state->hasValue = false; + ++state->id; + } + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + // no more than one event ever 'milliseconds' // TODO: oops, this is not the right definition for throttle. template diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index d869577..cf7ad04 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -322,6 +322,168 @@ namespace rxcpp { namespace util { -> decltype(detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t))) { return detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t)); } + + struct as_tuple { + auto operator()() + -> decltype(std::make_tuple()) { + return std::make_tuple();} + template + auto operator()(AsTupleNext x) + -> decltype(std::make_tuple(std::move(x))) { + return std::make_tuple(std::move(x));} + template< + class AsTupleNext1, + class AsTupleNext2> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2) + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2))) { + return std::make_tuple( + std::move(x1), + std::move(x2));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3) + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3, + class AsTupleNext4> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3, + AsTupleNext4 x4) + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3, + class AsTupleNext4, + class AsTupleNext5> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3, + AsTupleNext4 x4, + AsTupleNext5 x5) + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4), + std::move(x5))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4), + std::move(x5));} + + auto operator()() const + -> decltype(std::make_tuple()) { + return std::make_tuple();} + template + auto operator()(AsTupleNext x) const + -> decltype(std::make_tuple(std::move(x))) { + return std::make_tuple(std::move(x));} + template< + class AsTupleNext1, + class AsTupleNext2> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2) const + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2))) { + return std::make_tuple( + std::move(x1), + std::move(x2));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3) const + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3, + class AsTupleNext4> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3, + AsTupleNext4 x4) const + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4));} + template< + class AsTupleNext1, + class AsTupleNext2, + class AsTupleNext3, + class AsTupleNext4, + class AsTupleNext5> + auto operator()( + AsTupleNext1 x1, + AsTupleNext2 x2, + AsTupleNext3 x3, + AsTupleNext4 x4, + AsTupleNext5 x5) const + -> decltype(std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4), + std::move(x5))) { + return std::make_tuple( + std::move(x1), + std::move(x2), + std::move(x3), + std::move(x4), + std::move(x5));} + }; #endif //RXCPP_USE_VARIADIC_TEMPLATES struct pass_through { diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index cc1e88b..ba50526 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -98,6 +98,14 @@ namespace rxcpp -> decltype(from(Merge(obj, source...))) { return from(Merge(obj, source...)); } +#else + template + auto merge(const MergeSource& source) + -> decltype(from(Merge(obj, source))) { + return from(Merge(obj, source)); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES +#if RXCPP_USE_VARIADIC_TEMPLATES template auto zip(S selector, const ZipSource&... source) -> decltype(from(Zip(selector, obj, source...))) { @@ -108,6 +116,19 @@ namespace rxcpp -> decltype(from(Zip(util::as_tuple(), obj, source...))) { return from(Zip(util::as_tuple(), obj, source...)); } +#else + template + auto zip(S selector, const ZipSource& source) + -> decltype(from(Zip(selector, obj, source))) { + return from(Zip(selector, obj, source)); + } + template + auto zip(const Zip1Source& source) + -> decltype(from(Zip(util::as_tuple(), obj, source))) { + return from(Zip(util::as_tuple(), obj, source)); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES +#if RXCPP_USE_VARIADIC_TEMPLATES template auto combine_latest(S selector, const CombineLSource&... source) -> decltype(from(CombineLatest(selector, obj, source...))) { @@ -118,6 +139,17 @@ namespace rxcpp -> decltype(from(CombineLatest(util::as_tuple(), obj, source...))) { return from(CombineLatest(util::as_tuple(), obj, source...)); } +#else + template + auto combine_latest(S selector, const CombineLSource& source) + -> decltype(from(CombineLatest(selector, obj, source))) { + return from(CombineLatest(selector, obj, source)); + } + template + auto combine_latest(const CombineLSource& source) + -> decltype(from(CombineLatest(util::as_tuple(), obj, source))) { + return from(CombineLatest(util::as_tuple(), obj, source)); + } #endif //RXCPP_USE_VARIADIC_TEMPLATES template auto where(P predicate) -> decltype(from(Where(obj, predicate))) { @@ -188,6 +220,10 @@ namespace rxcpp auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { return from(Delay(obj, due, scheduler)); } + auto throttle(Scheduler::clock::duration due, Scheduler::shared scheduler) + -> decltype(from(Throttle(obj, due, scheduler))) { + return from(Throttle(obj, due, scheduler)); + } auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { return from(LimitWindow(obj, milliseconds)); } @@ -230,12 +266,99 @@ namespace rxcpp auto result = Subscribe(obj, onNext, onComplete, onError); return result; } -#if RXCPP_USE_VARIADIC_TEMPLATES +#if RXCPP_USE_VARIADIC_TEMPLATE template auto chain(ChainArg&&... arg) -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)...))) { return from(rxcpp_chain(Tag(), obj, std::forward(arg)...)); } +#else + template + auto chain() + -> decltype(from(rxcpp_chain(Tag(), obj))) { + return from(rxcpp_chain(Tag(), obj)); + } + template + auto chain(ChainArg&& arg) + -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)))) { + return from(rxcpp_chain(Tag(), obj, std::forward(arg))); + } + template + auto chain( + ChainArg1&& arg1, + ChainArg2&& arg2) + -> decltype(from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2)))) { + return from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2))); + } + template + auto chain( + ChainArg1&& arg1, + ChainArg2&& arg2, + ChainArg3&& arg3) + -> decltype(from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3)))) { + return from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3))); + } + template + auto chain( + ChainArg1&& arg1, + ChainArg2&& arg2, + ChainArg3&& arg3, + ChainArg4&& arg4) + -> decltype(from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3), + std::forward(arg4)))) { + return from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3), + std::forward(arg4))); + } + template + auto chain( + ChainArg1&& arg1, + ChainArg2&& arg2, + ChainArg3&& arg3, + ChainArg4&& arg4, + ChainArg5&& arg5) + -> decltype(from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3), + std::forward(arg4), + std::forward(arg5)))) { + return from(rxcpp_chain(Tag(), obj, + std::forward(arg1), + std::forward(arg2), + std::forward(arg3), + std::forward(arg4), + std::forward(arg5))); + } #endif }; diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index c1913ae..6f48364 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -34,7 +34,6 @@ void PrintPrimes(int n) void Combine(int n) { -#if RXCPP_USE_VARIADIC_TEMPLATES auto input1 = std::make_shared(); auto input2 = std::make_shared(); auto output = std::make_shared(); @@ -58,9 +57,6 @@ void Combine(int n) [](int p2, int p1) { cout << p2 << " =combined=> " << p1 << endl; })); -#else - (void)n; -#endif //RXCPP_USE_VARIADIC_TEMPLATES } struct Count { @@ -114,7 +110,6 @@ rxcpp::Binder>> rxcpp_chain(record&&, const template void Zip(int n) { -#if RXCPP_USE_VARIADIC_TEMPLATES auto input1 = std::make_shared(); auto input2 = std::make_shared(); auto output = std::make_shared(); @@ -152,14 +147,10 @@ void Zip(int n) cout << "zipcount:" << zipcount.nexts << ", " << zipcount.completions << ", " << zipcount.errors << ", " << zipcount.disposals << endl; cout << "takecount:" << takecount.nexts << ", " << takecount.completions << ", " << takecount.errors << ", " << takecount.disposals << endl; cout << "outputcount:" << outputcount.nexts << ", " << outputcount.completions << ", " << outputcount.errors << ", " << outputcount.disposals << endl; -#else - (void)n; -#endif //RXCPP_USE_VARIADIC_TEMPLATES } void Merge(int n) { -#if RXCPP_USE_VARIADIC_TEMPLATES auto input1 = std::make_shared(); auto input2 = std::make_shared(); auto output = std::make_shared(); @@ -185,9 +176,48 @@ void Merge(int n) [](const char* s, int p) { cout << s << p << endl; })); -#else - (void)n; -#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + +void PrintIntervals(int n) { + using namespace std::chrono; + typedef steady_clock clock; + struct Tick { + Tick(size_t c, clock::time_point at) : cursor(c), at(at) {} + size_t cursor; + clock::time_point at; + }; + auto source = std::make_shared(); + auto subject = rxcpp::CreateSubject(); + + cout << "Intervals of .5 second: " << endl; + rxcpp::from(subject) + .zip(rxcpp::from(subject).skip(1).publish()) + .select(rxcpp::MakeTupleDispatch( + [=](Tick a, Tick b){ + return duration_cast(b.at.time_since_epoch()) - + duration_cast(a.at.time_since_epoch());})) + .to_vector() + .subscribe( + // on next + [=](std::vector d) + { + cout << endl; + auto l = std::max_element(d.begin(), d.end()); + auto s = std::min_element(d.begin(), d.end()); + cout << "range: " << s->count() << "-" << l->count() << endl; + }); + + rxcpp::from(rxcpp::Interval(std::chrono::milliseconds(500), source)) + .select([](size_t interval){return Tick(interval, clock::now());}) + .take(n) + .for_each( + // on next + [=](Tick t) + { + cout << "."; + subject->OnNext(std::move(t)); + }); + subject->OnCompleted(); } std::shared_ptr> Data( @@ -296,6 +326,7 @@ void innerScheduler() { int main(int argc, char* argv[]) { try { + PrintIntervals(10); PrintPrimes(20); cout << "Zip Immediate" << endl; Zip(20); -- GitLab From 57ca6b685eb6cbb4e5233551be1b66da5e5a0846 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 31 Mar 2013 12:09:25 -0700 Subject: [PATCH 034/782] adds from_iterable from_iterable(r, opt - scheduler) adapts any r that satisfies std::begin(r) and std::end(r) into an Observable --- Ix/CPP/src/cpplinq/util.hpp | 10 +---- Rx/CPP/src/cpprx/rx-base.hpp | 5 --- Rx/CPP/src/cpprx/rx-operators.hpp | 63 +++++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-util.hpp | 43 +-------------------- Rx/CPP/src/cpprx/rx.hpp | 10 +++++ Rx/CPP/testbench/testbench.cpp | 38 ++++++++++++++++--- 6 files changed, 108 insertions(+), 61 deletions(-) diff --git a/Ix/CPP/src/cpplinq/util.hpp b/Ix/CPP/src/cpplinq/util.hpp index 953a48a..ee3d7eb 100644 --- a/Ix/CPP/src/cpplinq/util.hpp +++ b/Ix/CPP/src/cpplinq/util.hpp @@ -192,15 +192,7 @@ namespace cpplinq { namespace util { return is_set ? reinterpret_cast(&storage) : 0; } - void set(const T& value) { - if (is_set) { - *reinterpret_cast(&storage) = value; - } else { - new (reinterpret_cast(&storage)) T(value); - is_set = true; - } - } - void set(T&& value) { + void set(T value) { if (is_set) { *reinterpret_cast(&storage) = std::move(value); } else { diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 091e6e5..21921c1 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -319,11 +319,6 @@ namespace rxcpp return util::tuple_dispatch(std::forward(target), std::forward(tuple));} #if RXCPP_USE_VARIADIC_TEMPLATES - template - auto ConcatTuple(Lhs&& lhs, Rhs&& rhs) -> - decltype(util::tuple_concat(std::forward(lhs), std::forward(rhs))) { - return util::tuple_concat(std::forward(lhs), std::forward(rhs));} - template auto TieTuple(T&& t) -> decltype(util::tuple_tie(std::forward(t))) { diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 293d2b5..0319949 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -395,6 +395,69 @@ namespace rxcpp }); } + using std::begin; + using std::end; + template + auto FromIterable( + Range r, + Scheduler::shared scheduler = nullptr) + -> std::shared_ptr> + { + typedef decltype(begin(r)) It; + typedef decltype(*begin(r)) T; + + if (!scheduler) {scheduler = std::make_shared();} + auto range = std::make_shared(std::move(r)); + + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + explicit State(std::shared_ptr rangeArg) : cancel(false) { + this->range = std::move(rangeArg); + this->r_cursor = begin(*this->range); + this->r_end = end(*this->range); + } + bool cancel; + std::shared_ptr range; + It r_cursor; + It r_end; + }; + auto state = std::make_shared(range); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + try { + if (state->cancel) + return Disposable::Empty(); + + if (state->r_cursor == state->r_end) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(*state->r_cursor); + ++state->r_cursor; + return s->Schedule(std::move(self)); + } + } catch (...) { + observer->OnError(std::current_exception()); + } + return Disposable::Empty(); + }))); + + return cd; + }); + } ////////////////////////////////////////////////////////////////////// // diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index cf7ad04..a7f2a23 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -94,15 +94,7 @@ namespace rxcpp { namespace util { return is_set ? reinterpret_cast(&storage) : 0; } - void set(const T& value) { - if (is_set) { - *reinterpret_cast(&storage) = value; - } else { - new (reinterpret_cast(&storage)) T(value); - is_set = true; - } - } - void set(T&& value) { + void set(T value) { if (is_set) { *reinterpret_cast(&storage) = std::move(value); } else { @@ -179,39 +171,6 @@ namespace rxcpp { namespace util { return detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t)); } - namespace detail { - template - struct tuple_concat; - template - struct tuple_concat, tuple_indices> { - template - static - auto concatenate(LhsTuple&& lhs, RhsTuple&& rhs) - -> decltype (std::tuple< - typename std::tuple_element::type>::type..., - typename std::tuple_element::type>::type...>( - std::get(std::forward(lhs))..., - std::get(std::forward(rhs))...)) { - return std::tuple< - typename std::tuple_element::type>::type..., - typename std::tuple_element::type>::type...>( - std::get(std::forward(lhs))..., - std::get(std::forward(rhs))...); - } - };} - - template - auto tuple_concat(LhsTuple&& lhs, RhsTuple&& rhs) - -> decltype(detail::tuple_concat< - typename make_tuple_indices::type>::type, - typename make_tuple_indices::type>::type>:: - concatenate(std::forward(lhs), std::forward(rhs))) { - return detail::tuple_concat< - typename make_tuple_indices::type>::type, - typename make_tuple_indices::type>::type>:: - concatenate(std::forward(lhs), std::forward(rhs)); - } - namespace detail { template struct tuple_tie; diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index ba50526..562f097 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -382,6 +382,16 @@ namespace rxcpp Binder from(Binder binder) { return std::move(binder); } + template + auto from_iterable(Range r) + -> decltype(from(FromIterable(std::move(r)))) { + return from(FromIterable(std::move(r))); } + + template + auto from_iterable(Range r, Scheduler::shared scheduler) + -> decltype(from(FromIterable(std::move(r), std::move(scheduler)))) { + return from(FromIterable(std::move(r), std::move(scheduler))); } + template T item(const Binder>>&); diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 6f48364..fdb0dd5 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -18,15 +18,42 @@ using namespace std; bool IsPrime(int x); +vector vector_range(int start, int end) +{ + vector v; + for (int i = start; i < end; ++i) + v.push_back(i); + return v; +} + +void IxToRx(int n) { + std::cout << "IxToRx: first " << n << " primes squared" << endl; + auto values = vector_range(2, n * 10); + + auto primes = cpplinq::from(values) + .where(IsPrime) + .select([](int x) { return std::make_pair(x, x*x); }); + + auto input = std::make_shared(); + auto output = std::make_shared(); + rxcpp::from_iterable(primes, input) + .take(n) + .observe_on(output) + .for_each(rxcpp::MakeTupleDispatch( + [](int p, int s) { + cout << p << " =square=> " << s << endl; + })); +} + void PrintPrimes(int n) { - std::cout << "first " << n << " primes squared" << endl; + std::cout << "Rx: first " << n << " primes squared" << endl; auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values) + rxcpp::from(values) .where(IsPrime) .select([](int x) { return std::make_pair(x, x*x); }) .take(n) - .subscribe(rxcpp::MakeTupleDispatch( + .for_each(rxcpp::MakeTupleDispatch( [](int p, int s) { cout << p << " =square=> " << s << endl; })); @@ -189,7 +216,7 @@ void PrintIntervals(int n) { auto source = std::make_shared(); auto subject = rxcpp::CreateSubject(); - cout << "Intervals of .5 second: " << endl; + cout << n << " Intervals of .5 second: " << endl; rxcpp::from(subject) .zip(rxcpp::from(subject).skip(1).publish()) .select(rxcpp::MakeTupleDispatch( @@ -204,7 +231,7 @@ void PrintIntervals(int n) { cout << endl; auto l = std::max_element(d.begin(), d.end()); auto s = std::min_element(d.begin(), d.end()); - cout << "range: " << s->count() << "-" << l->count() << endl; + cout << "range: " << s->count() << "ms-" << l->count() << "ms" << endl; }); rxcpp::from(rxcpp::Interval(std::chrono::milliseconds(500), source)) @@ -327,6 +354,7 @@ int main(int argc, char* argv[]) { try { PrintIntervals(10); + IxToRx(20); PrintPrimes(20); cout << "Zip Immediate" << endl; Zip(20); -- GitLab From 6a7b68113a3787da5eef670ae092e0ce9f052b32 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 31 Mar 2013 21:18:25 -0700 Subject: [PATCH 035/782] change from_iterable to from(Iterate()) --- Rx/CPP/src/cpprx/rx-operators.hpp | 2 +- Rx/CPP/src/cpprx/rx.hpp | 10 ---------- Rx/CPP/testbench/testbench.cpp | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 0319949..963bd02 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -398,7 +398,7 @@ namespace rxcpp using std::begin; using std::end; template - auto FromIterable( + auto Iterate( Range r, Scheduler::shared scheduler = nullptr) -> std::shared_ptr> diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 562f097..ba50526 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -382,16 +382,6 @@ namespace rxcpp Binder from(Binder binder) { return std::move(binder); } - template - auto from_iterable(Range r) - -> decltype(from(FromIterable(std::move(r)))) { - return from(FromIterable(std::move(r))); } - - template - auto from_iterable(Range r, Scheduler::shared scheduler) - -> decltype(from(FromIterable(std::move(r), std::move(scheduler)))) { - return from(FromIterable(std::move(r), std::move(scheduler))); } - template T item(const Binder>>&); diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index fdb0dd5..7e28cfa 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -36,7 +36,7 @@ void IxToRx(int n) { auto input = std::make_shared(); auto output = std::make_shared(); - rxcpp::from_iterable(primes, input) + rxcpp::from(Iterate(primes, input)) .take(n) .observe_on(output) .for_each(rxcpp::MakeTupleDispatch( @@ -241,7 +241,7 @@ void PrintIntervals(int n) { // on next [=](Tick t) { - cout << "."; + cout << "." << flush; subject->OnNext(std::move(t)); }); subject->OnCompleted(); -- GitLab From 2c5d2fd4ab4bc412d67299a72d1e3c287aa44dca Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 4 Apr 2013 13:44:45 -0700 Subject: [PATCH 036/782] add concat --- Rx/CPP/src/cpprx/rx-operators.hpp | 171 +++++++++++++++++++++++++++++- Rx/CPP/src/cpprx/rx.hpp | 34 ++++++ Rx/CPP/testbench/testbench.cpp | 33 ++++++ 3 files changed, 235 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 963bd02..939e70b 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -401,10 +401,10 @@ namespace rxcpp auto Iterate( Range r, Scheduler::shared scheduler = nullptr) - -> std::shared_ptr> + -> std::shared_ptr::type>> { typedef decltype(begin(r)) It; - typedef decltype(*begin(r)) T; + typedef typename std::decay::type T; if (!scheduler) {scheduler = std::make_shared();} auto range = std::make_shared(std::move(r)); @@ -544,7 +544,7 @@ namespace rxcpp }); }); } - + template auto SelectMany( const std::shared_ptr>& source, @@ -681,6 +681,171 @@ namespace rxcpp return cd; }); } + + template + ObservableT Concat( + const std::shared_ptr>& source) + { + typedef typename observable_item::type T; + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + bool completed; + bool subscribed; + bool cancel; + std::queue queue; + Scheduler::shared scheduler; + std::mutex lock; + }; + auto state = std::make_shared(); + state->cancel = false; + state->subscribed = 0; + state->scheduler = std::make_shared(); + + ComposableDisposable cd; + + SharedDisposable sd; + cd.Add(sd); + + cd.Add(Disposable([=]{ + std::unique_lock guard(state->lock); + state->cancel = true; }) + ); + + cd.Add(Subscribe( + source, + // on next + [=](const ObservableT& sourceElement) + { + bool cancel = false; + bool subscribed = false; + Scheduler::shared sched; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + sched = state->scheduler; + if (!cancel) { + subscribed = state->subscribed; + state->queue.push(sourceElement); + state->subscribed = true; + sched = state->scheduler; + } + } + if (!cancel && !subscribed) { + sd.Set(sched->Schedule( + fix0([state, cd, sd, observer](Scheduler::shared s, std::function self) -> Disposable + { + try { + bool cancel = false; + bool finished = false; + ObservableT next; + { + std::unique_lock guard(state->lock); + finished = state->queue.empty(); + cancel = state->cancel; + if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} + } + if (!cancel && !finished) { + sd.Set(Subscribe( + next, + // on next + [=](const T& t) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + try { + if (!cancel) { + observer->OnNext(std::move(t)); + } + } catch (...) { + observer->OnError(std::current_exception()); + cd.Dispose(); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + bool subscribe = false; + { + std::unique_lock guard(state->lock); + finished = state->queue.empty() && state->completed; + subscribe = !state->queue.empty(); + state->subscribed = subscribe; + cancel = state->cancel; + } + if (!cancel) { + if (subscribe) {sd.Set(s->Schedule(std::move(self)));} + else if (finished) {observer->OnCompleted(); cd.Dispose();} + } + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + })); + } + } catch (...) { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + } + return Disposable::Empty(); + }))); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + state->completed = true; + finished = state->queue.empty() && !state->subscribed; + cancel = state->cancel; + } + if (!cancel && finished) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + })); + return cd; + }); + } namespace detail{ template diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index ba50526..7089131 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -38,6 +38,9 @@ namespace rxcpp BinderNested(Obj obj) : BinderBase(std::move(obj)) { } + + void select_many(); + void concat(); }; template @@ -58,6 +61,10 @@ namespace rxcpp -> decltype(from(SelectMany(obj, util::pass_through(), util::pass_through_second()))) { return from(SelectMany(obj, util::pass_through(), util::pass_through_second())); } + auto concat() + -> decltype(from(Concat(*(Obj*)nullptr))) { + return from(Concat(obj)); + } }; template @@ -82,6 +89,7 @@ namespace rxcpp auto select(S selector) -> decltype(from(Select(obj, selector))) { return from(Select(obj, selector)); } + using base::select_many; template auto select_many(CS collectionSelector) -> decltype(from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second()))) { @@ -151,6 +159,32 @@ namespace rxcpp return from(CombineLatest(util::as_tuple(), obj, source)); } #endif //RXCPP_USE_VARIADIC_TEMPLATES + + using base::concat; +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto concat(const ConcatSource&... source) + -> decltype(from(Concat(Iterate(std::vector())))) { + std::vector sources; + sources.push_back(obj); + std::make_tuple((sources.push_back(source), true)...); + return from(Concat(Iterate(std::move(sources)))); + } +#else + auto concat(const Obj& source) + -> decltype(from(Concat(Iterate(std::vector())))) { + std::vector sources; + sources.push_back(obj); + sources.push_back(source); + return from(Concat(Iterate(std::move(sources)))); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES + template + auto concat(Range range) + -> decltype(from(Concat(Iterate(range.insert(range.begin(), range.front()), range)))) { + range.insert(range.begin(), obj); + return from(Concat(Iterate(std::move(range)))); + } template auto where(P predicate) -> decltype(from(Where(obj, predicate))) { return from(Where(obj, predicate)); diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 7e28cfa..a610c67 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -59,6 +59,38 @@ void PrintPrimes(int n) })); } +void Concat(int n) +{ + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .where(IsPrime) + .select([](int prime){this_thread::yield(); return std::make_tuple("1:", prime);}) + .take(n/2) + .publish(); + + auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers + auto s2 = rxcpp::from(values2) + .subscribe_on(input2) + .where(IsPrime) + .select([](int prime){this_thread::yield(); return std::make_tuple("2:", prime);}) + .take(n/2) + .publish(); + + rxcpp::from(s2) + .concat(s1) + .take(n) + .observe_on(output) + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout << s << " =concat=> " << p << endl; + })); +} + void Combine(int n) { auto input1 = std::make_shared(); @@ -364,6 +396,7 @@ int main(int argc, char* argv[]) Zip(20); Combine(20); Merge(20); + Concat(20); innerScheduler(); innerScheduler(); -- GitLab From fd49e3e64be33c22e6071a79a4983e15c620dfc0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 6 Apr 2013 00:50:30 -0700 Subject: [PATCH 037/782] add BehaviorSubject --- Rx/CPP/src/cpprx/rx-base.hpp | 39 ++++++++ Rx/CPP/src/cpprx/rx-includes.hpp | 14 +++ Rx/CPP/src/cpprx/rx-operators.hpp | 146 +++++++++++++++++++++++++++--- Rx/CPP/src/cpprx/rx.hpp | 9 +- 4 files changed, 195 insertions(+), 13 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 21921c1..4a461a7 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -328,6 +328,9 @@ namespace rxcpp template class Subject; + template + class BehaviorSubject; + template class GroupedSubject; @@ -346,6 +349,9 @@ namespace rxcpp template struct is_observable>> {static const bool value = true;}; + template + struct is_observable>> {static const bool value = true;}; + template struct is_observable>> {static const bool value = true;}; @@ -382,16 +388,49 @@ namespace rxcpp template struct subject_item>> {typedef T type;}; + template + struct subject_item>> {typedef T type;}; + + template + struct subject_item>> {typedef T type;}; + template struct subject_observer; template struct subject_observer>> {typedef std::shared_ptr> type;}; + template + struct subject_observer>> {typedef std::shared_ptr> type;}; + template struct subject_observable; template struct subject_observable>> {typedef std::shared_ptr> type;}; + + template + struct subject_observable>> {typedef std::shared_ptr> type;}; + + template + std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + + template + std::shared_ptr> grouped_observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} } #endif diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index 8c861f0..eb57b0c 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -53,6 +53,20 @@ #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 #include "rx-util.hpp" #include "rx-base.hpp" diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 939e70b..234a02a 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -234,9 +234,6 @@ namespace rxcpp class Subject : public ObserverSubject, Subject>> { - public: - std::shared_ptr> observable(){return std::static_pointer_cast>(this->shared_from_this());} - std::shared_ptr> observer(){return std::static_pointer_cast>(this->shared_from_this());} }; template @@ -263,9 +260,6 @@ namespace rxcpp typedef ObserverSubject, GroupedSubject>>> base; public: GroupedSubject(K key) : base(std::move(key)) {} - std::shared_ptr> observable(){return std::static_pointer_cast>(this->shared_from_this());} - std::shared_ptr> observer(){return std::static_pointer_cast>(this->shared_from_this());} - std::shared_ptr> grouped_observable(){return std::static_pointer_cast>(this->shared_from_this());} }; template @@ -274,6 +268,128 @@ namespace rxcpp return std::make_shared>(std::move(key)); } + template + class BehaviorSubject : + public std::enable_shared_from_this>, + public Observable, + public Observer + { + std::mutex lock; + T value; + std::vector>> observers; + + void RemoveObserver(std::shared_ptr> toRemove) + { + std::unique_lock guard(lock); + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } + + BehaviorSubject(); + public: + + explicit BehaviorSubject(T t) : value(std::move(t)) {} + + virtual ~BehaviorSubject() { + // putting this first means that the observers + // will be destructed outside the lock + std::vector>> empty; + + std::unique_lock guard(lock); + using std::swap; + swap(observers, empty); + } + + virtual Disposable Subscribe(std::shared_ptr> observer) + { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + + try + { + { + std::unique_lock guard(lock); + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(observer); + } + observer->OnNext(value); + } + catch (...) + { + observer->OnError(std::current_exception()); + RemoveObserver(observer); + } + + return d; + } + + virtual void OnNext(T element) + { + std::unique_lock guard(lock); + auto local = observers; + value = std::move(element); + guard.unlock(); + for(auto& o : local) + { + try + { + if (o) { + o->OnNext(value); + } + } + catch (...) + { + o->OnError(std::current_exception()); + RemoveObserver(o); + } + } + } + virtual void OnCompleted() + { + std::unique_lock guard(lock); + auto local = std::move(observers); + guard.unlock(); + for(auto& o : local) + { + if (o) { + o->OnCompleted(); + } + } + } + virtual void OnError(const std::exception_ptr& error) + { + std::unique_lock guard(lock); + auto local = std::move(observers); + guard.unlock(); + for(auto& o : local) + { + if (o) { + o->OnError(error); + } + } + } + }; + + template + std::shared_ptr> CreateBehaviorSubject(Arg a) + { + return std::make_shared>(std::move(a)); + } + template struct fix0_thunk { F f; @@ -865,9 +981,9 @@ namespace rxcpp auto local = state; std::unique_lock guard(local->lock); std::get(local->latest) = element; - if (pending) { + if (!std::get(local->latestValid)) { + std::get(local->latestValid) = true; --local->pendingFirst; - pending = false; } if (local->pendingFirst == 0) { Latest args = local->latest; @@ -931,19 +1047,22 @@ namespace rxcpp typedef typename std::result_of::type result_type; typedef std::tuple>...> Sources; typedef std::tuple Latest; + typedef decltype(std::make_tuple((source, true)...)) LatestValid; struct State { typedef Latest Latest; typedef Sources Sources; typedef result_type result_type; typedef std::tuple_size SourcesSize; explicit State(S selector) - : pendingFirst(SourcesSize::value) + : latestValid() + , pendingFirst(SourcesSize::value) , pendingIssue(0) , pendingComplete(SourcesSize::value) , done(false) , selector(std::move(selector)) {} std::mutex lock; + LatestValid latestValid; size_t pendingFirst; size_t pendingIssue; size_t pendingComplete; @@ -953,7 +1072,7 @@ namespace rxcpp }; Sources sources(source...); // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); + std::shared_ptr state(new State(selector)); return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { @@ -974,19 +1093,22 @@ namespace rxcpp typedef typename std::result_of::type result_type; typedef std::tuple>, std::shared_ptr>> Sources; typedef std::tuple Latest; + typedef std::tuple LatestValid; struct State { typedef Latest Latest; typedef Sources Sources; typedef result_type result_type; typedef std::tuple_size SourcesSize; explicit State(S selector) - : pendingFirst(SourcesSize::value) + : latestValid() + , pendingFirst(SourcesSize::value) , pendingIssue(0) , pendingComplete(SourcesSize::value) , done(false) , selector(std::move(selector)) {} std::mutex lock; + LatestValid latestValid; size_t pendingFirst; size_t pendingIssue; size_t pendingComplete; @@ -1930,7 +2052,7 @@ namespace rxcpp // on next [=](const T& element) { - if (!state->hasValue || state->last != element) + if (!state->hasValue || !(state->last == element)) { observer->OnNext(element); state->last = element; diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 7089131..a083904 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -283,6 +283,9 @@ namespace rxcpp void for_each(OnNext onNext) { ForEach(obj, onNext); } + auto subscribe(std::shared_ptr> observer) -> decltype(obj->Subscribe(observer)) { + return obj->Subscribe(observer); + } template auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { auto result = Subscribe(obj, onNext); @@ -406,8 +409,12 @@ namespace rxcpp template Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } + return Binder>>(observable(obj)); } + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(observable(obj)); } + template Binder>> from(std::shared_ptr> obj) { return Binder>>(std::move(obj)); } -- GitLab From 5c4f6752fbf3a1bcb38ef302637a9410d0cee818 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 27 Apr 2013 12:37:26 -0700 Subject: [PATCH 038/782] RxC++: Disposable and Scheduler fixes --- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 41 +++++++-- Rx/CPP/src/cpprx/rx-base.hpp | 102 ++++++++++++++++----- Rx/CPP/src/cpprx/rx-operators.hpp | 43 ++++++--- Rx/CPP/src/cpprx/rx-scheduler.hpp | 92 ++++++++++++++----- Rx/CPP/src/cpprx/rx-windows.hpp | 12 ++- 5 files changed, 219 insertions(+), 71 deletions(-) diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index da3d39a..f1bf7a9 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -55,6 +55,11 @@ void CMainFrame::UserInit() // set up labels and query auto msg = L"Time flies like an arrow"; +#if LABEL_EXPRESSION_TRACING + auto start = worker->Now(); + auto ms = std::chrono::milliseconds(1); +#endif + for (int i = 0; msg[i]; ++i) { auto label = CreateLabelFromLetter(msg[i], this); @@ -64,19 +69,44 @@ void CMainFrame::UserInit() // user32 doesn't filter this for you: http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx auto s = rxcpp::from(mouseMove) - .select([](MouseMoveEventValue e) { return e.point; }) + .select([=](MouseMoveEventValue e) { + auto now = worker->Now(); +#if LABEL_EXPRESSION_TRACING + {std::wstringstream out; + out << L"input index: " << i << L", ms: " << ((now - start) / ms) + << L", x: " << e.point.x << L", y: " << e.point.y + << L", x: " << e.point.x+20*i << L", y: " << e.point.y-20 << std::endl; + OutputDebugString(out.str().c_str());} +#endif + return std::make_tuple(now, e.point); }) .distinct_until_changed() .delay(std::chrono::milliseconds(i * 100 + 1), worker) +#if LABEL_EXPRESSION_TRACING + .select(rxcpp::MakeTupleDispatch([=](rxcpp::Scheduler::clock::time_point time, CPoint point) { + {std::wstringstream out; + out << L"delayed index: " << i << L", ms: " << ((time - start) / ms) + << L", x: " << point.x << L", y: " << point.y + << L", x: " << point.x+20*i << L", y: " << point.y-20 << std::endl; + OutputDebugString(out.str().c_str());} + return std::make_tuple(time, point);;})) +#endif .observe_on(mainFormScheduler) - .subscribe([=](CPoint point) + .subscribe(rxcpp::MakeTupleDispatch([=](rxcpp::Scheduler::clock::time_point time, CPoint point) { +#if LABEL_EXPRESSION_TRACING + {std::wstringstream out; + out << L"observed index: " << i << L", ms: " << ((time - start) / ms) + << L", x: " << point.x << L", y: " << point.y + << L", x: " << point.x+20*i << L", y: " << point.y-20 << std::endl; + OutputDebugString(out.str().c_str());} +#endif label->SetWindowPos(nullptr, point.x+20*i, point.y-20, 20, 30, SWP_NOOWNERZORDER); label->Invalidate(); // repaint early, for fluid animation label->UpdateWindow(); - this->UpdateWindow(); - }); + //this->UpdateWindow(); + })); composableDisposable.Add(std::move(s)); } @@ -84,9 +114,6 @@ void CMainFrame::UserInit() void CMainFrame::OnClose() { - // TODO: figure out cause of crash -- until then, exit instead - ::ExitProcess(0); - // shutdown subscription. composableDisposable.Dispose(); diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 4a461a7..571f482 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -89,23 +89,49 @@ namespace rxcpp // reference handle type for a container for composing disposables class ComposableDisposable { + typedef std::shared_ptr shared_disposable; + typedef std::weak_ptr weak_disposable; struct State { - std::vector disposables; + std::vector disposables; std::mutex lock; bool isDisposed; State() : isDisposed(false) { } - void Add(Disposable&& d) + weak_disposable Add(Disposable&& d) + { + return Add(std::make_shared(std::move(d))); + } + weak_disposable Add(shared_disposable s) { std::unique_lock guard(lock); if (isDisposed) { guard.unlock(); - d.Dispose(); + s->Dispose(); } else { - disposables.emplace_back(std::move(d)); + auto end = std::end(disposables); + auto it = std::find(std::begin(disposables), end, s); + if (it == end) + { + disposables.emplace_back(s); + } + } + return s; + } + void Remove(weak_disposable w) + { + std::unique_lock guard(lock); + auto s = w.lock(); + if (s) + { + auto end = std::end(disposables); + auto it = std::find(std::begin(disposables), end, s); + if (it != end) + { + disposables.erase(it); + } } } void Dispose() @@ -119,22 +145,31 @@ namespace rxcpp guard.unlock(); std::for_each(v.begin(), v.end(), - [](Disposable& d) { - d.Dispose(); }); + [](shared_disposable& d) { + d->Dispose(); }); } } }; - std::shared_ptr state; + mutable std::shared_ptr state; public: - ComposableDisposable() : state(new State) + ComposableDisposable() + : state(std::make_shared()) + { + } + weak_disposable Add(shared_disposable s) const { + return state->Add(std::move(s)); } - void Add(Disposable d) const + weak_disposable Add(Disposable d) const { - state->Add(std::move(d)); + return state->Add(std::move(d)); + } + void Remove(weak_disposable w) const + { + state->Remove(w); } void Dispose() const { @@ -186,6 +221,20 @@ namespace rxcpp : state(new State(std::move(scheduler), std::move(disposable))) { } + ScheduledDisposable(const ScheduledDisposable& o) + : state(o.state) + { + } + ScheduledDisposable(ScheduledDisposable&& o) + : state(std::move(o.state)) + { + o.state = nullptr; + } + ScheduledDisposable& operator=(ScheduledDisposable o) { + using std::swap; + swap(o.state, state); + return *this; + } void Dispose() const { state->Dispose(); @@ -202,37 +251,44 @@ namespace rxcpp } }; - class SharedDisposable + class SerialDisposable { - typedef std::function dispose_type; - - struct State : public std::enable_shared_from_this + struct State { mutable Disposable disposable; + mutable bool disposed; mutable std::mutex lock; - State() : disposable(Disposable::Empty()) {} + State() : disposable(Disposable::Empty()), disposed(false) {} void Set(Disposable disposeArg) const - { + { std::unique_lock guard(lock); - {using std::swap; swap(disposable, disposeArg);} + if (!disposed) { + using std::swap; + swap(disposable, disposeArg); + } + guard.unlock(); + disposeArg.Dispose(); } void Dispose() { std::unique_lock guard(lock); - auto local = std::move(disposable); - guard.unlock(); - local.Dispose(); + if (!disposed) { + disposed = true; + auto local = std::move(disposable); + guard.unlock(); + local.Dispose(); + } } }; - std::shared_ptr state; + mutable std::shared_ptr state; public: - SharedDisposable() - : state(new State()) + SerialDisposable() + : state(std::make_shared()) { } void Dispose() const diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 234a02a..1c726ca 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -26,17 +26,19 @@ namespace rxcpp virtual Disposable Subscribe(std::shared_ptr> observer) { if (CurrentThreadScheduler::IsScheduleRequired()) { + SerialDisposable sd; auto scheduler = std::make_shared(); - return scheduler->Schedule( + scheduler->Schedule( [=](Scheduler::shared) -> Disposable { try { - return subscribe(observer); + sd.Set(subscribe(observer)); } catch (...) { observer->OnError(std::current_exception()); } return Disposable::Empty(); } ); + return sd; } try { return subscribe(observer); @@ -83,16 +85,16 @@ namespace rxcpp if(onCompleted) { onCompleted(); - clear(); } + clear(); } virtual void OnError(const std::exception_ptr& error) { if(onError) { onError(error); - clear(); } + clear(); } void clear() { @@ -481,7 +483,7 @@ namespace rxcpp size_t cursor; std::shared_ptr> observer; ComposableDisposable cd; - SharedDisposable sd; + SerialDisposable sd; void Tick(Scheduler::shared s){ observer->OnNext(cursor); @@ -822,7 +824,7 @@ namespace rxcpp ComposableDisposable cd; - SharedDisposable sd; + SerialDisposable sd; cd.Add(sd); cd.Add(Disposable([=]{ @@ -1858,36 +1860,47 @@ namespace rxcpp ComposableDisposable cd; - cd.Add(Disposable([=]{ *cancel = true; })); + cd.Add(Disposable([=]{ + *cancel = true; })); - SharedDisposable sd; - cd.Add(sd); + SerialDisposable sd; + auto wsd = cd.Add(sd); cd.Add(Subscribe( source, // on next [=](const T& element) { - sd.Set(scheduler->Schedule( + auto sched_disposable = scheduler->Schedule( due, [=] (Scheduler::shared){ if (!*cancel) observer->OnNext(element); return Disposable::Empty(); } - )); + ); + auto ssd = wsd.lock(); + if (ssd) + { + *ssd.get() = std::move(sched_disposable); + } }, // on completed [=] { - sd.Set(scheduler->Schedule( + auto sched_disposable = scheduler->Schedule( due, [=](Scheduler::shared){ if (!*cancel) observer->OnCompleted(); return Disposable::Empty(); } - )); + ); + auto ssd = wsd.lock(); + if (ssd) + { + *ssd.get() = std::move(sched_disposable); + } }, // on error [=](const std::exception_ptr& error) @@ -1920,7 +1933,7 @@ namespace rxcpp ComposableDisposable cd; - SharedDisposable sd; + SerialDisposable sd; cd.Add(sd); cd.Add(Subscribe( @@ -2083,7 +2096,7 @@ namespace rxcpp { ComposableDisposable cd; - SharedDisposable sd; + SerialDisposable sd; cd.Add(sd); cd.Add(scheduler->Schedule([=](Scheduler::shared){ diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 7ecd850..2757acd 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -229,9 +229,9 @@ namespace rxcpp typedef std::function Action; Scheduler::shared scheduler; - std::shared_ptr> observer; std::atomic trampoline; - SharedDisposable sd; + mutable std::shared_ptr> observer; + mutable SerialDisposable sd; mutable std::queue queue; mutable std::mutex lock; @@ -245,8 +245,14 @@ namespace rxcpp void Dispose() const { - std::unique_lock guard(lock); - while (!queue.empty()) {queue.pop();} + SerialDisposable sd; + { + std::unique_lock guard(lock); + while (!queue.empty()) {queue.pop();} + using std::swap; + swap(sd, this->sd); + observer= nullptr; + } sd.Dispose(); } operator Disposable() const @@ -319,7 +325,7 @@ namespace rxcpp sd.Set(sched->Schedule( [keepAlive](Scheduler::shared sched){ return keepAlive->Run(sched);})); - return Disposable::Empty(); + return sd; } // only decrement when no further work is scheduled @@ -341,13 +347,11 @@ namespace rxcpp std::atomic trampoline; mutable std::mutex lock; mutable std::condition_variable wake; - mutable std::atomic exit; CurrentThreadQueue::ThreadLocalQueue* queue; public: Derecurser() : trampoline(0) - , exit(false) { } virtual ~Derecurser() @@ -365,9 +369,12 @@ namespace rxcpp EnsureThreadResult result(util::maybe(), Disposable::Empty()); auto cancelable = std::make_shared(std::move(work)); + std::get<1>(result) = Disposable([cancelable]{ + *cancelable.get() = nullptr;}); std::unique_lock guard(lock); - RXCPP_UNWIND(unwindTrampoline, [&]{--trampoline;}); + RXCPP_UNWIND(unwindTrampoline, [&]{ + --trampoline;}); if (++trampoline == 1) { @@ -375,8 +382,6 @@ namespace rxcpp CurrentThreadQueue::DestroyQueue(queue); queue = nullptr;}); queue = CurrentThreadQueue::CreateQueue(owner).release(); - std::get<1>(result) = Disposable([cancelable]{ - *cancelable.get() = nullptr;}); queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); auto local = std::static_pointer_cast(shared_from_this()); @@ -390,8 +395,6 @@ namespace rxcpp } else { - std::get<1>(result) = Disposable([cancelable]{ - *cancelable.get() = nullptr;}); queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); wake.notify_one(); } @@ -402,7 +405,8 @@ namespace rxcpp void Run(CurrentThreadQueue::ThreadLocalQueue* queue) { auto keepAlive = shared_from_this(); { - RXCPP_UNWIND_AUTO([&]{--trampoline;}); + RXCPP_UNWIND_AUTO([&]{ + --trampoline;}); std::unique_lock guard(lock); @@ -411,37 +415,81 @@ namespace rxcpp CurrentThreadQueue::DestroyQueue(); queue = nullptr;}); - while(!exit && (!CurrentThreadQueue::empty() || trampoline > 1)) + auto start = queue->scheduler->Now(); + auto ms = std::chrono::milliseconds(1); + while(!CurrentThreadQueue::empty() || trampoline > 1) { + auto now = queue->scheduler->Now(); +#if 0 + {std::wstringstream out; + out << L"eventloop (run) pending: " << std::boolalpha << CurrentThreadQueue::empty() + << L", now: " << ((now - start) / ms); + if (!CurrentThreadQueue::empty()) { + out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} + out << std::endl; + OutputDebugString(out.str().c_str());} +#endif if (CurrentThreadQueue::empty()) { +#if 0 + {std::wstringstream out; + out << L"eventloop (wait for work) pending: " << std::boolalpha << CurrentThreadQueue::empty() + << L", now: " << ((now - start) / ms); + out << std::endl; + OutputDebugString(out.str().c_str());} +#endif wake.wait(guard, [&](){ - return exit || !CurrentThreadQueue::empty() || trampoline == 1;}); + return !CurrentThreadQueue::empty() || trampoline == 1;}); continue; } auto item = &CurrentThreadQueue::top(); - if (!item->work || !*item->work.get()) {CurrentThreadQueue::pop(); continue;} + if (!item->work || !*item->work.get()) { +#if 0 + {std::wstringstream out; + out << L"eventloop (pop disposed work) pending: " << std::boolalpha << CurrentThreadQueue::empty() + << L", now: " << ((now - start) / ms); + if (!CurrentThreadQueue::empty()) { + out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} + out << std::endl; + OutputDebugString(out.str().c_str());} +#endif + CurrentThreadQueue::pop(); continue;} // wait until the work is due - if (!exit && queue->scheduler->Now() < item->due) + if (now < item->due) { +#if 0 + {std::wstringstream out; + out << L"eventloop (wait for due) pending: " << std::boolalpha << CurrentThreadQueue::empty() + << L", now: " << ((now - start) / ms); + if (!CurrentThreadQueue::empty()) { + out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} + out << std::endl; + OutputDebugString(out.str().c_str());} +#endif wake.wait_until(guard, item->due); continue; } - if (exit || CurrentThreadQueue::empty()) {break;} - if (!item->work || !*item->work.get()) {CurrentThreadQueue::pop(); continue;} - +#if 0 + {std::wstringstream out; + out << L"eventloop (dispatch) pending: " << std::boolalpha << CurrentThreadQueue::empty() + << L", now: " << ((now - start) / ms); + if (!CurrentThreadQueue::empty()) { + out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} + out << std::endl; + OutputDebugString(out.str().c_str());} +#endif // dispatch work auto work = std::move(*item->work.get()); *item->work.get() = nullptr; CurrentThreadQueue::pop(); - RXCPP_UNWIND_AUTO([&]{guard.lock();}); + RXCPP_UNWIND_AUTO([&]{ + guard.lock();}); guard.unlock(); LocalScheduler::Do(work, queue->scheduler); } } - exit = false; } }; diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 7d64a1b..4af1b81 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -107,10 +107,11 @@ namespace rxcpp { namespace win32 { struct Queue; typedef std::pair Item; + typedef std::pair> PriorityItem; typedef std::priority_queue< - std::pair>, - std::vector>>, + PriorityItem, + std::vector, compare_work > ScheduledWork; @@ -157,18 +158,19 @@ namespace rxcpp { namespace win32 { static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static WindowClass* windowClass; + WindowClass* windowClass = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); switch (message) { case WM_NCCREATE: { windowClass = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); + SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(reinterpret_cast(windowClass))); } break; case WM_NCDESTROY: { delete windowClass; - windowClass = nullptr; + SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L); } break; case WM_TIMER: @@ -176,12 +178,14 @@ namespace rxcpp { namespace win32 { { bool destroy = false; HWND window = NULL; + std::vector> expired; { std::unique_lock guard(windowClass->queue->lock); while (!windowClass->queue->scheduledWork.empty() && !windowClass->queue->scheduledWork.top().second.get()->second) { // discard the disposed items + expired.push_back(windowClass->queue->scheduledWork.top().second); windowClass->queue->scheduledWork.pop(); } -- GitLab From 4fc2ba3977cf506ce2191f5cfd3898cef245a259 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 15 Jun 2013 17:00:49 -0700 Subject: [PATCH 039/782] fixes for error propagation --- Rx/CPP/src/cpprx/rx-operators.hpp | 467 +++++++++++++++++------------- Rx/CPP/testbench/testbench.cpp | 30 +- 2 files changed, 274 insertions(+), 223 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 1c726ca..4583adf 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -12,6 +12,68 @@ namespace rxcpp ////////////////////////////////////////////////////////////////////// // // constructors + template + struct CreatedAutoDetachObserver : public Observer + { + std::shared_ptr> observer; + SerialDisposable disposable; + + virtual ~CreatedAutoDetachObserver() { + clear(); + } + + virtual void OnNext(const T& element) + { + if (observer) { + RXCPP_UNWIND(disposer, [&](){ + disposable.Dispose(); + }); + observer->OnNext(element); + disposer.dismiss(); + } + } + virtual void OnCompleted() + { + if (observer) { + RXCPP_UNWIND(disposer, [&](){ + disposable.Dispose(); + }); + std::shared_ptr> final; + using std::swap; + swap(final, observer); + final->OnCompleted(); + disposer.dismiss(); + } + } + virtual void OnError(const std::exception_ptr& error) + { + if (observer) { + RXCPP_UNWIND(disposer, [&](){ + disposable.Dispose(); + }); + std::shared_ptr> final; + using std::swap; + swap(final, observer); + final->OnError(error); + disposer.dismiss(); + } + } + void clear() + { + observer = nullptr; + } + }; + + template + std::shared_ptr> CreateAutoDetachObserver( + std::shared_ptr> observer + ) + { + auto p = std::make_shared>(); + p->observer = std::move(observer); + + return p; + } template class CreatedObservable : public Observable @@ -25,25 +87,27 @@ namespace rxcpp } virtual Disposable Subscribe(std::shared_ptr> observer) { + auto autoDetachObserver = CreateAutoDetachObserver(std::move(observer)); + if (CurrentThreadScheduler::IsScheduleRequired()) { - SerialDisposable sd; auto scheduler = std::make_shared(); scheduler->Schedule( [=](Scheduler::shared) -> Disposable { try { - sd.Set(subscribe(observer)); + autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); } catch (...) { - observer->OnError(std::current_exception()); + autoDetachObserver->OnError(std::current_exception()); } return Disposable::Empty(); } ); - return sd; + return autoDetachObserver->disposable; } try { - return subscribe(observer); + autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); + return autoDetachObserver->disposable; } catch (...) { - observer->OnError(std::current_exception()); + autoDetachObserver->OnError(std::current_exception()); } return Disposable::Empty(); } @@ -68,33 +132,32 @@ namespace rxcpp virtual void OnNext(const T& element) { - try - { - if(onNext) - { - onNext(element); - } - } - catch (...) + if(onNext) { - OnError(std::current_exception()); + onNext(element); } } virtual void OnCompleted() { if(onCompleted) { - onCompleted(); - } - clear(); + std::function final; + using std::swap; + swap(final, onCompleted); + clear(); + final(); + } } virtual void OnError(const std::exception_ptr& error) { if(onError) { - onError(error); + std::function final; + using std::swap; + swap(final, onError); + clear(); + final(error); } - clear(); } void clear() { @@ -119,6 +182,14 @@ namespace rxcpp return p; } + struct SubjectState { + enum type { + Invalid, + Forwarding, + Completed, + Error + }; + }; template class ObservableSubject : @@ -127,6 +198,8 @@ namespace rxcpp { protected: std::mutex lock; + SubjectState::type state; + std::exception_ptr error; std::vector>> observers; virtual ~ObservableSubject() { @@ -139,6 +212,9 @@ namespace rxcpp swap(observers, empty); } + ObservableSubject() : state(SubjectState::Forwarding) { + } + void RemoveObserver(std::shared_ptr> toRemove) { std::unique_lock guard(lock); @@ -162,16 +238,24 @@ namespace rxcpp { std::unique_lock guard(lock); - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; + if (state == SubjectState::Completed) { + observer->OnCompleted(); + return Disposable::Empty(); + } else if (state == SubjectState::Error) { + observer->OnError(error); + return Disposable::Empty(); + } else { + for(auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } } + observers.push_back(std::move(observer)); + return d; } - observers.push_back(std::move(observer)); } - return d; } }; @@ -193,22 +277,15 @@ namespace rxcpp guard.unlock(); for(auto& o : local) { - try - { - if (o) { - o->OnNext(element); - } - } - catch (...) - { - o->OnError(std::current_exception()); - Base::RemoveObserver(o); + if (o) { + o->OnNext(element); } } } virtual void OnCompleted() { std::unique_lock guard(Base::lock); + Base::state = SubjectState::Completed; auto local = std::move(Base::observers); guard.unlock(); for(auto& o : local) @@ -221,6 +298,8 @@ namespace rxcpp virtual void OnError(const std::exception_ptr& error) { std::unique_lock guard(Base::lock); + Base::state = SubjectState::Error; + Base::error = error; auto local = std::move(Base::observers); guard.unlock(); for(auto& o : local) @@ -278,6 +357,8 @@ namespace rxcpp { std::mutex lock; T value; + SubjectState::type state; + std::exception_ptr error; std::vector>> observers; void RemoveObserver(std::shared_ptr> toRemove) @@ -291,7 +372,7 @@ namespace rxcpp BehaviorSubject(); public: - explicit BehaviorSubject(T t) : value(std::move(t)) {} + explicit BehaviorSubject(T t) : value(std::move(t)), state(SubjectState::Forwarding) {} virtual ~BehaviorSubject() { // putting this first means that the observers @@ -315,10 +396,15 @@ namespace rxcpp } }); - try { - { - std::unique_lock guard(lock); + std::unique_lock guard(lock); + if (state == SubjectState::Completed) { + observer->OnCompleted(); + return Disposable::Empty(); + } else if (state == SubjectState::Error) { + observer->OnError(error); + return Disposable::Empty(); + } else { for(auto& o : observers) { if (!o){ @@ -328,12 +414,9 @@ namespace rxcpp } observers.push_back(observer); } - observer->OnNext(value); } - catch (...) - { - observer->OnError(std::current_exception()); - RemoveObserver(observer); + if (state == SubjectState::Forwarding) { + observer->OnNext(value); } return d; @@ -347,22 +430,15 @@ namespace rxcpp guard.unlock(); for(auto& o : local) { - try - { - if (o) { - o->OnNext(value); - } - } - catch (...) - { - o->OnError(std::current_exception()); - RemoveObserver(o); + if (o) { + o->OnNext(value); } } } virtual void OnCompleted() { std::unique_lock guard(lock); + state = SubjectState::Completed; auto local = std::move(observers); guard.unlock(); for(auto& o : local) @@ -372,9 +448,11 @@ namespace rxcpp } } } - virtual void OnError(const std::exception_ptr& error) + virtual void OnError(const std::exception_ptr& errorArg) { std::unique_lock guard(lock); + state = SubjectState::Error; + error = errorArg; auto local = std::move(observers); guard.unlock(); for(auto& o : local) @@ -439,24 +517,20 @@ namespace rxcpp cd.Add(scheduler->Schedule( fix0([=](Scheduler::shared s, std::function self) -> Disposable { - try { - if (state->cancel) - return Disposable::Empty(); + if (state->cancel) + return Disposable::Empty(); - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - state->i += step; - return s->Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + return s->Schedule(std::move(self)); + } return Disposable::Empty(); }))); @@ -553,23 +627,19 @@ namespace rxcpp cd.Add(scheduler->Schedule( fix0([=](Scheduler::shared s, std::function self) -> Disposable { - try { - if (state->cancel) - return Disposable::Empty(); + if (state->cancel) + return Disposable::Empty(); - if (state->r_cursor == state->r_end) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(*state->r_cursor); - ++state->r_cursor; - return s->Schedule(std::move(self)); - } - } catch (...) { - observer->OnError(std::current_exception()); - } + if (state->r_cursor == state->r_end) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(*state->r_cursor); + ++state->r_cursor; + return s->Schedule(std::move(self)); + } return Disposable::Empty(); }))); @@ -710,54 +780,9 @@ namespace rxcpp if (!cancel) ++state->subscribed; } if (!cancel) { + decltype(collectionSelector(sourceElement)) collection; try { - auto collection = collectionSelector(sourceElement); - cd.Add(Subscribe( - collection, - // on next - [=](const CI& collectionElement) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - try { - if (!cancel) { - auto result = resultSelector(sourceElement, collectionElement); - observer->OnNext(std::move(result)); - } - } catch (...) { - observer->OnError(std::current_exception()); - cd.Dispose(); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; - } - if (!cancel && finished) - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); - cd.Dispose(); - })); + collection = collectionSelector(sourceElement); } catch (...) { bool cancel = false; { @@ -769,6 +794,53 @@ namespace rxcpp } cd.Dispose(); } + cd.Add(Subscribe( + collection, + // on next + [=](const CI& collectionElement) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + decltype(resultSelector(sourceElement, collectionElement)) result; + try { + result = resultSelector(sourceElement, collectionElement); + } catch (...) { + observer->OnError(std::current_exception()); + cd.Dispose(); + } + observer->OnNext(std::move(result)); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + cd.Dispose(); + })); } }, // on completed @@ -855,78 +927,61 @@ namespace rxcpp sd.Set(sched->Schedule( fix0([state, cd, sd, observer](Scheduler::shared s, std::function self) -> Disposable { - try { - bool cancel = false; - bool finished = false; - ObservableT next; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty(); - cancel = state->cancel; - if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} - } - if (!cancel && !finished) { - sd.Set(Subscribe( - next, - // on next - [=](const T& t) + bool cancel = false; + bool finished = false; + ObservableT next; + { + std::unique_lock guard(state->lock); + finished = state->queue.empty(); + cancel = state->cancel; + if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} + } + if (!cancel && !finished) { + sd.Set(Subscribe( + next, + // on next + [=](const T& t) + { + bool cancel = false; { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - try { - if (!cancel) { - observer->OnNext(std::move(t)); - } - } catch (...) { - observer->OnError(std::current_exception()); - cd.Dispose(); - } - }, - // on completed - [=] + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnNext(std::move(t)); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + bool subscribe = false; { - bool cancel = false; - bool finished = false; - bool subscribe = false; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty() && state->completed; - subscribe = !state->queue.empty(); - state->subscribed = subscribe; - cancel = state->cancel; - } - if (!cancel) { - if (subscribe) {sd.Set(s->Schedule(std::move(self)));} - else if (finished) {observer->OnCompleted(); cd.Dispose();} - } - }, - // on error - [=](const std::exception_ptr& error) + std::unique_lock guard(state->lock); + finished = state->queue.empty() && state->completed; + subscribe = !state->queue.empty(); + state->subscribed = subscribe; + cancel = state->cancel; + } + if (!cancel) { + if (subscribe) {sd.Set(s->Schedule(std::move(self)));} + else if (finished) {observer->OnCompleted(); cd.Dispose();} + } + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - })); - } - } catch (...) { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + })); } return Disposable::Empty(); }))); diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index a610c67..a0ace60 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -468,23 +468,19 @@ std::shared_ptr> Data( cd.Add(scheduler->Schedule( rxcpp::fix0([=](rxcpp::Scheduler::shared s, std::function self) -> rxcpp::Disposable { - try { - if (state->cancel) - return rxcpp::Disposable::Empty(); - - string line; - if (!!getline(state->data, line)) - { - observer->OnNext(std::move(line)); - return s->Schedule(std::move(self)); - } - else - { - observer->OnCompleted(); - } - } catch (...) { - observer->OnError(std::current_exception()); - } + if (state->cancel) + return rxcpp::Disposable::Empty(); + + string line; + if (!!getline(state->data, line)) + { + observer->OnNext(std::move(line)); + return s->Schedule(std::move(self)); + } + else + { + observer->OnCompleted(); + } return rxcpp::Disposable::Empty(); }) )); -- GitLab From 674bd2437fd527df2184e64ece3d64f94fc5bc45 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 17 Jun 2013 00:44:29 -0700 Subject: [PATCH 040/782] error fixes - phase 2 --- Rx/CPP/src/cpprx/rx-base.hpp | 9 +- Rx/CPP/src/cpprx/rx-operators.hpp | 248 ++++++++++++++++++------------ Rx/CPP/src/cpprx/rx-scheduler.hpp | 9 +- Rx/CPP/src/cpprx/rx-util.hpp | 8 +- Rx/CPP/testbench/testbench.cpp | 35 +++-- 5 files changed, 191 insertions(+), 118 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 571f482..e50ba13 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -204,7 +204,7 @@ namespace rxcpp auto local = std::move(scheduler); if (local) { auto keepAlive = shared_from_this(); - local->Schedule([keepAlive] (Scheduler::shared) { + local->Schedule([keepAlive] (Scheduler::shared) -> Disposable { keepAlive->disposable.Dispose(); return Disposable::Empty(); }); @@ -414,6 +414,7 @@ namespace rxcpp template struct is_observable>> {static const bool value = true;}; +namespace detail { template struct observable_item; @@ -422,6 +423,12 @@ namespace rxcpp template struct observable_item>> {typedef T type;}; +} + template + struct observable_item + { + typedef typename detail::observable_item::type>::type type; + }; template struct observable_observer; diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 4583adf..eaf8373 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -566,7 +566,7 @@ namespace rxcpp auto keepAlive = this->shared_from_this(); sd.Set(s->Schedule( last, - [this, keepAlive] (Scheduler::shared s){ + [this, keepAlive] (Scheduler::shared s) -> Disposable { Tick(s); return Disposable::Empty(); } @@ -578,7 +578,7 @@ namespace rxcpp state->last += state->due; state->sd.Set(scheduler->Schedule( state->last, - [=] (Scheduler::shared s){ + [=] (Scheduler::shared s) -> Disposable { state->Tick(s); return Disposable::Empty(); } @@ -717,8 +717,15 @@ namespace rxcpp // on next [=](const T& element) { - auto result = selector(element); - observer->OnNext(std::move(result)); + util::maybe result; + try { + result.set(selector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } }, // on completed [=] @@ -780,10 +787,10 @@ namespace rxcpp if (!cancel) ++state->subscribed; } if (!cancel) { - decltype(collectionSelector(sourceElement)) collection; + util::maybe collection; try { - collection = collectionSelector(sourceElement); - } catch (...) { + collection.set(collectionSelector(sourceElement)); + } catch(...) { bool cancel = false; { std::unique_lock guard(state->lock); @@ -794,53 +801,57 @@ namespace rxcpp } cd.Dispose(); } - cd.Add(Subscribe( - collection, - // on next - [=](const CI& collectionElement) - { - bool cancel = false; + if (!!collection) { + cd.Add(Subscribe( + *collection.get(), + // on next + [=](const CI& collectionElement) { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - decltype(resultSelector(sourceElement, collectionElement)) result; - try { - result = resultSelector(sourceElement, collectionElement); - } catch (...) { - observer->OnError(std::current_exception()); - cd.Dispose(); + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; } - observer->OnNext(std::move(result)); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; + if (!cancel) { + util::maybe result; + try { + result.set(resultSelector(sourceElement, collectionElement)); + } catch(...) { + observer->OnError(std::current_exception()); + cd.Dispose(); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } + } + }, + // on completed + [=] { - std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; - } - if (!cancel && finished) - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); - cd.Dispose(); - })); + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + cd.Dispose(); + })); + } } }, // on completed @@ -1034,7 +1045,6 @@ namespace rxcpp // on next [=](const typename std::tuple_element::type& element) { - static bool pending = true; auto local = state; std::unique_lock guard(local->lock); std::get(local->latest) = element; @@ -1044,14 +1054,22 @@ namespace rxcpp } if (local->pendingFirst == 0) { Latest args = local->latest; - auto result = util::tuple_dispatch(local->selector, args); - ++state->pendingIssue; - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(result)); + typedef decltype(util::tuple_dispatch(local->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(local->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + ++state->pendingIssue; + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(*result.get())); + } + --state->pendingIssue; } - --state->pendingIssue; if (state->done && state->pendingIssue == 0) { guard.unlock(); observer->OnCompleted(); @@ -1221,14 +1239,22 @@ namespace rxcpp // cause side-effect of pop on each queue std::make_tuple((queue.pop(), true)...); - ++state->pending; - auto result = util::tuple_dispatch(state->selector, args); - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(result)); + typedef decltype(util::tuple_dispatch(state->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(state->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + ++state->pending; + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(*result.get())); + } + --state->pending; } - --state->pending; } // build new array to check for any empty queue bool post_empties[] = {queue.empty()...}; @@ -1257,14 +1283,22 @@ namespace rxcpp queue1.pop(); queue2.pop(); - ++state->pending; - auto result = util::tuple_dispatch(state->selector, args); - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(result)); + typedef decltype(util::tuple_dispatch(state->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(state->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + ++state->pending; + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(*result.get())); + } + --state->pending; } - --state->pending; } // build new array to check for any empty queue bool post_empties[] = {queue1.empty(), queue2.empty()}; @@ -1520,8 +1554,14 @@ namespace rxcpp // on next [=](const T& element) { - auto result = predicate(element); - if (result) + typedef decltype(predicate(element)) U; + util::maybe result; + try { + result.set(predicate(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result && *result.get()) { observer->OnNext(element); } @@ -1555,7 +1595,7 @@ namespace rxcpp typedef std::shared_ptr> LocalGroupObservable; return CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observer) -> Disposable { typedef std::map>, L> Groups; @@ -1572,26 +1612,42 @@ namespace rxcpp // on next [=](const T& element) { - auto key = keySelector(element); - auto keySubject = CreateGroupedSubject(key); + util::maybe key; + try { + key.set(keySelector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } - typename Groups::iterator groupIt; - bool newGroup = false; + if (!!key) { + auto keySubject = CreateGroupedSubject(*key.get()); - { - std::unique_lock guard(state->lock); - std::tie(groupIt, newGroup) = state->groups.insert( - std::make_pair(key,keySubject) - ); - } + typename Groups::iterator groupIt; + bool newGroup = false; - if (newGroup) - { - LocalGroupObservable nextGroup(std::move(keySubject)); - observer->OnNext(nextGroup); + { + std::unique_lock guard(state->lock); + std::tie(groupIt, newGroup) = state->groups.insert( + std::make_pair(*key.get(), keySubject) + ); + } + + if (newGroup) + { + LocalGroupObservable nextGroup(std::move(keySubject)); + observer->OnNext(nextGroup); + } + + util::maybe result; + try { + result.set(valueSelector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + groupIt->second->OnNext(std::move(*result.get())); + } } - auto result = valueSelector(element); - groupIt->second->OnNext(std::move(result)); }, // on completed [=] @@ -1873,7 +1929,7 @@ namespace rxcpp { typedef typename StdCollection::value_type Value; return CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observer) -> Disposable { auto stdCollection = std::make_shared(); return Subscribe( @@ -1928,7 +1984,7 @@ namespace rxcpp { auto sched_disposable = scheduler->Schedule( due, - [=] (Scheduler::shared){ + [=] (Scheduler::shared) -> Disposable { if (!*cancel) observer->OnNext(element); return Disposable::Empty(); @@ -1945,7 +2001,7 @@ namespace rxcpp { auto sched_disposable = scheduler->Schedule( due, - [=](Scheduler::shared){ + [=](Scheduler::shared) -> Disposable { if (!*cancel) observer->OnCompleted(); return Disposable::Empty(); @@ -2005,7 +2061,7 @@ namespace rxcpp } sd.Set(scheduler->Schedule( due, - [=] (Scheduler::shared){ + [=] (Scheduler::shared) -> Disposable { { std::unique_lock guard(state->lock); if (state->hasValue && state->id == current) { @@ -2154,7 +2210,7 @@ namespace rxcpp SerialDisposable sd; cd.Add(sd); - cd.Add(scheduler->Schedule([=](Scheduler::shared){ + cd.Add(scheduler->Schedule([=](Scheduler::shared) -> Disposable { sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); return Disposable::Empty(); })); diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 2757acd..2a3a5fc 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -238,8 +238,8 @@ namespace rxcpp public: ScheduledObserver(Scheduler::shared scheduler, std::shared_ptr> observer) : scheduler(std::move(scheduler)) - , observer(std::move(observer)) , trampoline(0) + , observer(std::move(observer)) { } @@ -414,9 +414,10 @@ namespace rxcpp RXCPP_UNWIND(unwindQueue, [&](){ CurrentThreadQueue::DestroyQueue(); queue = nullptr;}); - +#if 0 auto start = queue->scheduler->Now(); auto ms = std::chrono::milliseconds(1); +#endif while(!CurrentThreadQueue::empty() || trampoline > 1) { auto now = queue->scheduler->Now(); @@ -508,8 +509,8 @@ namespace rxcpp } template EventLoopScheduler(Factory factoryarg) - : derecurser(std::make_shared()) - , factory(std::move(factoryarg)) + : factory(std::move(factoryarg)) + , derecurser(std::make_shared()) { } virtual ~EventLoopScheduler() diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index a7f2a23..5d78098 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -447,16 +447,16 @@ namespace rxcpp { namespace util { struct pass_through { template - X operator()(X x) {return std::move(x);} + typename std::decay::type operator()(X&& x) {return std::forward(x);} template - X operator()(X x) const {return std::move(x);} + typename std::decay::type operator()(X&& x) const {return std::forward(x);} }; struct pass_through_second { template - Y operator()(X , Y y) {return std::move(y);} + typename std::decay::type operator()(X&& , Y&& y) {return std::forward(y);} template - Y operator()(X , Y y) const {return std::move(y);} + typename std::decay::type operator()(X&& , Y&& y) const {return std::forward(y);} }; template diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index a0ace60..79f97e4 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -69,7 +69,7 @@ void Concat(int n) auto s1 = rxcpp::from(values1) .subscribe_on(input1) .where(IsPrime) - .select([](int prime){this_thread::yield(); return std::make_tuple("1:", prime);}) + .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("1:", prime);}) .take(n/2) .publish(); @@ -77,7 +77,7 @@ void Concat(int n) auto s2 = rxcpp::from(values2) .subscribe_on(input2) .where(IsPrime) - .select([](int prime){this_thread::yield(); return std::make_tuple("2:", prime);}) + .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("2:", prime);}) .take(n/2) .publish(); @@ -101,14 +101,14 @@ void Combine(int n) auto s1 = rxcpp::from(values1) .subscribe_on(input1) .where(IsPrime) - .select([](int prime){this_thread::yield(); return prime;}) + .select([](int prime) -> int {this_thread::yield(); return prime;}) .publish(); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values2) .subscribe_on(input2) .where(IsPrime) - .select([](int prime){this_thread::yield(); return prime;}) + .select([](int prime) -> int {this_thread::yield(); return prime;}) .combine_latest(s1) .take(n) .observe_on(output) @@ -132,7 +132,7 @@ std::shared_ptr> Record( ) { return rxcpp::CreateObservable( - [=](std::shared_ptr> observer) + [=](std::shared_ptr> observer) -> rxcpp::Disposable { rxcpp::ComposableDisposable cd; cd.Add(rxcpp::Disposable([=](){ @@ -180,7 +180,7 @@ void Zip(int n) .subscribe_on(input1) .where(IsPrime) .template chain(&s1count) - .select([](int prime){this_thread::yield(); return prime;}) + .select([](int prime) -> int {this_thread::yield(); return prime;}) .publish(); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers @@ -188,7 +188,7 @@ void Zip(int n) .subscribe_on(input2) .where(IsPrime) .template chain(&s2count) - .select([](int prime){this_thread::yield(); return prime;}) + .select([](int prime) -> int {this_thread::yield(); return prime;}) .zip(s1) .template chain(&zipcount) .take(n) @@ -220,14 +220,14 @@ void Merge(int n) auto s1 = rxcpp::from(values1) .subscribe_on(input1) .where(IsPrime) - .select([](int prime1) {this_thread::yield(); return std::make_tuple("1: ", prime1);}) + .select([](int prime1) -> std::tuple {this_thread::yield(); return std::make_tuple("1: ", prime1);}) .publish(); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values2) .subscribe_on(input2) .where(IsPrime) - .select([](int prime2) {this_thread::yield(); return std::make_tuple("2: ", prime2);}) + .select([](int prime2) -> std::tuple {this_thread::yield(); return std::make_tuple("2: ", prime2);}) .merge(s1) .take(n) .observe_on(output) @@ -294,11 +294,22 @@ void run() int concurrency; double time; + item(const item& other) : args(other.args), concurrency(other.concurrency), time(other.time) { + } + item(item&& other) : args(std::move(other.args)), concurrency(std::move(other.concurrency)), time(std::move(other.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() ); } + item& operator=(item other){ + using std::swap; + swap(args, other.args); + swap(concurrency, other.concurrency); + swap(time, other.time); + return *this; + } }; auto input = std::make_shared(); @@ -306,8 +317,6 @@ void run() auto dataLines = Data("data.txt"); - int arggroupcount = 0; - rxcpp::from(dataLines) .subscribe_on(input) // parse input into items @@ -373,10 +382,10 @@ template void innerScheduler() { auto outer = std::make_shared(); rxcpp::Scheduler::shared inner; - outer->Schedule([&](rxcpp::Scheduler::shared s){ + outer->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { inner = s; return rxcpp::Disposable::Empty();}); while(!inner); - inner->Schedule([&](rxcpp::Scheduler::shared s){ + inner->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { inner = nullptr; return rxcpp::Disposable::Empty();}); while(!!inner); cout << "innerScheduler test succeeded" << endl; -- GitLab From 27a38f93b45b4e5065c26fb630a3e9173d7caab2 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 17 Jun 2013 21:36:22 -0700 Subject: [PATCH 041/782] clang warning --- Ix/CPP/src/cpplinq/linq_cursor.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ix/CPP/src/cpplinq/linq_cursor.hpp b/Ix/CPP/src/cpplinq/linq_cursor.hpp index 827c488..8c95371 100644 --- a/Ix/CPP/src/cpplinq/linq_cursor.hpp +++ b/Ix/CPP/src/cpplinq/linq_cursor.hpp @@ -177,16 +177,16 @@ namespace cpplinq { iter_cursor(Iterator start, Iterator fin) - : start(start) + : current(start) + , start(start) , fin(std::move(fin)) - , current(start) { } iter_cursor(Iterator start, Iterator fin, Iterator current) - : start(std::move(start)) + : current(std::move(current)) + , start(std::move(start)) , fin(std::move(fin)) - , current(std::move(current)) { } -- GitLab From fd9e17d2db79fc6a9b355269bd5d206a7aba9cf9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 18 Jun 2013 09:39:34 -0700 Subject: [PATCH 042/782] pushing min/max macros don't need to wrap push_macro/pop_macro in ifdefs because gcc, clang and msvc support them. --- Ix/CPP/src/cpplinq/linq.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Ix/CPP/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp index 2d7c1e7..5f08588 100644 --- a/Ix/CPP/src/cpplinq/linq.hpp +++ b/Ix/CPP/src/cpplinq/linq.hpp @@ -129,6 +129,11 @@ #define CPPLINQ_LINQ_HPP #pragma once +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + #include #include #include @@ -542,5 +547,8 @@ linq_driver from_value(const TContainer& c) } +#pragma pop_macro("min") +#pragma pop_macro("max") + #endif // defined(CPPLINQ_LINQ_HPP) -- GitLab From 7de88ea358cdc92a7dedbf3cf3fdac4a6eb17c57 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 18 Jun 2013 09:40:15 -0700 Subject: [PATCH 043/782] inline non-template func def in header --- Rx/CPP/src/cpprx/rx-operators.hpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index eaf8373..3bf908a 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -538,7 +538,7 @@ namespace rxcpp }); } - std::shared_ptr> Interval( + inline std::shared_ptr> Interval( Scheduler::clock::duration due, Scheduler::shared scheduler) { @@ -675,16 +675,20 @@ namespace rxcpp std::condition_variable wake; bool done = false; std::exception_ptr error; - auto observer = CreateObserver(std::move(onNext), [&]{ - std::unique_lock guard(lock); - done = true; - wake.notify_one(); - }, [&](const std::exception_ptr& e){ - std::unique_lock guard(lock); - done = true; - error = std::move(e); - wake.notify_one(); - }); + auto observer = CreateObserver(std::move(onNext), + //on completed + [&]{ + std::unique_lock guard(lock); + done = true; + wake.notify_one(); + }, + //on error + [&](const std::exception_ptr& e){ + std::unique_lock guard(lock); + done = true; + error = std::move(e); + wake.notify_one(); + }); source->Subscribe(observer); -- GitLab From 0e83c84051a245667554321c16f3bff7977d3c5d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Jun 2013 14:15:59 -0700 Subject: [PATCH 044/782] remove publish --- Rx/CPP/src/cpprx/rx.hpp | 71 +++++++++++++++++++++------------- Rx/CPP/testbench/testbench.cpp | 23 ++++------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index a083904..acdf2eb 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -8,11 +8,24 @@ namespace rxcpp { + template + class Binder; + + template + class Binder>; + +namespace detail { + template + struct observable_item> {typedef typename rxcpp::observable_item::type type;}; +} + template class BinderBase { protected: Obj obj; + template + friend V rxcpp::observable(const BinderBase& b); public: typedef T item_type; @@ -21,8 +34,17 @@ namespace rxcpp BinderBase(Obj obj) : obj(std::move(obj)) { } + + Observable* operator->() const { + return obj.get(); + } }; + template + Obj observable(const BinderBase& b) { + return b.obj; + } + template class BinderNested; @@ -66,7 +88,7 @@ namespace rxcpp return from(Concat(obj)); } }; - + template class Binder : public BinderNested< typename observable_item::type, @@ -103,60 +125,60 @@ namespace rxcpp #if RXCPP_USE_VARIADIC_TEMPLATES template auto merge(const MergeSource&... source) - -> decltype(from(Merge(obj, source...))) { - return from(Merge(obj, source...)); + -> decltype(from(Merge(obj, observable(source)...))) { + return from(Merge(obj, observable(source)...)); } #else template auto merge(const MergeSource& source) - -> decltype(from(Merge(obj, source))) { - return from(Merge(obj, source)); + -> decltype(from(Merge(obj, observable(source)))) { + return from(Merge(obj, observable(source))); } #endif //RXCPP_USE_VARIADIC_TEMPLATES #if RXCPP_USE_VARIADIC_TEMPLATES template auto zip(S selector, const ZipSource&... source) - -> decltype(from(Zip(selector, obj, source...))) { - return from(Zip(selector, obj, source...)); + -> decltype(from(Zip(selector, obj, observable(source)...))) { + return from(Zip(selector, obj, observable(source)...)); } template auto zip(const Zip1Source&... source) - -> decltype(from(Zip(util::as_tuple(), obj, source...))) { - return from(Zip(util::as_tuple(), obj, source...)); + -> decltype(from(Zip(util::as_tuple(), obj, observable(source)...))) { + return from(Zip(util::as_tuple(), obj, observable(source)...)); } #else template auto zip(S selector, const ZipSource& source) - -> decltype(from(Zip(selector, obj, source))) { - return from(Zip(selector, obj, source)); + -> decltype(from(Zip(selector, obj, observable(source)))) { + return from(Zip(selector, obj, observable(source))); } template auto zip(const Zip1Source& source) - -> decltype(from(Zip(util::as_tuple(), obj, source))) { - return from(Zip(util::as_tuple(), obj, source)); + -> decltype(from(Zip(util::as_tuple(), obj, observable(source)))) { + return from(Zip(util::as_tuple(), obj, observable(source))); } #endif //RXCPP_USE_VARIADIC_TEMPLATES #if RXCPP_USE_VARIADIC_TEMPLATES template auto combine_latest(S selector, const CombineLSource&... source) - -> decltype(from(CombineLatest(selector, obj, source...))) { - return from(CombineLatest(selector, obj, source...)); + -> decltype(from(CombineLatest(selector, obj, observable(source)...))) { + return from(CombineLatest(selector, obj, observable(source)...)); } template auto combine_latest(const CombineL1Source&... source) - -> decltype(from(CombineLatest(util::as_tuple(), obj, source...))) { - return from(CombineLatest(util::as_tuple(), obj, source...)); + -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(source)...))) { + return from(CombineLatest(util::as_tuple(), obj, observable(source)...)); } #else template auto combine_latest(S selector, const CombineLSource& source) - -> decltype(from(CombineLatest(selector, obj, source))) { - return from(CombineLatest(selector, obj, source)); + -> decltype(from(CombineLatest(selector, obj, observable(source)))) { + return from(CombineLatest(selector, obj, observable(source))); } template auto combine_latest(const CombineLSource& source) - -> decltype(from(CombineLatest(util::as_tuple(), obj, source))) { - return from(CombineLatest(util::as_tuple(), obj, source)); + -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(source)))) { + return from(CombineLatest(util::as_tuple(), obj, observable(source))); } #endif //RXCPP_USE_VARIADIC_TEMPLATES @@ -167,7 +189,7 @@ namespace rxcpp -> decltype(from(Concat(Iterate(std::vector())))) { std::vector sources; sources.push_back(obj); - std::make_tuple((sources.push_back(source), true)...); + std::make_tuple((sources.push_back(observable(source)), true)...); return from(Concat(Iterate(std::move(sources)))); } #else @@ -175,7 +197,7 @@ namespace rxcpp -> decltype(from(Concat(Iterate(std::vector())))) { std::vector sources; sources.push_back(obj); - sources.push_back(source); + sources.push_back(observable(source)); return from(Concat(Iterate(std::move(sources)))); } #endif //RXCPP_USE_VARIADIC_TEMPLATES @@ -189,9 +211,6 @@ namespace rxcpp auto where(P predicate) -> decltype(from(Where(obj, predicate))) { return from(Where(obj, predicate)); } - Obj publish() { - return obj; - } template auto group_by( KS keySelector) diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 79f97e4..770db93 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -70,16 +70,14 @@ void Concat(int n) .subscribe_on(input1) .where(IsPrime) .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("1:", prime);}) - .take(n/2) - .publish(); + .take(n/2); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers auto s2 = rxcpp::from(values2) .subscribe_on(input2) .where(IsPrime) .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("2:", prime);}) - .take(n/2) - .publish(); + .take(n/2); rxcpp::from(s2) .concat(s1) @@ -101,8 +99,7 @@ void Combine(int n) auto s1 = rxcpp::from(values1) .subscribe_on(input1) .where(IsPrime) - .select([](int prime) -> int {this_thread::yield(); return prime;}) - .publish(); + .select([](int prime) -> int {this_thread::yield(); return prime;}); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values2) @@ -180,8 +177,7 @@ void Zip(int n) .subscribe_on(input1) .where(IsPrime) .template chain(&s1count) - .select([](int prime) -> int {this_thread::yield(); return prime;}) - .publish(); + .select([](int prime) -> int {this_thread::yield(); return prime;}); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values2) @@ -220,8 +216,7 @@ void Merge(int n) auto s1 = rxcpp::from(values1) .subscribe_on(input1) .where(IsPrime) - .select([](int prime1) -> std::tuple {this_thread::yield(); return std::make_tuple("1: ", prime1);}) - .publish(); + .select([](int prime1) -> std::tuple {this_thread::yield(); return std::make_tuple("1: ", prime1);}); auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values2) @@ -250,7 +245,7 @@ void PrintIntervals(int n) { cout << n << " Intervals of .5 second: " << endl; rxcpp::from(subject) - .zip(rxcpp::from(subject).skip(1).publish()) + .zip(rxcpp::from(subject).skip(1)) .select(rxcpp::MakeTupleDispatch( [=](Tick a, Tick b){ return duration_cast(b.at.time_since_epoch()) - @@ -341,14 +336,12 @@ void run() return rxcpp::from(concurrencyGroup) .select([](const item& i){ return i.time;}) - .to_vector() - .publish();}, + .to_vector();}, [](const std::shared_ptr> & concurrencyGroup, const std::vector & times){ return std::make_tuple(concurrencyGroup->Key(), times);} ) - .to_vector() - .publish();}, + .to_vector();}, [](const std::shared_ptr> & argsGroup, const std::vector>> & ouputGroup){ return std::make_tuple(argsGroup->Key(), ouputGroup);} -- GitLab From 19d503563c8c5c18de17802051dab8a32b8e6ee2 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Jun 2013 23:13:32 -0700 Subject: [PATCH 045/782] fix test using condition_variable --- Rx/CPP/testbench/testbench.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 770db93..718a347 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -375,12 +375,17 @@ template void innerScheduler() { auto outer = std::make_shared(); rxcpp::Scheduler::shared inner; + std::mutex lock; + std::unique_lock guard(lock); + std::condition_variable wake; outer->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { - inner = s; return rxcpp::Disposable::Empty();}); - while(!inner); + inner = s; wake.notify_one(); + return rxcpp::Disposable::Empty();}); + wake.wait(guard, [&]{return !!inner;}); inner->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { - inner = nullptr; return rxcpp::Disposable::Empty();}); - while(!!inner); + inner = nullptr; wake.notify_one(); + return rxcpp::Disposable::Empty();}); + wake.wait(guard, [&]{return !inner;}); cout << "innerScheduler test succeeded" << endl; } -- GitLab From ba8408e3dff860ec5d7f1307950a942045218d7e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Jun 2013 23:14:00 -0700 Subject: [PATCH 046/782] fix windows issues --- Rx/CPP/src/cpprx/rx.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index acdf2eb..0ecbf8a 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -25,7 +25,7 @@ namespace detail { protected: Obj obj; template - friend V rxcpp::observable(const BinderBase& b); + friend V observable(const BinderBase& b); public: typedef T item_type; @@ -193,7 +193,8 @@ namespace detail { return from(Concat(Iterate(std::move(sources)))); } #else - auto concat(const Obj& source) + template + auto concat(const ConcatSource& source) -> decltype(from(Concat(Iterate(std::vector())))) { std::vector sources; sources.push_back(obj); -- GitLab From 1f5142531b273f7c598d292a134cd5ba87765875 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Jun 2013 23:14:47 -0700 Subject: [PATCH 047/782] update whole window --- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp index f1bf7a9..4fc260d 100644 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp @@ -104,8 +104,8 @@ void CMainFrame::UserInit() label->Invalidate(); // repaint early, for fluid animation - label->UpdateWindow(); - //this->UpdateWindow(); + //label->UpdateWindow(); + this->UpdateWindow(); })); composableDisposable.Add(std::move(s)); -- GitLab From d5a9f6b5d73ec93fda338abcc30dbae73a457c0b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Jun 2013 23:23:57 -0700 Subject: [PATCH 048/782] tweak condition_variable in test --- Rx/CPP/testbench/testbench.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 718a347..b43b39e 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -376,16 +376,23 @@ void innerScheduler() { auto outer = std::make_shared(); rxcpp::Scheduler::shared inner; std::mutex lock; - std::unique_lock guard(lock); std::condition_variable wake; outer->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { + std::lock_guard guard(lock); inner = s; wake.notify_one(); return rxcpp::Disposable::Empty();}); + { + std::unique_lock guard(lock); wake.wait(guard, [&]{return !!inner;}); + } inner->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { + std::lock_guard guard(lock); inner = nullptr; wake.notify_one(); return rxcpp::Disposable::Empty();}); + { + std::unique_lock guard(lock); wake.wait(guard, [&]{return !inner;}); + } cout << "innerScheduler test succeeded" << endl; } -- GitLab From 1fa9f0d49016ce10183420edf2c000bada87a9f3 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 25 Jun 2013 23:58:45 -0700 Subject: [PATCH 049/782] fix _until operators --- Rx/CPP/src/cpprx/rx.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 0ecbf8a..a5eb824 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -240,8 +240,8 @@ namespace detail { } template auto take_until(std::shared_ptr> terminus) - -> decltype(from(TakeUntil(obj, terminus))) { - return from(TakeUntil(obj, terminus)); + -> decltype(from(TakeUntil(obj, observable(terminus)))) { + return from(TakeUntil(obj, observable(terminus))); } template auto skip(Integral n) @@ -250,8 +250,8 @@ namespace detail { } template auto skip_until(std::shared_ptr> terminus) - -> decltype(from(SkipUntil(obj, terminus))) { - return from(SkipUntil(obj, terminus)); + -> decltype(from(SkipUntil(obj, observable(terminus)))) { + return from(SkipUntil(obj, observable(terminus))); } templateclass Allocator> auto to_vector() -- GitLab From 894ecbeb0b7f758ff7a1b13e5bbefb4078f86b0b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 26 Jun 2013 21:38:20 -0700 Subject: [PATCH 050/782] accept anything that will convert to observable --- Rx/CPP/src/cpprx/rx.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index a5eb824..353d459 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -238,8 +238,8 @@ namespace detail { -> decltype(from(Take(obj, n))) { return from(Take(obj, n)); } - template - auto take_until(std::shared_ptr> terminus) + template + auto take_until(const TakeUntilTerminus& terminus) -> decltype(from(TakeUntil(obj, observable(terminus)))) { return from(TakeUntil(obj, observable(terminus))); } @@ -248,8 +248,8 @@ namespace detail { -> decltype(from(Skip(obj, n))) { return from(Skip(obj, n)); } - template - auto skip_until(std::shared_ptr> terminus) + template + auto skip_until(const SkipUntilTerminus& terminus) -> decltype(from(SkipUntil(obj, observable(terminus)))) { return from(SkipUntil(obj, observable(terminus))); } -- GitLab From caaf1156dface3a9ee47d07623ffb40de6ed50b3 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 26 Aug 2013 16:35:33 -0700 Subject: [PATCH 051/782] add missing return to maybe --- Rx/CPP/src/cpprx/rx-util.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 5d78098..92ef223 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -110,6 +110,7 @@ namespace rxcpp { namespace util { maybe& operator=(const T& other) { set(other); + return *this; } maybe& operator=(const maybe& other) { if (const T* pother = other.get()) { -- GitLab From 6463aa9070552a0871cce928aa781fb97ac707d8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 26 Aug 2013 16:43:49 -0700 Subject: [PATCH 052/782] add new Operators and Subjects ConnectableObservable AsyncSubject, ConnectableSubject ToAsync, Multicast, Publish, PublishLast, RefCount --- Rx/CPP/src/cpprx/rx-base.hpp | 69 ++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 343 ++++++++++++++++++++++++++++-- Rx/CPP/src/cpprx/rx.hpp | 52 ++++- 3 files changed, 447 insertions(+), 17 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index e50ba13..eb5cf5e 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -65,6 +65,13 @@ namespace rxcpp virtual ~GroupedObservable() {} }; + template + struct ConnectableObservable : Observable + { + virtual Disposable Connect() = 0; + virtual ~ConnectableObservable() {} + }; + struct Scheduler : public std::enable_shared_from_this { typedef std::chrono::steady_clock clock; @@ -387,6 +394,12 @@ namespace rxcpp template class BehaviorSubject; + template + class AsyncSubject; + + template + class ConnectableSubject; + template class GroupedSubject; @@ -408,6 +421,12 @@ namespace rxcpp template struct is_observable>> {static const bool value = true;}; + template + struct is_observable < std::shared_ptr < AsyncSubject> > {static const bool value = true; }; + + template + struct is_observable < std::shared_ptr < ConnectableSubject> > {static const bool value = true; }; + template struct is_observable>> {static const bool value = true;}; @@ -421,6 +440,9 @@ namespace detail { template struct observable_item>> {typedef T type;}; + template + struct observable_item < std::shared_ptr < ConnectableObservable> > {typedef T type; }; + template struct observable_item>> {typedef T type;}; } @@ -436,6 +458,9 @@ namespace detail { template struct observable_observer>> {typedef std::shared_ptr> type;}; + template + struct observable_observer < std::shared_ptr < ConnectableObservable> > {typedef std::shared_ptr < Observer < T >> type; }; + template struct observable_observer>> {typedef std::shared_ptr> type;}; @@ -454,6 +479,12 @@ namespace detail { template struct subject_item>> {typedef T type;}; + template + struct subject_item < std::shared_ptr < AsyncSubject> > {typedef T type; }; + + template + struct subject_item < std::shared_ptr < ConnectableSubject> > : subject_item {}; + template struct subject_item>> {typedef T type;}; @@ -466,6 +497,12 @@ namespace detail { template struct subject_observer>> {typedef std::shared_ptr> type;}; + template + struct subject_observer < std::shared_ptr < AsyncSubject> > {typedef std::shared_ptr < Observer < T >> type; }; + + template + struct subject_observer < std::shared_ptr < ConnectableSubject> > : subject_observer {}; + template struct subject_observable; @@ -475,21 +512,53 @@ namespace detail { template struct subject_observable>> {typedef std::shared_ptr> type;}; + template + struct subject_observable < std::shared_ptr < AsyncSubject> > {typedef std::shared_ptr < Observable < T >> type; }; + + template + struct subject_observable < std::shared_ptr < ConnectableSubject> > : subject_observable {}; + + template + std::shared_ptr> observable(const std::shared_ptr < Observable < T >> &o){ return o; } + + template + std::shared_ptr> observable(const std::shared_ptr < GroupedObservable < K, T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } + + template + std::shared_ptr< Observable < T >> observable(const std::shared_ptr < ConnectableObservable < T >> &o){ + return std::static_pointer_cast < Observable < T >> (o); } + template std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} template std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + template + std::shared_ptr> observable(const std::shared_ptr < AsyncSubject < T >> &s){ return std::static_pointer_cast < Observable < T >> (s); } + + template + typename subject_observable::type observable(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s){ + return std::static_pointer_cast < Observable < typename subject_item::type >> (s); } + template std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + template + std::shared_ptr> observer(const std::shared_ptr < Observer < T >> &o){ return o; } + template std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} template std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + template + std::shared_ptr> observer(const std::shared_ptr < AsyncSubject < T >> &s){ return std::static_pointer_cast < Observer < T >> (s); } + + template + void observer(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s); // no observer + template std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 3bf908a..91682ba 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -358,7 +358,7 @@ namespace rxcpp std::mutex lock; T value; SubjectState::type state; - std::exception_ptr error; + util::maybe error; std::vector>> observers; void RemoveObserver(std::shared_ptr> toRemove) @@ -372,6 +372,8 @@ namespace rxcpp BehaviorSubject(); public: + typedef std::shared_ptr> shared; + explicit BehaviorSubject(T t) : value(std::move(t)), state(SubjectState::Forwarding) {} virtual ~BehaviorSubject() { @@ -396,15 +398,25 @@ namespace rxcpp } }); + SubjectState::type localState = SubjectState::Invalid; + util::maybe localValue; + util::maybe localError; { std::unique_lock guard(lock); - if (state == SubjectState::Completed) { - observer->OnCompleted(); - return Disposable::Empty(); - } else if (state == SubjectState::Error) { - observer->OnError(error); - return Disposable::Empty(); - } else { + + localState = state; + + if (state == SubjectState::Forwarding || localState == SubjectState::Completed) + { + localValue.set(value); + } + else if (localState == SubjectState::Error) + { + localError = error; + } + + if (state == SubjectState::Forwarding) + { for(auto& o : observers) { if (!o){ @@ -415,23 +427,33 @@ namespace rxcpp observers.push_back(observer); } } - if (state == SubjectState::Forwarding) { - observer->OnNext(value); + + if (localState == SubjectState::Completed) { + observer->OnNext(localValue.get()); + observer->OnCompleted(); + return Disposable::Empty(); + } + else if (localState == SubjectState::Error) { + observer->OnError(localError.get()); + return Disposable::Empty(); + } + else if (localState == SubjectState::Forwarding) { + observer->OnNext(localValue.get()); } return d; } - virtual void OnNext(T element) + virtual void OnNext(const T& element) { std::unique_lock guard(lock); auto local = observers; - value = std::move(element); + value = element; guard.unlock(); for(auto& o : local) { if (o) { - o->OnNext(value); + o->OnNext(element); } } } @@ -452,13 +474,13 @@ namespace rxcpp { std::unique_lock guard(lock); state = SubjectState::Error; - error = errorArg; + error.set(errorArg); auto local = std::move(observers); guard.unlock(); for(auto& o : local) { if (o) { - o->OnError(error); + o->OnError(errorArg); } } } @@ -470,6 +492,210 @@ namespace rxcpp return std::make_shared>(std::move(a)); } + template + class AsyncSubject : + public std::enable_shared_from_this>, + public Observable, + public Observer + { + std::mutex lock; + util::maybe value; + SubjectState::type state; + util::maybe error; + std::vector < std::shared_ptr < Observer> > observers; + + void RemoveObserver(std::shared_ptr < Observer < T >> toRemove) + { + std::unique_lock guard(lock); + auto it = std::find(begin(observers), end(observers), toRemove); + if (it != end(observers)) + *it = nullptr; + } + + public: + + typedef std::shared_ptr> shared; + + AsyncSubject() : value(), state(SubjectState::Forwarding) {} + + virtual ~AsyncSubject() { + // putting this first means that the observers + // will be destructed outside the lock + std::vector < std::shared_ptr < Observer> > empty; + + std::unique_lock guard(lock); + using std::swap; + swap(observers, empty); + } + + virtual Disposable Subscribe(std::shared_ptr < Observer < T >> observer) + { + std::weak_ptr> wptr = observer; + std::weak_ptr wself = this->shared_from_this(); + + Disposable d([wptr, wself]{ + if (auto self = wself.lock()) + { + self->RemoveObserver(wptr.lock()); + } + }); + + SubjectState::type localState = SubjectState::Invalid; + util::maybe localValue; + util::maybe localError; + { + std::unique_lock guard(lock); + + localState = state; + + if (localState == SubjectState::Completed) + { + localValue = value; + } + else if (localState == SubjectState::Error) + { + localError = error; + } + else if (state == SubjectState::Forwarding) + { + for (auto& o : observers) + { + if (!o){ + o = std::move(observer); + return d; + } + } + observers.push_back(observer); + } + } + + if (localState == SubjectState::Completed) { + if (localValue) { + observer->OnNext(*localValue.get()); + } + observer->OnCompleted(); + return Disposable::Empty(); + } + else if (localState == SubjectState::Error) { + observer->OnError(*localError.get()); + return Disposable::Empty(); + } + + return d; + } + + virtual void OnNext(const T& element) + { + std::unique_lock guard(lock); + if (state == SubjectState::Forwarding) { + value = element; + } + } + virtual void OnCompleted() + { + std::unique_lock guard(lock); + state = SubjectState::Completed; + auto local = std::move(observers); + auto localValue = value; + guard.unlock(); + for (auto& o : local) + { + if (o) { + if (localValue) { + o->OnNext(*localValue.get()); + } + o->OnCompleted(); + } + } + } + virtual void OnError(const std::exception_ptr& errorArg) + { + std::unique_lock guard(lock); + state = SubjectState::Error; + error.set(errorArg); + auto local = std::move(observers); + guard.unlock(); + for (auto& o : local) + { + if (o) { + o->OnError(errorArg); + } + } + } + }; + + template + std::shared_ptr> CreateAsyncSubject() + { + return std::make_shared>(); + } + + template + auto ToAsync(Scheduler::shared scheduler, F && f) + -> std::shared_ptr> + { + typedef decltype(f()) Value; + auto result = CreateAsyncSubject(); + scheduler->Schedule([=]() -> Disposable + { + util::maybe value; + try + { + value.set(f()); + } + catch (...) + { + result->OnError(std::current_exception()); + return Disposable::Empty(); + } + result->OnNext(value.get()); + result->OnCompleted(); + return Disposable::Empty(); + }); + return result; + } + + template + class ConnectableSubject : ConnectableObservable::type> + { + private: + ConnectableSubject(); + + Subject subject; + Source source; + util::maybe subscription; + std::mutex lock; + + public: + virtual ~ConnectableSubject() {} + + ConnectableSubject(Source source, Subject subject) : source(source), subject(subject) + { + } + + virtual Disposable Connect() + { + std::unique_lock guard(lock); + if (!subscription) + { + subscription.set(source->Subscribe(observer(subject))); + } + return Disposable([]() + { + if (subscription) + { + subscription->Dispose(); + subscription.reset(); + } + }); + } + + virtual Disposable Subscribe(std::shared_ptr < Observer < typename subject_item::type >> observer) + { + return subject->Subscribe(observer); + } + }; + template struct fix0_thunk { F f; @@ -1672,6 +1898,93 @@ namespace rxcpp }); } + + template + std::shared_ptr> Multicast(const std::shared_ptr < Observable < T >> &source, const std::shared_ptr& multicastSubject) + { + return std::static_pointer_cast>( + std::make_shared < ConnectableSubject < std::shared_ptr < Observable < T >> , std::shared_ptr >> (source, multicastSubject)); + } + + template + std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) + { + typedef std::shared_ptr> MulticastSubject; + auto multicastSubject = std::make_shared(); + return Multicast(source, multicastSubject); + } + + template + std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source, V value) + { + typedef std::shared_ptr> MulticastSubject; + auto multicastSubject = std::make_shared(value); + return Multicast(source, multicastSubject); + } + + template + std::shared_ptr> PublishLast(const std::shared_ptr < Observable < T >> &source) + { + typedef std::shared_ptr> MulticastSubject; + auto multicastSubject = std::make_shared(); + return Multicast(source, multicastSubject); + } + + template + const std::shared_ptr> RefCount( + const std::shared_ptr>& source + ) + { + struct State + { + State() : refcount(0) {} + std::mutex lock; + size_t refcount; + Disposable subscription; + }; + auto state = std::make_shared(); + + return CreateObservable( + [=](std::shared_ptr < Observer < T >> observer) + { + auto subscription = Subscribe( + source, + // on next + [=](const T& element) + { + observer->OnNext(element); + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + + { + std::unique_lock guard(state->lock); + if (++state->refcount == 1) + { + state->subscription = source->Connect(); + } + } + + return Disposable([=](){ + subscription.Dispose(); + + std::unique_lock guard(state->lock); + if (--state->refcount == 0) + { + state->subscription.Dispose(); + } + }); + }); + } + template std::shared_ptr> Take( const std::shared_ptr>& source, diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 353d459..c97b322 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -89,11 +89,30 @@ namespace detail { } }; + template + class BinderConnectable + { + }; + + template + class BinderConnectable>> + { + public: + auto ref_count() + -> decltype(from(RefCount(obj))) { + return from(RefCount(obj)); + } + }; + template class Binder : public BinderNested< typename observable_item::type, Obj, - is_observable::type>::value> + is_observable::type>::value>, + public BinderConnectable< + typename observable_item::type, + Obj + > { typedef BinderNested< typename observable_item::type, @@ -253,6 +272,23 @@ namespace detail { -> decltype(from(SkipUntil(obj, observable(terminus)))) { return from(SkipUntil(obj, observable(terminus))); } + template + auto multicast(MulticastSubject subject) + -> decltype(from(Multicast(obj, subject))) { + return from(Multicast(obj, subject)); + } + auto publish() + -> decltype(from(Publish(obj))) { + return from(Publish(obj)); + } + auto publish(item_type value) + -> decltype(from(Publish(obj, value))) { + return from(Publish(obj, value)); + } + auto publish_last() + -> decltype(from(PublishLast(obj))) { + return from(PublishLast(obj)); + } templateclass Allocator> auto to_vector() -> decltype(from(ToStdCollection>>(obj))) { @@ -294,11 +330,19 @@ namespace detail { { return from(ObserveOnObserver(obj, std::move(scheduler))); } - auto on_dispatcher() +#if RXCPP_USE_WINRT + auto observe_on_dispatcher() + -> decltype(from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current())))) + { + return from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()))); + } +#else + auto on_dispatcher() -> decltype(from(ObserveOnDispatcher(obj))) { return from(ObserveOnDispatcher(obj)); } +#endif template void for_each(OnNext onNext) { ForEach(obj, onNext); @@ -423,6 +467,10 @@ namespace detail { Binder>> from(std::shared_ptr> obj) { return Binder>>(std::move(obj)); } + template + Binder < std::shared_ptr < ConnectableObservable> > from(std::shared_ptr < ConnectableObservable < T >> obj) { + return Binder < std::shared_ptr < ConnectableObservable> >(std::move(obj)); } + template Binder>> from(std::shared_ptr> obj) { return Binder>>(std::move(obj)); } -- GitLab From f6357ecbdfb56c07b0d77864dacb41da7f134659 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 26 Aug 2013 16:46:32 -0700 Subject: [PATCH 053/782] add some winrt operators CoreDispatcherScheduler FromEventPattern, FromAsyncPattern --- Rx/CPP/src/cpprx/rx-includes.hpp | 12 + Rx/CPP/src/cpprx/rx-windows.hpp | 2 +- Rx/CPP/src/cpprx/rx-winrt.hpp | 362 +++++++++++++++++++++++++++++++ 3 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 Rx/CPP/src/cpprx/rx-winrt.hpp diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index eb57b0c..283ab98 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -53,6 +53,12 @@ #endif +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +#define RXCPP_USE_WINRT 0 +#else +#define RXCPP_USE_WINRT 1 +#endif + #if defined(RXCPP_FORCE_USE_VARIADIC_TEMPLATES) #undef RXCPP_USE_VARIADIC_TEMPLATES #define RXCPP_USE_VARIADIC_TEMPLATES RXCPP_FORCE_USE_VARIADIC_TEMPLATES @@ -68,11 +74,17 @@ #define RXCPP_USE_RTTI RXCPP_FORCE_USE_RTTI #endif +#if defined(RXCPP_FORCE_USE_WINRT) +#undef RXCPP_USE_WINRT +#define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT +#endif + #include "rx-util.hpp" #include "rx-base.hpp" #include "rx-scheduler.hpp" #include "rx-windows.hpp" #include "rx-operators.hpp" +#include "rx-winrt.hpp" #pragma pop_macro("min") #pragma pop_macro("max") diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 4af1b81..fab0dd1 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -7,7 +7,7 @@ #define CPPRX_RX_WINDOWS_HPP #pragma once -#if defined(WINDOWS) || defined(WIN32) || defined(_WIN32) +#if defined(BUILDING_FOR_DESKTOP) && (defined(WINDOWS) || defined(WIN32) || defined(_WIN32)) #pragma comment(lib, "user32.lib") diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp new file mode 100644 index 0000000..02d15da --- /dev/null +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -0,0 +1,362 @@ +#pragma once +#include "rx-includes.hpp" + +#if !defined(CPPRX_RX_WINRT_HPP) +#define CPPRX_RX_WINRT_HPP +#pragma once + +#if RXCPP_USE_WINRT + +#define NOMINMAX +#include + +namespace rxcpp { namespace winrt { + namespace wf = Windows::Foundation; + namespace wuicore = Windows::UI::Core; + namespace wuixaml = Windows::UI::Xaml; + + template + struct EventPattern + { + EventPattern(TSender sender, TEventArgs eventargs) : + sender(sender), + eventargs(eventargs) + {} + + TSender Sender() { + return sender;}; + TEventArgs EventArgs() { + return eventargs;}; + + private: + TSender sender; + TEventArgs eventargs; + }; + + namespace detail + { + template + struct is_typed_event_handler : public std::false_type {}; + + template + struct is_typed_event_handler> : public std::true_type {}; + + template + struct get_sender; + template + struct get_sender> + { + typedef Sender type; + }; + + template + struct get_eventargs; + template + struct get_eventargs> + { + typedef EventArgs type; + }; + + template + struct get_eventpattern; + template + struct get_eventpattern> + { + typedef EventPattern type; + }; + + template + struct remove_ref { typedef T type; }; + template + struct remove_ref { typedef T type; }; + template + struct remove_ref { typedef T type; }; + template + struct remove_ref { typedef T type; }; + + template + wf::IAsyncOperation^ operation_interface(wf::IAsyncOperation^ i) { return i; } + + template + wf::IAsyncOperationWithProgress^ operation_interface(wf::IAsyncOperationWithProgress^ i) { return i; } + } + + template + auto FromEventPattern( + std::function addHandler, + std::function removeHandler) + -> typename std::enable_if < !detail::is_typed_event_handler::value, std::shared_ptr < Observable < EventPattern < Platform::Object^, EventArgs^ >> >> ::type + { + typedef EventPattern EP; + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto h = ref new EventHandler( + [=](Platform::Object^ sender, EventArgs^ args) -> void + { + observer->OnNext(EP(sender, args)); + }); + + auto token = addHandler(h); + + return Disposable( + [removeHandler, token]() + { + removeHandler(token); + }); + }); + } + + template + auto FromEventPattern( + std::function addHandler, + std::function removeHandler) + -> typename std::enable_if < !detail::is_typed_event_handler::value, std::shared_ptr < Observable < EventPattern < Sender^, EventArgs^ >> >> ::type + { + typedef EventPattern EP; + return CreateObservable( + [=](std::shared_ptr> observer) + { + auto h = ref new EventHandler( + [=](Platform::Object^ sender, EventArgs^ args) -> void + { + observer->OnNext(EP(dynamic_cast(sender), args)); + }); + + auto token = addHandler(h); + + return Disposable( + [removeHandler, token]() + { + removeHandler(token); + }); + }); + } + + template + auto FromEventPattern( + std::function addHandler, + std::function removeHandler) + -> typename std::enable_if < detail::is_typed_event_handler::value, std::shared_ptr < Observable < typename detail::get_eventpattern::type> >> ::type + { + typedef typename detail::get_eventpattern::type EP; + return CreateObservable( + [=](std::shared_ptr < Observer < EP >> observer) + { + auto h = ref new SpecificTypedEventHandler( + [=](typename detail::get_sender::type sender, typename detail::get_eventargs::type args) -> void + { + observer->OnNext(EP(sender, args)); + }); + + auto token = addHandler(h); + + return Disposable( + [removeHandler, token]() + { + removeHandler(token); + }); + }); + } + + template + auto FromAsyncPattern(F&& start) + -> std::function < std::shared_ptr < Observable< decltype(start()->GetResults()) >> ()> + { + return [=]() + { + typedef decltype(start()->GetResults()) Result; + auto subject = CreateAsyncSubject(); + auto o = start(); + typedef typename detail::remove_ref< decltype(o->Completed)>::type Handler; + typedef decltype(detail::operation_interface(o)) Interface; + o->Completed = ref new Handler([=](Interface io, wf::AsyncStatus) + { + util::maybe value; + try + { + value.set(io->GetResults()); + } + catch (...) + { + subject->OnError(std::current_exception()); + return; + } + subject->OnNext(*value.get()); + subject->OnCompleted(); + }); + return observable(subject); + }; + } + + template + std::function < std::shared_ptr < Observable> (const T&...)> FromAsyncPattern(std::function start) + { + return [=](const T&... t) + { + auto subject = CreateAsyncSubject(); + auto o = start(t...); + typedef typename detail::remove_ref< decltype(o->Completed)>::type Handler; + typedef decltype(detail::operation_interface(o)) Interface; + o->Completed = ref new Handler([=](Interface io, wf::AsyncStatus) + { + util::maybe value; + try + { + value.set(io->GetResults()); + } + catch (...) + { + subject->OnError(std::current_exception()); + return; + } + subject->OnNext(*value.get()); + subject->OnCompleted(); + }); + return observable(subject); + }; + } + + std::shared_ptr < Observable < size_t> > + inline DispatcherInterval( + Scheduler::clock::duration interval) + { + return CreateObservable( + [=](std::shared_ptr < Observer < size_t >> observer) + -> Disposable + { + size_t cursor = 0; + ComposableDisposable cd; + + wf::TimeSpan timeSpan; + // convert to 100ns ticks + timeSpan.Duration = static_cast(std::chrono::duration_cast(interval).count() / 100); + + auto dispatcherTimer = ref new wuixaml::DispatcherTimer(); + dispatcherTimer->Interval = timeSpan; + + cd.Add(Subscribe(FromEventPattern, Platform::Object>( + [dispatcherTimer](wf::EventHandler^ h) { + return dispatcherTimer->Tick += h; }, + [dispatcherTimer](wf::EventRegistrationToken t) { + dispatcherTimer->Tick -= t; + }), + [observer, cursor](EventPattern) mutable { + observer->OnNext(cursor); + ++cursor; + }, + [observer]() { + observer->OnCompleted(); + }, + [observer](std::exception_ptr e) { + observer->OnError(e); + })); + + cd.Add(Disposable( + [observer, dispatcherTimer](){ + dispatcherTimer->Stop(); + observer->OnCompleted(); + })); + + dispatcherTimer->Start(); + + return cd; + }); + } + + struct CoreDispatcherScheduler : public LocalScheduler + { + private: + CoreDispatcherScheduler(const CoreDispatcherScheduler&); + + public: + CoreDispatcherScheduler(wuicore::CoreDispatcher^ dispatcher, wuicore::CoreDispatcherPriority priority = wuicore::CoreDispatcherPriority::Normal) + : dispatcher(dispatcher) + , priority(priority) + { + } + virtual ~CoreDispatcherScheduler() + { + } + + typedef std::shared_ptr shared; + + static shared Current() + { + auto window = wuixaml::Window::Current; + if (window == nullptr) + { + throw std::logic_error("No window current"); + } + return std::make_shared(window->Dispatcher); + } + + wuicore::CoreDispatcher^ Dispatcher() + { + return dispatcher; + } + + wuicore::CoreDispatcherPriority Priority() + { + return priority; + } + + using LocalScheduler::Schedule; + virtual Disposable Schedule(clock::time_point dueTime, Work work) + { + auto that = shared_from_this(); + auto dispatchAsync = [this, that, work](Scheduler::shared sched) mutable -> Disposable + { + dispatcher->RunAsync( + priority, + ref new wuicore::DispatchedHandler( + [that, this, work]() mutable + { + this->Do(work, that); + }, + Platform::CallbackContext::Any + )); + return Disposable::Empty(); + }; + + auto now = Now(); + auto interval = dueTime - now; + if (now > dueTime || interval < std::chrono::milliseconds(10)) + { + return dispatchAsync(nullptr); + } + + wf::TimeSpan timeSpan; + // convert to 100ns ticks + timeSpan.Duration = static_cast(std::chrono::duration_cast(interval).count() / 100); + + auto dispatcherTimer = ref new wuixaml::DispatcherTimer(); + // convert to 100ns ticks + dispatcherTimer->Interval = timeSpan; + + auto result = Subscribe(FromEventPattern, Platform::Object>( + [dispatcherTimer](wf::EventHandler^ h) { + return dispatcherTimer->Tick += h; }, + [dispatcherTimer](wf::EventRegistrationToken t) { + dispatcherTimer->Tick -= t; + }), + [dispatchAsync, dispatcherTimer](EventPattern) mutable { + dispatcherTimer->Stop(); + dispatchAsync(nullptr); + }); + + dispatcherTimer->Start(); + + return result; + } + + private: + wuicore::CoreDispatcher^ dispatcher; + wuicore::CoreDispatcherPriority priority; + }; + +} } + +#endif + +#endif -- GitLab From 4e9ba17516052bc8a2b142ae991d57246be66235 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 27 Aug 2013 08:12:21 -0700 Subject: [PATCH 054/782] Async/Behavior Subject fixes --- Rx/CPP/src/cpprx/rx-operators.hpp | 85 +++++++++++++++++++----------- Rx/CPP/testbench/testbench.exe | Bin 0 -> 1731584 bytes 2 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 Rx/CPP/testbench/testbench.exe diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 91682ba..bbe35eb 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -356,6 +356,7 @@ namespace rxcpp public Observer { std::mutex lock; + size_t slotCount; T value; SubjectState::type state; util::maybe error; @@ -366,7 +367,10 @@ namespace rxcpp std::unique_lock guard(lock); auto it = std::find(begin(observers), end(observers), toRemove); if (it != end(observers)) + { *it = nullptr; + ++slotCount; + } } BehaviorSubject(); @@ -374,7 +378,7 @@ namespace rxcpp typedef std::shared_ptr> shared; - explicit BehaviorSubject(T t) : value(std::move(t)), state(SubjectState::Forwarding) {} + explicit BehaviorSubject(T t) : slotCount(0), value(std::move(t)), state(SubjectState::Forwarding) {} virtual ~BehaviorSubject() { // putting this first means that the observers @@ -417,28 +421,36 @@ namespace rxcpp if (state == SubjectState::Forwarding) { - for(auto& o : observers) + if (slotCount > 0) { - if (!o){ - o = std::move(observer); - return d; + for(auto& o : observers) + { + if (!o) + { + o = observer; + --slotCount; + break; + } } } - observers.push_back(observer); + else + { + observers.push_back(observer); + } } } if (localState == SubjectState::Completed) { - observer->OnNext(localValue.get()); + observer->OnNext(*localValue.get()); observer->OnCompleted(); return Disposable::Empty(); } else if (localState == SubjectState::Error) { - observer->OnError(localError.get()); + observer->OnError(*localError.get()); return Disposable::Empty(); } else if (localState == SubjectState::Forwarding) { - observer->OnNext(localValue.get()); + observer->OnNext(*localValue.get()); } return d; @@ -499,6 +511,7 @@ namespace rxcpp public Observer { std::mutex lock; + size_t slotCount; util::maybe value; SubjectState::type state; util::maybe error; @@ -509,14 +522,17 @@ namespace rxcpp std::unique_lock guard(lock); auto it = std::find(begin(observers), end(observers), toRemove); if (it != end(observers)) + { *it = nullptr; + ++slotCount; + } } public: typedef std::shared_ptr> shared; - AsyncSubject() : value(), state(SubjectState::Forwarding) {} + AsyncSubject() : slotCount(0), value(), state(SubjectState::Forwarding) {} virtual ~AsyncSubject() { // putting this first means that the observers @@ -558,14 +574,22 @@ namespace rxcpp } else if (state == SubjectState::Forwarding) { - for (auto& o : observers) + if (slotCount > 0) { - if (!o){ - o = std::move(observer); - return d; + for (auto& o : observers) + { + if (!o) + { + o = observer; + --slotCount; + break; + } } } - observers.push_back(observer); + else + { + observers.push_back(observer); + } } } @@ -656,7 +680,9 @@ namespace rxcpp } template - class ConnectableSubject : ConnectableObservable::type> + class ConnectableSubject : + public std::enable_shared_from_this>, + public ConnectableObservable::type> { private: ConnectableSubject(); @@ -680,12 +706,13 @@ namespace rxcpp { subscription.set(source->Subscribe(observer(subject))); } - return Disposable([]() + auto that = this->shared_from_this(); + return Disposable([that]() { - if (subscription) + if (that->subscription) { - subscription->Dispose(); - subscription.reset(); + that->subscription->Dispose(); + that->subscription.reset(); } }); } @@ -1909,24 +1936,21 @@ namespace rxcpp template std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) { - typedef std::shared_ptr> MulticastSubject; - auto multicastSubject = std::make_shared(); + auto multicastSubject = std::make_shared>(); return Multicast(source, multicastSubject); } template std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source, V value) { - typedef std::shared_ptr> MulticastSubject; - auto multicastSubject = std::make_shared(value); + auto multicastSubject = std::make_shared>(value); return Multicast(source, multicastSubject); } template std::shared_ptr> PublishLast(const std::shared_ptr < Observable < T >> &source) { - typedef std::shared_ptr> MulticastSubject; - auto multicastSubject = std::make_shared(); + auto multicastSubject = std::make_shared>(); return Multicast(source, multicastSubject); } @@ -1937,7 +1961,7 @@ namespace rxcpp { struct State { - State() : refcount(0) {} + State() : refcount(0), subscription(Disposable::Empty()) {} std::mutex lock; size_t refcount; Disposable subscription; @@ -1945,9 +1969,10 @@ namespace rxcpp auto state = std::make_shared(); return CreateObservable( - [=](std::shared_ptr < Observer < T >> observer) + [=](std::shared_ptr < Observer < T >> observer) -> Disposable { - auto subscription = Subscribe( + auto subscription = std::make_shared(Disposable::Empty()); + *subscription.get() = Subscribe( source, // on next [=](const T& element) @@ -1974,7 +1999,7 @@ namespace rxcpp } return Disposable([=](){ - subscription.Dispose(); + subscription->Dispose(); std::unique_lock guard(state->lock); if (--state->refcount == 0) diff --git a/Rx/CPP/testbench/testbench.exe b/Rx/CPP/testbench/testbench.exe new file mode 100644 index 0000000000000000000000000000000000000000..ce8ef7ef51e160e1da5e1bd243ca203859ba278f GIT binary patch literal 1731584 zcmeZ`n!v!!z`(%5z`*eTKLf)K1_*F~P^1JvLws4+R+`;H`Rxu$aR;Z1VY zzjDC*jlYB+ZuqryUH&g0Fdg{oIhYRkwejJGU(YrM{>lT>d0;vyGdTlf2Gm%F09OVE zA4XP&^Lu21U}6s#m>9Vkc^DYh2{SM-u!DtHR|_yO2rw`(8~}+qK-f$S3~XRo1kLb3 z3KB>R3=GT+4vk=iAblXsU>Ym})y2SYBoPJ)1_p+P zNg@m=adAMH;S6qV401Ia6k+!4lT`)*%qu{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nVVX;Q~ajhQS8| z3BwhJ7DfWb1;#gw6HLCC7?^69WtcrM`(eJpBEfQn)eoBha0s5TE3kh6a{B{_e=Q6q z82m5@FkE5CU=(2#VH{x+VH#l;VIE=e!GgnThgEzEvm2HL;Fz|sv9P^hn_&mmDFD$o!(fKt45JywGfZZHOXwA59OgI7JuDO~ z9jqo;X;?q7PO$l5v%%H_qKkn+K?0n%0}L*JQ$~W(10xG#4wDNe8Kw$m9cBXN8DRYq zmNP6FtS(qNSZ}ayu=!wpmSw=Y&2{i*jCsH*q;E!MF7Ok1cM(28w@>+9vICqE->K$o&RQ*VXk1Y z!y>?v!|H)mg|&f=gY6C533dUHJdhy4U;ygc8CV!zFv>7iFnM57VQOG@!t8~4gN23V z56cNw9@Ysq9CiyJ>9s%toW?B-E*NweIvCwBnqaJ9qG76GreUsOp<$_Eb-*eD9Crz} z5_S@h^0xuvwhjXaLkA-V;~T~|Om3LoFe@|ndaGK_@?|`^%0wg?k z7vUV)nyK!ra0<#=ORSf%zTq`cnss6pI-aKP*%%BP?fFUa@4bGO^0BT4Hs@>W`I) zb%FH`>o3+iHW@Y(Z1&iEuu-uMv26jjt~~4->@L_b*sIvv*caH(vA+Upk3W!L@BrIe zVz9#Cf&q`AgJFT;6vGpSJVqWyEk-+xUKq(3dl=UkuQ9%2%wytVvI5+eaWJhgU1NI1 zl*i1)ti)`C8N( Date: Tue, 27 Aug 2013 08:12:30 -0700 Subject: [PATCH 055/782] Binder fixes --- Rx/CPP/src/cpprx/rx.hpp | 72 ++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index c97b322..166dc81 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -45,19 +45,18 @@ namespace detail { return b.obj; } - template + template class BinderNested; - template - class BinderNested : public BinderBase + template + class BinderNested : public Base { protected: - typedef BinderBase base; - typedef typename base::item_type item_type; - using base::obj; + typedef typename Base::item_type item_type; + using Base::obj; public: static const bool is_item_observable = false; - BinderNested(Obj obj) : BinderBase(std::move(obj)) + BinderNested(Obj obj) : Base(std::move(obj)) { } @@ -65,17 +64,16 @@ namespace detail { void concat(); }; - template - class BinderNested : public BinderBase + template + class BinderNested : public Base { protected: - typedef BinderBase base; - typedef typename base::item_type item_type; - using base::obj; + typedef typename Base::item_type item_type; + using Base::obj; public: static const bool is_item_observable = true; - BinderNested(Obj obj) : base(std::move(obj)) + BinderNested(Obj obj) : Base(std::move(obj)) { } @@ -89,15 +87,23 @@ namespace detail { } }; - template - class BinderConnectable + template + class BinderConnectable : public Base { + public: + BinderConnectable(Obj obj) : Base(std::move(obj)) + { + } }; - template - class BinderConnectable>> + template + class BinderConnectable>> : public Base { public: + BinderConnectable(std::shared_ptr> obj) : Base(std::move(obj)) + { + } + auto ref_count() -> decltype(from(RefCount(obj))) { return from(RefCount(obj)); @@ -106,15 +112,21 @@ namespace detail { template class Binder : public BinderNested< + BinderConnectable< + BinderBase::type, Obj>, + typename observable_item::type, + Obj + >, typename observable_item::type, Obj, - is_observable::type>::value>, - public BinderConnectable< - typename observable_item::type, - Obj - > + is_observable::type>::value> { typedef BinderNested< + BinderConnectable< + BinderBase::type, Obj>, + typename observable_item::type, + Obj + >, typename observable_item::type, Obj, is_observable::type>::value> base; @@ -274,20 +286,20 @@ namespace detail { } template auto multicast(MulticastSubject subject) - -> decltype(from(Multicast(obj, subject))) { - return from(Multicast(obj, subject)); + -> decltype(from(Multicast(observable(obj), subject))) { + return from(Multicast(observable(obj), subject)); } auto publish() - -> decltype(from(Publish(obj))) { - return from(Publish(obj)); + -> decltype(from(Publish(observable(obj)))) { + return from(Publish(observable(obj))); } auto publish(item_type value) - -> decltype(from(Publish(obj, value))) { - return from(Publish(obj, value)); + -> decltype(from(Publish(observable(obj), value))) { + return from(Publish(observable(obj), value)); } auto publish_last() - -> decltype(from(PublishLast(obj))) { - return from(PublishLast(obj)); + -> decltype(from(PublishLast(observable(obj)))) { + return from(PublishLast(observable(obj))); } templateclass Allocator> auto to_vector() -- GitLab From 1dddb22b63443c7b299a85918c578c5b6b79ab01 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 27 Aug 2013 08:13:18 -0700 Subject: [PATCH 056/782] add tests for publish, refcount, publish_last and multicast --- Rx/CPP/testbench/testbench.cpp | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index b43b39e..d860a89 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -232,6 +232,80 @@ void Merge(int n) })); } +void RefCount(int n) +{ + auto loop = std::make_shared(); + + auto values1 = rxcpp::from(rxcpp::Range(1)) + .subscribe_on(loop) + .where(IsPrime) + .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .publish() + .ref_count(); // infinite (until overflow) stream of prime integers + + auto v1 = rxcpp::from(values1) + .select([](int prime1) -> std::tuple {return std::make_tuple("1: ", prime1);}); + + auto v2 = rxcpp::from(values1) + .select([](int prime1) -> std::tuple {return std::make_tuple("2: ", prime1);}); + + cout << "Merge 2 subscriptions to published primes:"; + rxcpp::from(v1) + .merge(v2) + .take(n) + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout << s << p << ", "; + })); + + auto values2 = rxcpp::from(rxcpp::Range(100)) + .subscribe_on(loop) + .where(IsPrime) + .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .publish(1000) + .ref_count(); // infinite (until overflow) stream of prime integers + + cout << endl << "Subscription 1 - published primes:" << endl; + rxcpp::from(values2) + .take(n/2) + .for_each( + [](int p) { + cout << p << ", "; + }); + + cout << endl << "Subscription 2 - published primes:" << endl; + rxcpp::from(values2) + .take(n/2) + .for_each( + [](int p) { + cout << p << ", "; + }); + + auto values3 = rxcpp::from(rxcpp::Range(200)) + .subscribe_on(loop) + .where(IsPrime) + .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .take(n/2) + .publish_last() + .ref_count(); // infinite (until overflow) stream of prime integers + + cout << endl << "Subscription 1 - last published prime:"; + rxcpp::from(values3) + .for_each( + [](int p) { + cout << p << ", "; + }); + + cout << endl << "Subscription 2 - last published prime:" << endl; + rxcpp::from(values3) + .for_each( + [](int p) { + cout << p << ", "; + }); + cout << endl; +} + + void PrintIntervals(int n) { using namespace std::chrono; typedef steady_clock clock; @@ -399,6 +473,7 @@ void innerScheduler() { int main(int argc, char* argv[]) { try { + RefCount(20); PrintIntervals(10); IxToRx(20); PrintPrimes(20); -- GitLab From 769b889472c700a4d29ca4fd528f56056240f11e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 27 Aug 2013 08:20:38 -0700 Subject: [PATCH 057/782] fix windows include guard --- Rx/CPP/src/cpprx/rx-windows.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index fab0dd1..5284744 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -7,7 +7,7 @@ #define CPPRX_RX_WINDOWS_HPP #pragma once -#if defined(BUILDING_FOR_DESKTOP) && (defined(WINDOWS) || defined(WIN32) || defined(_WIN32)) +#if (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) && (defined(WINDOWS) || defined(WIN32) || defined(_WIN32)) #pragma comment(lib, "user32.lib") -- GitLab From eb24962d810c2e2a0ab36deae1e7da0b5014808f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 27 Aug 2013 09:46:03 -0700 Subject: [PATCH 058/782] fixes for clang --- Rx/CPP/src/cpprx/rx-operators.hpp | 14 +++++++------- Rx/CPP/src/cpprx/rx.hpp | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index bbe35eb..079d957 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -1961,18 +1961,18 @@ namespace rxcpp { struct State { - State() : refcount(0), subscription(Disposable::Empty()) {} + State() : refcount(0) {} std::mutex lock; size_t refcount; - Disposable subscription; + SerialDisposable subscription; }; auto state = std::make_shared(); return CreateObservable( [=](std::shared_ptr < Observer < T >> observer) -> Disposable { - auto subscription = std::make_shared(Disposable::Empty()); - *subscription.get() = Subscribe( + SerialDisposable subscription; + subscription.Set(Subscribe( source, // on next [=](const T& element) @@ -1988,18 +1988,18 @@ namespace rxcpp [=](const std::exception_ptr& error) { observer->OnError(error); - }); + })); { std::unique_lock guard(state->lock); if (++state->refcount == 1) { - state->subscription = source->Connect(); + state->subscription.Set(source->Connect()); } } return Disposable([=](){ - subscription->Dispose(); + subscription.Dispose(); std::unique_lock guard(state->lock); if (--state->refcount == 0) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 166dc81..efecd89 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -90,6 +90,9 @@ namespace detail { template class BinderConnectable : public Base { + protected: + typedef typename Base::item_type item_type; + using Base::obj; public: BinderConnectable(Obj obj) : Base(std::move(obj)) { @@ -99,6 +102,9 @@ namespace detail { template class BinderConnectable>> : public Base { + protected: + typedef typename Base::item_type item_type; + using Base::obj; public: BinderConnectable(std::shared_ptr> obj) : Base(std::move(obj)) { -- GitLab From a3d5e94addf02aaed3e59d4048ac9410531dc231 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 29 Aug 2013 00:40:43 -0700 Subject: [PATCH 059/782] Rewrite RefCount using Sink and Producer --- Rx/CPP/src/cpprx/rx-base.hpp | 6 +- Rx/CPP/src/cpprx/rx-operators.hpp | 258 ++++++++++++++++++++++++------ Rx/CPP/testbench/testbench.cpp | 16 +- 3 files changed, 225 insertions(+), 55 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index eb5cf5e..1ad3966 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -15,9 +15,9 @@ namespace rxcpp template struct Observer { - virtual void OnNext(const T&) {}; - virtual void OnCompleted() {}; - virtual void OnError(const std::exception_ptr&) {}; + virtual void OnNext(const T&) {} + virtual void OnCompleted() {} + virtual void OnError(const std::exception_ptr&) {} virtual ~Observer() {} }; diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 079d957..94a3cd6 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -182,6 +182,141 @@ namespace rxcpp return p; } + + namespace detail + { + template + class Sink : public std::enable_shared_from_this + { + typedef std::shared_ptr> SinkObserver; + mutable std::mutex lock; + mutable util::maybe cancel; + + protected: + mutable SinkObserver observer; + + public: + Sink(SinkObserver observerArg, Disposable cancelArg) : + observer(std::move(observerArg)) + { + cancel.set(std::move(cancelArg)); + if (!observer) + { + observer = std::make_shared>(); + } + } + + void Dispose() const + { + std::unique_lock guard(lock); + observer = std::make_shared>(); + if (cancel) + { + cancel->Dispose(); + cancel.reset(); + } + } + + Disposable GetDisposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = this->shared_from_this(); + return Disposable([local]{ + local->Dispose(); + }); + } + + class _ : public Observer + { + std::shared_ptr that; + public: + _(std::shared_ptr that) : that(that) + {} + + virtual void OnNext(const T& t) + { + std::unique_lock guard(that->lock); + that->observer->OnNext(t); + } + virtual void OnCompleted() + { + std::unique_lock guard(that->lock); + that->observer->OnCompleted(); + if (that->cancel) + { + that->cancel->Dispose(); + that->cancel.reset(); + } + } + virtual void OnError(const std::exception_ptr& e) + { + std::unique_lock guard(that->lock); + that->observer->OnError(e); + if (that->cancel) + { + that->cancel->Dispose(); + that->cancel.reset(); + } + } + }; + }; + + template + class Producer : public std::enable_shared_from_this, public Observable + { + public: + typedef std::function SetSink; + typedef std::function, std::shared_ptr>, Disposable, SetSink)> Run; + private: + Run run; + struct State + { + SerialDisposable sink; + SerialDisposable subscription; + }; + public: + Producer(Run run) : + run(std::move(run)) + { + } + + virtual Disposable Subscribe(std::shared_ptr> observer) + { + auto state = std::make_shared(); + auto that = this->shared_from_this(); + if (CurrentThreadScheduler::IsScheduleRequired()) { + auto scheduler = std::make_shared(); + scheduler->Schedule([=](Scheduler::shared) -> Disposable + { + state->subscription.Set( + run(that, observer, state->subscription, [=](Disposable d) + { + state->sink.Set(std::move(d)); + })); + return Disposable::Empty(); + }); + } + else + { + state->subscription.Set( + run(that, observer, state->subscription, [=](Disposable d) + { + state->sink.Set(std::move(d)); + })); + } + return Disposable([=]() + { + state->sink.Dispose(); + state->subscription.Dispose(); + }); + } + }; + + } + + struct SubjectState { enum type { Invalid, @@ -687,8 +822,8 @@ namespace rxcpp private: ConnectableSubject(); - Subject subject; Source source; + Subject subject; util::maybe subscription; std::mutex lock; @@ -709,6 +844,7 @@ namespace rxcpp auto that = this->shared_from_this(); return Disposable([that]() { + std::unique_lock guard(that->lock); if (that->subscription) { that->subscription->Dispose(); @@ -1953,61 +2089,93 @@ namespace rxcpp auto multicastSubject = std::make_shared>(); return Multicast(source, multicastSubject); } - - template - const std::shared_ptr> RefCount( - const std::shared_ptr>& source - ) + namespace detail { - struct State + template + class RefCountObservable : public Producer, T> { - State() : refcount(0) {} + std::shared_ptr> source; std::mutex lock; size_t refcount; - SerialDisposable subscription; - }; - auto state = std::make_shared(); - - return CreateObservable( - [=](std::shared_ptr < Observer < T >> observer) -> Disposable - { - SerialDisposable subscription; - subscription.Set(Subscribe( - source, - // on next - [=](const T& element) - { - observer->OnNext(element); - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) + util::maybe subscription; + + class _ : public Sink<_, T>, public Observer { - observer->OnError(error); - })); - - { - std::unique_lock guard(state->lock); - if (++state->refcount == 1) + std::shared_ptr> parent; + + public: + typedef Sink<_, T> SinkBase; + + _(std::shared_ptr> parent, std::shared_ptr> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) { - state->subscription.Set(source->Connect()); } - } + + Disposable Run() + { + SerialDisposable subscription; + subscription.Set(parent->source->Subscribe(this->shared_from_this())); + + std::unique_lock guard(parent->lock); + if (++parent->refcount == 1) + { + parent->subscription.set(parent->source->Connect()); + } - return Disposable([=](){ - subscription.Dispose(); + auto local = parent; - std::unique_lock guard(state->lock); - if (--state->refcount == 0) + return Disposable([subscription, local]() + { + subscription.Dispose(); + std::unique_lock guard(local->lock); + if (--local->refcount == 0) + { + local->subscription->Dispose(); + local->subscription.reset(); + } + }); + } + + virtual void OnNext(const T& t) { - state->subscription.Dispose(); + SinkBase::observer->OnNext(t); } - }); - }); + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer, T> ProducerBase; + public: + + RefCountObservable(std::shared_ptr> source) : + ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::make_shared<_>(that, observer, std::move(cancel)); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + refcount(0), + source(std::move(source)) + { + subscription.set(Disposable::Empty()); + } + }; + } + template + const std::shared_ptr> RefCount( + const std::shared_ptr>& source + ) + { + return std::make_shared>(source); } template diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index d860a89..6122fd7 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -237,9 +237,8 @@ void RefCount(int n) auto loop = std::make_shared(); auto values1 = rxcpp::from(rxcpp::Range(1)) - .subscribe_on(loop) .where(IsPrime) - .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) .publish() .ref_count(); // infinite (until overflow) stream of prime integers @@ -252,6 +251,7 @@ void RefCount(int n) cout << "Merge 2 subscriptions to published primes:"; rxcpp::from(v1) .merge(v2) + .subscribe_on(loop) .take(n) .for_each(rxcpp::MakeTupleDispatch( [](const char* s, int p) { @@ -259,14 +259,14 @@ void RefCount(int n) })); auto values2 = rxcpp::from(rxcpp::Range(100)) - .subscribe_on(loop) .where(IsPrime) - .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) .publish(1000) .ref_count(); // infinite (until overflow) stream of prime integers cout << endl << "Subscription 1 - published primes:" << endl; rxcpp::from(values2) + .subscribe_on(loop) .take(n/2) .for_each( [](int p) { @@ -275,6 +275,7 @@ void RefCount(int n) cout << endl << "Subscription 2 - published primes:" << endl; rxcpp::from(values2) + .subscribe_on(loop) .take(n/2) .for_each( [](int p) { @@ -282,15 +283,15 @@ void RefCount(int n) }); auto values3 = rxcpp::from(rxcpp::Range(200)) - .subscribe_on(loop) .where(IsPrime) - .select([](int p){cout << endl << "producing: " << p << "-> "; return p;}) + .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) .take(n/2) .publish_last() - .ref_count(); // infinite (until overflow) stream of prime integers + .ref_count(); // last of n/2 prime integers cout << endl << "Subscription 1 - last published prime:"; rxcpp::from(values3) + .subscribe_on(loop) .for_each( [](int p) { cout << p << ", "; @@ -298,6 +299,7 @@ void RefCount(int n) cout << endl << "Subscription 2 - last published prime:" << endl; rxcpp::from(values3) + .subscribe_on(loop) .for_each( [](int p) { cout << p << ", "; -- GitLab From fad7930bbba99dc8b3ce773083b721856515b463 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 29 Aug 2013 00:59:25 -0700 Subject: [PATCH 060/782] workaround vc issue --- Rx/CPP/src/cpprx/rx-operators.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 94a3cd6..15abdd8 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -2157,9 +2157,9 @@ namespace rxcpp public: RefCountObservable(std::shared_ptr> source) : - ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable cancel, typename ProducerBase::SetSink setSink) -> Disposable + ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable&& cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::make_shared<_>(that, observer, std::move(cancel)); + auto sink = std::shared_ptr<_>(new _(that, observer, std::move(cancel))); setSink(sink->GetDisposable()); return sink->Run(); }), -- GitLab From b95c1c05ac4d1d2976fdf4ea9f8307eb6938861d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 29 Aug 2013 01:12:09 -0700 Subject: [PATCH 061/782] remove testbench.exe file --- Rx/CPP/testbench/testbench.exe | Bin 1731584 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Rx/CPP/testbench/testbench.exe diff --git a/Rx/CPP/testbench/testbench.exe b/Rx/CPP/testbench/testbench.exe deleted file mode 100644 index ce8ef7ef51e160e1da5e1bd243ca203859ba278f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1731584 zcmeZ`n!v!!z`(%5z`*eTKLf)K1_*F~P^1JvLws4+R+`;H`Rxu$aR;Z1VY zzjDC*jlYB+ZuqryUH&g0Fdg{oIhYRkwejJGU(YrM{>lT>d0;vyGdTlf2Gm%F09OVE zA4XP&^Lu21U}6s#m>9Vkc^DYh2{SM-u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Crz} z5_S@h^0xuvwhjXaLkA-V;~T~|Om3LoFe@|ndaGK_@?|`^%0wg?k z7vUV)nyK!ra0<#=ORSf%zTq`cnss6pI-aKP*%%BP?fFUa@4bGO^0BT4Hs@>W`I) zb%FH`>o3+iHW@Y(Z1&iEuu-uMv26jjt~~4->@L_b*sIvv*caH(vA+Upk3W!L@BrIe zVz9#Cf&q`AgJFT;6vGpSJVqWyEk-+xUKq(3dl=UkuQ9%2%wytVvI5+eaWJhgU1NI1 zl*i1)ti)`C8N( Date: Fri, 30 Aug 2013 23:24:10 -0700 Subject: [PATCH 062/782] fix for ScheduledObserver --- Rx/CPP/src/cpprx/rx-scheduler.hpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 2a3a5fc..ca72835 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -268,21 +268,36 @@ namespace rxcpp std::unique_lock guard(lock); auto local = this->shared_from_this(); queue.push(Action([=](){ - local->observer->OnNext(std::move(element));})); + std::unique_lock guard(lock); + auto o = local->observer; + guard.unlock(); + if (o){ + o->OnNext(std::move(element)); + }})); } virtual void OnCompleted() { std::unique_lock guard(lock); auto local = this->shared_from_this(); queue.push(Action([=](){ - local->observer->OnCompleted();})); + std::unique_lock guard(lock); + auto o = local->observer; + guard.unlock(); + if (o){ + o->OnCompleted(); + }})); } virtual void OnError(const std::exception_ptr& error) { std::unique_lock guard(lock); auto local = this->shared_from_this(); queue.push(Action([=](){ - local->observer->OnError(std::move(error));})); + std::unique_lock guard(lock); + auto o = local->observer; + guard.unlock(); + if (o){ + o->OnError(std::move(error)); + }})); } void EnsureActive() -- GitLab From 6a1fc44dcce3e71d780fd7976bacbee80e2b808c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 30 Aug 2013 23:34:19 -0700 Subject: [PATCH 063/782] Adds many new operators and some bug fixes - DeferOperation - ReactiveCommand and BindCommand - Producer and Sink helpers - Return - Throw - Using - ConnectForever - Scan --- Rx/CPP/src/cpprx/rx-operators.hpp | 373 ++++++++++++++++++++++++++++-- Rx/CPP/src/cpprx/rx-winrt.hpp | 320 ++++++++++++++++++++++++- Rx/CPP/src/cpprx/rx.hpp | 9 + 3 files changed, 679 insertions(+), 23 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 15abdd8..0589c09 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -789,29 +789,34 @@ namespace rxcpp return std::make_shared>(); } - template - auto ToAsync(Scheduler::shared scheduler, F && f) - -> std::shared_ptr> + template + std::function < std::shared_ptr < Observable> (A)> ToAsync(std::function f, Scheduler::shared scheduler = nullptr) { - typedef decltype(f()) Value; - auto result = CreateAsyncSubject(); - scheduler->Schedule([=]() -> Disposable + if (!scheduler) { - util::maybe value; - try - { - value.set(f()); - } - catch (...) + scheduler = std::make_shared(); + } + return [=](A a) -> std::shared_ptr < Observable> + { + auto result = CreateAsyncSubject(); + scheduler->Schedule([=](Scheduler::shared) -> Disposable { - result->OnError(std::current_exception()); + util::maybe value; + try + { + value.set(f(a)); + } + catch (...) + { + result->OnError(std::current_exception()); + return Disposable::Empty(); + } + result->OnNext(*value.get()); + result->OnCompleted(); return Disposable::Empty(); - } - result->OnNext(value.get()); - result->OnCompleted(); - return Disposable::Empty(); - }); - return result; + }); + return result; + }; } template @@ -859,6 +864,136 @@ namespace rxcpp } }; + + namespace detail + { + template + class ReturnObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + T value; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnNext(local->value); + that->SinkBase::observer->OnCompleted(); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer, T> ProducerBase; + public: + + ReturnObservable(T value, Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + value(value) + { + if (!scheduler) + { + scheduler = std::make_shared(); + } + } + }; + } + template + const std::shared_ptr> Return( + T value, + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(value), std::move(scheduler)); + } + + namespace detail + { + template + class ThrowObservable : public Producer, T> + { + typedef ThrowObservable This; + typedef std::shared_ptr Parent; + + std::exception_ptr exception; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnError(local->exception); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer ProducerBase; + public: + + ThrowObservable(std::exception_ptr exception, Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + exception(exception) + { + if (!scheduler) + { + scheduler = std::make_shared(); + } + } + }; + } + template + const std::shared_ptr> Throw( + std::exception_ptr exception, + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(exception), std::move(scheduler)); + } + template struct fix0_thunk { F f; @@ -1036,6 +1171,101 @@ namespace rxcpp }); } + namespace detail + { + template + class UsingObservable : public Producer, T> + { + typedef UsingObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr> Source; + + public: + typedef std::function ResourceFactory; + typedef std::function ObservableFactory; + + private: + ResourceFactory resourceFactory; + ObservableFactory observableFactory; + + class _ : public Sink<_, T>, public Observer + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + ComposableDisposable cd; + Source source; + auto disposable = Disposable::Empty(); + + try + { + auto resource = parent->resourceFactory(); + disposable = resource; + source = parent->observableFactory(resource); + } + catch (...) + { + cd.Add(Throw(std::current_exception())->Subscribe(this->shared_from_this())); + cd.Add(std::move(disposable)); + return cd; + } + + cd.Add(source->Subscribe(this->shared_from_this())); + cd.Add(std::move(disposable)); + return cd; + } + + virtual void OnNext(const T& t) + { + SinkBase::observer->OnNext(t); + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; + public: + + UsingObservable(ResourceFactory resourceFactory, ObservableFactory observableFactory) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + resourceFactory(resourceFactory), + observableFactory(observableFactory) + { + } + }; + } + template + const std::shared_ptr> Using( + typename detail::UsingObservable::ResourceFactory resourceFactory, + typename detail::UsingObservable::ObservableFactory observableFactory + ) + { + return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); + } + ////////////////////////////////////////////////////////////////////// // // imperative functions @@ -1143,7 +1373,7 @@ namespace rxcpp const typename observable_item< typename std::result_of::type>::type&)>::type>> { - typedef typename std::result_of::type C; + typedef typename std::decay::type>::type C; typedef typename observable_item::type CI; typedef typename std::result_of::type U; @@ -2089,6 +2319,7 @@ namespace rxcpp auto multicastSubject = std::make_shared>(); return Multicast(source, multicastSubject); } + namespace detail { template @@ -2178,6 +2409,108 @@ namespace rxcpp return std::make_shared>(source); } + template + const std::shared_ptr> ConnectForever( + const std::shared_ptr>& source + ) + { + source->Connect(); + return observable(source); + } + + namespace detail + { + template + class ScanObservable : public Producer, A> + { + typedef ScanObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr> Source; + typedef std::shared_ptr> Destination; + + public: + typedef std::function Accumulator; + + private: + + Source source; + A seed; + Accumulator accumulator; + + class _ : public Sink<_, A>, public Observer + { + Parent parent; + util::maybe accumulation; + + public: + typedef Sink<_, A> SinkBase; + + _(Parent parent, Destination observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + virtual void OnNext(const T& t) + { + try + { + if (accumulation) + { + accumulation.set(parent->accumulator(*accumulation.get(), t)); + } + else + { + accumulation.set(parent->accumulator(parent->seed, t)); + } + } + catch (...) + { + SinkBase::observer->OnError(std::current_exception()); + SinkBase::Dispose(); + return; + } + SinkBase::observer->OnNext(*accumulation.get()); + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; + public: + + ScanObservable(Source source, A seed, Accumulator accumulator) : + ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(std::move(source)), + seed(std::move(seed)), + accumulator(std::move(accumulator)) + { + } + }; + } + template + const std::shared_ptr> Scan( + const std::shared_ptr>& source, + A seed, + typename detail::ScanObservable::Accumulator accumulator + ) + { + return std::make_shared>(std::move(source), std::move(seed), std::move(accumulator)); + } + template std::shared_ptr> Take( const std::shared_ptr>& source, diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index 02d15da..9b3dca6 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -14,6 +14,7 @@ namespace rxcpp { namespace winrt { namespace wf = Windows::Foundation; namespace wuicore = Windows::UI::Core; namespace wuixaml = Windows::UI::Xaml; + namespace wuictrls = Windows::UI::Xaml::Controls; template struct EventPattern @@ -23,9 +24,9 @@ namespace rxcpp { namespace winrt { eventargs(eventargs) {} - TSender Sender() { + TSender Sender() const { return sender;}; - TEventArgs EventArgs() { + TEventArgs EventArgs() const { return eventargs;}; private: @@ -288,7 +289,12 @@ namespace rxcpp { namespace winrt { { throw std::logic_error("No window current"); } - return std::make_shared(window->Dispatcher); + auto d = window->Dispatcher; + if (d == nullptr) + { + throw std::logic_error("No dispatcher on current window"); + } + return std::make_shared(d); } wuicore::CoreDispatcher^ Dispatcher() @@ -355,6 +361,314 @@ namespace rxcpp { namespace winrt { wuicore::CoreDispatcherPriority priority; }; + template + class ReactiveCommand : public Observable + { + typedef ReactiveCommand This; + + std::mutex flight_lock; + std::shared_ptr < Subject> inflight; + std::shared_ptr < Subject> exceptions; + std::shared_ptr> executed; + Scheduler::shared defaultScheduler; + bool allowsConcurrentExecution; + std::shared_ptr < Observable < bool >> isExecuting; + std::shared_ptr < Observable < bool >> canExecuteObservable; + + public: + typedef std::shared_ptr shared; + + ReactiveCommand(std::shared_ptr < Observable < bool >> canExecute = nullptr, bool allowsConcurrentExecution = false, Scheduler::shared scheduler = nullptr, bool initialCondition = true) : + inflight(std::make_shared < Subject < bool >> ()), + exceptions(std::make_shared < Subject >()), + executed(std::make_shared < Subject < T >> ()), + defaultScheduler(scheduler), + allowsConcurrentExecution(allowsConcurrentExecution) + { + if (!canExecute) + { + canExecute = Return(true); + } + if (!defaultScheduler) + { + defaultScheduler = std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()); + } + + isExecuting = observable(from(inflight) + .scan(0, [](int balanced, bool in) { + return in ? balanced + 1 : balanced - 1; }) + .select([](int balanced) { + return balanced > 0; }) + .publish(false) + .connect_forever() + .distinct_until_changed()); + + auto isBusy = allowsConcurrentExecution ? Return(false) : isExecuting; + auto canExecuteAndNotBusy = from(isBusy) + .combine_latest([](bool b, bool ce) + { + return ce && !b; + }, canExecute); + + auto canExecuteObs = from(canExecuteAndNotBusy) + .publish(initialCondition) + .ref_count(); + + canExecuteObservable = observable(from(canExecuteObs) + .distinct_until_changed() + .observe_on(defaultScheduler)); + } + + template + std::shared_ptr> RegisterAsync(std::function>(T)> f) + { + return observable(from(executed) + .select_many( + // select collection + [=](T t) -> std::shared_ptr> + { + return Using( + // resource factory + [=]() -> SerialDisposable + { + std::unique_lock guard(flight_lock); + inflight->OnNext(true); + SerialDisposable flight; + flight.Set(ScheduledDisposable( + defaultScheduler, + Disposable([=]() + { + std::unique_lock guard(flight_lock); + inflight->OnNext(false); + }))); + return flight; + }, + // observable factory + [=](SerialDisposable) -> std::shared_ptr> + { + return f(t); + }); + }) + .observe_on(defaultScheduler) + .publish() + .connect_forever()); + } + + template + std::shared_ptr> RegisterAsyncFunction(std::function < R(T)> f, Scheduler::shared scheduler = nullptr) + { + auto asyncFunc = ToAsync(f, scheduler); + return RegisterAsync(asyncFunc); + } + + bool AllowsConcurrentExecution() + { + return allowsConcurrentExecution; + } + + std::shared_ptr> ThrownExceptions() + { + return from(exceptions).observe_on(defaultScheduler); + } + + std::shared_ptr> IsExecuting() + { + return isExecuting; + } + + std::shared_ptr> CanExecuteObservable() + { + return canExecuteObservable; + } + + Disposable Subscribe(std::shared_ptr < Observer < T >> observer) + { + return from(executed) + .subscribe( + //on next + [=](const T& t){ + try + { + observer->OnNext(t); + } + catch (...) + { + exceptions->OnError(std::current_exception()); + } + }, + //on completed + [=](){ + try + { + observer->OnCompleted(); + } + catch (...) + { + exceptions->OnError(std::current_exception()); + } + }, + //on error + [=](std::exception_ptr e){ + try + { + observer->OnError(e); + } + catch (...) + { + exceptions->OnError(std::current_exception()); + } + }); + } + + void Execute(T value) + { + { + std::unique_lock guard(flight_lock); + inflight->OnNext(true); + } + executed->OnNext(value); + { + std::unique_lock guard(flight_lock); + inflight->OnNext(false); + } + } + }; + + template + std::shared_ptr> observable(std::shared_ptr < ReactiveCommand < T >> s){ return std::static_pointer_cast < Observable < T >> (s); } + + template + Disposable BindCommand(wuictrls::Button^ button, std::shared_ptr> command) + { + typedef rxrt::EventPattern RoutedEventPattern; + + ComposableDisposable cd; + + cd.Add(from(command->CanExecuteObservable()) + .subscribe( + [=](bool b) + { + button->IsEnabled = b; + })); + + auto click = rxrt::FromEventPattern( + [=](wuixaml::RoutedEventHandler^ h) + { + return button->Click += h; + }, + [=](wf::EventRegistrationToken t) + { + button->Click -= t; + }); + + cd.Add(from(click) + .subscribe([=](RoutedEventPattern ep) + { + command->Execute(ep); + })); + + return cd; + } + + template + struct OperationPattern + { + typedef decltype(((O)nullptr)->GetDeferral()) D; + + OperationPattern(O operation) : + operation(operation), + deferral(operation->GetDeferral()) + { + } + + O Operation() const { + return operation; + }; + D Deferral() const { + return deferral; + }; + + private: + O operation; + D deferral; + }; + + namespace detail + { + + template + auto DeferOperation(const std::shared_ptr < Observable < T >> &source, SOp sop, SOb sob, Scheduler::shared scheduler = nullptr) + -> decltype(sob(*(OperationPattern*)nullptr, *(T*) nullptr)) + { + typedef decltype(sob(*(OperationPattern*)nullptr, *(T*) nullptr)) ResultObservable; + typedef typename observable_item::type Result; + if (!scheduler) + { + scheduler = std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()); + } + return rx::CreateObservable( + [=](const std::shared_ptr < Observer < Result >> &observer) + { + return from(source) + .select_many( + //select observable + [=](T t) -> ResultObservable + { + // must take the deferral early while the event is still on the stack. + auto o = sop(t); + auto op = OperationPattern(o); + + return Using( + // resource factory + [=]() -> SerialDisposable + { + // return a disposable that will complete the operation + SerialDisposable scope; + scope.Set(ScheduledDisposable( + scheduler, + Disposable( + [=]() + { + op.Deferral()->Complete(); + }))); + return scope; + }, + // observable factory + [=](SerialDisposable) + { + return sob(op, t); + }); + }) + .observe_on(scheduler) + .subscribe( + //on next + [=](Result r) + { + observer->OnNext(r); + }, + //on completed + [=]() + { + observer->OnCompleted(); + }, + //on error + [=](std::exception_ptr e) + { + observer->OnError(e); + } + ); + }); + } + } + + struct defer_operation {}; + template + auto rxcpp_chain(defer_operation && , const std::shared_ptr < Observable < T >> &source, SOp sop, SOb sob, Scheduler::shared scheduler = nullptr) + -> decltype(detail::DeferOperation(source, sop, sob, scheduler)) + { + return detail::DeferOperation(source, sop, sob, scheduler); + } + } } #endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index efecd89..b3029e5 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -114,6 +114,10 @@ namespace detail { -> decltype(from(RefCount(obj))) { return from(RefCount(obj)); } + auto connect_forever() + -> decltype(from(ConnectForever(obj))) { + return from(ConnectForever(obj)); + } }; template @@ -270,6 +274,11 @@ namespace detail { -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { return from(GroupBy(obj, keySelector, valueSelector, less)); } + template + auto scan(Seed seed, A accumulator) + -> decltype(from(Scan(obj, seed, accumulator))) { + return from(Scan(obj, seed, accumulator)); + } template auto take(Integral n) -> decltype(from(Take(obj, n))) { -- GitLab From 9d9699eb0ea79bbb33917e9071f219ad0ba4cfce Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 31 Aug 2013 11:25:55 -0700 Subject: [PATCH 064/782] make OperationPattern Disposable --- Rx/CPP/src/cpprx/rx-winrt.hpp | 44 +++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index 9b3dca6..b60d205 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -588,11 +588,34 @@ namespace rxcpp { namespace winrt { return deferral; }; + void Dispose() + { + deferral->Complete(); + } + + operator Disposable() const + { + // make sure to capture state and not 'this'. + // usage means that 'this' will usualy be destructed + // immediately + auto local = deferral; + return Disposable([local]{ + local->Complete(); + }); + } + private: O operation; D deferral; }; + template + OperationPattern make_operation_pattern(O o) + { + return OperationPattern(std::move(o)); + } + + namespace detail { @@ -615,26 +638,17 @@ namespace rxcpp { namespace winrt { [=](T t) -> ResultObservable { // must take the deferral early while the event is still on the stack. - auto o = sop(t); - auto op = OperationPattern(o); + auto op = make_operation_pattern(sop(t)); + typedef decltype(op) OP; - return Using( + return Using( // resource factory - [=]() -> SerialDisposable + [=]() -> OP { - // return a disposable that will complete the operation - SerialDisposable scope; - scope.Set(ScheduledDisposable( - scheduler, - Disposable( - [=]() - { - op.Deferral()->Complete(); - }))); - return scope; + return op; }, // observable factory - [=](SerialDisposable) + [sob, t](OP op) { return sob(op, t); }); -- GitLab From 623e9fe655c6706b0a1ef64920defd08d941025e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 31 Aug 2013 12:38:03 -0700 Subject: [PATCH 065/782] fix FromAsyncPattern to only require the function arg types to be provided --- Rx/CPP/src/cpprx/rx-winrt.hpp | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index b60d205..cd123e3 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -160,39 +160,12 @@ namespace rxcpp { namespace winrt { }); } - template - auto FromAsyncPattern(F&& start) - -> std::function < std::shared_ptr < Observable< decltype(start()->GetResults()) >> ()> + template + auto FromAsyncPattern(F&& start) + -> std::function < std::shared_ptr < Observable< decltype(start((*(T*)nullptr)...)->GetResults()) >> (const T&...)> { - return [=]() - { - typedef decltype(start()->GetResults()) Result; - auto subject = CreateAsyncSubject(); - auto o = start(); - typedef typename detail::remove_ref< decltype(o->Completed)>::type Handler; - typedef decltype(detail::operation_interface(o)) Interface; - o->Completed = ref new Handler([=](Interface io, wf::AsyncStatus) - { - util::maybe value; - try - { - value.set(io->GetResults()); - } - catch (...) - { - subject->OnError(std::current_exception()); - return; - } - subject->OnNext(*value.get()); - subject->OnCompleted(); - }); - return observable(subject); - }; - } + typedef decltype(start((*(T*)nullptr)...)->GetResults()) Result; - template - std::function < std::shared_ptr < Observable> (const T&...)> FromAsyncPattern(std::function start) - { return [=](const T&... t) { auto subject = CreateAsyncSubject(); -- GitLab From be6c6fcaae53219b940f2616e4bf54a1d82638af Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Sep 2013 08:23:19 -0700 Subject: [PATCH 066/782] Improve ToAsync and Using usage --- Rx/CPP/src/cpprx/rx-operators.hpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 0589c09..3816f2f 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -789,14 +789,17 @@ namespace rxcpp return std::make_shared>(); } - template - std::function < std::shared_ptr < Observable> (A)> ToAsync(std::function f, Scheduler::shared scheduler = nullptr) +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto ToAsync(F f, Scheduler::shared scheduler = nullptr) + ->std::function < std::shared_ptr < Observable< decltype(f((*(A*)nullptr)...)) >> (const A&...)> { + typedef decltype(f((*(A*) nullptr)...)) R; if (!scheduler) { scheduler = std::make_shared(); } - return [=](A a) -> std::shared_ptr < Observable> + return [=](const A&... a) -> std::shared_ptr < Observable> { auto result = CreateAsyncSubject(); scheduler->Schedule([=](Scheduler::shared) -> Disposable @@ -804,7 +807,7 @@ namespace rxcpp util::maybe value; try { - value.set(f(a)); + value.set(f(a...)); } catch (...) { @@ -818,6 +821,7 @@ namespace rxcpp return result; }; } +#endif template class ConnectableSubject : @@ -1257,12 +1261,15 @@ namespace rxcpp } }; } - template - const std::shared_ptr> Using( - typename detail::UsingObservable::ResourceFactory resourceFactory, - typename detail::UsingObservable::ObservableFactory observableFactory + template + auto Using( + RF resourceFactory, + OF observableFactory ) + -> decltype(observableFactory(resourceFactory())) { + typedef typename observable_item::type T; + typedef decltype(resourceFactory()) R; return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); } -- GitLab From 2d24c46acd3c5376d6e8e7a5bad1ccfc73a86464 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Sep 2013 08:25:45 -0700 Subject: [PATCH 067/782] ReactiveCommand fixes ensure that inflight is observed on the defaultScheduler so that IsExecuting is always on the UI thread. Improve Register function usage. --- Rx/CPP/src/cpprx/rx-winrt.hpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index cd123e3..ab320f5 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -362,12 +362,14 @@ namespace rxcpp { namespace winrt { { canExecute = Return(true); } + if (!defaultScheduler) { defaultScheduler = std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()); } isExecuting = observable(from(inflight) + .observe_on(defaultScheduler) .scan(0, [](int balanced, bool in) { return in ? balanced + 1 : balanced - 1; }) .select([](int balanced) { @@ -392,20 +394,21 @@ namespace rxcpp { namespace winrt { .observe_on(defaultScheduler)); } - template - std::shared_ptr> RegisterAsync(std::function>(T)> f) + template + auto RegisterAsync(F f) + -> std::shared_ptr> { return observable(from(executed) .select_many( // select collection - [=](T t) -> std::shared_ptr> + [=](T t) { - return Using( + std::unique_lock guard(flight_lock); + inflight->OnNext(true); + return Using( // resource factory [=]() -> SerialDisposable { - std::unique_lock guard(flight_lock); - inflight->OnNext(true); SerialDisposable flight; flight.Set(ScheduledDisposable( defaultScheduler, @@ -417,7 +420,7 @@ namespace rxcpp { namespace winrt { return flight; }, // observable factory - [=](SerialDisposable) -> std::shared_ptr> + [=](SerialDisposable) { return f(t); }); @@ -427,11 +430,12 @@ namespace rxcpp { namespace winrt { .connect_forever()); } - template - std::shared_ptr> RegisterAsyncFunction(std::function < R(T)> f, Scheduler::shared scheduler = nullptr) + template + auto RegisterAsyncFunction(F f, Scheduler::shared scheduler = nullptr) + -> std::shared_ptr> { - auto asyncFunc = ToAsync(f, scheduler); - return RegisterAsync(asyncFunc); + auto asyncFunc = ToAsync(f, scheduler); + return RegisterAsync(asyncFunc); } bool AllowsConcurrentExecution() @@ -614,9 +618,9 @@ namespace rxcpp { namespace winrt { auto op = make_operation_pattern(sop(t)); typedef decltype(op) OP; - return Using( + return Using( // resource factory - [=]() -> OP + [=]() { return op; }, -- GitLab From ef7ece0925a673237f5aabc8171111c064da1479 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Sep 2013 13:19:48 -0700 Subject: [PATCH 068/782] update _MSC_VER checks for VC2013 --- Rx/CPP/src/cpprx/rx-includes.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index 283ab98..d8dc7c1 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -32,7 +32,10 @@ #if _MSC_VER > 1600 #define RXCPP_USE_RVALUEREF 1 -#define RXCPP_USE_VARIADIC_TEMPLATES 0 +#endif + +#if _MSC_VER >= 1800 +#define RXCPP_USE_VARIADIC_TEMPLATES 1 #endif #if _CPPRTTI -- GitLab From 006f1aa7d5f94709a799735cc5be43219483f4f9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Sep 2013 13:20:22 -0700 Subject: [PATCH 069/782] pass arg pack to lambda using tuple --- Rx/CPP/src/cpprx/rx-operators.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 3816f2f..77de860 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -801,13 +801,14 @@ namespace rxcpp } return [=](const A&... a) -> std::shared_ptr < Observable> { + auto args = std::make_tuple(a...); auto result = CreateAsyncSubject(); scheduler->Schedule([=](Scheduler::shared) -> Disposable { util::maybe value; try { - value.set(f(a...)); + value.set(util::tuple_dispatch(f, args)); } catch (...) { -- GitLab From c94643820b9e7c29ed1b7720e7baa7a74bb4ef06 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Sep 2013 13:20:55 -0700 Subject: [PATCH 070/782] fix RegisterAsync return type --- Rx/CPP/src/cpprx/rx-winrt.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index ab320f5..2e743b9 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -396,7 +396,7 @@ namespace rxcpp { namespace winrt { template auto RegisterAsync(F f) - -> std::shared_ptr> + -> decltype(f(*(T*) nullptr)) { return observable(from(executed) .select_many( -- GitLab From 2840ee1831356650da078eb7a81d5cf7264cc25a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Sep 2013 13:21:51 -0700 Subject: [PATCH 071/782] disambiguate combine_latest --- Rx/CPP/src/cpprx/rx.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index b3029e5..f876922 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -202,13 +202,14 @@ namespace detail { #if RXCPP_USE_VARIADIC_TEMPLATES template auto combine_latest(S selector, const CombineLSource&... source) - -> decltype(from(CombineLatest(selector, obj, observable(source)...))) { + -> typename std::enable_if::value, decltype(from(CombineLatest(selector, obj, observable(source)...)))>::type { return from(CombineLatest(selector, obj, observable(source)...)); } - template - auto combine_latest(const CombineL1Source&... source) - -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(source)...))) { - return from(CombineLatest(util::as_tuple(), obj, observable(source)...)); + template + auto combine_latest(const CombineL1Source& source, const CombineL1SourceN&... sourcen) + -> typename std::enable_if < is_observable::value, + decltype(from(CombineLatest(util::as_tuple(), obj, observable(source), observable(sourcen)...)))>::type { + return from(CombineLatest(util::as_tuple(), obj, observable(source), observable(sourcen)...)); } #else template -- GitLab From cfbe76b18869ae37e82ffd0917b09b11ebb638f4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Sep 2013 13:31:50 -0700 Subject: [PATCH 072/782] add is_observable for Binder --- Rx/CPP/src/cpprx/rx.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index f876922..54ae133 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -19,6 +19,9 @@ namespace detail { struct observable_item> {typedef typename rxcpp::observable_item::type type;}; } + template + struct is_observable < Binder > {static const bool value = true; }; + template class BinderBase { -- GitLab From d619cb5dc57d3cee876fd39302325640bbcf8dc4 Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 14:49:19 -0700 Subject: [PATCH 073/782] Add readme in html format, to be converted to markdown --- Readme.html | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 Readme.html diff --git a/Readme.html b/Readme.html new file mode 100644 index 0000000..0ffeade --- /dev/null +++ b/Readme.html @@ -0,0 +1,303 @@ +

Reactive Extensions

+ +

Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.

+

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.

+

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.

+ +

Pulling vs. Pushing Data

+

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).

+

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.

+

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.

+

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.

+

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, Rxs 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.

+ +

Getting Started with Rx

+

This section describes in general what Reactive Extensions (Rx) is, and how it can benefit programmers who are creating asynchronous applications.

+ +

In This Section

+

1. When Will You Use Rx
+2. Installing Rx
+3. Differences Between Versions of Rx

+ +

Related Sections

+

Using Rx
+Reactive Extensions on MSDN Developer Center

+ +

When Will You Use Rx

+

This topic describes the advantage of using Rx for users who are currently using the .NET event model for asynchronous programming.

+ +

Advantages of using Rx

+

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.

+

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.

+

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.

+

The following example shows how easy it is to implement an observable in C++.

+ +//Declare an observable
+auto values1 = rxcpp::Range(1, 10);
+ rxcpp::from(values1)
+ .for_each(
+ [](int p) {
+ cout << p << endl;
+ }); +
+

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.

+ +

Filtering

+

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.

+

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.

+

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.

+ +

Manipulating Events

+

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.

+ +

Installing Rx

+

This topic describes where you can download the Reactive Extensions (Rx) SDK.

+ +

To download Rx

+

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 Rx MSDN Developer Center.

+ +

Differences Between Versions of Rx

+

The following topic describes the various platforms for which you can develop solutions using Reactive Extensions.

+

To get the latest release of Rx, as well as learn about its prerequisites, please visit the Rx MSDN Developer Center.

+ +

C++

+

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++.

+ +

Javascript

+

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.

+

RxJS brings similar capabilities to client script and integrates with jQuery events (Rx.Observable.FromJQueryEvent). It also supports Script#.

+ +

Ruby

+

Rx for Ruby (Rx.rb) allows you to use Linq operators to create push-based observable collections in Ruby.

+ +

Python

+

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.

+ +

.NET Framework

+

The core Rx interfaces, IObservable and IObserver, 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 Rx MSDN Developer Center.

+ +

Silverlight

+

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.

+

You can also use the various Observable operator overloads that take in a Scheduler, and specify the System.Reactive.Concurrency.DispatcherScheduler to be used.

+ +

Windows Phone

+

Windows Phone 7 ships with a version of the Reactive Extensions baked into the ROM of the device. For more information, see Reactive Extensions for .NET Overview for Windows Phone. Documentation for this version of the Reactive Extensions can be found in Windows Phone API library at Microsoft.Phone.Reactive Namespace.

+

The Rx MSDN Developer Center 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 Rx team blog post.

+

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.

+ +

Using Rx

+

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.

+ +

In This Section

+

1. Exploring The Major Interfaces in Rx
+2. Creating and Querying Event Streams
+3. Subjects
+6. Implementing your own operators for IObservable
+7. Using Observable Providers

+ +

Exploring The Major Interfaces in Rx

+

This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them.

+ +

Observable/Observer

+

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.

+

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.

+

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.

+

Observers support three publication events, reflected by the interfaces 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.

+

The following lists the Observable/Observer definitions.

+ +namespace rxcpp {
+ template
+ struct Observer
+ {
+ virtual void OnNext(const T&) {};
+ virtual void OnCompleted() {};
+ virtual void OnError(const std::exception_ptr&) {};

+ + virtual ~Observer() {}
+ };
+ + template
+ struct Observable
+ {
+ virtual Disposable Subscribe(std::shared_ptr> observer) = 0;
+ virtual ~Observable() {}
+ };
+} +
+

Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function.

+

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.

+ +

See Also

+Creating and Subscribing to Simple Observable Sequences +Querying Observable Collections using LINQ Operators + +

Creating and Querying Observable Sequences

+

This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it.

+ +

In This Section

+

Creating and Subscribing to Simple Observable Sequences
+Querying Observable Collections using LINQ Operators

+ +

Creating and Subscribing to Simple Observable Sequences

+

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.

+ +

Creating and subscribing to a simple sequence

+

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.

+

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.

+

As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values.

+ +auto values1 = rxcpp::Range(1, 10);
+ rxcpp::from(values1)
+ .for_each(
+ [](int p) {
+ cout << p << endl;
+ }); +
+

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.

+

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).

+

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.

+

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.

+ +

Converting an Enumerable Collection to an Observable Sequence

+

Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it.

+ + std::array< int, 3 > a={1, 2, 3};
+ auto values1 = rxcpp::Iterate(a);

+ + rxcpp::from(values1)
+ .for_each(
+ [](int p) {
+ cout << p << endl;
+ }); +
+ +

See Also

+Query Observable Collections using LINQ Operators + +

Querying Observable Sequences using LINQ Operators

+

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.

+ +

Using Different Operators

+

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.

+ +

Combining different sequences

+

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.

+

In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it.

+ +auto input1 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto input2 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto output = std::make_shared<rxcpp::EventLoopScheduler>();

+ + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ auto s1 = rxcpp::from(values1)
+ .subscribe_on(input1)
+ .select([](int prime) -> std::tuple<const char *, int> { return std::make_tuple("1:", prime);})
+ .take(3);

+ + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ auto s2 = rxcpp::from(values2)
+ .subscribe_on(input2)
+ .select([](int prime) -> std::tuple<const char *, int> { return std::make_tuple("2:", prime);})
+ .take(3);

+ + + + rxcpp::from(s1)
+ .concat(s2)
+ .observe_on(output)
+ .for_each(rxcpp::MakeTupleDispatch(
+ [](const char* s, int p) {
+ cout << p << endl;
+ })); +
+

Notice that the resultant sequence is 1,2,3,1,2,3. 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.

+

Compare this with the merge operator. If you run the following sample code, you will get 1,1,2,2,3,3. 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.

+

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.

+ +auto input1 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto input2 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto output = std::make_shared<rxcpp::EventLoopScheduler>();

+ + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ auto s1 = rxcpp::from(values1)
+ .subscribe_on(input1)
+ .select([](int data) -> std::tuple<const char *, int> { return std::make_tuple("1: ", data);});

+ + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ rxcpp::from(values2)
+ .subscribe_on(input1)
+ .select([](int data) -> std::tuple<const char *, int> { return std::make_tuple("2: ", data);})
+ .merge(s1)
+ .take(6)
+ .observe_on(output)
+ .for_each(rxcpp::MakeTupleDispatch(
+ [](const char* s, int p) {
+ cout << s << p << endl;
+ })); +
+

Notice that for these combination operators to work, all the observable sequences need to be of the same type.

+ +

Subjects

+

This section describes the Subject type implemented by Reactive Extensions. It also describes various implementations of Subject which serves different purposes.

+

In This Section

+

1. Using Subjects

+ +

Using Subjects

+

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.

+

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.

+ +

Different types of Subjects

+

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.

+ +

Scheduling and Concurrency

+

This section describes how you can use a scheduler to control when to start a sequence or subscribe to an event.

+ +

Scheduler Types

+

The various Scheduler types provided by Rx are:

+

ImmediateScheduler: Default scheduler, pushes notifications as they are recieved.

+

EventLoopScheduler: Used when creating a separate thread for Rx sequences.

+ +

Using Schedulers

+

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.

+ +

Using Schedulers

+

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.

+

In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler.

+ +auto input1 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto input2 = std::make_shared<rxcpp::EventLoopScheduler>();
+ auto output = std::make_shared<rxcpp::EventLoopScheduler>();

+ + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ auto s1 = rxcpp::from(values1)
+ .subscribe_on(input1)
+ .select([](int data) -> std::tuple<const char *, int> { return std::make_tuple("1:", data);})
+ .take(3);

+ + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers
+ auto s2 = rxcpp::from(values2)
+ .subscribe_on(input2)
+ .select([](int data) -> std::tuple<const char *, int> { return std::make_tuple("2:", data);})
+ .take(3);

+ + rxcpp::from(s1)
+ .concat(s2)
+ .observe_on(output)
+ .for_each(rxcpp::MakeTupleDispatch(
+ [](const char* s, int p) {
+ cout << p << endl;
+ })); +
+

This will queue up on the observer quickly. We can improve this code by using 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.

+

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.

+ +

Implementing Your Own Operators for Observable

+

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.

+ +

Creating New Operators

+

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 queryespecially if you can reuse that same operator several times in your code.

+

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.

+

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.

+ +

Customizing Existing Operators

+

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.

-- GitLab From 6aa0f1d68d16ad805063da0bfd7de3cd0b66674b Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 14:55:27 -0700 Subject: [PATCH 074/782] Expanded documentation in readme.md --- README.md | 367 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 353 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bb32490..9616b37 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,359 @@ -# Reactive Extensions: +# Reactive Extensions for C++ (RxCpp) -* Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. -* RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. -* Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. +Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. -# Interactive Extensions -* Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. -* IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. -* Ix++: An implantation of LINQ for Native Developers in C++ +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. -# Applications: -* Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. -* LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. +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%2B%2B, .NET, Ruby, Python, Silverlight, Windows Phone 7 and JavaScript. For more information on these different platforms, see Differences Between Versions of Rx topic. -#Contributing Code +## Pulling vs. Pushing Data -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. +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). -You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. \ No newline at end of file +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. + +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. + +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. + +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, Rxs 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. + +This section describes in general what Reactive Extensions (Rx) is, and how it can benefit programmers who are creating asynchronous applications. + +### In This Section + +1\. When Will You Use Rx +2\. Installing Rx +3\. Differences Between Versions of Rx + +### Related Sections + +Using Rx +Reactive Extensions on MSDN Developer Center + +This topic describes the advantage of using Rx for users who are currently using the .NET event model for asynchronous programming. + +## Advantages of using Rx + +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. + +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. + +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. + +The following example shows how easy it is to implement an observable in C%2B%2B. + +` //Declare an observable +auto values1 = rxcpp::Range(1, 10); +rxcpp::from(values1) +.for_each( +[](int p) { +cout }); ` + +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. + +## Filtering + +One drawback of the C%2B%2B 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. + +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. + +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. + +## Manipulating Events + +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. + +This topic describes where you can download the Reactive Extensions (Rx) SDK. + +## To download Rx + +Reactive Extensions is available for different platforms such as C%2B%2B, 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 [Rx MSDN Developer Center.][1] + +The following topic describes the various platforms for which you can develop solutions using Reactive Extensions. + +To get the latest release of Rx, as well as learn about its prerequisites, please visit the [Rx MSDN Developer Center][1]. + +## C%2B%2B + +The Reactive Extensions for C%2B%2B (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in C%2B%2B. + +## Javascript + +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. + +RxJS brings similar capabilities to client script and integrates with jQuery events (Rx.Observable.FromJQueryEvent). It also supports Script#. + +## Ruby + +Rx for Ruby (Rx.rb) allows you to use Linq operators to create push-based observable collections in Ruby. + +## Python + +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. + +## .NET Framework + +The core Rx interfaces, IObservable and IObserver, 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 [Rx MSDN Developer Center][1]. + +## Silverlight + +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. + +You can also use the various Observable operator overloads that take in a Scheduler, and specify the System.Reactive.Concurrency.DispatcherScheduler to be used. + +## Windows Phone + +Windows Phone 7 ships with a version of the Reactive Extensions baked into the ROM of the device. For more information, see [Reactive Extensions for .NET Overview for Windows Phone][2]. Documentation for this version of the Reactive Extensions can be found in Windows Phone API library at [Microsoft.Phone.Reactive Namespace][3]. + +The [Rx MSDN Developer Center][1] 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 [Rx team blog post][4]. + +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. + +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. + +### In This Section + +1\. Exploring The Major Interfaces in Rx +2\. Creating and Querying Event Streams +3\. Subjects +6\. Implementing your own operators for IObservable +7\. Using Observable Providers + +This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them. + +## Observable/Observer + +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. + +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. + +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. + +Observers support three publication events, reflected by the interfaces 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. + +The following lists the Observable/Observer definitions. + +` namespace rxcpp { +template +struct Observer +{ +virtual void OnNext(const T&) {}; +virtual void OnCompleted() {}; +virtual void OnError(const std::exception_ptr&) {}; + +virtual ~Observer() {} +}; +template +struct Observable +{ +virtual Disposable Subscribe(std::shared_ptr> observer) = 0; +virtual ~Observable() {} +}; +} + +` + +Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function. + +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. + +### See Also + +Creating and Subscribing to Simple Observable Sequences Querying Observable Collections using LINQ Operators + +This section describes how you can create and subscribe to an observable sequence, convert an existing C%2B%2B event into a sequence and query it. + +### In This Section + +Creating and Subscribing to Simple Observable Sequences +Querying Observable Collections using LINQ Operators + +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. + +## Creating and subscribing to a simple sequence + +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. + +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. + +As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values. + +` auto values1 = rxcpp::Range(1, 10); +rxcpp::from(values1) +.for_each( +[](int p) { +cout }); ` + +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. + +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). + +In addition to creating an observable sequence from scratch, you can convert existing enumerators, C%2B%2B events and asynchronous patterns into observable sequences. The other topics in this section will show you how to do this. + +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. + +## Converting an Enumerable Collection to an Observable Sequence + +Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it. + +` std::array a={1, 2, 3}; +auto values1 = rxcpp::Iterate(a); + +rxcpp::from(values1) +.for_each( +[](int p) { +cout }); + +` + +### See Also + +Query Observable Collections using LINQ Operators + +We have converted existing C%2B%2B 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. + +## Using Different Operators + +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. + +## Combining different sequences + +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. + +In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it. + +` auto input1 = std::make_shared(); +auto input2 = std::make_shared(); +auto output = std::make_shared(); + +auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers +auto s1 = rxcpp::from(values1) +.subscribe_on(input1) +.select([](int prime) -> std::tuple { return std::make_tuple("1:", prime);}) +.take(3); + +auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers +auto s2 = rxcpp::from(values2) +.subscribe_on(input2) +.select([](int prime) -> std::tuple { return std::make_tuple("2:", prime);}) +.take(3); + +rxcpp::from(s1) +.concat(s2) +.observe_on(output) +.for_each(rxcpp::MakeTupleDispatch( +[](const char* s, int p) { +cout })); + +` + +Notice that the resultant sequence is 1,2,3,1,2,3. 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. + +Compare this with the merge operator. If you run the following sample code, you will get 1,1,2,2,3,3. 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. + +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. + +` auto input1 = std::make_shared(); +auto input2 = std::make_shared(); +auto output = std::make_shared(); + +auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers +auto s1 = rxcpp::from(values1) +.subscribe_on(input1) +.select([](int data) -> std::tuple { return std::make_tuple("1: ", data);}); + +auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers +rxcpp::from(values2) +.subscribe_on(input1) +.select([](int data) -> std::tuple { return std::make_tuple("2: ", data);}) +.merge(s1) +.take(6) +.observe_on(output) +.for_each(rxcpp::MakeTupleDispatch( +[](const char* s, int p) { +cout })); + +` + +Notice that for these combination operators to work, all the observable sequences need to be of the same type. + +This section describes the Subject type implemented by Reactive Extensions. It also describes various implementations of Subject which serves different purposes. + +### In This Section + +1\. Using Subjects + +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. + +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. + +## Different types of Subjects + +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. + +This section describes how you can use a scheduler to control when to start a sequence or subscribe to an event. + +The various Scheduler types provided by Rx are: + +ImmediateScheduler: Default scheduler, pushes notifications as they are recieved. + +EventLoopScheduler: Used when creating a separate thread for Rx sequences. + +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. + +## Using Schedulers + +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. + +In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler. + +` auto input1 = std::make_shared(); +auto input2 = std::make_shared(); +auto output = std::make_shared(); + +auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers +auto s1 = rxcpp::from(values1) +.subscribe_on(input1) +.select([](int data) -> std::tuple { return std::make_tuple("1:", data);}) +.take(3); + +auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers +auto s2 = rxcpp::from(values2) +.subscribe_on(input2) +.select([](int data) -> std::tuple { return std::make_tuple("2:", data);}) +.take(3); + +rxcpp::from(s1) +.concat(s2) +.observe_on(output) +.for_each(rxcpp::MakeTupleDispatch( +[](const char* s, int p) { +cout })); + +` + +This will queue up on the observer quickly. We can improve this code by using 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. + +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. + +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. + +## Creating New Operators + +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 queryespecially if you can reuse that same operator several times in your code. + +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. + +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. + +## Customizing Existing Operators + +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. + + [1]: http://msdn.microsoft.com/en-us/data/gg577609 + [2]: http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx + [3]: http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx + [4]: http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx + + \ No newline at end of file -- GitLab From 128bba0ec707c558fa66840eb8ccc67ffebcf3f0 Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 15:02:33 -0700 Subject: [PATCH 075/782] Fix formatting in readme.md --- README.md | 142 +++++++++++++++++++++++++++--------------------------- 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 9616b37..673496e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Reactive Extensions (Rx) is a library for composing asynchronous and event-based 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. -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%2B%2B, .NET, Ruby, Python, Silverlight, Windows Phone 7 and JavaScript. For more information on these different platforms, see Differences Between Versions of Rx topic. +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. ## Pulling vs. Pushing Data @@ -41,20 +41,21 @@ In addition, if your application interacts with multiple sources of data, the co 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. -The following example shows how easy it is to implement an observable in C%2B%2B. +The following example shows how easy it is to implement an observable in C++. -` //Declare an observable -auto values1 = rxcpp::Range(1, 10); -rxcpp::from(values1) -.for_each( -[](int p) { -cout }); ` + //Declare an observable
+ auto values1 = rxcpp::Range(1, 10);
+ rxcpp::from(values1)
+ .for_each(
+ [](int p) {
+ cout << p << endl;
+ }); 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. ## Filtering -One drawback of the C%2B%2B 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. +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. 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. @@ -68,15 +69,15 @@ This topic describes where you can download the Reactive Extensions (Rx) SDK. ## To download Rx -Reactive Extensions is available for different platforms such as C%2B%2B, 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 [Rx MSDN Developer Center.][1] +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 [Rx MSDN Developer Center.][1] The following topic describes the various platforms for which you can develop solutions using Reactive Extensions. To get the latest release of Rx, as well as learn about its prerequisites, please visit the [Rx MSDN Developer Center][1]. -## C%2B%2B +## C++ -The Reactive Extensions for C%2B%2B (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in C%2B%2B. +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++. ## Javascript @@ -114,11 +115,11 @@ This section includes topics that explain how you use Rx to create and subscribe ### In This Section -1\. Exploring The Major Interfaces in Rx -2\. Creating and Querying Event Streams -3\. Subjects -6\. Implementing your own operators for IObservable -7\. Using Observable Providers +1. Exploring The Major Interfaces in Rx +2. Creating and Querying Event Streams +3. Subjects +6. Implementing your own operators for IObservable +7. Using Observable Providers This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them. @@ -134,25 +135,24 @@ Observers support three publication events, reflected by the interfaces methods. The following lists the Observable/Observer definitions. -` namespace rxcpp { -template -struct Observer -{ -virtual void OnNext(const T&) {}; -virtual void OnCompleted() {}; -virtual void OnError(const std::exception_ptr&) {}; - -virtual ~Observer() {} -}; -template -struct Observable -{ -virtual Disposable Subscribe(std::shared_ptr> observer) = 0; -virtual ~Observable() {} -}; -} - -` + namespace rxcpp { + template + struct Observer + { + virtual void OnNext(const T&) {}; + virtual void OnCompleted() {}; + virtual void OnError(const std::exception_ptr&) {}; + + virtual ~Observer() {} + }; + + template + struct Observable + { + virtual Disposable Subscribe(std::shared_ptr> observer) = 0; + virtual ~Observable() {} + }; + } Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function. @@ -162,7 +162,7 @@ You can treat the observable sequence (such as a sequence of mouse-over events) Creating and Subscribing to Simple Observable Sequences Querying Observable Collections using LINQ Operators -This section describes how you can create and subscribe to an observable sequence, convert an existing C%2B%2B event into a sequence and query it. +This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it. ### In This Section @@ -179,17 +179,17 @@ The range operator has several overloads. In our example, it creates a sequence As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values. -` auto values1 = rxcpp::Range(1, 10); -rxcpp::from(values1) -.for_each( -[](int p) { -cout }); ` + auto values1 = rxcpp::Range(1, 10); + rxcpp::from(values1) + .for_each( + [](int p) { + cout }); 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. 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). -In addition to creating an observable sequence from scratch, you can convert existing enumerators, C%2B%2B events and asynchronous patterns into observable sequences. The other topics in this section will show you how to do this. +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. 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. @@ -197,21 +197,20 @@ Notice that this topic only shows you a few operators that can create an observa Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it. -` std::array a={1, 2, 3}; -auto values1 = rxcpp::Iterate(a); + std::array a={1, 2, 3}; + auto values1 = rxcpp::Iterate(a); -rxcpp::from(values1) -.for_each( -[](int p) { -cout }); + rxcpp::from(values1) + .for_each( + [](int p) { + cout }); -` ### See Also Query Observable Collections using LINQ Operators -We have converted existing C%2B%2B 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. +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. ## Using Different Operators @@ -223,30 +222,29 @@ In this section, we will examine some of the operators that combine various obse In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it. -` auto input1 = std::make_shared(); -auto input2 = std::make_shared(); -auto output = std::make_shared(); + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); -auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers -auto s1 = rxcpp::from(values1) -.subscribe_on(input1) -.select([](int prime) -> std::tuple { return std::make_tuple("1:", prime);}) -.take(3); + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .select([](int prime) ->; std::tuple { return std::make_tuple("1:", prime);}) + .take(3); -auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers -auto s2 = rxcpp::from(values2) -.subscribe_on(input2) -.select([](int prime) -> std::tuple { return std::make_tuple("2:", prime);}) -.take(3); + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers + auto s2 = rxcpp::from(values2) + .subscribe_on(input2) + .select([](int prime) ->; std::tuple { return std::make_tuple("2:", prime);}) + .take(3); -rxcpp::from(s1) -.concat(s2) -.observe_on(output) -.for_each(rxcpp::MakeTupleDispatch( -[](const char* s, int p) { -cout })); + rxcpp::from(s1) + .concat(s2) + .observe_on(output) + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout })); -` Notice that the resultant sequence is 1,2,3,1,2,3. 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. @@ -282,7 +280,7 @@ This section describes the Subject type implemented by Reactive Extensions. It a ### In This Section -1\. Using Subjects +1. Using Subjects 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. -- GitLab From b994f81fee6a92e82909c6d1ac2eb22b938ac705 Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 15:05:21 -0700 Subject: [PATCH 076/782] Update README.md --- README.md | 106 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 673496e..dfee08b 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ This section describes in general what Reactive Extensions (Rx) is, and how it c ### In This Section -1\. When Will You Use Rx -2\. Installing Rx -3\. Differences Between Versions of Rx +1. When Will You Use Rx +2. Installing Rx +3. Differences Between Versions of Rx ### Related Sections @@ -252,27 +252,25 @@ Compare this with the merge operator. If you run the following sample code, you 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. -` auto input1 = std::make_shared(); -auto input2 = std::make_shared(); -auto output = std::make_shared(); - -auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers -auto s1 = rxcpp::from(values1) -.subscribe_on(input1) -.select([](int data) -> std::tuple { return std::make_tuple("1: ", data);}); - -auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers -rxcpp::from(values2) -.subscribe_on(input1) -.select([](int data) -> std::tuple { return std::make_tuple("2: ", data);}) -.merge(s1) -.take(6) -.observe_on(output) -.for_each(rxcpp::MakeTupleDispatch( -[](const char* s, int p) { -cout })); - -` + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .select([](int data) -> std::tuple { return std::make_tuple("1: ", data);}); + + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers + rxcpp::from(values2) + .subscribe_on(input1) + .select([](int data) -> std::tuple { return std::make_tuple("2: ", data);}) + .merge(s1) + .take(6) + .observe_on(output) + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout })); Notice that for these combination operators to work, all the observable sequences need to be of the same type. @@ -305,31 +303,30 @@ A scheduler controls when a subscription starts and when notifications are publi 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. In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler. - -` auto input1 = std::make_shared(); -auto input2 = std::make_shared(); -auto output = std::make_shared(); - -auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers -auto s1 = rxcpp::from(values1) -.subscribe_on(input1) -.select([](int data) -> std::tuple { return std::make_tuple("1:", data);}) -.take(3); - -auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers -auto s2 = rxcpp::from(values2) -.subscribe_on(input2) -.select([](int data) -> std::tuple { return std::make_tuple("2:", data);}) -.take(3); - -rxcpp::from(s1) -.concat(s2) -.observe_on(output) -.for_each(rxcpp::MakeTupleDispatch( -[](const char* s, int p) { -cout })); - -` + + auto input1 = std::make_shared(); + auto input2 = std::make_shared(); + auto output = std::make_shared(); + + auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers + auto s1 = rxcpp::from(values1) + .subscribe_on(input1) + .select([](int data) -> std::tuple { return std::make_tuple("1:", data);}) + .take(3); + + auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers + auto s2 = rxcpp::from(values2) + .subscribe_on(input2) + .select([](int data) -> std::tuple { return std::make_tuple("2:", data);}) + .take(3); + + rxcpp::from(s1) + .concat(s2) + .observe_on(output) + .for_each(rxcpp::MakeTupleDispatch( + [](const char* s, int p) { + cout })); + This will queue up on the observer quickly. We can improve this code by using 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. @@ -349,9 +346,10 @@ When writing a custom operator, it is good practice not to leave any disposables 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. - [1]: http://msdn.microsoft.com/en-us/data/gg577609 - [2]: http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx - [3]: http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx - [4]: http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx + +http://msdn.microsoft.com/en-us/data/gg577609 +http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx +http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx +http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx + - \ No newline at end of file -- GitLab From 324e88a78258c27a56d115f981e3411f58f2b9c7 Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 15:10:58 -0700 Subject: [PATCH 077/782] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfee08b..f3f7c7e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Reactive Extensions for C++ (RxCpp) +Reactive Extensions for C++ (RxCpp) +===================================== Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. @@ -161,7 +162,7 @@ You can treat the observable sequence (such as a sequence of mouse-over events) ### See Also Creating and Subscribing to Simple Observable Sequences Querying Observable Collections using LINQ Operators - + This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it. ### In This Section -- GitLab From a9c2c210309a93899c22ee2ccdaf9d16f5e6716f Mon Sep 17 00:00:00 2001 From: Donna Malayeri Date: Wed, 4 Sep 2013 15:47:23 -0700 Subject: [PATCH 078/782] Revert changes to .md file, since codeplex is not rendering properly --- README.md | 364 +++--------------------------------------------------- 1 file changed, 14 insertions(+), 350 deletions(-) diff --git a/README.md b/README.md index f3f7c7e..bb32490 100644 --- a/README.md +++ b/README.md @@ -1,356 +1,20 @@ -Reactive Extensions for C++ (RxCpp) -===================================== +# Reactive Extensions: -Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. +* Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. +* RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. +* Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. -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. +# Interactive Extensions +* Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. +* IxJS: An implementation of LINQ to Objects and the Interactive Extensions (Ix) in JavaScript. +* Ix++: An implantation of LINQ for Native Developers in C++ -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. +# Applications: +* Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. +* LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. -## Pulling vs. Pushing Data +#Contributing Code -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). +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. -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. - -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. - -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. - -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, Rxs 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. - -This section describes in general what Reactive Extensions (Rx) is, and how it can benefit programmers who are creating asynchronous applications. - -### In This Section - -1. When Will You Use Rx -2. Installing Rx -3. Differences Between Versions of Rx - -### Related Sections - -Using Rx -Reactive Extensions on MSDN Developer Center - -This topic describes the advantage of using Rx for users who are currently using the .NET event model for asynchronous programming. - -## Advantages of using Rx - -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. - -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. - -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. - -The following example shows how easy it is to implement an observable in C++. - - //Declare an observable
- auto values1 = rxcpp::Range(1, 10);
- rxcpp::from(values1)
- .for_each(
- [](int p) {
- cout << p << endl;
- }); - -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. - -## Filtering - -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. - -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. - -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. - -## Manipulating Events - -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. - -This topic describes where you can download the Reactive Extensions (Rx) SDK. - -## To download Rx - -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 [Rx MSDN Developer Center.][1] - -The following topic describes the various platforms for which you can develop solutions using Reactive Extensions. - -To get the latest release of Rx, as well as learn about its prerequisites, please visit the [Rx MSDN Developer Center][1]. - -## C++ - -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++. - -## Javascript - -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. - -RxJS brings similar capabilities to client script and integrates with jQuery events (Rx.Observable.FromJQueryEvent). It also supports Script#. - -## Ruby - -Rx for Ruby (Rx.rb) allows you to use Linq operators to create push-based observable collections in Ruby. - -## Python - -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. - -## .NET Framework - -The core Rx interfaces, IObservable and IObserver, 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 [Rx MSDN Developer Center][1]. - -## Silverlight - -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. - -You can also use the various Observable operator overloads that take in a Scheduler, and specify the System.Reactive.Concurrency.DispatcherScheduler to be used. - -## Windows Phone - -Windows Phone 7 ships with a version of the Reactive Extensions baked into the ROM of the device. For more information, see [Reactive Extensions for .NET Overview for Windows Phone][2]. Documentation for this version of the Reactive Extensions can be found in Windows Phone API library at [Microsoft.Phone.Reactive Namespace][3]. - -The [Rx MSDN Developer Center][1] 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 [Rx team blog post][4]. - -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. - -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. - -### In This Section - -1. Exploring The Major Interfaces in Rx -2. Creating and Querying Event Streams -3. Subjects -6. Implementing your own operators for IObservable -7. Using Observable Providers - -This topic describes the major Reactive Extensions (Rx) interfaces used to represent observable sequences and subscribe to them. - -## Observable/Observer - -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. - -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. - -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. - -Observers support three publication events, reflected by the interfaces 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. - -The following lists the Observable/Observer definitions. - - namespace rxcpp { - template - struct Observer - { - virtual void OnNext(const T&) {}; - virtual void OnCompleted() {}; - virtual void OnError(const std::exception_ptr&) {}; - - virtual ~Observer() {} - }; - - template - struct Observable - { - virtual Disposable Subscribe(std::shared_ptr> observer) = 0; - virtual ~Observable() {} - }; - } - -Note that the OnError event returns an exception_ptr type. The example above shows passing the error to a handler function. - -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. - -### See Also - -Creating and Subscribing to Simple Observable Sequences Querying Observable Collections using LINQ Operators - -This section describes how you can create and subscribe to an observable sequence, convert an existing C++ event into a sequence and query it. - -### In This Section - -Creating and Subscribing to Simple Observable Sequences -Querying Observable Collections using LINQ Operators - -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. - -## Creating and subscribing to a simple sequence - -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. - -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. - -As soon as the subscription happens, the values are sent to the observer. The OnNext delegate then prints out the values. - - auto values1 = rxcpp::Range(1, 10); - rxcpp::from(values1) - .for_each( - [](int p) { - cout }); - -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. - -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). - -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. - -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. - -## Converting an Enumerable Collection to an Observable Sequence - -Using the Iterate operator, you can convert an array colection to an observable sequence and subscribe to it. - - std::array a={1, 2, 3}; - auto values1 = rxcpp::Iterate(a); - - rxcpp::from(values1) - .for_each( - [](int p) { - cout }); - - -### See Also - -Query Observable Collections using LINQ Operators - -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. - -## Using Different Operators - -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. - -## Combining different sequences - -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. - -In the following sample, we use the concat operator to combine two sequences into a single sequence and subscribe to it. - - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .select([](int prime) ->; std::tuple { return std::make_tuple("1:", prime);}) - .take(3); - - auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers - auto s2 = rxcpp::from(values2) - .subscribe_on(input2) - .select([](int prime) ->; std::tuple { return std::make_tuple("2:", prime);}) - .take(3); - - rxcpp::from(s1) - .concat(s2) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout })); - - -Notice that the resultant sequence is 1,2,3,1,2,3. 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. - -Compare this with the merge operator. If you run the following sample code, you will get 1,1,2,2,3,3. 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. - -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. - - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .select([](int data) -> std::tuple { return std::make_tuple("1: ", data);}); - - auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers - rxcpp::from(values2) - .subscribe_on(input1) - .select([](int data) -> std::tuple { return std::make_tuple("2: ", data);}) - .merge(s1) - .take(6) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout })); - -Notice that for these combination operators to work, all the observable sequences need to be of the same type. - -This section describes the Subject type implemented by Reactive Extensions. It also describes various implementations of Subject which serves different purposes. - -### In This Section - -1. Using Subjects - -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. - -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. - -## Different types of Subjects - -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. - -This section describes how you can use a scheduler to control when to start a sequence or subscribe to an event. - -The various Scheduler types provided by Rx are: - -ImmediateScheduler: Default scheduler, pushes notifications as they are recieved. - -EventLoopScheduler: Used when creating a separate thread for Rx sequences. - -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. - -## Using Schedulers - -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. - -In the following example, the source observable sequences are each running in their own threads using EventLoopScheduler. - - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - auto values1 = rxcpp::Range(1); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .select([](int data) -> std::tuple { return std::make_tuple("1:", data);}) - .take(3); - - auto values2 = rxcpp::Range(1); // infinite (until overflow) stream of integers - auto s2 = rxcpp::from(values2) - .subscribe_on(input2) - .select([](int data) -> std::tuple { return std::make_tuple("2:", data);}) - .take(3); - - rxcpp::from(s1) - .concat(s2) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout })); - - -This will queue up on the observer quickly. We can improve this code by using 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. - -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. - -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. - -## Creating New Operators - -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 queryespecially if you can reuse that same operator several times in your code. - -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. - -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. - -## Customizing Existing Operators - -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. - - -http://msdn.microsoft.com/en-us/data/gg577609 -http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx -http://msdn.microsoft.com/en-us/library/ff707857(v=VS.92).aspx -http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-for-windows-phone-7.aspx - - +You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. \ No newline at end of file -- GitLab From 06431b9a492fec17ad539416464c54a6f05c5447 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 27 Sep 2013 07:12:53 -0700 Subject: [PATCH 079/782] fix bug when using where on an empty collection --- Ix/CPP/src/cpplinq/linq_where.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ix/CPP/src/cpplinq/linq_where.hpp b/Ix/CPP/src/cpplinq/linq_where.hpp index 4f66ba7..9b3d936 100644 --- a/Ix/CPP/src/cpplinq/linq_where.hpp +++ b/Ix/CPP/src/cpplinq/linq_where.hpp @@ -24,7 +24,7 @@ namespace cpplinq cursor(const inner_cursor& cur, const Predicate& p) : cur(cur), pred(p) { - if (!pred(cur.get())) { + if (!cur.empty() && !pred(cur.get())) { this->inc(); } } -- GitLab From c33d2725398cbbf13154e74e1c8fb910df536b90 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 27 Sep 2013 07:14:29 -0700 Subject: [PATCH 080/782] fixed name-hiding bug and Zip end-condition bug --- Rx/CPP/src/cpprx/rx-operators.hpp | 78 ++++++++++--------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 77de860..fd68c06 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -920,7 +920,7 @@ namespace rxcpp { if (!scheduler) { - scheduler = std::make_shared(); + this->scheduler = std::make_shared(); } } }; @@ -1838,21 +1838,18 @@ namespace rxcpp namespace detail{ template struct ZipSubscriber { - typedef typename std::tuple_element::type::value_type Item; + typedef typename std::tuple_element::type::second_type::value_type Item; typedef std::shared_ptr> ResultObserver; struct Next { - std::unique_lock& guard; std::shared_ptr state; const ResultObserver& observer; const ComposableDisposable& cd; explicit Next( - std::unique_lock& guard, std::shared_ptr state, const ResultObserver& observer, const ComposableDisposable& cd) - : guard(guard) - , state(std::move(state)) + : state(std::move(state)) , observer(observer) , cd(cd) { } @@ -1860,15 +1857,15 @@ namespace rxcpp template void operator()(ZipQueue&... queue) { // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue.empty()...}; + bool empties[] = {queue.second.empty()...}; if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { // all queues have an item. // // copy front of each queue - auto args = std::make_tuple(queue.front()...); + auto args = std::make_tuple(queue.second.front()...); // cause side-effect of pop on each queue - std::make_tuple((queue.pop(), true)...); + std::make_tuple((queue.second.pop(), true)...); typedef decltype(util::tuple_dispatch(state->selector, args)) U; util::maybe result; @@ -1878,24 +1875,14 @@ namespace rxcpp observer->OnError(std::current_exception()); } if (!!result) { - ++state->pending; - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(*result.get())); - } - --state->pending; + observer->OnNext(std::move(*result.get())); } } // build new array to check for any empty queue - bool post_empties[] = {queue.empty()...}; - if (state->completed && state->pending == 0 && - std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + bool post_empties[] = {queue.first && queue.second.empty()...}; + if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { // at least one queue is empty and at least one of the sources has completed. // it is time to stop. - - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); observer->OnCompleted(); cd.Dispose(); } @@ -1904,15 +1891,15 @@ namespace rxcpp template void operator()(ZipQueue1& queue1, ZipQueue2& queue2) { // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue1.empty(), queue2.empty()}; + bool empties[] = {queue1.second.empty(), queue2.second.empty()}; if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { // all queues have an item. // // copy front of each queue - auto args = std::make_tuple(queue1.front(), queue2.front()); + auto args = std::make_tuple(queue1.second.front(), queue2.second.front()); - queue1.pop(); - queue2.pop(); + queue1.second.pop(); + queue2.second.pop(); typedef decltype(util::tuple_dispatch(state->selector, args)) U; util::maybe result; @@ -1922,24 +1909,14 @@ namespace rxcpp observer->OnError(std::current_exception()); } if (!!result) { - ++state->pending; - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(*result.get())); - } - --state->pending; + observer->OnNext(std::move(*result.get())); } } // build new array to check for any empty queue - bool post_empties[] = {queue1.empty(), queue2.empty()}; - if (state->completed && state->pending == 0 && - std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + bool post_empties[] = {queue1.first && queue1.second.empty(), queue2.first && queue2.second.empty()}; + if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { // at least one queue is empty and at least one of the sources has completed. // it is time to stop. - - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); observer->OnCompleted(); cd.Dispose(); } @@ -1957,21 +1934,22 @@ namespace rxcpp [=](const Item& element) { std::unique_lock guard(state->lock); - std::get(state->queues).push(element); - Next next(guard, state, observer, cd); + std::get(state->queues).second.push(element); + Next next(state, observer, cd); util::tuple_dispatch(next, state->queues); }, // on completed [=] { std::unique_lock guard(state->lock); - state->completed = true; - Next next(guard, state, observer, cd); + std::get(state->queues).first = true; + Next next(state, observer, cd); util::tuple_dispatch(next, state->queues); }, // on error [=](const std::exception_ptr& error) { + std::unique_lock guard(state->lock); observer->OnError(error); cd.Dispose(); })); @@ -1998,7 +1976,7 @@ namespace rxcpp { typedef typename std::result_of::type result_type; typedef std::tuple>...> Sources; - typedef std::tuple...> Queues; + typedef std::tuple>...> Queues; struct State { typedef Queues Queues; typedef Sources Sources; @@ -2006,13 +1984,9 @@ namespace rxcpp typedef std::tuple_size SourcesSize; explicit State(S selector) : selector(std::move(selector)) - , pending(0) - , completed(false) {} std::mutex lock; S selector; - size_t pending; - bool completed; Queues queues; }; Sources sources(source...); @@ -2037,7 +2011,7 @@ namespace rxcpp { typedef typename std::result_of::type result_type; typedef std::tuple>, std::shared_ptr>> Sources; - typedef std::tuple, std::queue> Queues; + typedef std::tuple>, std::pair>> Queues; struct State { typedef Queues Queues; typedef Sources Sources; @@ -2045,13 +2019,9 @@ namespace rxcpp typedef std::tuple_size SourcesSize; explicit State(S selector) : selector(std::move(selector)) - , pending(0) - , completed(false) {} std::mutex lock; S selector; - size_t pending; - bool completed; Queues queues; }; Sources sources(source1, source2); @@ -2774,7 +2744,7 @@ namespace rxcpp template - const std::shared_ptr> ToStdCollection( + std::shared_ptr> ToStdCollection( const std::shared_ptr>& source ) { -- GitLab From a05cc5a0543340daa642aba7dcddaeee7bdc8d2a Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sat, 28 Sep 2013 21:25:20 -0700 Subject: [PATCH 081/782] adding random operator --- Rx/CPP/src/cpprx/rx-operators.hpp | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index fd68c06..e70e460 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -1067,6 +1067,63 @@ namespace rxcpp }); } + // + // std::mt19937 twister; + // std::uniform_int_distribution xDistribution(0, xExtent - 1); + // auto xSource = Random(twister, xDistribution, [](std::mt19937& e){ + // e.seed(std::random_device()()); + // }); + // + template + std::shared_ptr> Random( + Engine e, + Distribution d, + Seeder s, + Scheduler::shared scheduler = nullptr) + { + typedef typename Distribution::result_type T; + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Engine e; + Distribution d; + T step() + { + return d(e); + } + }; + auto state = std::make_shared(); + state->cancel = false; + state->e = e; + state->d = d; + + // allow the seed to be set + s(state->e); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + if (state->cancel) + return Disposable::Empty(); + + observer->OnNext(state->step()); + return s->Schedule(std::move(self)); + }))); + + return cd; + }); + } + inline std::shared_ptr> Interval( Scheduler::clock::duration due, Scheduler::shared scheduler) -- GitLab From 238f86c998f1b1be77521256e500cbf0834f3950 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 6 Nov 2013 00:05:00 -0800 Subject: [PATCH 082/782] Fixes Scan adds Empty --- Rx/CPP/src/cpprx/rx-operators.hpp | 104 +++++++++++++++++++++++++++--- Rx/CPP/src/cpprx/rx.hpp | 5 ++ Rx/CPP/testbench/testbench.cpp | 55 ++++++++++++++++ 3 files changed, 154 insertions(+), 10 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index e70e460..324652f 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -869,6 +869,66 @@ namespace rxcpp } }; + namespace detail + { + template + class EmptyObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnCompleted(); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer, T> ProducerBase; + public: + + EmptyObservable(Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + scheduler(scheduler) + { + if (!scheduler) + { + this->scheduler = std::make_shared(); + } + } + }; + } + template + std::shared_ptr> Empty( + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(scheduler)); + } namespace detail { @@ -916,7 +976,8 @@ namespace rxcpp setSink(sink->GetDisposable()); return sink->Run(); }), - value(value) + value(value), + scheduler(scheduler) { if (!scheduler) { @@ -926,7 +987,7 @@ namespace rxcpp }; } template - const std::shared_ptr> Return( + std::shared_ptr> Return( T value, Scheduler::shared scheduler = nullptr ) @@ -981,11 +1042,12 @@ namespace rxcpp setSink(sink->GetDisposable()); return sink->Run(); }), - exception(exception) + exception(exception), + scheduler(scheduler) { if (!scheduler) { - scheduler = std::make_shared(); + this->scheduler = std::make_shared(); } } }; @@ -2465,12 +2527,14 @@ namespace rxcpp public: typedef std::function Accumulator; + typedef std::function(T)> Seeder; private: Source source; - A seed; + util::maybe seed; Accumulator accumulator; + Seeder seeder; class _ : public Sink<_, A>, public Observer { @@ -2496,7 +2560,7 @@ namespace rxcpp } else { - accumulation.set(parent->accumulator(parent->seed, t)); + accumulation.set(!!parent->seed ? parent->accumulator(*parent->seed.get(), t) : *parent->seeder(t).get()); } } catch (...) @@ -2509,6 +2573,9 @@ namespace rxcpp } virtual void OnCompleted() { + if (!accumulation && !!parent->seed) { + SinkBase::observer->OnNext(*parent->seed.get()); + } SinkBase::observer->OnCompleted(); SinkBase::Dispose(); } @@ -2522,7 +2589,7 @@ namespace rxcpp typedef Producer ProducerBase; public: - ScanObservable(Source source, A seed, Accumulator accumulator) : + ScanObservable(Source source, util::maybe seed, Accumulator accumulator, Seeder seeder) : ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); @@ -2531,19 +2598,36 @@ namespace rxcpp }), source(std::move(source)), seed(std::move(seed)), - accumulator(std::move(accumulator)) + accumulator(std::move(accumulator)), + seeder(std::move(seeder)) { } }; } template - const std::shared_ptr> Scan( + std::shared_ptr> Scan( const std::shared_ptr>& source, A seed, typename detail::ScanObservable::Accumulator accumulator ) { - return std::make_shared>(std::move(source), std::move(seed), std::move(accumulator)); + return std::make_shared>( + std::move(source), + util::maybe(std::move(seed)), + std::move(accumulator), + [](T) -> util::maybe {std::abort(); return util::maybe();}); + } + template + std::shared_ptr> Scan( + const std::shared_ptr>& source, + typename detail::ScanObservable::Accumulator accumulator + ) + { + return std::make_shared>( + std::move(source), + util::maybe(), + std::move(accumulator), + [](T t) -> util::maybe {return util::maybe(t);}); } template diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 54ae133..3835a3c 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -283,6 +283,11 @@ namespace detail { -> decltype(from(Scan(obj, seed, accumulator))) { return from(Scan(obj, seed, accumulator)); } + template + auto scan(A accumulator) + -> decltype(from(Scan(obj, accumulator))) { + return from(Scan(obj, accumulator)); + } template auto take(Integral n) -> decltype(from(Take(obj, n))) { diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 6122fd7..6aaee53 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -59,6 +59,59 @@ void PrintPrimes(int n) })); } +void Scan() +{ + int test = 0; + auto next = [&](int i) { + cout << "next " << test << ":" << i << endl; + }; + auto complete = [&]() { + cout << "completed " << test << endl; + }; + auto error = [&](std::exception_ptr e) { + try { + std::rethrow_exception(e); + } + catch(std::exception ex) { + cout << ex.what() << endl; + } + }; + + auto input = std::make_shared(); + + auto add = [](int x, int y){return x + y;}; + + // Usage + auto obs1 = rxcpp::from(rxcpp::Empty(input)).scan(add); + auto obs2 = rxcpp::from(rxcpp::Empty(input)).scan(0, add); + + auto obs3 = rxcpp::from(rxcpp::Range(1, 3, 1, input)).scan(add); + auto obs4 = rxcpp::from(rxcpp::Range(1, 3, 1, input)).scan(0, add); + + test = 1; + obs1.subscribe(next, complete, error); + // => completed 1 + + test = 2; + obs2.subscribe(next, complete, error); + // => next 2:0 + // => completed 2 + + test = 3; + obs3.subscribe(next, complete, error); + // => next 3:1 + // => next 3:3 + // => next 3:6 + // => completed 3 + + test = 4; + obs4.subscribe(next, complete, error); + // => next 4:1 + // => next 4:3 + // => next 4:6 + // => completed 4 +} + void Concat(int n) { auto input1 = std::make_shared(); @@ -493,6 +546,8 @@ int main(int argc, char* argv[]) innerScheduler(); innerScheduler(); + Scan(); + run(); } catch (exception& e) { -- GitLab From 35de7d7daf1ccd7125d655127ab3537b7401b96f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 11:29:58 -0800 Subject: [PATCH 083/782] moved Empty to separate header --- Rx/CPP/src/cpprx/operators/Empty.hpp | 73 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-includes.hpp | 2 + Rx/CPP/src/cpprx/rx-operators.hpp | 64 ++---------------------- 3 files changed, 80 insertions(+), 59 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Empty.hpp diff --git a/Rx/CPP/src/cpprx/operators/Empty.hpp b/Rx/CPP/src/cpprx/operators/Empty.hpp new file mode 100644 index 0000000..6dfb448 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Empty.hpp @@ -0,0 +1,73 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#if !defined(CPPRX_RX_OPERATORS_EMPTY_HPP) +#define CPPRX_RX_OPERATORS_EMPTY_HPP + +namespace rxcpp +{ + + namespace detail + { + template + class EmptyObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnCompleted(); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer, T> ProducerBase; + public: + + EmptyObservable(Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + scheduler(scheduler) + { + if (!scheduler) + { + this->scheduler = std::make_shared(); + } + } + }; + } + template + std::shared_ptr> Empty( + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(scheduler)); + } +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index d8dc7c1..743a86f 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -10,6 +10,8 @@ #undef min #undef max +#include + #include #include #include diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 324652f..c44e02c 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -868,67 +868,13 @@ namespace rxcpp return subject->Subscribe(observer); } }; +} - namespace detail - { - template - class EmptyObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } +#include "operators/empty.hpp" - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnCompleted(); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer, T> ProducerBase; - public: +namespace rxcpp +{ - EmptyObservable(Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - } - template - std::shared_ptr> Empty( - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(scheduler)); - } namespace detail { @@ -2615,7 +2561,7 @@ namespace rxcpp std::move(source), util::maybe(std::move(seed)), std::move(accumulator), - [](T) -> util::maybe {std::abort(); return util::maybe();}); + [](T) -> util::maybe {abort(); return util::maybe();}); } template std::shared_ptr> Scan( -- GitLab From 0b4df348fb25eeca76e81784834d0cf9093bb91b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 11:39:16 -0800 Subject: [PATCH 084/782] move Return to separate header --- Rx/CPP/src/cpprx/operators/Return.hpp | 77 +++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 69 +----------------------- 2 files changed, 79 insertions(+), 67 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Return.hpp diff --git a/Rx/CPP/src/cpprx/operators/Return.hpp b/Rx/CPP/src/cpprx/operators/Return.hpp new file mode 100644 index 0000000..bb1e129 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Return.hpp @@ -0,0 +1,77 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once + +#if !defined(CPPRX_RX_OPERATORS_RETURN_HPP) +#define CPPRX_RX_OPERATORS_RETURN_HPP + +namespace rxcpp +{ + + namespace detail + { + template + class ReturnObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + T value; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnNext(local->value); + that->SinkBase::observer->OnCompleted(); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer, T> ProducerBase; + public: + + ReturnObservable(T value, Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + value(value), + scheduler(scheduler) + { + if (!scheduler) + { + this->scheduler = std::make_shared(); + } + } + }; + } + template + std::shared_ptr> Return( + T value, + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(value), std::move(scheduler)); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index c44e02c..411b720 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -870,77 +870,12 @@ namespace rxcpp }; } -#include "operators/empty.hpp" +#include "operators/Empty.hpp" +#include "operators/Return.hpp" namespace rxcpp { - - namespace detail - { - template - class ReturnObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - T value; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnNext(local->value); - that->SinkBase::observer->OnCompleted(); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer, T> ProducerBase; - public: - - ReturnObservable(T value, Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - value(value), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - } - template - std::shared_ptr> Return( - T value, - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(value), std::move(scheduler)); - } - namespace detail { template -- GitLab From a3bedef1715f5d9069c3c0c2cc3e1f31957ed531 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:27:00 -0800 Subject: [PATCH 085/782] recursive reference to help editor --- Rx/CPP/src/cpprx/operators/Empty.hpp | 1 + Rx/CPP/src/cpprx/operators/Return.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Rx/CPP/src/cpprx/operators/Empty.hpp b/Rx/CPP/src/cpprx/operators/Empty.hpp index 6dfb448..09466ca 100644 --- a/Rx/CPP/src/cpprx/operators/Empty.hpp +++ b/Rx/CPP/src/cpprx/operators/Empty.hpp @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. #pragma once +#include "../rx-operators.hpp" #if !defined(CPPRX_RX_OPERATORS_EMPTY_HPP) #define CPPRX_RX_OPERATORS_EMPTY_HPP diff --git a/Rx/CPP/src/cpprx/operators/Return.hpp b/Rx/CPP/src/cpprx/operators/Return.hpp index bb1e129..cb97075 100644 --- a/Rx/CPP/src/cpprx/operators/Return.hpp +++ b/Rx/CPP/src/cpprx/operators/Return.hpp @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. #pragma once +#include "../rx-operators.hpp" #if !defined(CPPRX_RX_OPERATORS_RETURN_HPP) #define CPPRX_RX_OPERATORS_RETURN_HPP -- GitLab From a7759e48e727c23f5cc13487e6dd1136c48f5567 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:27:16 -0800 Subject: [PATCH 086/782] move Throw to separate header --- Rx/CPP/src/cpprx/operators/Throw.hpp | 79 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 66 +---------------------- 2 files changed, 80 insertions(+), 65 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Throw.hpp diff --git a/Rx/CPP/src/cpprx/operators/Throw.hpp b/Rx/CPP/src/cpprx/operators/Throw.hpp new file mode 100644 index 0000000..df94880 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Throw.hpp @@ -0,0 +1,79 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_THROW_HPP) +#define CPPRX_RX_OPERATORS_THROW_HPP + +namespace rxcpp +{ + + namespace detail + { + template + class ThrowObservable : public Producer, T> + { + typedef ThrowObservable This; + typedef std::shared_ptr Parent; + + std::exception_ptr exception; + Scheduler::shared scheduler; + + class _ : public Sink<_, T> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + auto local = parent; + auto that = this->shared_from_this(); + return parent->scheduler->Schedule( + [=](Scheduler::shared) -> Disposable { + that->SinkBase::observer->OnError(local->exception); + that->SinkBase::Dispose(); + return Disposable::Empty(); + }); + } + }; + + typedef Producer ProducerBase; + public: + + ThrowObservable(std::exception_ptr exception, Scheduler::shared scheduler) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + exception(exception), + scheduler(scheduler) + { + if (!scheduler) + { + this->scheduler = std::make_shared(); + } + } + }; + } + template + const std::shared_ptr> Throw( + std::exception_ptr exception, + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(exception), std::move(scheduler)); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 411b720..5ba0c91 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -872,75 +872,11 @@ namespace rxcpp #include "operators/Empty.hpp" #include "operators/Return.hpp" +#include "operators/Throw.hpp" namespace rxcpp { - namespace detail - { - template - class ThrowObservable : public Producer, T> - { - typedef ThrowObservable This; - typedef std::shared_ptr Parent; - - std::exception_ptr exception; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnError(local->exception); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer ProducerBase; - public: - - ThrowObservable(std::exception_ptr exception, Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - exception(exception), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - } - template - const std::shared_ptr> Throw( - std::exception_ptr exception, - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(exception), std::move(scheduler)); - } template struct fix0_thunk { -- GitLab From 48a58b94e2463cd23d5379fff81ec44c5ee5ed7b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:30:08 -0800 Subject: [PATCH 087/782] move Range to separate header --- Rx/CPP/src/cpprx/operators/Range.hpp | 65 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 64 +++------------------------ 2 files changed, 72 insertions(+), 57 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Range.hpp diff --git a/Rx/CPP/src/cpprx/operators/Range.hpp b/Rx/CPP/src/cpprx/operators/Range.hpp new file mode 100644 index 0000000..2e346cc --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Range.hpp @@ -0,0 +1,65 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_RANGE_HPP) +#define CPPRX_RX_OPERATORS_RANGE_HPP + +namespace rxcpp +{ + + + template + auto Range( + Integral start, Integral end = std::numeric_limits::max(), Integral step = 1, + Scheduler::shared scheduler = nullptr) + -> std::shared_ptr> + { + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Integral i; + Integral rem; + }; + auto state = std::make_shared(); + state->cancel = false; + state->i = start; + state->rem = ((end - start) + step) / step; + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + if (state->cancel) + return Disposable::Empty(); + + if (!state->rem) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(state->i); + --state->rem; + state->i += step; + return s->Schedule(std::move(self)); + } + return Disposable::Empty(); + }))); + + return cd; + }); + } +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 5ba0c91..c3ce2c5 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -868,15 +868,6 @@ namespace rxcpp return subject->Subscribe(observer); } }; -} - -#include "operators/Empty.hpp" -#include "operators/Return.hpp" -#include "operators/Throw.hpp" - -namespace rxcpp -{ - template struct fix0_thunk { @@ -894,57 +885,16 @@ namespace rxcpp { return fix0_thunk(std::move(f)); } +} - template - auto Range( - Integral start, Integral end = std::numeric_limits::max(), Integral step = 1, - Scheduler::shared scheduler = nullptr) - -> std::shared_ptr> - { - if (!scheduler) {scheduler = std::make_shared();} - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = ((end - start) + step) / step; - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); +#include "operators/Empty.hpp" +#include "operators/Return.hpp" +#include "operators/Throw.hpp" +#include "operators/Range.hpp" - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - state->i += step; - return s->Schedule(std::move(self)); - } - return Disposable::Empty(); - }))); +namespace rxcpp +{ - return cd; - }); - } // // std::mt19937 twister; -- GitLab From 22a97d5b1755c8db5d4c75b5822bf9ba0600410d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:32:39 -0800 Subject: [PATCH 088/782] move Random to separate header --- Rx/CPP/src/cpprx/operators/Random.hpp | 70 +++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 58 +--------------------- 2 files changed, 71 insertions(+), 57 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Random.hpp diff --git a/Rx/CPP/src/cpprx/operators/Random.hpp b/Rx/CPP/src/cpprx/operators/Random.hpp new file mode 100644 index 0000000..741acb8 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Random.hpp @@ -0,0 +1,70 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_RANDOM_HPP) +#define CPPRX_RX_OPERATORS_RANDOM_HPP + +namespace rxcpp +{ + + // + // std::mt19937 twister; + // std::uniform_int_distribution xDistribution(0, xExtent - 1); + // auto xSource = Random(twister, xDistribution, [](std::mt19937& e){ + // e.seed(std::random_device()()); + // }); + // + template + std::shared_ptr> Random( + Engine e, + Distribution d, + Seeder s, + Scheduler::shared scheduler = nullptr) + { + typedef typename Distribution::result_type T; + if (!scheduler) {scheduler = std::make_shared();} + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + bool cancel; + Engine e; + Distribution d; + T step() + { + return d(e); + } + }; + auto state = std::make_shared(); + state->cancel = false; + state->e = e; + state->d = d; + + // allow the seed to be set + s(state->e); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + if (state->cancel) + return Disposable::Empty(); + + observer->OnNext(state->step()); + return s->Schedule(std::move(self)); + }))); + + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index c3ce2c5..9d5eca0 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -891,68 +891,12 @@ namespace rxcpp #include "operators/Return.hpp" #include "operators/Throw.hpp" #include "operators/Range.hpp" +#include "operators/Random.hpp" namespace rxcpp { - // - // std::mt19937 twister; - // std::uniform_int_distribution xDistribution(0, xExtent - 1); - // auto xSource = Random(twister, xDistribution, [](std::mt19937& e){ - // e.seed(std::random_device()()); - // }); - // - template - std::shared_ptr> Random( - Engine e, - Distribution d, - Seeder s, - Scheduler::shared scheduler = nullptr) - { - typedef typename Distribution::result_type T; - if (!scheduler) {scheduler = std::make_shared();} - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Engine e; - Distribution d; - T step() - { - return d(e); - } - }; - auto state = std::make_shared(); - state->cancel = false; - state->e = e; - state->d = d; - - // allow the seed to be set - s(state->e); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); - - observer->OnNext(state->step()); - return s->Schedule(std::move(self)); - }))); - - return cd; - }); - } - inline std::shared_ptr> Interval( Scheduler::clock::duration due, Scheduler::shared scheduler) -- GitLab From 824301e9940c1a85cc2623bf02075e9c8969a0b5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:41:02 -0800 Subject: [PATCH 089/782] move Interval to separate header --- Rx/CPP/src/cpprx/operators/Interval.hpp | 62 +++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 52 +-------------------- 2 files changed, 64 insertions(+), 50 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Interval.hpp diff --git a/Rx/CPP/src/cpprx/operators/Interval.hpp b/Rx/CPP/src/cpprx/operators/Interval.hpp new file mode 100644 index 0000000..cd5a3e9 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Interval.hpp @@ -0,0 +1,62 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_INTERVAL_HPP) +#define CPPRX_RX_OPERATORS_INTERVAL_HPP + +namespace rxcpp +{ + + inline std::shared_ptr> Interval( + Scheduler::clock::duration due, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State : public std::enable_shared_from_this { + State(Scheduler::clock::duration due, + Scheduler::clock::time_point last, + std::shared_ptr> observer) : due(due), last(last), cursor(0), observer(observer) { + cd.Add(sd);} + + Scheduler::clock::duration due; + Scheduler::clock::time_point last; + size_t cursor; + std::shared_ptr> observer; + ComposableDisposable cd; + SerialDisposable sd; + + void Tick(Scheduler::shared s){ + observer->OnNext(cursor); + last += due; + ++cursor; + auto keepAlive = this->shared_from_this(); + sd.Set(s->Schedule( + last, + [this, keepAlive] (Scheduler::shared s) -> Disposable { + Tick(s); + return Disposable::Empty(); + } + )); + } + }; + auto state = std::make_shared(due, scheduler->Now(), observer); + + state->last += state->due; + state->sd.Set(scheduler->Schedule( + state->last, + [=] (Scheduler::shared s) -> Disposable { + state->Tick(s); + return Disposable::Empty(); + } + )); + return state->cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 9d5eca0..3330fc4 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -892,60 +892,11 @@ namespace rxcpp #include "operators/Throw.hpp" #include "operators/Range.hpp" #include "operators/Random.hpp" +#include "operators/Interval.hpp" namespace rxcpp { - - inline std::shared_ptr> Interval( - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State : public std::enable_shared_from_this { - State(Scheduler::clock::duration due, - Scheduler::clock::time_point last, - std::shared_ptr> observer) : due(due), last(last), cursor(0), observer(observer) { - cd.Add(sd);} - - Scheduler::clock::duration due; - Scheduler::clock::time_point last; - size_t cursor; - std::shared_ptr> observer; - ComposableDisposable cd; - SerialDisposable sd; - - void Tick(Scheduler::shared s){ - observer->OnNext(cursor); - last += due; - ++cursor; - auto keepAlive = this->shared_from_this(); - sd.Set(s->Schedule( - last, - [this, keepAlive] (Scheduler::shared s) -> Disposable { - Tick(s); - return Disposable::Empty(); - } - )); - } - }; - auto state = std::make_shared(due, scheduler->Now(), observer); - - state->last += state->due; - state->sd.Set(scheduler->Schedule( - state->last, - [=] (Scheduler::shared s) -> Disposable { - state->Tick(s); - return Disposable::Empty(); - } - )); - return state->cd; - }); - } - using std::begin; using std::end; template @@ -1006,6 +957,7 @@ namespace rxcpp }); } + namespace detail { template -- GitLab From eb73b0ef0d0361c2abbbcba66a565be2ca819e52 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:41:55 -0800 Subject: [PATCH 090/782] move Iterate to separate header --- Rx/CPP/src/cpprx/operators/Iterate.hpp | 73 ++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 62 +--------------------- 2 files changed, 74 insertions(+), 61 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Iterate.hpp diff --git a/Rx/CPP/src/cpprx/operators/Iterate.hpp b/Rx/CPP/src/cpprx/operators/Iterate.hpp new file mode 100644 index 0000000..1ccca10 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Iterate.hpp @@ -0,0 +1,73 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_ITERATE_HPP) +#define CPPRX_RX_OPERATORS_ITERATE_HPP + +namespace rxcpp +{ + + using std::begin; + using std::end; + template + auto Iterate( + Range r, + Scheduler::shared scheduler = nullptr) + -> std::shared_ptr::type>> + { + typedef decltype(begin(r)) It; + typedef typename std::decay::type T; + + if (!scheduler) {scheduler = std::make_shared();} + auto range = std::make_shared(std::move(r)); + + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + struct State + { + explicit State(std::shared_ptr rangeArg) : cancel(false) { + this->range = std::move(rangeArg); + this->r_cursor = begin(*this->range); + this->r_end = end(*this->range); + } + bool cancel; + std::shared_ptr range; + It r_cursor; + It r_end; + }; + auto state = std::make_shared(range); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + state->cancel = true; + })); + + cd.Add(scheduler->Schedule( + fix0([=](Scheduler::shared s, std::function self) -> Disposable + { + if (state->cancel) + return Disposable::Empty(); + + if (state->r_cursor == state->r_end) + { + observer->OnCompleted(); + } + else + { + observer->OnNext(*state->r_cursor); + ++state->r_cursor; + return s->Schedule(std::move(self)); + } + return Disposable::Empty(); + }))); + + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 3330fc4..adb541f 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -893,71 +893,11 @@ namespace rxcpp #include "operators/Range.hpp" #include "operators/Random.hpp" #include "operators/Interval.hpp" +#include "operators/Iterate.hpp" namespace rxcpp { - using std::begin; - using std::end; - template - auto Iterate( - Range r, - Scheduler::shared scheduler = nullptr) - -> std::shared_ptr::type>> - { - typedef decltype(begin(r)) It; - typedef typename std::decay::type T; - - if (!scheduler) {scheduler = std::make_shared();} - auto range = std::make_shared(std::move(r)); - - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - explicit State(std::shared_ptr rangeArg) : cancel(false) { - this->range = std::move(rangeArg); - this->r_cursor = begin(*this->range); - this->r_end = end(*this->range); - } - bool cancel; - std::shared_ptr range; - It r_cursor; - It r_end; - }; - auto state = std::make_shared(range); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); - - if (state->r_cursor == state->r_end) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(*state->r_cursor); - ++state->r_cursor; - return s->Schedule(std::move(self)); - } - return Disposable::Empty(); - }))); - - return cd; - }); - } - - namespace detail { template -- GitLab From 69cf3a33140b05658fb312bf3c4ab0941d1cfbcc Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:43:53 -0800 Subject: [PATCH 091/782] move Using to separate header --- Rx/CPP/src/cpprx/operators/Using.hpp | 111 +++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 98 +---------------------- 2 files changed, 112 insertions(+), 97 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Using.hpp diff --git a/Rx/CPP/src/cpprx/operators/Using.hpp b/Rx/CPP/src/cpprx/operators/Using.hpp new file mode 100644 index 0000000..634bfc6 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Using.hpp @@ -0,0 +1,111 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_USING_HPP) +#define CPPRX_RX_OPERATORS_USING_HPP + +namespace rxcpp +{ + + namespace detail + { + template + class UsingObservable : public Producer, T> + { + typedef UsingObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr> Source; + + public: + typedef std::function ResourceFactory; + typedef std::function ObservableFactory; + + private: + ResourceFactory resourceFactory; + ObservableFactory observableFactory; + + class _ : public Sink<_, T>, public Observer + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + ComposableDisposable cd; + Source source; + auto disposable = Disposable::Empty(); + + try + { + auto resource = parent->resourceFactory(); + disposable = resource; + source = parent->observableFactory(resource); + } + catch (...) + { + cd.Add(Throw(std::current_exception())->Subscribe(this->shared_from_this())); + cd.Add(std::move(disposable)); + return cd; + } + + cd.Add(source->Subscribe(this->shared_from_this())); + cd.Add(std::move(disposable)); + return cd; + } + + virtual void OnNext(const T& t) + { + SinkBase::observer->OnNext(t); + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; + public: + + UsingObservable(ResourceFactory resourceFactory, ObservableFactory observableFactory) : + ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + resourceFactory(resourceFactory), + observableFactory(observableFactory) + { + } + }; + } + template + auto Using( + RF resourceFactory, + OF observableFactory + ) + -> decltype(observableFactory(resourceFactory())) + { + typedef typename observable_item::type T; + typedef decltype(resourceFactory()) R; + return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index adb541f..5a44b35 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -894,107 +894,11 @@ namespace rxcpp #include "operators/Random.hpp" #include "operators/Interval.hpp" #include "operators/Iterate.hpp" +#include "operators/Using.hpp" namespace rxcpp { - namespace detail - { - template - class UsingObservable : public Producer, T> - { - typedef UsingObservable This; - typedef std::shared_ptr Parent; - typedef std::shared_ptr> Source; - - public: - typedef std::function ResourceFactory; - typedef std::function ObservableFactory; - - private: - ResourceFactory resourceFactory; - ObservableFactory observableFactory; - - class _ : public Sink<_, T>, public Observer - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - ComposableDisposable cd; - Source source; - auto disposable = Disposable::Empty(); - - try - { - auto resource = parent->resourceFactory(); - disposable = resource; - source = parent->observableFactory(resource); - } - catch (...) - { - cd.Add(Throw(std::current_exception())->Subscribe(this->shared_from_this())); - cd.Add(std::move(disposable)); - return cd; - } - - cd.Add(source->Subscribe(this->shared_from_this())); - cd.Add(std::move(disposable)); - return cd; - } - - virtual void OnNext(const T& t) - { - SinkBase::observer->OnNext(t); - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; - public: - - UsingObservable(ResourceFactory resourceFactory, ObservableFactory observableFactory) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - resourceFactory(resourceFactory), - observableFactory(observableFactory) - { - } - }; - } - template - auto Using( - RF resourceFactory, - OF observableFactory - ) - -> decltype(observableFactory(resourceFactory())) - { - typedef typename observable_item::type T; - typedef decltype(resourceFactory()) R; - return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); - } ////////////////////////////////////////////////////////////////////// // -- GitLab From 11143407fc6640379540fbc3b93a80a3ea8f19b0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:47:12 -0800 Subject: [PATCH 092/782] move Select to separate header --- Rx/CPP/src/cpprx/operators/Select.hpp | 52 +++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 66 ++++++--------------------- 2 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Select.hpp diff --git a/Rx/CPP/src/cpprx/operators/Select.hpp b/Rx/CPP/src/cpprx/operators/Select.hpp new file mode 100644 index 0000000..42d40be --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Select.hpp @@ -0,0 +1,52 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SELECT_HPP) +#define CPPRX_RX_OPERATORS_SELECT_HPP + +namespace rxcpp +{ + + template + auto Select( + const std::shared_ptr>& source, + S selector + ) + -> const std::shared_ptr::type>> + { + typedef typename std::result_of::type U; + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + util::maybe result; + try { + result.set(selector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 5a44b35..b9a1c83 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -885,20 +885,6 @@ namespace rxcpp { return fix0_thunk(std::move(f)); } -} - -#include "operators/Empty.hpp" -#include "operators/Return.hpp" -#include "operators/Throw.hpp" -#include "operators/Range.hpp" -#include "operators/Random.hpp" -#include "operators/Interval.hpp" -#include "operators/Iterate.hpp" -#include "operators/Using.hpp" - -namespace rxcpp -{ - ////////////////////////////////////////////////////////////////////// // @@ -953,49 +939,25 @@ namespace rxcpp if (error != std::exception_ptr()) { std::rethrow_exception(error);} } +} + +#include "operators/Empty.hpp" +#include "operators/Return.hpp" +#include "operators/Throw.hpp" +#include "operators/Range.hpp" +#include "operators/Random.hpp" +#include "operators/Interval.hpp" +#include "operators/Iterate.hpp" +#include "operators/Using.hpp" +#include "operators/Select.hpp" + +namespace rxcpp +{ ////////////////////////////////////////////////////////////////////// // // standard query operators - template - auto Select( - const std::shared_ptr>& source, - S selector - ) - -> const std::shared_ptr::type>> - { - typedef typename std::result_of::type U; - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - util::maybe result; - try { - result.set(selector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } template auto SelectMany( -- GitLab From 4b637be9a55d4aa1e0390defc4d9512ecd83b240 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:49:43 -0800 Subject: [PATCH 093/782] move SelectMany to separate header --- Rx/CPP/src/cpprx/operators/SelectMany.hpp | 156 ++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 153 +-------------------- 2 files changed, 161 insertions(+), 148 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/SelectMany.hpp diff --git a/Rx/CPP/src/cpprx/operators/SelectMany.hpp b/Rx/CPP/src/cpprx/operators/SelectMany.hpp new file mode 100644 index 0000000..b24cb20 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/SelectMany.hpp @@ -0,0 +1,156 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SELECTMANY_HPP) +#define CPPRX_RX_OPERATORS_SELECTMANY_HPP + +namespace rxcpp +{ + + template + auto SelectMany( + const std::shared_ptr>& source, + CS collectionSelector, + RS resultSelector) + -> const std::shared_ptr::type>::type&)>::type>> + { + typedef typename std::decay::type>::type C; + typedef typename observable_item::type CI; + typedef typename std::result_of::type U; + + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + size_t subscribed; + bool cancel; + std::mutex lock; + }; + auto state = std::make_shared(); + state->cancel = false; + state->subscribed = 0; + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + std::unique_lock guard(state->lock); + state->cancel = true; }) + ); + + ++state->subscribed; + cd.Add(Subscribe( + source, + // on next + [=](const T& sourceElement) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + if (!cancel) ++state->subscribed; + } + if (!cancel) { + util::maybe collection; + try { + collection.set(collectionSelector(sourceElement)); + } catch(...) { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + } + if (!!collection) { + cd.Add(Subscribe( + *collection.get(), + // on next + [=](const CI& collectionElement) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + util::maybe result; + try { + result.set(resultSelector(sourceElement, collectionElement)); + } catch(...) { + observer->OnError(std::current_exception()); + cd.Dispose(); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + cd.Dispose(); + })); + } + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + finished = (--state->subscribed) == 0; + cancel = state->cancel; + } + if (!cancel && finished) + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + --state->subscribed; + cancel = state->cancel; + } + if (!cancel) + observer->OnError(error); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index b9a1c83..fb3bbf1 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -949,158 +949,15 @@ namespace rxcpp #include "operators/Interval.hpp" #include "operators/Iterate.hpp" #include "operators/Using.hpp" + +////////////////////////////////////////////////////////////////////// +// +// standard query operators #include "operators/Select.hpp" +#include "operators/SelectMany.hpp" namespace rxcpp { - - ////////////////////////////////////////////////////////////////////// - // - // standard query operators - - - template - auto SelectMany( - const std::shared_ptr>& source, - CS collectionSelector, - RS resultSelector) - -> const std::shared_ptr::type>::type&)>::type>> - { - typedef typename std::decay::type>::type C; - typedef typename observable_item::type CI; - typedef typename std::result_of::type U; - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - size_t subscribed; - bool cancel; - std::mutex lock; - }; - auto state = std::make_shared(); - state->cancel = false; - state->subscribed = 0; - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - std::unique_lock guard(state->lock); - state->cancel = true; }) - ); - - ++state->subscribed; - cd.Add(Subscribe( - source, - // on next - [=](const T& sourceElement) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - if (!cancel) ++state->subscribed; - } - if (!cancel) { - util::maybe collection; - try { - collection.set(collectionSelector(sourceElement)); - } catch(...) { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - } - if (!!collection) { - cd.Add(Subscribe( - *collection.get(), - // on next - [=](const CI& collectionElement) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - util::maybe result; - try { - result.set(resultSelector(sourceElement, collectionElement)); - } catch(...) { - observer->OnError(std::current_exception()); - cd.Dispose(); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; - } - if (!cancel && finished) - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); - cd.Dispose(); - })); - } - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; - } - if (!cancel && finished) - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); - })); - return cd; - }); - } template ObservableT Concat( -- GitLab From 75e10aa5b853575385e23560e6ec2bed4cf9bf1c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:51:36 -0800 Subject: [PATCH 094/782] move Concat to separate header --- Rx/CPP/src/cpprx/operators/Concat.hpp | 161 ++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 148 +---------------------- 2 files changed, 162 insertions(+), 147 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Concat.hpp diff --git a/Rx/CPP/src/cpprx/operators/Concat.hpp b/Rx/CPP/src/cpprx/operators/Concat.hpp new file mode 100644 index 0000000..e173732 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Concat.hpp @@ -0,0 +1,161 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_CONCAT_HPP) +#define CPPRX_RX_OPERATORS_CONCAT_HPP + +namespace rxcpp +{ + + template + ObservableT Concat( + const std::shared_ptr>& source) + { + typedef typename observable_item::type T; + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + bool completed; + bool subscribed; + bool cancel; + std::queue queue; + Scheduler::shared scheduler; + std::mutex lock; + }; + auto state = std::make_shared(); + state->cancel = false; + state->subscribed = 0; + state->scheduler = std::make_shared(); + + ComposableDisposable cd; + + SerialDisposable sd; + cd.Add(sd); + + cd.Add(Disposable([=]{ + std::unique_lock guard(state->lock); + state->cancel = true; }) + ); + + cd.Add(Subscribe( + source, + // on next + [=](const ObservableT& sourceElement) + { + bool cancel = false; + bool subscribed = false; + Scheduler::shared sched; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + sched = state->scheduler; + if (!cancel) { + subscribed = state->subscribed; + state->queue.push(sourceElement); + state->subscribed = true; + sched = state->scheduler; + } + } + if (!cancel && !subscribed) { + sd.Set(sched->Schedule( + fix0([state, cd, sd, observer](Scheduler::shared s, std::function self) -> Disposable + { + bool cancel = false; + bool finished = false; + ObservableT next; + { + std::unique_lock guard(state->lock); + finished = state->queue.empty(); + cancel = state->cancel; + if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} + } + if (!cancel && !finished) { + sd.Set(Subscribe( + next, + // on next + [=](const T& t) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnNext(std::move(t)); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + bool subscribe = false; + { + std::unique_lock guard(state->lock); + finished = state->queue.empty() && state->completed; + subscribe = !state->queue.empty(); + state->subscribed = subscribe; + cancel = state->cancel; + } + if (!cancel) { + if (subscribe) {sd.Set(s->Schedule(std::move(self)));} + else if (finished) {observer->OnCompleted(); cd.Dispose();} + } + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + })); + } + return Disposable::Empty(); + }))); + } + }, + // on completed + [=] + { + bool cancel = false; + bool finished = false; + { + std::unique_lock guard(state->lock); + state->completed = true; + finished = state->queue.empty() && !state->subscribed; + cancel = state->cancel; + } + if (!cancel && finished) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + bool cancel = false; + { + std::unique_lock guard(state->lock); + cancel = state->cancel; + } + if (!cancel) { + observer->OnError(std::current_exception()); + } + cd.Dispose(); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index fb3bbf1..49ce6ad 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -955,157 +955,11 @@ namespace rxcpp // standard query operators #include "operators/Select.hpp" #include "operators/SelectMany.hpp" +#include "operators/Concat.hpp" namespace rxcpp { - template - ObservableT Concat( - const std::shared_ptr>& source) - { - typedef typename observable_item::type T; - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - bool completed; - bool subscribed; - bool cancel; - std::queue queue; - Scheduler::shared scheduler; - std::mutex lock; - }; - auto state = std::make_shared(); - state->cancel = false; - state->subscribed = 0; - state->scheduler = std::make_shared(); - - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(Disposable([=]{ - std::unique_lock guard(state->lock); - state->cancel = true; }) - ); - - cd.Add(Subscribe( - source, - // on next - [=](const ObservableT& sourceElement) - { - bool cancel = false; - bool subscribed = false; - Scheduler::shared sched; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - sched = state->scheduler; - if (!cancel) { - subscribed = state->subscribed; - state->queue.push(sourceElement); - state->subscribed = true; - sched = state->scheduler; - } - } - if (!cancel && !subscribed) { - sd.Set(sched->Schedule( - fix0([state, cd, sd, observer](Scheduler::shared s, std::function self) -> Disposable - { - bool cancel = false; - bool finished = false; - ObservableT next; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty(); - cancel = state->cancel; - if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} - } - if (!cancel && !finished) { - sd.Set(Subscribe( - next, - // on next - [=](const T& t) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnNext(std::move(t)); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - bool subscribe = false; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty() && state->completed; - subscribe = !state->queue.empty(); - state->subscribed = subscribe; - cancel = state->cancel; - } - if (!cancel) { - if (subscribe) {sd.Set(s->Schedule(std::move(self)));} - else if (finished) {observer->OnCompleted(); cd.Dispose();} - } - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - })); - } - return Disposable::Empty(); - }))); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - state->completed = true; - finished = state->queue.empty() && !state->subscribed; - cancel = state->cancel; - } - if (!cancel && finished) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - })); - return cd; - }); - } namespace detail{ template -- GitLab From bc3c7ccdc08917609762d6719931aa449e4dbad4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:57:13 -0800 Subject: [PATCH 095/782] move CombineLatest to separate header --- Rx/CPP/src/cpprx/operators/CombineLatest.hpp | 187 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 175 +---------------- 2 files changed, 188 insertions(+), 174 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/CombineLatest.hpp diff --git a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp new file mode 100644 index 0000000..0e98c3f --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp @@ -0,0 +1,187 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_COMBINELATEST_HPP) +#define CPPRX_RX_OPERATORS_COMBINELATEST_HPP + +namespace rxcpp +{ + + namespace detail{ + template + struct CombineLatestSubscriber { + typedef typename SubscribeState::Latest Latest; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const typename std::tuple_element::type& element) + { + auto local = state; + std::unique_lock guard(local->lock); + std::get(local->latest) = element; + if (!std::get(local->latestValid)) { + std::get(local->latestValid) = true; + --local->pendingFirst; + } + if (local->pendingFirst == 0) { + Latest args = local->latest; + typedef decltype(util::tuple_dispatch(local->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(local->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + ++state->pendingIssue; + { + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + observer->OnNext(std::move(*result.get())); + } + --state->pendingIssue; + } + if (state->done && state->pendingIssue == 0) { + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on completed + [=] + { + std::unique_lock guard(state->lock); + --state->pendingComplete; + if (state->pendingComplete == 0) { + state->done = true; + if (state->pendingIssue == 0) { + guard.unlock(); + observer->OnCompleted(); + cd.Dispose(); + } + } + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + CombineLatestSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct CombineLatestSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } + +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto CombineLatest( + S selector, + const std::shared_ptr>&... source + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>...> Sources; + typedef std::tuple Latest; + typedef decltype(std::make_tuple((source, true)...)) LatestValid; + struct State { + typedef Latest Latest; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : latestValid() + , pendingFirst(SourcesSize::value) + , pendingIssue(0) + , pendingComplete(SourcesSize::value) + , done(false) + , selector(std::move(selector)) + {} + std::mutex lock; + LatestValid latestValid; + size_t pendingFirst; + size_t pendingIssue; + size_t pendingComplete; + bool done; + S selector; + Latest latest; + }; + Sources sources(source...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(selector)); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#else + template + auto CombineLatest( + S selector, + const std::shared_ptr>& source1, + const std::shared_ptr>& source2 + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>, std::shared_ptr>> Sources; + typedef std::tuple Latest; + typedef std::tuple LatestValid; + struct State { + typedef Latest Latest; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : latestValid() + , pendingFirst(SourcesSize::value) + , pendingIssue(0) + , pendingComplete(SourcesSize::value) + , done(false) + , selector(std::move(selector)) + {} + std::mutex lock; + LatestValid latestValid; + size_t pendingFirst; + size_t pendingIssue; + size_t pendingComplete; + bool done; + S selector; + Latest latest; + }; + Sources sources(source1, source2); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 49ce6ad..2a58f01 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -956,183 +956,10 @@ namespace rxcpp #include "operators/Select.hpp" #include "operators/SelectMany.hpp" #include "operators/Concat.hpp" +#include "operators/CombineLatest.hpp" namespace rxcpp { - - - namespace detail{ - template - struct CombineLatestSubscriber { - typedef typename SubscribeState::Latest Latest; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const typename std::tuple_element::type& element) - { - auto local = state; - std::unique_lock guard(local->lock); - std::get(local->latest) = element; - if (!std::get(local->latestValid)) { - std::get(local->latestValid) = true; - --local->pendingFirst; - } - if (local->pendingFirst == 0) { - Latest args = local->latest; - typedef decltype(util::tuple_dispatch(local->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(local->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - ++state->pendingIssue; - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(*result.get())); - } - --state->pendingIssue; - } - if (state->done && state->pendingIssue == 0) { - guard.unlock(); - observer->OnCompleted(); - cd.Dispose(); - } - } - }, - // on completed - [=] - { - std::unique_lock guard(state->lock); - --state->pendingComplete; - if (state->pendingComplete == 0) { - state->done = true; - if (state->pendingIssue == 0) { - guard.unlock(); - observer->OnCompleted(); - cd.Dispose(); - } - } - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - CombineLatestSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct CombineLatestSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } - -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto CombineLatest( - S selector, - const std::shared_ptr>&... source - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>...> Sources; - typedef std::tuple Latest; - typedef decltype(std::make_tuple((source, true)...)) LatestValid; - struct State { - typedef Latest Latest; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : latestValid() - , pendingFirst(SourcesSize::value) - , pendingIssue(0) - , pendingComplete(SourcesSize::value) - , done(false) - , selector(std::move(selector)) - {} - std::mutex lock; - LatestValid latestValid; - size_t pendingFirst; - size_t pendingIssue; - size_t pendingComplete; - bool done; - S selector; - Latest latest; - }; - Sources sources(source...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(selector)); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - auto CombineLatest( - S selector, - const std::shared_ptr>& source1, - const std::shared_ptr>& source2 - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>, std::shared_ptr>> Sources; - typedef std::tuple Latest; - typedef std::tuple LatestValid; - struct State { - typedef Latest Latest; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : latestValid() - , pendingFirst(SourcesSize::value) - , pendingIssue(0) - , pendingComplete(SourcesSize::value) - , done(false) - , selector(std::move(selector)) - {} - std::mutex lock; - LatestValid latestValid; - size_t pendingFirst; - size_t pendingIssue; - size_t pendingComplete; - bool done; - S selector; - Latest latest; - }; - Sources sources(source1, source2); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif namespace detail{ template -- GitLab From 8c0e56c78673dc390239f82402b9e22e58197d74 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:57:44 -0800 Subject: [PATCH 096/782] move Zip to separate header --- Rx/CPP/src/cpprx/operators/Zip.hpp | 215 +++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 203 +-------------------------- 2 files changed, 216 insertions(+), 202 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Zip.hpp diff --git a/Rx/CPP/src/cpprx/operators/Zip.hpp b/Rx/CPP/src/cpprx/operators/Zip.hpp new file mode 100644 index 0000000..3d51f0c --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Zip.hpp @@ -0,0 +1,215 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_ZIP_HPP) +#define CPPRX_RX_OPERATORS_ZIP_HPP + +namespace rxcpp +{ + + namespace detail{ + template + struct ZipSubscriber { + typedef typename std::tuple_element::type::second_type::value_type Item; + typedef std::shared_ptr> ResultObserver; + struct Next + { + std::shared_ptr state; + const ResultObserver& observer; + const ComposableDisposable& cd; + explicit Next( + std::shared_ptr state, + const ResultObserver& observer, + const ComposableDisposable& cd) + : state(std::move(state)) + , observer(observer) + , cd(cd) { + } +#if RXCPP_USE_VARIADIC_TEMPLATES + template + void operator()(ZipQueue&... queue) { + // build array of bool that we can iterate to detect empty queues + bool empties[] = {queue.second.empty()...}; + if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { + // all queues have an item. + // + // copy front of each queue + auto args = std::make_tuple(queue.second.front()...); + + // cause side-effect of pop on each queue + std::make_tuple((queue.second.pop(), true)...); + + typedef decltype(util::tuple_dispatch(state->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(state->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } + } + // build new array to check for any empty queue + bool post_empties[] = {queue.first && queue.second.empty()...}; + if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + // at least one queue is empty and at least one of the sources has completed. + // it is time to stop. + observer->OnCompleted(); + cd.Dispose(); + } + } +#else + template + void operator()(ZipQueue1& queue1, ZipQueue2& queue2) { + // build array of bool that we can iterate to detect empty queues + bool empties[] = {queue1.second.empty(), queue2.second.empty()}; + if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { + // all queues have an item. + // + // copy front of each queue + auto args = std::make_tuple(queue1.second.front(), queue2.second.front()); + + queue1.second.pop(); + queue2.second.pop(); + + typedef decltype(util::tuple_dispatch(state->selector, args)) U; + util::maybe result; + try { + result.set(util::tuple_dispatch(state->selector, args)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + observer->OnNext(std::move(*result.get())); + } + } + // build new array to check for any empty queue + bool post_empties[] = {queue1.first && queue1.second.empty(), queue2.first && queue2.second.empty()}; + if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { + // at least one queue is empty and at least one of the sources has completed. + // it is time to stop. + observer->OnCompleted(); + cd.Dispose(); + } + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES + }; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const Item& element) + { + std::unique_lock guard(state->lock); + std::get(state->queues).second.push(element); + Next next(state, observer, cd); + util::tuple_dispatch(next, state->queues); + }, + // on completed + [=] + { + std::unique_lock guard(state->lock); + std::get(state->queues).first = true; + Next next(state, observer, cd); + util::tuple_dispatch(next, state->queues); + }, + // on error + [=](const std::exception_ptr& error) + { + std::unique_lock guard(state->lock); + observer->OnError(error); + cd.Dispose(); + })); + ZipSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct ZipSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto Zip( + S selector, + const std::shared_ptr>&... source + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>...> Sources; + typedef std::tuple>...> Queues; + struct State { + typedef Queues Queues; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : selector(std::move(selector)) + {} + std::mutex lock; + S selector; + Queues queues; + }; + Sources sources(source...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#else + template + auto Zip( + S selector, + const std::shared_ptr>& source1, + const std::shared_ptr>& source2 + ) + -> std::shared_ptr::type>> + { + typedef typename std::result_of::type result_type; + typedef std::tuple>, std::shared_ptr>> Sources; + typedef std::tuple>, std::pair>> Queues; + struct State { + typedef Queues Queues; + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + explicit State(S selector) + : selector(std::move(selector)) + {} + std::mutex lock; + S selector; + Queues queues; + }; + Sources sources(source1, source2); + // bug on osx prevents using make_shared + std::shared_ptr state(new State(std::move(selector))); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 2a58f01..b6a35d5 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -957,212 +957,11 @@ namespace rxcpp #include "operators/SelectMany.hpp" #include "operators/Concat.hpp" #include "operators/CombineLatest.hpp" +#include "operators/Zip.hpp" namespace rxcpp { - namespace detail{ - template - struct ZipSubscriber { - typedef typename std::tuple_element::type::second_type::value_type Item; - typedef std::shared_ptr> ResultObserver; - struct Next - { - std::shared_ptr state; - const ResultObserver& observer; - const ComposableDisposable& cd; - explicit Next( - std::shared_ptr state, - const ResultObserver& observer, - const ComposableDisposable& cd) - : state(std::move(state)) - , observer(observer) - , cd(cd) { - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - void operator()(ZipQueue&... queue) { - // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue.second.empty()...}; - if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { - // all queues have an item. - // - // copy front of each queue - auto args = std::make_tuple(queue.second.front()...); - - // cause side-effect of pop on each queue - std::make_tuple((queue.second.pop(), true)...); - - typedef decltype(util::tuple_dispatch(state->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(state->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - // build new array to check for any empty queue - bool post_empties[] = {queue.first && queue.second.empty()...}; - if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { - // at least one queue is empty and at least one of the sources has completed. - // it is time to stop. - observer->OnCompleted(); - cd.Dispose(); - } - } -#else - template - void operator()(ZipQueue1& queue1, ZipQueue2& queue2) { - // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue1.second.empty(), queue2.second.empty()}; - if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { - // all queues have an item. - // - // copy front of each queue - auto args = std::make_tuple(queue1.second.front(), queue2.second.front()); - - queue1.second.pop(); - queue2.second.pop(); - - typedef decltype(util::tuple_dispatch(state->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(state->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - // build new array to check for any empty queue - bool post_empties[] = {queue1.first && queue1.second.empty(), queue2.first && queue2.second.empty()}; - if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { - // at least one queue is empty and at least one of the sources has completed. - // it is time to stop. - observer->OnCompleted(); - cd.Dispose(); - } - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - }; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const Item& element) - { - std::unique_lock guard(state->lock); - std::get(state->queues).second.push(element); - Next next(state, observer, cd); - util::tuple_dispatch(next, state->queues); - }, - // on completed - [=] - { - std::unique_lock guard(state->lock); - std::get(state->queues).first = true; - Next next(state, observer, cd); - util::tuple_dispatch(next, state->queues); - }, - // on error - [=](const std::exception_ptr& error) - { - std::unique_lock guard(state->lock); - observer->OnError(error); - cd.Dispose(); - })); - ZipSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct ZipSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto Zip( - S selector, - const std::shared_ptr>&... source - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>...> Sources; - typedef std::tuple>...> Queues; - struct State { - typedef Queues Queues; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : selector(std::move(selector)) - {} - std::mutex lock; - S selector; - Queues queues; - }; - Sources sources(source...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - auto Zip( - S selector, - const std::shared_ptr>& source1, - const std::shared_ptr>& source2 - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>, std::shared_ptr>> Sources; - typedef std::tuple>, std::pair>> Queues; - struct State { - typedef Queues Queues; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : selector(std::move(selector)) - {} - std::mutex lock; - S selector; - Queues queues; - }; - Sources sources(source1, source2); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - namespace detail{ template struct MergeSubscriber { -- GitLab From 798d552e353da14472a3e1443d370f26b6818cf8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 12:59:47 -0800 Subject: [PATCH 097/782] move Merge to separate header --- Rx/CPP/src/cpprx/operators/Merge.hpp | 117 +++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 105 +----------------------- 2 files changed, 118 insertions(+), 104 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Merge.hpp diff --git a/Rx/CPP/src/cpprx/operators/Merge.hpp b/Rx/CPP/src/cpprx/operators/Merge.hpp new file mode 100644 index 0000000..793acdf --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Merge.hpp @@ -0,0 +1,117 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_MERGE_HPP) +#define CPPRX_RX_OPERATORS_MERGE_HPP + +namespace rxcpp +{ + + namespace detail{ + template + struct MergeSubscriber { + typedef typename SubscribeState::result_type Item; + typedef std::shared_ptr> ResultObserver; + static void subscribe( + ComposableDisposable& cd, + const std::shared_ptr>& observer, + const std::shared_ptr& state, + const typename SubscribeState::Sources& sources) { + cd.Add(Subscribe( + std::get(sources), + // on next + [=](const Item& element) + { + observer->OnNext(element); + }, + // on completed + [=] + { + if (--state->pendingComplete == 0) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + MergeSubscriber:: + subscribe(cd, observer, state, sources); + } + }; + template + struct MergeSubscriber { + static void subscribe( + ComposableDisposable& , + const std::shared_ptr>& , + const std::shared_ptr& , + const typename SubscribeState::Sources& ) {} + }; + } +#if RXCPP_USE_VARIADIC_TEMPLATES + template + std::shared_ptr> Merge( + const std::shared_ptr>& firstSource, + const std::shared_ptr>&... otherSource + ) + { + typedef MergeSource result_type; + typedef decltype(std::make_tuple(firstSource, otherSource...)) Sources; + struct State { + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + State() + : pendingComplete(SourcesSize::value) + {} + std::atomic pendingComplete; + }; + Sources sources(firstSource, otherSource...); + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#else + template + std::shared_ptr> Merge( + const std::shared_ptr>& firstSource, + const std::shared_ptr>& otherSource + ) + { + typedef MergeSource result_type; + typedef decltype(std::make_tuple(firstSource, otherSource)) Sources; + struct State { + typedef Sources Sources; + typedef result_type result_type; + typedef std::tuple_size SourcesSize; + State() + : pendingComplete(SourcesSize::value) + {} + std::atomic pendingComplete; + }; + Sources sources(firstSource, otherSource); + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + ComposableDisposable cd; + detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); + return cd; + }); + } +#endif //RXCPP_USE_VARIADIC_TEMPLATES +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index b6a35d5..c55efaa 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -958,114 +958,11 @@ namespace rxcpp #include "operators/Concat.hpp" #include "operators/CombineLatest.hpp" #include "operators/Zip.hpp" +#include "operators/Merge.hpp" namespace rxcpp { - namespace detail{ - template - struct MergeSubscriber { - typedef typename SubscribeState::result_type Item; - typedef std::shared_ptr> ResultObserver; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const Item& element) - { - observer->OnNext(element); - }, - // on completed - [=] - { - if (--state->pendingComplete == 0) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - MergeSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct MergeSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - std::shared_ptr> Merge( - const std::shared_ptr>& firstSource, - const std::shared_ptr>&... otherSource - ) - { - typedef MergeSource result_type; - typedef decltype(std::make_tuple(firstSource, otherSource...)) Sources; - struct State { - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - State() - : pendingComplete(SourcesSize::value) - {} - std::atomic pendingComplete; - }; - Sources sources(firstSource, otherSource...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - std::shared_ptr> Merge( - const std::shared_ptr>& firstSource, - const std::shared_ptr>& otherSource - ) - { - typedef MergeSource result_type; - typedef decltype(std::make_tuple(firstSource, otherSource)) Sources; - struct State { - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - State() - : pendingComplete(SourcesSize::value) - {} - std::atomic pendingComplete; - }; - Sources sources(firstSource, otherSource); - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - template const std::shared_ptr> Where( const std::shared_ptr>& source, -- GitLab From fe8c3370c811c8103313235b828c3bcf38daa38b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:01:30 -0800 Subject: [PATCH 098/782] move Where to separate header --- Rx/CPP/src/cpprx/operators/Where.hpp | 52 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 40 +-------------------- 2 files changed, 53 insertions(+), 39 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Where.hpp diff --git a/Rx/CPP/src/cpprx/operators/Where.hpp b/Rx/CPP/src/cpprx/operators/Where.hpp new file mode 100644 index 0000000..679ffab --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Where.hpp @@ -0,0 +1,52 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_WHERE_HPP) +#define CPPRX_RX_OPERATORS_WHERE_HPP + +namespace rxcpp +{ + + template + const std::shared_ptr> Where( + const std::shared_ptr>& source, + P predicate + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + { + return Subscribe( + source, + // on next + [=](const T& element) + { + typedef decltype(predicate(element)) U; + util::maybe result; + try { + result.set(predicate(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result && *result.get()) + { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index c55efaa..5be0cf1 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -959,49 +959,11 @@ namespace rxcpp #include "operators/CombineLatest.hpp" #include "operators/Zip.hpp" #include "operators/Merge.hpp" +#include "operators/Where.hpp" namespace rxcpp { - template - const std::shared_ptr> Where( - const std::shared_ptr>& source, - P predicate - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - typedef decltype(predicate(element)) U; - util::maybe result; - try { - result.set(predicate(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result && *result.get()) - { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - template auto GroupBy( const std::shared_ptr>& source, -- GitLab From 88f447bb9d8cc8987e52e8b0c0291aa935d462b9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:05:25 -0800 Subject: [PATCH 099/782] move GroupBy to separate header --- Rx/CPP/src/cpprx/operators/GroupBy.hpp | 102 +++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 91 +--------------------- 2 files changed, 103 insertions(+), 90 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/GroupBy.hpp diff --git a/Rx/CPP/src/cpprx/operators/GroupBy.hpp b/Rx/CPP/src/cpprx/operators/GroupBy.hpp new file mode 100644 index 0000000..e9e7923 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/GroupBy.hpp @@ -0,0 +1,102 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_GROUPBY_HPP) +#define CPPRX_RX_OPERATORS_GRUOPBY_HPP + +namespace rxcpp +{ + + template + auto GroupBy( + const std::shared_ptr>& source, + KS keySelector, + VS valueSelector, + L less) + -> std::shared_ptr::type, + typename std::decay::type>>>> + { + typedef typename std::decay::type Key; + typedef typename std::decay::type Value; + + typedef std::shared_ptr> LocalGroupObservable; + + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + typedef std::map>, L> Groups; + + struct State + { + explicit State(L less) : groups(std::move(less)) {} + std::mutex lock; + Groups groups; + }; + auto state = std::make_shared(std::move(less)); + + return Subscribe( + source, + // on next + [=](const T& element) + { + util::maybe key; + try { + key.set(keySelector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + + if (!!key) { + auto keySubject = CreateGroupedSubject(*key.get()); + + typename Groups::iterator groupIt; + bool newGroup = false; + + { + std::unique_lock guard(state->lock); + std::tie(groupIt, newGroup) = state->groups.insert( + std::make_pair(*key.get(), keySubject) + ); + } + + if (newGroup) + { + LocalGroupObservable nextGroup(std::move(keySubject)); + observer->OnNext(nextGroup); + } + + util::maybe result; + try { + result.set(valueSelector(element)); + } catch(...) { + observer->OnError(std::current_exception()); + } + if (!!result) { + groupIt->second->OnNext(std::move(*result.get())); + } + } + }, + // on completed + [=] + { + for(auto& group : state->groups) { + group.second->OnCompleted(); + } + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + for(auto& group : state->groups) { + group.second->OnError(error); + } + observer->OnError(error); + }); + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 5be0cf1..6f3c969 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -960,100 +960,11 @@ namespace rxcpp #include "operators/Zip.hpp" #include "operators/Merge.hpp" #include "operators/Where.hpp" +#include "operators/GroupBy.hpp" namespace rxcpp { - template - auto GroupBy( - const std::shared_ptr>& source, - KS keySelector, - VS valueSelector, - L less) - -> std::shared_ptr::type, - typename std::decay::type>>>> - { - typedef typename std::decay::type Key; - typedef typename std::decay::type Value; - - typedef std::shared_ptr> LocalGroupObservable; - - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - typedef std::map>, L> Groups; - - struct State - { - explicit State(L less) : groups(std::move(less)) {} - std::mutex lock; - Groups groups; - }; - auto state = std::make_shared(std::move(less)); - - return Subscribe( - source, - // on next - [=](const T& element) - { - util::maybe key; - try { - key.set(keySelector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - - if (!!key) { - auto keySubject = CreateGroupedSubject(*key.get()); - - typename Groups::iterator groupIt; - bool newGroup = false; - - { - std::unique_lock guard(state->lock); - std::tie(groupIt, newGroup) = state->groups.insert( - std::make_pair(*key.get(), keySubject) - ); - } - - if (newGroup) - { - LocalGroupObservable nextGroup(std::move(keySubject)); - observer->OnNext(nextGroup); - } - - util::maybe result; - try { - result.set(valueSelector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - groupIt->second->OnNext(std::move(*result.get())); - } - } - }, - // on completed - [=] - { - for(auto& group : state->groups) { - group.second->OnCompleted(); - } - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - for(auto& group : state->groups) { - group.second->OnError(error); - } - observer->OnError(error); - }); - }); - } - - template std::shared_ptr> Multicast(const std::shared_ptr < Observable < T >> &source, const std::shared_ptr& multicastSubject) { -- GitLab From 89118c8ff492f21cd4ef4a623afd12349015d2a9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:10:33 -0800 Subject: [PATCH 100/782] move Multicast to separate header --- Rx/CPP/src/cpprx/operators/Multicast.hpp | 20 ++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 8 +------- 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Multicast.hpp diff --git a/Rx/CPP/src/cpprx/operators/Multicast.hpp b/Rx/CPP/src/cpprx/operators/Multicast.hpp new file mode 100644 index 0000000..e3d9c75 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Multicast.hpp @@ -0,0 +1,20 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_MULTICAST_HPP) +#define CPPRX_RX_OPERATORS_MULTICAST_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Multicast(const std::shared_ptr < Observable < T >> &source, const std::shared_ptr& multicastSubject) + { + return std::static_pointer_cast>( + std::make_shared < ConnectableSubject < std::shared_ptr < Observable < T >> , std::shared_ptr >> (source, multicastSubject)); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 6f3c969..22bf197 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -961,17 +961,11 @@ namespace rxcpp #include "operators/Merge.hpp" #include "operators/Where.hpp" #include "operators/GroupBy.hpp" +#include "operators/Multicast.hpp" namespace rxcpp { - template - std::shared_ptr> Multicast(const std::shared_ptr < Observable < T >> &source, const std::shared_ptr& multicastSubject) - { - return std::static_pointer_cast>( - std::make_shared < ConnectableSubject < std::shared_ptr < Observable < T >> , std::shared_ptr >> (source, multicastSubject)); - } - template std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) { -- GitLab From 1e2b32e33e33f4c9ab6e3b9a4660cacc4d9fa9e6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:16:15 -0800 Subject: [PATCH 101/782] move Publish to separate header --- Rx/CPP/src/cpprx/operators/Publish.hpp | 34 ++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 22 ++--------------- 2 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Publish.hpp diff --git a/Rx/CPP/src/cpprx/operators/Publish.hpp b/Rx/CPP/src/cpprx/operators/Publish.hpp new file mode 100644 index 0000000..fe2fb15 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Publish.hpp @@ -0,0 +1,34 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_PUBLISH_HPP) +#define CPPRX_RX_OPERATORS_PUBLISH_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) + { + auto multicastSubject = std::make_shared>(); + return Multicast(source, multicastSubject); + } + + template + std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source, V value) + { + auto multicastSubject = std::make_shared>(value); + return Multicast(source, multicastSubject); + } + + template + std::shared_ptr> PublishLast(const std::shared_ptr < Observable < T >> &source) + { + auto multicastSubject = std::make_shared>(); + return Multicast(source, multicastSubject); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 22bf197..037a90b 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -953,6 +953,7 @@ namespace rxcpp ////////////////////////////////////////////////////////////////////// // // standard query operators + #include "operators/Select.hpp" #include "operators/SelectMany.hpp" #include "operators/Concat.hpp" @@ -962,30 +963,11 @@ namespace rxcpp #include "operators/Where.hpp" #include "operators/GroupBy.hpp" #include "operators/Multicast.hpp" +#include "operators/Publish.hpp" namespace rxcpp { - template - std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) - { - auto multicastSubject = std::make_shared>(); - return Multicast(source, multicastSubject); - } - - template - std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source, V value) - { - auto multicastSubject = std::make_shared>(value); - return Multicast(source, multicastSubject); - } - - template - std::shared_ptr> PublishLast(const std::shared_ptr < Observable < T >> &source) - { - auto multicastSubject = std::make_shared>(); - return Multicast(source, multicastSubject); - } namespace detail { -- GitLab From a04764b875cc8aae81236c25af589672e02bade0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:18:52 -0800 Subject: [PATCH 102/782] move RefCount to separate header --- Rx/CPP/src/cpprx/operators/RefCount.hpp | 102 ++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 91 +-------------------- 2 files changed, 103 insertions(+), 90 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/RefCount.hpp diff --git a/Rx/CPP/src/cpprx/operators/RefCount.hpp b/Rx/CPP/src/cpprx/operators/RefCount.hpp new file mode 100644 index 0000000..a1997fd --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/RefCount.hpp @@ -0,0 +1,102 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_REFCOUNT_HPP) +#define CPPRX_RX_OPERATORS_REFCOUNT_HPP + +namespace rxcpp +{ + + namespace detail + { + template + class RefCountObservable : public Producer, T> + { + std::shared_ptr> source; + std::mutex lock; + size_t refcount; + util::maybe subscription; + + class _ : public Sink<_, T>, public Observer + { + std::shared_ptr> parent; + + public: + typedef Sink<_, T> SinkBase; + + _(std::shared_ptr> parent, std::shared_ptr> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + Disposable Run() + { + SerialDisposable subscription; + subscription.Set(parent->source->Subscribe(this->shared_from_this())); + + std::unique_lock guard(parent->lock); + if (++parent->refcount == 1) + { + parent->subscription.set(parent->source->Connect()); + } + + auto local = parent; + + return Disposable([subscription, local]() + { + subscription.Dispose(); + std::unique_lock guard(local->lock); + if (--local->refcount == 0) + { + local->subscription->Dispose(); + local->subscription.reset(); + } + }); + } + + virtual void OnNext(const T& t) + { + SinkBase::observer->OnNext(t); + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer, T> ProducerBase; + public: + + RefCountObservable(std::shared_ptr> source) : + ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable&& cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(that, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return sink->Run(); + }), + refcount(0), + source(std::move(source)) + { + subscription.set(Disposable::Empty()); + } + }; + } + template + const std::shared_ptr> RefCount( + const std::shared_ptr>& source + ) + { + return std::make_shared>(source); + } +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 037a90b..219f9bd 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -964,100 +964,11 @@ namespace rxcpp #include "operators/GroupBy.hpp" #include "operators/Multicast.hpp" #include "operators/Publish.hpp" +#include "operators/RefCount.hpp" namespace rxcpp { - - namespace detail - { - template - class RefCountObservable : public Producer, T> - { - std::shared_ptr> source; - std::mutex lock; - size_t refcount; - util::maybe subscription; - - class _ : public Sink<_, T>, public Observer - { - std::shared_ptr> parent; - - public: - typedef Sink<_, T> SinkBase; - - _(std::shared_ptr> parent, std::shared_ptr> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - SerialDisposable subscription; - subscription.Set(parent->source->Subscribe(this->shared_from_this())); - - std::unique_lock guard(parent->lock); - if (++parent->refcount == 1) - { - parent->subscription.set(parent->source->Connect()); - } - - auto local = parent; - - return Disposable([subscription, local]() - { - subscription.Dispose(); - std::unique_lock guard(local->lock); - if (--local->refcount == 0) - { - local->subscription->Dispose(); - local->subscription.reset(); - } - }); - } - - virtual void OnNext(const T& t) - { - SinkBase::observer->OnNext(t); - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer, T> ProducerBase; - public: - - RefCountObservable(std::shared_ptr> source) : - ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable&& cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(that, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - refcount(0), - source(std::move(source)) - { - subscription.set(Disposable::Empty()); - } - }; - } - template - const std::shared_ptr> RefCount( - const std::shared_ptr>& source - ) - { - return std::make_shared>(source); - } - template const std::shared_ptr> ConnectForever( const std::shared_ptr>& source -- GitLab From 2ecc66c860558b5fcb8e0c2ab72218046cc65226 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:28:31 -0800 Subject: [PATCH 103/782] move ConnectForever to separate header --- Rx/CPP/src/cpprx/operators/ConnectForever.hpp | 22 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 10 +-------- 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/ConnectForever.hpp diff --git a/Rx/CPP/src/cpprx/operators/ConnectForever.hpp b/Rx/CPP/src/cpprx/operators/ConnectForever.hpp new file mode 100644 index 0000000..1c873ee --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/ConnectForever.hpp @@ -0,0 +1,22 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_CONNECTFOREVER_HPP) +#define CPPRX_RX_OPERATORS_CONNECTFOREVER_HPP + +namespace rxcpp +{ + + template + const std::shared_ptr> ConnectForever( + const std::shared_ptr>& source + ) + { + source->Connect(); + return observable(source); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 219f9bd..9779d01 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -965,19 +965,11 @@ namespace rxcpp #include "operators/Multicast.hpp" #include "operators/Publish.hpp" #include "operators/RefCount.hpp" +#include "operators/ConnectForever.hpp" namespace rxcpp { - template - const std::shared_ptr> ConnectForever( - const std::shared_ptr>& source - ) - { - source->Connect(); - return observable(source); - } - namespace detail { template -- GitLab From d7af2bda685d491f61a3ca0f9ebb02c613aa446e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 13:49:09 -0800 Subject: [PATCH 104/782] move Scan to separate header --- Rx/CPP/src/cpprx/operators/Scan.hpp | 127 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 116 +------------------------ 2 files changed, 128 insertions(+), 115 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Scan.hpp diff --git a/Rx/CPP/src/cpprx/operators/Scan.hpp b/Rx/CPP/src/cpprx/operators/Scan.hpp new file mode 100644 index 0000000..6247c8e --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Scan.hpp @@ -0,0 +1,127 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SCAN_HPP) +#define CPPRX_RX_OPERATORS_SCAN_HPP + +namespace rxcpp +{ + namespace detail + { + template + class ScanObservable : public Producer, A> + { + typedef ScanObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr> Source; + typedef std::shared_ptr> Destination; + + public: + typedef std::function Accumulator; + typedef std::function(T)> Seeder; + + private: + + Source source; + util::maybe seed; + Accumulator accumulator; + Seeder seeder; + + class _ : public Sink<_, A>, public Observer + { + Parent parent; + util::maybe accumulation; + + public: + typedef Sink<_, A> SinkBase; + + _(Parent parent, Destination observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + virtual void OnNext(const T& t) + { + try + { + if (accumulation) + { + accumulation.set(parent->accumulator(*accumulation.get(), t)); + } + else + { + accumulation.set(!!parent->seed ? parent->accumulator(*parent->seed.get(), t) : *parent->seeder(t).get()); + } + } + catch (...) + { + SinkBase::observer->OnError(std::current_exception()); + SinkBase::Dispose(); + return; + } + SinkBase::observer->OnNext(*accumulation.get()); + } + virtual void OnCompleted() + { + if (!accumulation && !!parent->seed) { + SinkBase::observer->OnNext(*parent->seed.get()); + } + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; + public: + + ScanObservable(Source source, util::maybe seed, Accumulator accumulator, Seeder seeder) : + ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(std::move(source)), + seed(std::move(seed)), + accumulator(std::move(accumulator)), + seeder(std::move(seeder)) + { + } + }; + } + template + std::shared_ptr> Scan( + const std::shared_ptr>& source, + A seed, + typename detail::ScanObservable::Accumulator accumulator + ) + { + return std::make_shared>( + std::move(source), + util::maybe(std::move(seed)), + std::move(accumulator), + [](T) -> util::maybe {abort(); return util::maybe();}); + } + template + std::shared_ptr> Scan( + const std::shared_ptr>& source, + typename detail::ScanObservable::Accumulator accumulator + ) + { + return std::make_shared>( + std::move(source), + util::maybe(), + std::move(accumulator), + [](T t) -> util::maybe {return util::maybe(t);}); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 9779d01..f4f8470 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -966,125 +966,11 @@ namespace rxcpp #include "operators/Publish.hpp" #include "operators/RefCount.hpp" #include "operators/ConnectForever.hpp" +#include "operators/Scan.hpp" namespace rxcpp { - namespace detail - { - template - class ScanObservable : public Producer, A> - { - typedef ScanObservable This; - typedef std::shared_ptr Parent; - typedef std::shared_ptr> Source; - typedef std::shared_ptr> Destination; - - public: - typedef std::function Accumulator; - typedef std::function(T)> Seeder; - - private: - - Source source; - util::maybe seed; - Accumulator accumulator; - Seeder seeder; - - class _ : public Sink<_, A>, public Observer - { - Parent parent; - util::maybe accumulation; - - public: - typedef Sink<_, A> SinkBase; - - _(Parent parent, Destination observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const T& t) - { - try - { - if (accumulation) - { - accumulation.set(parent->accumulator(*accumulation.get(), t)); - } - else - { - accumulation.set(!!parent->seed ? parent->accumulator(*parent->seed.get(), t) : *parent->seeder(t).get()); - } - } - catch (...) - { - SinkBase::observer->OnError(std::current_exception()); - SinkBase::Dispose(); - return; - } - SinkBase::observer->OnNext(*accumulation.get()); - } - virtual void OnCompleted() - { - if (!accumulation && !!parent->seed) { - SinkBase::observer->OnNext(*parent->seed.get()); - } - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; - public: - - ScanObservable(Source source, util::maybe seed, Accumulator accumulator, Seeder seeder) : - ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(std::move(source)), - seed(std::move(seed)), - accumulator(std::move(accumulator)), - seeder(std::move(seeder)) - { - } - }; - } - template - std::shared_ptr> Scan( - const std::shared_ptr>& source, - A seed, - typename detail::ScanObservable::Accumulator accumulator - ) - { - return std::make_shared>( - std::move(source), - util::maybe(std::move(seed)), - std::move(accumulator), - [](T) -> util::maybe {abort(); return util::maybe();}); - } - template - std::shared_ptr> Scan( - const std::shared_ptr>& source, - typename detail::ScanObservable::Accumulator accumulator - ) - { - return std::make_shared>( - std::move(source), - util::maybe(), - std::move(accumulator), - [](T t) -> util::maybe {return util::maybe(t);}); - } - template std::shared_ptr> Take( const std::shared_ptr>& source, -- GitLab From b7b94a2360f064e5d41cd0ef3d78733bc7ad6966 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:02:36 -0800 Subject: [PATCH 105/782] move Take to separate header --- Rx/CPP/src/cpprx/operators/Take.hpp | 147 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 135 +------------------------ 2 files changed, 148 insertions(+), 134 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Take.hpp diff --git a/Rx/CPP/src/cpprx/operators/Take.hpp b/Rx/CPP/src/cpprx/operators/Take.hpp new file mode 100644 index 0000000..8414394 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Take.hpp @@ -0,0 +1,147 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_TAKE_HPP) +#define CPPRX_RX_OPERATORS_TAKE_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Take( + const std::shared_ptr>& source, + Integral n + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + // keep count of remaining calls received OnNext and count of OnNext calls issued. + auto remaining = std::make_shared, std::atomic>>(n, n); + + ComposableDisposable cd; + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + auto local = --std::get<0>(*remaining); + RXCPP_UNWIND_AUTO([&](){ + if (local >= 0){ + // all elements received + if (--std::get<1>(*remaining) == 0) { + // all elements passed on to observer. + observer->OnCompleted(); + cd.Dispose();}}}); + + if (local >= 0) { + observer->OnNext(element); + } + }, + // on completed + [=] + { + if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + template + std::shared_ptr> TakeUntil( + const std::shared_ptr>& source, + const std::shared_ptr>& terminus + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + + struct TerminusState { + enum type { + Live, + Terminated + }; + }; + struct TakeState { + enum type { + Taking, + Completed + }; + }; + struct State { + State() : terminusState(TerminusState::Live), takeState(TakeState::Taking) {} + std::atomic terminusState; + std::atomic takeState; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + cd.Add(Subscribe( + terminus, + // on next + [=](const T& element) + { + state->terminusState = TerminusState::Terminated; + }, + // on completed + [=] + { + state->terminusState = TerminusState::Terminated; + }, + // on error + [=](const std::exception_ptr& error) + { + state->terminusState = TerminusState::Terminated; + })); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (state->terminusState == TerminusState::Live) { + observer->OnNext(element); + } else if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on completed + [=] + { + if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { + state->terminusState = TerminusState::Terminated; + observer->OnCompleted(); + cd.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + state->takeState = TakeState::Completed; + state->terminusState = TerminusState::Terminated; + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index f4f8470..a625f23 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -967,144 +967,11 @@ namespace rxcpp #include "operators/RefCount.hpp" #include "operators/ConnectForever.hpp" #include "operators/Scan.hpp" +#include "operators/Take.hpp" namespace rxcpp { - template - std::shared_ptr> Take( - const std::shared_ptr>& source, - Integral n - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - // keep count of remaining calls received OnNext and count of OnNext calls issued. - auto remaining = std::make_shared, std::atomic>>(n, n); - - ComposableDisposable cd; - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - auto local = --std::get<0>(*remaining); - RXCPP_UNWIND_AUTO([&](){ - if (local >= 0){ - // all elements received - if (--std::get<1>(*remaining) == 0) { - // all elements passed on to observer. - observer->OnCompleted(); - cd.Dispose();}}}); - - if (local >= 0) { - observer->OnNext(element); - } - }, - // on completed - [=] - { - if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - - template - std::shared_ptr> TakeUntil( - const std::shared_ptr>& source, - const std::shared_ptr>& terminus - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - - struct TerminusState { - enum type { - Live, - Terminated - }; - }; - struct TakeState { - enum type { - Taking, - Completed - }; - }; - struct State { - State() : terminusState(TerminusState::Live), takeState(TakeState::Taking) {} - std::atomic terminusState; - std::atomic takeState; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - cd.Add(Subscribe( - terminus, - // on next - [=](const T& element) - { - state->terminusState = TerminusState::Terminated; - }, - // on completed - [=] - { - state->terminusState = TerminusState::Terminated; - }, - // on error - [=](const std::exception_ptr& error) - { - state->terminusState = TerminusState::Terminated; - })); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (state->terminusState == TerminusState::Live) { - observer->OnNext(element); - } else if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on completed - [=] - { - if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { - state->terminusState = TerminusState::Terminated; - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - state->takeState = TakeState::Completed; - state->terminusState = TerminusState::Terminated; - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - template std::shared_ptr> Skip( const std::shared_ptr>& source, -- GitLab From 7e2574c10fef68035d82a3afbeb79031789a62cd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:06:06 -0800 Subject: [PATCH 106/782] move Skip to separate header --- Rx/CPP/src/cpprx/operators/Skip.hpp | 132 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 121 +------------------------ 2 files changed, 133 insertions(+), 120 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Skip.hpp diff --git a/Rx/CPP/src/cpprx/operators/Skip.hpp b/Rx/CPP/src/cpprx/operators/Skip.hpp new file mode 100644 index 0000000..fb27dbb --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Skip.hpp @@ -0,0 +1,132 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SKIP_HPP) +#define CPPRX_RX_OPERATORS_SKIP_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Skip( + const std::shared_ptr>& source, + Integral n + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + enum type { + Skipping, + Forwarding + }; + }; + // keep count of remaining OnNext calls to skip and state. + auto remaining = std::make_shared, std::atomic>>(n, State::Skipping); + + ComposableDisposable cd; + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (std::get<1>(*remaining) == State::Forwarding) { + observer->OnNext(element); + } else { + auto local = --std::get<0>(*remaining); + + if (local == 0) { + std::get<1>(*remaining) = State::Forwarding; + } + } + }, + // on completed + [=] + { + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } + + template + std::shared_ptr> SkipUntil( + const std::shared_ptr>& source, + const std::shared_ptr>& terminus + ) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct SkipState { + enum type { + Skipping, + Taking + }; + }; + struct State { + State() : skipState(SkipState::Skipping) {} + std::atomic skipState; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + cd.Add(Subscribe( + terminus, + // on next + [=](const T& element) + { + state->skipState = SkipState::Taking; + }, + // on completed + [=] + { + state->skipState = SkipState::Taking; + }, + // on error + [=](const std::exception_ptr& error) + { + state->skipState = SkipState::Taking; + })); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + if (state->skipState == SkipState::Taking) { + observer->OnNext(element); + } + }, + // on completed + [=] + { + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index a625f23..07d445b 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -968,130 +968,11 @@ namespace rxcpp #include "operators/ConnectForever.hpp" #include "operators/Scan.hpp" #include "operators/Take.hpp" +#include "operators/Skip.hpp" namespace rxcpp { - template - std::shared_ptr> Skip( - const std::shared_ptr>& source, - Integral n - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - enum type { - Skipping, - Forwarding - }; - }; - // keep count of remaining OnNext calls to skip and state. - auto remaining = std::make_shared, std::atomic>>(n, State::Skipping); - - ComposableDisposable cd; - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (std::get<1>(*remaining) == State::Forwarding) { - observer->OnNext(element); - } else { - auto local = --std::get<0>(*remaining); - - if (local == 0) { - std::get<1>(*remaining) = State::Forwarding; - } - } - }, - // on completed - [=] - { - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - - template - std::shared_ptr> SkipUntil( - const std::shared_ptr>& source, - const std::shared_ptr>& terminus - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct SkipState { - enum type { - Skipping, - Taking - }; - }; - struct State { - State() : skipState(SkipState::Skipping) {} - std::atomic skipState; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - cd.Add(Subscribe( - terminus, - // on next - [=](const T& element) - { - state->skipState = SkipState::Taking; - }, - // on completed - [=] - { - state->skipState = SkipState::Taking; - }, - // on error - [=](const std::exception_ptr& error) - { - state->skipState = SkipState::Taking; - })); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (state->skipState == SkipState::Taking) { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - - template std::shared_ptr> ToStdCollection( const std::shared_ptr>& source -- GitLab From 888bcd5f45ed6c0bad3895d74aedd771a246b7f9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:32:14 -0800 Subject: [PATCH 107/782] move Delay to separate header --- Rx/CPP/src/cpprx/operators/Delay.hpp | 79 ++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 75 +++----------------------- 2 files changed, 85 insertions(+), 69 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Delay.hpp diff --git a/Rx/CPP/src/cpprx/operators/Delay.hpp b/Rx/CPP/src/cpprx/operators/Delay.hpp new file mode 100644 index 0000000..fe55f70 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Delay.hpp @@ -0,0 +1,79 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_DELAY_HPP) +#define CPPRX_RX_OPERATORS_DELAY_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Delay( + const std::shared_ptr>& source, + Scheduler::clock::duration due, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + auto cancel = std::make_shared(false); + + ComposableDisposable cd; + + cd.Add(Disposable([=]{ + *cancel = true; })); + + SerialDisposable sd; + auto wsd = cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + auto sched_disposable = scheduler->Schedule( + due, + [=] (Scheduler::shared) -> Disposable { + if (!*cancel) + observer->OnNext(element); + return Disposable::Empty(); + } + ); + auto ssd = wsd.lock(); + if (ssd) + { + *ssd.get() = std::move(sched_disposable); + } + }, + // on completed + [=] + { + auto sched_disposable = scheduler->Schedule( + due, + [=](Scheduler::shared) -> Disposable { + if (!*cancel) + observer->OnCompleted(); + return Disposable::Empty(); + } + ); + auto ssd = wsd.lock(); + if (ssd) + { + *ssd.get() = std::move(sched_disposable); + } + }, + // on error + [=](const std::exception_ptr& error) + { + if (!*cancel) + observer->OnError(error); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 07d445b..39fe839 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -970,6 +970,12 @@ namespace rxcpp #include "operators/Take.hpp" #include "operators/Skip.hpp" +////////////////////////////////////////////////////////////////////// +// +// time + +#include "operators/Delay.hpp" + namespace rxcpp { @@ -1004,75 +1010,6 @@ namespace rxcpp }); } - ////////////////////////////////////////////////////////////////////// - // - // time - - template - std::shared_ptr> Delay( - const std::shared_ptr>& source, - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - *cancel = true; })); - - SerialDisposable sd; - auto wsd = cd.Add(sd); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - auto sched_disposable = scheduler->Schedule( - due, - [=] (Scheduler::shared) -> Disposable { - if (!*cancel) - observer->OnNext(element); - return Disposable::Empty(); - } - ); - auto ssd = wsd.lock(); - if (ssd) - { - *ssd.get() = std::move(sched_disposable); - } - }, - // on completed - [=] - { - auto sched_disposable = scheduler->Schedule( - due, - [=](Scheduler::shared) -> Disposable { - if (!*cancel) - observer->OnCompleted(); - return Disposable::Empty(); - } - ); - auto ssd = wsd.lock(); - if (ssd) - { - *ssd.get() = std::move(sched_disposable); - } - }, - // on error - [=](const std::exception_ptr& error) - { - if (!*cancel) - observer->OnError(error); - })); - return cd; - }); - } template std::shared_ptr> Throttle( -- GitLab From e08cc09ca1079b31554eeed7400e564080d5e026 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:35:10 -0800 Subject: [PATCH 108/782] move Throttle to separate header --- Rx/CPP/src/cpprx/operators/Throttle.hpp | 97 +++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 86 +--------------------- 2 files changed, 98 insertions(+), 85 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Throttle.hpp diff --git a/Rx/CPP/src/cpprx/operators/Throttle.hpp b/Rx/CPP/src/cpprx/operators/Throttle.hpp new file mode 100644 index 0000000..89abdd1 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Throttle.hpp @@ -0,0 +1,97 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_THROTTLE_HPP) +#define CPPRX_RX_OPERATORS_THROTTLE_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> Throttle( + const std::shared_ptr>& source, + Scheduler::clock::duration due, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + State() : hasValue(false), id(0) {} + std::mutex lock; + T value; + bool hasValue; + size_t id; + }; + auto state = std::make_shared(); + + ComposableDisposable cd; + + SerialDisposable sd; + cd.Add(sd); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + size_t current = 0; + { + std::unique_lock guard(state->lock); + state->hasValue = true; + state->value = std::move(element); + current = ++state->id; + } + sd.Set(scheduler->Schedule( + due, + [=] (Scheduler::shared) -> Disposable { + { + std::unique_lock guard(state->lock); + if (state->hasValue && state->id == current) { + observer->OnNext(std::move(state->value)); + } + state->hasValue = false; + } + + return Disposable::Empty(); + } + )); + }, + // on completed + [=] + { + bool sendValue = false; + T value; + { + std::unique_lock guard(state->lock); + sendValue = state->hasValue; + if (sendValue) { + value = std::move(state->value);} + state->hasValue = false; + ++state->id; + } + if (sendValue) { + observer->OnNext(std::move(value));} + observer->OnCompleted(); + cd.Dispose(); + }, + // on error + [=](const std::exception_ptr& error) + { + { + std::unique_lock guard(state->lock); + state->hasValue = false; + ++state->id; + } + observer->OnError(error); + cd.Dispose(); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 39fe839..df38391 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -975,6 +975,7 @@ namespace rxcpp // time #include "operators/Delay.hpp" +#include "operators/Throttle.hpp" namespace rxcpp { @@ -1011,91 +1012,6 @@ namespace rxcpp } - template - std::shared_ptr> Throttle( - const std::shared_ptr>& source, - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - State() : hasValue(false), id(0) {} - std::mutex lock; - T value; - bool hasValue; - size_t id; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - size_t current = 0; - { - std::unique_lock guard(state->lock); - state->hasValue = true; - state->value = std::move(element); - current = ++state->id; - } - sd.Set(scheduler->Schedule( - due, - [=] (Scheduler::shared) -> Disposable { - { - std::unique_lock guard(state->lock); - if (state->hasValue && state->id == current) { - observer->OnNext(std::move(state->value)); - } - state->hasValue = false; - } - - return Disposable::Empty(); - } - )); - }, - // on completed - [=] - { - bool sendValue = false; - T value; - { - std::unique_lock guard(state->lock); - sendValue = state->hasValue; - if (sendValue) { - value = std::move(state->value);} - state->hasValue = false; - ++state->id; - } - if (sendValue) { - observer->OnNext(std::move(value));} - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - { - std::unique_lock guard(state->lock); - state->hasValue = false; - ++state->id; - } - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - - // no more than one event ever 'milliseconds' // TODO: oops, this is not the right definition for throttle. template -- GitLab From 9c45683050f4ad3342edbfa871f614a5a0bc483b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:52:07 -0800 Subject: [PATCH 109/782] move DistinctUntilChanged to separate header --- .../cpprx/operators/DistinctUntilChanged.hpp | 55 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 41 +------------- 2 files changed, 56 insertions(+), 40 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp diff --git a/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp b/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp new file mode 100644 index 0000000..1796ed9 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp @@ -0,0 +1,55 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_DISTINCTUNTILCHANGED_HPP) +#define CPPRX_RX_OPERATORS_DISTINCTUNTILCHANGED_HPP + +namespace rxcpp +{ + + // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 + template + std::shared_ptr> DistinctUntilChanged( + const std::shared_ptr>& source) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + struct State { + State() : last(), hasValue(false) {} + T last; bool hasValue; + }; + + auto state = std::make_shared(); + state->hasValue = false; + + return Subscribe( + source, + // on next + [=](const T& element) + { + if (!state->hasValue || !(state->last == element)) + { + observer->OnNext(element); + state->last = element; + state->hasValue = true; + } + }, + // on completed + [=] + { + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index df38391..e8bf5a8 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -969,6 +969,7 @@ namespace rxcpp #include "operators/Scan.hpp" #include "operators/Take.hpp" #include "operators/Skip.hpp" +#include "operators/DistinctUntilChanged.hpp" ////////////////////////////////////////////////////////////////////// // @@ -1058,47 +1059,7 @@ namespace rxcpp }); } - // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 - template - std::shared_ptr> DistinctUntilChanged( - const std::shared_ptr>& source) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - State() : last(), hasValue(false) {} - T last; bool hasValue; - }; - - auto state = std::make_shared(); - state->hasValue = false; - return Subscribe( - source, - // on next - [=](const T& element) - { - if (!state->hasValue || !(state->last == element)) - { - observer->OnNext(element); - state->last = element; - state->hasValue = true; - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } template std::shared_ptr> SubscribeOnObservable( -- GitLab From 1403831e2a62f6bf6cb67644951dbcddf3fd7739 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:52:50 -0800 Subject: [PATCH 110/782] move ToStdCollection to separate header --- .../src/cpprx/operators/ToStdCollection.hpp | 44 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 33 +------------- 2 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/ToStdCollection.hpp diff --git a/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp b/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp new file mode 100644 index 0000000..25813b1 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp @@ -0,0 +1,44 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_TOSTDCOLLECTION_HPP) +#define CPPRX_RX_OPERATORS_TOSTDCOLLECTION_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> ToStdCollection( + const std::shared_ptr>& source + ) + { + typedef typename StdCollection::value_type Value; + return CreateObservable( + [=](std::shared_ptr> observer) -> Disposable + { + auto stdCollection = std::make_shared(); + return Subscribe( + source, + // on next + [=](const Value& element) + { + stdCollection->insert(stdCollection->end(), element); + }, + // on completed + [=] + { + observer->OnNext(std::move(*stdCollection.get())); + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(error); + }); + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index e8bf5a8..db441f0 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -970,6 +970,7 @@ namespace rxcpp #include "operators/Take.hpp" #include "operators/Skip.hpp" #include "operators/DistinctUntilChanged.hpp" +#include "operators/ToStdCollection.hpp" ////////////////////////////////////////////////////////////////////// // @@ -981,38 +982,6 @@ namespace rxcpp namespace rxcpp { - template - std::shared_ptr> ToStdCollection( - const std::shared_ptr>& source - ) - { - typedef typename StdCollection::value_type Value; - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - auto stdCollection = std::make_shared(); - return Subscribe( - source, - // on next - [=](const Value& element) - { - stdCollection->insert(stdCollection->end(), element); - }, - // on completed - [=] - { - observer->OnNext(std::move(*stdCollection.get())); - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - // no more than one event ever 'milliseconds' // TODO: oops, this is not the right definition for throttle. template -- GitLab From 79c1d5f07d831081a361cc72f8ddf98564754dd5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 14:57:48 -0800 Subject: [PATCH 111/782] move SubscribeOnObservable to separate header --- .../cpprx/operators/SubscribeOnObservable.hpp | 35 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 30 +++++----------- 2 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp diff --git a/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp b/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp new file mode 100644 index 0000000..29a4c6b --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp @@ -0,0 +1,35 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SUBSCRIBEONOBSERVABLE_HPP) +#define CPPRX_RX_OPERATORS_SUBSCRIBEONOBSERVABLE_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> SubscribeOnObservable( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observer) + -> Disposable + { + ComposableDisposable cd; + + SerialDisposable sd; + cd.Add(sd); + + cd.Add(scheduler->Schedule([=](Scheduler::shared) -> Disposable { + sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); + return Disposable::Empty(); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index db441f0..ea4e58b 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -972,6 +972,14 @@ namespace rxcpp #include "operators/DistinctUntilChanged.hpp" #include "operators/ToStdCollection.hpp" + +////////////////////////////////////////////////////////////////////// +// +// shift to Scheduler + +#include "operators/SubscribeOnObservable.hpp" + + ////////////////////////////////////////////////////////////////////// // // time @@ -1030,28 +1038,6 @@ namespace rxcpp - template - std::shared_ptr> SubscribeOnObservable( - const std::shared_ptr>& source, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(scheduler->Schedule([=](Scheduler::shared) -> Disposable { - sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); - return Disposable::Empty(); - })); - return cd; - }); - } - template std::shared_ptr> ObserveOnObserver( const std::shared_ptr>& source, -- GitLab From 5a188416562193585c633c93d033b20213e43c7f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 15:02:16 -0800 Subject: [PATCH 112/782] move ObserveOnObserver to separate header --- .../src/cpprx/operators/ObserveOnObserver.hpp | 53 +++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 42 +-------------- 2 files changed, 54 insertions(+), 41 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp diff --git a/Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp b/Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp new file mode 100644 index 0000000..4ff79f7 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp @@ -0,0 +1,53 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_OBSERVEONOBSERVER_HPP) +#define CPPRX_RX_OPERATORS_OBSERVEONOBSERVER_HPP + +namespace rxcpp +{ + + template + std::shared_ptr> ObserveOnObserver( + const std::shared_ptr>& source, + Scheduler::shared scheduler) + { + return CreateObservable( + [=](std::shared_ptr> observerArg) + -> Disposable + { + std::shared_ptr> observer( + new ScheduledObserver(scheduler, std::move(observerArg))); + + ComposableDisposable cd; + + cd.Add(*observer.get()); + + cd.Add(Subscribe( + source, + // on next + [=](const T& element) + { + observer->OnNext(std::move(element)); + observer->EnsureActive(); + }, + // on completed + [=] + { + observer->OnCompleted(); + observer->EnsureActive(); + }, + // on error + [=](const std::exception_ptr& error) + { + observer->OnError(std::move(error)); + observer->EnsureActive(); + })); + return cd; + }); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index ea4e58b..fb64e2a 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -978,6 +978,7 @@ namespace rxcpp // shift to Scheduler #include "operators/SubscribeOnObservable.hpp" +#include "operators/ObserveOnObserver.hpp" ////////////////////////////////////////////////////////////////////// @@ -1037,47 +1038,6 @@ namespace rxcpp } - - template - std::shared_ptr> ObserveOnObserver( - const std::shared_ptr>& source, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observerArg) - -> Disposable - { - std::shared_ptr> observer( - new ScheduledObserver(scheduler, std::move(observerArg))); - - ComposableDisposable cd; - - cd.Add(*observer.get()); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - observer->OnNext(std::move(element)); - observer->EnsureActive(); - }, - // on completed - [=] - { - observer->OnCompleted(); - observer->EnsureActive(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(std::move(error)); - observer->EnsureActive(); - })); - return cd; - }); - } - class StdQueueDispatcher { mutable std::queue> pending; -- GitLab From 973667169ada8d7ea5c5c56100493d48ba0eddba Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 15:06:39 -0800 Subject: [PATCH 113/782] move ToAsync to separate header --- Rx/CPP/src/cpprx/operators/ToAsync.hpp | 48 ++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 36 +------------------ 2 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/ToAsync.hpp diff --git a/Rx/CPP/src/cpprx/operators/ToAsync.hpp b/Rx/CPP/src/cpprx/operators/ToAsync.hpp new file mode 100644 index 0000000..33bffcb --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/ToAsync.hpp @@ -0,0 +1,48 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_TOASYNC_HPP) +#define CPPRX_RX_OPERATORS_TOASYNC_HPP + +namespace rxcpp +{ + +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto ToAsync(F f, Scheduler::shared scheduler = nullptr) + ->std::function < std::shared_ptr < Observable< decltype(f((*(A*)nullptr)...)) >> (const A&...)> + { + typedef decltype(f((*(A*) nullptr)...)) R; + if (!scheduler) + { + scheduler = std::make_shared(); + } + return [=](const A&... a) -> std::shared_ptr < Observable> + { + auto args = std::make_tuple(a...); + auto result = CreateAsyncSubject(); + scheduler->Schedule([=](Scheduler::shared) -> Disposable + { + util::maybe value; + try + { + value.set(util::tuple_dispatch(f, args)); + } + catch (...) + { + result->OnError(std::current_exception()); + return Disposable::Empty(); + } + result->OnNext(*value.get()); + result->OnCompleted(); + return Disposable::Empty(); + }); + return result; + }; + } +#endif +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index fb64e2a..1e90a0c 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -789,41 +789,6 @@ namespace rxcpp return std::make_shared>(); } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto ToAsync(F f, Scheduler::shared scheduler = nullptr) - ->std::function < std::shared_ptr < Observable< decltype(f((*(A*)nullptr)...)) >> (const A&...)> - { - typedef decltype(f((*(A*) nullptr)...)) R; - if (!scheduler) - { - scheduler = std::make_shared(); - } - return [=](const A&... a) -> std::shared_ptr < Observable> - { - auto args = std::make_tuple(a...); - auto result = CreateAsyncSubject(); - scheduler->Schedule([=](Scheduler::shared) -> Disposable - { - util::maybe value; - try - { - value.set(util::tuple_dispatch(f, args)); - } - catch (...) - { - result->OnError(std::current_exception()); - return Disposable::Empty(); - } - result->OnNext(*value.get()); - result->OnCompleted(); - return Disposable::Empty(); - }); - return result; - }; - } -#endif - template class ConnectableSubject : public std::enable_shared_from_this>, @@ -971,6 +936,7 @@ namespace rxcpp #include "operators/Skip.hpp" #include "operators/DistinctUntilChanged.hpp" #include "operators/ToStdCollection.hpp" +#include "operators/ToAsync.hpp" ////////////////////////////////////////////////////////////////////// -- GitLab From 4c44dfa9445278f2cd791eea575708b401bc03a4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 15:10:06 -0800 Subject: [PATCH 114/782] move ForEach to separate header --- Rx/CPP/src/cpprx/operators/ForEach.hpp | 49 ++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 44 +++-------------------- 2 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/ForEach.hpp diff --git a/Rx/CPP/src/cpprx/operators/ForEach.hpp b/Rx/CPP/src/cpprx/operators/ForEach.hpp new file mode 100644 index 0000000..e2c815e --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/ForEach.hpp @@ -0,0 +1,49 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_FOREACH_HPP) +#define CPPRX_RX_OPERATORS_FOREACH_HPP + +namespace rxcpp +{ + + template + void ForEach( + const std::shared_ptr>& source, + typename util::identity>::type onNext + ) + { + std::mutex lock; + std::condition_variable wake; + bool done = false; + std::exception_ptr error; + auto observer = CreateObserver(std::move(onNext), + //on completed + [&]{ + std::unique_lock guard(lock); + done = true; + wake.notify_one(); + }, + //on error + [&](const std::exception_ptr& e){ + std::unique_lock guard(lock); + done = true; + error = std::move(e); + wake.notify_one(); + }); + + source->Subscribe(observer); + + { + std::unique_lock guard(lock); + wake.wait(guard, [&]{return done;}); + } + + if (error != std::exception_ptr()) { + std::rethrow_exception(error);} + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 1e90a0c..1e04ded 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -851,9 +851,6 @@ namespace rxcpp return fix0_thunk(std::move(f)); } - ////////////////////////////////////////////////////////////////////// - // - // imperative functions template Disposable Subscribe( @@ -868,44 +865,12 @@ namespace rxcpp return source->Subscribe(observer); } - - template - void ForEach( - const std::shared_ptr>& source, - typename util::identity>::type onNext - ) - { - std::mutex lock; - std::condition_variable wake; - bool done = false; - std::exception_ptr error; - auto observer = CreateObserver(std::move(onNext), - //on completed - [&]{ - std::unique_lock guard(lock); - done = true; - wake.notify_one(); - }, - //on error - [&](const std::exception_ptr& e){ - std::unique_lock guard(lock); - done = true; - error = std::move(e); - wake.notify_one(); - }); - - source->Subscribe(observer); - - { - std::unique_lock guard(lock); - wake.wait(guard, [&]{return done;}); - } - - if (error != std::exception_ptr()) { - std::rethrow_exception(error);} - } } +////////////////////////////////////////////////////////////////////// +// +// imperative functions + #include "operators/Empty.hpp" #include "operators/Return.hpp" #include "operators/Throw.hpp" @@ -919,6 +884,7 @@ namespace rxcpp // // standard query operators +#include "operators/ForEach.hpp" #include "operators/Select.hpp" #include "operators/SelectMany.hpp" #include "operators/Concat.hpp" -- GitLab From fa6d9c00f13e177028b71027438a656713526b5a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 24 Nov 2013 15:12:41 -0800 Subject: [PATCH 115/782] move Subscribe to separate header --- Rx/CPP/src/cpprx/operators/Subscribe.hpp | 27 ++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 18 ++-------------- 2 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Subscribe.hpp diff --git a/Rx/CPP/src/cpprx/operators/Subscribe.hpp b/Rx/CPP/src/cpprx/operators/Subscribe.hpp new file mode 100644 index 0000000..5717720 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Subscribe.hpp @@ -0,0 +1,27 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_SUBSCRIBE_HPP) +#define CPPRX_RX_OPERATORS_SUBSCRIBE_HPP + +namespace rxcpp +{ + + template + Disposable Subscribe( + const S& source, + typename util::identity::type&)>>::type onNext, + std::function onCompleted = nullptr, + std::function onError = nullptr + ) + { + auto observer = CreateObserver::type>( + std::move(onNext), std::move(onCompleted), std::move(onError)); + + return source->Subscribe(observer); + } +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 1e04ded..a8e5cad 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -850,27 +850,14 @@ namespace rxcpp { return fix0_thunk(std::move(f)); } - - - template - Disposable Subscribe( - const S& source, - typename util::identity::type&)>>::type onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) - { - auto observer = CreateObserver::type>( - std::move(onNext), std::move(onCompleted), std::move(onError)); - - return source->Subscribe(observer); - } } ////////////////////////////////////////////////////////////////////// // // imperative functions +#include "operators/Subscribe.hpp" +#include "operators/ForEach.hpp" #include "operators/Empty.hpp" #include "operators/Return.hpp" #include "operators/Throw.hpp" @@ -884,7 +871,6 @@ namespace rxcpp // // standard query operators -#include "operators/ForEach.hpp" #include "operators/Select.hpp" #include "operators/SelectMany.hpp" #include "operators/Concat.hpp" -- GitLab From 8bcc30f0e61ff2ea2c2f05c455fa4ae5802b7614 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 30 Nov 2013 20:53:34 -0800 Subject: [PATCH 116/782] Add Materialize and Dematerialize --- Rx/CPP/src/cpprx/operators/Dematerialize.hpp | 93 ++++++++++++++++++++ Rx/CPP/src/cpprx/operators/Materialize.hpp | 87 ++++++++++++++++++ Rx/CPP/src/cpprx/rx-base.hpp | 84 ++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 2 + Rx/CPP/src/cpprx/rx.hpp | 45 +++++++++- Rx/CPP/testbench/testbench.cpp | 2 + 6 files changed, 311 insertions(+), 2 deletions(-) create mode 100644 Rx/CPP/src/cpprx/operators/Dematerialize.hpp create mode 100644 Rx/CPP/src/cpprx/operators/Materialize.hpp diff --git a/Rx/CPP/src/cpprx/operators/Dematerialize.hpp b/Rx/CPP/src/cpprx/operators/Dematerialize.hpp new file mode 100644 index 0000000..796a133 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Dematerialize.hpp @@ -0,0 +1,93 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_DEMATERIALIZE_HPP) +#define CPPRX_RX_OPERATORS_DEMATERIALIZE_HPP + +namespace rxcpp +{ + +namespace detail +{ + +template +class DematerializeObservable : public Producer, T> +{ + typedef DematerializeObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr>>> Source; + typedef std::shared_ptr> Destination; + +private: + + Source source; + + class _ : public Sink<_, T>, public Observer>> + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, Destination observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + virtual void OnNext(const std::shared_ptr>& n) + { + n->Accept([this](const T& t){ + this->SinkBase::observer->OnNext(t); + }, [this](){ + this->SinkBase::observer->OnCompleted(); + this->SinkBase::Dispose(); + }, [this](const std::exception_ptr& e){ + this->SinkBase::observer->OnError(e); + this->SinkBase::Dispose(); + }); + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; +public: + + DematerializeObservable(Source source) : + ProducerBase([this](Parent parent, Destination observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(std::move(source)) + { + } +}; + +} + +template +std::shared_ptr> Dematerialize( + const std::shared_ptr>>>& source +) +{ + return std::make_shared>( + std::move(source) + ); +} + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Materialize.hpp b/Rx/CPP/src/cpprx/operators/Materialize.hpp new file mode 100644 index 0000000..ede4d6e --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Materialize.hpp @@ -0,0 +1,87 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_MATERIALIZE_HPP) +#define CPPRX_RX_OPERATORS_MATERIALIZE_HPP + +namespace rxcpp +{ + +namespace detail +{ + +template +class MaterializeObservable : public Producer, std::shared_ptr>> +{ + typedef MaterializeObservable This; + typedef std::shared_ptr Parent; + typedef std::shared_ptr> Source; + typedef std::shared_ptr>>> Destination; + +private: + + Source source; + + class _ : public Sink<_, std::shared_ptr>>, public Observer + { + Parent parent; + + public: + typedef Sink<_, std::shared_ptr>> SinkBase; + + _(Parent parent, Destination observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + virtual void OnNext(const T& t) + { + SinkBase::observer->OnNext(Notification::CreateOnNext(t)); + } + virtual void OnCompleted() + { + SinkBase::observer->OnNext(Notification::CreateOnCompleted()); + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnNext(Notification::CreateOnError(e)); + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + }; + + typedef Producer>> ProducerBase; +public: + + MaterializeObservable(Source source) : + ProducerBase([this](Parent parent, Destination observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(std::move(source)) + { + } +}; + +} + +template +std::shared_ptr>>> Materialize( + const std::shared_ptr>& source +) +{ + return std::make_shared>( + std::move(source) + ); +} + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 1ad3966..8dec099 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -356,6 +356,90 @@ namespace rxcpp } }; + template + struct Notification { + typedef std::function OnNext; + typedef std::function OnCompleted; + typedef std::function OnError; + + virtual ~Notification() {} + + virtual void Accept(std::shared_ptr>) =0; + virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) =0; + + private: + struct OnNextNotification : public Notification { + OnNextNotification(T value) : value(std::move(value)) { + } + virtual void Accept(std::shared_ptr> o) { + if (!o) { + abort(); + } + o->OnNext(value); + } + virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { + if (!onnext || !oncompleted || !onerror) { + abort(); + } + onnext(value); + } + const T value; + }; + + struct OnCompletedNotification : public Notification { + OnCompletedNotification() { + } + virtual void Accept(std::shared_ptr> o) { + if (!o) { + abort(); + } + o->OnCompleted(); + } + virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { + if (!onnext || !oncompleted || !onerror) { + abort(); + } + oncompleted(); + } + }; + + struct OnErrorNotification : public Notification { + OnErrorNotification(std::exception_ptr ep) : ep(ep) { + } + virtual void Accept(std::shared_ptr> o) { + if (!o) { + abort(); + } + o->OnError(ep); + } + virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { + if (!onnext || !oncompleted || !onerror) { + abort(); + } + onerror(ep); + } + const std::exception_ptr ep; + }; + + public: + static + std::shared_ptr CreateOnNext(T value) { + return std::make_shared(std::move(value)); + } + static + std::shared_ptr CreateOnCompleted() { + return std::make_shared(); + } + template + static + std::shared_ptr CreateOnError(Exception&& e) { + std::exception_ptr ep; + try {throw std::forward(e);} + catch (...) {ep = std::current_exception();} + return std::make_shared(ep); + } + }; + template class TupleDispatch { Target target; diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index a8e5cad..fabb763 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -889,6 +889,8 @@ namespace rxcpp #include "operators/DistinctUntilChanged.hpp" #include "operators/ToStdCollection.hpp" #include "operators/ToAsync.hpp" +#include "operators/Materialize.hpp" +#include "operators/Dematerialize.hpp" ////////////////////////////////////////////////////////////////////// diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index 3835a3c..ade931f 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -123,10 +123,43 @@ namespace detail { } }; + template + class BinderMaterialized : public Base + { + protected: + typedef typename Base::item_type item_type; + using Base::obj; + public: + BinderMaterialized(Obj obj) : Base(std::move(obj)) + { + } + }; + + template + class BinderMaterialized>>>> : public Base + { + protected: + typedef typename Base::item_type item_type; + using Base::obj; + public: + BinderMaterialized(std::shared_ptr>>> obj) : Base(std::move(obj)) + { + } + + auto dematerialize() + -> decltype(from(Dematerialize(observable(obj)))) { + return from(Dematerialize(observable(obj))); + } + }; + template class Binder : public BinderNested< BinderConnectable< - BinderBase::type, Obj>, + BinderMaterialized< + BinderBase::type, Obj>, + typename observable_item::type, + Obj + >, typename observable_item::type, Obj >, @@ -136,7 +169,11 @@ namespace detail { { typedef BinderNested< BinderConnectable< - BinderBase::type, Obj>, + BinderMaterialized< + BinderBase::type, Obj>, + typename observable_item::type, + Obj + >, typename observable_item::type, Obj >, @@ -343,6 +380,10 @@ namespace detail { -> decltype(from(ToStdCollection>(obj))) { return from(ToStdCollection>(obj)); } + auto materialize() + -> decltype(from(Materialize(observable(obj)))) { + return from(Materialize(observable(obj))); + } auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { return from(Delay(obj, due, scheduler)); } diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 6aaee53..2e41f4d 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -51,6 +51,8 @@ void PrintPrimes(int n) auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers rxcpp::from(values) .where(IsPrime) + .materialize() + .dematerialize() .select([](int x) { return std::make_pair(x, x*x); }) .take(n) .for_each(rxcpp::MakeTupleDispatch( -- GitLab From 596c281ab686237837540d456c387b970e7cf7a7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 30 Nov 2013 22:30:25 -0800 Subject: [PATCH 117/782] Add VirtualTimeSchedulerBase --- Rx/CPP/src/cpprx/rx-base.hpp | 169 ++++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-scheduler.hpp | 9 +- 2 files changed, 170 insertions(+), 8 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 8dec099..945e8de 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -356,6 +356,175 @@ namespace rxcpp } }; + template + struct ScheduledItem { + ScheduledItem(Absolute due, std::shared_ptr work) + : due(due) + , work(std::move(work)) + {} + Absolute due; + std::shared_ptr work; + }; + + template + struct VirtualTimeSchedulerBase : public Scheduler + { + private: + VirtualTimeSchedulerBase(const VirtualTimeSchedulerBase&); + + bool is_enabled; + + public: + static void Do(Work& work, Scheduler::shared scheduler) throw() + { + if (work) + { + work(std::move(scheduler)); + } + } + + public: + VirtualTimeSchedulerBase() + : is_enabled(false) + { + } + explicit VirtualTimeSchedulerBase(Absolute initialClock) + : is_enabled(false) + , clock_now(initialClock) + { + } + virtual ~VirtualTimeSchedulerBase() + { + } + + protected: + Absolute clock_now; + + virtual Absolute Add(Absolute, Relative) =0; + + virtual clock::time_point ToTimePoint(Absolute) =0; + virtual Relative ToRelative(clock::duration) =0; + + virtual ScheduledItem GetNext() =0; + + public: + virtual Disposable ScheduleAbsolute(Absolute, Work) =0; + + virtual Disposable ScheduleRelative(Relative dueTime, Work work) { + auto at = Add(clock_now, dueTime); + return ScheduleAbsolute(at, std::move(work)); + } + + virtual clock::time_point Now() {return ToAbsolute(clock_now);} + + bool IsEnabled() {return is_enabled;} + Absolute Clock() {return clock_now;} + + using Scheduler::Schedule; + virtual Disposable Schedule(Work work) + { + return ScheduleAbsolute(clock_now, std::move(work)); + } + + virtual Disposable Schedule(clock::duration due, Work work) + { + return ScheduleRelative(ToRelative(due), std::move(work)); + } + + virtual Disposable Schedule(clock::time_point due, Work work) + { + return ScheduleRelative(ToRelative(due - Now()), std::move(work)); + } + + void Start() + { + if (!is_enabled) { + is_enabled = true; + do { + auto next = GetNext(); + if (!!next.work) { + if (next.due > clock_now) { + clock_now = next.due; + } + Do(next.work, this); + } + else { + is_enabled = false; + } + } while (is_enabled); + } + } + + void Stop() + { + is_enabled = false; + } + + void AdvanceTo(Absolute time) + { + if (time < clock_now) { + abort(); + } + + if (time == clock_now) { + return; + } + + if (!is_enabled) { + is_enabled = true; + do { + auto next = GetNext(); + if (!!next.work && next.due <= time) { + if (next.due > clock_now) { + clock_now = next.due; + } + Do(next.work, this); + } + else { + is_enabled = false; + } + } while (is_enabled); + + clock_now = time; + } + else { + abort(); + } + } + + void AdvanceBy(Relative time) + { + auto dt = Add(clock_now, time); + + if (dt < clock_now) { + abort(); + } + + if (dt == clock_now) { + return; + } + + if (!is_enabled) { + AdvanceTo(dt); + } + else { + abort(); + } + } + + void Sleep(Relative time) + { + auto dt = Add(clock_now, time); + + if (dt < clock_now) { + abort(); + } + + clock_now = dt; + } + + }; + template struct Notification { typedef std::function OnNext; diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index ca72835..293eb5c 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -17,14 +17,7 @@ namespace rxcpp { typedef Scheduler::clock clock; typedef Scheduler::Work Work; - struct QueueItem { - QueueItem(clock::time_point due, std::shared_ptr work) - : due(due) - , work(std::move(work)) - {} - clock::time_point due; - std::shared_ptr work; - }; + typedef ScheduledItem QueueItem; private: ~CurrentThreadQueue(); -- GitLab From 2d8e3541c73b89f74b552422bd477fb330227621 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Dec 2013 12:19:27 -0800 Subject: [PATCH 118/782] Add VirtualTimeScheduler --- Rx/CPP/src/cpprx/rx-base.hpp | 79 ++++++++++++++++++------------- Rx/CPP/src/cpprx/rx-scheduler.hpp | 78 ++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 34 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 945e8de..263dc91 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -318,18 +318,37 @@ namespace rxcpp } }; + template + class ScheduledItem { + public: + ScheduledItem(Absolute due, std::shared_ptr work) + : due(due) + , work(std::move(work)) + {} + + static Disposable Do(Scheduler::Work& work, Scheduler::shared scheduler) throw() + { + if (work) + { + return work(std::move(scheduler)); + } + return Disposable::Empty(); + } + + Absolute due; + std::shared_ptr work; + }; + struct LocalScheduler : public Scheduler { private: LocalScheduler(const LocalScheduler&); public: - static void Do(Work& work, Scheduler::shared scheduler) throw() + typedef ScheduledItem QueueItem; + static Disposable Do(Work& work, const Scheduler::shared& scheduler) throw() { - if (work) - { - work(std::move(scheduler)); - } + return QueueItem::Do(work, scheduler); } public: @@ -356,16 +375,6 @@ namespace rxcpp } }; - template - struct ScheduledItem { - ScheduledItem(Absolute due, std::shared_ptr work) - : due(due) - , work(std::move(work)) - {} - Absolute due; - std::shared_ptr work; - }; - template struct VirtualTimeSchedulerBase : public Scheduler { @@ -375,15 +384,11 @@ namespace rxcpp bool is_enabled; public: - static void Do(Work& work, Scheduler::shared scheduler) throw() + virtual ~VirtualTimeSchedulerBase() { - if (work) - { - work(std::move(scheduler)); - } } - public: + protected: VirtualTimeSchedulerBase() : is_enabled(false) { @@ -393,11 +398,11 @@ namespace rxcpp , clock_now(initialClock) { } - virtual ~VirtualTimeSchedulerBase() - { - } - protected: + typedef Scheduler::clock clock; + typedef Scheduler::Work Work; + typedef ScheduledItem QueueItem; + Absolute clock_now; virtual Absolute Add(Absolute, Relative) =0; @@ -405,9 +410,14 @@ namespace rxcpp virtual clock::time_point ToTimePoint(Absolute) =0; virtual Relative ToRelative(clock::duration) =0; - virtual ScheduledItem GetNext() =0; + virtual QueueItem GetNext() =0; public: + static Disposable Do(Work& work, const Scheduler::shared& scheduler) throw() + { + return QueueItem::Do(work, scheduler); + } + virtual Disposable ScheduleAbsolute(Absolute, Work) =0; virtual Disposable ScheduleRelative(Relative dueTime, Work work) { @@ -442,11 +452,11 @@ namespace rxcpp is_enabled = true; do { auto next = GetNext(); - if (!!next.work) { - if (next.due > clock_now) { - clock_now = next.due; + if (!!next && !!next->work && !!*next->work) { + if (next->due > clock_now) { + clock_now = next->due; } - Do(next.work, this); + Do(*next->work, shared_from_this()); } else { is_enabled = false; @@ -474,11 +484,11 @@ namespace rxcpp is_enabled = true; do { auto next = GetNext(); - if (!!next.work && next.due <= time) { - if (next.due > clock_now) { - clock_now = next.due; + if (!!next && !!next->work && !!*next->work && next->due <= time) { + if (next->due > clock_now) { + clock_now = next->due; } - Do(next.work, this); + Do(*next->work, shared_from_this()); } else { is_enabled = false; @@ -525,6 +535,7 @@ namespace rxcpp }; + template struct Notification { typedef std::function OnNext; diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 293eb5c..81e6d06 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -574,6 +574,84 @@ namespace rxcpp return scheduler->Schedule(dueTime, work); } }; + + template + class VirtualTimeScheduler : public VirtualTimeSchedulerBase + { + private: + VirtualTimeScheduler(const VirtualTimeScheduler&); + + typedef VirtualTimeSchedulerBase Base; + + typedef typename Base::clock clock; + typedef typename Base::Work Work; + typedef typename Base::QueueItem QueueItem; + + struct compare_work + { + bool operator()(const QueueItem& work1, const QueueItem& work2) const { + return work1.due > work2.due; + } + }; + + typedef std::priority_queue< + QueueItem, + std::vector, + compare_work + > ScheduledWork; + + ScheduledWork queue; + + public: + + virtual ~VirtualTimeScheduler() + { + } + + protected: + VirtualTimeScheduler() + { + } + explicit VirtualTimeScheduler(Absolute initialClock) + : Base(initialClock) + { + } + + virtual util::maybe GetNext() { + util::maybe next; + while (!queue.empty()) { + next.set(queue.top()); + if (!next->work || !*next->work) { + queue.pop(); + } + else { + return next; + } + } + return next; + } + + Disposable ScheduleAbsolute(Absolute dueTime, Work work) + { + auto cancelable = std::make_shared(std::move(work)); + + auto run = [cancelable](Scheduler::shared scheduler) -> Disposable { + auto work = *cancelable.get(); + *cancelable.get() = nullptr; + return Do(work, std::move(scheduler)); + }; + + auto si = QueueItem(dueTime, std::make_shared(std::move(run))); + queue.push(si); + + auto result = Disposable([cancelable]{ + *cancelable.get() = nullptr; + }); + return result; + } + + }; + } #endif -- GitLab From e93240d4f1cb01c77ddfc66de919971e8b9bc23b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Dec 2013 03:42:09 -0800 Subject: [PATCH 119/782] Add TestScheduler --- Rx/CPP/src/cpprx/rx-base.hpp | 83 ++++++++- Rx/CPP/src/cpprx/rx-scheduler.hpp | 297 +++++++++++++++++++++++++++++- 2 files changed, 370 insertions(+), 10 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 263dc91..530935a 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -410,7 +410,7 @@ namespace rxcpp virtual clock::time_point ToTimePoint(Absolute) =0; virtual Relative ToRelative(clock::duration) =0; - virtual QueueItem GetNext() =0; + virtual util::maybe GetNext() =0; public: static Disposable Do(Work& work, const Scheduler::shared& scheduler) throw() @@ -425,7 +425,7 @@ namespace rxcpp return ScheduleAbsolute(at, std::move(work)); } - virtual clock::time_point Now() {return ToAbsolute(clock_now);} + virtual clock::time_point Now() {return ToTimePoint(clock_now);} bool IsEnabled() {return is_enabled;} Absolute Clock() {return clock_now;} @@ -535,15 +535,51 @@ namespace rxcpp }; + template + class Recorded + { + long time; + T value; + public: + Recorded(long time, T value) : time(time), value(value) { + } + long Time() {return time;} + T Value() {return value;} + }; + + template + bool operator == (Recorded lhs, Recorded rhs) { + return lhs.Time() == rhs.Time() && lhs.Value() == rhs.Value(); + } + + class Subscription + { + long subscribe; + long unsubscribe; + + public: + explicit Subscription(long subscribe) : subscribe(subscribe), unsubscribe(std::numeric_limits::max()) { + } + Subscription(long subscribe, long unsubscribe) : subscribe(subscribe), unsubscribe(unsubscribe) { + } + long Subscribe() {return subscribe;} + long Unsubscribe() {return unsubscribe;} + }; + + bool operator == (Subscription lhs, Subscription rhs) { + return lhs.Subscribe() == rhs.Subscribe() && lhs.Unsubscribe() == rhs.Unsubscribe(); + } template - struct Notification { + struct Notification + { typedef std::function OnNext; typedef std::function OnCompleted; typedef std::function OnError; virtual ~Notification() {} + virtual bool Equals(std::shared_ptr> other) = 0; virtual void Accept(std::shared_ptr>) =0; virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) =0; @@ -551,6 +587,11 @@ namespace rxcpp struct OnNextNotification : public Notification { OnNextNotification(T value) : value(std::move(value)) { } + virtual bool Equals(std::shared_ptr> other) { + bool result = false; + other->Accept([this, &result](T value) { result = this->value == value;}, [](){}, [](std::exception_ptr){}); + return result; + } virtual void Accept(std::shared_ptr> o) { if (!o) { abort(); @@ -569,6 +610,11 @@ namespace rxcpp struct OnCompletedNotification : public Notification { OnCompletedNotification() { } + virtual bool Equals(std::shared_ptr> other) { + bool result = false; + other->Accept([](T) {}, [&result](){result = true;}, [](std::exception_ptr){}); + return result; + } virtual void Accept(std::shared_ptr> o) { if (!o) { abort(); @@ -586,6 +632,12 @@ namespace rxcpp struct OnErrorNotification : public Notification { OnErrorNotification(std::exception_ptr ep) : ep(ep) { } + virtual bool Equals(std::shared_ptr> other) { + bool result = false; + // not trying to compare exceptions + other->Accept([](T) {}, [](){}, [&result](std::exception_ptr){result = true;}); + return result; + } virtual void Accept(std::shared_ptr> o) { if (!o) { abort(); @@ -618,6 +670,31 @@ namespace rxcpp catch (...) {ep = std::current_exception();} return std::make_shared(ep); } + static + std::shared_ptr CreateOnError(std::exception_ptr ep) { + return std::make_shared(ep); + } + }; + + template + bool operator == (std::shared_ptr> lhs, std::shared_ptr> rhs) { + if (!lhs && !rhs) {return true;} + if (!lhs || !rhs) {return false;} + return lhs->Equals(rhs); + } + + template + struct TestableObserver : public Observer + { + virtual std::vector>>> Messages() =0; + }; + + template + struct TestableObservable : public Observable + { + virtual std::vector Subscriptions() =0; + + virtual std::vector>>> Messages() =0; }; template diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 81e6d06..108556b 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -583,8 +583,6 @@ namespace rxcpp typedef VirtualTimeSchedulerBase Base; - typedef typename Base::clock clock; - typedef typename Base::Work Work; typedef typename Base::QueueItem QueueItem; struct compare_work @@ -603,6 +601,8 @@ namespace rxcpp ScheduledWork queue; public: + typedef typename Base::clock clock; + typedef typename Base::Work Work; virtual ~VirtualTimeScheduler() { @@ -633,15 +633,17 @@ namespace rxcpp Disposable ScheduleAbsolute(Absolute dueTime, Work work) { - auto cancelable = std::make_shared(std::move(work)); + auto cancelable = std::make_shared(); - auto run = [cancelable](Scheduler::shared scheduler) -> Disposable { - auto work = *cancelable.get(); + auto run = [cancelable, work](Scheduler::shared scheduler) -> Disposable { + auto local = work; *cancelable.get() = nullptr; - return Do(work, std::move(scheduler)); + return Base::Do(local, std::move(scheduler)); }; + + *cancelable.get() = run; - auto si = QueueItem(dueTime, std::make_shared(std::move(run))); + auto si = QueueItem(dueTime, cancelable); queue.push(si); auto result = Disposable([cancelable]{ @@ -652,6 +654,287 @@ namespace rxcpp }; + class TestScheduler : public VirtualTimeScheduler + { + public: + typedef VirtualTimeScheduler Base; + typedef typename Base::clock clock; + typedef typename Base::Work Work; + typedef std::shared_ptr shared; + + static const long Created = 100; + static const long Subscribed = 200; + static const long Disposed = 1000; + + template + struct Messages + { + typedef Recorded>> RecordedT; + + static + RecordedT OnNext(long ticks, T value) + { + return RecordedT(ticks, Notification::CreateOnNext(value)); + } + + static + RecordedT OnCompleted(long ticks) + { + return RecordedT(ticks, Notification::CreateOnCompleted()); + } + + static + RecordedT OnError(long ticks, std::exception_ptr ep) + { + return RecordedT(ticks, Notification::CreateOnError(ep)); + } + + template + static + RecordedT OnError(long ticks, Exception e) + { + return RecordedT(ticks, Notification::CreateOnError(e)); + } + + static + Subscription Subscribe(long subscribe, long unsubscribe) + { + return Subscription(subscribe, unsubscribe); + } + + private: + ~Messages(); + }; + + virtual Disposable ScheduleAbsolute(long dueTime, Work work) + { + if (dueTime <= Base::clock_now) + dueTime = Base::clock_now + 1; + + return Base::ScheduleAbsolute(dueTime, std::move(work)); + } + + virtual long Add(long absolute, long relative) + { + return absolute + relative; + } + + virtual clock::time_point ToTimePoint(long absolute) + { + return clock::time_point(clock::duration(absolute)); + } + + virtual long ToRelative(clock::duration d) + { + return d.count(); + } + + using Base::Start; + + template + std::shared_ptr> Start(std::function>()> create, long created, long subscribed, long disposed) + { + auto observer = CreateObserver(); + + struct State + { + std::shared_ptr> source; + SerialDisposable subscription; + std::shared_ptr> observer; + }; + auto state = std::make_shared(); + + state->observer = observer; + + ScheduleAbsolute(created, [create, state](Scheduler::shared scheduler) -> Disposable { + state->source = create(); return Disposable::Empty(); }); + ScheduleAbsolute(subscribed, [state](Scheduler::shared scheduler) -> Disposable { + state->subscription.Set(state->source->Subscribe(state->observer)); return Disposable::Empty(); }); + ScheduleAbsolute(disposed, [state](Scheduler::shared scheduler) -> Disposable { + state->subscription.Dispose(); return Disposable::Empty(); }); + + Start(); + + return observer; + } + + template + std::shared_ptr> Start(std::function>()> create, long disposed) + { + return Start(create, Created, Subscribed, disposed); + } + + template + std::shared_ptr> Start(std::function>()> create) + { + return Start(create, Created, Subscribed, Disposed); + } + + template + std::shared_ptr> CreateHotObservable(std::vector>>> messages); + + template + std::shared_ptr> CreateColdObservable(std::vector>>> messages); + + template + std::shared_ptr> CreateObserver(); + }; + + template + class MockObserver : public TestableObserver + { + typedef Notification NotificationT; + typedef Recorded>> RecordedT; + + TestScheduler::shared scheduler; + std::vector messages; + + public: + MockObserver(TestScheduler::shared scheduler) + : scheduler(scheduler) + { + } + + virtual void OnNext(const T& value) + { + messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnNext(value))); + } + + virtual void OnError(const std::exception_ptr& exception) + { + messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnError(exception))); + } + + virtual void OnCompleted() + { + messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnCompleted())); + } + + std::vector Messages() + { + return messages; + } + }; + + template + std::shared_ptr> TestScheduler::CreateObserver() + { + return std::make_shared>(std::static_pointer_cast(shared_from_this())); + } + + template + class ColdObservable : public TestableObservable, public std::enable_shared_from_this> + { + TestScheduler::shared scheduler; + typedef Recorded>> RecordedT; + std::vector messages; + std::vector subscriptions; + + public: + + ColdObservable(TestScheduler::shared scheduler, std::vector messages) + : scheduler(scheduler) + , messages(std::move(messages)) + { + } + + template + ColdObservable(TestScheduler::shared scheduler, Iterator begin, Iterator end) + : scheduler(scheduler) + , messages(begin, end) + { + } + + virtual Disposable Subscribe(std::shared_ptr> observer) + { + subscriptions.push_back(Subscription(scheduler->Clock())); + auto index = subscriptions.size() - 1; + + ComposableDisposable d; + + for (auto& message : messages) { + auto notification = message.Value(); + d.Add(scheduler->ScheduleRelative(message.Time(), [notification, observer](Scheduler::shared) -> Disposable { + notification->Accept(observer); return Disposable::Empty(); + })); + } + + auto sharedThis = this->shared_from_this(); + return Disposable([sharedThis, index, d]() { + sharedThis->subscriptions[index] = Subscription(sharedThis->subscriptions[index].Subscribe(), sharedThis->scheduler->Clock()); + d.Dispose(); + }); + } + + virtual std::vector Subscriptions() { + return subscriptions; + } + + virtual std::vector>>> Messages() { + return messages; + } + }; + + template + std::shared_ptr> TestScheduler::CreateColdObservable(std::vector>>> messages) + { + return std::make_shared>(std::static_pointer_cast(shared_from_this()), std::move(messages)); + } + + template + class HotObservable : public TestableObservable, public std::enable_shared_from_this> + { + TestScheduler::shared scheduler; + typedef Recorded>> RecordedT; + std::vector messages; + std::vector subscriptions; + std::vector>> observers; + + public: + + HotObservable(TestScheduler::shared scheduler, std::vector messages) + : scheduler(scheduler) + , messages(messages) + { + for (auto& message : messages) { + auto notification = message.Value(); + scheduler->ScheduleAbsolute(message.Time(), [this, notification](Scheduler::shared) -> Disposable { + for (auto& observer : this->observers) { + notification->Accept(observer); + } + return Disposable::Empty(); + }); + } + } + + virtual Disposable Subscribe(std::shared_ptr> observer) + { + observers.push_back(observer); + subscriptions.push_back(Subscription(scheduler->Clock())); + auto index = subscriptions.size() - 1; + + auto sharedThis = this->shared_from_this(); + return Disposable([sharedThis, index, observer]() { + sharedThis->observers.erase(std::find(sharedThis->observers.begin(), sharedThis->observers.end(), observer)); + sharedThis->subscriptions[index] = Subscription(sharedThis->subscriptions[index].Subscribe(), sharedThis->scheduler->Clock()); + }); + } + + virtual std::vector Subscriptions() { + return subscriptions; + } + + virtual std::vector>>> Messages() { + return messages; + } + }; + + template + std::shared_ptr> TestScheduler::CreateHotObservable(std::vector>>> messages) + { + return std::make_shared>(std::static_pointer_cast(shared_from_this()), std::move(messages)); + } + } #endif -- GitLab From e1190a782bc0ce57a7c6686dd29d1e873297edea Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Dec 2013 10:14:42 -0800 Subject: [PATCH 120/782] Bug fixes and pretty-printing --- .gitignore | 109 ++++++++++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-base.hpp | 36 ++++++++-- Rx/CPP/src/cpprx/rx-includes.hpp | 3 + Rx/CPP/src/cpprx/rx-scheduler.hpp | 6 ++ 4 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd3a2a5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,109 @@ +################# +## Visual Studio +################# + +## 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/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# 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 + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.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 + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +############ +## Mac +############ + +.DS_Store + +############ +## CMake +############ + +projects/CMake/* +!projects/CMake/CMakelists.txt diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 530935a..f8e6386 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -391,6 +391,7 @@ namespace rxcpp protected: VirtualTimeSchedulerBase() : is_enabled(false) + , clock_now(0) { } explicit VirtualTimeSchedulerBase(Absolute initialClock) @@ -543,8 +544,8 @@ namespace rxcpp public: Recorded(long time, T value) : time(time), value(value) { } - long Time() {return time;} - T Value() {return value;} + long Time() const {return time;} + const T& Value() const {return value;} }; template @@ -552,6 +553,12 @@ namespace rxcpp return lhs.Time() == rhs.Time() && lhs.Value() == rhs.Value(); } + template + std::ostream& operator<< (std::ostream& out, const Recorded& r) { + out << "@" << r.Time() << "-" << r.Value(); + return out; + } + class Subscription { long subscribe; @@ -562,14 +569,19 @@ namespace rxcpp } Subscription(long subscribe, long unsubscribe) : subscribe(subscribe), unsubscribe(unsubscribe) { } - long Subscribe() {return subscribe;} - long Unsubscribe() {return unsubscribe;} + long Subscribe() const {return subscribe;} + long Unsubscribe() const {return unsubscribe;} }; bool operator == (Subscription lhs, Subscription rhs) { return lhs.Subscribe() == rhs.Subscribe() && lhs.Unsubscribe() == rhs.Unsubscribe(); } + std::ostream& operator<< (std::ostream& out, const Subscription& s) { + out << s.Subscribe() << "-" << s.Unsubscribe(); + return out; + } + template struct Notification { @@ -579,6 +591,7 @@ namespace rxcpp virtual ~Notification() {} + virtual void Out(std::ostream& out) =0; virtual bool Equals(std::shared_ptr> other) = 0; virtual void Accept(std::shared_ptr>) =0; virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) =0; @@ -587,6 +600,9 @@ namespace rxcpp struct OnNextNotification : public Notification { OnNextNotification(T value) : value(std::move(value)) { } + virtual void Out(std::ostream& out) { + out << "OnNext( " << value << ")"; + } virtual bool Equals(std::shared_ptr> other) { bool result = false; other->Accept([this, &result](T value) { result = this->value == value;}, [](){}, [](std::exception_ptr){}); @@ -610,6 +626,9 @@ namespace rxcpp struct OnCompletedNotification : public Notification { OnCompletedNotification() { } + virtual void Out(std::ostream& out) { + out << "OnCompleted()"; + } virtual bool Equals(std::shared_ptr> other) { bool result = false; other->Accept([](T) {}, [&result](){result = true;}, [](std::exception_ptr){}); @@ -632,6 +651,9 @@ namespace rxcpp struct OnErrorNotification : public Notification { OnErrorNotification(std::exception_ptr ep) : ep(ep) { } + virtual void Out(std::ostream& out) { + out << "OnError()"; + } virtual bool Equals(std::shared_ptr> other) { bool result = false; // not trying to compare exceptions @@ -683,6 +705,12 @@ namespace rxcpp return lhs->Equals(rhs); } + template + std::ostream& operator<< (std::ostream& out, const std::shared_ptr>& n) { + n->Out(out); + return out; + } + template struct TestableObserver : public Observer { diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp index 743a86f..4ef0221 100644 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ b/Rx/CPP/src/cpprx/rx-includes.hpp @@ -12,6 +12,9 @@ #include +#include +#include + #include #include #include diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 108556b..f4216c5 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -702,6 +702,12 @@ namespace rxcpp return Subscription(subscribe, unsubscribe); } + template + static + auto ToVector(const Item (&arr) [size]) -> std::vector { + return std::vector(std::begin(arr), std::end(arr)); + } + private: ~Messages(); }; -- GitLab From f8bb6ebffb1e3a376fa90bf6932160264bad1591 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Dec 2013 10:34:47 -0800 Subject: [PATCH 121/782] add support for TestableObservable and TestableObserver --- Rx/CPP/src/cpprx/rx-base.hpp | 12 ++++++++++++ Rx/CPP/src/cpprx/rx.hpp | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index f8e6386..3aff92a 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -809,6 +809,9 @@ namespace detail { template struct observable_item>> {typedef T type;}; + template + struct observable_item>> {typedef T type;}; + template struct observable_item < std::shared_ptr < ConnectableObservable> > {typedef T type; }; @@ -839,6 +842,9 @@ namespace detail { template struct observer_item>> {typedef T type;}; + template + struct observer_item>> {typedef T type;}; + template struct subject_item; @@ -893,6 +899,9 @@ namespace detail { template std::shared_ptr> observable(const std::shared_ptr < GroupedObservable < K, T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } + template + std::shared_ptr> observable(const std::shared_ptr < TestableObservable < T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } + template std::shared_ptr< Observable < T >> observable(const std::shared_ptr < ConnectableObservable < T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } @@ -931,6 +940,9 @@ namespace detail { template std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} + template + std::shared_ptr> observer(const std::shared_ptr>& o){return std::static_pointer_cast>(o);} + template std::shared_ptr> grouped_observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} } diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index ade931f..b1a32cd 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -411,7 +411,7 @@ namespace detail { auto observe_on_dispatcher() -> decltype(from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current())))) { - return from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()))); + return from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()))); } #else auto on_dispatcher() @@ -564,6 +564,10 @@ namespace detail { Binder>> from(std::shared_ptr> obj) { return Binder>>(std::move(obj)); } + template + Binder>> from(std::shared_ptr> obj) { + return Binder>>(std::move(obj)); } + template Binder from(Binder binder) { return std::move(binder); } -- GitLab From 5eeb82060c447e2b23454214cf84ba0ea02c8ed2 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 2 Dec 2013 12:26:51 -0800 Subject: [PATCH 122/782] improve windows build --- Rx/CPP/src/cpprx/rx-scheduler.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index f4216c5..bc3dc60 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -658,8 +658,8 @@ namespace rxcpp { public: typedef VirtualTimeScheduler Base; - typedef typename Base::clock clock; - typedef typename Base::Work Work; + typedef Base::clock clock; + typedef Base::Work Work; typedef std::shared_ptr shared; static const long Created = 100; @@ -732,7 +732,7 @@ namespace rxcpp virtual long ToRelative(clock::duration d) { - return d.count(); + return static_cast(d.count()); } using Base::Start; -- GitLab From a5afc4e3ceb74c75d6b1550759b9090661e5f732 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Dec 2013 19:25:30 -0800 Subject: [PATCH 123/782] fix duplicate symbol errors in clang --- Rx/CPP/src/cpprx/rx-base.hpp | 12 ++++----- Rx/CPP/src/cpprx/rx-scheduler.hpp | 41 ++++++++++++++++--------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 3aff92a..91c2522 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -565,19 +565,19 @@ namespace rxcpp long unsubscribe; public: - explicit Subscription(long subscribe) : subscribe(subscribe), unsubscribe(std::numeric_limits::max()) { + explicit inline Subscription(long subscribe) : subscribe(subscribe), unsubscribe(std::numeric_limits::max()) { } - Subscription(long subscribe, long unsubscribe) : subscribe(subscribe), unsubscribe(unsubscribe) { + inline Subscription(long subscribe, long unsubscribe) : subscribe(subscribe), unsubscribe(unsubscribe) { } - long Subscribe() const {return subscribe;} - long Unsubscribe() const {return unsubscribe;} + inline long Subscribe() const {return subscribe;} + inline long Unsubscribe() const {return unsubscribe;} }; - bool operator == (Subscription lhs, Subscription rhs) { + inline bool operator == (Subscription lhs, Subscription rhs) { return lhs.Subscribe() == rhs.Subscribe() && lhs.Unsubscribe() == rhs.Unsubscribe(); } - std::ostream& operator<< (std::ostream& out, const Subscription& s) { + inline std::ostream& operator<< (std::ostream& out, const Subscription& s) { out << s.Subscribe() << "-" << s.Unsubscribe(); return out; } diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index bc3dc60..385cb39 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -42,44 +42,47 @@ namespace rxcpp }; private: - RXCPP_THREAD_LOCAL static ThreadLocalQueue* threadLocalQueue; + static ThreadLocalQueue*& threadLocalQueue() { + RXCPP_THREAD_LOCAL static ThreadLocalQueue* queue; + return queue; + } public: static Scheduler::shared GetScheduler() { - return !!threadLocalQueue ? threadLocalQueue->scheduler : Scheduler::shared(); + return !!threadLocalQueue() ? threadLocalQueue()->scheduler : Scheduler::shared(); } static bool empty() { - if (!threadLocalQueue) { + if (!threadLocalQueue()) { throw std::logic_error("this thread does not have a queue!"); } - return threadLocalQueue->queue.empty(); + return threadLocalQueue()->queue.empty(); } static ScheduledWork::const_reference top() { - if (!threadLocalQueue) { + if (!threadLocalQueue()) { throw std::logic_error("this thread does not have a queue!"); } - return threadLocalQueue->queue.top(); + return threadLocalQueue()->queue.top(); } static void pop() { - if (!threadLocalQueue) { + if (!threadLocalQueue()) { throw std::logic_error("this thread does not have a queue!"); } - threadLocalQueue->queue.pop(); + threadLocalQueue()->queue.pop(); } static void push(QueueItem item) { - if (!threadLocalQueue) { + if (!threadLocalQueue()) { throw std::logic_error("this thread does not have a queue!"); } - threadLocalQueue->queue.push(std::move(item)); + threadLocalQueue()->queue.push(std::move(item)); } static void EnsureQueue(Scheduler::shared scheduler) { - if (!!threadLocalQueue) { + if (!!threadLocalQueue()) { throw std::logic_error("this thread already has a queue!"); } // create and publish new queue - threadLocalQueue = new ThreadLocalQueue(); - threadLocalQueue->scheduler = scheduler; + threadLocalQueue() = new ThreadLocalQueue(); + threadLocalQueue()->scheduler = scheduler; } static std::unique_ptr CreateQueue(Scheduler::shared scheduler) { std::unique_ptr result(new ThreadLocalQueue()); @@ -87,25 +90,23 @@ namespace rxcpp return result; } static void SetQueue(ThreadLocalQueue* queue) { - if (!!threadLocalQueue) { + if (!!threadLocalQueue()) { throw std::logic_error("this thread already has a queue!"); } // create and publish new queue - threadLocalQueue = queue; + threadLocalQueue() = queue; } static void DestroyQueue(ThreadLocalQueue* queue) { delete queue; } static void DestroyQueue() { - if (!threadLocalQueue) { + if (!threadLocalQueue()) { throw std::logic_error("this thread does not have a queue!"); } - DestroyQueue(threadLocalQueue); - threadLocalQueue = nullptr; + DestroyQueue(threadLocalQueue()); + threadLocalQueue() = nullptr; } }; - // static - RXCPP_SELECT_ANY RXCPP_THREAD_LOCAL CurrentThreadQueue::ThreadLocalQueue* CurrentThreadQueue::threadLocalQueue = nullptr; struct CurrentThreadScheduler : public LocalScheduler { -- GitLab From 9e5b2ca9f1bafb6fb982cb3bf7ed2de6def3127d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 2 Dec 2013 19:26:02 -0800 Subject: [PATCH 124/782] reimplement Where to fix dispose bug --- Rx/CPP/src/cpprx/operators/Where.hpp | 100 ++++++++++++++++++--------- 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Where.hpp b/Rx/CPP/src/cpprx/operators/Where.hpp index 679ffab..5119cb3 100644 --- a/Rx/CPP/src/cpprx/operators/Where.hpp +++ b/Rx/CPP/src/cpprx/operators/Where.hpp @@ -8,44 +8,78 @@ namespace rxcpp { + namespace detail + { + template + class WhereObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + typedef std::function Predicate; + + std::shared_ptr> source; + Predicate predicate; + + class _ : public Sink<_, T>, public Observer + { + Parent parent; + + public: + typedef Sink<_, T> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + virtual void OnNext(const T& t) + { + util::maybe shouldRun; + try { + shouldRun.set(parent->predicate(t)); + } catch (...) { + SinkBase::observer->OnError(std::current_exception()); + SinkBase::Dispose(); + } + if (!!shouldRun && *shouldRun.get()) { + SinkBase::observer->OnNext(t); + } + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer, T> ProducerBase; + public: + + WhereObservable(const std::shared_ptr>& source, Predicate predicate) : + ProducerBase([this](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(source), + predicate(std::move(predicate)) + { + } + }; + } template - const std::shared_ptr> Where( + std::shared_ptr> Where( const std::shared_ptr>& source, P predicate - ) + ) { - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - typedef decltype(predicate(element)) U; - util::maybe result; - try { - result.set(predicate(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result && *result.get()) - { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); + return std::make_shared>(source, std::move(predicate)); } } -- GitLab From 3e3bf958c6122fce0130e8ca5878d0169c2e5f7d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:26:31 -0800 Subject: [PATCH 125/782] ignore projects --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dd3a2a5..ca7abf5 100644 --- a/.gitignore +++ b/.gitignore @@ -105,5 +105,5 @@ Desktop.ini ## CMake ############ -projects/CMake/* +projects/* !projects/CMake/CMakelists.txt -- GitLab From 47f02bc502e3cba918906853a12d7367c0d911fa Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:27:23 -0800 Subject: [PATCH 126/782] remove bad code --- Rx/CPP/src/cpprx/rx-operators.hpp | 87 ++++++------------------------- 1 file changed, 17 insertions(+), 70 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index fabb763..2c4525b 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -13,18 +13,24 @@ namespace rxcpp // // constructors template - struct CreatedAutoDetachObserver : public Observer + struct CreatedAutoDetachObserver : public Observer, public std::enable_shared_from_this> { std::shared_ptr> observer; + std::atomic isStopped; SerialDisposable disposable; virtual ~CreatedAutoDetachObserver() { - clear(); + } + + CreatedAutoDetachObserver() + : isStopped(false) + { } virtual void OnNext(const T& element) { - if (observer) { + auto keepAlive = this->shared_from_this(); + if (!isStopped) { RXCPP_UNWIND(disposer, [&](){ disposable.Dispose(); }); @@ -34,34 +40,26 @@ namespace rxcpp } virtual void OnCompleted() { - if (observer) { + auto keepAlive = this->shared_from_this(); + if (!isStopped.exchange(true)) { RXCPP_UNWIND(disposer, [&](){ disposable.Dispose(); }); - std::shared_ptr> final; - using std::swap; - swap(final, observer); - final->OnCompleted(); + observer->OnCompleted(); disposer.dismiss(); } } virtual void OnError(const std::exception_ptr& error) { - if (observer) { + auto keepAlive = this->shared_from_this(); + if (!isStopped.exchange(true)) { RXCPP_UNWIND(disposer, [&](){ disposable.Dispose(); }); - std::shared_ptr> final; - using std::swap; - swap(final, observer); - final->OnError(error); + observer->OnError(error); disposer.dismiss(); } } - void clear() - { - observer = nullptr; - } }; template @@ -127,7 +125,6 @@ namespace rxcpp std::function onError; virtual ~CreatedObserver() { - clear(); } virtual void OnNext(const T& element) @@ -141,30 +138,16 @@ namespace rxcpp { if(onCompleted) { - std::function final; - using std::swap; - swap(final, onCompleted); - clear(); - final(); + onCompleted(); } } virtual void OnError(const std::exception_ptr& error) { if(onError) { - std::function final; - using std::swap; - swap(final, onError); - clear(); - final(error); + onError(error); } } - void clear() - { - onNext = nullptr; - onCompleted = nullptr; - onError = nullptr; - } }; template @@ -189,7 +172,6 @@ namespace rxcpp class Sink : public std::enable_shared_from_this { typedef std::shared_ptr> SinkObserver; - mutable std::mutex lock; mutable util::maybe cancel; protected: @@ -208,7 +190,6 @@ namespace rxcpp void Dispose() const { - std::unique_lock guard(lock); observer = std::make_shared>(); if (cancel) { @@ -227,40 +208,6 @@ namespace rxcpp local->Dispose(); }); } - - class _ : public Observer - { - std::shared_ptr that; - public: - _(std::shared_ptr that) : that(that) - {} - - virtual void OnNext(const T& t) - { - std::unique_lock guard(that->lock); - that->observer->OnNext(t); - } - virtual void OnCompleted() - { - std::unique_lock guard(that->lock); - that->observer->OnCompleted(); - if (that->cancel) - { - that->cancel->Dispose(); - that->cancel.reset(); - } - } - virtual void OnError(const std::exception_ptr& e) - { - std::unique_lock guard(that->lock); - that->observer->OnError(e); - if (that->cancel) - { - that->cancel->Dispose(); - that->cancel.reset(); - } - } - }; }; template -- GitLab From 557b829cab4dc8c4f0550e9012d72c19e06985d4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:27:42 -0800 Subject: [PATCH 127/782] fix Zip --- Rx/CPP/src/cpprx/operators/Zip.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Rx/CPP/src/cpprx/operators/Zip.hpp b/Rx/CPP/src/cpprx/operators/Zip.hpp index 3d51f0c..13a7b0f 100644 --- a/Rx/CPP/src/cpprx/operators/Zip.hpp +++ b/Rx/CPP/src/cpprx/operators/Zip.hpp @@ -108,6 +108,7 @@ namespace rxcpp [=](const Item& element) { std::unique_lock guard(state->lock); + if (state->isStopped) {return;} std::get(state->queues).second.push(element); Next next(state, observer, cd); util::tuple_dispatch(next, state->queues); @@ -116,6 +117,7 @@ namespace rxcpp [=] { std::unique_lock guard(state->lock); + if (state->isStopped) {return;} std::get(state->queues).first = true; Next next(state, observer, cd); util::tuple_dispatch(next, state->queues); @@ -124,6 +126,7 @@ namespace rxcpp [=](const std::exception_ptr& error) { std::unique_lock guard(state->lock); + if (state->isStopped) {return;} observer->OnError(error); cd.Dispose(); })); @@ -158,10 +161,12 @@ namespace rxcpp typedef std::tuple_size SourcesSize; explicit State(S selector) : selector(std::move(selector)) + , isStopped(false) {} std::mutex lock; S selector; Queues queues; + bool isStopped; }; Sources sources(source...); // bug on osx prevents using make_shared @@ -170,6 +175,7 @@ namespace rxcpp [=](std::shared_ptr> observer) -> Disposable { ComposableDisposable cd; + cd.Add(Disposable([state](){state->isStopped = true;})); detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); return cd; }); -- GitLab From 0949ad5fcd2caf90fbcfd02077a015bdbb131eb5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:27:59 -0800 Subject: [PATCH 128/782] reimplement Take --- Rx/CPP/src/cpprx/operators/Take.hpp | 112 +++++++++++++++++----------- 1 file changed, 69 insertions(+), 43 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Take.hpp b/Rx/CPP/src/cpprx/operators/Take.hpp index 8414394..2ffec60 100644 --- a/Rx/CPP/src/cpprx/operators/Take.hpp +++ b/Rx/CPP/src/cpprx/operators/Take.hpp @@ -9,57 +9,83 @@ namespace rxcpp { - template - std::shared_ptr> Take( - const std::shared_ptr>& source, - Integral n - ) + namespace detail { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable + template + class TakeObservable : public Producer, T> + { + typedef std::shared_ptr> Parent; + + std::shared_ptr> source; + Integral count; + + class _ : public Sink<_, T>, public Observer { - // keep count of remaining calls received OnNext and count of OnNext calls issued. - auto remaining = std::make_shared, std::atomic>>(n, n); + Parent parent; + Integral remaining; - ComposableDisposable cd; + public: + typedef Sink<_, T> SinkBase; - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - auto local = --std::get<0>(*remaining); - RXCPP_UNWIND_AUTO([&](){ - if (local >= 0){ - // all elements received - if (--std::get<1>(*remaining) == 0) { - // all elements passed on to observer. - observer->OnCompleted(); - cd.Dispose();}}}); - - if (local >= 0) { - observer->OnNext(element); - } - }, - // on completed - [=] + _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent), + remaining(parent->count) + { + } + + virtual void OnNext(const T& t) + { + if (remaining > 0) { - if (std::get<1>(*remaining) == 0 && std::get<0>(*remaining) <= 0) { - observer->OnCompleted(); - cd.Dispose(); + --remaining; + SinkBase::observer->OnNext(t); + + if (remaining == 0) + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); } - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); + } + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer, T> ProducerBase; + public: + + TakeObservable(const std::shared_ptr>& source, Integral count) : + ProducerBase([this](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(source), + count(count) + { + } + }; + } + template + std::shared_ptr> Take( + const std::shared_ptr>& source, + Integral n + ) + { + return std::make_shared>(source, n); } + template std::shared_ptr> TakeUntil( const std::shared_ptr>& source, -- GitLab From e754305d404622b252752fa46d13732ad27f38af Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:28:15 -0800 Subject: [PATCH 129/782] fix compiler warning --- Rx/CPP/src/cpprx/operators/RefCount.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/RefCount.hpp b/Rx/CPP/src/cpprx/operators/RefCount.hpp index a1997fd..22a8224 100644 --- a/Rx/CPP/src/cpprx/operators/RefCount.hpp +++ b/Rx/CPP/src/cpprx/operators/RefCount.hpp @@ -83,8 +83,8 @@ namespace rxcpp setSink(sink->GetDisposable()); return sink->Run(); }), - refcount(0), - source(std::move(source)) + source(std::move(source)), + refcount(0) { subscription.set(Disposable::Empty()); } -- GitLab From 44c3a898ee362457884c1093c956aebef145bcff Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 3 Dec 2013 00:28:31 -0800 Subject: [PATCH 130/782] fix CombineLatest --- Rx/CPP/src/cpprx/operators/CombineLatest.hpp | 59 +++++++------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp index 0e98c3f..cf5af07 100644 --- a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp +++ b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp @@ -23,35 +23,24 @@ namespace rxcpp // on next [=](const typename std::tuple_element::type& element) { - auto local = state; - std::unique_lock guard(local->lock); - std::get(local->latest) = element; - if (!std::get(local->latestValid)) { - std::get(local->latestValid) = true; - --local->pendingFirst; + std::unique_lock guard(state->lock); + if (state->done) {return;} + std::get(state->latest) = element; + if (!std::get(state->latestValid)) { + std::get(state->latestValid) = true; + --state->pendingFirst; } - if (local->pendingFirst == 0) { - Latest args = local->latest; - typedef decltype(util::tuple_dispatch(local->selector, args)) U; + if (state->pendingFirst == 0) { + Latest args = state->latest; + typedef decltype(util::tuple_dispatch(state->selector, args)) U; util::maybe result; try { - result.set(util::tuple_dispatch(local->selector, args)); + result.set(util::tuple_dispatch(state->selector, args)); } catch(...) { observer->OnError(std::current_exception()); } if (!!result) { - ++state->pendingIssue; - { - RXCPP_UNWIND_AUTO([&](){guard.lock();}); - guard.unlock(); - observer->OnNext(std::move(*result.get())); - } - --state->pendingIssue; - } - if (state->done && state->pendingIssue == 0) { - guard.unlock(); - observer->OnCompleted(); - cd.Dispose(); + observer->OnNext(std::move(*result.get())); } } }, @@ -59,19 +48,17 @@ namespace rxcpp [=] { std::unique_lock guard(state->lock); - --state->pendingComplete; - if (state->pendingComplete == 0) { - state->done = true; - if (state->pendingIssue == 0) { - guard.unlock(); - observer->OnCompleted(); - cd.Dispose(); - } - } + if (state->done) {return;} + state->done = true; + observer->OnCompleted(); + cd.Dispose(); }, // on error [=](const std::exception_ptr& error) { + std::unique_lock guard(state->lock); + if (state->done) {return;} + state->done = true; observer->OnError(error); cd.Dispose(); })); @@ -109,16 +96,12 @@ namespace rxcpp explicit State(S selector) : latestValid() , pendingFirst(SourcesSize::value) - , pendingIssue(0) - , pendingComplete(SourcesSize::value) , done(false) , selector(std::move(selector)) {} std::mutex lock; LatestValid latestValid; size_t pendingFirst; - size_t pendingIssue; - size_t pendingComplete; bool done; S selector; Latest latest; @@ -130,6 +113,7 @@ namespace rxcpp [=](std::shared_ptr> observer) -> Disposable { ComposableDisposable cd; + cd.Add(Disposable([state](){state->done = true;})); detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); return cd; }); @@ -155,16 +139,12 @@ namespace rxcpp explicit State(S selector) : latestValid() , pendingFirst(SourcesSize::value) - , pendingIssue(0) - , pendingComplete(SourcesSize::value) , done(false) , selector(std::move(selector)) {} std::mutex lock; LatestValid latestValid; size_t pendingFirst; - size_t pendingIssue; - size_t pendingComplete; bool done; S selector; Latest latest; @@ -176,6 +156,7 @@ namespace rxcpp [=](std::shared_ptr> observer) -> Disposable { ComposableDisposable cd; + cd.Add(Disposable([state](){state->done = true;})); detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); return cd; }); -- GitLab From 75bf4eb291863f2668e8bebe8b16a605657d2206 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 4 Dec 2013 23:33:14 -0800 Subject: [PATCH 131/782] record more data in testbench --- Rx/CPP/testbench/testbench.cpp | 124 ++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 56 deletions(-) diff --git a/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp index 2e41f4d..4fd5e8c 100644 --- a/Rx/CPP/testbench/testbench.cpp +++ b/Rx/CPP/testbench/testbench.cpp @@ -18,6 +18,56 @@ using namespace std; bool IsPrime(int x); +struct Count { + Count() : subscriptions(0), nexts(0), completions(0), errors(0), disposals(0) {} + std::atomic subscriptions; + std::atomic nexts; + std::atomic completions; + std::atomic errors; + std::atomic disposals; +}; +template +std::shared_ptr> Record( + const std::shared_ptr>& source, + Count* count +) +{ + return rxcpp::CreateObservable( + [=](std::shared_ptr> observer) -> rxcpp::Disposable + { + ++count->subscriptions; + rxcpp::ComposableDisposable cd; + cd.Add(rxcpp::Disposable([=](){ + ++count->disposals;})); + cd.Add(rxcpp::Subscribe( + source, + // on next + [=](T element) + { + ++count->nexts; + observer->OnNext(std::move(element)); + }, + // on completed + [=] + { + ++count->completions; + observer->OnCompleted(); + }, + // on error + [=](const std::exception_ptr& error) + { + ++count->errors; + observer->OnError(error); + })); + return cd; + }); +} +struct record {}; +template +rxcpp::Binder>> rxcpp_chain(record&&, const std::shared_ptr>& source, Count* count) { + return rxcpp::from(Record(source, count)); +} + vector vector_range(int start, int end) { vector v; @@ -27,6 +77,8 @@ vector vector_range(int start, int end) } void IxToRx(int n) { + Count sourcecount, takencount, observedcount; + std::cout << "IxToRx: first " << n << " primes squared" << endl; auto values = vector_range(2, n * 10); @@ -34,15 +86,22 @@ void IxToRx(int n) { .where(IsPrime) .select([](int x) { return std::make_pair(x, x*x); }); - auto input = std::make_shared(); auto output = std::make_shared(); - rxcpp::from(Iterate(primes, input)) + rxcpp::from(rxcpp::Iterate(primes)) + .template chain(&sourcecount) .take(n) + .template chain(&takencount) .observe_on(output) + .template chain(&observedcount) .for_each(rxcpp::MakeTupleDispatch( [](int p, int s) { cout << p << " =square=> " << s << endl; })); + + cout << "location: subscriptions, nexts, completions, errors, disposals" << endl; + cout << "sourcecount: " << sourcecount.subscriptions << ", " << sourcecount.nexts << ", " << sourcecount.completions << ", " << sourcecount.errors << ", " << sourcecount.disposals << endl; + cout << "takencount: " << takencount.subscriptions << ", " << takencount.nexts << ", " << takencount.completions << ", " << takencount.errors << ", " << takencount.disposals << endl; + cout << "observedcount: " << observedcount.subscriptions << ", " << observedcount.nexts << ", " << observedcount.completions << ", " << observedcount.errors << ", " << observedcount.disposals << endl; } void PrintPrimes(int n) @@ -170,53 +229,7 @@ void Combine(int n) })); } -struct Count { - Count() : nexts(0), completions(0), errors(0), disposals(0) {} - std::atomic nexts; - std::atomic completions; - std::atomic errors; - std::atomic disposals; -}; -template -std::shared_ptr> Record( - const std::shared_ptr>& source, - Count* count - ) -{ - return rxcpp::CreateObservable( - [=](std::shared_ptr> observer) -> rxcpp::Disposable - { - rxcpp::ComposableDisposable cd; - cd.Add(rxcpp::Disposable([=](){ - ++count->disposals;})); - cd.Add(rxcpp::Subscribe( - source, - // on next - [=](T element) - { - ++count->nexts; - observer->OnNext(std::move(element)); - }, - // on completed - [=] - { - ++count->completions; - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - ++count->errors; - observer->OnError(error); - })); - return cd; - }); -} -struct record {}; -template -rxcpp::Binder>> rxcpp_chain(record&&, const std::shared_ptr>& source, Count* count) { - return rxcpp::from(Record(source, count)); -} + template void Zip(int n) @@ -251,12 +264,12 @@ void Zip(int n) cout << p2 << " =zipped=> " << p1 << endl; })); - cout << "location: nexts, completions, errors, disposals" << endl; - cout << "s1count:" << s1count.nexts << ", " << s1count.completions << ", " << s1count.errors << ", " << s1count.disposals << endl; - cout << "s2count:" << s2count.nexts << ", " << s2count.completions << ", " << s2count.errors << ", " << s2count.disposals << endl; - cout << "zipcount:" << zipcount.nexts << ", " << zipcount.completions << ", " << zipcount.errors << ", " << zipcount.disposals << endl; - cout << "takecount:" << takecount.nexts << ", " << takecount.completions << ", " << takecount.errors << ", " << takecount.disposals << endl; - cout << "outputcount:" << outputcount.nexts << ", " << outputcount.completions << ", " << outputcount.errors << ", " << outputcount.disposals << endl; + cout << "location: subscriptions, nexts, completions, errors, disposals" << endl; + cout << "s1count: " << s1count.subscriptions << ", " << s1count.nexts << ", " << s1count.completions << ", " << s1count.errors << ", " << s1count.disposals << endl; + cout << "s2count: " << s2count.subscriptions << ", " << s2count.nexts << ", " << s2count.completions << ", " << s2count.errors << ", " << s2count.disposals << endl; + cout << "zipcount: " << zipcount.subscriptions << ", " << zipcount.nexts << ", " << zipcount.completions << ", " << zipcount.errors << ", " << zipcount.disposals << endl; + cout << "takecount: " << takecount.subscriptions << ", " << takecount.nexts << ", " << takecount.completions << ", " << takecount.errors << ", " << takecount.disposals << endl; + cout << "outputcount: " << outputcount.subscriptions << ", " << outputcount.nexts << ", " << outputcount.completions << ", " << outputcount.errors << ", " << outputcount.disposals << endl; } void Merge(int n) @@ -551,7 +564,6 @@ int main(int argc, char* argv[]) Scan(); run(); - } catch (exception& e) { cerr << "exception: " << e.what() << endl; } -- GitLab From cd1318186f7c669df1ff73a97309da430ca98f81 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 4 Dec 2013 23:38:26 -0800 Subject: [PATCH 132/782] work around clang compiler bug --- Rx/CPP/src/cpprx/operators/Iterate.hpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Iterate.hpp b/Rx/CPP/src/cpprx/operators/Iterate.hpp index 1ccca10..8478de1 100644 --- a/Rx/CPP/src/cpprx/operators/Iterate.hpp +++ b/Rx/CPP/src/cpprx/operators/Iterate.hpp @@ -28,7 +28,15 @@ namespace rxcpp { struct State { - explicit State(std::shared_ptr rangeArg) : cancel(false) { + explicit State(std::shared_ptr rangeArg) { + // finally tracked down issue caused by clang compiler bug. + // initializing in the init list only works sometimes. + // a breakpoint here would eventually show that + // cancel was true instead of false. + // initializing in the body instead works every time. + // or using new instead of std::make_shared to create + // State will cause the init list to work every time + this->cancel = false; this->range = std::move(rangeArg); this->r_cursor = begin(*this->range); this->r_end = end(*this->range); @@ -45,8 +53,12 @@ namespace rxcpp cd.Add(Disposable([=]{ state->cancel = true; })); + + SerialDisposable sd; + + cd.Add(sd); - cd.Add(scheduler->Schedule( + sd.Set(scheduler->Schedule( fix0([=](Scheduler::shared s, std::function self) -> Disposable { if (state->cancel) @@ -60,7 +72,8 @@ namespace rxcpp { observer->OnNext(*state->r_cursor); ++state->r_cursor; - return s->Schedule(std::move(self)); + sd.Set(s->Schedule(std::move(self))); + return cd; } return Disposable::Empty(); }))); -- GitLab From 3d872b55551ddefce2d7635da851364da3d8fbda Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 4 Dec 2013 23:41:23 -0800 Subject: [PATCH 133/782] Make Work Disposable and fix schedulers --- Rx/CPP/src/cpprx/rx-base.hpp | 86 +++++++++- Rx/CPP/src/cpprx/rx-operators.hpp | 35 ++-- Rx/CPP/src/cpprx/rx-scheduler.hpp | 262 ++++++++++++++++++------------ 3 files changed, 258 insertions(+), 125 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 91c2522..1c10226 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -76,7 +76,79 @@ namespace rxcpp { typedef std::chrono::steady_clock clock; typedef std::shared_ptr shared; - typedef std::function Work; + + class Work { + struct bool_r{}; + static bool_r bool_true(){return bool_r();} + typedef decltype(&bool_true) bool_type; + + struct State + { + typedef std::function F; + F work; + bool disposed; + inline void Dispose() { + disposed = true; + } + }; + std::shared_ptr state; + + template + struct assign + { + void operator()(const std::shared_ptr& state, State::F fn) { + state->work = std::move(fn); + } + }; + + template + struct assign + { + void operator()(std::shared_ptr& state, const Work& o) { + state = o.state; + } + void operator()(std::shared_ptr& state, Work&& o) { + state = std::move(o.state); + } + }; + public: + Work() + : state(std::make_shared()) + { + state->disposed = false; + } + template + Work(Fn&& fn) + : state(std::make_shared()) + { + assign<1, std::is_same::type>::value>()(state, std::forward(fn)); + state->disposed = false; + } + template + Work& operator=(Fn&& fn) + { + assign<1, std::is_same::type>::value>()(state, std::forward(fn)); + return *this; + } + inline Disposable operator()(shared s) { + if (!state->disposed) { + return state->work(s); + } + return Disposable::Empty(); + } + inline operator bool_type() const {return (!state->disposed && !!state->work) ? &bool_true : nullptr;} + inline void Dispose() const { + state->Dispose(); + } + inline operator Disposable() const + { + // make sure to capture state and not 'this'. + auto local = state; + return Disposable([local]{ + local->Dispose(); + }); + } + }; shared get() {return shared_from_this();} @@ -321,7 +393,7 @@ namespace rxcpp template class ScheduledItem { public: - ScheduledItem(Absolute due, std::shared_ptr work) + ScheduledItem(Absolute due, Scheduler::Work work) : due(due) , work(std::move(work)) {} @@ -336,7 +408,7 @@ namespace rxcpp } Absolute due; - std::shared_ptr work; + Scheduler::Work work; }; struct LocalScheduler : public Scheduler @@ -453,11 +525,11 @@ namespace rxcpp is_enabled = true; do { auto next = GetNext(); - if (!!next && !!next->work && !!*next->work) { + if (!!next && !!next->work) { if (next->due > clock_now) { clock_now = next->due; } - Do(*next->work, shared_from_this()); + Do(next->work, shared_from_this()); } else { is_enabled = false; @@ -485,11 +557,11 @@ namespace rxcpp is_enabled = true; do { auto next = GetNext(); - if (!!next && !!next->work && !!*next->work && next->due <= time) { + if (!!next && !!next->work && next->due <= time) { if (next->due > clock_now) { clock_now = next->due; } - Do(*next->work, shared_from_this()); + Do(next->work, shared_from_this()); } else { is_enabled = false; diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 2c4525b..fdd81f7 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -16,10 +16,13 @@ namespace rxcpp struct CreatedAutoDetachObserver : public Observer, public std::enable_shared_from_this> { std::shared_ptr> observer; - std::atomic isStopped; - SerialDisposable disposable; + mutable std::atomic isStopped; + mutable SerialDisposable disposable; virtual ~CreatedAutoDetachObserver() { + if (!isStopped) { + abort(); + } } CreatedAutoDetachObserver() @@ -29,9 +32,10 @@ namespace rxcpp virtual void OnNext(const T& element) { - auto keepAlive = this->shared_from_this(); if (!isStopped) { + auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ + isStopped = true; disposable.Dispose(); }); observer->OnNext(element); @@ -40,26 +44,37 @@ namespace rxcpp } virtual void OnCompleted() { - auto keepAlive = this->shared_from_this(); if (!isStopped.exchange(true)) { + auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ disposable.Dispose(); }); observer->OnCompleted(); - disposer.dismiss(); } } virtual void OnError(const std::exception_ptr& error) { - auto keepAlive = this->shared_from_this(); if (!isStopped.exchange(true)) { + auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ disposable.Dispose(); }); observer->OnError(error); - disposer.dismiss(); } } + + void Dispose() const { + isStopped = true; + disposable.Dispose(); + } + operator Disposable() const + { + // make sure to capture state and not 'this'. + auto local = this->shared_from_this(); + return Disposable([local]{ + local->Dispose(); + }); + } }; template @@ -99,15 +114,15 @@ namespace rxcpp return Disposable::Empty(); } ); - return autoDetachObserver->disposable; + return *autoDetachObserver; } try { autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); - return autoDetachObserver->disposable; + return *autoDetachObserver; } catch (...) { autoDetachObserver->OnError(std::current_exception()); } - return Disposable::Empty(); + return *autoDetachObserver; } }; diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 385cb39..cac1534 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -54,31 +54,31 @@ namespace rxcpp } static bool empty() { if (!threadLocalQueue()) { - throw std::logic_error("this thread does not have a queue!"); + abort(); } return threadLocalQueue()->queue.empty(); } static ScheduledWork::const_reference top() { if (!threadLocalQueue()) { - throw std::logic_error("this thread does not have a queue!"); + abort(); } return threadLocalQueue()->queue.top(); } static void pop() { if (!threadLocalQueue()) { - throw std::logic_error("this thread does not have a queue!"); + abort(); } threadLocalQueue()->queue.pop(); } static void push(QueueItem item) { if (!threadLocalQueue()) { - throw std::logic_error("this thread does not have a queue!"); + abort(); } threadLocalQueue()->queue.push(std::move(item)); } static void EnsureQueue(Scheduler::shared scheduler) { if (!!threadLocalQueue()) { - throw std::logic_error("this thread already has a queue!"); + abort(); } // create and publish new queue threadLocalQueue() = new ThreadLocalQueue(); @@ -91,9 +91,9 @@ namespace rxcpp } static void SetQueue(ThreadLocalQueue* queue) { if (!!threadLocalQueue()) { - throw std::logic_error("this thread already has a queue!"); + abort(); } - // create and publish new queue + // publish new queue threadLocalQueue() = queue; } static void DestroyQueue(ThreadLocalQueue* queue) { @@ -101,7 +101,7 @@ namespace rxcpp } static void DestroyQueue() { if (!threadLocalQueue()) { - throw std::logic_error("this thread does not have a queue!"); + abort(); } DestroyQueue(threadLocalQueue()); threadLocalQueue() = nullptr; @@ -130,12 +130,10 @@ namespace rxcpp using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { - auto cancelable = std::make_shared(std::move(work)); - - CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, cancelable)); + CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, work)); - return Disposable([cancelable]{ - *cancelable.get() = nullptr;}); + // work is disposable + return work; } }; @@ -162,14 +160,12 @@ namespace rxcpp // take ownership - auto cancelable = std::make_shared(std::move(work)); - CurrentThreadQueue::EnsureQueue(std::make_shared()); RXCPP_UNWIND_AUTO([]{ CurrentThreadQueue::DestroyQueue(); }); - CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); + CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); // loop until queue is empty for ( @@ -179,8 +175,8 @@ namespace rxcpp ) { // dispatch work - auto work = std::move(*CurrentThreadQueue::top().work.get()); - *CurrentThreadQueue::top().work.get() = nullptr; + auto work = CurrentThreadQueue::top().work; + CurrentThreadQueue::pop(); Do(work, get()); @@ -197,8 +193,15 @@ namespace rxcpp private: ImmediateScheduler(const ImmediateScheduler&); + mutable std::mutex lock; + mutable bool hasFaulted; + mutable bool isAquired; + mutable CurrentThreadQueue::ThreadLocalQueue* queue; public: ImmediateScheduler() + : hasFaulted(false) + , isAquired(false) + , queue(nullptr) { } virtual ~ImmediateScheduler() @@ -208,10 +211,61 @@ namespace rxcpp using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { - auto ct = std::make_shared(); - std::this_thread::sleep_until(dueTime); - Do(work, ct); - return Disposable::Empty(); + auto item = CurrentThreadQueue::QueueItem(dueTime, std::move(work)); + bool isOwner = false; + + { + std::unique_lock guard(lock); + if (!hasFaulted && !queue && !isAquired) + { + queue = CurrentThreadQueue::CreateQueue(this->shared_from_this()).release(); + isOwner = !isAquired; + isAquired = true; + } + } + + if (isOwner) + { + RXCPP_UNWIND_AUTO([&](){ + std::unique_lock guard(lock); + CurrentThreadQueue::DestroyQueue(queue); + queue = nullptr; + isAquired = false; + }); + + for(;;) + { + std::this_thread::sleep_until(item.due); + try + { + Do(item.work, queue->scheduler); + } + catch (...) + { + std::unique_lock guard(lock); + while (!queue->queue.empty()) {queue->queue.pop();} + hasFaulted = true; + throw; + } + + { + std::unique_lock guard(lock); + if (queue->queue.empty()) + { + break; + } + item = std::move(queue->queue.top()); + queue->queue.pop(); + } + } + return Disposable::Empty(); + } + else + { + std::unique_lock guard(lock); + queue->queue.push(item); + return item.work; + } } }; @@ -223,30 +277,24 @@ namespace rxcpp typedef std::function Action; Scheduler::shared scheduler; - std::atomic trampoline; mutable std::shared_ptr> observer; mutable SerialDisposable sd; mutable std::queue queue; mutable std::mutex lock; + mutable bool hasFaulted; + mutable bool isAquired; public: ScheduledObserver(Scheduler::shared scheduler, std::shared_ptr> observer) : scheduler(std::move(scheduler)) - , trampoline(0) , observer(std::move(observer)) + , hasFaulted(false) + , isAquired(false) { } void Dispose() const { - SerialDisposable sd; - { - std::unique_lock guard(lock); - while (!queue.empty()) {queue.pop();} - using std::swap; - swap(sd, this->sd); - observer= nullptr; - } sd.Dispose(); } operator Disposable() const @@ -260,86 +308,83 @@ namespace rxcpp virtual void OnNext(const T& element) { std::unique_lock guard(lock); - auto local = this->shared_from_this(); queue.push(Action([=](){ - std::unique_lock guard(lock); - auto o = local->observer; - guard.unlock(); - if (o){ - o->OnNext(std::move(element)); - }})); + observer->OnNext(std::move(element)); + })); } virtual void OnCompleted() { std::unique_lock guard(lock); - auto local = this->shared_from_this(); queue.push(Action([=](){ - std::unique_lock guard(lock); - auto o = local->observer; - guard.unlock(); - if (o){ - o->OnCompleted(); - }})); + observer->OnCompleted(); + })); } virtual void OnError(const std::exception_ptr& error) { std::unique_lock guard(lock); - auto local = this->shared_from_this(); queue.push(Action([=](){ - std::unique_lock guard(lock); - auto o = local->observer; - guard.unlock(); - if (o){ - o->OnError(std::move(error)); - }})); + observer->OnError(std::move(error)); + })); } void EnsureActive() { - RXCPP_UNWIND_AUTO([&]{--trampoline;}); - if (++trampoline == 1) + bool isOwner = false; + + { + std::unique_lock guard(lock); + if (!hasFaulted && !queue.empty()) + { + isOwner = !isAquired; + isAquired = true; + } + } + + if (isOwner) { - // this is decremented when no further work is scheduled - ++trampoline; auto keepAlive = this->shared_from_this(); sd.Set(scheduler->Schedule( [keepAlive](Scheduler::shared sched){ return keepAlive->Run(sched);})); } } + private: Disposable Run(Scheduler::shared sched) { auto keepAlive = this->shared_from_this(); - std::unique_lock guard(lock); + Action action; + { + std::unique_lock guard(lock); + if(!queue.empty()) + { + action = std::move(queue.front()); + queue.pop(); + } + else + { + isAquired = false; + return Disposable::Empty(); + } + } - if(!queue.empty()) + try { - auto& item = queue.front(); - - // dispatch action - auto action = std::move(item); - item = nullptr; - queue.pop(); - - RXCPP_UNWIND_AUTO([&]{guard.lock();}); - guard.unlock(); action(); } - - if(!queue.empty()) + catch (...) { - guard.unlock(); - sd.Set(sched->Schedule( - [keepAlive](Scheduler::shared sched){ - return keepAlive->Run(sched);})); - return sd; + std::unique_lock guard(lock); + while (!queue.empty()) {queue.pop();} + hasFaulted = true; + throw; } - // only decrement when no further work is scheduled - --trampoline; - return Disposable::Empty(); + sd.Set(sched->Schedule( + [keepAlive](Scheduler::shared sched){ + return keepAlive->Run(sched);})); + return sd; } }; @@ -353,14 +398,14 @@ namespace rxcpp private: Derecurser(const Derecurser&); - std::atomic trampoline; + mutable bool isAquired; mutable std::mutex lock; mutable std::condition_variable wake; CurrentThreadQueue::ThreadLocalQueue* queue; public: Derecurser() - : trampoline(0) + : isAquired(false) { } virtual ~Derecurser() @@ -375,38 +420,40 @@ namespace rxcpp typedef std::tuple, Disposable> EnsureThreadResult; EnsureThreadResult EnsureThread(Factory& factory, Scheduler::shared owner, clock::time_point dueTime, Work work) { + bool isOwner = false; EnsureThreadResult result(util::maybe(), Disposable::Empty()); - auto cancelable = std::make_shared(std::move(work)); - std::get<1>(result) = Disposable([cancelable]{ - *cancelable.get() = nullptr;}); + // work is disposable + std::get<1>(result) = work; std::unique_lock guard(lock); - RXCPP_UNWIND(unwindTrampoline, [&]{ - --trampoline;}); - if (++trampoline == 1) + if (!isAquired) { RXCPP_UNWIND(unwindQueue, [&](){ CurrentThreadQueue::DestroyQueue(queue); queue = nullptr;}); queue = CurrentThreadQueue::CreateQueue(owner).release(); - queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); + queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); auto local = std::static_pointer_cast(shared_from_this()); auto localQueue = queue; std::get<0>(result).set(factory([local, localQueue]{ local->Run(localQueue);})); - // trampoline and queue lifetime is now owned by the thread - unwindTrampoline.dismiss(); + isOwner = !isAquired; + isAquired = true; + + // queue lifetime is now owned by the thread unwindQueue.dismiss(); } - else + + if (!isOwner) { - queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(cancelable))); + queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); wake.notify_one(); } + return std::move(result); } @@ -414,20 +461,22 @@ namespace rxcpp void Run(CurrentThreadQueue::ThreadLocalQueue* queue) { auto keepAlive = shared_from_this(); { - RXCPP_UNWIND_AUTO([&]{ - --trampoline;}); - std::unique_lock guard(lock); - CurrentThreadQueue::SetQueue(queue); + RXCPP_UNWIND_AUTO([&]{ + isAquired = false;}); + RXCPP_UNWIND(unwindQueue, [&](){ CurrentThreadQueue::DestroyQueue(); queue = nullptr;}); + + CurrentThreadQueue::SetQueue(queue); + #if 0 auto start = queue->scheduler->Now(); auto ms = std::chrono::milliseconds(1); #endif - while(!CurrentThreadQueue::empty() || trampoline > 1) + while(!CurrentThreadQueue::empty()) { auto now = queue->scheduler->Now(); #if 0 @@ -448,12 +497,12 @@ namespace rxcpp OutputDebugString(out.str().c_str());} #endif wake.wait(guard, [&](){ - return !CurrentThreadQueue::empty() || trampoline == 1;}); + return !CurrentThreadQueue::empty();}); continue; } auto item = &CurrentThreadQueue::top(); - if (!item->work || !*item->work.get()) { + if (!item->work) { #if 0 {std::wstringstream out; out << L"eventloop (pop disposed work) pending: " << std::boolalpha << CurrentThreadQueue::empty() @@ -490,8 +539,8 @@ namespace rxcpp OutputDebugString(out.str().c_str());} #endif // dispatch work - auto work = std::move(*item->work.get()); - *item->work.get() = nullptr; + auto work = item->work; + CurrentThreadQueue::pop(); RXCPP_UNWIND_AUTO([&]{ @@ -622,7 +671,7 @@ namespace rxcpp util::maybe next; while (!queue.empty()) { next.set(queue.top()); - if (!next->work || !*next->work) { + if (!next->work) { queue.pop(); } else { @@ -634,23 +683,20 @@ namespace rxcpp Disposable ScheduleAbsolute(Absolute dueTime, Work work) { - auto cancelable = std::make_shared(); + Work cancelable; auto run = [cancelable, work](Scheduler::shared scheduler) -> Disposable { auto local = work; - *cancelable.get() = nullptr; + cancelable.Dispose(); return Base::Do(local, std::move(scheduler)); }; - *cancelable.get() = run; + cancelable = run; auto si = QueueItem(dueTime, cancelable); queue.push(si); - auto result = Disposable([cancelable]{ - *cancelable.get() = nullptr; - }); - return result; + return cancelable; } }; -- GitLab From 9a44c66b9e9d095d61847b22985b3ad14597da54 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 01:22:53 -0800 Subject: [PATCH 134/782] add isStopped to non-variadic path --- Rx/CPP/src/cpprx/operators/Zip.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Rx/CPP/src/cpprx/operators/Zip.hpp b/Rx/CPP/src/cpprx/operators/Zip.hpp index 13a7b0f..8788bbc 100644 --- a/Rx/CPP/src/cpprx/operators/Zip.hpp +++ b/Rx/CPP/src/cpprx/operators/Zip.hpp @@ -199,10 +199,12 @@ namespace rxcpp typedef std::tuple_size SourcesSize; explicit State(S selector) : selector(std::move(selector)) + , isStopped(false) {} std::mutex lock; S selector; Queues queues; + bool isStopped; }; Sources sources(source1, source2); // bug on osx prevents using make_shared -- GitLab From 3ecc8f259e399e7112cb5fd5717bd7a7b7afb57a Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 01:24:10 -0800 Subject: [PATCH 135/782] add bug fixes for issues found on windows --- Rx/CPP/src/cpprx/rx-operators.hpp | 10 ++++++++-- Rx/CPP/src/cpprx/rx-scheduler.hpp | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index fdd81f7..97e9bc4 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -189,6 +189,9 @@ namespace rxcpp typedef std::shared_ptr> SinkObserver; mutable util::maybe cancel; + // need to prevent disposed observer from being + // deleted since it may still be in use on the stack + mutable SinkObserver expired; protected: mutable SinkObserver observer; @@ -205,7 +208,10 @@ namespace rxcpp void Dispose() const { - observer = std::make_shared>(); + expired = std::make_shared>(); + using std::swap; + swap(observer, expired); + if (cancel) { cancel->Dispose(); @@ -782,7 +788,7 @@ namespace rxcpp return Disposable([that]() { std::unique_lock guard(that->lock); - if (that->subscription) + if (!!that->subscription) { that->subscription->Dispose(); that->subscription.reset(); diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index cac1534..5f13d71 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -952,7 +952,8 @@ namespace rxcpp for (auto& message : messages) { auto notification = message.Value(); scheduler->ScheduleAbsolute(message.Time(), [this, notification](Scheduler::shared) -> Disposable { - for (auto& observer : this->observers) { + auto local = this->observers; + for (auto& observer : local) { notification->Accept(observer); } return Disposable::Empty(); -- GitLab From 7f4becf53bac4e22c763694418dff4284258d0f1 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 09:47:59 -0800 Subject: [PATCH 136/782] Wow, that was compiling - until now.. --- Rx/CPP/src/cpprx/operators/Take.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/operators/Take.hpp b/Rx/CPP/src/cpprx/operators/Take.hpp index 2ffec60..5085d9a 100644 --- a/Rx/CPP/src/cpprx/operators/Take.hpp +++ b/Rx/CPP/src/cpprx/operators/Take.hpp @@ -121,7 +121,7 @@ namespace rxcpp cd.Add(Subscribe( terminus, // on next - [=](const T& element) + [=](const U& element) { state->terminusState = TerminusState::Terminated; }, -- GitLab From 3953440f4139bd1fff0dabe4aad67f7a51d73ce4 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 09:49:38 -0800 Subject: [PATCH 137/782] Fix to avoid ICE --- Rx/CPP/src/cpprx/operators/CombineLatest.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp index cf5af07..d847f9b 100644 --- a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp +++ b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp @@ -31,7 +31,7 @@ namespace rxcpp --state->pendingFirst; } if (state->pendingFirst == 0) { - Latest args = state->latest; + auto args = state->latest; typedef decltype(util::tuple_dispatch(state->selector, args)) U; util::maybe result; try { -- GitLab From e806fc9fa74ca8c835196d26c1983a710a9bba0c Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 09:53:05 -0800 Subject: [PATCH 138/782] Fix to avoid ICE in lambdas missing 'this->' --- Rx/CPP/src/cpprx/rx-operators.hpp | 12 ++++++------ Rx/CPP/src/cpprx/rx-scheduler.hpp | 6 +++--- Rx/CPP/src/cpprx/rx-winrt.hpp | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 97e9bc4..b972ea7 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -35,8 +35,8 @@ namespace rxcpp if (!isStopped) { auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ - isStopped = true; - disposable.Dispose(); + this->isStopped = true; + this->disposable.Dispose(); }); observer->OnNext(element); disposer.dismiss(); @@ -47,7 +47,7 @@ namespace rxcpp if (!isStopped.exchange(true)) { auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ - disposable.Dispose(); + this->disposable.Dispose(); }); observer->OnCompleted(); } @@ -57,7 +57,7 @@ namespace rxcpp if (!isStopped.exchange(true)) { auto keepAlive = this->shared_from_this(); RXCPP_UNWIND(disposer, [&](){ - disposable.Dispose(); + this->disposable.Dispose(); }); observer->OnError(error); } @@ -107,7 +107,7 @@ namespace rxcpp scheduler->Schedule( [=](Scheduler::shared) -> Disposable { try { - autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); + autoDetachObserver->disposable.Set(this->subscribe(autoDetachObserver)); } catch (...) { autoDetachObserver->OnError(std::current_exception()); } @@ -259,7 +259,7 @@ namespace rxcpp scheduler->Schedule([=](Scheduler::shared) -> Disposable { state->subscription.Set( - run(that, observer, state->subscription, [=](Disposable d) + this->run(that, observer, state->subscription, [=](Disposable d) { state->sink.Set(std::move(d)); })); diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 5f13d71..410c168 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -309,21 +309,21 @@ namespace rxcpp { std::unique_lock guard(lock); queue.push(Action([=](){ - observer->OnNext(std::move(element)); + this->observer->OnNext(std::move(element)); })); } virtual void OnCompleted() { std::unique_lock guard(lock); queue.push(Action([=](){ - observer->OnCompleted(); + this->observer->OnCompleted(); })); } virtual void OnError(const std::exception_ptr& error) { std::unique_lock guard(lock); queue.push(Action([=](){ - observer->OnError(std::move(error)); + this->observer->OnError(std::move(error)); })); } diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp index 2e743b9..061e351 100644 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ b/Rx/CPP/src/cpprx/rx-winrt.hpp @@ -403,19 +403,19 @@ namespace rxcpp { namespace winrt { // select collection [=](T t) { - std::unique_lock guard(flight_lock); - inflight->OnNext(true); + std::unique_lock guard(this->flight_lock); + this->inflight->OnNext(true); return Using( // resource factory [=]() -> SerialDisposable { SerialDisposable flight; flight.Set(ScheduledDisposable( - defaultScheduler, + this->defaultScheduler, Disposable([=]() { - std::unique_lock guard(flight_lock); - inflight->OnNext(false); + std::unique_lock guard(this->flight_lock); + this->inflight->OnNext(false); }))); return flight; }, @@ -470,7 +470,7 @@ namespace rxcpp { namespace winrt { } catch (...) { - exceptions->OnError(std::current_exception()); + this->exceptions->OnError(std::current_exception()); } }, //on completed @@ -481,7 +481,7 @@ namespace rxcpp { namespace winrt { } catch (...) { - exceptions->OnError(std::current_exception()); + this->exceptions->OnError(std::current_exception()); } }, //on error @@ -492,7 +492,7 @@ namespace rxcpp { namespace winrt { } catch (...) { - exceptions->OnError(std::current_exception()); + this->exceptions->OnError(std::current_exception()); } }); } -- GitLab From 779b3e21e661e55ae6265e240fc0c5bcf8f6aa7f Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 09:54:25 -0800 Subject: [PATCH 139/782] Fix to avoid ICE by adding 'Class::' in lambda --- Rx/CPP/src/cpprx/operators/RefCount.hpp | 2 +- Rx/CPP/src/cpprx/operators/Return.hpp | 2 +- Rx/CPP/src/cpprx/operators/Scan.hpp | 2 +- Rx/CPP/src/cpprx/operators/Throw.hpp | 2 +- Rx/CPP/src/cpprx/operators/Where.hpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/RefCount.hpp b/Rx/CPP/src/cpprx/operators/RefCount.hpp index 22a8224..9638ca1 100644 --- a/Rx/CPP/src/cpprx/operators/RefCount.hpp +++ b/Rx/CPP/src/cpprx/operators/RefCount.hpp @@ -79,7 +79,7 @@ namespace rxcpp RefCountObservable(std::shared_ptr> source) : ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable&& cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(that, observer, std::move(cancel))); + auto sink = std::shared_ptr(new RefCountObservable::_(that, observer, std::move(cancel))); setSink(sink->GetDisposable()); return sink->Run(); }), diff --git a/Rx/CPP/src/cpprx/operators/Return.hpp b/Rx/CPP/src/cpprx/operators/Return.hpp index cb97075..924492f 100644 --- a/Rx/CPP/src/cpprx/operators/Return.hpp +++ b/Rx/CPP/src/cpprx/operators/Return.hpp @@ -51,7 +51,7 @@ namespace rxcpp ReturnObservable(T value, Scheduler::shared scheduler) : ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + auto sink = std::shared_ptr(new ReturnObservable::_(parent, observer, std::move(cancel))); setSink(sink->GetDisposable()); return sink->Run(); }), diff --git a/Rx/CPP/src/cpprx/operators/Scan.hpp b/Rx/CPP/src/cpprx/operators/Scan.hpp index 6247c8e..fa3b00c 100644 --- a/Rx/CPP/src/cpprx/operators/Scan.hpp +++ b/Rx/CPP/src/cpprx/operators/Scan.hpp @@ -85,7 +85,7 @@ namespace rxcpp ScanObservable(Source source, util::maybe seed, Accumulator accumulator, Seeder seeder) : ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + auto sink = std::shared_ptr(new ScanObservable::_(parent, observer, std::move(cancel))); setSink(sink->GetDisposable()); return this->source->Subscribe(sink); }), diff --git a/Rx/CPP/src/cpprx/operators/Throw.hpp b/Rx/CPP/src/cpprx/operators/Throw.hpp index df94880..13530d3 100644 --- a/Rx/CPP/src/cpprx/operators/Throw.hpp +++ b/Rx/CPP/src/cpprx/operators/Throw.hpp @@ -52,7 +52,7 @@ namespace rxcpp ThrowObservable(std::exception_ptr exception, Scheduler::shared scheduler) : ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + auto sink = std::shared_ptr(new ThrowObservable::_(parent, observer, std::move(cancel))); setSink(sink->GetDisposable()); return sink->Run(); }), diff --git a/Rx/CPP/src/cpprx/operators/Where.hpp b/Rx/CPP/src/cpprx/operators/Where.hpp index 5119cb3..d0089bd 100644 --- a/Rx/CPP/src/cpprx/operators/Where.hpp +++ b/Rx/CPP/src/cpprx/operators/Where.hpp @@ -63,7 +63,7 @@ namespace rxcpp WhereObservable(const std::shared_ptr>& source, Predicate predicate) : ProducerBase([this](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + auto sink = std::shared_ptr(new WhereObservable::_(parent, observer, std::move(cancel))); setSink(sink->GetDisposable()); return this->source->Subscribe(sink); }), -- GitLab From ece7187a87ae9bf730c0f89bdd7b0d4a247f0c11 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 09:55:07 -0800 Subject: [PATCH 140/782] Fix to avoid ICE (moved Source source to class member) --- Rx/CPP/src/cpprx/operators/Using.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Using.hpp b/Rx/CPP/src/cpprx/operators/Using.hpp index 634bfc6..d435d75 100644 --- a/Rx/CPP/src/cpprx/operators/Using.hpp +++ b/Rx/CPP/src/cpprx/operators/Using.hpp @@ -11,16 +11,16 @@ namespace rxcpp namespace detail { - template - class UsingObservable : public Producer, T> + template + class UsingObservable : public Producer, T> { - typedef UsingObservable This; + typedef UsingObservable This; typedef std::shared_ptr Parent; - typedef std::shared_ptr> Source; + typedef typename std::decay::type Source; public: typedef std::function ResourceFactory; - typedef std::function ObservableFactory; + typedef std::function ObservableFactory; private: ResourceFactory resourceFactory; @@ -29,6 +29,7 @@ namespace rxcpp class _ : public Sink<_, T>, public Observer { Parent parent; + Source source; public: typedef Sink<_, T> SinkBase; @@ -42,7 +43,6 @@ namespace rxcpp Disposable Run() { ComposableDisposable cd; - Source source; auto disposable = Disposable::Empty(); try @@ -85,7 +85,7 @@ namespace rxcpp UsingObservable(ResourceFactory resourceFactory, ObservableFactory observableFactory) : ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); + auto sink = std::shared_ptr(new UsingObservable::_(parent, observer, std::move(cancel))); setSink(sink->GetDisposable()); return sink->Run(); }), @@ -102,9 +102,10 @@ namespace rxcpp ) -> decltype(observableFactory(resourceFactory())) { - typedef typename observable_item::type T; + typedef decltype(observableFactory(resourceFactory())) ScopedObservable; + typedef typename observable_item::type T; typedef decltype(resourceFactory()) R; - return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); + return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); } } -- GitLab From 058f75e8bca0c493db3e2c3ebf41f0a44138bd33 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 18:32:10 -0800 Subject: [PATCH 141/782] add CMake build --- projects/CMake/CMakeLists.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/CMake/CMakeLists.txt diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt new file mode 100644 index 0000000..866beec --- /dev/null +++ b/projects/CMake/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 2.8) + +project(rxcpp) + +MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + list( APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS}") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + list( APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS}") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + list( APPEND CMAKE_CXX_FLAGS " /DUNICODE /D_UNICODE /bigobj ${CMAKE_CXX_FLAGS}") +endif() + +# define some folders +get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) +set(TEST_DIR ${RXCPP_DIR}/Rx/CPP/test) + +include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src) + +# define the sources of testbench +set(TESTBENCH_SOURCES + ${RXCPP_DIR}/Rx/CPP/testbench/testbench.cpp +) +add_executable(testbench ${TESTBENCH_SOURCES}) -- GitLab From 8fe8f8e4c341a336389bd3839709a4be1b0721ac Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Dec 2013 01:08:41 -0800 Subject: [PATCH 142/782] fixes root cause of the ices --- Rx/CPP/src/cpprx/rx.hpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index b1a32cd..bddfd96 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -240,16 +240,24 @@ namespace detail { } #endif //RXCPP_USE_VARIADIC_TEMPLATES #if RXCPP_USE_VARIADIC_TEMPLATES - template - auto combine_latest(S selector, const CombineLSource&... source) - -> typename std::enable_if::value, decltype(from(CombineLatest(selector, obj, observable(source)...)))>::type { - return from(CombineLatest(selector, obj, observable(source)...)); - } - template - auto combine_latest(const CombineL1Source& source, const CombineL1SourceN&... sourcen) - -> typename std::enable_if < is_observable::value, - decltype(from(CombineLatest(util::as_tuple(), obj, observable(source), observable(sourcen)...)))>::type { - return from(CombineLatest(util::as_tuple(), obj, observable(source), observable(sourcen)...)); + private: + struct selector_tag{}; + struct source_tag{}; + template + auto combine_latest_detail(selector_tag&&, CombineSelector&& selector, const CombineSelectorSources&... sources) + -> decltype(from(CombineLatest(std::forward(selector), obj, observable(sources)...))) { + return from(CombineLatest(std::forward(selector), obj, observable(sources)...)); + } + template + auto combine_latest_detail(source_tag&&, const CombineSourceSources&... sources) + -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(sources)...))) { + return from(CombineLatest(util::as_tuple(), obj, observable(sources)...)); + } + public: + template + auto combine_latest(CombineSourceOrSelector&& sourceOrSelector, const CombineSourceN&... sourcen) + -> decltype(from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), std::forward(sourcen)...))) { + return from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), std::forward(sourcen)...)); } #else template -- GitLab From 0497a527a8dd38720d3bc4ae69e11dd722eec5cc Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Dec 2013 01:09:27 -0800 Subject: [PATCH 143/782] return defaults to immediate --- Rx/CPP/src/cpprx/operators/Return.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/operators/Return.hpp b/Rx/CPP/src/cpprx/operators/Return.hpp index 924492f..da3b49b 100644 --- a/Rx/CPP/src/cpprx/operators/Return.hpp +++ b/Rx/CPP/src/cpprx/operators/Return.hpp @@ -60,7 +60,7 @@ namespace rxcpp { if (!scheduler) { - this->scheduler = std::make_shared(); + this->scheduler = std::make_shared(); } } }; -- GitLab From fd41f8489b3d455cdff1e44ee95bbf39d4920d3a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Dec 2013 01:09:59 -0800 Subject: [PATCH 144/782] add never operator --- Rx/CPP/src/cpprx/operators/Never.hpp | 22 ++++++++++++++++++++++ Rx/CPP/src/cpprx/rx-operators.hpp | 1 + 2 files changed, 23 insertions(+) create mode 100644 Rx/CPP/src/cpprx/operators/Never.hpp diff --git a/Rx/CPP/src/cpprx/operators/Never.hpp b/Rx/CPP/src/cpprx/operators/Never.hpp new file mode 100644 index 0000000..ffdd831 --- /dev/null +++ b/Rx/CPP/src/cpprx/operators/Never.hpp @@ -0,0 +1,22 @@ + // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#pragma once +#include "../rx-operators.hpp" + +#if !defined(CPPRX_RX_OPERATORS_NEVER_HPP) +#define CPPRX_RX_OPERATORS_NEVER_HPP + +namespace rxcpp +{ + template + std::shared_ptr> Never() + { + return CreateObservable( + [=](std::shared_ptr>) -> Disposable + { + return Disposable::Empty(); + }); + } +} + +#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index b972ea7..0a8d0b1 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -827,6 +827,7 @@ namespace rxcpp #include "operators/Subscribe.hpp" #include "operators/ForEach.hpp" #include "operators/Empty.hpp" +#include "operators/Never.hpp" #include "operators/Return.hpp" #include "operators/Throw.hpp" #include "operators/Range.hpp" -- GitLab From 80c46fc0fbde9574b383b5f9b66844845722399a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Dec 2013 11:33:37 -0800 Subject: [PATCH 145/782] fix for SkipUntil --- Rx/CPP/src/cpprx/operators/Skip.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/operators/Skip.hpp b/Rx/CPP/src/cpprx/operators/Skip.hpp index fb27dbb..e635b71 100644 --- a/Rx/CPP/src/cpprx/operators/Skip.hpp +++ b/Rx/CPP/src/cpprx/operators/Skip.hpp @@ -88,7 +88,7 @@ namespace rxcpp cd.Add(Subscribe( terminus, // on next - [=](const T& element) + [=](const U& element) { state->skipState = SkipState::Taking; }, -- GitLab From 2633f247e73dcb7c0aabcac91e420cf8ed6a5277 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Dec 2013 09:34:47 -0800 Subject: [PATCH 146/782] misplaced forward --- Rx/CPP/src/cpprx/rx.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index bddfd96..eab8c1b 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -256,8 +256,8 @@ namespace detail { public: template auto combine_latest(CombineSourceOrSelector&& sourceOrSelector, const CombineSourceN&... sourcen) - -> decltype(from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), std::forward(sourcen)...))) { - return from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), std::forward(sourcen)...)); + -> decltype(from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), sourcen...))) { + return from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), sourcen...)); } #else template -- GitLab From af7a85a92d177226b72ccf77c25009f8eecdba86 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 12:47:56 -0800 Subject: [PATCH 147/782] add travis ci status --- .travis.yml | 18 ++++++++++++++++++ README.md | 6 ++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..65065ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: cpp + +compiler: + - clang + +env: + - BUILD_TYPE=Debug + - BUILD_TYPE=Release + +install: + - cmake -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - cd Build + - make + - cd .. + +script: + - cd Build + - ctest -V diff --git a/README.md b/README.md index bb32490..122be88 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Reactive Extensions: +Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/RxCpp.png)](https://travis-ci.org/Reactive-Extensions/RxCpp) + * Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. * RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. * Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. @@ -15,6 +17,6 @@ #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. +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. -You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. \ No newline at end of file +You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. -- GitLab From f574b0b1536b96a1086afb0ae1c896f56bbefc92 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 13:12:07 -0800 Subject: [PATCH 148/782] allow fallback to monotonic_clock --- Rx/CPP/src/cpprx/rx-base.hpp | 2 +- Rx/CPP/src/cpprx/rx-util.hpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 1c10226..d5ed9c5 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -74,7 +74,7 @@ namespace rxcpp struct Scheduler : public std::enable_shared_from_this { - typedef std::chrono::steady_clock clock; + typedef util::scheduler_clock clock; typedef std::shared_ptr shared; class Work { diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index 92ef223..eafdd22 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -132,6 +132,13 @@ namespace rxcpp { namespace util { template struct reveal_type {private: reveal_type();}; + + template + auto find_clock(T, int) -> std::chrono::steady_clock; + template + auto find_clock(T, ...) -> std::chrono::monotonic_clock; + typedef decltype(find_clock(0, 0)) scheduler_clock; + #if RXCPP_USE_VARIADIC_TEMPLATES template struct tuple_indices; -- GitLab From cc22364bc86daa7fb2e19ecdf4758429e16dbd87 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 13:12:29 -0800 Subject: [PATCH 149/782] remove incomplete limitwindow operator --- Rx/CPP/src/cpprx/rx-operators.hpp | 48 ------------------------------- Rx/CPP/src/cpprx/rx.hpp | 3 -- 2 files changed, 51 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index 0a8d0b1..a216573 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -879,54 +879,6 @@ namespace rxcpp namespace rxcpp { - - // no more than one event ever 'milliseconds' - // TODO: oops, this is not the right definition for throttle. - template - std::shared_ptr> LimitWindow( - const std::shared_ptr>& source, - int milliseconds) - { - if (milliseconds == 0) - return source; - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - std::chrono::steady_clock::time_point dueTime; - }; - - auto state = std::make_shared(); - - return Subscribe( - source, - // on next - [=](const T& element) - { - auto now = std::chrono::steady_clock::now(); - - if (now >= state->dueTime) - { - observer->OnNext(element); - state->dueTime = now + std::chrono::duration(milliseconds); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } - - class StdQueueDispatcher { mutable std::queue> pending; diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp index eab8c1b..16bfcc1 100644 --- a/Rx/CPP/src/cpprx/rx.hpp +++ b/Rx/CPP/src/cpprx/rx.hpp @@ -399,9 +399,6 @@ namespace detail { -> decltype(from(Throttle(obj, due, scheduler))) { return from(Throttle(obj, due, scheduler)); } - auto limit_window(int milliseconds) -> decltype(from(LimitWindow(obj, milliseconds))) { - return from(LimitWindow(obj, milliseconds)); - } auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { return from(DistinctUntilChanged(obj)); } -- GitLab From e6112126769e226b07751facac68f52cd5d4949d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 13:30:04 -0800 Subject: [PATCH 150/782] Revert "allow fallback to monotonic_clock" This reverts commit f574b0b1536b96a1086afb0ae1c896f56bbefc92. --- Rx/CPP/src/cpprx/rx-base.hpp | 2 +- Rx/CPP/src/cpprx/rx-util.hpp | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index d5ed9c5..1c10226 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -74,7 +74,7 @@ namespace rxcpp struct Scheduler : public std::enable_shared_from_this { - typedef util::scheduler_clock clock; + typedef std::chrono::steady_clock clock; typedef std::shared_ptr shared; class Work { diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp index eafdd22..92ef223 100644 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ b/Rx/CPP/src/cpprx/rx-util.hpp @@ -132,13 +132,6 @@ namespace rxcpp { namespace util { template struct reveal_type {private: reveal_type();}; - - template - auto find_clock(T, int) -> std::chrono::steady_clock; - template - auto find_clock(T, ...) -> std::chrono::monotonic_clock; - typedef decltype(find_clock(0, 0)) scheduler_clock; - #if RXCPP_USE_VARIADIC_TEMPLATES template struct tuple_indices; -- GitLab From a960488c80e5e39903992548fcee4113c00f8eda Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 17 Dec 2013 15:26:03 -0800 Subject: [PATCH 151/782] fix unused parameter warning --- Rx/CPP/src/cpprx/operators/Take.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Take.hpp b/Rx/CPP/src/cpprx/operators/Take.hpp index 5085d9a..20187d4 100644 --- a/Rx/CPP/src/cpprx/operators/Take.hpp +++ b/Rx/CPP/src/cpprx/operators/Take.hpp @@ -121,7 +121,7 @@ namespace rxcpp cd.Add(Subscribe( terminus, // on next - [=](const U& element) + [=](const U& ) { state->terminusState = TerminusState::Terminated; }, @@ -131,7 +131,7 @@ namespace rxcpp state->terminusState = TerminusState::Terminated; }, // on error - [=](const std::exception_ptr& error) + [=](const std::exception_ptr& ) { state->terminusState = TerminusState::Terminated; })); -- GitLab From 104c0e5f9f37bb33a5e30bdbb60efc0fa879f5c6 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 17 Dec 2013 15:26:41 -0800 Subject: [PATCH 152/782] fix assignment on a moved-from Work. --- Rx/CPP/src/cpprx/rx-base.hpp | 82 ++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 1c10226..609265c 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -9,7 +9,7 @@ namespace rxcpp { ////////////////////////////////////////////////////////////////////// - // + // // Abstract interfaces template @@ -29,14 +29,14 @@ namespace rxcpp typedef std::function dispose_type; dispose_type dispose; public: - explicit Disposable(dispose_type disposearg) + explicit Disposable(dispose_type disposearg) : dispose(std::move(disposearg)) { disposearg = nullptr;} - Disposable(Disposable&& other) + Disposable(Disposable&& other) : dispose(std::move(other.dispose)) { other.dispose = nullptr; } Disposable& operator=(Disposable other) { - swap(other); + swap(other); return *this; } void Dispose() @@ -78,7 +78,7 @@ namespace rxcpp typedef std::shared_ptr shared; class Work { - struct bool_r{}; + struct bool_r{}; static bool_r bool_true(){return bool_r();} typedef decltype(&bool_true) bool_type; @@ -94,11 +94,19 @@ namespace rxcpp std::shared_ptr state; template - struct assign + struct assign { - void operator()(const std::shared_ptr& state, State::F fn) { + void operator()(std::shared_ptr& state, State::F fn) { + if (!state) { + state = std::make_shared(); + } state->work = std::move(fn); } + void operator()(std::shared_ptr& state, std::nullptr_t) { + if (state) { + state->work = nullptr; + } + } }; template @@ -129,11 +137,11 @@ namespace rxcpp { assign<1, std::is_same::type>::value>()(state, std::forward(fn)); return *this; - } + } inline Disposable operator()(shared s) { if (!state->disposed) { return state->work(s); - } + } return Disposable::Empty(); } inline operator bool_type() const {return (!state->disposed && !!state->work) ? &bool_true : nullptr;} @@ -161,10 +169,10 @@ namespace rxcpp }; ////////////////////////////////////////////////////////////////////// - // + // // disposables - + // reference handle type for a container for composing disposables class ComposableDisposable { @@ -175,7 +183,7 @@ namespace rxcpp std::vector disposables; std::mutex lock; bool isDisposed; - + State() : isDisposed(false) { } @@ -199,11 +207,11 @@ namespace rxcpp } return s; } - void Remove(weak_disposable w) + void Remove(weak_disposable w) { std::unique_lock guard(lock); auto s = w.lock(); - if (s) + if (s) { auto end = std::end(disposables); auto it = std::find(std::begin(disposables), end, s); @@ -222,16 +230,16 @@ namespace rxcpp isDisposed = true; auto v = std::move(disposables); guard.unlock(); - + std::for_each(v.begin(), v.end(), - [](shared_disposable& d) { + [](shared_disposable& d) { d->Dispose(); }); } } }; - + mutable std::shared_ptr state; - + public: ComposableDisposable() @@ -272,8 +280,8 @@ namespace rxcpp { Scheduler::shared scheduler; Disposable disposable; - - State(Scheduler::shared scheduler, Disposable disposable) + + State(Scheduler::shared scheduler, Disposable disposable) : scheduler(std::move(scheduler)) , disposable(std::move(disposable)) { @@ -290,13 +298,13 @@ namespace rxcpp } } }; - + std::shared_ptr state; - + ScheduledDisposable(); public: - ScheduledDisposable(Scheduler::shared scheduler, Disposable disposable) + ScheduledDisposable(Scheduler::shared scheduler, Disposable disposable) : state(new State(std::move(scheduler), std::move(disposable))) { } @@ -332,7 +340,7 @@ namespace rxcpp class SerialDisposable { - struct State + struct State { mutable Disposable disposable; mutable bool disposed; @@ -341,10 +349,10 @@ namespace rxcpp State() : disposable(Disposable::Empty()), disposed(false) {} void Set(Disposable disposeArg) const - { + { std::unique_lock guard(lock); if (!disposed) { - using std::swap; + using std::swap; swap(disposable, disposeArg); } guard.unlock(); @@ -361,12 +369,12 @@ namespace rxcpp } } }; - + mutable std::shared_ptr state; - + public: - SerialDisposable() + SerialDisposable() : state(std::make_shared()) { } @@ -439,7 +447,7 @@ namespace rxcpp clock::time_point dueTime = clock::now(); return Schedule(dueTime, std::move(work)); } - + virtual Disposable Schedule(clock::duration due, Work work) { clock::time_point dueTime = clock::now() + due; @@ -508,7 +516,7 @@ namespace rxcpp { return ScheduleAbsolute(clock_now, std::move(work)); } - + virtual Disposable Schedule(clock::duration due, Work work) { return ScheduleRelative(ToRelative(due), std::move(work)); @@ -655,7 +663,7 @@ namespace rxcpp } template - struct Notification + struct Notification { typedef std::function OnNext; typedef std::function OnCompleted; @@ -804,11 +812,11 @@ namespace rxcpp TupleDispatch(Target target) : target(std::move(target)) { } template - auto operator()(const Tuple& tuple) + auto operator()(const Tuple& tuple) -> decltype(util::tuple_dispatch(target, tuple)) { return util::tuple_dispatch(target, tuple);} template - auto operator()(const Tuple& tuple) const + auto operator()(const Tuple& tuple) const -> decltype(util::tuple_dispatch(target, tuple)) { return util::tuple_dispatch(target, tuple);} }; @@ -818,13 +826,13 @@ namespace rxcpp return TupleDispatch(std::forward(target));} template - auto DispatchTuple(Tuple&& tuple, Target&& target) -> + auto DispatchTuple(Tuple&& tuple, Target&& target) -> decltype(util::tuple_dispatch(std::forward(target), std::forward(tuple))) { return util::tuple_dispatch(std::forward(target), std::forward(tuple));} #if RXCPP_USE_VARIADIC_TEMPLATES template - auto TieTuple(T&& t) -> + auto TieTuple(T&& t) -> decltype(util::tuple_tie(std::forward(t))) { return util::tuple_tie(std::forward(t));} #endif //RXCPP_USE_VARIADIC_TEMPLATES @@ -988,7 +996,7 @@ namespace detail { std::shared_ptr> observable(const std::shared_ptr < AsyncSubject < T >> &s){ return std::static_pointer_cast < Observable < T >> (s); } template - typename subject_observable::type observable(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s){ + typename subject_observable::type observable(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s){ return std::static_pointer_cast < Observable < typename subject_item::type >> (s); } template -- GitLab From f1f22d1902fd300fca56504939fe78c0b387ff12 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 5 Dec 2013 18:20:32 -0800 Subject: [PATCH 153/782] Begin adding unittests! --- .gitignore | 2 +- Rx/CPP/test/operators/Publish.cpp | 111 +++++++++ Rx/CPP/test/operators/Where.cpp | 389 ++++++++++++++++++++++++++++++ Rx/CPP/test/test.cpp | 2 + projects/CMake/CMakeLists.txt | 20 +- 5 files changed, 522 insertions(+), 2 deletions(-) create mode 100644 Rx/CPP/test/operators/Publish.cpp create mode 100644 Rx/CPP/test/operators/Where.cpp create mode 100644 Rx/CPP/test/test.cpp diff --git a/.gitignore b/.gitignore index ca7abf5..7156fda 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,4 @@ Desktop.ini ############ projects/* -!projects/CMake/CMakelists.txt +!projects/CMake/CMakeLists.txt diff --git a/Rx/CPP/test/operators/Publish.cpp b/Rx/CPP/test/operators/Publish.cpp new file mode 100644 index 0000000..26e6e5b --- /dev/null +++ b/Rx/CPP/test/operators/Publish.cpp @@ -0,0 +1,111 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("publish_last", "[publish_last][publish][multicast][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(110, 7), + m::OnNext(220, 3), + m::OnNext(280, 4), + m::OnNext(290, 1), + m::OnNext(340, 8), + m::OnNext(360, 5), + m::OnNext(370, 6), + m::OnNext(390, 7), + m::OnNext(410, 13), + m::OnNext(430, 2), + m::OnNext(450, 9), + m::OnNext(520, 11), + m::OnNext(560, 20), + m::OnCompleted(600) + }; + return m::ToVector(messages); + }() + ); + + auto res = scheduler->CreateObserver(); + + rx::SerialDisposable subscription; + std::shared_ptr> ys; + + WHEN("subscribed and then connected"){ + + scheduler->ScheduleAbsolute(rx::TestScheduler::Created, + [&invoked, &ys, &xs](rx::Scheduler::shared) { + ys = rx::observable(rx::from(xs) + .publish_last()); + return rx::Disposable::Empty(); + }); + + scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&subscription, &ys, &res](rx::Scheduler::shared) { + subscription.Set(ys->Subscribe(res)); + return rx::Disposable::Empty(); + }); + + scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&subscription](rx::Scheduler::shared) { + subscription.Dispose(); + return rx::Disposable::Empty(); + }); + + auto connection = std::make_shared(); + scheduler->ScheduleAbsolute(300, [connection, &ys](rx::Scheduler::shared) { + connection->Set(ys->Connect()); + return rx::Disposable::Empty(); + }); + scheduler->ScheduleAbsolute(400, [connection](rx::Scheduler::shared) { + connection->Dispose(); + return rx::Disposable::Empty(); + }); + + connection = std::make_shared(); + scheduler->ScheduleAbsolute(500, [connection, &ys](rx::Scheduler::shared) { + connection->Set(ys->Connect()); + return rx::Disposable::Empty(); + }); + scheduler->ScheduleAbsolute(550, [connection](rx::Scheduler::shared) { + connection->Dispose(); + return rx::Disposable::Empty(); + }); + + connection = std::make_shared(); + scheduler->ScheduleAbsolute(650, [connection, &ys](rx::Scheduler::shared) { + connection->Set(ys->Connect()); + return rx::Disposable::Empty(); + }); + scheduler->ScheduleAbsolute(800, [connection](rx::Scheduler::shared) { + connection->Dispose(); + return rx::Disposable::Empty(); + }); + + scheduler->Start(); + + THEN("the output is empty"){ + std::vector required; + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there were 3 subscription/unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(300, 400), + m::Subscribe(500, 550), + m::Subscribe(650, 800) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + diff --git a/Rx/CPP/test/operators/Where.cpp b/Rx/CPP/test/operators/Where.cpp new file mode 100644 index 0000000..36cee52 --- /dev/null +++ b/Rx/CPP/test/operators/Where.cpp @@ -0,0 +1,389 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +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("where stops on completion", "[where][filter][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(110, 1), + m::OnNext(180, 2), + m::OnNext(230, 3), + m::OnNext(270, 4), + m::OnNext(340, 5), + m::OnNext(380, 6), + m::OnNext(390, 7), + m::OnNext(450, 8), + m::OnNext(470, 9), + m::OnNext(560, 10), + m::OnNext(580, 11), + m::OnCompleted(600), + m::OnNext(610, 12), + m::OnError(620, std::exception()), + m::OnCompleted(630) + }; + return m::ToVector(messages); + }() + ); + + WHEN("filtered to longs that are primes"){ + + auto res = scheduler->Start( + [xs, &invoked]() { + return rx::observable(rx::from(xs) + .where([&invoked](long x) { + invoked++; + return IsPrime(x); + })); + } + ); + + THEN("the output only contains primes"){ + m::RecordedT items[] = { + m::OnNext(230, 3), + m::OnNext(340, 5), + m::OnNext(390, 7), + m::OnNext(580, 11), + m::OnCompleted(600) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 600) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until completed"){ + REQUIRE(9 == invoked); + } + } + } +} + +SCENARIO("where stops on disposal", "[where][filter][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(110, 1), + m::OnNext(180, 2), + m::OnNext(230, 3), + m::OnNext(270, 4), + m::OnNext(340, 5), + m::OnNext(380, 6), + m::OnNext(390, 7), + m::OnNext(450, 8), + m::OnNext(470, 9), + m::OnNext(560, 10), + m::OnNext(580, 11), + m::OnCompleted(600) + }; + return m::ToVector(messages); + }() + ); + + WHEN("filtered to longs that are primes"){ + + auto res = scheduler->Start( + [xs, &invoked]() { + return rx::observable(rx::from(xs) + .where([&invoked](long x) { + invoked++; + return IsPrime(x); + })); + }, + 400 + ); + + THEN("the output only contains primes that arrived before disposal"){ + m::RecordedT items[] = { + m::OnNext(230, 3), + m::OnNext(340, 5), + m::OnNext(390, 7) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 400) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(5 == invoked); + } + } + } +} + +SCENARIO("where stops on error", "[where][filter][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + std::exception ex; + + auto xs = scheduler->CreateHotObservable( + [ex]() { + m::RecordedT messages[] = { + m::OnNext(110, 1), + m::OnNext(180, 2), + m::OnNext(230, 3), + m::OnNext(270, 4), + m::OnNext(340, 5), + m::OnNext(380, 6), + m::OnNext(390, 7), + m::OnNext(450, 8), + m::OnNext(470, 9), + m::OnNext(560, 10), + m::OnNext(580, 11), + m::OnError(600, ex), + m::OnNext(610, 12), + m::OnError(620, std::exception()), + m::OnCompleted(630) + }; + return m::ToVector(messages); + }() + ); + + WHEN("filtered to longs that are primes"){ + + auto res = scheduler->Start( + [xs, &invoked]() { + return rx::observable(rx::from(xs) + .where([&invoked](long x) { + invoked++; + return IsPrime(x); + })); + } + ); + + THEN("the output only contains primes"){ + m::RecordedT items[] = { + m::OnNext(230, 3), + m::OnNext(340, 5), + m::OnNext(390, 7), + m::OnNext(580, 11), + m::OnError(600, ex), + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 600) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until error"){ + REQUIRE(9 == invoked); + } + } + } +} + +SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + std::exception ex; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(110, 1), + m::OnNext(180, 2), + m::OnNext(230, 3), + m::OnNext(270, 4), + m::OnNext(340, 5), + m::OnNext(380, 6), + m::OnNext(390, 7), + m::OnNext(450, 8), + m::OnNext(470, 9), + m::OnNext(560, 10), + m::OnNext(580, 11), + m::OnCompleted(600), + m::OnNext(610, 12), + m::OnError(620, std::exception()), + m::OnCompleted(630) + }; + return m::ToVector(messages); + }() + ); + + WHEN("filtered to longs that are primes"){ + + auto res = scheduler->Start( + [ex, xs, &invoked]() { + return rx::observable(rx::from(xs) + .where([ex, &invoked](long x) { + invoked++; + if (x > 5) { + throw ex; + } + return IsPrime(x); + })); + } + ); + + THEN("the output only contains primes"){ + m::RecordedT items[] = { + m::OnNext(230, 3), + m::OnNext(340, 5), + m::OnError(380, ex) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 380) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until error"){ + REQUIRE(4 == invoked); + } + } + } +} + +SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ + GIVEN("a test hot observable of longs"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(110, 1), + m::OnNext(180, 2), + m::OnNext(230, 3), + m::OnNext(270, 4), + m::OnNext(340, 5), + m::OnNext(380, 6), + m::OnNext(390, 7), + m::OnNext(450, 8), + m::OnNext(470, 9), + m::OnNext(560, 10), + m::OnNext(580, 11), + m::OnCompleted(600), + m::OnNext(610, 12), + m::OnError(620, std::exception()), + m::OnCompleted(630) + }; + return m::ToVector(messages); + }() + ); + + auto res = scheduler->CreateObserver(); + + rx::SerialDisposable d; + std::shared_ptr> ys; + + WHEN("filtered to longs that are primes"){ + + scheduler->ScheduleAbsolute(rx::TestScheduler::Created, + [&invoked, &d, &ys, &xs](rx::Scheduler::shared) { + ys = rx::observable(rx::from(xs) + .where([&invoked, &d](long x) { + invoked++; + if (x == 8) + d.Dispose(); + return IsPrime(x); + })); + return rx::Disposable::Empty(); + }); + + scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&d, &ys, &res](rx::Scheduler::shared) { + d.Set(ys->Subscribe(res)); + return rx::Disposable::Empty(); + }); + + scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&d](rx::Scheduler::shared) { + d.Dispose(); + return rx::Disposable::Empty(); + }); + + scheduler->Start(); + + THEN("the output only contains primes"){ + m::RecordedT items[] = { + m::OnNext(230, 3), + m::OnNext(340, 5), + m::OnNext(390, 7) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 450) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(6 == invoked); + } + } + } +} + diff --git a/Rx/CPP/test/test.cpp b/Rx/CPP/test/test.cpp new file mode 100644 index 0000000..0c7c351 --- /dev/null +++ b/Rx/CPP/test/test.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include "catch.hpp" diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 866beec..4080292 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -17,10 +17,28 @@ get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) set(TEST_DIR ${RXCPP_DIR}/Rx/CPP/test) -include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src) +include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src) + +# define the sources of the self test +set(TEST_SOURCES + ${TEST_DIR}/test.cpp + ${TEST_DIR}/operators/Publish.cpp + ${TEST_DIR}/operators/Where.cpp +) +add_executable(rxcpp_test ${TEST_SOURCES}) # define the sources of testbench set(TESTBENCH_SOURCES ${RXCPP_DIR}/Rx/CPP/testbench/testbench.cpp ) add_executable(testbench ${TESTBENCH_SOURCES}) + +# configure unit tests via CTest +enable_testing() +add_test(NAME RunTests COMMAND rxcpp_test) + +add_test(NAME ListTests COMMAND rxcpp_test --list-tests) +set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + +add_test(NAME ListTags COMMAND rxcpp_test --list-tags) +set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") -- GitLab From ad5e1f1ac8c50bafe19dad0d8faa8e2d8b729cf9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Dec 2013 09:36:43 -0800 Subject: [PATCH 154/782] add nuget package description Conflicts: .gitignore --- .gitignore | 1 + projects/nuget/rxcpp.autoconfig | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 projects/nuget/rxcpp.autoconfig diff --git a/.gitignore b/.gitignore index 7156fda..6fe9162 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,4 @@ Desktop.ini projects/* !projects/CMake/CMakeLists.txt +!projects/nuget/rxcpp.autopackage diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig new file mode 100644 index 0000000..640c1c9 --- /dev/null +++ b/projects/nuget/rxcpp.autoconfig @@ -0,0 +1,31 @@ +nuget { + nuspec { + id = rxcpp; + version : 2.2.1.0; + title: Reactive Extensions for C++; + authors: {Microsoft Open Technologies Inc.}; + owners: {Microsoft Open Technologies Inc.}; + licenseUrl: "http://rxcpp.codeplex.com/license"; + projectUrl: "https://rxcpp.codeplex.com/"; + iconUrl: "http://download-codeplex.sec.s-msft.com/Download?ProjectName=rx&DownloadId=604538&Build=20828"; + requireLicenseAcceptance:false; + summary: "The Reactive Extensions (Rx) asynchronous programming library"; + description: @"The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and operators. Operators are the asynchronous form of standard library algorithms and they operate on Observables instead of iterators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize the concurrency in the asynchronous data streams using Schedulers."; + releaseNotes: "This release has many new operators and schedulers. Also some preliminary ssupprot for MVVM in WinRT."; + copyright: Copyright 2013; + tags: { RXCPP, RXC++, RX, native, MSOpenTech}; + }; + + files { + + #defines { + SDK_RX = ..\..\; + } + include: { "${SDK_RX}Rx\CPP\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; + docs: { ${SDK_RX}Readme.html }; + } + + targets { + Defines += HAS_RXCPP; + } +} -- GitLab From 8318bd7a707214df241dba2b0554a9d908b5901c Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 11 Dec 2013 07:43:03 -0800 Subject: [PATCH 155/782] add license.txt and authors.txt to nuget package --- projects/nuget/rxcpp.autoconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index 640c1c9..cdd6602 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -22,7 +22,7 @@ nuget { SDK_RX = ..\..\; } include: { "${SDK_RX}Rx\CPP\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; - docs: { ${SDK_RX}Readme.html }; + docs: { ${SDK_RX}Readme.html, ${SDK_RX}AUTHORS.txt, ${SDK_RX}Rx\CPP\license.txt }; } targets { -- GitLab From c3325e3499d56a79b292785a5e12da6fda030ea6 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 11 Dec 2013 07:57:55 -0800 Subject: [PATCH 156/782] add dependency on the Catch unittest library --- .gitmodules | 3 +++ ext/catch | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 ext/catch diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2dcede7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ext/catch"] + path = ext/catch + url = https://github.com/philsquared/Catch.git diff --git a/ext/catch b/ext/catch new file mode 160000 index 0000000..8ba6555 --- /dev/null +++ b/ext/catch @@ -0,0 +1 @@ +Subproject commit 8ba6555acd25da27cc9d8210119c0c57edac4704 -- GitLab From a76c632e517844c2083c85f29efb77040c2a5520 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 11 Dec 2013 08:52:35 -0800 Subject: [PATCH 157/782] Added Return tests --- Rx/CPP/test/operators/Return.cpp | 119 +++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 120 insertions(+) create mode 100644 Rx/CPP/test/operators/Return.cpp diff --git a/Rx/CPP/test/operators/Return.cpp b/Rx/CPP/test/operators/Return.cpp new file mode 100644 index 0000000..44c38cf --- /dev/null +++ b/Rx/CPP/test/operators/Return.cpp @@ -0,0 +1,119 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("return basic", "[return][operators]"){ + GIVEN("return 42"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + auto res = scheduler->Start( + [=]() { + return rx::Return(42, scheduler); + } + ); + + WHEN("started"){ + + THEN("the output is 42"){ + m::RecordedT items[] = { + m::OnNext(201, 42), + m::OnCompleted(201) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("return disposed", "[return][operators]"){ + GIVEN("test scheduler"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + WHEN("return 42 after disposed"){ + auto res = scheduler->Start( + [&]() { + return rx::Return(42, scheduler); + }, + 200 + ); + + THEN("the output is empty"){ + std::vector required; + auto actual = res->Messages(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("return disposed after next", "[return][operators]"){ + GIVEN("return 42 after disposal"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + rx::SerialDisposable d; + + auto xs = rx::Return(42, scheduler); + + auto res = scheduler->CreateObserver(); + + scheduler->ScheduleAbsolute( + 100, + [&](rx::Scheduler::shared) { + d.Set(from(xs).subscribe( + [&](int x){ + d.Dispose(); res->OnNext(x);}, + [&](){ + res->OnCompleted();}, + [&](std::exception_ptr ex){ + res->OnError(ex);})); + return d; + } + ); + + WHEN("started"){ + + scheduler->Start(); + + THEN("the output is 42"){ + m::RecordedT items[] = { + m::OnNext(101, 42) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("return observer throws", "[return][operators]"){ + GIVEN("return 42"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + auto xs = rx::Return(42, scheduler); + + WHEN("subscribed to onnext that throws"){ + from(xs).subscribe([](int){ throw std::runtime_error("onnext throws"); }); + + THEN("the exception is not supressed"){ + REQUIRE_THROWS(scheduler->Start()); + } + } + + WHEN("subscribed to oncompleted that throws"){ + from(xs).subscribe([](int){},[](){ throw std::runtime_error("oncompleted throws"); }); + + THEN("the exception is not supressed"){ + REQUIRE_THROWS(scheduler->Start()); + } + } + } +} + diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 4080292..c3afa34 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -22,6 +22,7 @@ include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXC # define the sources of the self test set(TEST_SOURCES ${TEST_DIR}/test.cpp + ${TEST_DIR}/operators/Return.cpp ${TEST_DIR}/operators/Publish.cpp ${TEST_DIR}/operators/Where.cpp ) -- GitLab From 3610224d8e1aacb346cdd967ceaa95cb3d622456 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 06:48:19 -0800 Subject: [PATCH 158/782] add editor config, install plugin for your editor to use it. --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8ac3f31 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true -- GitLab From dd18b7e7bff4866fcef1f56a3b0f56ae550f5643 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 09:51:00 -0800 Subject: [PATCH 159/782] enable Throw operator to take any type and make a std::exception_ptr --- Rx/CPP/src/cpprx/operators/Throw.hpp | 35 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Throw.hpp b/Rx/CPP/src/cpprx/operators/Throw.hpp index 13530d3..1d39351 100644 --- a/Rx/CPP/src/cpprx/operators/Throw.hpp +++ b/Rx/CPP/src/cpprx/operators/Throw.hpp @@ -65,15 +65,40 @@ namespace rxcpp } } }; + + struct throw_ptr_tag{}; + struct throw_instance_tag{}; + + template + std::shared_ptr> Throw( + throw_ptr_tag&&, + std::exception_ptr exception, + Scheduler::shared scheduler = nullptr + ) + { + return std::make_shared>(std::move(exception), std::move(scheduler)); + } + + template + std::shared_ptr> Throw( + throw_instance_tag&&, + E e, + Scheduler::shared scheduler = nullptr + ) + { + std::exception_ptr exception; + try {throw e;} catch(...) {exception = std::current_exception();} + return std::make_shared>(std::move(exception), std::move(scheduler)); + } } - template - const std::shared_ptr> Throw( - std::exception_ptr exception, + template + std::shared_ptr> Throw( + E e, Scheduler::shared scheduler = nullptr ) { - return std::make_shared>(std::move(exception), std::move(scheduler)); + return detail::Throw(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::forward(e), std::move(scheduler)); } } -#endif \ No newline at end of file +#endif -- GitLab From eff65b25d387922d2b57c8e5b0ae173f703b0d31 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 09:51:31 -0800 Subject: [PATCH 160/782] switch from longs to ints --- Rx/CPP/test/operators/Where.cpp | 74 ++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/Rx/CPP/test/operators/Where.cpp b/Rx/CPP/test/operators/Where.cpp index 36cee52..ddfbb3a 100644 --- a/Rx/CPP/test/operators/Where.cpp +++ b/Rx/CPP/test/operators/Where.cpp @@ -8,21 +8,21 @@ bool IsPrime(int x) if (x < 2) return false; for (int i = 2; i <= x/2; ++i) { - if (x % i == 0) + if (x % i == 0) return false; } return true; } SCENARIO("where stops on completion", "[where][filter][operators]"){ - GIVEN("a test hot observable of longs"){ + GIVEN("a test hot observable of ints"){ auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages m; long invoked = 0; auto xs = scheduler->CreateHotObservable( - []() { + []() { m::RecordedT messages[] = { m::OnNext(110, 1), m::OnNext(180, 2), @@ -44,12 +44,12 @@ SCENARIO("where stops on completion", "[where][filter][operators]"){ }() ); - WHEN("filtered to longs that are primes"){ + WHEN("filtered to ints that are primes"){ - auto res = scheduler->Start( + auto res = scheduler->Start( [xs, &invoked]() { return rx::observable(rx::from(xs) - .where([&invoked](long x) { + .where([&invoked](int x) { invoked++; return IsPrime(x); })); @@ -86,14 +86,14 @@ SCENARIO("where stops on completion", "[where][filter][operators]"){ } SCENARIO("where stops on disposal", "[where][filter][operators]"){ - GIVEN("a test hot observable of longs"){ + GIVEN("a test hot observable of ints"){ auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages m; long invoked = 0; auto xs = scheduler->CreateHotObservable( - []() { + []() { m::RecordedT messages[] = { m::OnNext(110, 1), m::OnNext(180, 2), @@ -112,12 +112,12 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ }() ); - WHEN("filtered to longs that are primes"){ + WHEN("filtered to ints that are primes"){ - auto res = scheduler->Start( + auto res = scheduler->Start( [xs, &invoked]() { return rx::observable(rx::from(xs) - .where([&invoked](long x) { + .where([&invoked](int x) { invoked++; return IsPrime(x); })); @@ -153,16 +153,16 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ } SCENARIO("where stops on error", "[where][filter][operators]"){ - GIVEN("a test hot observable of longs"){ + GIVEN("a test hot observable of ints"){ auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages m; long invoked = 0; std::exception ex; auto xs = scheduler->CreateHotObservable( - [ex]() { + [ex]() { m::RecordedT messages[] = { m::OnNext(110, 1), m::OnNext(180, 2), @@ -184,12 +184,12 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ }() ); - WHEN("filtered to longs that are primes"){ + WHEN("filtered to ints that are primes"){ - auto res = scheduler->Start( + auto res = scheduler->Start( [xs, &invoked]() { return rx::observable(rx::from(xs) - .where([&invoked](long x) { + .where([&invoked](int x) { invoked++; return IsPrime(x); })); @@ -226,16 +226,16 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ } SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ - GIVEN("a test hot observable of longs"){ + GIVEN("a test hot observable of ints"){ auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages m; long invoked = 0; std::exception ex; auto xs = scheduler->CreateHotObservable( - []() { + []() { m::RecordedT messages[] = { m::OnNext(110, 1), m::OnNext(180, 2), @@ -257,12 +257,12 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ }() ); - WHEN("filtered to longs that are primes"){ + WHEN("filtered to ints that are primes"){ - auto res = scheduler->Start( + auto res = scheduler->Start( [ex, xs, &invoked]() { return rx::observable(rx::from(xs) - .where([ex, &invoked](long x) { + .where([ex, &invoked](int x) { invoked++; if (x > 5) { throw ex; @@ -300,14 +300,14 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ } SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ - GIVEN("a test hot observable of longs"){ + GIVEN("a test hot observable of ints"){ auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages m; long invoked = 0; auto xs = scheduler->CreateHotObservable( - []() { + []() { m::RecordedT messages[] = { m::OnNext(110, 1), m::OnNext(180, 2), @@ -329,17 +329,17 @@ SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ }() ); - auto res = scheduler->CreateObserver(); + auto res = scheduler->CreateObserver(); rx::SerialDisposable d; - std::shared_ptr> ys; + std::shared_ptr> ys; - WHEN("filtered to longs that are primes"){ + WHEN("filtered to ints that are primes"){ - scheduler->ScheduleAbsolute(rx::TestScheduler::Created, - [&invoked, &d, &ys, &xs](rx::Scheduler::shared) { + scheduler->ScheduleAbsolute(rx::TestScheduler::Created, + [&invoked, &d, &ys, &xs](rx::Scheduler::shared) { ys = rx::observable(rx::from(xs) - .where([&invoked, &d](long x) { + .where([&invoked, &d](int x) { invoked++; if (x == 8) d.Dispose(); @@ -348,13 +348,13 @@ SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ return rx::Disposable::Empty(); }); - scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&d, &ys, &res](rx::Scheduler::shared) { + scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&d, &ys, &res](rx::Scheduler::shared) { d.Set(ys->Subscribe(res)); return rx::Disposable::Empty(); }); - scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&d](rx::Scheduler::shared) { - d.Dispose(); + scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&d](rx::Scheduler::shared) { + d.Dispose(); return rx::Disposable::Empty(); }); -- GitLab From 071fed3aa211a33acdfc607ebd90678bd72c4843 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 09:52:07 -0800 Subject: [PATCH 161/782] Duplicate some more logic for exception handling --- Rx/CPP/src/cpprx/rx-operators.hpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp index a216573..cbef605 100644 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ b/Rx/CPP/src/cpprx/rx-operators.hpp @@ -75,6 +75,19 @@ namespace rxcpp local->Dispose(); }); } + + bool Fail(const std::exception_ptr& error) + { + if (!isStopped.exchange(true)) { + auto keepAlive = this->shared_from_this(); + RXCPP_UNWIND(disposer, [&](){ + this->disposable.Dispose(); + }); + observer->OnError(error); + return true; + } + return false; + } }; template @@ -109,7 +122,9 @@ namespace rxcpp try { autoDetachObserver->disposable.Set(this->subscribe(autoDetachObserver)); } catch (...) { - autoDetachObserver->OnError(std::current_exception()); + if (!autoDetachObserver->Fail(std::current_exception())) { + throw; + } } return Disposable::Empty(); } @@ -120,7 +135,9 @@ namespace rxcpp autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); return *autoDetachObserver; } catch (...) { - autoDetachObserver->OnError(std::current_exception()); + if (!autoDetachObserver->Fail(std::current_exception())) { + throw; + } } return *autoDetachObserver; } -- GitLab From f3b2be75c9fa878ebc2081a867707b17d27321e7 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 09:52:35 -0800 Subject: [PATCH 162/782] reimplement the select operator --- Rx/CPP/src/cpprx/operators/Select.hpp | 107 +++++++++++++++++--------- 1 file changed, 72 insertions(+), 35 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Select.hpp b/Rx/CPP/src/cpprx/operators/Select.hpp index 42d40be..608d911 100644 --- a/Rx/CPP/src/cpprx/operators/Select.hpp +++ b/Rx/CPP/src/cpprx/operators/Select.hpp @@ -9,44 +9,81 @@ namespace rxcpp { - template + namespace detail + { + template + class SelectObservable : public Producer, Tout> + { + typedef SelectObservable Self; + typedef std::shared_ptr Parent; + typedef std::function Selector; + + std::shared_ptr> source; + Selector selector; + + class _ : public Sink<_, Tout>, public Observer + { + Parent parent; + + public: + typedef Sink<_, Tout> SinkBase; + + _(Parent parent, std::shared_ptr < Observer < Tout >> observer, Disposable cancel) : + SinkBase(std::move(observer), std::move(cancel)), + parent(parent) + { + } + + virtual void OnNext(const Tin& t) + { + util::maybe result; + try { + result.set(parent->selector(t)); + } catch (...) { + SinkBase::observer->OnError(std::current_exception()); + SinkBase::Dispose(); + } + if (!!result) { + SinkBase::observer->OnNext(*result.get()); + } + } + virtual void OnCompleted() + { + SinkBase::observer->OnCompleted(); + SinkBase::Dispose(); + } + virtual void OnError(const std::exception_ptr& e) + { + SinkBase::observer->OnError(e); + SinkBase::Dispose(); + } + }; + + typedef Producer ProducerBase; + public: + + SelectObservable(const std::shared_ptr>& source, Selector selector) : + ProducerBase([this](Parent parent, std::shared_ptr < Observer < Tout >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable + { + auto sink = std::shared_ptr(new Self::_(parent, observer, std::move(cancel))); + setSink(sink->GetDisposable()); + return this->source->Subscribe(sink); + }), + source(source), + selector(std::move(selector)) + { + } + }; + } + template auto Select( - const std::shared_ptr>& source, + const std::shared_ptr>& source, S selector - ) - -> const std::shared_ptr::type>> + ) -> const std::shared_ptr::type>> { - typedef typename std::result_of::type U; - return CreateObservable( - [=](std::shared_ptr> observer) - { - return Subscribe( - source, - // on next - [=](const T& element) - { - util::maybe result; - try { - result.set(selector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); + typedef typename std::result_of::type Tout; + return std::make_shared>(source, std::move(selector)); } } -#endif \ No newline at end of file +#endif -- GitLab From 0f61f3bc202e6854d8daefabc0ba74752ed0f8ae Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 12 Dec 2013 09:52:59 -0800 Subject: [PATCH 163/782] add Select unittests --- Rx/CPP/test/operators/Select.cpp | 181 +++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 3 +- 2 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 Rx/CPP/test/operators/Select.cpp diff --git a/Rx/CPP/test/operators/Select.cpp b/Rx/CPP/test/operators/Select.cpp new file mode 100644 index 0000000..2de7f21 --- /dev/null +++ b/Rx/CPP/test/operators/Select.cpp @@ -0,0 +1,181 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("select throws", "[select][map][operators]"){ + GIVEN("select"){ + WHEN("subscribed to onnext that throws"){ + THEN("the exception is not supressed"){ + auto next_throws = [](int){ + throw std::runtime_error("onnext throws"); }; + REQUIRE_THROWS(from(rx::Return(1)) + .select([](int v){return v;}) + .subscribe(next_throws)); + } + } + + WHEN("subscribed to throw operator"){ + THEN("the exception is not supressed"){ + REQUIRE_THROWS(from(rx::Throw(std::runtime_error("throw operator"))) + .select([](int v){return v;}) + .subscribe([](int){}, [](){}, [](std::exception_ptr){ throw std::runtime_error("onerror throws"); })); + } + } + + WHEN("subscribed to oncompleted that throws"){ + THEN("the exception is not supressed"){ + REQUIRE_THROWS(from(rx::Empty()) + .select([](int v){return v;}) + .subscribe([](int){}, [](){ throw std::runtime_error("oncompleted throws"); }, [](std::exception_ptr){})); + } + } + } +} + +SCENARIO("select should throw", "[select][map][operators][hide]"){ + GIVEN("select"){ + WHEN("subscribe throws"){ + THEN("the exception is not supressed"){ + // not yet sure why this fails + auto subscribe_throws = [](std::shared_ptr> observer) -> rxcpp::Disposable { + throw std::runtime_error("subscribe throws"); }; + REQUIRE_THROWS(from(rx::CreateObservable(subscribe_throws)) + .select([](int v){return v;}) + .subscribe([](int){})); + } + } + } +} + +SCENARIO("select stops on completion", "[select][map][operators]"){ + GIVEN("a test hot observable of ints"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(180, 1), + m::OnNext(210, 2), + m::OnNext(240, 3), + m::OnNext(290, 4), + m::OnNext(350, 5), + m::OnCompleted(400), + m::OnNext(410, -1), + m::OnCompleted(420), + m::OnError(430, std::exception()) + }; + return m::ToVector(messages); + }() + ); + + WHEN("mapped to ints that are one larger"){ + + auto res = scheduler->Start( + [xs, &invoked]() { + return rx::observable(rx::from(xs) + .select([&invoked](int x) { + invoked++; + return x + 1; + })); + } + ); + + THEN("the output only contains primes"){ + m::RecordedT items[] = { + m::OnNext(210, 3), + m::OnNext(240, 4), + m::OnNext(290, 5), + m::OnNext(350, 6), + m::OnCompleted(400), + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(200, 400) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until completed"){ + REQUIRE(4 == invoked); + } + } + } +} + +SCENARIO("select stops on disposal", "[select][map][operators]"){ + GIVEN("a test hot observable of ints"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + long invoked = 0; + + auto xs = scheduler->CreateHotObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(100, 1), + m::OnNext(200, 2), + m::OnNext(500, 3), + m::OnNext(600, 4) + }; + return m::ToVector(messages); + }() + ); + + auto res = scheduler->CreateObserver(); + + WHEN("the ints are identity mapped"){ + + rx::SerialDisposable d; + + d.Set(observable(from(xs) + .select([&](int x) { + invoked++; + if (scheduler->Clock() > 400) { + d.Dispose(); + } + return x; + })) + ->Subscribe(observer(res)) + ); + + scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&](rx::Scheduler::shared) { + d.Dispose(); return rx::Disposable::Empty();}); + + scheduler->Start(); + + THEN("the output only contains values that arrived before disposal"){ + m::RecordedT items[] = { + m::OnNext(100, 1), + m::OnNext(200, 2) + }; + auto required = m::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rx::Subscription items[] = { + m::Subscribe(0, 500) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("select was called until disposed"){ + REQUIRE(3 == invoked); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index c3afa34..bf85ff3 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -23,8 +23,9 @@ include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXC set(TEST_SOURCES ${TEST_DIR}/test.cpp ${TEST_DIR}/operators/Return.cpp - ${TEST_DIR}/operators/Publish.cpp + ${TEST_DIR}/operators/Select.cpp ${TEST_DIR}/operators/Where.cpp + ${TEST_DIR}/operators/Publish.cpp ) add_executable(rxcpp_test ${TEST_SOURCES}) -- GitLab From b62cd524c35deb0158c0ab979e84102c097a862b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 13 Dec 2013 21:56:31 -0800 Subject: [PATCH 164/782] update nuget settings --- projects/nuget/rxcpp.autoconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index cdd6602..b354d6c 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -1,19 +1,19 @@ nuget { nuspec { id = rxcpp; - version : 2.2.1.0; + version : 1.0.0; title: Reactive Extensions for C++; authors: {Microsoft Open Technologies Inc.}; owners: {Microsoft Open Technologies Inc.}; licenseUrl: "http://rxcpp.codeplex.com/license"; projectUrl: "https://rxcpp.codeplex.com/"; - iconUrl: "http://download-codeplex.sec.s-msft.com/Download?ProjectName=rx&DownloadId=604538&Build=20828"; + iconUrl: "http://go.microsoft.com/fwlink/?LinkId=261274"; requireLicenseAcceptance:false; summary: "The Reactive Extensions (Rx) asynchronous programming library"; description: @"The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and operators. Operators are the asynchronous form of standard library algorithms and they operate on Observables instead of iterators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize the concurrency in the asynchronous data streams using Schedulers."; - releaseNotes: "This release has many new operators and schedulers. Also some preliminary ssupprot for MVVM in WinRT."; + releaseNotes: "This release has many new operators and schedulers. Also some preliminary support for MVVM in WinRT."; copyright: Copyright 2013; - tags: { RXCPP, RXC++, RX, native, MSOpenTech}; + tags: { RxCpp, RxC++, Rx, Reactive, Observable, Functional, native}; }; files { @@ -24,7 +24,7 @@ nuget { include: { "${SDK_RX}Rx\CPP\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; docs: { ${SDK_RX}Readme.html, ${SDK_RX}AUTHORS.txt, ${SDK_RX}Rx\CPP\license.txt }; } - + targets { Defines += HAS_RXCPP; } -- GitLab From 5969b968e5251cd5a3b631dbcd8488d00c1140a8 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 13 Dec 2013 22:03:00 -0800 Subject: [PATCH 165/782] remove name hiding from Throw --- Rx/CPP/src/cpprx/operators/Throw.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Throw.hpp b/Rx/CPP/src/cpprx/operators/Throw.hpp index 1d39351..425f5eb 100644 --- a/Rx/CPP/src/cpprx/operators/Throw.hpp +++ b/Rx/CPP/src/cpprx/operators/Throw.hpp @@ -70,7 +70,7 @@ namespace rxcpp struct throw_instance_tag{}; template - std::shared_ptr> Throw( + std::shared_ptr> make_throw( throw_ptr_tag&&, std::exception_ptr exception, Scheduler::shared scheduler = nullptr @@ -80,7 +80,7 @@ namespace rxcpp } template - std::shared_ptr> Throw( + std::shared_ptr> make_throw( throw_instance_tag&&, E e, Scheduler::shared scheduler = nullptr @@ -97,7 +97,7 @@ namespace rxcpp Scheduler::shared scheduler = nullptr ) { - return detail::Throw(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::forward(e), std::move(scheduler)); + return detail::make_throw(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::forward(e), std::move(scheduler)); } } -- GitLab From ca88bc80c5f8ab7d6fd29a9af2eb3fd0d12c5ed2 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 16 Dec 2013 20:45:38 -0800 Subject: [PATCH 166/782] fixes SelectMany disposal --- Rx/CPP/src/cpprx/operators/SelectMany.hpp | 156 ++++++++-------------- 1 file changed, 59 insertions(+), 97 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/SelectMany.hpp b/Rx/CPP/src/cpprx/operators/SelectMany.hpp index b24cb20..e282ced 100644 --- a/Rx/CPP/src/cpprx/operators/SelectMany.hpp +++ b/Rx/CPP/src/cpprx/operators/SelectMany.hpp @@ -28,129 +28,91 @@ namespace rxcpp -> Disposable { struct State { - size_t subscribed; - bool cancel; + std::atomic count; std::mutex lock; + ComposableDisposable group; }; auto state = std::make_shared(); - state->cancel = false; - state->subscribed = 0; + state->count = 0; - ComposableDisposable cd; + SerialDisposable sourceDisposable; + state->group.Add(sourceDisposable); - cd.Add(Disposable([=]{ - std::unique_lock guard(state->lock); - state->cancel = true; }) - ); - - ++state->subscribed; - cd.Add(Subscribe( + ++state->count; + sourceDisposable.Set(Subscribe( source, // on next [=](const T& sourceElement) { - bool cancel = false; - { + util::maybe collection; + try { + collection.set(collectionSelector(sourceElement)); + } catch(...) { std::unique_lock guard(state->lock); - cancel = state->cancel; - if (!cancel) ++state->subscribed; + observer->OnError(std::current_exception()); + state->group.Dispose(); + return; } - if (!cancel) { - util::maybe collection; - try { - collection.set(collectionSelector(sourceElement)); - } catch(...) { - bool cancel = false; - { + + SerialDisposable inner; + state->group.Add(inner); + + ++state->count; + inner.Set(Subscribe( + *collection.get(), + // on next + [=](const CI& collectionElement) + { + util::maybe result; + try { + result.set(resultSelector(sourceElement, collectionElement)); + } catch(...) { std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { observer->OnError(std::current_exception()); + state->group.Dispose(); } - cd.Dispose(); - } - if (!!collection) { - cd.Add(Subscribe( - *collection.get(), - // on next - [=](const CI& collectionElement) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - util::maybe result; - try { - result.set(resultSelector(sourceElement, collectionElement)); - } catch(...) { - observer->OnError(std::current_exception()); - cd.Dispose(); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; - } - if (!cancel && finished) - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); - cd.Dispose(); - })); - } - } + std::unique_lock guard(state->lock); + observer->OnNext(std::move(*result.get())); + }, + // on completed + [=] + { + inner.Dispose(); + if (0 == --state->count) { + std::unique_lock guard(state->lock); + observer->OnCompleted(); + state->group.Dispose(); + } + }, + // on error + [=](const std::exception_ptr& error) + { + std::unique_lock guard(state->lock); + observer->OnError(error); + state->group.Dispose(); + })); }, // on completed [=] { - bool cancel = false; - bool finished = false; - { + if (0 == --state->count) { std::unique_lock guard(state->lock); - finished = (--state->subscribed) == 0; - cancel = state->cancel; + observer->OnCompleted(); + state->group.Dispose(); + } else { + sourceDisposable.Dispose(); } - if (!cancel && finished) - observer->OnCompleted(); }, // on error [=](const std::exception_ptr& error) { - bool cancel = false; - { - std::unique_lock guard(state->lock); - --state->subscribed; - cancel = state->cancel; - } - if (!cancel) - observer->OnError(error); + std::unique_lock guard(state->lock); + observer->OnError(error); + state->group.Dispose(); })); - return cd; + return state->group; }); } } -#endif \ No newline at end of file +#endif -- GitLab From 7285302bea92b80e03e03d59ae4d6e9a45953e2b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 16 Dec 2013 20:47:37 -0800 Subject: [PATCH 167/782] adds SelectMany unittests --- Rx/CPP/test/operators/SelectMany.cpp | 96 ++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 97 insertions(+) create mode 100644 Rx/CPP/test/operators/SelectMany.cpp diff --git a/Rx/CPP/test/operators/SelectMany.cpp b/Rx/CPP/test/operators/SelectMany.cpp new file mode 100644 index 0000000..bfd5cbf --- /dev/null +++ b/Rx/CPP/test/operators/SelectMany.cpp @@ -0,0 +1,96 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("select_many", "[select_many][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages ms; + + long invoked = 0; + + auto xs = scheduler->CreateColdObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(100, 4), + m::OnNext(200, 2), + m::OnNext(300, 3), + m::OnNext(400, 1), + m::OnCompleted(500) + }; + return m::ToVector(messages); + }() + ); + + auto ys = scheduler->CreateColdObservable( + []() { + ms::RecordedT messages[] = { + ms::OnNext(50, "foo"), + ms::OnNext(100, "bar"), + ms::OnNext(150, "baz"), + ms::OnNext(200, "qux"), + ms::OnCompleted(250) + }; + return ms::ToVector(messages); + }() + ); + + WHEN("each int is mapped to the strings"){ + + auto res = scheduler->Start( + [&]() { + return observable(from(xs) + .select_many([&](int){return ys;})); + } + ); + + THEN("the output contains strings repeated for each int"){ + ms::RecordedT items[] = { + ms::OnNext(350, "foo"), + ms::OnNext(400, "bar"), + ms::OnNext(450, "foo"), + ms::OnNext(450, "baz"), + ms::OnNext(500, "bar"), + ms::OnNext(500, "qux"), + ms::OnNext(550, "baz"), + ms::OnNext(550, "foo"), + ms::OnNext(600, "bar"), + ms::OnNext(600, "qux"), + ms::OnNext(650, "baz"), + ms::OnNext(650, "foo"), + ms::OnNext(700, "qux"), + ms::OnNext(700, "bar"), + ms::OnNext(750, "baz"), + ms::OnNext(800, "qux"), + ms::OnCompleted(850) + }; + auto required = ms::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rx::Subscription items[] = { + m::Subscribe(200, 700) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rx::Subscription items[] = { + ms::Subscribe(300, 550), + ms::Subscribe(400, 650), + ms::Subscribe(500, 750), + ms::Subscribe(600, 850) + }; + auto required = m::ToVector(items); + auto actual = ys->Subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index bf85ff3..3933df6 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -24,6 +24,7 @@ set(TEST_SOURCES ${TEST_DIR}/test.cpp ${TEST_DIR}/operators/Return.cpp ${TEST_DIR}/operators/Select.cpp + ${TEST_DIR}/operators/SelectMany.cpp ${TEST_DIR}/operators/Where.cpp ${TEST_DIR}/operators/Publish.cpp ) -- GitLab From 9d74d6504fdc90ee6a1e1b99b5ae4e4e337ea7d1 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 16 Dec 2013 21:42:28 -0800 Subject: [PATCH 168/782] more SelectMany unittests --- Rx/CPP/test/operators/SelectMany.cpp | 185 ++++++++++++++++++++++++++- 1 file changed, 184 insertions(+), 1 deletion(-) diff --git a/Rx/CPP/test/operators/SelectMany.cpp b/Rx/CPP/test/operators/SelectMany.cpp index bfd5cbf..9ab6602 100644 --- a/Rx/CPP/test/operators/SelectMany.cpp +++ b/Rx/CPP/test/operators/SelectMany.cpp @@ -3,7 +3,7 @@ namespace rx=rxcpp; #include "catch.hpp" -SCENARIO("select_many", "[select_many][map][operators]"){ +SCENARIO("select_many completes", "[select_many][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto scheduler = std::make_shared(); typedef rx::TestScheduler::Messages m; @@ -94,3 +94,186 @@ SCENARIO("select_many", "[select_many][map][operators]"){ } } } + +SCENARIO("select_many source never ends", "[select_many][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages ms; + + long invoked = 0; + + auto xs = scheduler->CreateColdObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(100, 4), + m::OnNext(200, 2), + m::OnNext(300, 3), + m::OnNext(400, 1), + m::OnNext(500, 5), + m::OnNext(700, 0) + }; + return m::ToVector(messages); + }() + ); + + auto ys = scheduler->CreateColdObservable( + []() { + ms::RecordedT messages[] = { + ms::OnNext(50, "foo"), + ms::OnNext(100, "bar"), + ms::OnNext(150, "baz"), + ms::OnNext(200, "qux"), + ms::OnCompleted(250) + }; + return ms::ToVector(messages); + }() + ); + + WHEN("each int is mapped to the strings"){ + + auto res = scheduler->Start( + [&]() { + return observable(from(xs) + .select_many([&](int){return ys;})); + } + ); + + THEN("the output contains strings repeated for each int"){ + ms::RecordedT items[] = { + ms::OnNext(350, "foo"), + ms::OnNext(400, "bar"), + ms::OnNext(450, "baz"), + ms::OnNext(450, "foo"), + ms::OnNext(500, "bar"), + ms::OnNext(500, "qux"), + ms::OnNext(550, "baz"), + ms::OnNext(550, "foo"), + ms::OnNext(600, "qux"), + ms::OnNext(600, "bar"), + ms::OnNext(650, "baz"), + ms::OnNext(650, "foo"), + ms::OnNext(700, "qux"), + ms::OnNext(700, "bar"), + ms::OnNext(750, "baz"), + ms::OnNext(750, "foo"), + ms::OnNext(800, "qux"), + ms::OnNext(800, "bar"), + ms::OnNext(850, "baz"), + ms::OnNext(900, "qux"), + ms::OnNext(950, "foo"), + ms::OnNext(1000, "bar") + }; + auto required = ms::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rx::Subscription items[] = { + m::Subscribe(200, 1000) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rx::Subscription items[] = { + ms::Subscribe(300, 550), + ms::Subscribe(400, 650), + ms::Subscribe(500, 750), + ms::Subscribe(600, 850), + ms::Subscribe(700, 950), + ms::Subscribe(900, 1000) + }; + auto required = m::ToVector(items); + auto actual = ys->Subscriptions(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("select_many inner error", "[select_many][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + typedef rx::TestScheduler::Messages ms; + + long invoked = 0; + + auto xs = scheduler->CreateColdObservable( + []() { + m::RecordedT messages[] = { + m::OnNext(100, 4), + m::OnNext(200, 2), + m::OnNext(300, 3), + m::OnNext(400, 1), + m::OnCompleted(500) + }; + return m::ToVector(messages); + }() + ); + + auto ys = scheduler->CreateColdObservable( + []() { + ms::RecordedT messages[] = { + ms::OnNext(50, "foo"), + ms::OnNext(100, "bar"), + ms::OnNext(150, "baz"), + ms::OnNext(200, "qux"), + ms::OnError(300, std::exception()) + }; + return ms::ToVector(messages); + }() + ); + + WHEN("each int is mapped to the strings"){ + + auto res = scheduler->Start( + [&]() { + return observable(from(xs) + .select_many([&](int){return ys;})); + } + ); + + THEN("the output contains strings repeated for each int"){ + ms::RecordedT items[] = { + ms::OnNext(350, "foo"), + ms::OnNext(400, "bar"), + ms::OnNext(450, "foo"), + ms::OnNext(450, "baz"), + ms::OnNext(500, "bar"), + ms::OnNext(500, "qux"), + ms::OnNext(550, "baz"), + ms::OnNext(550, "foo"), + ms::OnError(600, std::exception()) + }; + auto required = ms::ToVector(items); + auto actual = res->Messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rx::Subscription items[] = { + m::Subscribe(200, 600) + }; + auto required = m::ToVector(items); + auto actual = xs->Subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rx::Subscription items[] = { + ms::Subscribe(300, 600), + ms::Subscribe(400, 600), + ms::Subscribe(500, 600) + }; + auto required = m::ToVector(items); + auto actual = ys->Subscriptions(); + REQUIRE(required == actual); + } + } + } +} \ No newline at end of file -- GitLab From 059934e59928fac58078d76bcb05504aad581272 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 17 Dec 2013 15:22:47 -0800 Subject: [PATCH 169/782] update version --- projects/nuget/rxcpp.autoconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index b354d6c..9c6f05a 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -1,7 +1,7 @@ nuget { nuspec { id = rxcpp; - version : 1.0.0; + version : 1.0.1; title: Reactive Extensions for C++; authors: {Microsoft Open Technologies Inc.}; owners: {Microsoft Open Technologies Inc.}; -- GitLab From a9cc4f404e7957c6b69c84287886f2dc77e6652b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 19 Dec 2013 15:27:55 -0800 Subject: [PATCH 170/782] ensure that events do not overlap allowing events to overlap in the tests exposes them to differences in STL implementations. events at the same time may be processed in inverse order on one platform from the next. --- Rx/CPP/test/operators/SelectMany.cpp | 41 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/Rx/CPP/test/operators/SelectMany.cpp b/Rx/CPP/test/operators/SelectMany.cpp index 9ab6602..afa4d22 100644 --- a/Rx/CPP/test/operators/SelectMany.cpp +++ b/Rx/CPP/test/operators/SelectMany.cpp @@ -219,11 +219,11 @@ SCENARIO("select_many inner error", "[select_many][map][operators]"){ auto ys = scheduler->CreateColdObservable( []() { ms::RecordedT messages[] = { - ms::OnNext(50, "foo"), - ms::OnNext(100, "bar"), - ms::OnNext(150, "baz"), - ms::OnNext(200, "qux"), - ms::OnError(300, std::exception()) + ms::OnNext(55, "foo"), + ms::OnNext(104, "bar"), + ms::OnNext(153, "baz"), + ms::OnNext(202, "qux"), + ms::OnError(301, std::exception()) }; return ms::ToVector(messages); }() @@ -240,15 +240,15 @@ SCENARIO("select_many inner error", "[select_many][map][operators]"){ THEN("the output contains strings repeated for each int"){ ms::RecordedT items[] = { - ms::OnNext(350, "foo"), - ms::OnNext(400, "bar"), - ms::OnNext(450, "foo"), - ms::OnNext(450, "baz"), - ms::OnNext(500, "bar"), - ms::OnNext(500, "qux"), - ms::OnNext(550, "baz"), - ms::OnNext(550, "foo"), - ms::OnError(600, std::exception()) + ms::OnNext(355, "foo"), + ms::OnNext(404, "bar"), + ms::OnNext(453, "baz"), + ms::OnNext(455, "foo"), + ms::OnNext(502, "qux"), + ms::OnNext(504, "bar"), + ms::OnNext(553, "baz"), + ms::OnNext(555, "foo"), + ms::OnError(601, std::exception()) }; auto required = ms::ToVector(items); auto actual = res->Messages(); @@ -257,7 +257,7 @@ SCENARIO("select_many inner error", "[select_many][map][operators]"){ THEN("there was one subscription and one unsubscription to the ints"){ rx::Subscription items[] = { - m::Subscribe(200, 600) + m::Subscribe(200, 601) }; auto required = m::ToVector(items); auto actual = xs->Subscriptions(); @@ -266,14 +266,15 @@ SCENARIO("select_many inner error", "[select_many][map][operators]"){ THEN("there were four subscription and unsubscription to the strings"){ rx::Subscription items[] = { - ms::Subscribe(300, 600), - ms::Subscribe(400, 600), - ms::Subscribe(500, 600) + ms::Subscribe(300, 601), + ms::Subscribe(400, 601), + ms::Subscribe(500, 601), + ms::Subscribe(600, 601) }; - auto required = m::ToVector(items); + auto required = ms::ToVector(items); auto actual = ys->Subscriptions(); REQUIRE(required == actual); } } } -} \ No newline at end of file +} -- GitLab From 2de529e4599bce629ab996c2a37911390f0195d7 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 19 Dec 2013 15:34:18 -0800 Subject: [PATCH 171/782] avoid more overlapping events --- Rx/CPP/test/operators/SelectMany.cpp | 63 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/Rx/CPP/test/operators/SelectMany.cpp b/Rx/CPP/test/operators/SelectMany.cpp index afa4d22..9daef6c 100644 --- a/Rx/CPP/test/operators/SelectMany.cpp +++ b/Rx/CPP/test/operators/SelectMany.cpp @@ -120,11 +120,11 @@ SCENARIO("select_many source never ends", "[select_many][map][operators]"){ auto ys = scheduler->CreateColdObservable( []() { ms::RecordedT messages[] = { - ms::OnNext(50, "foo"), - ms::OnNext(100, "bar"), - ms::OnNext(150, "baz"), - ms::OnNext(200, "qux"), - ms::OnCompleted(250) + ms::OnNext(55, "foo"), + ms::OnNext(104, "bar"), + ms::OnNext(153, "baz"), + ms::OnNext(202, "qux"), + ms::OnCompleted(251) }; return ms::ToVector(messages); }() @@ -141,28 +141,27 @@ SCENARIO("select_many source never ends", "[select_many][map][operators]"){ THEN("the output contains strings repeated for each int"){ ms::RecordedT items[] = { - ms::OnNext(350, "foo"), - ms::OnNext(400, "bar"), - ms::OnNext(450, "baz"), - ms::OnNext(450, "foo"), - ms::OnNext(500, "bar"), - ms::OnNext(500, "qux"), - ms::OnNext(550, "baz"), - ms::OnNext(550, "foo"), - ms::OnNext(600, "qux"), - ms::OnNext(600, "bar"), - ms::OnNext(650, "baz"), - ms::OnNext(650, "foo"), - ms::OnNext(700, "qux"), - ms::OnNext(700, "bar"), - ms::OnNext(750, "baz"), - ms::OnNext(750, "foo"), - ms::OnNext(800, "qux"), - ms::OnNext(800, "bar"), - ms::OnNext(850, "baz"), - ms::OnNext(900, "qux"), - ms::OnNext(950, "foo"), - ms::OnNext(1000, "bar") + ms::OnNext(355, "foo"), + ms::OnNext(404, "bar"), + ms::OnNext(453, "baz"), + ms::OnNext(455, "foo"), + ms::OnNext(502, "qux"), + ms::OnNext(504, "bar"), + ms::OnNext(553, "baz"), + ms::OnNext(555, "foo"), + ms::OnNext(602, "qux"), + ms::OnNext(604, "bar"), + ms::OnNext(653, "baz"), + ms::OnNext(655, "foo"), + ms::OnNext(702, "qux"), + ms::OnNext(704, "bar"), + ms::OnNext(753, "baz"), + ms::OnNext(755, "foo"), + ms::OnNext(802, "qux"), + ms::OnNext(804, "bar"), + ms::OnNext(853, "baz"), + ms::OnNext(902, "qux"), + ms::OnNext(955, "foo") }; auto required = ms::ToVector(items); auto actual = res->Messages(); @@ -180,11 +179,11 @@ SCENARIO("select_many source never ends", "[select_many][map][operators]"){ THEN("there were four subscription and unsubscription to the strings"){ rx::Subscription items[] = { - ms::Subscribe(300, 550), - ms::Subscribe(400, 650), - ms::Subscribe(500, 750), - ms::Subscribe(600, 850), - ms::Subscribe(700, 950), + ms::Subscribe(300, 551), + ms::Subscribe(400, 651), + ms::Subscribe(500, 751), + ms::Subscribe(600, 851), + ms::Subscribe(700, 951), ms::Subscribe(900, 1000) }; auto required = m::ToVector(items); -- GitLab From 811950a150ca4fb00fc90a8ef7bf4432bedd7cec Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 19 Dec 2013 16:08:55 -0800 Subject: [PATCH 172/782] move throw() to only protect thread root and wndproc root --- Rx/CPP/src/cpprx/rx-base.hpp | 4 +- Rx/CPP/src/cpprx/rx-scheduler.hpp | 149 ++++++++++-------------------- Rx/CPP/src/cpprx/rx-windows.hpp | 24 ++--- 3 files changed, 65 insertions(+), 112 deletions(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 609265c..9424c9b 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -406,7 +406,7 @@ namespace rxcpp , work(std::move(work)) {} - static Disposable Do(Scheduler::Work& work, Scheduler::shared scheduler) throw() + static Disposable Do(Scheduler::Work& work, Scheduler::shared scheduler) { if (work) { @@ -426,7 +426,7 @@ namespace rxcpp public: typedef ScheduledItem QueueItem; - static Disposable Do(Work& work, const Scheduler::shared& scheduler) throw() + static Disposable Do(Work& work, const Scheduler::shared& scheduler) { return QueueItem::Do(work, scheduler); } diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp index 410c168..ed69bf4 100644 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ b/Rx/CPP/src/cpprx/rx-scheduler.hpp @@ -10,7 +10,7 @@ namespace rxcpp { ////////////////////////////////////////////////////////////////////// - // + // // schedulers struct CurrentThreadQueue @@ -21,18 +21,18 @@ namespace rxcpp private: ~CurrentThreadQueue(); - + struct compare_work { bool operator()(const QueueItem& work1, const QueueItem& work2) const { return work1.due > work2.due; } }; - + typedef std::priority_queue< QueueItem, std::vector, - compare_work + compare_work > ScheduledWork; public: @@ -46,11 +46,11 @@ namespace rxcpp RXCPP_THREAD_LOCAL static ThreadLocalQueue* queue; return queue; } - + public: - static Scheduler::shared GetScheduler() { - return !!threadLocalQueue() ? threadLocalQueue()->scheduler : Scheduler::shared(); + static Scheduler::shared GetScheduler() { + return !!threadLocalQueue() ? threadLocalQueue()->scheduler : Scheduler::shared(); } static bool empty() { if (!threadLocalQueue()) { @@ -126,7 +126,7 @@ namespace rxcpp } static bool IsScheduleRequired() { return false; } - + using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { @@ -146,13 +146,13 @@ namespace rxcpp } static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } - + using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { auto localScheduler = CurrentThreadQueue::GetScheduler(); // check ownership - if (!!localScheduler) + if (!!localScheduler) { // already has an owner - delegate return localScheduler->Schedule(dueTime, std::move(work)); @@ -178,9 +178,9 @@ namespace rxcpp auto work = CurrentThreadQueue::top().work; CurrentThreadQueue::pop(); - + Do(work, get()); - + if (CurrentThreadQueue::empty()) {break;} } @@ -192,7 +192,7 @@ namespace rxcpp { private: ImmediateScheduler(const ImmediateScheduler&); - + mutable std::mutex lock; mutable bool hasFaulted; mutable bool isAquired; @@ -224,7 +224,7 @@ namespace rxcpp } } - if (isOwner) + if (isOwner) { RXCPP_UNWIND_AUTO([&](){ std::unique_lock guard(lock); @@ -233,10 +233,10 @@ namespace rxcpp isAquired = false; }); - for(;;) + for(;;) { std::this_thread::sleep_until(item.due); - try + try { Do(item.work, queue->scheduler); } @@ -268,10 +268,10 @@ namespace rxcpp } } }; - + template - class ScheduledObserver : - public Observer, + class ScheduledObserver : + public Observer, public std::enable_shared_from_this> { typedef std::function Action; @@ -312,14 +312,14 @@ namespace rxcpp this->observer->OnNext(std::move(element)); })); } - virtual void OnCompleted() + virtual void OnCompleted() { std::unique_lock guard(lock); queue.push(Action([=](){ this->observer->OnCompleted(); })); } - virtual void OnError(const std::exception_ptr& error) + virtual void OnError(const std::exception_ptr& error) { std::unique_lock guard(lock); queue.push(Action([=](){ @@ -369,7 +369,7 @@ namespace rxcpp } } - try + try { action(); } @@ -416,7 +416,7 @@ namespace rxcpp typedef std::function Factory; static bool IsScheduleRequired() { return false; } - + typedef std::tuple, Disposable> EnsureThreadResult; EnsureThreadResult EnsureThread(Factory& factory, Scheduler::shared owner, clock::time_point dueTime, Work work) { @@ -438,7 +438,7 @@ namespace rxcpp auto local = std::static_pointer_cast(shared_from_this()); auto localQueue = queue; - std::get<0>(result).set(factory([local, localQueue]{ + std::get<0>(result).set(factory([local, localQueue] { local->Run(localQueue);})); isOwner = !isAquired; @@ -458,7 +458,7 @@ namespace rxcpp } private: - void Run(CurrentThreadQueue::ThreadLocalQueue* queue) { + void Run(CurrentThreadQueue::ThreadLocalQueue* queue) throw() { auto keepAlive = shared_from_this(); { std::unique_lock guard(lock); @@ -467,35 +467,15 @@ namespace rxcpp isAquired = false;}); RXCPP_UNWIND(unwindQueue, [&](){ - CurrentThreadQueue::DestroyQueue(); + CurrentThreadQueue::DestroyQueue(); queue = nullptr;}); CurrentThreadQueue::SetQueue(queue); -#if 0 - auto start = queue->scheduler->Now(); - auto ms = std::chrono::milliseconds(1); -#endif while(!CurrentThreadQueue::empty()) { auto now = queue->scheduler->Now(); -#if 0 - {std::wstringstream out; - out << L"eventloop (run) pending: " << std::boolalpha << CurrentThreadQueue::empty() - << L", now: " << ((now - start) / ms); - if (!CurrentThreadQueue::empty()) { - out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} - out << std::endl; - OutputDebugString(out.str().c_str());} -#endif if (CurrentThreadQueue::empty()) { -#if 0 - {std::wstringstream out; - out << L"eventloop (wait for work) pending: " << std::boolalpha << CurrentThreadQueue::empty() - << L", now: " << ((now - start) / ms); - out << std::endl; - OutputDebugString(out.str().c_str());} -#endif wake.wait(guard, [&](){ return !CurrentThreadQueue::empty();}); continue; @@ -503,46 +483,19 @@ namespace rxcpp auto item = &CurrentThreadQueue::top(); if (!item->work) { -#if 0 - {std::wstringstream out; - out << L"eventloop (pop disposed work) pending: " << std::boolalpha << CurrentThreadQueue::empty() - << L", now: " << ((now - start) / ms); - if (!CurrentThreadQueue::empty()) { - out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} - out << std::endl; - OutputDebugString(out.str().c_str());} -#endif CurrentThreadQueue::pop(); continue;} - + // wait until the work is due if (now < item->due) { -#if 0 - {std::wstringstream out; - out << L"eventloop (wait for due) pending: " << std::boolalpha << CurrentThreadQueue::empty() - << L", now: " << ((now - start) / ms); - if (!CurrentThreadQueue::empty()) { - out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} - out << std::endl; - OutputDebugString(out.str().c_str());} -#endif wake.wait_until(guard, item->due); continue; } -#if 0 - {std::wstringstream out; - out << L"eventloop (dispatch) pending: " << std::boolalpha << CurrentThreadQueue::empty() - << L", now: " << ((now - start) / ms); - if (!CurrentThreadQueue::empty()) { - out << L", due: " << ((CurrentThreadQueue::top().due - start) / ms);} - out << std::endl; - OutputDebugString(out.str().c_str());} -#endif // dispatch work auto work = item->work; CurrentThreadQueue::pop(); - + RXCPP_UNWIND_AUTO([&]{ guard.lock();}); guard.unlock(); @@ -566,7 +519,7 @@ namespace rxcpp }; } template - EventLoopScheduler(Factory factoryarg) + EventLoopScheduler(Factory factoryarg) : factory(std::move(factoryarg)) , derecurser(std::make_shared()) { @@ -579,7 +532,7 @@ namespace rxcpp } static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } - + using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { @@ -595,18 +548,18 @@ namespace rxcpp return std::move(std::get<1>(maybeThread)); } }; - + struct NewThreadScheduler : public LocalScheduler { public: typedef std::function)> Factory; private: NewThreadScheduler(const NewThreadScheduler&); - + Factory factory; public: - - + + NewThreadScheduler() : factory([](std::function start){return std::thread(std::move(start));}) { } @@ -616,7 +569,7 @@ namespace rxcpp virtual ~NewThreadScheduler() { } - + using LocalScheduler::Schedule; virtual Disposable Schedule(clock::time_point dueTime, Work work) { @@ -641,11 +594,11 @@ namespace rxcpp return work1.due > work2.due; } }; - + typedef std::priority_queue< QueueItem, std::vector, - compare_work + compare_work > ScheduledWork; ScheduledWork queue; @@ -690,7 +643,7 @@ namespace rxcpp cancelable.Dispose(); return Base::Do(local, std::move(scheduler)); }; - + cancelable = run; auto si = QueueItem(dueTime, cancelable); @@ -714,43 +667,43 @@ namespace rxcpp static const long Disposed = 1000; template - struct Messages + struct Messages { typedef Recorded>> RecordedT; - static + static RecordedT OnNext(long ticks, T value) { return RecordedT(ticks, Notification::CreateOnNext(value)); } - static + static RecordedT OnCompleted(long ticks) { return RecordedT(ticks, Notification::CreateOnCompleted()); } - static + static RecordedT OnError(long ticks, std::exception_ptr ep) { return RecordedT(ticks, Notification::CreateOnError(ep)); } template - static + static RecordedT OnError(long ticks, Exception e) { return RecordedT(ticks, Notification::CreateOnError(e)); } - static + static Subscription Subscribe(long subscribe, long unsubscribe) { return Subscription(subscribe, unsubscribe); } template - static + static auto ToVector(const Item (&arr) [size]) -> std::vector { return std::vector(std::begin(arr), std::end(arr)); } @@ -789,7 +742,7 @@ namespace rxcpp { auto observer = CreateObserver(); - struct State + struct State { std::shared_ptr> source; SerialDisposable subscription; @@ -799,11 +752,11 @@ namespace rxcpp state->observer = observer; - ScheduleAbsolute(created, [create, state](Scheduler::shared scheduler) -> Disposable { + ScheduleAbsolute(created, [create, state](Scheduler::shared scheduler) -> Disposable { state->source = create(); return Disposable::Empty(); }); - ScheduleAbsolute(subscribed, [state](Scheduler::shared scheduler) -> Disposable { + ScheduleAbsolute(subscribed, [state](Scheduler::shared scheduler) -> Disposable { state->subscription.Set(state->source->Subscribe(state->observer)); return Disposable::Empty(); }); - ScheduleAbsolute(disposed, [state](Scheduler::shared scheduler) -> Disposable { + ScheduleAbsolute(disposed, [state](Scheduler::shared scheduler) -> Disposable { state->subscription.Dispose(); return Disposable::Empty(); }); Start(); @@ -907,8 +860,8 @@ namespace rxcpp for (auto& message : messages) { auto notification = message.Value(); - d.Add(scheduler->ScheduleRelative(message.Time(), [notification, observer](Scheduler::shared) -> Disposable { - notification->Accept(observer); return Disposable::Empty(); + d.Add(scheduler->ScheduleRelative(message.Time(), [notification, observer](Scheduler::shared) -> Disposable { + notification->Accept(observer); return Disposable::Empty(); })); } diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp index 5284744..06b2fb9 100644 --- a/Rx/CPP/src/cpprx/rx-windows.hpp +++ b/Rx/CPP/src/cpprx/rx-windows.hpp @@ -15,7 +15,7 @@ #include namespace rxcpp { namespace win32 { - + #if !defined(OBSERVE_ON_DISPATCHER_OP) #define OBSERVE_ON_DISPATCHER_OP rxcpp::win32::ObserveOnDispatcherOp @@ -51,7 +51,7 @@ namespace rxcpp { namespace win32 { if (!RegisterClass(&wndclass)) throw std::exception("error"); - + } HWND CreateWindow_() { @@ -71,7 +71,7 @@ namespace rxcpp { namespace win32 { return DefWindowProc(hwnd, message, wParam, lParam); } } - static WindowClass& Instance() { + static WindowClass& Instance() { static WindowClass instance; return instance; } @@ -103,7 +103,7 @@ namespace rxcpp { namespace win32 { return work1.first > work2.first; } }; - + struct Queue; typedef std::pair Item; @@ -112,10 +112,10 @@ namespace rxcpp { namespace win32 { typedef std::priority_queue< PriorityItem, std::vector, - compare_work + compare_work > ScheduledWork; - struct Queue + struct Queue { Queue() : exit(false), window(NULL) {} bool exit; @@ -143,7 +143,7 @@ namespace rxcpp { namespace win32 { wndclass.lpszClassName = className(); RegisterClassW(&wndclass); - + std::unique_ptr that(new WindowClass); that->queue = queue; @@ -156,7 +156,7 @@ namespace rxcpp { namespace win32 { static const int WM_USER_DISPATCH = WM_USER + 1; - static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) throw() { WindowClass* windowClass = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); switch (message) @@ -190,10 +190,10 @@ namespace rxcpp { namespace win32 { } if (!windowClass->queue->scheduledWork.empty()) - { + { auto& item = windowClass->queue->scheduledWork.top(); auto now = item.second.get()->first->Now(); - + // wait until the work is due if(now < item.first) { @@ -204,7 +204,7 @@ namespace rxcpp { namespace win32 { } std::this_thread::sleep_until(item.first); } - + // dispatch work auto work = std::move(item.second.get()->second); auto scheduler = std::move(item.second.get()->first); @@ -230,7 +230,7 @@ namespace rxcpp { namespace win32 { if (destroy) { - DestroyWindow(window); + DestroyWindow(window); } } return 0; -- GitLab From a4a1d81da1905bcab110ce6b78f2fe992fab91e7 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 19 Dec 2013 16:17:27 -0800 Subject: [PATCH 173/782] missed a throw() --- Rx/CPP/src/cpprx/rx-base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp index 9424c9b..43acb56 100644 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ b/Rx/CPP/src/cpprx/rx-base.hpp @@ -494,7 +494,7 @@ namespace rxcpp virtual util::maybe GetNext() =0; public: - static Disposable Do(Work& work, const Scheduler::shared& scheduler) throw() + static Disposable Do(Work& work, const Scheduler::shared& scheduler) { return QueueItem::Do(work, scheduler); } -- GitLab From 102645582411af0dba7d2703a1539f6699b1f2e7 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sun, 26 Jan 2014 15:26:00 -0800 Subject: [PATCH 174/782] increment nuget package version --- projects/nuget/rxcpp.autoconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index 9c6f05a..7c002d0 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -1,7 +1,7 @@ nuget { nuspec { id = rxcpp; - version : 1.0.1; + version : 1.0.2; title: Reactive Extensions for C++; authors: {Microsoft Open Technologies Inc.}; owners: {Microsoft Open Technologies Inc.}; -- GitLab From 800253ff880da40ec5cc04be7afa129f78945b3d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 20 Feb 2014 08:00:20 -0800 Subject: [PATCH 175/782] add failing test for issue 5 --- Rx/CPP/test/operators/Merge.cpp | 60 +++++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 61 insertions(+) create mode 100644 Rx/CPP/test/operators/Merge.cpp diff --git a/Rx/CPP/test/operators/Merge.cpp b/Rx/CPP/test/operators/Merge.cpp new file mode 100644 index 0000000..7e26d8f --- /dev/null +++ b/Rx/CPP/test/operators/Merge.cpp @@ -0,0 +1,60 @@ +#include "cpprx/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("merge issue 5", "[merge][issue][operators]"){ + GIVEN("Empty and Never"){ + auto scheduler = std::make_shared(); + typedef rx::TestScheduler::Messages m; + + WHEN("merged 4 times"){ + + std::vector empty; + auto o = rx::observable(rx::from(rx::Iterate(empty)) + .merge(rx::Never())); + + auto res1 = scheduler->Start( + [o]() { + return o; + } + ); + auto res2 = scheduler->Start( + [o]() { + return o; + } + ); + auto res3 = scheduler->Start( + [o]() { + return o; + } + ); + auto res4 = scheduler->Start( + [o]() { + return o; + } + ); + + THEN("1 - the output is empty and subscribed"){ + std::vector required; + auto actual = res1->Messages(); + REQUIRE(required == actual); + } + THEN("2 - the output is empty and subscribed"){ + std::vector required; + auto actual = res2->Messages(); + REQUIRE(required == actual); + } + THEN("3 - the output is empty and subscribed"){ + std::vector required; + auto actual = res3->Messages(); + REQUIRE(required == actual); + } + THEN("4 - the output is empty and subscribed"){ + std::vector required; + auto actual = res4->Messages(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 3933df6..bd4e4b6 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -22,6 +22,7 @@ include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXC # define the sources of the self test set(TEST_SOURCES ${TEST_DIR}/test.cpp + ${TEST_DIR}/operators/Merge.cpp ${TEST_DIR}/operators/Return.cpp ${TEST_DIR}/operators/Select.cpp ${TEST_DIR}/operators/SelectMany.cpp -- GitLab From bfaf418a9fdf9fd4bffc8845e2e56ce9da351f37 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 20 Feb 2014 08:16:19 -0800 Subject: [PATCH 176/782] fix for issue 5, state was shared across subscriptions --- Rx/CPP/src/cpprx/operators/Merge.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Rx/CPP/src/cpprx/operators/Merge.hpp b/Rx/CPP/src/cpprx/operators/Merge.hpp index 793acdf..4a724ca 100644 --- a/Rx/CPP/src/cpprx/operators/Merge.hpp +++ b/Rx/CPP/src/cpprx/operators/Merge.hpp @@ -62,7 +62,9 @@ namespace rxcpp { typedef MergeSource result_type; typedef decltype(std::make_tuple(firstSource, otherSource...)) Sources; - struct State { + struct State + : std::enable_shared_from_this + { typedef Sources Sources; typedef result_type result_type; typedef std::tuple_size SourcesSize; @@ -72,11 +74,11 @@ namespace rxcpp std::atomic pendingComplete; }; Sources sources(firstSource, otherSource...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); ComposableDisposable cd; detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); return cd; @@ -91,7 +93,9 @@ namespace rxcpp { typedef MergeSource result_type; typedef decltype(std::make_tuple(firstSource, otherSource)) Sources; - struct State { + struct State + : std::enable_shared_from_this + { typedef Sources Sources; typedef result_type result_type; typedef std::tuple_size SourcesSize; @@ -101,11 +105,11 @@ namespace rxcpp std::atomic pendingComplete; }; Sources sources(firstSource, otherSource); - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); return CreateObservable( [=](std::shared_ptr> observer) -> Disposable { + // bug on osx prevents using make_shared + std::shared_ptr state(new State()); ComposableDisposable cd; detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); return cd; -- GitLab From b99e75cda3861f3bb8621befe1fbca32949c15e0 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 28 Jan 2014 23:57:54 -0800 Subject: [PATCH 177/782] explore static observer --- Rx/CPP/src/rxcpp/rx.hpp | 627 ++++++++++++++++++ Rx/CPP/test/v2/subscriptions/observer.cpp | 190 ++++++ Rx/CPP/test/v2/subscriptions/subscription.cpp | 181 +++++ projects/CMake/CMakeLists.txt | 2 + 4 files changed, 1000 insertions(+) create mode 100644 Rx/CPP/src/rxcpp/rx.hpp create mode 100644 Rx/CPP/test/v2/subscriptions/observer.cpp create mode 100644 Rx/CPP/test/v2/subscriptions/subscription.cpp diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp new file mode 100644 index 0000000..c9a8157 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -0,0 +1,627 @@ +// 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 +#include +#include +#include +#include +#include +#include + +namespace rxcpp { + + struct tag_subscription {}; + struct subscription_base {typedef tag_subscription subscription_tag;}; + template + class is_subscription + { + template + static typename C::subscription_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_subscription>::value; + }; + + class dynamic_subscription : public subscription_base + { + typedef std::function unsubscribe_call_type; + unsubscribe_call_type unsubscribe_call; + dynamic_subscription() + { + } + public: + dynamic_subscription(const dynamic_subscription& o) + : unsubscribe_call(o.unsubscribe_call) + { + } + dynamic_subscription(dynamic_subscription&& o) + : unsubscribe_call(std::move(o.unsubscribe_call)) + { + } + template + dynamic_subscription(I i, typename std::enable_if::value && !std::is_same::value, void**>::type selector = nullptr) + : unsubscribe_call([i](){ + i.unsubscribe();}) + { + } + dynamic_subscription(unsubscribe_call_type s) + : unsubscribe_call(std::move(s)) + { + } + void unsubscribe() const { + unsubscribe_call(); + } + }; + + template + class static_subscription : public subscription_base + { + typedef 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(); + } + }; + + template + class subscription : public subscription_base + { + typedef I inner_t; + inner_t inner; + mutable bool issubscribed; + public: + subscription(inner_t inner) + : inner(std::move(inner)) + , issubscribed(true) + { + } + bool is_subscribed() const { + return issubscribed; + } + void unsubscribe() const { + if (issubscribed) { + inner.unsubscribe(); + } + issubscribed = false; + } + }; + template<> + class subscription : public subscription_base + { + public: + subscription() + { + } + bool is_subscribed() const { + return false; + } + void unsubscribe() const { + } + }; + inline auto make_subscription() + -> subscription { + return subscription(); + } + template + auto make_subscription(I i) + -> typename std::enable_if::value, + subscription>::type { + return subscription(std::move(i)); + } + template + auto make_subscription(Unsubscribe u) + -> typename std::enable_if::value, + subscription< static_subscription>>::type { + return subscription< static_subscription>( + static_subscription(std::move(u))); + } + + class composite_subscription : public subscription_base + { + public: + typedef std::shared_ptr shared_subscription; + typedef std::weak_ptr weak_subscription; + private: + struct state_t + { + std::vector subscriptions; + std::mutex lock; + bool issubscribed; + + state_t() + : issubscribed(true) + { + } + + bool is_subscribed() { + return issubscribed; + } + + weak_subscription add(dynamic_subscription s) { + return add(std::make_shared(std::move(s))); + } + + weak_subscription add(shared_subscription s) { + std::unique_lock guard(lock); + + if (!issubscribed) { + s->unsubscribe(); + } else { + auto end = std::end(subscriptions); + auto it = std::find(std::begin(subscriptions), end, s); + if (it == end) + { + subscriptions.emplace_back(std::move(s)); + } + } + return s; + } + + void remove(weak_subscription w) { + std::unique_lock guard(lock); + + auto s = w.lock(); + if (s) + { + auto end = std::end(subscriptions); + auto it = std::find(std::begin(subscriptions), end, s); + if (it != end) + { + subscriptions.erase(it); + } + } + } + + void clear() { + std::unique_lock guard(lock); + + if (issubscribed) { + std::vector v(std::move(subscriptions)); + std::for_each(v.begin(), v.end(), + [](shared_subscription& s) { + s->unsubscribe(); }); + } + } + + void unsubscribe() { + std::unique_lock guard(lock); + + if (issubscribed) { + issubscribed = false; + std::vector v(std::move(subscriptions)); + std::for_each(v.begin(), v.end(), + [](shared_subscription& s) { + s->unsubscribe(); }); + } + } + }; + + mutable std::shared_ptr state; + + public: + + composite_subscription() + : state(std::make_shared()) + { + } + composite_subscription(const composite_subscription& o) + : state(o.state) + { + } + composite_subscription(composite_subscription&& o) + : state(std::move(o.state)) + { + } + + composite_subscription& operator=(const composite_subscription& o) + { + state = o.state; + return *this; + } + composite_subscription& operator=(composite_subscription&& o) + { + state = std::move(o.state); + return *this; + } + + bool is_subscribed() const { + return state->is_subscribed(); + } + weak_subscription add(shared_subscription s) const { + return state->add(std::move(s)); + } + weak_subscription add(dynamic_subscription s) const { + return state->add(std::move(s)); + } + void remove(weak_subscription w) const { + state->remove(w); + } + void clear() const { + state->clear(); + } + void unsubscribe() const { + state->unsubscribe(); + } + }; + + struct tag_observer {}; + template + struct observer_root : public subscription_base + { + typedef T value_type; + typedef composite_subscription subscription_type; + typedef typename subscription_type::weak_subscription weak_subscription; + typedef tag_observer observer_tag; + }; + template + struct observer_base : public observer_root + { + private: + subscription_type s; + + observer_base(); + public: + observer_base(subscription_type s) + : s(std::move(s)) + { + } + observer_base(const observer_base& o) + : s(o.s) + { + } + observer_base(observer_base&& o) + : s(std::move(o.s)) + { + } + observer_base& operator=(observer_base o) { + swap(o); + return *this; + } + void swap(observer_base& o) { + using std::swap; + swap(s, o.s); + } + bool is_subscribed() { + return s.is_subscribed(); + } + weak_subscription add(dynamic_subscription ds) { + return s.add(std::move(ds)); + } + void remove(weak_subscription ws) { + s.remove(ws); + } + void unsubscribe() { + s.unsubscribe(); + } + }; + template + struct observer_base : public observer_root + { + void swap(observer_base&) { + } + bool is_subscribed() { + return false; + } + weak_subscription add(dynamic_subscription ds) { + ds.unsubscribe(); + return weak_subscription(); + } + void remove(weak_subscription) { + } + void unsubscribe() { + } + }; + template + class is_observer + { + template + static typename C::observer_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_observer>::value; + }; + +namespace detail { + struct OnErrorEmpty + { + void operator()(std::exception_ptr&&){} + }; + struct OnCompletedEmpty + { + void operator()(){} + }; +} + + template + class dynamic_observer : public observer_base + { + public: + typedef std::function on_next_t; + typedef std::function on_error_t; + typedef std::function on_completed_t; + + private: + on_next_t onnext; + on_error_t onerror; + on_completed_t oncompleted; + + public: + dynamic_observer() + { + } + dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(composite_subscription()) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + dynamic_observer(const dynamic_observer& o) + : observer_base(o) + , onnext(o.onnext) + , onerror(o.onerror) + , oncompleted(o.oncompleted) + { + } + dynamic_observer(dynamic_observer&& o) + : observer_base(std::move(o)) + , onnext(std::move(o.onnext)) + , onerror(std::move(o.onerror)) + , oncompleted(std::move(o.oncompleted)) + { + } + dynamic_observer& operator=(dynamic_observer o) { + swap(o); + return *this; + } + void swap(dynamic_observer& o) { + using std::swap; + observer_base::swap(o); + swap(onnext, o.onnext); + swap(onerror, o.onerror); + swap(oncompleted, o.oncompleted); + } + + void on_next(T t) { + if (onnext) { + onnext(std::move(t)); + } + } + void on_error(std::exception_ptr e) { + if (onerror) { + onerror(e); + } + } + void on_completed() { + if (oncompleted) { + oncompleted(); + } + } + }; + + template + class static_observer : public observer_base + { + public: + typedef OnNext on_next_t; + typedef OnError on_error_t; + typedef OnCompleted on_completed_t; + + private: + on_next_t onnext; + on_error_t onerror; + on_completed_t oncompleted; + + public: + static_observer() + { + } + static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(composite_subscription()) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + static_observer(const static_observer& o) + : observer_base(o) + , onnext(o.onnext) + , onerror(o.onerror) + , oncompleted(o.oncompleted) + { + } + static_observer(static_observer&& o) + : observer_base(std::move(o)) + , onnext(std::move(o.onnext)) + , onerror(std::move(o.onerror)) + , oncompleted(std::move(o.oncompleted)) + { + } + static_observer& operator=(static_observer o) { + swap(o); + return *this; + } + void swap(static_observer& o) { + using std::swap; + observer_base::swap(o); + swap(onnext, o.onnext); + swap(onerror, o.onerror); + swap(oncompleted, o.oncompleted); + } + + void on_next(T t) { + onnext(std::move(t)); + } + void on_error(std::exception_ptr e) { + onerror(e); + } + void on_completed() { + oncompleted(); + } + }; + + template + class observer : public observer_root + { + typedef + typename std::conditional::value, I, dynamic_observer>::type + inner_t; + inner_t inner; + public: + ~observer() + { + } + observer(inner_t inner) + : inner(std::move(inner)) + { + } + void on_next(T t) { + if (is_subscribed()) { + inner.on_next(std::move(t)); + } + } + void on_error(std::exception_ptr e) { + if (is_subscribed()) { + inner.on_error(e); + } + unsubscribe(); + } + void on_completed() { + if (is_subscribed()) { + inner.on_completed(); + } + unsubscribe(); + } + bool is_subscribed() { + return inner.is_subscribed(); + } + weak_subscription add(dynamic_subscription ds) { + return inner.add(std::move(ds)); + } + void remove(weak_subscription ws) { + inner.remove(ws); + } + void unsubscribe() { + inner.unsubscribe(); + } + }; + template + class observer : public observer_base + { + public: + observer() + { + } + void on_next(T&&) { + } + void on_error(std::exception_ptr) { + } + void on_completed() { + } + }; + template + auto make_observer() + -> observer { + return observer(); + } + template + auto make_observer(I i) + -> typename std::enable_if::value, observer>::type { + return observer(std::move(i)); + } + template + auto make_observer(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) + -> observer> { + return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); + } + template + auto make_observer(OnNext n, OnError e, OnCompleted c) + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e), std::move(c))); + } + template + auto make_observer(OnNext n, OnError e) + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); + } + template + auto make_observer(OnNext n) + -> typename std::enable_if::value, + observer>>::type { + return observer>( + static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); + } + +#if 0 + template + class observable + { + public: + ~observable(); + + observable(const observable& o) + : onsubscribe(o.onsubscribe) + { + } + observable(observable&& o) + : onsubscribe(std::move(o.onsubscribe)) + { + } + + observable(on_subscribe_t os) + : onsubscribe(std::move(os)) + { + } + + static observable create(on_subscribe_t os) { + return observable(std::move(os)); + } + static observable create(const subscribe_t& s) { + return observable([s](observer o){ + o.add(s(o)); + }); + } + }; +#endif + +} +#endif diff --git a/Rx/CPP/test/v2/subscriptions/observer.cpp b/Rx/CPP/test/v2/subscriptions/observer.cpp new file mode 100644 index 0000000..25150c4 --- /dev/null +++ b/Rx/CPP/test/v2/subscriptions/observer.cpp @@ -0,0 +1,190 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("observer traits", "[observer][traits]"){ + GIVEN("given some observer types"){ + auto emptyNext = [](int){}; + rx::dynamic_observer dob(emptyNext); + auto so = rx::make_observer(emptyNext); + auto eo = rx::make_observer(); + WHEN("tested"){ + THEN("is_observer value is true for dynamic_observer"){ + REQUIRE(rx::is_observer::value); + } + THEN("is_observer value is true for static_observer"){ + REQUIRE(rx::is_observer::value); + } + THEN("is_observer value is true for observer"){ + REQUIRE(rx::is_observer::value); + } + } + } +} + +SCENARIO("non-observer traits", "[observer][traits]"){ + GIVEN("given some subscription types"){ + auto empty = [](){}; + rx::dynamic_subscription ds(empty); + rx::static_subscription ss(empty); + auto es = rx::make_subscription(); + rx::composite_subscription cs; + WHEN("tested"){ + THEN("is_observer value is false for dynamic_subscription"){ + REQUIRE(!rx::is_observer::value); + } + THEN("is_observer value is false for static_subscription"){ + REQUIRE(!rx::is_observer::value); + } + THEN("is_observer value is false for subscription"){ + REQUIRE(!rx::is_observer::value); + } + THEN("is_observer value is false for composite_subscription"){ + REQUIRE(!rx::is_observer::value); + } + } + } +} + +SCENARIO("observers with subscription traits", "[observer][subscription][traits]"){ + GIVEN("given some observer types"){ + auto emptyNext = [](int){}; + rx::dynamic_observer dob(emptyNext); + auto so = rx::make_observer(emptyNext); + auto eo = rx::make_observer(); + WHEN("tested"){ + THEN("is_subscription value is true for dynamic_observer"){ + REQUIRE(rx::is_subscription::value); + } + THEN("is_subscription value is true for static_observer"){ + REQUIRE(rx::is_subscription::value); + } + THEN("is_subscription value is true for observer"){ + REQUIRE(rx::is_subscription::value); + } + } + } +} + +SCENARIO("observer behavior", "[observer][traits]"){ + GIVEN("given some observer types"){ + int result = 0; + auto next = [&result](int i){result += i;}; + auto error = [&result](std::exception_ptr){result += 10;}; + auto completed = [&result](){result += 100;}; + auto dob = rx::make_observer(rx::dynamic_observer(next, error, completed)); + auto so = rx::make_observer(next, error, completed); + auto eo = rx::make_observer(); + WHEN("nothing is called"){ + THEN("dynamic_observer result is 0"){ + REQUIRE(result == 0); + } + THEN("static_observer result is 0"){ + REQUIRE(result == 0); + } + THEN("observer result is 0"){ + REQUIRE(result == 0); + } + THEN("dynamic_observer is subscribed"){ + REQUIRE(dob.is_subscribed()); + } + THEN("static_observer is subscribed"){ + REQUIRE(so.is_subscribed()); + } + THEN("observer is subscribed"){ + REQUIRE(!eo.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("observer result is 0"){ + eo.on_next(1); + REQUIRE(result == 0); + } + 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()); + } + THEN("observer is not subscribed"){ + eo.on_next(1); + REQUIRE(!eo.is_subscribed()); + } + } + WHEN("onnext is called with 1 after error"){ + THEN("dynamic_observer result is 10"){ + dob.on_error(std::current_exception()); + dob.on_next(1); + REQUIRE(result == 10); + } + THEN("static_observer result is 10"){ + so.on_error(std::current_exception()); + so.on_next(1); + REQUIRE(result == 10); + } + THEN("observer result is 0"){ + eo.on_error(std::current_exception()); + eo.on_next(1); + REQUIRE(result == 0); + } + THEN("dynamic_observer is not subscribed"){ + dob.on_error(std::current_exception()); + dob.on_next(1); + REQUIRE(!dob.is_subscribed()); + } + THEN("static_observer is not subscribed"){ + so.on_error(std::current_exception()); + so.on_next(1); + REQUIRE(!so.is_subscribed()); + } + THEN("observer is not subscribed"){ + eo.on_error(std::current_exception()); + eo.on_next(1); + REQUIRE(!eo.is_subscribed()); + } + } + WHEN("onnext is called with 1 after completed"){ + THEN("dynamic_observer result is 100"){ + dob.on_completed(); + dob.on_next(1); + REQUIRE(result == 100); + } + THEN("static_observer result is 100"){ + so.on_completed(); + so.on_next(1); + REQUIRE(result == 100); + } + THEN("observer result is 0"){ + eo.on_completed(); + eo.on_next(1); + REQUIRE(result == 0); + } + THEN("dynamic_observer is not subscribed"){ + dob.on_completed(); + dob.on_next(1); + REQUIRE(!dob.is_subscribed()); + } + THEN("static_observer is not subscribed"){ + so.on_completed(); + so.on_next(1); + REQUIRE(!so.is_subscribed()); + } + THEN("observer is not subscribed"){ + eo.on_completed(); + eo.on_next(1); + REQUIRE(!eo.is_subscribed()); + } + } + } +} diff --git a/Rx/CPP/test/v2/subscriptions/subscription.cpp b/Rx/CPP/test/v2/subscriptions/subscription.cpp new file mode 100644 index 0000000..3244946 --- /dev/null +++ b/Rx/CPP/test/v2/subscriptions/subscription.cpp @@ -0,0 +1,181 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; + +#include "catch.hpp" + +SCENARIO("subscription traits", "[subscription][traits]"){ + GIVEN("given some subscription types"){ + auto empty = [](){}; + rx::dynamic_subscription ds(empty); + rx::static_subscription ss(empty); + auto es = rx::make_subscription(); + rx::composite_subscription cs; + WHEN("tested"){ + THEN("is_subscription value is true for dynamic_subscription"){ + REQUIRE(rx::is_subscription::value); + } + THEN("is_subscription value is true for static_subscription"){ + REQUIRE(rx::is_subscription::value); + } + THEN("is_subscription value is true for subscription"){ + REQUIRE(rx::is_subscription::value); + } + THEN("is_subscription value is true for composite_subscription"){ + REQUIRE(rx::is_subscription::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"){ + REQUIRE(!rx::is_subscription::value); + } + THEN("is_subscription value is false for int"){ + REQUIRE(!rx::is_subscription::value); + } + THEN("is_subscription value is false for void*"){ + REQUIRE(!rx::is_subscription::value); + } + THEN("is_subscription value is false for void"){ + REQUIRE(!rx::is_subscription::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 dynamic", "[subscription]"){ + GIVEN("given a subscription"){ + int i=0; + auto s = rx::make_subscription(rx::dynamic_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(rx::make_subscription(rx::dynamic_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 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/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index bd4e4b6..ba23eb9 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -28,6 +28,8 @@ set(TEST_SOURCES ${TEST_DIR}/operators/SelectMany.cpp ${TEST_DIR}/operators/Where.cpp ${TEST_DIR}/operators/Publish.cpp + ${TEST_DIR}/v2/subscriptions/observer.cpp + ${TEST_DIR}/v2/subscriptions/subscription.cpp ) add_executable(rxcpp_test ${TEST_SOURCES}) -- GitLab From 40b07847443d13770b1d340ed9377f5bf66a9350 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 30 Jan 2014 21:36:58 -0800 Subject: [PATCH 178/782] added filter and range observables --- Rx/CPP/src/rxcpp/rx.hpp | 241 +++++++++++++++++++++------- Rx/CPP/test/v2/operators/filter.cpp | 33 ++++ projects/CMake/CMakeLists.txt | 1 + 3 files changed, 215 insertions(+), 60 deletions(-) create mode 100644 Rx/CPP/test/v2/operators/filter.cpp diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index c9a8157..938fefd 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -21,7 +21,7 @@ namespace rxcpp { class is_subscription { template - static typename C::subscription_tag check(int); + static typename C::subscription_tag check(int); template static void check(...); public: @@ -32,7 +32,7 @@ namespace rxcpp { { typedef std::function unsubscribe_call_type; unsubscribe_call_type unsubscribe_call; - dynamic_subscription() + dynamic_subscription() { } public: @@ -50,7 +50,7 @@ namespace rxcpp { i.unsubscribe();}) { } - dynamic_subscription(unsubscribe_call_type s) + dynamic_subscription(unsubscribe_call_type s) : unsubscribe_call(std::move(s)) { } @@ -64,7 +64,7 @@ namespace rxcpp { { typedef Unsubscribe unsubscribe_call_type; unsubscribe_call_type unsubscribe_call; - static_subscription() + static_subscription() { } public: @@ -76,7 +76,7 @@ namespace rxcpp { : unsubscribe_call(std::move(o.unsubscribe_call)) { } - static_subscription(unsubscribe_call_type s) + static_subscription(unsubscribe_call_type s) : unsubscribe_call(std::move(s)) { } @@ -120,19 +120,19 @@ namespace rxcpp { void unsubscribe() const { } }; - inline auto make_subscription() + inline auto make_subscription() -> subscription { return subscription(); } template - auto make_subscription(I i) - -> typename std::enable_if::value, + auto make_subscription(I i) + -> typename std::enable_if::value, subscription>::type { return subscription(std::move(i)); } template - auto make_subscription(Unsubscribe u) - -> typename std::enable_if::value, + auto make_subscription(Unsubscribe u) + -> typename std::enable_if::value, subscription< static_subscription>>::type { return subscription< static_subscription>( static_subscription(std::move(u))); @@ -279,7 +279,7 @@ namespace rxcpp { struct observer_base : public observer_root { private: - subscription_type s; + mutable subscription_type s; observer_base(); public: @@ -303,16 +303,16 @@ namespace rxcpp { using std::swap; swap(s, o.s); } - bool is_subscribed() { + bool is_subscribed() const { return s.is_subscribed(); } - weak_subscription add(dynamic_subscription ds) { + weak_subscription add(dynamic_subscription ds) const { return s.add(std::move(ds)); } - void remove(weak_subscription ws) { + void remove(weak_subscription ws) const { s.remove(ws); } - void unsubscribe() { + void unsubscribe() const { s.unsubscribe(); } }; @@ -321,23 +321,23 @@ namespace rxcpp { { void swap(observer_base&) { } - bool is_subscribed() { + bool is_subscribed() const { return false; } - weak_subscription add(dynamic_subscription ds) { + weak_subscription add(dynamic_subscription ds) const { ds.unsubscribe(); return weak_subscription(); } - void remove(weak_subscription) { + void remove(weak_subscription) const { } - void unsubscribe() { + void unsubscribe() const { } }; template class is_observer { template - static typename C::observer_tag check(int); + static typename C::observer_tag check(int); template static void check(...); public: @@ -347,11 +347,11 @@ namespace rxcpp { namespace detail { struct OnErrorEmpty { - void operator()(std::exception_ptr&&){} + void operator()(std::exception_ptr) const {} }; struct OnCompletedEmpty { - void operator()(){} + void operator()() const {} }; } @@ -412,17 +412,17 @@ namespace detail { swap(oncompleted, o.oncompleted); } - void on_next(T t) { + void on_next(T t) const { if (onnext) { onnext(std::move(t)); } } - void on_error(std::exception_ptr e) { + void on_error(std::exception_ptr e) const { if (onerror) { onerror(e); } } - void on_completed() { + void on_completed() const { if (oncompleted) { oncompleted(); } @@ -486,13 +486,13 @@ namespace detail { swap(oncompleted, o.oncompleted); } - void on_next(T t) { + void on_next(T t) const { onnext(std::move(t)); } - void on_error(std::exception_ptr e) { + void on_error(std::exception_ptr e) const { onerror(e); } - void on_completed() { + void on_completed() const { oncompleted(); } }; @@ -505,40 +505,40 @@ namespace detail { inner_t; inner_t inner; public: - ~observer() + ~observer() { } observer(inner_t inner) : inner(std::move(inner)) { } - void on_next(T t) { + void on_next(T t) const { if (is_subscribed()) { inner.on_next(std::move(t)); } } - void on_error(std::exception_ptr e) { + void on_error(std::exception_ptr e) const { if (is_subscribed()) { inner.on_error(e); } unsubscribe(); } - void on_completed() { + void on_completed() const { if (is_subscribed()) { inner.on_completed(); } unsubscribe(); } - bool is_subscribed() { + bool is_subscribed() const { return inner.is_subscribed(); } - weak_subscription add(dynamic_subscription ds) { + weak_subscription add(dynamic_subscription ds) const { return inner.add(std::move(ds)); } - void remove(weak_subscription ws) { + void remove(weak_subscription ws) const { inner.remove(ws); } - void unsubscribe() { + void unsubscribe() const { inner.unsubscribe(); } }; @@ -549,11 +549,11 @@ namespace detail { observer() { } - void on_next(T&&) { + void on_next(T&&) const { } - void on_error(std::exception_ptr) { + void on_error(std::exception_ptr) const { } - void on_completed() { + void on_completed() const { } }; template @@ -585,40 +585,161 @@ namespace detail { } template auto make_observer(OnNext n) - -> typename std::enable_if::value, + -> typename std::enable_if::value, observer>>::type { return observer>( static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); } -#if 0 - template - class observable - { - public: - ~observable(); +#if 1 + template + class observable; - observable(const observable& o) - : onsubscribe(o.onsubscribe) + namespace operators + { + struct tag_operator {}; + template + struct operator_base { - } - observable(observable&& o) - : onsubscribe(std::move(o.onsubscribe)) + typedef T value_type; + typedef tag_operator operator_tag; + }; + template + class is_operator + { + template + static typename C::operator_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_operator>::value; + }; + + template + struct filter : public operator_base + { + Observable source; + Predicate test; + filter(Observable o, Predicate p) + : source(std::move(o)) + , test(std::move(p)) + {} + template + void on_subscribe(observer o) { + o.add(source.subscribe(make_observer( + // on_next + [this, o](T t) { + bool filtered = false; + try { + filtered = !this->test(t); + } catch(...) { + o.on_error(std::current_exception()); + o.unsubscribe(); + } + if (!filtered) { + o.on_next(std::move(t)); + } + }, + // on_error + [o](std::exception_ptr e) { + o.on_error(e); + }, + // on_completed + [o]() { + o.on_completed(); + } + ))); + } + }; + + } + namespace rxo=operators; + + namespace sources + { + struct tag_source {}; + template + struct source_base { - } + typedef T value_type; + typedef tag_source source_tag; + }; + template + class is_source + { + template + static typename C::source_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_source>::value; + }; - observable(on_subscribe_t os) - : onsubscribe(std::move(os)) + template + struct range : public source_base { + struct state_type + { + T next; + size_t remaining; + ptrdiff_t step; + }; + state_type init; + range(T b, size_t c, ptrdiff_t s) + { + init.next = b; + init.remaining = c; + init.step = s; + } + template + void on_subscribe(observer o) { + auto state = std::make_shared(init); + auto s = make_subscription(); + for (;state->remaining != 0; --state->remaining) { + o.on_next(state->next); + state->next = static_cast(state->step + state->next); + } + o.on_completed(); + } + }; + } + namespace rxs=sources; + + template + class observable + : public B + { + public: + static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + + template + observable(A&&... a) + : B(std::forward(a)...) + {} + + template + auto subscribe(observer o) + -> decltype(make_subscription(o)) { + B::on_subscribe(o); + return make_subscription(o); } - static observable create(on_subscribe_t os) { - return observable(std::move(os)); + template + observable> filter(Predicate p) { + return observable>(*this, std::move(p)); } - static observable create(const subscribe_t& s) { - return observable([s](observer o){ - o.add(s(o)); - }); + }; + + // observable<> has static methods to construct observable sources and adaptors. + // observable<> is not constructable + template<> + class observable + { + ~observable(); + public: + template + static observable> range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) { + return observable>(start, count, step); } }; #endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp new file mode 100644 index 0000000..2ff05a3 --- /dev/null +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -0,0 +1,33 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; + +#include "catch.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", "[filter][operators][traits]"){ + GIVEN("given a range of ints from 1 to 100"){ + WHEN("filtered to primes"){ + THEN("a subscription only observes primes"){ + auto s = rx::observable<>::range(1, 100, 1) + .filter(IsPrime) + .subscribe(rx::make_observer([](int t) { + const auto prime = IsPrime(t) ? t : -1; + REQUIRE( t == prime ); + })); + } + } + } +} + diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index ba23eb9..74ce562 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -30,6 +30,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/Publish.cpp ${TEST_DIR}/v2/subscriptions/observer.cpp ${TEST_DIR}/v2/subscriptions/subscription.cpp + ${TEST_DIR}/v2/operators/filter.cpp ) add_executable(rxcpp_test ${TEST_SOURCES}) -- GitLab From 0032aea34ccc6af751ddfb02f57d03f83a30ca4b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 30 Jan 2014 22:05:06 -0800 Subject: [PATCH 179/782] adds subscribe overloads to simplify the test --- Rx/CPP/src/rxcpp/rx.hpp | 21 +++++++++++++++++++-- Rx/CPP/test/v2/operators/filter.cpp | 4 ++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 938fefd..8f4578a 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -591,7 +591,6 @@ namespace detail { static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); } -#if 1 template class observable; @@ -724,6 +723,25 @@ namespace detail { return make_subscription(o); } + template + auto subscribe(OnNext n) + -> typename std::enable_if::value, + decltype(make_subscription(make_observer(std::move(n))))>::type { + return subscribe(make_observer(std::move(n))); + } + + template + auto subscribe(OnNext n, OnError e) + -> decltype(make_subscription(make_observer(std::move(n), std::move(e)))) { + return subscribe(make_observer(std::move(n), std::move(e))); + } + + template + auto subscribe(OnNext n, OnError e, OnCompleted c) + -> decltype(make_subscription(make_observer(std::move(n), std::move(e), std::move(c)))) { + return subscribe(make_observer(std::move(n), std::move(e), std::move(c))); + } + template observable> filter(Predicate p) { return observable>(*this, std::move(p)); @@ -742,7 +760,6 @@ namespace detail { return observable>(start, count, step); } }; -#endif } #endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 2ff05a3..4116a4a 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -22,10 +22,10 @@ SCENARIO("filter", "[filter][operators][traits]"){ THEN("a subscription only observes primes"){ auto s = rx::observable<>::range(1, 100, 1) .filter(IsPrime) - .subscribe(rx::make_observer([](int t) { + .subscribe([](int t) { const auto prime = IsPrime(t) ? t : -1; REQUIRE( t == prime ); - })); + }); } } } -- GitLab From 4e275e95803707e3e8106106d099bb106aeb58be Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 31 Jan 2014 17:01:36 -0800 Subject: [PATCH 180/782] add support for operator >> usage. --- Rx/CPP/src/rxcpp/rx.hpp | 295 ++++++++++++++++++---------- Rx/CPP/test/v2/operators/filter.cpp | 17 +- 2 files changed, 208 insertions(+), 104 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 8f4578a..908bdf5 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -594,115 +594,196 @@ namespace detail { template class observable; - namespace operators +namespace operators +{ + struct tag_operator {}; + template + struct operator_base { - struct tag_operator {}; - template - struct operator_base - { - typedef T value_type; - typedef tag_operator operator_tag; - }; - template - class is_operator - { - template - static typename C::operator_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_same(0)), tag_operator>::value; - }; + typedef T value_type; + typedef tag_operator operator_tag; + }; + template + class is_operator + { + template + static typename C::operator_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_operator>::value; + }; - template - struct filter : public operator_base - { - Observable source; - Predicate test; - filter(Observable o, Predicate p) - : source(std::move(o)) - , test(std::move(p)) - {} - template - void on_subscribe(observer o) { - o.add(source.subscribe(make_observer( - // on_next - [this, o](T t) { - bool filtered = false; - try { - filtered = !this->test(t); - } catch(...) { - o.on_error(std::current_exception()); - o.unsubscribe(); - } - if (!filtered) { - o.on_next(std::move(t)); - } - }, - // on_error - [o](std::exception_ptr e) { - o.on_error(e); - }, - // on_completed - [o]() { - o.on_completed(); - } - ))); - } - }; +namespace detail { + template + class subscribe_to_observer_factory + { + Observer observer; + public: + subscribe_to_observer_factory(Observer o) : observer(std::move(o)) {} + template + auto operator()(Observable source) + -> decltype(source.subscribe(std::move(observer))) { + return source.subscribe(std::move(observer)); + } + }; + template + class subscribe_factory + { + OnNext onnext; + OnError onerror; + OnCompleted oncompleted; + public: + subscribe_factory(OnNext n, OnError e, OnCompleted c) + : onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + {} + template + auto operator()(Observable source) + -> decltype(source.subscribe(std::move(onnext), std::move(onerror), std::move(oncompleted))) { + return source.subscribe(std::move(onnext), std::move(onerror), std::move(oncompleted)); + } + }; +} + template + auto subscribe(Observer o) + -> typename std::enable_if::value, + detail::subscribe_to_observer_factory>::type { + return detail::subscribe_to_observer_factory(std::move(o)); + } + + template + auto subscribe(OnNext n) + -> typename std::enable_if::value, + detail::subscribe_factory>::type { + return detail::subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); + } + + template + auto subscribe(OnNext n, OnError e) + -> detail::subscribe_factory { + return detail::subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); + } + template + auto subscribe(OnNext n, OnError e, OnCompleted c) + -> detail::subscribe_factory { + return detail::subscribe_factory(std::move(n), std::move(e), std::move(c)); } - namespace rxo=operators; - namespace sources +namespace detail { + + template + struct filter : public operator_base { - struct tag_source {}; - template - struct source_base + Observable source; + Predicate test; + filter(Observable o, Predicate p) + : source(std::move(o)) + , test(std::move(p)) + {} + template + void on_subscribe(observer o) { + o.add(source.subscribe(make_observer( + // on_next + [this, o](T t) { + bool filtered = false; + try { + filtered = !this->test(t); + } catch(...) { + o.on_error(std::current_exception()); + o.unsubscribe(); + } + if (!filtered) { + o.on_next(std::move(t)); + } + }, + // on_error + [o](std::exception_ptr e) { + o.on_error(e); + }, + // on_completed + [o]() { + o.on_completed(); + } + ))); + } + }; + template + class filter_factory + { + Predicate predicate; + public: + filter_factory(Predicate p) : predicate(std::move(p)) {} + template + auto operator()(Observable source) + -> observable> { + return observable>(source, std::move(predicate)); + } + }; +} + template + auto filter(Predicate p) + -> detail::filter_factory { + return detail::filter_factory(std::move(p)); + } + +} +namespace rxo=operators; + +namespace sources +{ + struct tag_source {}; + template + struct source_base + { + typedef T value_type; + typedef tag_source source_tag; + }; + template + class is_source + { + template + static typename C::source_tag check(int); + template + static void check(...); + public: + static const bool value = std::is_same(0)), tag_source>::value; + }; + +namespace detail +{ + template + struct range : public source_base + { + struct state_type { - typedef T value_type; - typedef tag_source source_tag; - }; - template - class is_source - { - template - static typename C::source_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_same(0)), tag_source>::value; + T next; + size_t remaining; + ptrdiff_t step; }; - - template - struct range : public source_base + state_type init; + range(T b, size_t c, ptrdiff_t s) { - struct state_type - { - T next; - size_t remaining; - ptrdiff_t step; - }; - state_type init; - range(T b, size_t c, ptrdiff_t s) - { - init.next = b; - init.remaining = c; - init.step = s; - } - template - void on_subscribe(observer o) { - auto state = std::make_shared(init); - auto s = make_subscription(); - for (;state->remaining != 0; --state->remaining) { - o.on_next(state->next); - state->next = static_cast(state->step + state->next); - } - o.on_completed(); + init.next = b; + init.remaining = c; + init.step = s; + } + template + void on_subscribe(observer o) { + auto state = std::make_shared(init); + auto s = make_subscription(); + for (;state->remaining != 0; --state->remaining) { + o.on_next(state->next); + state->next = static_cast(state->step + state->next); } - }; - } - namespace rxs=sources; + o.on_completed(); + } + }; +} +} +namespace rxs=sources; template class observable @@ -743,8 +824,9 @@ namespace detail { } template - observable> filter(Predicate p) { - return observable>(*this, std::move(p)); + auto filter(Predicate p) + -> observable> { + return observable>(*this, std::move(p)); } }; @@ -756,10 +838,17 @@ namespace detail { ~observable(); public: template - static observable> range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) { - return observable>(start, count, step); + static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) + -> observable> { + return observable>(start, count, step); } }; + template + auto operator >> (observable source, OperatorFactory&& op) + -> decltype(op(source)){ + return op(source); + } + } #endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 4116a4a..7648909 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,5 +1,6 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; +namespace rxo=rxcpp::operators; #include "catch.hpp" @@ -16,7 +17,7 @@ bool IsPrime(int x) } } -SCENARIO("filter", "[filter][operators][traits]"){ +SCENARIO("filter members", "[filter][operators][traits]"){ GIVEN("given a range of ints from 1 to 100"){ WHEN("filtered to primes"){ THEN("a subscription only observes primes"){ @@ -31,3 +32,17 @@ SCENARIO("filter", "[filter][operators][traits]"){ } } +SCENARIO("filter operators", "[filter][operators][traits]"){ + GIVEN("given a range of ints from 1 to 100"){ + WHEN("filtered to primes"){ + THEN("a subscription only observes primes"){ + auto s = rx::observable<>::range(1, 100, 1) + >> rxo::filter(IsPrime) + >> rxo::subscribe([](int t) { + const auto prime = IsPrime(t) ? t : -1; + REQUIRE( t == prime ); + }); + } + } + } +} -- GitLab From d61eb6c4b362a5aca9ff6d6049ac518a87068dbe Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 31 Jan 2014 17:17:45 -0800 Subject: [PATCH 181/782] move the observable base to a member --- Rx/CPP/src/rxcpp/rx.hpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 908bdf5..708e1eb 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -719,7 +719,8 @@ namespace detail { template auto operator()(Observable source) -> observable> { - return observable>(source, std::move(predicate)); + return observable>( + filter(source, std::move(predicate))); } }; } @@ -785,22 +786,26 @@ namespace detail } namespace rxs=sources; - template + template class observable - : public B { + SourceOperator source_operator; public: - static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + typedef T value_type; + + static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); - template - observable(A&&... a) - : B(std::forward(a)...) + explicit observable(const SourceOperator& o) + : source_operator(o) + {} + explicit observable(SourceOperator&& o) + : source_operator(std::move(o)) {} template auto subscribe(observer o) -> decltype(make_subscription(o)) { - B::on_subscribe(o); + source_operator.on_subscribe(o); return make_subscription(o); } @@ -825,8 +830,9 @@ namespace rxs=sources; template auto filter(Predicate p) - -> observable> { - return observable>(*this, std::move(p)); + -> observable> { + return observable>( + rxo::detail::filter(*this, std::move(p))); } }; @@ -839,13 +845,14 @@ namespace rxs=sources; public: template static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) - -> observable> { - return observable>(start, count, step); + -> observable> { + return observable>( + rxs::detail::range(start, count, step)); } }; - template - auto operator >> (observable source, OperatorFactory&& op) + template + auto operator >> (observable source, OperatorFactory&& op) -> decltype(op(source)){ return op(source); } -- GitLab From 82fc7ad05f85efcc0f180f5f3ab6fc7d8e8c94b9 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sun, 2 Feb 2014 13:49:13 -0800 Subject: [PATCH 182/782] static assert that the filter predicate is ok --- Rx/CPP/src/rxcpp/rx.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 708e1eb..fbf63e7 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -25,7 +25,7 @@ namespace rxcpp { template static void check(...); public: - static const bool value = std::is_same(0)), tag_subscription>::value; + static const bool value = std::is_convertible(0)), tag_subscription>::value; }; class dynamic_subscription : public subscription_base @@ -341,7 +341,7 @@ namespace rxcpp { template static void check(...); public: - static const bool value = std::is_same(0)), tag_observer>::value; + static const bool value = std::is_convertible(0)), tag_observer>::value; }; namespace detail { @@ -611,7 +611,7 @@ namespace operators template static void check(...); public: - static const bool value = std::is_same(0)), tag_operator>::value; + static const bool value = std::is_convertible(0)), tag_operator>::value; }; namespace detail { @@ -679,10 +679,17 @@ namespace detail { { Observable source; Predicate test; + + template + static auto check(int) -> decltype((*(CP*)nullptr)(*(CT*)nullptr)); + template + static void check(...); filter(Observable o, Predicate p) : source(std::move(o)) , test(std::move(p)) - {} + { + static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); + } template void on_subscribe(observer o) { o.add(source.subscribe(make_observer( @@ -750,7 +757,7 @@ namespace sources template static void check(...); public: - static const bool value = std::is_same(0)), tag_source>::value; + static const bool value = std::is_convertible(0)), tag_source>::value; }; namespace detail -- GitLab From d3c93a84d3360d2b53ea1e199ade9bcd219df9e4 Mon Sep 17 00:00:00 2001 From: Tobias Furuholm Date: Sat, 1 Feb 2014 14:00:07 +0100 Subject: [PATCH 183/782] builds on clang --- Rx/CPP/src/rxcpp/rx.hpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index fbf63e7..da3c930 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -279,6 +279,9 @@ namespace rxcpp { struct observer_base : public observer_root { private: + typedef typename observer_root::subscription_type subscription_type; + typedef typename observer_root::weak_subscription weak_subscription; + mutable subscription_type s; observer_base(); @@ -319,6 +322,8 @@ namespace rxcpp { template struct observer_base : public observer_root { + typedef typename observer_root::weak_subscription weak_subscription; + void swap(observer_base&) { } bool is_subscribed() const { @@ -373,28 +378,28 @@ namespace detail { { } dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) + : observer_base(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) + : observer_base(composite_subscription()) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } dynamic_observer(const dynamic_observer& o) - : observer_base(o) + : observer_base(o) , onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } dynamic_observer(dynamic_observer&& o) - : observer_base(std::move(o)) + : observer_base(std::move(o)) , onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) @@ -406,7 +411,7 @@ namespace detail { } void swap(dynamic_observer& o) { using std::swap; - observer_base::swap(o); + observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -447,28 +452,28 @@ namespace detail { { } static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) + : observer_base(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) + : observer_base(composite_subscription()) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } static_observer(const static_observer& o) - : observer_base(o) + : observer_base(o) , onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } static_observer(static_observer&& o) - : observer_base(std::move(o)) + : observer_base(std::move(o)) , onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) @@ -480,7 +485,7 @@ namespace detail { } void swap(static_observer& o) { using std::swap; - observer_base::swap(o); + observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -500,8 +505,9 @@ namespace detail { template class observer : public observer_root { - typedef - typename std::conditional::value, I, dynamic_observer>::type + typedef typename observer_root::weak_subscription weak_subscription; + typedef typename std::conditional::value, I, dynamic_observer>::type + inner_t; inner_t inner; public: -- GitLab From d7c47b2934c5625b51d2be933103cb211ef1ec76 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 5 Feb 2014 21:00:21 -0800 Subject: [PATCH 184/782] modified furuholm's helpful changes for clang I did not want the private typedefs to hide the public ones in root. The compiler needed a dependent name so I gave it a typedefs for this_type and base_type where needed and used those to make the inherited typedef references dependent name lookups. I have found that using fixed names like this_type and base_type make it easier to move and copy code around. --- Rx/CPP/src/rxcpp/rx.hpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index da3c930..3cc8232 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -279,14 +279,13 @@ namespace rxcpp { struct observer_base : public observer_root { private: - typedef typename observer_root::subscription_type subscription_type; - typedef typename observer_root::weak_subscription weak_subscription; + typedef observer_base this_type; - mutable subscription_type s; + mutable typename this_type::subscription_type s; observer_base(); public: - observer_base(subscription_type s) + observer_base(typename this_type::subscription_type s) : s(std::move(s)) { } @@ -309,10 +308,10 @@ namespace rxcpp { bool is_subscribed() const { return s.is_subscribed(); } - weak_subscription add(dynamic_subscription ds) const { + typename this_type::weak_subscription add(dynamic_subscription ds) const { return s.add(std::move(ds)); } - void remove(weak_subscription ws) const { + void remove(typename this_type::weak_subscription ws) const { s.remove(ws); } void unsubscribe() const { @@ -322,18 +321,20 @@ namespace rxcpp { template struct observer_base : public observer_root { - typedef typename observer_root::weak_subscription weak_subscription; + private: + typedef observer_base this_type; + public: void swap(observer_base&) { } bool is_subscribed() const { return false; } - weak_subscription add(dynamic_subscription ds) const { + typename this_type::weak_subscription add(dynamic_subscription ds) const { ds.unsubscribe(); - return weak_subscription(); + return typename this_type::weak_subscription(); } - void remove(weak_subscription) const { + void remove(typename this_type::weak_subscription) const { } void unsubscribe() const { } @@ -369,6 +370,8 @@ namespace detail { typedef std::function on_completed_t; private: + typedef observer_base base_type; + on_next_t onnext; on_error_t onerror; on_completed_t oncompleted; @@ -378,28 +381,28 @@ namespace detail { { } dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) + : base_type(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) + : base_type(composite_subscription()) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } dynamic_observer(const dynamic_observer& o) - : observer_base(o) + : base_type(o) , onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } dynamic_observer(dynamic_observer&& o) - : observer_base(std::move(o)) + : base_type(std::move(o)) , onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) @@ -505,9 +508,9 @@ namespace detail { template class observer : public observer_root { - typedef typename observer_root::weak_subscription weak_subscription; + typedef observer this_type; typedef typename std::conditional::value, I, dynamic_observer>::type - + inner_t; inner_t inner; public: @@ -538,10 +541,10 @@ namespace detail { bool is_subscribed() const { return inner.is_subscribed(); } - weak_subscription add(dynamic_subscription ds) const { + typename this_type::weak_subscription add(dynamic_subscription ds) const { return inner.add(std::move(ds)); } - void remove(weak_subscription ws) const { + void remove(typename this_type::weak_subscription ws) const { inner.remove(ws); } void unsubscribe() const { -- GitLab From 9cfe6e2caa0ea44acd884609701013277550559a Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 6 Feb 2014 10:58:01 -0800 Subject: [PATCH 185/782] refactor into multiple headers --- Rx/CPP/src/rxcpp/operators/rx-filter.hpp | 86 ++ Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp | 81 ++ Rx/CPP/src/rxcpp/rx-includes.hpp | 100 +++ Rx/CPP/src/rxcpp/rx-observer.hpp | 349 ++++++++ Rx/CPP/src/rxcpp/rx-operators.hpp | 46 + Rx/CPP/src/rxcpp/rx-sources.hpp | 40 + Rx/CPP/src/rxcpp/rx-subscription.hpp | 266 ++++++ Rx/CPP/src/rxcpp/rx.hpp | 891 ++------------------ Rx/CPP/src/rxcpp/sources/rx-range.hpp | 57 ++ Rx/CPP/test/v2/operators/filter.cpp | 3 +- 10 files changed, 1080 insertions(+), 839 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/operators/rx-filter.hpp create mode 100644 Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-includes.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-observer.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-operators.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-sources.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-subscription.hpp create mode 100644 Rx/CPP/src/rxcpp/sources/rx-range.hpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp new file mode 100644 index 0000000..09b11eb --- /dev/null +++ b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp @@ -0,0 +1,86 @@ +// 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_FILTER_HPP) +#define RXCPP_OPERATORS_RX_FILTER_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct filter : public operator_base +{ + Observable source; + Predicate test; + + template + static auto check(int) -> decltype((*(CP*)nullptr)(*(CT*)nullptr)); + template + static void check(...); + filter(Observable o, Predicate p) + : source(std::move(o)) + , test(std::move(p)) + { + static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); + } + template + void on_subscribe(observer o) { + o.add(source.subscribe(make_observer( + // on_next + [this, o](T t) { + bool filtered = false; + try { + filtered = !this->test(t); + } catch(...) { + o.on_error(std::current_exception()); + o.unsubscribe(); + } + if (!filtered) { + o.on_next(std::move(t)); + } + }, + // on_error + [o](std::exception_ptr e) { + o.on_error(e); + }, + // on_completed + [o]() { + o.on_completed(); + } + ))); + } +}; + +template +class filter_factory +{ + Predicate predicate; +public: + filter_factory(Predicate p) : predicate(std::move(p)) {} + template + auto operator()(Observable source) + -> observable> { + return observable>( + filter(source, std::move(predicate))); + } +}; + +} + +template +auto filter(Predicate p) + -> detail::filter_factory { + return detail::filter_factory(std::move(p)); +} + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp new file mode 100644 index 0000000..40af349 --- /dev/null +++ b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp @@ -0,0 +1,81 @@ +// 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_SUBSCRIBE_HPP) +#define RXCPP_OPERATORS_RX_SUBSCRIBE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +class subscribe_to_observer_factory +{ + Observer observer; +public: + subscribe_to_observer_factory(Observer o) : observer(std::move(o)) {} + template + auto operator()(Observable source) + -> decltype(source.subscribe(std::move(observer))) { + return source.subscribe(std::move(observer)); + } +}; +template +class subscribe_factory +{ + OnNext onnext; + OnError onerror; + OnCompleted oncompleted; +public: + subscribe_factory(OnNext n, OnError e, OnCompleted c) + : onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + {} + template + auto operator()(Observable source) + -> decltype(source.subscribe(make_observer(std::move(onnext), std::move(onerror), std::move(oncompleted)))) { + return source.subscribe(make_observer(std::move(onnext), std::move(onerror), std::move(oncompleted))); + } +}; + +} + + +template +auto subscribe(Observer o) + -> typename std::enable_if::value, + detail::subscribe_to_observer_factory>::type { + return detail::subscribe_to_observer_factory(std::move(o)); +} + +template +auto subscribe(OnNext n) + -> typename std::enable_if::value, + detail::subscribe_factory>::type { + return detail::subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); +} + +template +auto subscribe(OnNext n, OnError e) + -> detail::subscribe_factory { + return detail::subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); +} + +template +auto subscribe(OnNext n, OnError e, OnCompleted c) + -> detail::subscribe_factory { + return detail::subscribe_factory(std::move(n), std::move(e), std::move(c)); +} + + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp new file mode 100644 index 0000000..79f57b4 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -0,0 +1,100 @@ +// 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 + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// some configuration macros +#if defined(_MSC_VER) + +#if _MSC_VER > 1600 +#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 + +#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 + +#endif + +#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) +#define RXCPP_USE_WINRT 0 +#else +#define RXCPP_USE_WINRT 1 +#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_WINRT) +#undef RXCPP_USE_WINRT +#define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT +#endif + +#include "rx-subscription.hpp" +#include "rx-observer.hpp" +#include "rx-operators.hpp" +#include "rx-sources.hpp" + +#pragma pop_macro("min") +#pragma pop_macro("max") + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp new file mode 100644 index 0000000..59518c8 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -0,0 +1,349 @@ +// 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 { + + +struct tag_observer {}; +template +struct observer_root : public subscription_base +{ + typedef T value_type; + typedef composite_subscription subscription_type; + typedef typename subscription_type::weak_subscription weak_subscription; + typedef tag_observer observer_tag; +}; +template +struct observer_base : public observer_root +{ +private: + typedef observer_base this_type; + + mutable typename this_type::subscription_type s; + + observer_base(); +public: + observer_base(typename this_type::subscription_type s) + : s(std::move(s)) + { + } + observer_base(const observer_base& o) + : s(o.s) + { + } + observer_base(observer_base&& o) + : s(std::move(o.s)) + { + } + observer_base& operator=(observer_base o) { + swap(o); + return *this; + } + void swap(observer_base& o) { + using std::swap; + swap(s, o.s); + } + bool is_subscribed() const { + return s.is_subscribed(); + } + typename this_type::weak_subscription add(dynamic_subscription ds) const { + return s.add(std::move(ds)); + } + void remove(typename this_type::weak_subscription ws) const { + s.remove(ws); + } + void unsubscribe() const { + s.unsubscribe(); + } +}; +template +struct observer_base : public observer_root +{ +private: + typedef observer_base this_type; + +public: + void swap(observer_base&) { + } + bool is_subscribed() const { + return false; + } + typename this_type::weak_subscription add(dynamic_subscription ds) const { + ds.unsubscribe(); + return typename this_type::weak_subscription(); + } + void remove(typename this_type::weak_subscription) const { + } + void unsubscribe() const { + } +}; +template +class is_observer +{ + template + static typename C::observer_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_observer>::value; +}; + +namespace detail { +struct OnErrorEmpty +{ + void operator()(std::exception_ptr) const {} +}; +struct OnCompletedEmpty +{ + void operator()() const {} +}; +} + +template +class dynamic_observer : public observer_base +{ +public: + typedef std::function on_next_t; + typedef std::function on_error_t; + typedef std::function on_completed_t; + +private: + typedef observer_base base_type; + + on_next_t onnext; + on_error_t onerror; + on_completed_t oncompleted; + +public: + dynamic_observer() + { + } + dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) + : base_type(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) + : base_type(composite_subscription()) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + dynamic_observer(const dynamic_observer& o) + : base_type(o) + , onnext(o.onnext) + , onerror(o.onerror) + , oncompleted(o.oncompleted) + { + } + dynamic_observer(dynamic_observer&& o) + : base_type(std::move(o)) + , onnext(std::move(o.onnext)) + , onerror(std::move(o.onerror)) + , oncompleted(std::move(o.oncompleted)) + { + } + dynamic_observer& operator=(dynamic_observer o) { + swap(o); + return *this; + } + void swap(dynamic_observer& o) { + using std::swap; + observer_base::swap(o); + swap(onnext, o.onnext); + swap(onerror, o.onerror); + swap(oncompleted, o.oncompleted); + } + + void on_next(T t) const { + if (onnext) { + onnext(std::move(t)); + } + } + void on_error(std::exception_ptr e) const { + if (onerror) { + onerror(e); + } + } + void on_completed() const { + if (oncompleted) { + oncompleted(); + } + } +}; + +template +class static_observer : public observer_base +{ +public: + typedef OnNext on_next_t; + typedef OnError on_error_t; + typedef OnCompleted on_completed_t; + +private: + on_next_t onnext; + on_error_t onerror; + on_completed_t oncompleted; + +public: + static_observer() + { + } + static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) + : observer_base(composite_subscription()) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + { + } + static_observer(const static_observer& o) + : observer_base(o) + , onnext(o.onnext) + , onerror(o.onerror) + , oncompleted(o.oncompleted) + { + } + static_observer(static_observer&& o) + : observer_base(std::move(o)) + , onnext(std::move(o.onnext)) + , onerror(std::move(o.onerror)) + , oncompleted(std::move(o.oncompleted)) + { + } + static_observer& operator=(static_observer o) { + swap(o); + return *this; + } + void swap(static_observer& o) { + using std::swap; + observer_base::swap(o); + swap(onnext, o.onnext); + swap(onerror, o.onerror); + swap(oncompleted, o.oncompleted); + } + + void on_next(T t) const { + onnext(std::move(t)); + } + void on_error(std::exception_ptr e) const { + onerror(e); + } + void on_completed() const { + oncompleted(); + } +}; + +template +class observer : public observer_root +{ + typedef observer this_type; + typedef typename std::conditional::value, I, dynamic_observer>::type + + inner_t; + inner_t inner; +public: + ~observer() + { + } + observer(inner_t inner) + : inner(std::move(inner)) + { + } + void on_next(T t) const { + if (is_subscribed()) { + inner.on_next(std::move(t)); + } + } + void on_error(std::exception_ptr e) const { + if (is_subscribed()) { + inner.on_error(e); + } + unsubscribe(); + } + void on_completed() const { + if (is_subscribed()) { + inner.on_completed(); + } + unsubscribe(); + } + bool is_subscribed() const { + return inner.is_subscribed(); + } + typename this_type::weak_subscription add(dynamic_subscription ds) const { + return inner.add(std::move(ds)); + } + void remove(typename this_type::weak_subscription ws) const { + inner.remove(ws); + } + void unsubscribe() const { + inner.unsubscribe(); + } +}; +template +class observer : public observer_base +{ +public: + observer() + { + } + void on_next(T&&) const { + } + void on_error(std::exception_ptr) const { + } + void on_completed() const { + } +}; +template +auto make_observer() + -> observer { + return observer(); +} +template +auto make_observer(I i) + -> typename std::enable_if::value, observer>::type { + return observer(std::move(i)); +} +template +auto make_observer(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) + -> observer> { + return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); +} +template +auto make_observer(OnNext n, OnError e, OnCompleted c) + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e), std::move(c))); +} +template +auto make_observer(OnNext n, OnError e) + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); +} +template +auto make_observer(OnNext n) + -> typename std::enable_if::value, + observer>>::type { + return observer>( + static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/CPP/src/rxcpp/rx-operators.hpp new file mode 100644 index 0000000..551a0ab --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-operators.hpp @@ -0,0 +1,46 @@ +// 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 { + + +template +class observable; + + +namespace operators { + + +struct tag_operator {}; +template +struct operator_base +{ + typedef T value_type; + typedef tag_operator operator_tag; +}; +template +class is_operator +{ + template + static typename C::operator_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_operator>::value; +}; + +} +namespace rxo=operators; + +} + +#include "operators/rx-subscribe.hpp" +#include "operators/rx-filter.hpp" + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp new file mode 100644 index 0000000..77ae0b8 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -0,0 +1,40 @@ + +// 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 +struct source_base +{ + typedef T value_type; + typedef tag_source source_tag; +}; +template +class is_source +{ + template + static typename C::source_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_source>::value; +}; + +} +namespace rxs=sources; + +} + +#include "sources/rx-range.hpp" + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/CPP/src/rxcpp/rx-subscription.hpp new file mode 100644 index 0000000..7b5219b --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-subscription.hpp @@ -0,0 +1,266 @@ +// 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 { + + +struct tag_subscription {}; +struct subscription_base {typedef tag_subscription subscription_tag;}; +template +class is_subscription +{ + template + static typename C::subscription_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_subscription>::value; +}; + +class dynamic_subscription : public subscription_base +{ + typedef std::function unsubscribe_call_type; + unsubscribe_call_type unsubscribe_call; + dynamic_subscription() + { + } +public: + dynamic_subscription(const dynamic_subscription& o) + : unsubscribe_call(o.unsubscribe_call) + { + } + dynamic_subscription(dynamic_subscription&& o) + : unsubscribe_call(std::move(o.unsubscribe_call)) + { + } + template + dynamic_subscription(I i, typename std::enable_if::value && !std::is_same::value, void**>::type selector = nullptr) + : unsubscribe_call([i](){ + i.unsubscribe();}) + { + } + dynamic_subscription(unsubscribe_call_type s) + : unsubscribe_call(std::move(s)) + { + } + void unsubscribe() const { + unsubscribe_call(); + } +}; + +template +class static_subscription : public subscription_base +{ + typedef 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(); + } +}; + +template +class subscription : public subscription_base +{ + typedef I inner_t; + inner_t inner; + mutable bool issubscribed; +public: + subscription(inner_t inner) + : inner(std::move(inner)) + , issubscribed(true) + { + } + bool is_subscribed() const { + return issubscribed; + } + void unsubscribe() const { + if (issubscribed) { + inner.unsubscribe(); + } + issubscribed = false; + } +}; +template<> +class subscription : public subscription_base +{ +public: + subscription() + { + } + bool is_subscribed() const { + return false; + } + void unsubscribe() const { + } +}; +inline auto make_subscription() + -> subscription { + return subscription(); +} +template +auto make_subscription(I i) + -> typename std::enable_if::value, + subscription>::type { + return subscription(std::move(i)); +} +template +auto make_subscription(Unsubscribe u) + -> typename std::enable_if::value, + subscription< static_subscription>>::type { + return subscription< static_subscription>( + static_subscription(std::move(u))); +} + +class composite_subscription : public subscription_base +{ +public: + typedef std::shared_ptr shared_subscription; + typedef std::weak_ptr weak_subscription; +private: + struct state_t + { + std::vector subscriptions; + std::mutex lock; + bool issubscribed; + + state_t() + : issubscribed(true) + { + } + + bool is_subscribed() { + return issubscribed; + } + + weak_subscription add(dynamic_subscription s) { + return add(std::make_shared(std::move(s))); + } + + weak_subscription add(shared_subscription s) { + std::unique_lock guard(lock); + + if (!issubscribed) { + s->unsubscribe(); + } else { + auto end = std::end(subscriptions); + auto it = std::find(std::begin(subscriptions), end, s); + if (it == end) + { + subscriptions.emplace_back(std::move(s)); + } + } + return s; + } + + void remove(weak_subscription w) { + std::unique_lock guard(lock); + + auto s = w.lock(); + if (s) + { + auto end = std::end(subscriptions); + auto it = std::find(std::begin(subscriptions), end, s); + if (it != end) + { + subscriptions.erase(it); + } + } + } + + void clear() { + std::unique_lock guard(lock); + + if (issubscribed) { + std::vector v(std::move(subscriptions)); + std::for_each(v.begin(), v.end(), + [](shared_subscription& s) { + s->unsubscribe(); }); + } + } + + void unsubscribe() { + std::unique_lock guard(lock); + + if (issubscribed) { + issubscribed = false; + std::vector v(std::move(subscriptions)); + std::for_each(v.begin(), v.end(), + [](shared_subscription& s) { + s->unsubscribe(); }); + } + } + }; + + mutable std::shared_ptr state; + +public: + + composite_subscription() + : state(std::make_shared()) + { + } + composite_subscription(const composite_subscription& o) + : state(o.state) + { + } + composite_subscription(composite_subscription&& o) + : state(std::move(o.state)) + { + } + + composite_subscription& operator=(const composite_subscription& o) + { + state = o.state; + return *this; + } + composite_subscription& operator=(composite_subscription&& o) + { + state = std::move(o.state); + return *this; + } + + bool is_subscribed() const { + return state->is_subscribed(); + } + weak_subscription add(shared_subscription s) const { + return state->add(std::move(s)); + } + weak_subscription add(dynamic_subscription s) const { + return state->add(std::move(s)); + } + void remove(weak_subscription w) const { + state->remove(w); + } + void clear() const { + state->clear(); + } + void unsubscribe() const { + state->unsubscribe(); + } +}; + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 3cc8232..9ac9042 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -5,873 +5,88 @@ #if !defined(RXCPP_RX_HPP) #define RXCPP_RX_HPP -#include -#include -#include -#include -#include -#include -#include +#include "rx-includes.hpp" namespace rxcpp { - struct tag_subscription {}; - struct subscription_base {typedef tag_subscription subscription_tag;}; - template - class is_subscription - { - template - static typename C::subscription_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_convertible(0)), tag_subscription>::value; - }; - - class dynamic_subscription : public subscription_base - { - typedef std::function unsubscribe_call_type; - unsubscribe_call_type unsubscribe_call; - dynamic_subscription() - { - } - public: - dynamic_subscription(const dynamic_subscription& o) - : unsubscribe_call(o.unsubscribe_call) - { - } - dynamic_subscription(dynamic_subscription&& o) - : unsubscribe_call(std::move(o.unsubscribe_call)) - { - } - template - dynamic_subscription(I i, typename std::enable_if::value && !std::is_same::value, void**>::type selector = nullptr) - : unsubscribe_call([i](){ - i.unsubscribe();}) - { - } - dynamic_subscription(unsubscribe_call_type s) - : unsubscribe_call(std::move(s)) - { - } - void unsubscribe() const { - unsubscribe_call(); - } - }; - - template - class static_subscription : public subscription_base - { - typedef 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(); - } - }; +template +class observable +{ + SourceOperator source_operator; +private: template - class subscription : public subscription_base - { - typedef I inner_t; - inner_t inner; - mutable bool issubscribed; - public: - subscription(inner_t inner) - : inner(std::move(inner)) - , issubscribed(true) - { - } - bool is_subscribed() const { - return issubscribed; - } - void unsubscribe() const { - if (issubscribed) { - inner.unsubscribe(); - } - issubscribed = false; - } - }; - template<> - class subscription : public subscription_base - { - public: - subscription() - { - } - bool is_subscribed() const { - return false; - } - void unsubscribe() const { - } - }; - inline auto make_subscription() - -> subscription { - return subscription(); - } - template - auto make_subscription(I i) - -> typename std::enable_if::value, - subscription>::type { - return subscription(std::move(i)); + auto detail_subscribe(observer o, tag_observer&&) + -> decltype(make_subscription(o)) { + source_operator.on_subscribe(o); + return make_subscription(o); } - template - auto make_subscription(Unsubscribe u) - -> typename std::enable_if::value, - subscription< static_subscription>>::type { - return subscription< static_subscription>( - static_subscription(std::move(u))); - } - - class composite_subscription : public subscription_base - { - public: - typedef std::shared_ptr shared_subscription; - typedef std::weak_ptr weak_subscription; - private: - struct state_t - { - std::vector subscriptions; - std::mutex lock; - bool issubscribed; - - state_t() - : issubscribed(true) - { - } - - bool is_subscribed() { - return issubscribed; - } - - weak_subscription add(dynamic_subscription s) { - return add(std::make_shared(std::move(s))); - } - - weak_subscription add(shared_subscription s) { - std::unique_lock guard(lock); - - if (!issubscribed) { - s->unsubscribe(); - } else { - auto end = std::end(subscriptions); - auto it = std::find(std::begin(subscriptions), end, s); - if (it == end) - { - subscriptions.emplace_back(std::move(s)); - } - } - return s; - } - - void remove(weak_subscription w) { - std::unique_lock guard(lock); - - auto s = w.lock(); - if (s) - { - auto end = std::end(subscriptions); - auto it = std::find(std::begin(subscriptions), end, s); - if (it != end) - { - subscriptions.erase(it); - } - } - } - - void clear() { - std::unique_lock guard(lock); - - if (issubscribed) { - std::vector v(std::move(subscriptions)); - std::for_each(v.begin(), v.end(), - [](shared_subscription& s) { - s->unsubscribe(); }); - } - } - - void unsubscribe() { - std::unique_lock guard(lock); - - if (issubscribed) { - issubscribed = false; - std::vector v(std::move(subscriptions)); - std::for_each(v.begin(), v.end(), - [](shared_subscription& s) { - s->unsubscribe(); }); - } - } - }; - - mutable std::shared_ptr state; - - public: - - composite_subscription() - : state(std::make_shared()) - { - } - composite_subscription(const composite_subscription& o) - : state(o.state) - { - } - composite_subscription(composite_subscription&& o) - : state(std::move(o.state)) - { - } - - composite_subscription& operator=(const composite_subscription& o) - { - state = o.state; - return *this; - } - composite_subscription& operator=(composite_subscription&& o) - { - state = std::move(o.state); - return *this; - } - - bool is_subscribed() const { - return state->is_subscribed(); - } - weak_subscription add(shared_subscription s) const { - return state->add(std::move(s)); - } - weak_subscription add(dynamic_subscription s) const { - return state->add(std::move(s)); - } - void remove(weak_subscription w) const { - state->remove(w); - } - void clear() const { - state->clear(); - } - void unsubscribe() const { - state->unsubscribe(); - } - }; - - struct tag_observer {}; - template - struct observer_root : public subscription_base - { - typedef T value_type; - typedef composite_subscription subscription_type; - typedef typename subscription_type::weak_subscription weak_subscription; - typedef tag_observer observer_tag; - }; - template - struct observer_base : public observer_root - { - private: - typedef observer_base this_type; - - mutable typename this_type::subscription_type s; - - observer_base(); - public: - observer_base(typename this_type::subscription_type s) - : s(std::move(s)) - { - } - observer_base(const observer_base& o) - : s(o.s) - { - } - observer_base(observer_base&& o) - : s(std::move(o.s)) - { - } - observer_base& operator=(observer_base o) { - swap(o); - return *this; - } - void swap(observer_base& o) { - using std::swap; - swap(s, o.s); - } - bool is_subscribed() const { - return s.is_subscribed(); - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - return s.add(std::move(ds)); - } - void remove(typename this_type::weak_subscription ws) const { - s.remove(ws); - } - void unsubscribe() const { - s.unsubscribe(); - } - }; - template - struct observer_base : public observer_root - { - private: - typedef observer_base this_type; - - public: - void swap(observer_base&) { - } - bool is_subscribed() const { - return false; - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - ds.unsubscribe(); - return typename this_type::weak_subscription(); - } - void remove(typename this_type::weak_subscription) const { - } - void unsubscribe() const { - } - }; - template - class is_observer - { - template - static typename C::observer_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_convertible(0)), tag_observer>::value; - }; - -namespace detail { - struct OnErrorEmpty - { - void operator()(std::exception_ptr) const {} - }; - struct OnCompletedEmpty - { - void operator()() const {} - }; -} - - template - class dynamic_observer : public observer_base - { - public: - typedef std::function on_next_t; - typedef std::function on_error_t; - typedef std::function on_completed_t; - - private: - typedef observer_base base_type; - - on_next_t onnext; - on_error_t onerror; - on_completed_t oncompleted; - - public: - dynamic_observer() - { - } - dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : base_type(std::move(cs)) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - { - } - dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : base_type(composite_subscription()) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - { - } - dynamic_observer(const dynamic_observer& o) - : base_type(o) - , onnext(o.onnext) - , onerror(o.onerror) - , oncompleted(o.oncompleted) - { - } - dynamic_observer(dynamic_observer&& o) - : base_type(std::move(o)) - , onnext(std::move(o.onnext)) - , onerror(std::move(o.onerror)) - , oncompleted(std::move(o.oncompleted)) - { - } - dynamic_observer& operator=(dynamic_observer o) { - swap(o); - return *this; - } - void swap(dynamic_observer& o) { - using std::swap; - observer_base::swap(o); - swap(onnext, o.onnext); - swap(onerror, o.onerror); - swap(oncompleted, o.oncompleted); - } - - void on_next(T t) const { - if (onnext) { - onnext(std::move(t)); - } - } - void on_error(std::exception_ptr e) const { - if (onerror) { - onerror(e); - } - } - void on_completed() const { - if (oncompleted) { - oncompleted(); - } - } - }; - - template - class static_observer : public observer_base - { - public: - typedef OnNext on_next_t; - typedef OnError on_error_t; - typedef OnCompleted on_completed_t; - - private: - on_next_t onnext; - on_error_t onerror; - on_completed_t oncompleted; - - public: - static_observer() - { - } - static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - { - } - static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - { - } - static_observer(const static_observer& o) - : observer_base(o) - , onnext(o.onnext) - , onerror(o.onerror) - , oncompleted(o.oncompleted) - { - } - static_observer(static_observer&& o) - : observer_base(std::move(o)) - , onnext(std::move(o.onnext)) - , onerror(std::move(o.onerror)) - , oncompleted(std::move(o.oncompleted)) - { - } - static_observer& operator=(static_observer o) { - swap(o); - return *this; - } - void swap(static_observer& o) { - using std::swap; - observer_base::swap(o); - swap(onnext, o.onnext); - swap(onerror, o.onerror); - swap(oncompleted, o.oncompleted); - } - - void on_next(T t) const { - onnext(std::move(t)); - } - void on_error(std::exception_ptr e) const { - onerror(e); - } - void on_completed() const { - oncompleted(); - } - }; - template - class observer : public observer_root - { - typedef observer this_type; - typedef typename std::conditional::value, I, dynamic_observer>::type - - inner_t; - inner_t inner; - public: - ~observer() - { - } - observer(inner_t inner) - : inner(std::move(inner)) - { - } - void on_next(T t) const { - if (is_subscribed()) { - inner.on_next(std::move(t)); - } - } - void on_error(std::exception_ptr e) const { - if (is_subscribed()) { - inner.on_error(e); - } - unsubscribe(); - } - void on_completed() const { - if (is_subscribed()) { - inner.on_completed(); - } - unsubscribe(); - } - bool is_subscribed() const { - return inner.is_subscribed(); - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - return inner.add(std::move(ds)); - } - void remove(typename this_type::weak_subscription ws) const { - inner.remove(ws); - } - void unsubscribe() const { - inner.unsubscribe(); - } - }; - template - class observer : public observer_base - { - public: - observer() - { - } - void on_next(T&&) const { - } - void on_error(std::exception_ptr) const { - } - void on_completed() const { - } - }; - template - auto make_observer() - -> observer { - return observer(); - } - template - auto make_observer(I i) - -> typename std::enable_if::value, observer>::type { - return observer(std::move(i)); - } - template - auto make_observer(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) - -> observer> { - return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); - } - template - auto make_observer(OnNext n, OnError e, OnCompleted c) - -> observer> { - return observer>( - static_observer(std::move(n), std::move(e), std::move(c))); - } - template - auto make_observer(OnNext n, OnError e) - -> observer> { - return observer>( - static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); - } - template - auto make_observer(OnNext n) - -> typename std::enable_if::value, - observer>>::type { - return observer>( - static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); + struct tag_onnext {}; + template + auto detail_subscribe(OnNext n, tag_onnext&&) + -> decltype(make_subscription(make_observer(std::move(n)))) { + return subscribe(make_observer(std::move(n))); } - template - class observable; +public: + typedef T value_type; -namespace operators -{ - struct tag_operator {}; - template - struct operator_base - { - typedef T value_type; - typedef tag_operator operator_tag; - }; - template - class is_operator - { - template - static typename C::operator_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_convertible(0)), tag_operator>::value; - }; + static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); -namespace detail { - template - class subscribe_to_observer_factory - { - Observer observer; - public: - subscribe_to_observer_factory(Observer o) : observer(std::move(o)) {} - template - auto operator()(Observable source) - -> decltype(source.subscribe(std::move(observer))) { - return source.subscribe(std::move(observer)); - } - }; - template - class subscribe_factory - { - OnNext onnext; - OnError onerror; - OnCompleted oncompleted; - public: - subscribe_factory(OnNext n, OnError e, OnCompleted c) - : onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - {} - template - auto operator()(Observable source) - -> decltype(source.subscribe(std::move(onnext), std::move(onerror), std::move(oncompleted))) { - return source.subscribe(std::move(onnext), std::move(onerror), std::move(oncompleted)); - } - }; -} - template - auto subscribe(Observer o) - -> typename std::enable_if::value, - detail::subscribe_to_observer_factory>::type { - return detail::subscribe_to_observer_factory(std::move(o)); - } + explicit observable(const SourceOperator& o) + : source_operator(o) + {} + explicit observable(SourceOperator&& o) + : source_operator(std::move(o)) + {} - template - auto subscribe(OnNext n) - -> typename std::enable_if::value, - detail::subscribe_factory>::type { - return detail::subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); + template + auto subscribe(Arg a) + -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_onnext>::type())) { + return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_onnext>::type()); } template auto subscribe(OnNext n, OnError e) - -> detail::subscribe_factory { - return detail::subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); + -> decltype(make_subscription(make_observer(std::move(n), std::move(e)))) { + return subscribe(make_observer(std::move(n), std::move(e))); } template auto subscribe(OnNext n, OnError e, OnCompleted c) - -> detail::subscribe_factory { - return detail::subscribe_factory(std::move(n), std::move(e), std::move(c)); + -> decltype(make_subscription(make_observer(std::move(n), std::move(e), std::move(c)))) { + return subscribe(make_observer(std::move(n), std::move(e), std::move(c))); } - -namespace detail { - - template - struct filter : public operator_base - { - Observable source; - Predicate test; - - template - static auto check(int) -> decltype((*(CP*)nullptr)(*(CT*)nullptr)); - template - static void check(...); - filter(Observable o, Predicate p) - : source(std::move(o)) - , test(std::move(p)) - { - static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); - } - template - void on_subscribe(observer o) { - o.add(source.subscribe(make_observer( - // on_next - [this, o](T t) { - bool filtered = false; - try { - filtered = !this->test(t); - } catch(...) { - o.on_error(std::current_exception()); - o.unsubscribe(); - } - if (!filtered) { - o.on_next(std::move(t)); - } - }, - // on_error - [o](std::exception_ptr e) { - o.on_error(e); - }, - // on_completed - [o]() { - o.on_completed(); - } - ))); - } - }; - template - class filter_factory - { - Predicate predicate; - public: - filter_factory(Predicate p) : predicate(std::move(p)) {} - template - auto operator()(Observable source) - -> observable> { - return observable>( - filter(source, std::move(predicate))); - } - }; -} template auto filter(Predicate p) - -> detail::filter_factory { - return detail::filter_factory(std::move(p)); + -> observable> { + return observable>( + rxo::detail::filter(*this, std::move(p))); } +}; -} -namespace rxo=operators; - -namespace sources +// observable<> has static methods to construct observable sources and adaptors. +// observable<> is not constructable +template<> +class observable { - struct tag_source {}; - template - struct source_base - { - typedef T value_type; - typedef tag_source source_tag; - }; + ~observable(); +public: template - class is_source - { - template - static typename C::source_tag check(int); - template - static void check(...); - public: - static const bool value = std::is_convertible(0)), tag_source>::value; - }; + static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) + -> observable> { + return observable>( + rxs::detail::range(start, count, step)); + } +}; -namespace detail -{ - template - struct range : public source_base - { - struct state_type - { - T next; - size_t remaining; - ptrdiff_t step; - }; - state_type init; - range(T b, size_t c, ptrdiff_t s) - { - init.next = b; - init.remaining = c; - init.step = s; - } - template - void on_subscribe(observer o) { - auto state = std::make_shared(init); - auto s = make_subscription(); - for (;state->remaining != 0; --state->remaining) { - o.on_next(state->next); - state->next = static_cast(state->step + state->next); - } - o.on_completed(); - } - }; -} } -namespace rxs=sources; - - template - class observable - { - SourceOperator source_operator; - public: - typedef T value_type; - - static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); - - explicit observable(const SourceOperator& o) - : source_operator(o) - {} - explicit observable(SourceOperator&& o) - : source_operator(std::move(o)) - {} - - template - auto subscribe(observer o) - -> decltype(make_subscription(o)) { - source_operator.on_subscribe(o); - return make_subscription(o); - } - - template - auto subscribe(OnNext n) - -> typename std::enable_if::value, - decltype(make_subscription(make_observer(std::move(n))))>::type { - return subscribe(make_observer(std::move(n))); - } - - template - auto subscribe(OnNext n, OnError e) - -> decltype(make_subscription(make_observer(std::move(n), std::move(e)))) { - return subscribe(make_observer(std::move(n), std::move(e))); - } - - template - auto subscribe(OnNext n, OnError e, OnCompleted c) - -> decltype(make_subscription(make_observer(std::move(n), std::move(e), std::move(c)))) { - return subscribe(make_observer(std::move(n), std::move(e), std::move(c))); - } - - template - auto filter(Predicate p) - -> observable> { - return observable>( - rxo::detail::filter(*this, std::move(p))); - } - }; - - // observable<> has static methods to construct observable sources and adaptors. - // observable<> is not constructable - template<> - class observable - { - ~observable(); - public: - template - static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) - -> observable> { - return observable>( - rxs::detail::range(start, count, step)); - } - }; - - template - auto operator >> (observable source, OperatorFactory&& op) - -> decltype(op(source)){ - return op(source); - } +template +auto operator >> (rxcpp::observable source, OperatorFactory&& op) + -> decltype(op(source)){ + return op(source); } + #endif diff --git a/Rx/CPP/src/rxcpp/sources/rx-range.hpp b/Rx/CPP/src/rxcpp/sources/rx-range.hpp new file mode 100644 index 0000000..d4f59b0 --- /dev/null +++ b/Rx/CPP/src/rxcpp/sources/rx-range.hpp @@ -0,0 +1,57 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct range : public source_base +{ + struct state_type + { + T next; + size_t remaining; + ptrdiff_t step; + }; + state_type init; + range(T b, size_t c, ptrdiff_t s) + { + init.next = b; + init.remaining = c; + init.step = s; + } + template + void on_subscribe(observer o) { + auto state = std::make_shared(init); + auto s = make_subscription(); + for (;state->remaining != 0; --state->remaining) { + o.on_next(state->next); + state->next = static_cast(state->step + state->next); + } + o.on_completed(); + } +}; + +} + +template +auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) + -> observable> { + return observable>( + detail::range(start, count, step)); +} + +} + +} + +#endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 7648909..18dbdb5 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,6 +1,7 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; #include "catch.hpp" @@ -36,7 +37,7 @@ SCENARIO("filter operators", "[filter][operators][traits]"){ GIVEN("given a range of ints from 1 to 100"){ WHEN("filtered to primes"){ THEN("a subscription only observes primes"){ - auto s = rx::observable<>::range(1, 100, 1) + auto s = rxs::range(1, 100, 1) >> rxo::filter(IsPrime) >> rxo::subscribe([](int t) { const auto prime = IsPrime(t) ? t : -1; -- GitLab From a5ca2962cf826c9b9d7fb2d554ea3e69daeffe12 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 6 Feb 2014 10:58:23 -0800 Subject: [PATCH 186/782] add rxcppv2_test target --- projects/CMake/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 74ce562..93404a2 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -28,11 +28,17 @@ set(TEST_SOURCES ${TEST_DIR}/operators/SelectMany.cpp ${TEST_DIR}/operators/Where.cpp ${TEST_DIR}/operators/Publish.cpp +) +add_executable(rxcpp_test ${TEST_SOURCES}) + +# define the sources of the self test +set(TEST_SOURCES + ${TEST_DIR}/test.cpp ${TEST_DIR}/v2/subscriptions/observer.cpp ${TEST_DIR}/v2/subscriptions/subscription.cpp ${TEST_DIR}/v2/operators/filter.cpp ) -add_executable(rxcpp_test ${TEST_SOURCES}) +add_executable(rxcppv2_test ${TEST_SOURCES}) # define the sources of testbench set(TESTBENCH_SOURCES @@ -42,6 +48,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # configure unit tests via CTest enable_testing() + add_test(NAME RunTests COMMAND rxcpp_test) add_test(NAME ListTests COMMAND rxcpp_test --list-tests) @@ -49,3 +56,11 @@ set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test c add_test(NAME ListTags COMMAND rxcpp_test --list-tags) set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") + +add_test(NAME RunTestsV2 COMMAND rxcppv2_test) + +add_test(NAME ListTestsV2 COMMAND rxcppv2_test --list-tests) +set_tests_properties(ListTestsV2 PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + +add_test(NAME ListTagsV2 COMMAND rxcppv2_test --list-tags) +set_tests_properties(ListTagsV2 PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") -- GitLab From 7382c56e0f3aa9f22ae4e869af625f6dd6d5945d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 12 Feb 2014 07:24:29 -0800 Subject: [PATCH 187/782] add current_thread scheduler --- Rx/CPP/src/rxcpp/rx-includes.hpp | 4 +- Rx/CPP/src/rxcpp/rx-observer.hpp | 10 + Rx/CPP/src/rxcpp/rx-scheduler.hpp | 158 ++++++++++++ Rx/CPP/src/rxcpp/rx-sources.hpp | 2 +- Rx/CPP/src/rxcpp/rx-subscription.hpp | 2 +- Rx/CPP/src/rxcpp/rx-util.hpp | 83 +++++++ Rx/CPP/src/rxcpp/rx.hpp | 30 ++- .../src/rxcpp/schedulers/rx-currentthread.hpp | 231 ++++++++++++++++++ Rx/CPP/src/rxcpp/sources/rx-range.hpp | 28 ++- 9 files changed, 535 insertions(+), 13 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/rx-scheduler.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-util.hpp create mode 100644 Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 79f57b4..c2b22cf 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -37,7 +37,7 @@ // some configuration macros #if defined(_MSC_VER) -#if _MSC_VER > 1600 +#if _MSC_VER > 1600 #define RXCPP_USE_RVALUEREF 1 #endif @@ -89,8 +89,10 @@ #define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT #endif +#include "rx-util.hpp" #include "rx-subscription.hpp" #include "rx-observer.hpp" +#include "rx-scheduler.hpp" #include "rx-operators.hpp" #include "rx-sources.hpp" diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 59518c8..b893ce3 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -267,17 +267,27 @@ public: } void on_next(T t) const { if (is_subscribed()) { + RXCPP_UNWIND(unsubscriber, [this](){ + this->unsubscribe(); + }); inner.on_next(std::move(t)); + unsubscriber.dismiss(); } } void on_error(std::exception_ptr e) const { if (is_subscribed()) { + RXCPP_UNWIND_AUTO([this](){ + this->unsubscribe(); + }); inner.on_error(e); } unsubscribe(); } void on_completed() const { if (is_subscribed()) { + RXCPP_UNWIND_AUTO([this](){ + this->unsubscribe(); + }); inner.on_completed(); } unsubscribe(); diff --git a/Rx/CPP/src/rxcpp/rx-scheduler.hpp b/Rx/CPP/src/rxcpp/rx-scheduler.hpp new file mode 100644 index 0000000..3852cb8 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-scheduler.hpp @@ -0,0 +1,158 @@ +// 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 action_type; +typedef std::shared_ptr action; + +class scheduler_base; +typedef std::shared_ptr scheduler; + +class action_type + : public subscription_base + , public std::enable_shared_from_this +{ + typedef action_type this_type; + +public: + typedef composite_subscription subscription_type; + typedef subscription_type::weak_subscription weak_subscription; + typedef std::function function_type; + +private: + mutable this_type::subscription_type s; + function_type f; + + static action shared_empty; + +public: + action_type() + { + s.unsubscribe(); + } + + explicit action_type(function_type f) + : f(std::move(f)) + { + if (!this->f) { + s.unsubscribe(); + } + } + action_type(this_type::subscription_type s, function_type f) + : s(std::move(s)) + , f(std::move(f)) + { + if (!this->f) { + this->s.unsubscribe(); + } + } + + inline static action empty() { + return shared_empty; + } + + inline action operator()(scheduler sc) { + if (is_subscribed() && f) { + return f(this->shared_from_this(), std::move(sc)); + } + return empty(); + } + + inline bool is_subscribed() const { + return s.is_subscribed(); + } + inline this_type::weak_subscription add(dynamic_subscription ds) const { + return s.add(std::move(ds)); + } + inline void remove(this_type::weak_subscription ws) const { + s.remove(ws); + } + inline void unsubscribe() const { + s.unsubscribe(); + } +}; + +//static +RXCPP_SELECT_ANY action action_type::shared_empty = std::make_shared(); + +inline action make_action_empty() { + return action_type::empty(); +} + +inline action make_action(action_type::function_type f) { + return std::make_shared(std::move(f)); +} + +inline action make_action(action_type::subscription_type s, action_type::function_type f) { + return std::make_shared(std::move(s), std::move(f)); +} + +class scheduler_base + : public std::enable_shared_from_this +{ + typedef scheduler_base this_type; + +public: + typedef std::chrono::steady_clock clock; + + virtual ~scheduler_base() {} + + virtual clock::time_point now() = 0; + + virtual void schedule(action a) = 0; + virtual void schedule(clock::duration when, action a) = 0; + virtual void schedule(clock::time_point when, action a) = 0; + + inline void schedule(action_type::function_type f){ + return schedule(make_action(std::move(f))); + } + inline void schedule(clock::duration when, action_type::function_type f){ + return schedule(when, make_action(std::move(f))); + } + inline void schedule(clock::time_point when, action_type::function_type f){ + return schedule(when, make_action(std::move(f))); + } + inline void schedule(action_type::subscription_type s, action_type::function_type f){ + return schedule(make_action(std::move(s), std::move(f))); + } + inline void schedule(clock::duration when, action_type::subscription_type s, action_type::function_type f){ + return schedule(when, make_action(std::move(s), std::move(f))); + } + inline void schedule(clock::time_point when, action_type::subscription_type s, action_type::function_type f){ + return schedule(when, make_action(std::move(s), std::move(f))); + } +}; + +namespace detail { + +template +struct time_action +{ + time_action(TimePoint when, action a) + : when(when) + , a(std::move(a)) + { + } + TimePoint when; + action a; +}; + +} + +} +namespace rxsc=schedulers; + +} + +#include "schedulers/rx-currentthread.hpp" + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index 77ae0b8..bec8c55 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -37,4 +37,4 @@ namespace rxs=sources; #include "sources/rx-range.hpp" -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/CPP/src/rxcpp/rx-subscription.hpp index 7b5219b..f580dde 100644 --- a/Rx/CPP/src/rxcpp/rx-subscription.hpp +++ b/Rx/CPP/src/rxcpp/rx-subscription.hpp @@ -263,4 +263,4 @@ public: } -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/src/rxcpp/rx-util.hpp b/Rx/CPP/src/rxcpp/rx-util.hpp new file mode 100644 index 0000000..3762607 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-util.hpp @@ -0,0 +1,83 @@ +// 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_THREAD_LOCAL) +#if defined(_MSC_VER) +#define RXCPP_THREAD_LOCAL __declspec(thread) +#else +#define RXCPP_THREAD_LOCAL __thread +#endif +#endif + +#if !defined(RXCPP_SELECT_ANY) +#if defined(_MSC_VER) +#define RXCPP_SELECT_ANY __declspec(selectany) +#else +#define RXCPP_SELECT_ANY +#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__) + +namespace rxcpp { + +namespace detail { + +template +class unwinder +{ +public: + ~unwinder() + { + if (!!function) + { + try { + (*function)(); + } catch (...) { + std::unexpected(); + } + } + } + + explicit unwinder(Function* functionArg) + : function(functionArg) + { + } + + void dismiss() + { + function = nullptr; + } + +private: + unwinder(); + unwinder(const unwinder&); + unwinder& operator=(const unwinder&); + + Function* function; +}; + +} + +} + +#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::detail::unwinder UnwinderName(std::addressof(FunctionName)) + +#endif diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 9ac9042..e7ec220 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -18,7 +18,30 @@ private: template auto detail_subscribe(observer o, tag_observer&&) -> decltype(make_subscription(o)) { - source_operator.on_subscribe(o); + + auto subscriber = [=]() { + try { + source_operator.on_subscribe(o); + } + catch(...) { + if (!o.is_subscribed()) { + throw; + } + o.on_error(std::current_exception()); + o.unsubscribe(); + } + }; + + if (rxsc::current_thread::is_schedule_required()) { + auto sc = rxsc::make_current_thread(); + sc->schedule([=](rxsc::action, rxsc::scheduler) { + subscriber(); + return rxsc::make_action_empty(); + }); + } else { + subscriber(); + } + return make_subscription(o); } @@ -58,6 +81,7 @@ public: -> decltype(make_subscription(make_observer(std::move(n), std::move(e), std::move(c)))) { return subscribe(make_observer(std::move(n), std::move(e), std::move(c))); } + template auto filter(Predicate p) -> observable> { @@ -74,10 +98,10 @@ class observable ~observable(); public: template - static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) + static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable> { return observable>( - rxs::detail::range(start, count, step)); + rxs::detail::range(start, count, step, sc)); } }; diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp new file mode 100644 index 0000000..6e82354 --- /dev/null +++ b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp @@ -0,0 +1,231 @@ +// 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 clock; + typedef time_action item_type; + +private: + struct compare_item_time + { + bool operator()(const item_type& lhs, const item_type& rhs) const { + return lhs.when > rhs.when; + } + }; + + typedef std::priority_queue< + item_type, + std::vector, + compare_item_time + > queue_item_time; + +public: + struct current_thread_queue_type { + scheduler sc; + queue_item_time queue; + }; + +private: + static current_thread_queue_type*& current_thread_queue() { + RXCPP_THREAD_LOCAL static current_thread_queue_type* queue; + return queue; + } + +public: + + static scheduler get_scheduler() { + return !!current_thread_queue() ? current_thread_queue()->sc : scheduler(); + } + static bool empty() { + if (!current_thread_queue()) { + abort(); + } + return current_thread_queue()->queue.empty(); + } + static queue_item_time::const_reference top() { + if (!current_thread_queue()) { + abort(); + } + return current_thread_queue()->queue.top(); + } + static void pop() { + if (!current_thread_queue()) { + abort(); + } + current_thread_queue()->queue.pop(); + } + static void push(item_type item) { + if (!current_thread_queue()) { + abort(); + } + current_thread_queue()->queue.push(std::move(item)); + } + static scheduler ensure(scheduler sc) { + if (!!current_thread_queue()) { + abort(); + } + // create and publish new queue + current_thread_queue() = new current_thread_queue_type(); + current_thread_queue()->sc = sc; + return sc; + } + static std::unique_ptr create(scheduler sc) { + std::unique_ptr result(new current_thread_queue_type()); + result->sc = std::move(sc); + return result; + } + static void set(current_thread_queue_type* queue) { + if (!!current_thread_queue()) { + abort(); + } + // publish new queue + current_thread_queue() = queue; + } + static void destroy(current_thread_queue_type* queue) { + delete queue; + } + static void destroy() { + if (!current_thread_queue()) { + abort(); + } + destroy(current_thread_queue()); + current_thread_queue() = nullptr; + } +}; + + +} + +struct current_thread : public scheduler_base +{ +private: + typedef current_thread this_type; + current_thread(const this_type&); + + typedef detail::action_queue queue; + + struct derecurser : public scheduler_base + { + private: + typedef current_thread this_type; + derecurser(const this_type&); + public: + derecurser() + { + } + virtual ~derecurser() + { + } + + virtual clock::time_point now() { + return clock::now(); + } + + virtual void schedule(action a) { + queue::push(queue::item_type(now(), std::move(a))); + } + + virtual void schedule(clock::duration when, action a) { + queue::push(queue::item_type(now() + when, std::move(a))); + } + + virtual void schedule(clock::time_point when, action a) { + queue::push(queue::item_type(when, std::move(a))); + } + }; + +public: + current_thread() + { + } + virtual ~current_thread() + { + } + + static bool is_schedule_required() { return !queue::get_scheduler(); } + + virtual clock::time_point now() { + return clock::now(); + } + + virtual void schedule(action a) { + schedule(now(), std::move(a)); + } + + virtual void schedule(clock::duration when, action a) { + schedule(now() + when, std::move(a)); + } + + virtual void schedule(clock::time_point when, action a) { + auto sc = queue::get_scheduler(); + // check ownership + if (!!sc) + { + // already has an owner - delegate + return sc->schedule(when, std::move(a)); + } + + // take ownership + + sc = queue::ensure(std::make_shared()); + RXCPP_UNWIND_AUTO([]{ + queue::destroy(); + }); + + queue::push(queue::item_type(when, std::move(a))); + + // loop until queue is empty + for ( + auto when = queue::top().when; + std::this_thread::sleep_until(when), true; + when = queue::top().when + ) + { + auto a = queue::top().a; + + queue::pop(); + + for (;;) { + a = (*a)(sc); + if (!a->is_subscribed()) { + break; + } + if (!queue::empty()) { + // take proper place in line + sc->schedule(std::move(a)); + break; + } + // tail recurse to a + } + + if (queue::empty()) { + break; + } + } + } +}; + +inline scheduler make_current_thread() { + return std::make_shared(); +} + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/sources/rx-range.hpp b/Rx/CPP/src/rxcpp/sources/rx-range.hpp index d4f59b0..683edfa 100644 --- a/Rx/CPP/src/rxcpp/sources/rx-range.hpp +++ b/Rx/CPP/src/rxcpp/sources/rx-range.hpp @@ -21,33 +21,47 @@ struct range : public source_base T next; size_t remaining; ptrdiff_t step; + rxsc::scheduler sc; }; state_type init; - range(T b, size_t c, ptrdiff_t s) + range(T b, size_t c, ptrdiff_t s, rxsc::scheduler sc) { init.next = b; init.remaining = c; init.step = s; + init.sc = sc; } template void on_subscribe(observer o) { auto state = std::make_shared(init); - auto s = make_subscription(); - for (;state->remaining != 0; --state->remaining) { + state->sc->schedule([=](rxsc::action that, rxsc::scheduler){ + if (state->remaining == 0) { + o.on_completed(); + // o is unsubscribed + } + if (!o.is_subscribed()) { + // terminate loop + return rxsc::make_action_empty(); + } + + // send next value + --state->remaining; o.on_next(state->next); state->next = static_cast(state->step + state->next); - } - o.on_completed(); + + // tail recurse this same action to continue loop + return that; + }); } }; } template -auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1) +auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable> { return observable>( - detail::range(start, count, step)); + detail::range(start, count, step, sc)); } } -- GitLab From 87b5a5cb6bfb35483dc602358e1ca5b9cfe4d853 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 12 Feb 2014 07:41:56 -0800 Subject: [PATCH 188/782] fix clang build --- Rx/CPP/src/rxcpp/rx-util.hpp | 2 +- Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-util.hpp b/Rx/CPP/src/rxcpp/rx-util.hpp index 3762607..380d53b 100644 --- a/Rx/CPP/src/rxcpp/rx-util.hpp +++ b/Rx/CPP/src/rxcpp/rx-util.hpp @@ -19,7 +19,7 @@ #if defined(_MSC_VER) #define RXCPP_SELECT_ANY __declspec(selectany) #else -#define RXCPP_SELECT_ANY +#define RXCPP_SELECT_ANY __attribute__((weak)) #endif #endif diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp index 6e82354..c8c0082 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp @@ -5,7 +5,7 @@ #if !defined(RXCPP_RX_SCHEDULER_CURRENT_THREAD_HPP) #define RXCPP_RX_SCHEDULER_CURRENT_THREAD_HPP -#include "rx-includes.hpp" +#include "../rx-includes.hpp" namespace rxcpp { -- GitLab From f56f054158ae6f9a63e51cc12ab2a56cd07e5806 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 13 Feb 2014 08:17:15 -0800 Subject: [PATCH 189/782] add notification types --- Rx/CPP/src/rxcpp/rx-includes.hpp | 1 + Rx/CPP/src/rxcpp/rx-notification.hpp | 230 +++++++++++++++++++++++++++ Rx/CPP/src/rxcpp/rx-observer.hpp | 5 + 3 files changed, 236 insertions(+) create mode 100644 Rx/CPP/src/rxcpp/rx-notification.hpp diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index c2b22cf..07f4b7f 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -92,6 +92,7 @@ #include "rx-util.hpp" #include "rx-subscription.hpp" #include "rx-observer.hpp" +#include "rx-notification.hpp" #include "rx-scheduler.hpp" #include "rx-operators.hpp" #include "rx-sources.hpp" diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp new file mode 100644 index 0000000..f0b6aa0 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -0,0 +1,230 @@ +// 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 { + +template +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 +bool operator == (recorded lhs, recorded rhs) { + return lhs.Time() == rhs.Time() && lhs.Value() == rhs.Value(); +} + +template +std::ostream& operator<< (std::ostream& out, const recorded& r) { + out << "@" << r.Time() << "-" << r.Value(); + return out; +} + +class subscription +{ + long s; + long u; + +public: + explicit inline subscription(long s) + : s(s), u(std::numeric_limits::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 +struct notification_base + : public std::enable_shared_from_this> +{ + typedef observer> observer_type; + typedef std::shared_ptr> 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 +struct notification +{ + typedef typename detail::notification_base::type type; + typedef typename detail::notification_base::observer_type observer_type; + +private: + typedef detail::notification_base base; + + struct on_next_notification : public base { + on_next_notification(T value) : value(std::move(value)) { + } + virtual void out(std::ostream& out) const { + out << "on_next( " << value << ")"; + } + virtual bool equals(const base::type& other) const { + bool result = false; + other->accept(make_observer_dynamic([this, &result](T value) { + result = this->value == value; + })); + return result; + } + virtual void accept(const base::observer_type& o) const { + if (!o) { + abort(); + } + o->on_next(value); + } + const T value; + }; + + struct on_error_notification : public base { + on_error_notification(std::exception_ptr ep) : ep(ep) { + } + virtual void out(std::ostream& out) const { + out << "on_error("; + try { + std::rethrow_exception(ep); + } catch (const std::exception& e) { + out << e.what(); + } catch (...) { + out << ""; + } + out << ")"; + } + virtual bool equals(const base::type& other) const { + bool result = false; + // not trying to compare exceptions + other->accept(make_observer_dynamic(nullptr, [&result](std::exception_ptr){ + result = true; + })); + return result; + } + virtual void accept(const base::observer_type& o) const { + if (!o) { + abort(); + } + o->on_error(ep); + } + const std::exception_ptr ep; + }; + + struct on_completed_notification : public base { + on_completed_notification() { + } + virtual void out(std::ostream& out) const { + out << "on_completed()"; + } + virtual bool equals(const base::type& other) const { + bool result = false; + other->Accept(make_observer_dynamic(nullptr, nullptr, [&result](){ + result = true; + })); + return result; + } + virtual void accept(const base::observer_type& o) const { + if (!o) { + abort(); + } + o->on_completed(); + } + }; + + struct exception_tag {}; + + template + static + type make_on_error(exception_tag&&, Exception&& e) { + std::exception_ptr ep; + try { + throw std::forward(e); + } + catch (...) { + ep = std::current_exception(); + } + return std::make_shared(ep); + } + + struct exception_ptr_tag {}; + + static + type make_on_error(exception_ptr_tag&&, std::exception_ptr ep) { + return std::make_shared(ep); + } + +public: + static + type make_on_next(T value) { + return std::make_shared(std::move(value)); + } + static + type make_on_completed() { + return std::make_shared(); + } + template + static + type make_on_error(Exception&& e) { + return make_on_error(typename std::conditional< + std::is_same::type, std::exception_ptr>::value, + exception_ptr_tag, exception_tag>::type(), + std::forward(e)); + } +}; + +template +bool operator == (const std::shared_ptr>& lhs, const std::shared_ptr>& rhs) { + if (!lhs && !rhs) {return true;} + if (!lhs || !rhs) {return false;} + return lhs->equals(rhs); +} + +template +std::ostream& operator<< (std::ostream& out, const std::shared_ptr>& n) { + n->out(out); + return out; +} + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index b893ce3..218c668 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -353,6 +353,11 @@ auto make_observer(OnNext n) return observer>( static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); } +template +auto make_observer_dynamic(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) + -> observer> { + return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); +} } -- GitLab From 22359a8e0cc1bfc54b8469165594206cc1f721eb Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 13 Feb 2014 16:09:01 -0800 Subject: [PATCH 190/782] share one subscription instance for the whole chain --- Rx/CPP/src/rxcpp/operators/rx-filter.hpp | 5 +- Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp | 83 +++++++-- Rx/CPP/src/rxcpp/rx-observer.hpp | 165 +++++++++++++----- Rx/CPP/src/rxcpp/rx-subscription.hpp | 4 +- Rx/CPP/src/rxcpp/rx.hpp | 60 +++++-- .../src/rxcpp/schedulers/rx-currentthread.hpp | 9 +- Rx/CPP/src/rxcpp/sources/rx-range.hpp | 2 +- 7 files changed, 245 insertions(+), 83 deletions(-) diff --git a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp index 09b11eb..ffdeca6 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp @@ -31,7 +31,8 @@ struct filter : public operator_base } template void on_subscribe(observer o) { - o.add(source.subscribe(make_observer( + o.add(source.subscribe( + o.get_subscription(), // on_next [this, o](T t) { bool filtered = false; @@ -53,7 +54,7 @@ struct filter : public operator_base [o]() { o.on_completed(); } - ))); + )); } }; diff --git a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp index 40af349..e8495bf 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp @@ -43,37 +43,90 @@ public: return source.subscribe(make_observer(std::move(onnext), std::move(onerror), std::move(oncompleted))); } }; +template +class subscribe_factory_chained +{ + composite_subscription cs; + OnNext onnext; + OnError onerror; + OnCompleted oncompleted; +public: + subscribe_factory_chained(OnNext n, OnError e, OnCompleted c) + : cs(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) + {} + template + auto operator()(Observable source) + -> decltype(source.subscribe(make_observer(std::move(cs), std::move(onnext), std::move(onerror), std::move(oncompleted)))) { + return source.subscribe(make_observer(std::move(cs), std::move(onnext), std::move(onerror), std::move(oncompleted))); + } +}; + +template +auto subscribe(Observer o, tag_observer&&) + -> subscribe_to_observer_factory { + return subscribe_to_observer_factory(std::move(o)); +} +struct tag_function {}; +template +auto subscribe(OnNext n, tag_function&&) + -> subscribe_factory { + return subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); } +template +auto subscribe(OnNext n, OnError e, tag_function&&) + -> subscribe_factory { + return subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); +} -template -auto subscribe(Observer o) - -> typename std::enable_if::value, - detail::subscribe_to_observer_factory>::type { - return detail::subscribe_to_observer_factory(std::move(o)); +template +auto subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) + -> subscribe_factory { + return subscribe_factory(std::move(n), std::move(e), std::move(c)); } template -auto subscribe(OnNext n) - -> typename std::enable_if::value, - detail::subscribe_factory>::type { - return detail::subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); +auto subscribe(composite_subscription cs, OnNext n, tag_subscription&&) + -> subscribe_factory_chained { + return subscribe_factory_chained(std::move(cs), std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); } template -auto subscribe(OnNext n, OnError e) - -> detail::subscribe_factory { - return detail::subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); +auto subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) + -> subscribe_factory_chained { + return subscribe_factory_chained(std::move(cs), std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); +} + +} + +template +auto subscribe(Arg a) + -> decltype(detail::subscribe(std::move(a), typename std::conditional::value, tag_observer, detail::tag_function>::type())) { + return detail::subscribe(std::move(a), typename std::conditional::value, tag_observer, detail::tag_function>::type()); +} + +template +auto subscribe(Arg1 a1, Arg2 a2) + -> decltype(detail::subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { + return detail::subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); +} + +template +auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) + -> decltype(detail::subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { + return detail::subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); } template -auto subscribe(OnNext n, OnError e, OnCompleted c) +auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) -> detail::subscribe_factory { - return detail::subscribe_factory(std::move(n), std::move(e), std::move(c)); + return detail::subscribe_factory(std::move(cs), std::move(n), std::move(e), std::move(c)); } - } } diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 218c668..64301c2 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -19,7 +19,7 @@ struct observer_root : public subscription_base typedef typename subscription_type::weak_subscription weak_subscription; typedef tag_observer observer_tag; }; -template +template struct observer_base : public observer_root { private: @@ -49,6 +49,9 @@ public: using std::swap; swap(s, o.s); } + typename this_type::subscription_type get_subscription() { + return s; + } bool is_subscribed() const { return s.is_subscribed(); } @@ -63,27 +66,6 @@ public: } }; template -struct observer_base : public observer_root -{ -private: - typedef observer_base this_type; - -public: - void swap(observer_base&) { - } - bool is_subscribed() const { - return false; - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - ds.unsubscribe(); - return typename this_type::weak_subscription(); - } - void remove(typename this_type::weak_subscription) const { - } - void unsubscribe() const { - } -}; -template class is_observer { template @@ -106,7 +88,7 @@ struct OnCompletedEmpty } template -class dynamic_observer : public observer_base +class dynamic_observer : public observer_base { public: typedef std::function on_next_t; @@ -114,7 +96,7 @@ public: typedef std::function on_completed_t; private: - typedef observer_base base_type; + typedef observer_base base_type; on_next_t onnext; on_error_t onerror; @@ -182,7 +164,7 @@ public: }; template -class static_observer : public observer_base +class static_observer : public observer_base { public: typedef OnNext on_next_t; @@ -199,28 +181,28 @@ public: { } static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) + : observer_base(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) + : observer_base(composite_subscription()) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } static_observer(const static_observer& o) - : observer_base(o) + : observer_base(o) , onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } static_observer(static_observer&& o) - : observer_base(std::move(o)) + : observer_base(std::move(o)) , onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) @@ -292,6 +274,9 @@ public: } unsubscribe(); } + typename this_type::subscription_type get_subscription() { + return inner.get_subscription(); + } bool is_subscribed() const { return inner.is_subscribed(); } @@ -306,8 +291,9 @@ public: } }; template -class observer : public observer_base +class observer : public observer_root { + typedef observer this_type; public: observer() { @@ -318,47 +304,134 @@ public: } void on_completed() const { } + typename this_type::subscription_type get_subscription() { + static typename this_type::subscription_type result; + result.unsubscribe(); + return result; + } + bool is_subscribed() const { + return false; + } + typename this_type::weak_subscription add(dynamic_subscription ds) const { + ds.unsubscribe(); + return typename this_type::weak_subscription(); + } + void remove(typename this_type::weak_subscription) const { + } + void unsubscribe() const { + } }; + template auto make_observer() -> observer { return observer(); } + +namespace detail { + +struct tag_require_observer {}; +template +auto make_observer(T, tag_require_observer&&) + -> observer { + static_assert(false, "this overload of make_observer requires an observer"); +} + +struct tag_require_function {}; + +template +auto make_observer(OnNext n, tag_require_function&&) + -> observer { + static_assert(false, "this overload of make_observer requires an on_next function"); +} + template -auto make_observer(I i) - -> typename std::enable_if::value, observer>::type { - return observer(std::move(i)); +auto make_observer(I i, tag_observer&&) + -> observer { + return observer(std::move(i)); } -template -auto make_observer(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) - -> observer> { - return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); + +struct tag_function {}; +template +auto make_observer(OnNext n, tag_function&&) + -> observer> { + return observer>( + static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); +} + +template +auto make_observer(OnNext n, OnError e, tag_function&&) + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); } + template -auto make_observer(OnNext n, OnError e, OnCompleted c) +auto make_observer(OnNext n, OnError e, OnCompleted c, tag_function&&) -> observer> { return observer>( static_observer(std::move(n), std::move(e), std::move(c))); } + +template +auto make_observer(composite_subscription cs, OnNext n, tag_subscription&&) + -> observer> { + return observer>( + static_observer(std::move(cs), std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); +} + template -auto make_observer(OnNext n, OnError e) +auto make_observer(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) -> observer> { return observer>( - static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); + static_observer(std::move(cs), std::move(n), std::move(e), detail::OnCompletedEmpty())); } -template -auto make_observer(OnNext n) - -> typename std::enable_if::value, - observer>>::type { - return observer>( - static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); + +} + +template +auto make_observer(Arg a) + -> decltype(detail::make_observer(std::move(a), typename std::conditional::value, tag_observer, detail::tag_require_observer>::type())) { + return detail::make_observer(std::move(a), typename std::conditional::value, tag_observer, detail::tag_require_observer>::type()); +} + +template +auto make_observer(Arg a) + -> decltype(detail::make_observer(std::move(a), typename std::conditional::value, detail::tag_require_function, detail::tag_function>::type())) { + return detail::make_observer(std::move(a), typename std::conditional::value, detail::tag_require_function, detail::tag_function>::type()); +} + +template +auto make_observer(Arg1 a1, Arg2 a2) + -> decltype(detail::make_observer(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { + return detail::make_observer(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); +} + +template +auto make_observer(Arg1 a1, Arg2 a2, Arg3 a3) + -> decltype(detail::make_observer(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { + return detail::make_observer(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); +} + +template +auto make_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c) + -> observer> { + return observer>( + static_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } + template auto make_observer_dynamic(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) -> observer> { return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); } +template +auto make_observer_dynamic(composite_subscription cs, typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) + -> observer> { + return observer>(dynamic_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); +} + } #endif diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/CPP/src/rxcpp/rx-subscription.hpp index f580dde..235d5e5 100644 --- a/Rx/CPP/src/rxcpp/rx-subscription.hpp +++ b/Rx/CPP/src/rxcpp/rx-subscription.hpp @@ -139,10 +139,10 @@ public: typedef std::shared_ptr shared_subscription; typedef std::weak_ptr weak_subscription; private: - struct state_t + struct state_t : public std::enable_shared_from_this { std::vector subscriptions; - std::mutex lock; + std::recursive_mutex lock; bool issubscribed; state_t() diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index e7ec220..c46eeca 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -19,6 +19,10 @@ private: auto detail_subscribe(observer o, tag_observer&&) -> decltype(make_subscription(o)) { + if (!o.is_subscribed()) { + return make_subscription(o); + } + auto subscriber = [=]() { try { source_operator.on_subscribe(o); @@ -45,11 +49,35 @@ private: return make_subscription(o); } - struct tag_onnext {}; + struct tag_function {}; template - auto detail_subscribe(OnNext n, tag_onnext&&) - -> decltype(make_subscription(make_observer(std::move(n)))) { - return subscribe(make_observer(std::move(n))); + auto detail_subscribe(OnNext n, tag_function&&) + -> decltype(make_subscription( make_observer(std::move(n)))) { + return subscribe( make_observer(std::move(n))); + } + + template + auto detail_subscribe(OnNext n, OnError e, tag_function&&) + -> decltype(make_subscription( make_observer(std::move(n), std::move(e)))) { + return subscribe( make_observer(std::move(n), std::move(e))); + } + + template + auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) + -> decltype(make_subscription( make_observer(std::move(n), std::move(e), std::move(c)))) { + return subscribe( make_observer(std::move(n), std::move(e), std::move(c))); + } + + template + auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n)))) { + return subscribe( make_observer(std::move(cs), std::move(n))); + } + + template + auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e)))) { + return subscribe( make_observer(std::move(cs), std::move(n), std::move(e))); } public: @@ -66,20 +94,26 @@ public: template auto subscribe(Arg a) - -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_onnext>::type())) { - return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_onnext>::type()); + -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type())) { + return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type()); } - template - auto subscribe(OnNext n, OnError e) - -> decltype(make_subscription(make_observer(std::move(n), std::move(e)))) { - return subscribe(make_observer(std::move(n), std::move(e))); + template + auto subscribe(Arg1 a1, Arg2 a2) + -> decltype(detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type())) { + return detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type()); + } + + template + auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) + -> decltype(detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type())) { + return detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type()); } template - auto subscribe(OnNext n, OnError e, OnCompleted c) - -> decltype(make_subscription(make_observer(std::move(n), std::move(e), std::move(c)))) { - return subscribe(make_observer(std::move(n), std::move(e), std::move(c))); + auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c)))) { + return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } template diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp index c8c0082..b3316ef 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp @@ -172,6 +172,10 @@ public: } virtual void schedule(clock::time_point when, action a) { + if (!a->is_subscribed()) { + return; + } + auto sc = queue::get_scheduler(); // check ownership if (!!sc) @@ -200,11 +204,8 @@ public: queue::pop(); - for (;;) { + while (a->is_subscribed()) { a = (*a)(sc); - if (!a->is_subscribed()) { - break; - } if (!queue::empty()) { // take proper place in line sc->schedule(std::move(a)); diff --git a/Rx/CPP/src/rxcpp/sources/rx-range.hpp b/Rx/CPP/src/rxcpp/sources/rx-range.hpp index 683edfa..9a44ba9 100644 --- a/Rx/CPP/src/rxcpp/sources/rx-range.hpp +++ b/Rx/CPP/src/rxcpp/sources/rx-range.hpp @@ -34,7 +34,7 @@ struct range : public source_base template void on_subscribe(observer o) { auto state = std::make_shared(init); - state->sc->schedule([=](rxsc::action that, rxsc::scheduler){ + state->sc->schedule(o.get_subscription(), [=](rxsc::action that, rxsc::scheduler){ if (state->remaining == 0) { o.on_completed(); // o is unsubscribed -- GitLab From 3359191b8ff0e0ac855a9e28bdbfa6365e060ddf Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 13 Feb 2014 16:14:43 -0800 Subject: [PATCH 191/782] clang fixes --- Rx/CPP/src/rxcpp/rx-notification.hpp | 26 +++++++++++++------------- Rx/CPP/src/rxcpp/rx-observer.hpp | 15 ++------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp index f0b6aa0..f6750fb 100644 --- a/Rx/CPP/src/rxcpp/rx-notification.hpp +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -17,7 +17,7 @@ class recorded long t; T v; public: - recorded(long t, T v) + recorded(long t, T v) : t(t), v(v) { } long time() const { @@ -45,10 +45,10 @@ class subscription long u; public: - explicit inline subscription(long s) + explicit inline subscription(long s) : s(s), u(std::numeric_limits::max()) { } - inline subscription(long s, long u) + inline subscription(long s, long u) : s(s), u(u) { } inline long subscribe() const { @@ -71,7 +71,7 @@ inline std::ostream& operator<< (std::ostream& out, const subscription& s) { namespace detail { template -struct notification_base +struct notification_base : public std::enable_shared_from_this> { typedef observer> observer_type; @@ -101,14 +101,14 @@ private: virtual void out(std::ostream& out) const { out << "on_next( " << value << ")"; } - virtual bool equals(const base::type& other) const { + virtual bool equals(const typename base::type& other) const { bool result = false; - other->accept(make_observer_dynamic([this, &result](T value) { + other->accept(make_observer_dynamic([this, &result](T value) { result = this->value == value; })); return result; } - virtual void accept(const base::observer_type& o) const { + virtual void accept(const typename base::observer_type& o) const { if (!o) { abort(); } @@ -131,7 +131,7 @@ private: } out << ")"; } - virtual bool equals(const base::type& other) const { + virtual bool equals(const typename base::type& other) const { bool result = false; // not trying to compare exceptions other->accept(make_observer_dynamic(nullptr, [&result](std::exception_ptr){ @@ -139,7 +139,7 @@ private: })); return result; } - virtual void accept(const base::observer_type& o) const { + virtual void accept(const typename base::observer_type& o) const { if (!o) { abort(); } @@ -154,14 +154,14 @@ private: virtual void out(std::ostream& out) const { out << "on_completed()"; } - virtual bool equals(const base::type& other) const { + virtual bool equals(const typename base::type& other) const { bool result = false; other->Accept(make_observer_dynamic(nullptr, nullptr, [&result](){ result = true; })); return result; } - virtual void accept(const base::observer_type& o) const { + virtual void accept(const typename base::observer_type& o) const { if (!o) { abort(); } @@ -204,8 +204,8 @@ public: static type make_on_error(Exception&& e) { return make_on_error(typename std::conditional< - std::is_same::type, std::exception_ptr>::value, - exception_ptr_tag, exception_tag>::type(), + std::is_same::type, std::exception_ptr>::value, + exception_ptr_tag, exception_tag>::type(), std::forward(e)); } }; diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 64301c2..644d29b 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -140,7 +140,7 @@ public: } void swap(dynamic_observer& o) { using std::swap; - observer_base::swap(o); + observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -214,7 +214,7 @@ public: } void swap(static_observer& o) { using std::swap; - observer_base::swap(o); + observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -331,20 +331,9 @@ auto make_observer() namespace detail { struct tag_require_observer {}; -template -auto make_observer(T, tag_require_observer&&) - -> observer { - static_assert(false, "this overload of make_observer requires an observer"); -} struct tag_require_function {}; -template -auto make_observer(OnNext n, tag_require_function&&) - -> observer { - static_assert(false, "this overload of make_observer requires an on_next function"); -} - template auto make_observer(I i, tag_observer&&) -> observer { -- GitLab From 2ba9d8b7ce059b733b651cb7b38c668d60277ef6 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 13 Feb 2014 20:34:08 -0800 Subject: [PATCH 192/782] add vitual_time scheduler --- Rx/CPP/src/rxcpp/rx-notification.hpp | 1 + Rx/CPP/src/rxcpp/rx-scheduler.hpp | 17 +- .../src/rxcpp/schedulers/rx-currentthread.hpp | 21 +- .../src/rxcpp/schedulers/rx-virtualtime.hpp | 253 ++++++++++++++++++ 4 files changed, 275 insertions(+), 17 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp index f6750fb..bf3207c 100644 --- a/Rx/CPP/src/rxcpp/rx-notification.hpp +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -224,6 +224,7 @@ std::ostream& operator<< (std::ostream& out, const std::shared_ptr item_type; private: @@ -73,6 +73,9 @@ public: if (!current_thread_queue()) { abort(); } + if (!item.a->is_subscribed()) { + return; + } current_thread_queue()->queue.push(std::move(item)); } static scheduler ensure(scheduler sc) { @@ -132,19 +135,19 @@ private: { } - virtual clock::time_point now() { - return clock::now(); + virtual clock_type::time_point now() { + return clock_type::now(); } virtual void schedule(action a) { queue::push(queue::item_type(now(), std::move(a))); } - virtual void schedule(clock::duration when, action a) { + virtual void schedule(clock_type::duration when, action a) { queue::push(queue::item_type(now() + when, std::move(a))); } - virtual void schedule(clock::time_point when, action a) { + virtual void schedule(clock_type::time_point when, action a) { queue::push(queue::item_type(when, std::move(a))); } }; @@ -159,19 +162,19 @@ public: static bool is_schedule_required() { return !queue::get_scheduler(); } - virtual clock::time_point now() { - return clock::now(); + virtual clock_type::time_point now() { + return clock_type::now(); } virtual void schedule(action a) { schedule(now(), std::move(a)); } - virtual void schedule(clock::duration when, action a) { + virtual void schedule(clock_type::duration when, action a) { schedule(now() + when, std::move(a)); } - virtual void schedule(clock::time_point when, action a) { + virtual void schedule(clock_type::time_point when, action a) { if (!a->is_subscribed()) { return; } diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp new file mode 100644 index 0000000..5c20341 --- /dev/null +++ b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -0,0 +1,253 @@ +// 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 +struct virtual_time_base : public scheduler_base +{ +private: + typedef virtual_time_base this_type; + virtual_time_base(const virtual_time_base&); + + 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) + { + } + + absolute clock_now; + + typedef time_action item_type; + + virtual absolute add(absolute, relative) =0; + + virtual typename this_type::clock_type::time_point to_time_point(absolute) =0; + virtual relative to_relative(typename this_type::clock_type::duration) =0; + + virtual item_type top() =0; + virtual void pop() =0; + virtual bool empty() =0; + +public: + virtual void schedule_absolute(absolute, action) =0; + + virtual void schedule_relative(relative dueTime, action a) { + auto at = add(clock_now, dueTime); + return schedule_absolute(at, std::move(a)); + } + + bool is_enabled() {return isenabled;} + absolute clock() {return clock_now;} + + void start() + { + if (!isenabled) { + isenabled = true; + while (!empty() && isenabled) { + auto next = top(); + pop(); + if (next.a->is_subscribed()) { + if (next.when > clock_now) { + clock_now = next.when; + } + auto a = (*next.a)(shared_from_this()); + if (a.subscribed()) { + schedule(a); + } + } + else { + isenabled = false; + } + } + } + } + + void stop() + { + isenabled = false; + } + + void advance_to(absolute time) + { + if (time < clock_now) { + abort(); + } + + if (time == clock_now) { + return; + } + + if (!isenabled) { + isenabled = true; + while (!empty() && isenabled) { + auto next = top(); + pop(); + if (next.a->is_subscribed() && next.when <= time) { + if (next.when > clock_now) { + clock_now = next.when; + } + auto a = (*next.a)(shared_from_this()); + if (a.subscribed()) { + schedule(a); + } + } + else { + isenabled = false; + } + } + + clock_now = time; + } + else { + abort(); + } + } + + void advance_by(relative time) + { + auto dt = add(clock_now, time); + + if (dt < clock_now) { + abort(); + } + + if (dt == clock_now) { + return; + } + + if (!isenabled) { + advance_to(dt); + } + else { + abort(); + } + } + + void sleep(relative time) + { + auto dt = add(clock_now, time); + + if (dt < clock_now) { + abort(); + } + + clock_now = dt; + } + + virtual clock_type::time_point now() { + return to_time_point(clock_now); + } + + virtual void schedule(action a) { + schedule_absolute(clock_now, std::move(a)); + } + + virtual void schedule(clock_type::duration when, action a) { + schedule_absolute(to_relative(when), std::move(a)); + } + + virtual void schedule(clock_type::time_point when, action a) { + schedule_absolute(to_relative(when - now()), std::move(a)); + } + +}; + +} + +template +class virtual_time : public detail::virtual_time_base +{ +private: + virtual_time(const virtual_time&); + + typedef detail::virtual_time_base base; + + typedef typename base::item_type item_type; + + struct compare_item_time + { + bool operator()(const item_type& lhs, const item_type& rhs) const { + return lhs.when > rhs.when; + } + }; + + typedef std::priority_queue< + item_type, + std::vector, + compare_item_time + > queue_item_time; + + queue_item_time queue; + +public: + virtual ~virtual_time() + { + } + +protected: + virtual_time() + { + } + explicit virtual_time(typename base::absolute initialClock) + : base(initialClock) + { + } + + virtual item_type top() { + return queue.top(); + } + virtual void pop() { + queue.pop(); + } + virtual bool empty() { + return queue.empty(); + } + + virtual void schedule_absolute(typename base::absolute when, action a) + { + // use a separate subscription here so that a's subscription is not affected + auto run = make_action([a](action that, scheduler sc) { + if (that.is_subscribed()) { + that.unsubscribe(); // unsubscribe() run, not a; + (*a)(sc); + } + return make_action(); + }); + queue.push(item_type(when, run)); + } + +}; + + +} + +} + +#endif \ No newline at end of file -- GitLab From 0323430b2cc9bc41f1ee0a131b87232775359d9e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 14 Feb 2014 14:31:39 -0800 Subject: [PATCH 193/782] fixes for clang --- Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp index 5c20341..44dfc74 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -234,11 +234,11 @@ protected: { // use a separate subscription here so that a's subscription is not affected auto run = make_action([a](action that, scheduler sc) { - if (that.is_subscribed()) { - that.unsubscribe(); // unsubscribe() run, not a; + if (that->is_subscribed()) { + that->unsubscribe(); // unsubscribe() run, not a; (*a)(sc); } - return make_action(); + return make_action_empty(); }); queue.push(item_type(when, run)); } @@ -250,4 +250,4 @@ protected: } -#endif \ No newline at end of file +#endif -- GitLab From 3981717e3538164bc9b1e1bd456b6bb90adfffb3 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 14 Feb 2014 14:18:37 -0800 Subject: [PATCH 194/782] added testscheduler and filter tests using it some tests are failing due to subscription lifetime issues. --- Rx/CPP/src/rxcpp/rx-notification.hpp | 25 +- Rx/CPP/src/rxcpp/rx-sources.hpp | 2 +- Rx/CPP/src/rxcpp/rx-test.hpp | 115 ++++++ Rx/CPP/src/rxcpp/rx-util.hpp | 12 +- Rx/CPP/src/rxcpp/rx.hpp | 105 ++++- Rx/CPP/src/rxcpp/schedulers/rx-test.hpp | 338 +++++++++++++++ .../src/rxcpp/schedulers/rx-virtualtime.hpp | 29 +- Rx/CPP/test/v2/operators/filter.cpp | 390 +++++++++++++++++- 8 files changed, 957 insertions(+), 59 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/rx-test.hpp create mode 100644 Rx/CPP/src/rxcpp/schedulers/rx-test.hpp diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp index bf3207c..bdf86ef 100644 --- a/Rx/CPP/src/rxcpp/rx-notification.hpp +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -30,12 +30,12 @@ public: template bool operator == (recorded lhs, recorded rhs) { - return lhs.Time() == rhs.Time() && lhs.Value() == rhs.Value(); + return lhs.time() == rhs.time() && lhs.value() == rhs.value(); } template std::ostream& operator<< (std::ostream& out, const recorded& r) { - out << "@" << r.Time() << "-" << r.Value(); + out << "@" << r.time() << "-" << r.value(); return out; } @@ -103,16 +103,13 @@ private: } virtual bool equals(const typename base::type& other) const { bool result = false; - other->accept(make_observer_dynamic([this, &result](T value) { + other->accept(make_observer_dynamic([this, &result](T value) { result = this->value == value; })); return result; } virtual void accept(const typename base::observer_type& o) const { - if (!o) { - abort(); - } - o->on_next(value); + o.on_next(value); } const T value; }; @@ -134,16 +131,13 @@ private: virtual bool equals(const typename base::type& other) const { bool result = false; // not trying to compare exceptions - other->accept(make_observer_dynamic(nullptr, [&result](std::exception_ptr){ + other->accept(make_observer_dynamic(nullptr, [&result](std::exception_ptr){ result = true; })); return result; } virtual void accept(const typename base::observer_type& o) const { - if (!o) { - abort(); - } - o->on_error(ep); + o.on_error(ep); } const std::exception_ptr ep; }; @@ -156,16 +150,13 @@ private: } virtual bool equals(const typename base::type& other) const { bool result = false; - other->Accept(make_observer_dynamic(nullptr, nullptr, [&result](){ + other->accept(make_observer_dynamic(nullptr, nullptr, [&result](){ result = true; })); return result; } virtual void accept(const typename base::observer_type& o) const { - if (!o) { - abort(); - } - o->on_completed(); + o.on_completed(); } }; diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index bec8c55..7e585a1 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -27,7 +27,7 @@ class is_source template static void check(...); public: - static const bool value = std::is_convertible(0)), tag_source>::value; + static const bool value = std::is_convertible::type>(0)), tag_source>::value; }; } diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp new file mode 100644 index 0000000..2a90279 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -0,0 +1,115 @@ +#pragma once + +#if !defined(RXCPP_RX_TEST_HPP) +#define RXCPP_RX_TEST_HPP + +#include "rx-includes.hpp" + +namespace rxcpp { + +namespace test { + +namespace detail { + +template +struct test_subject_base + : public std::enable_shared_from_this> +{ + typedef rxn::recorded::type> recorded_type; + typedef std::shared_ptr> type; + + virtual void on_subscribe(observer>) const =0; + virtual std::vector messages() const =0; + virtual std::vector subscriptions() const =0; +}; + +template +struct test_source + : public rxs::source_base +{ + explicit test_source(typename test_subject_base::type ts) + : ts(std::move(ts)) + { + } + typename test_subject_base::type ts; + void on_subscribe(observer> o) const { + ts->on_subscribe(std::move(o)); + } + template + typename std::enable_if::type, observer>>::value, void>::type + on_subscribe(Observer o) const { + auto so = std::make_shared(o); + ts->on_subscribe(make_observer_dynamic( + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + })); + } +}; + +} + +template +class testable_observer + : public observer> +{ + typedef observer> observer_base; + typedef typename detail::test_subject_base::type test_subject; + test_subject ts; + +public: + typedef typename detail::test_subject_base::recorded_type recorded_type; + + testable_observer(test_subject ts, observer_base ob) + : observer_base(std::move(ob)) + , ts(std::move(ts)) + { + } + + std::vector messages() const { + return ts->messages(); + } +}; + +template +class testable_observable + : public observable> +{ + typedef observable> observable_base; + typedef typename detail::test_subject_base::type test_subject; + test_subject ts; + +public: + typedef typename detail::test_subject_base::recorded_type recorded_type; + + explicit testable_observable(test_subject ts) + : observable_base(detail::test_source(ts)) + , ts(ts) + { + } + + std::vector subscriptions() const { + return ts->subscriptions(); + } + + std::vector messages() const { + return ts->messages(); + } +}; + +} +namespace rxt=test; + +} + +#include "schedulers/rx-test.hpp" + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx-util.hpp b/Rx/CPP/src/rxcpp/rx-util.hpp index 380d53b..64a91ae 100644 --- a/Rx/CPP/src/rxcpp/rx-util.hpp +++ b/Rx/CPP/src/rxcpp/rx-util.hpp @@ -30,6 +30,13 @@ namespace rxcpp { +namespace util { + +template +std::vector to_vector(const T (&arr) [size]) { + return std::vector(std::begin(arr), std::end(arr)); +} + namespace detail { template @@ -68,6 +75,9 @@ private: } +} +namespace rxu=util; + } #define RXCPP_UNWIND(Name, Function) \ @@ -78,6 +88,6 @@ private: #define RXCPP_UNWIND_EXPLICIT(FunctionName, UnwinderName, Function) \ auto FunctionName = (Function); \ - rxcpp::detail::unwinder UnwinderName(std::addressof(FunctionName)) + rxcpp::util::detail::unwinder UnwinderName(std::addressof(FunctionName)) #endif diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index c46eeca..e5e7df9 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -9,14 +9,67 @@ namespace rxcpp { +template +struct dynamic_observable + : public rxs::source_base +{ + struct state_type + : public std::enable_shared_from_this + { + typedef std::function>)> onsubscribe_type; + + onsubscribe_type on_subscribe; + }; + std::shared_ptr state; + + dynamic_observable() + { + } + + template + explicit dynamic_observable(Source source) + : state(std::make_shared()) + { + state->on_subscribe = [source](observer> o) mutable { + source.on_subscribe(std::move(o)); + }; + } + + void on_subscribe(observer> o) const { + state->on_subscribe(std::move(o)); + } + + template + typename std::enable_if::type, observer>>::value, void>::type + on_subscribe(Observer o) const { + auto so = std::make_shared(o); + state->on_subscribe(make_observer_dynamic( + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + })); + } +}; + template class observable { - SourceOperator source_operator; + mutable SourceOperator source_operator; private: + template + friend class observable; + template - auto detail_subscribe(observer o, tag_observer&&) + auto detail_subscribe(observer o, tag_observer&&) const -> decltype(make_subscription(o)) { if (!o.is_subscribed()) { @@ -51,31 +104,31 @@ private: struct tag_function {}; template - auto detail_subscribe(OnNext n, tag_function&&) + auto detail_subscribe(OnNext n, tag_function&&) const -> decltype(make_subscription( make_observer(std::move(n)))) { return subscribe( make_observer(std::move(n))); } template - auto detail_subscribe(OnNext n, OnError e, tag_function&&) + auto detail_subscribe(OnNext n, OnError e, tag_function&&) const -> decltype(make_subscription( make_observer(std::move(n), std::move(e)))) { return subscribe( make_observer(std::move(n), std::move(e))); } template - auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) + auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) const -> decltype(make_subscription( make_observer(std::move(n), std::move(e), std::move(c)))) { return subscribe( make_observer(std::move(n), std::move(e), std::move(c))); } template - auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) + auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) const -> decltype(make_subscription( make_observer(std::move(cs), std::move(n)))) { return subscribe( make_observer(std::move(cs), std::move(n))); } template - auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) + auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) const -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e)))) { return subscribe( make_observer(std::move(cs), std::move(n), std::move(e))); } @@ -85,39 +138,65 @@ public: static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + observable() + { + } + explicit observable(const SourceOperator& o) : source_operator(o) - {} + { + } explicit observable(SourceOperator&& o) : source_operator(std::move(o)) + { + } + + // implicit conversion between observables of the same value_type + template + observable(const observable& o) + : source_operator(o.source_operator) {} +#if 0 + template + void on_subscribe(observer o) const { + source_operator.on_subscribe(o); + } +#endif + + // + // performs type-forgetting conversion + // + observable> as_dynamic() { + return *this; + } + template - auto subscribe(Arg a) + auto subscribe(Arg a) const -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type())) { return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type()); } template - auto subscribe(Arg1 a1, Arg2 a2) + auto subscribe(Arg1 a1, Arg2 a2) const -> decltype(detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type())) { return detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type()); } template - auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) + auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) const -> decltype(detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type())) { return detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type()); } template - auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) + auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) const -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c)))) { return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } template - auto filter(Predicate p) + auto filter(Predicate p) const -> observable> { return observable>( rxo::detail::filter(*this, std::move(p))); diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp new file mode 100644 index 0000000..d814f1e --- /dev/null +++ b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp @@ -0,0 +1,338 @@ +// 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 { + +class test : public virtual_time +{ +public: + typedef virtual_time base; + typedef base::clock_type clock_type; + typedef std::shared_ptr shared; + + static const long created_time = 100; + static const long subscribed_time = 200; + static const long unsubscribed_time = 1000; + + template + struct messages + { + typedef typename rxn::notification notification_type; + typedef rxn::recorded recorded_type; + + static + recorded_type on_next(long ticks, T value) + { + return recorded_type(ticks, notification_type::make_on_next(value)); + } + + static + recorded_type on_completed(long ticks) + { + return recorded_type(ticks, notification_type::make_on_completed()); + } + + template + static + recorded_type on_error(long ticks, Exception e) + { + return recorded_type(ticks, notification_type::make_on_error(e)); + } + + static + rxn::subscription subscribe(long subscribe, long unsubscribe) + { + return rxn::subscription(subscribe, unsubscribe); + } + + private: + ~messages(); + }; + + using base::schedule_absolute; + using base::schedule_relative; + + virtual void schedule_absolute(long when, action a) + { + if (when <= base::clock_now) + when = base::clock_now + 1; + + return base::schedule_absolute(when, std::move(a)); + } + + virtual long add(long absolute, long relative) + { + return absolute + relative; + } + + virtual clock_type::time_point to_time_point(long absolute) + { + return clock_type::time_point(clock_type::duration(absolute)); + } + + virtual long to_relative(clock_type::duration d) + { + return static_cast(d.count()); + } + + using base::start; + + template + auto start(F createSource, long created, long subscribed, long unsubscribed) + -> rxt::testable_observer + { + struct state_type + { + typedef decltype(createSource()) source_type; + typedef typename source_type::value_type value_type; + + explicit state_type(rxt::testable_observer o) + : observer(o) + { + } + std::unique_ptr source; + rxt::testable_observer observer; + }; + auto state = std::make_shared(make_observer()); + + schedule_absolute(created, make_action([createSource, state](action, scheduler) { + state->source.reset(new typename state_type::source_type(createSource())); + return make_action_empty(); + })); + schedule_absolute(subscribed, make_action([state](action, scheduler) { + state->source->subscribe(state->observer); + return make_action_empty(); + })); + schedule_absolute(unsubscribed, make_action([state](action, scheduler) { + state->observer.unsubscribe(); + return make_action_empty(); + })); + + start(); + + return state->observer; + } + + template + auto start(F createSource, long unsubscribed) + -> rxt::testable_observer + { + return start(std::move(createSource), created_time, subscribed_time, unsubscribed); + } + + template + auto start(F createSource) + -> rxt::testable_observer + { + return start(std::move(createSource), created_time, subscribed_time, unsubscribed_time); + } + + template + rxt::testable_observable make_hot_observable(std::vector>>> messages); + + template + auto make_hot_observable(const T (&arr) [size]) + -> decltype(make_hot_observable(std::vector())) { + return make_hot_observable(rxu::to_vector(arr)); + } + + template + rxt::testable_observable make_cold_observable(std::vector>>> messages); + + template + auto make_cold_observable(const T (&arr) [size]) + -> decltype(make_cold_observable(std::vector())) { + return make_cold_observable(rxu::to_vector(arr)); + } + + template + rxt::testable_observer make_observer(); +}; + +template +class mock_observer + : public rxt::detail::test_subject_base +{ + typedef typename rxn::notification notification_type; + typedef rxn::recorded recorded_type; + +public: + mock_observer(typename test::shared sc) + : sc(sc) + { + } + + typename test::shared sc; + std::vector m; + + virtual void on_subscribe(observer>) const { + abort(); + } + virtual std::vector subscriptions() const { + abort(); return std::vector(); + } + + virtual std::vector messages() const { + return m; + } +}; + +template +rxt::testable_observer test::make_observer() +{ + typedef typename rxn::notification notification_type; + typedef rxn::recorded recorded_type; + + auto ts = std::make_shared>( + std::static_pointer_cast(shared_from_this())); + + return rxt::testable_observer(ts, make_observer_dynamic( + // on_next + [ts](T value) + { + ts->m.push_back( + recorded_type(ts->sc->clock(), notification_type::make_on_next(value))); + }, + // on_error + [ts](std::exception_ptr e) + { + ts->m.push_back( + recorded_type(ts->sc->clock(), notification_type::make_on_error(e))); + }, + // on_completed + [ts]() + { + ts->m.push_back( + recorded_type(ts->sc->clock(), notification_type::make_on_completed())); + })); +} + +template +class cold_observable + : public rxt::detail::test_subject_base +{ + typedef cold_observable this_type; + typename test::shared sc; + typedef rxn::recorded::type> recorded_type; + mutable std::vector mv; + mutable std::vector sv; + +public: + + cold_observable(typename test::shared sc, std::vector mv) + : sc(sc) + , mv(std::move(mv)) + { + } + + template + cold_observable(typename test::shared sc, Iterator begin, Iterator end) + : scheduler(sc) + , mv(begin, end) + { + } + + virtual void on_subscribe(observer> o) const { + sv.push_back(rxn::subscription(sc->clock())); + auto index = sv.size() - 1; + + for (auto& message : mv) { + auto n = message.value(); + scheduler->schedule_relative(message.time(), make_action([n, o](action, scheduler) { + n->accept(o); + return make_action_empty(); + })); + } + + auto sharedThis = std::static_pointer_cast(this->shared_from_this()); + o.add(dynamic_subscription([sharedThis, index]() { + sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock()); + })); + } + + virtual std::vector subscriptions() const { + return sv; + } + + virtual std::vector messages() const { + return mv; + } +}; + +template +rxt::testable_observable test::make_cold_observable(std::vector>>> messages) +{ + return rxt::testable_observable(std::make_shared>( + std::static_pointer_cast(shared_from_this()), std::move(messages))); +} + +template +class hot_observable + : public rxt::detail::test_subject_base +{ + typedef hot_observable this_type; + typename test::shared sc; + typedef rxn::recorded::type> recorded_type; + typedef observer> observer_type; + mutable std::vector mv; + mutable std::vector sv; + mutable std::vector observers; + +public: + + hot_observable(typename test::shared sc, std::vector mv) + : sc(sc) + , mv(mv) + { + for (auto& message : mv) { + auto n = message.value(); + sc->schedule_absolute(message.time(), make_action([this, n](action, scheduler) { + auto local = this->observers; + for (auto& o : local) { + n->accept(o); + } + return make_action_empty(); + })); + } + } + + virtual void on_subscribe(observer_type o) const { + observers.push_back(o); + sv.push_back(rxn::subscription(sc->clock())); + auto index = sv.size() - 1; + + auto sharedThis = std::static_pointer_cast(this->shared_from_this()); + o.add(dynamic_subscription([sharedThis, index]() { + sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock()); + })); + } + + virtual std::vector subscriptions() const { + return sv; + } + + virtual std::vector messages() const { + return mv; + } +}; + +template +rxt::testable_observable test::make_hot_observable(std::vector>>> messages) +{ + return rxt::testable_observable(std::make_shared>( + std::static_pointer_cast(shared_from_this()), std::move(messages))); +} + +} + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp index 44dfc74..42f87f8 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -17,7 +17,7 @@ template struct virtual_time_base : public scheduler_base { private: - typedef virtual_time_base this_type; + typedef virtual_time_base this_type; virtual_time_base(const virtual_time_base&); bool isenabled; @@ -44,12 +44,12 @@ protected: absolute clock_now; - typedef time_action item_type; + typedef time_action item_type; virtual absolute add(absolute, relative) =0; - virtual typename this_type::clock_type::time_point to_time_point(absolute) =0; - virtual relative to_relative(typename this_type::clock_type::duration) =0; + virtual typename scheduler_base::clock_type::time_point to_time_point(absolute) =0; + virtual relative to_relative(typename scheduler_base::clock_type::duration) =0; virtual item_type top() =0; virtual void pop() =0; @@ -58,11 +58,23 @@ protected: public: virtual void schedule_absolute(absolute, action) =0; - virtual void schedule_relative(relative dueTime, action a) { - auto at = add(clock_now, dueTime); + template + typename std::enable_if::type, action>::value, void>::type + schedule_absolute(absolute when, F f) { + schedule_absolute(when, make_action(f)); + } + + virtual void schedule_relative(relative when, action a) { + auto at = add(clock_now, when); return schedule_absolute(at, std::move(a)); } + template + typename std::enable_if::type, action>::value, void>::type + schedule_relative(relative when, F f) { + schedule_relative(when, make_action(f)); + } + bool is_enabled() {return isenabled;} absolute clock() {return clock_now;} @@ -78,7 +90,7 @@ public: clock_now = next.when; } auto a = (*next.a)(shared_from_this()); - if (a.subscribed()) { + if (a->is_subscribed()) { schedule(a); } } @@ -230,6 +242,9 @@ protected: return queue.empty(); } + using base::schedule_absolute; + using base::schedule_relative; + virtual void schedule_absolute(typename base::absolute when, action a) { // use a separate subscription here so that a's subscription is not affected diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 18dbdb5..f415c10 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,7 +1,13 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; +namespace rxu=rxcpp::util; namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; #include "catch.hpp" @@ -18,31 +24,375 @@ bool IsPrime(int x) } } -SCENARIO("filter members", "[filter][operators][traits]"){ - GIVEN("given a range of ints from 1 to 100"){ - WHEN("filtered to primes"){ - THEN("a subscription only observes primes"){ - auto s = rx::observable<>::range(1, 100, 1) - .filter(IsPrime) - .subscribe([](int t) { - const auto prime = IsPrime(t) ? t : -1; - REQUIRE( t == prime ); - }); +SCENARIO("filter stops on completion", "[filter][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + m::recorded_type messages[] = { + m::on_next(110, 1), + m::on_next(180, 2), + m::on_next(230, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(380, 6), + m::on_next(390, 7), + m::on_next(450, 8), + m::on_next(470, 9), + m::on_next(560, 10), + m::on_next(580, 11), + m::on_completed(600), + m::on_next(610, 12), + m::on_error(620, std::exception()), + m::on_completed(630) + }; + auto xs = sc->make_hot_observable(messages); + + WHEN("filtered to ints that are primes"){ + auto res = sc->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"){ + m::recorded_type items[] = { + m::on_next(230, 3), + m::on_next(340, 5), + m::on_next(390, 7), + m::on_next(580, 11), + m::on_completed(600) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 600) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("filter was called until completed"){ + REQUIRE(9 == invoked); + } + } + } +} + + +SCENARIO("where stops on disposal", "[where][filter][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + m::recorded_type messages[] = { + m::on_next(110, 1), + m::on_next(180, 2), + m::on_next(230, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(380, 6), + m::on_next(390, 7), + m::on_next(450, 8), + m::on_next(470, 9), + m::on_next(560, 10), + m::on_next(580, 11), + m::on_completed(600) + }; + auto xs = sc->make_hot_observable(rxu::to_vector(messages)); + + WHEN("filtered to ints that are primes"){ + + auto res = sc->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"){ + m::recorded_type items[] = { + m::on_next(230, 3), + m::on_next(340, 5), + m::on_next(390, 7) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(5 == invoked); + } + } + } +} + +SCENARIO("where stops on error", "[where][filter][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + std::exception ex; + + auto xs = sc->make_hot_observable( + [ex]() { + m::recorded_type messages[] = { + m::on_next(110, 1), + m::on_next(180, 2), + m::on_next(230, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(380, 6), + m::on_next(390, 7), + m::on_next(450, 8), + m::on_next(470, 9), + m::on_next(560, 10), + m::on_next(580, 11), + m::on_error(600, ex), + m::on_next(610, 12), + m::on_error(620, std::exception()), + m::on_completed(630) + }; + return rxu::to_vector(messages); + }() + ); + + WHEN("filtered to ints that are primes"){ + + auto res = sc->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"){ + m::recorded_type items[] = { + m::on_next(230, 3), + m::on_next(340, 5), + m::on_next(390, 7), + m::on_next(580, 11), + m::on_error(600, ex), + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 600) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until error"){ + REQUIRE(9 == invoked); + } + } + } +} + +SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + std::exception ex; + + auto xs = sc->make_hot_observable( + []() { + m::recorded_type messages[] = { + m::on_next(110, 1), + m::on_next(180, 2), + m::on_next(230, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(380, 6), + m::on_next(390, 7), + m::on_next(450, 8), + m::on_next(470, 9), + m::on_next(560, 10), + m::on_next(580, 11), + m::on_completed(600), + m::on_next(610, 12), + m::on_error(620, std::exception()), + m::on_completed(630) + }; + return rxu::to_vector(messages); + }() + ); + + WHEN("filtered to ints that are primes"){ + + auto res = sc->start( + [ex, xs, &invoked]() { + return xs + .filter([ex, &invoked](int x) { + invoked++; + if (x > 5) { + throw ex; + } + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output only contains primes"){ + m::recorded_type items[] = { + m::on_next(230, 3), + m::on_next(340, 5), + m::on_error(380, ex) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 380) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until error"){ + REQUIRE(4 == invoked); } } } } -SCENARIO("filter operators", "[filter][operators][traits]"){ - GIVEN("given a range of ints from 1 to 100"){ - WHEN("filtered to primes"){ - THEN("a subscription only observes primes"){ - auto s = rxs::range(1, 100, 1) - >> rxo::filter(IsPrime) - >> rxo::subscribe([](int t) { - const auto prime = IsPrime(t) ? t : -1; - REQUIRE( t == prime ); - }); +SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + auto xs = sc->make_hot_observable( + []() { + m::recorded_type messages[] = { + m::on_next(110, 1), + m::on_next(180, 2), + m::on_next(230, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(380, 6), + m::on_next(390, 7), + m::on_next(450, 8), + m::on_next(470, 9), + m::on_next(560, 10), + m::on_next(580, 11), + m::on_completed(600), + m::on_next(610, 12), + m::on_error(620, std::exception()), + m::on_completed(630) + }; + return rxu::to_vector(messages); + }() + ); + + auto res = sc->make_observer(); + + rx::observable> ys; + + WHEN("filtered to ints that are primes"){ + + sc->schedule_absolute(rxsc::test::created_time, + [&invoked, &res, &ys, &xs](rxsc::action, rxsc::scheduler) { + ys = xs + .filter([&invoked, &res](int x) { + invoked++; + if (x == 8) + res.unsubscribe(); + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + return rxsc::make_action_empty(); + }); + + sc->schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](rxsc::action, rxsc::scheduler) { + ys.subscribe(res); + return rxsc::make_action_empty(); + }); + + sc->schedule_absolute(rxsc::test::unsubscribed_time, [&res](rxsc::action, rxsc::scheduler) { + res.unsubscribe(); + return rxsc::make_action_empty(); + }); + + sc->start(); + + THEN("the output only contains primes"){ + m::recorded_type items[] = { + m::on_next(230, 3), + m::on_next(340, 5), + m::on_next(390, 7) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 450) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(6 == invoked); } } } -- GitLab From ead6a749622af563bd9df7224b2bb81748e6b8d0 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 14 Feb 2014 14:27:11 -0800 Subject: [PATCH 195/782] there, now the filter tests pass --- Rx/CPP/src/rxcpp/rx-test.hpp | 1 + Rx/CPP/src/rxcpp/rx.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp index 2a90279..594030a 100644 --- a/Rx/CPP/src/rxcpp/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -40,6 +40,7 @@ struct test_source on_subscribe(Observer o) const { auto so = std::make_shared(o); ts->on_subscribe(make_observer_dynamic( + so->get_subscription(), // on_next [so](T t){ so->on_next(t); diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index e5e7df9..da2f660 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -44,6 +44,7 @@ struct dynamic_observable on_subscribe(Observer o) const { auto so = std::make_shared(o); state->on_subscribe(make_observer_dynamic( + so->get_subscription(), // on_next [so](T t){ so->on_next(t); -- GitLab From 43b517916778fba64a96d6c830b93a963ddece91 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 14 Feb 2014 15:10:08 -0800 Subject: [PATCH 196/782] clang fixes --- Rx/CPP/src/rxcpp/rx-notification.hpp | 79 +++++++++++++------------ Rx/CPP/src/rxcpp/schedulers/rx-test.hpp | 24 ++++---- 2 files changed, 53 insertions(+), 50 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp index bdf86ef..4bdd5bd 100644 --- a/Rx/CPP/src/rxcpp/rx-notification.hpp +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -11,34 +11,6 @@ namespace rxcpp { namespace notifications { -template -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 -bool operator == (recorded lhs, recorded rhs) { - return lhs.time() == rhs.time() && lhs.value() == rhs.value(); -} - -template -std::ostream& operator<< (std::ostream& out, const recorded& r) { - out << "@" << r.time() << "-" << r.value(); - return out; -} - class subscription { long s; @@ -98,8 +70,8 @@ private: struct on_next_notification : public base { on_next_notification(T value) : value(std::move(value)) { } - virtual void out(std::ostream& out) const { - out << "on_next( " << value << ")"; + virtual void out(std::ostream& os) const { + os << "on_next( " << value << ")"; } virtual bool equals(const typename base::type& other) const { bool result = false; @@ -117,16 +89,16 @@ private: struct on_error_notification : public base { on_error_notification(std::exception_ptr ep) : ep(ep) { } - virtual void out(std::ostream& out) const { - out << "on_error("; + virtual void out(std::ostream& os) const { + os << "on_error("; try { std::rethrow_exception(ep); } catch (const std::exception& e) { - out << e.what(); + os << e.what(); } catch (...) { - out << ""; + os << ""; } - out << ")"; + os << ")"; } virtual bool equals(const typename base::type& other) const { bool result = false; @@ -145,8 +117,8 @@ private: struct on_completed_notification : public base { on_completed_notification() { } - virtual void out(std::ostream& out) const { - out << "on_completed()"; + virtual void out(std::ostream& os) const { + os << "on_completed()"; } virtual bool equals(const typename base::type& other) const { bool result = false; @@ -209,8 +181,37 @@ bool operator == (const std::shared_ptr>& lhs, cons } template -std::ostream& operator<< (std::ostream& out, const std::shared_ptr>& n) { - n->out(out); +std::ostream& operator<< (std::ostream& os, const std::shared_ptr>& n) { + n->out(os); + return os; +} + + +template +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 +bool operator == (recorded lhs, recorded rhs) { + return lhs.time() == rhs.time() && lhs.value() == rhs.value(); +} + +template +std::ostream& operator<< (std::ostream& out, const recorded& r) { + out << "@" << r.time() << "-" << r.value(); return out; } diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp index d814f1e..39cd0af 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp @@ -90,35 +90,37 @@ public: -> rxt::testable_observer { struct state_type + : public std::enable_shared_from_this { typedef decltype(createSource()) source_type; - typedef typename source_type::value_type value_type; - explicit state_type(rxt::testable_observer o) - : observer(o) + std::unique_ptr source; + rxt::testable_observer o; + + explicit state_type(rxt::testable_observer o) + : source() + , o(o) { } - std::unique_ptr source; - rxt::testable_observer observer; }; - auto state = std::make_shared(make_observer()); + std::shared_ptr state(new state_type(this->make_observer())); schedule_absolute(created, make_action([createSource, state](action, scheduler) { state->source.reset(new typename state_type::source_type(createSource())); return make_action_empty(); })); schedule_absolute(subscribed, make_action([state](action, scheduler) { - state->source->subscribe(state->observer); + state->source->subscribe(state->o); return make_action_empty(); })); schedule_absolute(unsubscribed, make_action([state](action, scheduler) { - state->observer.unsubscribe(); + state->o.unsubscribe(); return make_action_empty(); })); start(); - return state->observer; + return state->o; } template @@ -246,7 +248,7 @@ public: for (auto& message : mv) { auto n = message.value(); - scheduler->schedule_relative(message.time(), make_action([n, o](action, scheduler) { + sc->schedule_relative(message.time(), make_action([n, o](action, scheduler) { n->accept(o); return make_action_empty(); })); @@ -335,4 +337,4 @@ rxt::testable_observable test::make_hot_observable(std::vector Date: Fri, 14 Feb 2014 15:52:37 -0800 Subject: [PATCH 197/782] testing '.operator()' vs. '>> rxo::operator()' --- Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp | 19 +++++++ Rx/CPP/src/rxcpp/rx-includes.hpp | 2 +- Rx/CPP/src/rxcpp/rx-operators.hpp | 5 -- Rx/CPP/src/rxcpp/rx-sources.hpp | 51 +++++++++++++++++ Rx/CPP/src/rxcpp/rx.hpp | 58 ++++---------------- Rx/CPP/test/v2/operators/filter.cpp | 61 +++++++++++++++++++-- 6 files changed, 139 insertions(+), 57 deletions(-) diff --git a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp index e8495bf..e8adadb 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp @@ -127,6 +127,25 @@ auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) return detail::subscribe_factory(std::move(cs), std::move(n), std::move(e), std::move(c)); } +namespace detail { + +class dynamic_factory +{ +public: + template + auto operator()(Observable source) + -> observable> { + return observable>(source); + } +}; + +} + +inline auto as_dynamic() + -> detail::dynamic_factory { + return detail::dynamic_factory(); +} + } } diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 07f4b7f..6beae24 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -94,8 +94,8 @@ #include "rx-observer.hpp" #include "rx-notification.hpp" #include "rx-scheduler.hpp" -#include "rx-operators.hpp" #include "rx-sources.hpp" +#include "rx-operators.hpp" #pragma pop_macro("min") #pragma pop_macro("max") diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/CPP/src/rxcpp/rx-operators.hpp index 551a0ab..519c136 100644 --- a/Rx/CPP/src/rxcpp/rx-operators.hpp +++ b/Rx/CPP/src/rxcpp/rx-operators.hpp @@ -9,11 +9,6 @@ namespace rxcpp { - -template -class observable; - - namespace operators { diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index 7e585a1..b8a6999 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -33,6 +33,57 @@ public: } namespace rxs=sources; +template +struct dynamic_observable + : public rxs::source_base +{ + struct state_type + : public std::enable_shared_from_this + { + typedef std::function>)> onsubscribe_type; + + onsubscribe_type on_subscribe; + }; + std::shared_ptr state; + + dynamic_observable() + { + } + + template + explicit dynamic_observable(Source source) + : state(std::make_shared()) + { + state->on_subscribe = [source](observer> o) mutable { + source.on_subscribe(std::move(o)); + }; + } + + void on_subscribe(observer> o) const { + state->on_subscribe(std::move(o)); + } + + template + typename std::enable_if::type, observer>>::value, void>::type + on_subscribe(Observer o) const { + auto so = std::make_shared(o); + state->on_subscribe(make_observer_dynamic( + so->get_subscription(), + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + })); + } +}; + } #include "sources/rx-range.hpp" diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index da2f660..38adcef 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -5,60 +5,22 @@ #if !defined(RXCPP_RX_HPP) #define RXCPP_RX_HPP -#include "rx-includes.hpp" - namespace rxcpp { template -struct dynamic_observable - : public rxs::source_base -{ - struct state_type - : public std::enable_shared_from_this - { - typedef std::function>)> onsubscribe_type; +struct dynamic_observable; - onsubscribe_type on_subscribe; - }; - std::shared_ptr state; +template< + class T = void, + class SourceObservable = std::conditional::value, + void, dynamic_observable>::type> +class observable; - dynamic_observable() - { - } +} - template - explicit dynamic_observable(Source source) - : state(std::make_shared()) - { - state->on_subscribe = [source](observer> o) mutable { - source.on_subscribe(std::move(o)); - }; - } +#include "rx-includes.hpp" - void on_subscribe(observer> o) const { - state->on_subscribe(std::move(o)); - } - - template - typename std::enable_if::type, observer>>::value, void>::type - on_subscribe(Observer o) const { - auto so = std::make_shared(o); - state->on_subscribe(make_observer_dynamic( - so->get_subscription(), - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - })); - } -}; +namespace rxcpp { template class observable @@ -196,12 +158,14 @@ public: return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } +#if RXCPP_USE_OBSERVABLE_MEMBERS template auto filter(Predicate p) const -> observable> { return observable>( rxo::detail::filter(*this, std::move(p))); } +#endif }; // observable<> has static methods to construct observable sources and adaptors. diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index f415c10..cd2fdf6 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,3 +1,6 @@ + +#define RXCPP_USE_OBSERVABLE_MEMBERS 1 + #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; @@ -53,6 +56,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ WHEN("filtered to ints that are primes"){ auto res = sc->start( [&xs, &invoked]() { +#if RXCPP_USE_OBSERVABLE_MEMBERS return xs .filter([&invoked](int x) { invoked++; @@ -60,9 +64,17 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ }) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); +#else + return xs + >> rxo::filter([&invoked](int x) { + invoked++; + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + >> rxo::as_dynamic(); +#endif } ); - THEN("the output only contains primes"){ m::recorded_type items[] = { m::on_next(230, 3), @@ -120,6 +132,7 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ auto res = sc->start( [&xs, &invoked]() { +#if RXCPP_USE_OBSERVABLE_MEMBERS return xs .filter([&invoked](int x) { invoked++; @@ -127,6 +140,15 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ }) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); +#else + return xs + >> rxo::filter([&invoked](int x) { + invoked++; + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + >> rxo::as_dynamic(); +#endif }, 400 ); @@ -194,6 +216,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ auto res = sc->start( [xs, &invoked]() { +#if RXCPP_USE_OBSERVABLE_MEMBERS return xs .filter([&invoked](int x) { invoked++; @@ -201,6 +224,15 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ }) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); +#else + return xs + >> rxo::filter([&invoked](int x) { + invoked++; + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + >> rxo::as_dynamic(); +#endif } ); @@ -269,6 +301,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ auto res = sc->start( [ex, xs, &invoked]() { +#if RXCPP_USE_OBSERVABLE_MEMBERS return xs .filter([ex, &invoked](int x) { invoked++; @@ -279,6 +312,18 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ }) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); +#else + return xs + >> rxo::filter([ex, &invoked](int x) { + invoked++; + if (x > 5) { + throw ex; + } + return IsPrime(x); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + >> rxo::as_dynamic(); +#endif } ); @@ -347,15 +392,23 @@ SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ sc->schedule_absolute(rxsc::test::created_time, [&invoked, &res, &ys, &xs](rxsc::action, rxsc::scheduler) { +#if RXCPP_USE_OBSERVABLE_MEMBERS ys = xs .filter([&invoked, &res](int x) { invoked++; if (x == 8) res.unsubscribe(); return IsPrime(x); - }) - // forget type to workaround lambda deduction bug on msvc 2013 - .as_dynamic(); + }); +#else + ys = xs + >> rxo::filter([&invoked, &res](int x) { + invoked++; + if (x == 8) + res.unsubscribe(); + return IsPrime(x); + }); +#endif return rxsc::make_action_empty(); }); -- GitLab From b78e30f9aa61f355be41f4faa3c650942c798c50 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 14 Feb 2014 15:58:01 -0800 Subject: [PATCH 198/782] clang fixes --- Rx/CPP/src/rxcpp/rx-includes.hpp | 1 + Rx/CPP/src/rxcpp/rx-predef.hpp | 24 ++++++++++++++++++++++++ Rx/CPP/src/rxcpp/rx.hpp | 13 ------------- 3 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/rx-predef.hpp diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 6beae24..52c2283 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -90,6 +90,7 @@ #endif #include "rx-util.hpp" +#include "rx-predef.hpp" #include "rx-subscription.hpp" #include "rx-observer.hpp" #include "rx-notification.hpp" diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp new file mode 100644 index 0000000..bb29b73 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -0,0 +1,24 @@ +// 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 { + +template +struct dynamic_observable; + +template< + class T = void, + class SourceObservable = typename std::conditional::value, + void, dynamic_observable>::type> +class observable; + + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 38adcef..8e0e9c9 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -5,19 +5,6 @@ #if !defined(RXCPP_RX_HPP) #define RXCPP_RX_HPP -namespace rxcpp { - -template -struct dynamic_observable; - -template< - class T = void, - class SourceObservable = std::conditional::value, - void, dynamic_observable>::type> -class observable; - -} - #include "rx-includes.hpp" namespace rxcpp { -- GitLab From f820b2eac9a4469c51f017ef9f84ded2073e972d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 14 Feb 2014 16:57:04 -0800 Subject: [PATCH 199/782] use default template args for observable/observer --- Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp | 4 ++-- Rx/CPP/src/rxcpp/rx-notification.hpp | 2 +- Rx/CPP/src/rxcpp/rx-observer.hpp | 11 +++++------ Rx/CPP/src/rxcpp/rx-predef.hpp | 8 +++++++- Rx/CPP/src/rxcpp/rx-sources.hpp | 8 ++++---- Rx/CPP/src/rxcpp/rx-test.hpp | 22 ++++++++++----------- Rx/CPP/src/rxcpp/rx.hpp | 2 +- Rx/CPP/src/rxcpp/schedulers/rx-test.hpp | 6 +++--- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp index e8adadb..0a53734 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp @@ -134,8 +134,8 @@ class dynamic_factory public: template auto operator()(Observable source) - -> observable> { - return observable>(source); + -> observable { + return observable(source); } }; diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/CPP/src/rxcpp/rx-notification.hpp index 4bdd5bd..503c392 100644 --- a/Rx/CPP/src/rxcpp/rx-notification.hpp +++ b/Rx/CPP/src/rxcpp/rx-notification.hpp @@ -46,7 +46,7 @@ template struct notification_base : public std::enable_shared_from_this> { - typedef observer> observer_type; + typedef observer observer_type; typedef std::shared_ptr> type; virtual ~notification_base() {} diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 644d29b..976d6fc 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -235,9 +235,8 @@ template class observer : public observer_root { typedef observer this_type; - typedef typename std::conditional::value, I, dynamic_observer>::type + typedef typename std::conditional::value, I, dynamic_observer>::type inner_t; - inner_t; inner_t inner; public: ~observer() @@ -411,14 +410,14 @@ auto make_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c template auto make_observer_dynamic(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) - -> observer> { - return observer>(dynamic_observer(std::move(n), std::move(e), std::move(c))); + -> observer { + return observer(dynamic_observer(std::move(n), std::move(e), std::move(c))); } template auto make_observer_dynamic(composite_subscription cs, typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) - -> observer> { - return observer>(dynamic_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); + -> observer { + return observer(dynamic_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } } diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp index bb29b73..8da4f9f 100644 --- a/Rx/CPP/src/rxcpp/rx-predef.hpp +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -9,6 +9,12 @@ namespace rxcpp { +template +class dynamic_observer; + +template> +class observer; + template struct dynamic_observable; @@ -21,4 +27,4 @@ class observable; } -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index b8a6999..a732178 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -40,7 +40,7 @@ struct dynamic_observable struct state_type : public std::enable_shared_from_this { - typedef std::function>)> onsubscribe_type; + typedef std::function)> onsubscribe_type; onsubscribe_type on_subscribe; }; @@ -54,17 +54,17 @@ struct dynamic_observable explicit dynamic_observable(Source source) : state(std::make_shared()) { - state->on_subscribe = [source](observer> o) mutable { + state->on_subscribe = [source](observer o) mutable { source.on_subscribe(std::move(o)); }; } - void on_subscribe(observer> o) const { + void on_subscribe(observer o) const { state->on_subscribe(std::move(o)); } template - typename std::enable_if::type, observer>>::value, void>::type + typename std::enable_if::type, observer>::value, void>::type on_subscribe(Observer o) const { auto so = std::make_shared(o); state->on_subscribe(make_observer_dynamic( diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp index 594030a..4280e1f 100644 --- a/Rx/CPP/src/rxcpp/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -18,13 +18,13 @@ struct test_subject_base typedef rxn::recorded::type> recorded_type; typedef std::shared_ptr> type; - virtual void on_subscribe(observer>) const =0; + virtual void on_subscribe(observer) const =0; virtual std::vector messages() const =0; virtual std::vector subscriptions() const =0; }; template -struct test_source +struct test_source : public rxs::source_base { explicit test_source(typename test_subject_base::type ts) @@ -32,11 +32,11 @@ struct test_source { } typename test_subject_base::type ts; - void on_subscribe(observer> o) const { + void on_subscribe(observer o) const { ts->on_subscribe(std::move(o)); } template - typename std::enable_if::type, observer>>::value, void>::type + typename std::enable_if::type, observer>::value, void>::type on_subscribe(Observer o) const { auto so = std::make_shared(o); ts->on_subscribe(make_observer_dynamic( @@ -59,17 +59,17 @@ struct test_source } template -class testable_observer - : public observer> +class testable_observer + : public observer { - typedef observer> observer_base; + typedef observer observer_base; typedef typename detail::test_subject_base::type test_subject; test_subject ts; public: typedef typename detail::test_subject_base::recorded_type recorded_type; - testable_observer(test_subject ts, observer_base ob) + testable_observer(test_subject ts, observer_base ob) : observer_base(std::move(ob)) , ts(std::move(ts)) { @@ -81,7 +81,7 @@ public: }; template -class testable_observable +class testable_observable : public observable> { typedef observable> observable_base; @@ -91,7 +91,7 @@ class testable_observable public: typedef typename detail::test_subject_base::recorded_type recorded_type; - explicit testable_observable(test_subject ts) + explicit testable_observable(test_subject ts) : observable_base(detail::test_source(ts)) , ts(ts) { @@ -113,4 +113,4 @@ namespace rxt=test; #include "schedulers/rx-test.hpp" -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 8e0e9c9..8b833ad 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -117,7 +117,7 @@ public: // // performs type-forgetting conversion // - observable> as_dynamic() { + observable as_dynamic() { return *this; } diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp index 39cd0af..250dbf6 100644 --- a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp @@ -175,7 +175,7 @@ public: typename test::shared sc; std::vector m; - virtual void on_subscribe(observer>) const { + virtual void on_subscribe(observer) const { abort(); } virtual std::vector subscriptions() const { @@ -242,7 +242,7 @@ public: { } - virtual void on_subscribe(observer> o) const { + virtual void on_subscribe(observer o) const { sv.push_back(rxn::subscription(sc->clock())); auto index = sv.size() - 1; @@ -283,7 +283,7 @@ class hot_observable typedef hot_observable this_type; typename test::shared sc; typedef rxn::recorded::type> recorded_type; - typedef observer> observer_type; + typedef observer observer_type; mutable std::vector mv; mutable std::vector sv; mutable std::vector observers; -- GitLab From fce5aed33fa96696f1be3974d4a674a05f5db80b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 17 Feb 2014 00:27:35 -0800 Subject: [PATCH 200/782] added optimized subject --- Rx/CPP/src/rxcpp/rx-includes.hpp | 2 + Rx/CPP/src/rxcpp/rx-observable.hpp | 181 ++++++++++++++++ Rx/CPP/src/rxcpp/rx-observer.hpp | 35 ++- Rx/CPP/src/rxcpp/rx-operators.hpp | 3 +- Rx/CPP/src/rxcpp/rx-predef.hpp | 3 +- Rx/CPP/src/rxcpp/rx-sources.hpp | 31 ++- Rx/CPP/src/rxcpp/rx-subjects.hpp | 21 ++ Rx/CPP/src/rxcpp/rx.hpp | 171 --------------- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 264 +++++++++++++++++++++++ Rx/CPP/test/v2/operators/filter.cpp | 48 +++++ 10 files changed, 567 insertions(+), 192 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/rx-observable.hpp create mode 100644 Rx/CPP/src/rxcpp/rx-subjects.hpp create mode 100644 Rx/CPP/src/rxcpp/subjects/rx-subject.hpp diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 52c2283..7b53b15 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -96,7 +96,9 @@ #include "rx-notification.hpp" #include "rx-scheduler.hpp" #include "rx-sources.hpp" +#include "rx-subjects.hpp" #include "rx-operators.hpp" +#include "rx-observable.hpp" #pragma pop_macro("min") #pragma pop_macro("max") diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp new file mode 100644 index 0000000..fb7f8e1 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -0,0 +1,181 @@ +// 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_OBSERVABLE_HPP) +#define RXCPP_RX_SCHEDULER_OBSERVABLE_HPP + +#include "rx-includes.hpp" + +namespace rxcpp { + +template +class observable +{ + mutable SourceOperator source_operator; + +private: + template + friend class observable; + + template + auto detail_subscribe(observer o, tag_observer&&) const + -> decltype(make_subscription(o)) { + + if (!o.is_subscribed()) { + return make_subscription(o); + } + + auto subscriber = [=]() { + try { + source_operator.on_subscribe(o); + } + catch(...) { + if (!o.is_subscribed()) { + throw; + } + o.on_error(std::current_exception()); + o.unsubscribe(); + } + }; + + if (rxsc::current_thread::is_schedule_required()) { + auto sc = rxsc::make_current_thread(); + sc->schedule([=](rxsc::action, rxsc::scheduler) { + subscriber(); + return rxsc::make_action_empty(); + }); + } else { + subscriber(); + } + + return make_subscription(o); + } + + struct tag_function {}; + template + auto detail_subscribe(OnNext n, tag_function&&) const + -> decltype(make_subscription( make_observer(std::move(n)))) { + return subscribe( make_observer(std::move(n))); + } + + template + auto detail_subscribe(OnNext n, OnError e, tag_function&&) const + -> decltype(make_subscription( make_observer(std::move(n), std::move(e)))) { + return subscribe( make_observer(std::move(n), std::move(e))); + } + + template + auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) const + -> decltype(make_subscription( make_observer(std::move(n), std::move(e), std::move(c)))) { + return subscribe( make_observer(std::move(n), std::move(e), std::move(c))); + } + + template + auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) const + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n)))) { + return subscribe( make_observer(std::move(cs), std::move(n))); + } + + template + auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) const + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e)))) { + return subscribe( make_observer(std::move(cs), std::move(n), std::move(e))); + } + +public: + typedef T value_type; + + static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + + observable() + { + } + + explicit observable(const SourceOperator& o) + : source_operator(o) + { + } + explicit observable(SourceOperator&& o) + : source_operator(std::move(o)) + { + } + + // implicit conversion between observables of the same value_type + template + observable(const observable& o) + : source_operator(o.source_operator) + {} + +#if 0 + template + void on_subscribe(observer o) const { + source_operator.on_subscribe(o); + } +#endif + + // + // performs type-forgetting conversion + // + observable as_dynamic() { + return *this; + } + + template + auto subscribe(Arg a) const + -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type())) { + return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type()); + } + + template + auto subscribe(Arg1 a1, Arg2 a2) const + -> decltype(detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type())) { + return detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type()); + } + + template + auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) const + -> decltype(detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type())) { + return detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type()); + } + + template + auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) const + -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c)))) { + return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); + } + +#if RXCPP_USE_OBSERVABLE_MEMBERS + template + auto filter(Predicate p) const + -> observable> { + return observable>( + rxo::detail::filter(*this, std::move(p))); + } +#endif +}; + +// observable<> has static methods to construct observable sources and adaptors. +// observable<> is not constructable +template<> +class observable +{ + ~observable(); +public: + template + static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable> { + return observable>( + rxs::detail::range(start, count, step, sc)); + } +}; + +} + +template +auto operator >> (rxcpp::observable source, OperatorFactory&& op) + -> decltype(op(source)){ + return op(source); +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 976d6fc..c0d8ee2 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -27,8 +27,10 @@ private: mutable typename this_type::subscription_type s; - observer_base(); public: + observer_base() + { + } observer_base(typename this_type::subscription_type s) : s(std::move(s)) { @@ -237,6 +239,21 @@ class observer : public observer_root typedef observer this_type; typedef typename std::conditional::value, I, dynamic_observer>::type inner_t; + struct detacher + { + ~detacher() + { + if (that) { + that->unsubscribe(); + } + } + detacher(const observer* that) + : that(that) + { + } + const observer* that; + }; + inner_t inner; public: ~observer() @@ -248,28 +265,24 @@ public: } void on_next(T t) const { if (is_subscribed()) { - RXCPP_UNWIND(unsubscriber, [this](){ - this->unsubscribe(); - }); + detacher protect(this); inner.on_next(std::move(t)); - unsubscriber.dismiss(); + protect.that = nullptr; } } void on_error(std::exception_ptr e) const { if (is_subscribed()) { - RXCPP_UNWIND_AUTO([this](){ - this->unsubscribe(); - }); + detacher protect(this); inner.on_error(e); + protect.that = nullptr; } unsubscribe(); } void on_completed() const { if (is_subscribed()) { - RXCPP_UNWIND_AUTO([this](){ - this->unsubscribe(); - }); + detacher protect(this); inner.on_completed(); + protect.that = nullptr; } unsubscribe(); } diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/CPP/src/rxcpp/rx-operators.hpp index 519c136..497cb6f 100644 --- a/Rx/CPP/src/rxcpp/rx-operators.hpp +++ b/Rx/CPP/src/rxcpp/rx-operators.hpp @@ -11,7 +11,6 @@ namespace rxcpp { namespace operators { - struct tag_operator {}; template struct operator_base @@ -27,7 +26,7 @@ class is_operator template static void check(...); public: - static const bool value = std::is_convertible(0)), tag_operator>::value; + static const bool value = std::is_convertible::type>(0)), tag_operator>::value; }; } diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp index 8da4f9f..9c32656 100644 --- a/Rx/CPP/src/rxcpp/rx-predef.hpp +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -16,7 +16,7 @@ template> class observer; template -struct dynamic_observable; +class dynamic_observable; template< class T = void, @@ -24,7 +24,6 @@ template< void, dynamic_observable>::type> class observable; - } #endif diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index a732178..d3126bd 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -34,7 +34,7 @@ public: namespace rxs=sources; template -struct dynamic_observable +class dynamic_observable : public rxs::source_base { struct state_type @@ -46,17 +46,31 @@ struct dynamic_observable }; std::shared_ptr state; + template + void construct(SO so, rxs::tag_source&&) { + state->on_subscribe = [so](observer o) mutable { + so.on_subscribe(std::move(o)); + }; + } + + struct tag_function {}; + template + void construct(F&& f, tag_function&&) { + state->on_subscribe = std::forward(f); + } + +public: + dynamic_observable() { } - template - explicit dynamic_observable(Source source) + template + explicit dynamic_observable(SOF&& sof) : state(std::make_shared()) { - state->on_subscribe = [source](observer o) mutable { - source.on_subscribe(std::move(o)); - }; + construct(std::forward(sof), + typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); } void on_subscribe(observer o) const { @@ -84,6 +98,11 @@ struct dynamic_observable } }; +template +observable make_dynamic_observable(Source&& s) { + return observable(dynamic_observable(std::forward(s))); +} + } #include "sources/rx-range.hpp" diff --git a/Rx/CPP/src/rxcpp/rx-subjects.hpp b/Rx/CPP/src/rxcpp/rx-subjects.hpp new file mode 100644 index 0000000..1289835 --- /dev/null +++ b/Rx/CPP/src/rxcpp/rx-subjects.hpp @@ -0,0 +1,21 @@ +// 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" + +#endif \ No newline at end of file diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/CPP/src/rxcpp/rx.hpp index 8b833ad..79bd4fd 100644 --- a/Rx/CPP/src/rxcpp/rx.hpp +++ b/Rx/CPP/src/rxcpp/rx.hpp @@ -7,175 +7,4 @@ #include "rx-includes.hpp" -namespace rxcpp { - -template -class observable -{ - mutable SourceOperator source_operator; - -private: - template - friend class observable; - - template - auto detail_subscribe(observer o, tag_observer&&) const - -> decltype(make_subscription(o)) { - - if (!o.is_subscribed()) { - return make_subscription(o); - } - - auto subscriber = [=]() { - try { - source_operator.on_subscribe(o); - } - catch(...) { - if (!o.is_subscribed()) { - throw; - } - o.on_error(std::current_exception()); - o.unsubscribe(); - } - }; - - if (rxsc::current_thread::is_schedule_required()) { - auto sc = rxsc::make_current_thread(); - sc->schedule([=](rxsc::action, rxsc::scheduler) { - subscriber(); - return rxsc::make_action_empty(); - }); - } else { - subscriber(); - } - - return make_subscription(o); - } - - struct tag_function {}; - template - auto detail_subscribe(OnNext n, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n)))) { - return subscribe( make_observer(std::move(n))); - } - - template - auto detail_subscribe(OnNext n, OnError e, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n), std::move(e)))) { - return subscribe( make_observer(std::move(n), std::move(e))); - } - - template - auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n), std::move(e), std::move(c)))) { - return subscribe( make_observer(std::move(n), std::move(e), std::move(c))); - } - - template - auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n)))) { - return subscribe( make_observer(std::move(cs), std::move(n))); - } - - template - auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e)))) { - return subscribe( make_observer(std::move(cs), std::move(n), std::move(e))); - } - -public: - typedef T value_type; - - static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); - - observable() - { - } - - explicit observable(const SourceOperator& o) - : source_operator(o) - { - } - explicit observable(SourceOperator&& o) - : source_operator(std::move(o)) - { - } - - // implicit conversion between observables of the same value_type - template - observable(const observable& o) - : source_operator(o.source_operator) - {} - -#if 0 - template - void on_subscribe(observer o) const { - source_operator.on_subscribe(o); - } -#endif - - // - // performs type-forgetting conversion - // - observable as_dynamic() { - return *this; - } - - template - auto subscribe(Arg a) const - -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type())) { - return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type()); - } - - template - auto subscribe(Arg1 a1, Arg2 a2) const - -> decltype(detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type())) { - return detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type()); - } - - template - auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) const - -> decltype(detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type())) { - return detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type()); - } - - template - auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c)))) { - return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); - } - -#if RXCPP_USE_OBSERVABLE_MEMBERS - template - auto filter(Predicate p) const - -> observable> { - return observable>( - rxo::detail::filter(*this, std::move(p))); - } -#endif -}; - -// observable<> has static methods to construct observable sources and adaptors. -// observable<> is not constructable -template<> -class observable -{ - ~observable(); -public: - template - static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - rxs::detail::range(start, count, step, sc)); - } -}; - -} - -template -auto operator >> (rxcpp::observable source, OperatorFactory&& op) - -> decltype(op(source)){ - return op(source); -} - #endif diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp new file mode 100644 index 0000000..435e1db --- /dev/null +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -0,0 +1,264 @@ +// 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_SUBJECT_HPP) +#define RXCPP_RX_SCHEDULER_SUBJECT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace subjects { + +namespace detail { + + +template +class multicast_observer + : public observer_base +{ + typedef observer_base base; + typedef std::vector> list_type; + + struct state_type; + + struct machine_type + { + ~machine_type() + { + delete state.exchange(nullptr); + } + machine_type(std::unique_ptr state) + : state(state.release()) + { + } + mutable std::recursive_mutex replace_lock; + mutable std::atomic state; + }; + + struct state_type + { + virtual void spin_until_unused() const =0; + virtual void add(observer observer, machine_type& m) const =0; + virtual void on_next(T t, machine_type& m) const =0; + virtual void on_error(std::exception_ptr e, machine_type& m) const =0; + virtual void on_completed(machine_type& m) const =0; + }; + + struct errored + : public state_type + { + std::exception_ptr e; + errored(std::exception_ptr e) + : e(e) + { + } + virtual void spin_until_unused() const { + } + virtual void add(observer observer, machine_type&) const { + observer.on_error(e); + } + virtual void on_next(T, machine_type&) const { + } + virtual void on_error(std::exception_ptr, machine_type&) const { + } + virtual void on_completed(machine_type&) const { + } + }; + + struct completed + : public state_type + { + virtual void spin_until_unused() const { + } + virtual void add(observer observer, machine_type&) const { + observer.on_completed(); + } + virtual void on_next(T, machine_type&) const { + } + virtual void on_error(std::exception_ptr, machine_type&) const { + } + virtual void on_completed(machine_type&) const { + } + }; + + struct casting + : public state_type + { + mutable std::atomic count; + mutable list_type observers; + + struct scoped_count + { + std::atomic& c; + ~scoped_count() + { + --c; + } + scoped_count(std::atomic& c) + : c(c) + { + ++c; + } + }; + + casting(list_type existing, observer observer) + : observers(existing) + { + observers.push_back(observer); + } + + virtual void spin_until_unused() const { + while(count != 0); + } + virtual void add(observer observer, machine_type& m) const { + std::unique_ptr that; + { + scoped_count track(count); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new casting(observers, observer)); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->add(observer, m); + return; + } + that.reset(compare); + next.release(); + } + that->spin_until_unused(); + } + virtual void on_next(T t, machine_type& m) const { + scoped_count track(count); + for (auto& o : observers) { + o.on_next(std::move(t)); + } + } + virtual void on_error(std::exception_ptr e, machine_type& m) const { + std::unique_ptr that; + { + scoped_count track(count); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new errored(e)); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->on_error(e, m); + return; + } + that.reset(compare); + next.release(); + guard.unlock(); + for (auto& o : observers) { + o.on_error(std::move(e)); + } + } + that->spin_until_unused(); + } + virtual void on_completed(machine_type& m) const { + std::unique_ptr that; + { + scoped_count track(count); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new completed()); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->on_completed(m); + return; + } + that.reset(compare); + next.release(); + guard.unlock(); + for (auto& o : observers) { + o.on_completed(); + } + } + that->spin_until_unused(); + } + }; + + struct empty + : public state_type + { + virtual void spin_until_unused() const { + } + virtual void add(observer observer, machine_type& m) const { + list_type none; + std::unique_ptr that; + { + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new casting(none, observer)); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->add(observer, m); + return; + } + that.reset(compare); + next.release(); + } + } + virtual void on_next(T, machine_type&) const { + } + virtual void on_error(std::exception_ptr, machine_type&) const { + } + virtual void on_completed(machine_type&) const { + } + }; + + typedef std::shared_ptr shared; + shared machine; + +public: + multicast_observer() + : machine(std::make_shared(std::unique_ptr(new empty()))) + { + } + multicast_observer(composite_subscription cs) + : observer_base(std::move(cs)) + , machine(std::make_shared(std::unique_ptr(new empty()))) + { + } + void add(observer observer) const { + machine->state.load()->add(observer, *machine); + } + void on_next(T t) const { + machine->state.load()->on_next(std::move(t), *machine); + } + void on_error(std::exception_ptr e) const { + machine->state.load()->on_error(std::move(e), *machine); + } + void on_completed() const { + machine->state.load()->on_completed(*machine); + } +}; + +} + +template +class subject +{ + detail::multicast_observer s; + +public: + subject() + { + } + subject(composite_subscription cs) + : s(std::move(cs)) + { + } + + observer> get_observer() const { + return observer>(s); + } + observable get_observable() const { + return make_dynamic_observable([this](observer o){ + this->s.add(std::move(o)); + }); + } +}; + +} + +} + +#endif \ No newline at end of file diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index cd2fdf6..03140a9 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -7,6 +7,7 @@ namespace rxu=rxcpp::util; namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" @@ -27,6 +28,53 @@ bool IsPrime(int x) } } +SCENARIO("subject test", "[subject][subjects]"){ + GIVEN("a subject"){ + WHEN("multicasting a million ints"){ + using namespace std::chrono; + typedef steady_clock clock; + + const int onnextcalls = 10000000; + + for (int n = 0; n < 10; n++) + { + rxsub::subject sub; + + for (int i = 0; i < n; i++) { + sub.get_observable().subscribe([](int){}); + } + + auto start = clock::now(); + rxs::range(0, onnextcalls).subscribe(sub.get_observer()); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range: " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + for (int n = 0; n < 10; n++) + { + rxsub::subject sub; + + for (int i = 0; i < n; i++) { + sub.get_observable().subscribe([](int){}); + } + + auto start = clock::now(); + auto o = sub.get_observer(); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop : " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + } + } +} + SCENARIO("filter stops on completion", "[filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); -- GitLab From 9899e4202c6533ccc0ed97ef08bd59bee952e1b5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 17 Feb 2014 00:43:06 -0800 Subject: [PATCH 201/782] making clang happy --- Rx/CPP/src/rxcpp/rx-observable.hpp | 72 +++++++++++++++++++++++- Rx/CPP/src/rxcpp/rx-predef.hpp | 3 + Rx/CPP/src/rxcpp/rx-sources.hpp | 70 ----------------------- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 5 +- Rx/CPP/test/v2/operators/filter.cpp | 17 +++--- 5 files changed, 86 insertions(+), 81 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index fb7f8e1..0e520c4 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -9,6 +9,76 @@ namespace rxcpp { +template +class dynamic_observable + : public rxs::source_base +{ + struct state_type + : public std::enable_shared_from_this + { + typedef std::function)> onsubscribe_type; + + onsubscribe_type on_subscribe; + }; + std::shared_ptr state; + + template + void construct(SO so, rxs::tag_source&&) { + state->on_subscribe = [so](observer o) mutable { + so.on_subscribe(std::move(o)); + }; + } + + struct tag_function {}; + template + void construct(F&& f, tag_function&&) { + state->on_subscribe = std::forward(f); + } + +public: + + dynamic_observable() + { + } + + template + explicit dynamic_observable(SOF&& sof) + : state(std::make_shared()) + { + construct(std::forward(sof), + typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); + } + + void on_subscribe(observer o) const { + state->on_subscribe(std::move(o)); + } + + template + typename std::enable_if::type, observer>::value, void>::type + on_subscribe(Observer o) const { + auto so = std::make_shared(o); + state->on_subscribe(make_observer_dynamic( + so->get_subscription(), + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + })); + } +}; + +template +observable make_dynamic_observable(Source&& s) { + return observable(dynamic_observable(std::forward(s))); +} + template class observable { @@ -178,4 +248,4 @@ auto operator >> (rxcpp::observable source, OperatorFactory&& return op(source); } -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp index 9c32656..588f2d2 100644 --- a/Rx/CPP/src/rxcpp/rx-predef.hpp +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -24,6 +24,9 @@ template< void, dynamic_observable>::type> class observable; +template +observable make_dynamic_observable(Source&&); + } #endif diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/CPP/src/rxcpp/rx-sources.hpp index d3126bd..7e585a1 100644 --- a/Rx/CPP/src/rxcpp/rx-sources.hpp +++ b/Rx/CPP/src/rxcpp/rx-sources.hpp @@ -33,76 +33,6 @@ public: } namespace rxs=sources; -template -class dynamic_observable - : public rxs::source_base -{ - struct state_type - : public std::enable_shared_from_this - { - typedef std::function)> onsubscribe_type; - - onsubscribe_type on_subscribe; - }; - std::shared_ptr state; - - template - void construct(SO so, rxs::tag_source&&) { - state->on_subscribe = [so](observer o) mutable { - so.on_subscribe(std::move(o)); - }; - } - - struct tag_function {}; - template - void construct(F&& f, tag_function&&) { - state->on_subscribe = std::forward(f); - } - -public: - - dynamic_observable() - { - } - - template - explicit dynamic_observable(SOF&& sof) - : state(std::make_shared()) - { - construct(std::forward(sof), - typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); - } - - void on_subscribe(observer o) const { - state->on_subscribe(std::move(o)); - } - - template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Observer o) const { - auto so = std::make_shared(o); - state->on_subscribe(make_observer_dynamic( - so->get_subscription(), - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - })); - } -}; - -template -observable make_dynamic_observable(Source&& s) { - return observable(dynamic_observable(std::forward(s))); -} - } #include "sources/rx-range.hpp" diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 435e1db..1128307 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -39,6 +39,7 @@ class multicast_observer struct state_type { + virtual ~state_type(){} virtual void spin_until_unused() const =0; virtual void add(observer observer, machine_type& m) const =0; virtual void on_next(T t, machine_type& m) const =0; @@ -103,7 +104,7 @@ class multicast_observer } }; - casting(list_type existing, observer observer) + casting(list_type existing, observer observer) : observers(existing) { observers.push_back(observer); @@ -261,4 +262,4 @@ public: } -#endif \ No newline at end of file +#endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 03140a9..1d6aa9b 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -45,11 +45,15 @@ SCENARIO("subject test", "[subject][subjects]"){ } auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe(sub.get_observer()); + auto o = sub.get_observer(); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "range: " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop : " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } for (int n = 0; n < 10; n++) @@ -61,16 +65,13 @@ SCENARIO("subject test", "[subject][subjects]"){ } auto start = clock::now(); - auto o = sub.get_observer(); - for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); - } - o.on_completed(); + rxs::range(0, onnextcalls).subscribe(sub.get_observer()); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop : " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "range: " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } + } } } -- GitLab From 9307e99bf3781755e4ae261cdc187892706cf2a3 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Mon, 17 Feb 2014 07:35:20 -0800 Subject: [PATCH 202/782] async changes --- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 120 ++++++++++------------- Rx/CPP/test/v2/operators/filter.cpp | 7 +- 2 files changed, 59 insertions(+), 68 deletions(-) diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 1128307..d280a4d 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -40,7 +40,6 @@ class multicast_observer struct state_type { virtual ~state_type(){} - virtual void spin_until_unused() const =0; virtual void add(observer observer, machine_type& m) const =0; virtual void on_next(T t, machine_type& m) const =0; virtual void on_error(std::exception_ptr e, machine_type& m) const =0; @@ -55,8 +54,6 @@ class multicast_observer : e(e) { } - virtual void spin_until_unused() const { - } virtual void add(observer observer, machine_type&) const { observer.on_error(e); } @@ -71,8 +68,6 @@ class multicast_observer struct completed : public state_type { - virtual void spin_until_unused() const { - } virtual void add(observer observer, machine_type&) const { observer.on_completed(); } @@ -89,99 +84,92 @@ class multicast_observer { mutable std::atomic count; mutable list_type observers; + mutable std::unique_ptr that; + struct scoped_count { - std::atomic& c; + const casting& c; ~scoped_count() { - --c; + if (--c.count == 0) { + c.that.reset(); + } } - scoped_count(std::atomic& c) - : c(c) + scoped_count(const casting* c) + : c(*c) { - ++c; + ++this->c.count; } }; - casting(list_type existing, observer observer) - : observers(existing) + casting(list_type& existing, observer o) { - observers.push_back(observer); + observers.reserve(existing.size() + 1); + std::copy_if( + existing.begin(), existing.end(), + std::inserter(observers, observers.end()), + [](observer& o){ + return o.is_subscribed(); + }); + observers.push_back(o); } - virtual void spin_until_unused() const { - while(count != 0); - } virtual void add(observer observer, machine_type& m) const { - std::unique_ptr that; - { - scoped_count track(count); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new casting(observers, observer)); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->add(observer, m); - return; - } - that.reset(compare); - next.release(); + scoped_count track(this); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new casting(observers, observer)); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->add(observer, m); + return; } - that->spin_until_unused(); + that.reset(compare); + next.release(); } virtual void on_next(T t, machine_type& m) const { - scoped_count track(count); + scoped_count track(this); for (auto& o : observers) { o.on_next(std::move(t)); } } virtual void on_error(std::exception_ptr e, machine_type& m) const { - std::unique_ptr that; - { - scoped_count track(count); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new errored(e)); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->on_error(e, m); - return; - } - that.reset(compare); - next.release(); - guard.unlock(); - for (auto& o : observers) { - o.on_error(std::move(e)); - } + scoped_count track(this); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new errored(e)); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->on_error(e, m); + return; + } + that.reset(compare); + next.release(); + guard.unlock(); + for (auto& o : observers) { + o.on_error(std::move(e)); } - that->spin_until_unused(); } virtual void on_completed(machine_type& m) const { - std::unique_ptr that; - { - scoped_count track(count); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new completed()); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->on_completed(m); - return; - } - that.reset(compare); - next.release(); - guard.unlock(); - for (auto& o : observers) { - o.on_completed(); - } + scoped_count track(this); + std::unique_lock guard(m.replace_lock); + std::unique_ptr next(new completed()); + state_type* compare = const_cast(this); + if (!m.state.compare_exchange_strong(compare, next.get())) { + compare->on_completed(m); + return; + } + that.reset(compare); + next.release(); + guard.unlock(); + for (auto& o : observers) { + o.on_completed(); } - that->spin_until_unused(); } }; struct empty : public state_type { - virtual void spin_until_unused() const { - } virtual void add(observer observer, machine_type& m) const { list_type none; std::unique_ptr that; diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 1d6aa9b..59e1d00 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -44,8 +44,9 @@ SCENARIO("subject test", "[subject][subjects]"){ sub.get_observable().subscribe([](int){}); } - auto start = clock::now(); auto o = sub.get_observer(); + + auto start = clock::now(); for (int i = 0; i < onnextcalls; i++) { o.on_next(i); } @@ -64,8 +65,10 @@ SCENARIO("subject test", "[subject][subjects]"){ sub.get_observable().subscribe([](int){}); } + auto o = sub.get_observer(); + auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe(sub.get_observer()); + rxs::range(0, onnextcalls).subscribe(o); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); -- GitLab From b7734f43a9921793bc2538dc33222882ea85bb78 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 18 Feb 2014 17:37:41 -0800 Subject: [PATCH 203/782] new subject impl I have to choose correct and simple over fast and wrong. The std::recursive_mutex perf controls the perf in this impl. --- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 280 ++++++++++------------- Rx/CPP/test/v2/operators/filter.cpp | 84 ++++++- 2 files changed, 197 insertions(+), 167 deletions(-) diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index d280a4d..7358212 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -13,213 +13,171 @@ namespace subjects { namespace detail { - template class multicast_observer : public observer_base { typedef observer_base base; - typedef std::vector> list_type; - - struct state_type; + typedef observer observer_type; + typedef std::vector list_type; - struct machine_type + struct mode { - ~machine_type() - { - delete state.exchange(nullptr); - } - machine_type(std::unique_ptr state) - : state(state.release()) - { - } - mutable std::recursive_mutex replace_lock; - mutable std::atomic state; + enum type { + Invalid = 0, + Casting, + Completed, + Errored + }; }; - struct state_type - { - virtual ~state_type(){} - virtual void add(observer observer, machine_type& m) const =0; - virtual void on_next(T t, machine_type& m) const =0; - virtual void on_error(std::exception_ptr e, machine_type& m) const =0; - virtual void on_completed(machine_type& m) const =0; - }; + struct completer_type; - struct errored - : public state_type + struct state_type + : public std::enable_shared_from_this { - std::exception_ptr e; - errored(std::exception_ptr e) - : e(e) + state_type() + : current(mode::Casting) { } - virtual void add(observer observer, machine_type&) const { - observer.on_error(e); - } - virtual void on_next(T, machine_type&) const { - } - virtual void on_error(std::exception_ptr, machine_type&) const { - } - virtual void on_completed(machine_type&) const { - } + std::atomic completers; + std::recursive_mutex lock; + typename mode::type current; + std::exception_ptr error; }; - struct completed - : public state_type + struct completer_type + : public std::enable_shared_from_this { - virtual void add(observer observer, machine_type&) const { - observer.on_completed(); - } - virtual void on_next(T, machine_type&) const { - } - virtual void on_error(std::exception_ptr, machine_type&) const { - } - virtual void on_completed(machine_type&) const { - } - }; - - struct casting - : public state_type - { - mutable std::atomic count; - mutable list_type observers; - mutable std::unique_ptr that; - - - struct scoped_count + ~completer_type() { - const casting& c; - ~scoped_count() - { - if (--c.count == 0) { - c.that.reset(); + std::unique_lock guard(state->lock); + if (--state->completers == 0) { + switch(state->current) { + case mode::Casting: + break; + case mode::Errored: + { + for (auto& o : observers) { + o.on_error(state->error); + } + } + break; + case mode::Completed: + { + for (auto& o : observers) { + o.on_completed(); + } + } + break; + default: + abort(); } } - scoped_count(const casting* c) - : c(*c) - { - ++this->c.count; - } - }; - - casting(list_type& existing, observer o) - { - observers.reserve(existing.size() + 1); - std::copy_if( - existing.begin(), existing.end(), - std::inserter(observers, observers.end()), - [](observer& o){ - return o.is_subscribed(); - }); - observers.push_back(o); - } - - virtual void add(observer observer, machine_type& m) const { - scoped_count track(this); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new casting(observers, observer)); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->add(observer, m); - return; - } - that.reset(compare); - next.release(); - } - virtual void on_next(T t, machine_type& m) const { - scoped_count track(this); - for (auto& o : observers) { - o.on_next(std::move(t)); - } } - virtual void on_error(std::exception_ptr e, machine_type& m) const { - scoped_count track(this); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new errored(e)); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->on_error(e, m); - return; - } - that.reset(compare); - next.release(); - guard.unlock(); - for (auto& o : observers) { - o.on_error(std::move(e)); - } - } - virtual void on_completed(machine_type& m) const { - scoped_count track(this); - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new completed()); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->on_completed(m); - return; - } - that.reset(compare); - next.release(); - guard.unlock(); - for (auto& o : observers) { - o.on_completed(); + completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) + : state(s) + { + ++state->completers; + if (old) { + observers.reserve(old->observers.size() + 1); + std::copy_if( + old->observers.begin(), old->observers.end(), + std::inserter(observers, observers.end()), + [](const observer& o){ + return o.is_subscribed(); + }); } + observers.push_back(o); } + std::shared_ptr state; + list_type observers; }; - struct empty - : public state_type + // this type exists to prevent a circular ref between state and completer + struct binder_type + : public std::enable_shared_from_this { - virtual void add(observer observer, machine_type& m) const { - list_type none; - std::unique_ptr that; - { - std::unique_lock guard(m.replace_lock); - std::unique_ptr next(new casting(none, observer)); - state_type* compare = const_cast(this); - if (!m.state.compare_exchange_strong(compare, next.get())) { - compare->add(observer, m); - return; - } - that.reset(compare); - next.release(); - } - } - virtual void on_next(T, machine_type&) const { - } - virtual void on_error(std::exception_ptr, machine_type&) const { - } - virtual void on_completed(machine_type&) const { + binder_type() + : state(std::make_shared()) + { } + + std::shared_ptr state; + + // must only be accessed under state->lock + mutable std::shared_ptr completer; }; - typedef std::shared_ptr shared; - shared machine; + std::shared_ptr b; + + public: multicast_observer() - : machine(std::make_shared(std::unique_ptr(new empty()))) + : b(std::make_shared()) { } multicast_observer(composite_subscription cs) : observer_base(std::move(cs)) - , machine(std::make_shared(std::unique_ptr(new empty()))) + , b(std::make_shared()) { } - void add(observer observer) const { - machine->state.load()->add(observer, *machine); + void add(observer o) const { + std::unique_lock guard(b->state->lock); + switch (b->state->current) { + case mode::Casting: + { + if (o.is_subscribed()) { + b->completer = std::make_shared(b->state, b->completer, o); + } + } + break; + case mode::Completed: + { + o.on_completed(); + } + break; + case mode::Errored: + { + o.on_error(b->state->error); + } + break; + default: + abort(); + } } void on_next(T t) const { - machine->state.load()->on_next(std::move(t), *machine); + std::shared_ptr c; + { + std::unique_lock guard(b->state->lock); + if (!b->completer) { + return; + } + c = b->completer; + } + for (auto& o : c->observers) { + o.on_next(std::move(t)); + } } void on_error(std::exception_ptr e) const { - machine->state.load()->on_error(std::move(e), *machine); + std::unique_lock guard(b->state->lock); + if (b->state->current == mode::Casting) { + b->state->error = e; + b->state->current = mode::Errored; + b->completer.reset(); + } } void on_completed() const { - machine->state.load()->on_completed(*machine); + std::unique_lock guard(b->state->lock); + if (b->state->current == mode::Casting) { + b->state->current = mode::Completed; + b->completer.reset(); + } } }; + } template diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 59e1d00..8a6c462 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,5 +1,6 @@ #define RXCPP_USE_OBSERVABLE_MEMBERS 1 +#define RXCPP_SUBJECT_TEST_ASYNC 0 #include "rxcpp/rx.hpp" namespace rx=rxcpp; @@ -34,14 +35,72 @@ SCENARIO("subject test", "[subject][subjects]"){ using namespace std::chrono; typedef steady_clock clock; - const int onnextcalls = 10000000; + const int onnextcalls = 100000000; + + { + int c = 0; + int n = 1; + auto o = rx::make_observer([&c](int){++c;}); + auto start = clock::now(); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + { + int c = 0; + int n = 1; + auto start = clock::now(); + rxs::range(0, onnextcalls).subscribe([&c](int){++c;}); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + { + std::recursive_mutex m; + int c = 0; + int n = 1; + auto start = clock::now(); + for (int i = 0; i < onnextcalls; i++) { + std::unique_lock guard(m); + ++c; + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop recursive_mutex: " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } for (int n = 0; n < 10; n++) { + auto c = std::make_shared(); rxsub::subject sub; for (int i = 0; i < n; i++) { - sub.get_observable().subscribe([](int){}); +#if RXCPP_SUBJECT_TEST_ASYNC + std::async([sub, c]() { + auto source = sub.get_observable(); + auto subscription = sub.get_observer(); + while(subscription.is_subscribed()) { + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + rx::composite_subscription cs; + assert(cs.is_subscribed()); + source.subscribe(cs, [c, cs](int){ + ++(*c); + cs.unsubscribe(); + }); + } + }); +#else + sub.get_observable().subscribe([c](int){++(*c);}); +#endif } auto o = sub.get_observer(); @@ -54,15 +113,29 @@ SCENARIO("subject test", "[subject][subjects]"){ auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop : " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } for (int n = 0; n < 10; n++) { + auto c = std::make_shared(); rxsub::subject sub; for (int i = 0; i < n; i++) { - sub.get_observable().subscribe([](int){}); +#if RXCPP_SUBJECT_TEST_ASYNC + std::async([sub, c]() { + while(sub.get_observer().is_subscribed()) { + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + rx::composite_subscription cs; + sub.get_observable().subscribe(cs, [c, cs](int){ + ++(*c); + cs.unsubscribe(); + }); + } + }); +#else + sub.get_observable().subscribe([c](int){++(*c);}); +#endif } auto o = sub.get_observer(); @@ -72,9 +145,8 @@ SCENARIO("subject test", "[subject][subjects]"){ auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "range: " << n << " subscribed, " << onnextcalls << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "range : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } - } } } -- GitLab From 68e866d9d9dd09b1f48b1b897700a6e347183389 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 18 Feb 2014 18:10:07 -0800 Subject: [PATCH 204/782] clang fixes --- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 8 ++++---- Rx/CPP/test/v2/operators/filter.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 7358212..ab0b5bd 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -75,7 +75,7 @@ class multicast_observer } } } - completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) + completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { ++state->completers; @@ -106,7 +106,7 @@ class multicast_observer std::shared_ptr state; // must only be accessed under state->lock - mutable std::shared_ptr completer; + mutable std::shared_ptr completer; }; std::shared_ptr b; @@ -129,7 +129,7 @@ public: case mode::Casting: { if (o.is_subscribed()) { - b->completer = std::make_shared(b->state, b->completer, o); + b->completer = std::make_shared(b->state, b->completer, o); } } break; @@ -148,7 +148,7 @@ public: } } void on_next(T t) const { - std::shared_ptr c; + std::shared_ptr c; { std::unique_lock guard(b->state->lock); if (!b->completer) { diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 8a6c462..0a80897 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -80,7 +80,7 @@ SCENARIO("subject test", "[subject][subjects]"){ for (int n = 0; n < 10; n++) { - auto c = std::make_shared(); + auto c = std::make_shared(0); rxsub::subject sub; for (int i = 0; i < n; i++) { @@ -118,7 +118,7 @@ SCENARIO("subject test", "[subject][subjects]"){ for (int n = 0; n < 10; n++) { - auto c = std::make_shared(); + auto c = std::make_shared(0); rxsub::subject sub; for (int i = 0; i < n; i++) { -- GitLab From b24fdaba44891782c4a4f71f91d56ec83e9f7956 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 18 Feb 2014 18:39:39 -0800 Subject: [PATCH 205/782] fix async bug --- Rx/CPP/test/v2/operators/filter.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 0a80897..4d70651 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -35,7 +35,7 @@ SCENARIO("subject test", "[subject][subjects]"){ using namespace std::chrono; typedef steady_clock clock; - const int onnextcalls = 100000000; + const int onnextcalls = 10000000; { int c = 0; @@ -83,9 +83,13 @@ SCENARIO("subject test", "[subject][subjects]"){ auto c = std::make_shared(0); rxsub::subject sub; +#if RXCPP_SUBJECT_TEST_ASYNC + std::vector> f(n); +#endif + for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - std::async([sub, c]() { + f[i] = std::async([sub, c]() { auto source = sub.get_observable(); auto subscription = sub.get_observer(); while(subscription.is_subscribed()) { @@ -97,6 +101,7 @@ SCENARIO("subject test", "[subject][subjects]"){ cs.unsubscribe(); }); } + return 0; }); #else sub.get_observable().subscribe([c](int){++(*c);}); @@ -121,9 +126,13 @@ SCENARIO("subject test", "[subject][subjects]"){ auto c = std::make_shared(0); rxsub::subject sub; +#if RXCPP_SUBJECT_TEST_ASYNC + std::vector> f(n); +#endif + for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - std::async([sub, c]() { + f[i] = std::async([sub, c]() { while(sub.get_observer().is_subscribed()) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); rx::composite_subscription cs; @@ -132,6 +141,7 @@ SCENARIO("subject test", "[subject][subjects]"){ cs.unsubscribe(); }); } + return 0; }); #else sub.get_observable().subscribe([c](int){++(*c);}); -- GitLab From 4185a6945b4712cf1083ea67888b005027724e31 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 18 Feb 2014 23:52:14 -0800 Subject: [PATCH 206/782] remove recursive_mutex usage --- Rx/CPP/src/rxcpp/rx-observable.hpp | 2 -- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 29 ++++++++++++++++-------- Rx/CPP/test/v2/operators/filter.cpp | 29 ++++++++++-------------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index 0e520c4..7d201cf 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -215,14 +215,12 @@ public: return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } -#if RXCPP_USE_OBSERVABLE_MEMBERS template auto filter(Predicate p) const -> observable> { return observable>( rxo::detail::filter(*this, std::move(p))); } -#endif }; // observable<> has static methods to construct observable sources and adaptors. diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index ab0b5bd..7c1c67f 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -41,7 +41,7 @@ class multicast_observer { } std::atomic completers; - std::recursive_mutex lock; + std::mutex lock; typename mode::type current; std::exception_ptr error; }; @@ -51,13 +51,14 @@ class multicast_observer { ~completer_type() { - std::unique_lock guard(state->lock); if (--state->completers == 0) { + std::unique_lock guard(state->lock); switch(state->current) { case mode::Casting: break; case mode::Errored: { + guard.unlock(); for (auto& o : observers) { o.on_error(state->error); } @@ -65,6 +66,7 @@ class multicast_observer break; case mode::Completed: { + guard.unlock(); for (auto& o : observers) { o.on_completed(); } @@ -124,7 +126,7 @@ public: { } void add(observer o) const { - std::unique_lock guard(b->state->lock); + std::unique_lock guard(b->state->lock); switch (b->state->current) { case mode::Casting: { @@ -135,12 +137,17 @@ public: break; case mode::Completed: { + guard.unlock(); o.on_completed(); + return; } break; case mode::Errored: { - o.on_error(b->state->error); + auto e = b->state->error; + guard.unlock(); + o.on_error(e); + return; } break; default: @@ -150,7 +157,7 @@ public: void on_next(T t) const { std::shared_ptr c; { - std::unique_lock guard(b->state->lock); + std::unique_lock guard(b->state->lock); if (!b->completer) { return; } @@ -161,18 +168,22 @@ public: } } void on_error(std::exception_ptr e) const { - std::unique_lock guard(b->state->lock); + std::unique_lock guard(b->state->lock); if (b->state->current == mode::Casting) { b->state->error = e; b->state->current = mode::Errored; - b->completer.reset(); + auto c = std::move(b->completer); + guard.unlock(); + // destruct completer outside the lock } } void on_completed() const { - std::unique_lock guard(b->state->lock); + std::unique_lock guard(b->state->lock); if (b->state->current == mode::Casting) { b->state->current = mode::Completed; - b->completer.reset(); + auto c = std::move(b->completer); + guard.unlock(); + // destruct completer outside the lock } } }; diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 4d70651..e188939 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,6 +1,6 @@ #define RXCPP_USE_OBSERVABLE_MEMBERS 1 -#define RXCPP_SUBJECT_TEST_ASYNC 0 +#define RXCPP_SUBJECT_TEST_ASYNC 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; @@ -64,18 +64,18 @@ SCENARIO("subject test", "[subject][subjects]"){ } { - std::recursive_mutex m; + std::mutex m; int c = 0; int n = 1; auto start = clock::now(); for (int i = 0; i < onnextcalls; i++) { - std::unique_lock guard(m); + std::unique_lock guard(m); ++c; } auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop recursive_mutex: " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } for (int n = 0; n < 10; n++) @@ -89,23 +89,20 @@ SCENARIO("subject test", "[subject][subjects]"){ for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub, c]() { + f[i] = std::async([sub]() { auto source = sub.get_observable(); auto subscription = sub.get_observer(); while(subscription.is_subscribed()) { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); rx::composite_subscription cs; - assert(cs.is_subscribed()); - source.subscribe(cs, [c, cs](int){ - ++(*c); + source.subscribe(cs, [cs](int){ cs.unsubscribe(); }); } return 0; }); -#else - sub.get_observable().subscribe([c](int){++(*c);}); #endif + sub.get_observable().subscribe([c](int){++(*c);}); } auto o = sub.get_observer(); @@ -132,20 +129,18 @@ SCENARIO("subject test", "[subject][subjects]"){ for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub, c]() { + f[i] = std::async([sub]() { while(sub.get_observer().is_subscribed()) { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); rx::composite_subscription cs; - sub.get_observable().subscribe(cs, [c, cs](int){ - ++(*c); + sub.get_observable().subscribe(cs, [cs](int){ cs.unsubscribe(); }); } return 0; }); -#else - sub.get_observable().subscribe([c](int){++(*c);}); #endif + sub.get_observable().subscribe([c](int){++(*c);}); } auto o = sub.get_observer(); -- GitLab From b60bf6bfe0321790ab94c44632d00bb68479e841 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 20 Feb 2014 21:55:38 -0800 Subject: [PATCH 207/782] give specific string to exception --- Rx/CPP/test/v2/operators/filter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index e188939..a69df05 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -316,7 +316,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ long invoked = 0; - std::exception ex; + std::exception ex("filter on_error from source"); auto xs = sc->make_hot_observable( [ex]() { @@ -401,7 +401,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ long invoked = 0; - std::exception ex; + std::exception ex("filter predicate error"); auto xs = sc->make_hot_observable( []() { -- GitLab From 39f1072f615f751454cf9e2be56ee96ce9cc5b16 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 20 Feb 2014 22:00:55 -0800 Subject: [PATCH 208/782] add static checking for observer functions --- Rx/CPP/src/rxcpp/rx-observer.hpp | 337 ++++++++++++++++++++++++++----- 1 file changed, 289 insertions(+), 48 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index c0d8ee2..968901b 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -87,6 +87,44 @@ struct OnCompletedEmpty { void operator()() const {} }; + +template +struct is_on_next_of +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(CT*)nullptr)); + template + static not_void check(...); + + typedef decltype(check(0)) detail_result; + static const bool value = std::is_same::value; +}; + +template +struct is_on_error +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(std::exception_ptr*)nullptr)); + template + static not_void check(...); + + static const bool value = std::is_same(0)), void>::value; +}; + +template +struct is_on_completed +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)()); + template + static not_void check(...); + + static const bool value = std::is_same(0)), void>::value; +}; + } template @@ -104,38 +142,224 @@ private: on_error_t onerror; on_completed_t oncompleted; + struct tag_this_type {}; + struct tag_function {}; + + template + struct resolve_tag + { + typedef typename std::conditional::type, dynamic_observer>::value, tag_this_type, + typename std::conditional::value, tag_subscription, tag_function>::type + >::type type; + }; + + template::type> + struct resolve_cs; + template + struct resolve_cs + { + auto operator()(const Arg& a) + -> decltype(a.cs) { + return a.cs; + } + auto operator()(Arg&& a) + -> decltype(a.cs) { + return std::move(a.cs); + } + }; + template + struct resolve_cs + { + Arg operator()(Arg a) { + return std::move(a); + } + }; + template + struct resolve_cs + { + composite_subscription operator()(const Arg& a) { + return composite_subscription(); + } + }; + + template::type> + struct resolve_onnext; + template + struct resolve_onnext + { + auto operator()(const Arg& a) + -> decltype(a.onnext) { + return a.onnext; + } + auto operator()(Arg&& a) + -> decltype(a.onnext) { + return std::move(a.onnext); + } + }; + template + struct resolve_onnext + { + template + on_next_t operator()(const Arg1& a1) { + return on_next_t(); + } + template + Arg2 operator()(const Arg1&, Arg2 a2) { + static_assert(detail::is_on_next_of::value || std::is_same::value, + "Function supplied for on_next must be a function with the signature void(T);"); + return std::move(a2); + } + }; + template + struct resolve_onnext + { + template + Arg1 operator()(Arg1 a1) { + static_assert(detail::is_on_next_of::value || std::is_same::value, + "Function supplied for on_next must be a function with the signature void(T);"); + return std::move(a1); + } + template + Arg operator()(Arg1 a1, const Arg2&) { + static_assert(detail::is_on_next_of::value || std::is_same::value, + "Function supplied for on_next must be a function with the signature void(T);"); + return std::move(a1); + } + }; + + template::type> + struct resolve_onerror; + template + struct resolve_onerror + { + auto operator()(const Arg& a) + -> decltype(a.onerror) { + return a.onerror; + } + auto operator()(Arg&& a) + -> decltype(a.onerror) { + return std::move(a.onerror); + } + }; + template + struct resolve_onerror + { + template + on_error_t operator()(const Arg1& a1) { + return on_error_t(); + } + template + Arg2 operator()(const Arg1&, Arg2 a2) { + static_assert(detail::is_on_error::value || std::is_same::value, + "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); + return std::move(a2); + } + }; + template + struct resolve_onerror + { + template + on_error_t operator()(const Arg1& a1) { + return on_error_t(); + } + template + Arg1 operator()(Arg1 a1, const Arg2&) { + static_assert(detail::is_on_error::value || std::is_same::value, + "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); + return std::move(a1); + } + }; + + template::type> + struct resolve_oncompleted; + template + struct resolve_oncompleted + { + auto operator()(const Arg& a) + -> decltype(a.oncompleted) { + return a.oncompleted; + } + auto operator()(Arg&& a) + -> decltype(a.oncompleted) { + return std::move(a.oncompleted); + } + }; + template + struct resolve_oncompleted + { + template + on_completed_t operator()(const Arg1& a1) { + return on_completed_t(); + } + template + Arg2 operator()(const Arg1&, Arg2 a2) { + static_assert(detail::is_on_completed::value || std::is_same::value, + "Function supplied for on_completed must be a function with the signature void();"); + return std::move(a2); + } + }; + template + struct resolve_oncompleted + { + template + on_completed_t operator()(const Arg1& a1) { + return on_completed_t(); + } + template + Arg1 operator()(Arg1 a1, const Arg2&) { + static_assert(detail::is_on_completed::value || std::is_same::value, + "Function supplied for on_completed must be a function with the signature void();"); + return std::move(a1); + } + }; + public: dynamic_observer() { } - dynamic_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : base_type(std::move(cs)) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) + + template + explicit dynamic_observer(Arg a) + : base_type(resolve_cs()(a)) + , onnext(resolve_onnext()(a)) + , onerror(resolve_onerror()(a)) + , oncompleted(resolve_oncompleted()(a)) { } - dynamic_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : base_type(composite_subscription()) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) + + template + dynamic_observer(Arg1 a1, Arg2 a2) + : base_type(resolve_cs()(a1)) + , onnext(resolve_onnext()(a1, a2)) + , onerror(resolve_onerror()(a2, on_error_t())) + , oncompleted(resolve_oncompleted()(on_completed_t(), on_completed_t())) { } - dynamic_observer(const dynamic_observer& o) - : base_type(o) - , onnext(o.onnext) - , onerror(o.onerror) - , oncompleted(o.oncompleted) + + template + dynamic_observer(Arg1 a1, Arg2 a2, Arg3 a3) + : base_type(resolve_cs()(a1)) + , onnext(resolve_onnext()(a1, a2)) + , onerror(resolve_onerror()(a2, a3)) + , oncompleted(resolve_oncompleted()(a3, on_completed_t())) { } - dynamic_observer(dynamic_observer&& o) - : base_type(std::move(o)) - , onnext(std::move(o.onnext)) - , onerror(std::move(o.onerror)) - , oncompleted(std::move(o.oncompleted)) + + template + dynamic_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c) + : base_type(std::move(cs)) + , onnext(std::move(n)) + , onerror(std::move(e)) + , oncompleted(std::move(c)) { + static_assert(detail::is_on_next_of::value || std::is_same::value, + "Function supplied for on_next must be a function with the signature void(T);"); + static_assert(detail::is_on_error::value || std::is_same::value, + "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); + static_assert(detail::is_on_completed::value || std::is_same::value, + "Function supplied for on_completed must be a function with the signature void();"); } + dynamic_observer& operator=(dynamic_observer o) { swap(o); return *this; @@ -165,7 +389,7 @@ public: } }; -template +template class static_observer : public observer_base { public: @@ -179,18 +403,19 @@ private: on_completed_t oncompleted; public: - static_observer() - { - } - static_observer(composite_subscription cs, on_next_t n = nullptr, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(std::move(cs)) + static_assert(detail::is_on_next_of::value, "Function supplied for on_next must be a function with the signature void(T);"); + static_assert(detail::is_on_error::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); + static_assert(detail::is_on_completed::value, "Function supplied for on_completed must be a function with the signature void();"); + + explicit static_observer(on_next_t n = on_next_t(), on_error_t e = on_error_t(), on_completed_t c = on_completed_t()) + : observer_base(composite_subscription()) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } - static_observer(on_next_t n, on_error_t e = nullptr, on_completed_t c = nullptr) - : observer_base(composite_subscription()) + explicit static_observer(composite_subscription cs, on_next_t n = on_next_t(), on_error_t e = on_error_t(), on_completed_t c = on_completed_t()) + : observer_base(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) @@ -274,17 +499,13 @@ public: if (is_subscribed()) { detacher protect(this); inner.on_error(e); - protect.that = nullptr; } - unsubscribe(); } void on_completed() const { if (is_subscribed()) { detacher protect(this); inner.on_completed(); - protect.that = nullptr; } - unsubscribe(); } typename this_type::subscription_type get_subscription() { return inner.get_subscription(); @@ -355,16 +576,16 @@ auto make_observer(I i, tag_observer&&) struct tag_function {}; template auto make_observer(OnNext n, tag_function&&) - -> observer> { - return observer>( - static_observer(std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); + -> observer> { + return observer>( + static_observer(std::move(n))); } template auto make_observer(OnNext n, OnError e, tag_function&&) - -> observer> { - return observer>( - static_observer(std::move(n), std::move(e), detail::OnCompletedEmpty())); + -> observer> { + return observer>( + static_observer(std::move(n), std::move(e))); } template @@ -376,16 +597,16 @@ auto make_observer(OnNext n, OnError e, OnCompleted c, tag_function&&) template auto make_observer(composite_subscription cs, OnNext n, tag_subscription&&) - -> observer> { - return observer>( - static_observer(std::move(cs), std::move(n), detail::OnErrorEmpty(), detail::OnCompletedEmpty())); + -> observer> { + return observer>( + static_observer(std::move(cs), std::move(n))); } template auto make_observer(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) - -> observer> { - return observer>( - static_observer(std::move(cs), std::move(n), std::move(e), detail::OnCompletedEmpty())); + -> observer> { + return observer>( + static_observer(std::move(cs), std::move(n), std::move(e))); } } @@ -421,14 +642,34 @@ auto make_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c static_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } -template -auto make_observer_dynamic(typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) +template +auto make_observer_dynamic(OnNext n) + -> observer { + return observer(dynamic_observer(std::move(n))); +} +template +auto make_observer_dynamic(OnNext n, OnError e) + -> observer { + return observer(dynamic_observer(std::move(n), std::move(e))); +} +template +auto make_observer_dynamic(OnNext n, OnError e, OnCompleted c) -> observer { return observer(dynamic_observer(std::move(n), std::move(e), std::move(c))); } -template -auto make_observer_dynamic(composite_subscription cs, typename dynamic_observer::on_next_t n, typename dynamic_observer::on_error_t e = nullptr, typename dynamic_observer::on_completed_t c = nullptr) +template +auto make_observer_dynamic(composite_subscription cs, OnNext n) + -> observer { + return observer(dynamic_observer(std::move(cs), std::move(n))); +} +template +auto make_observer_dynamic(composite_subscription cs, OnNext n, OnError e) + -> observer { + return observer(dynamic_observer(std::move(cs), std::move(n), std::move(e))); +} +template +auto make_observer_dynamic(composite_subscription cs, OnNext n, OnError e, OnCompleted c) -> observer { return observer(dynamic_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); } -- GitLab From 9ad402dfd9c1b4667ddf138d1a1c6f1594cc49d4 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 21 Feb 2014 00:58:46 -0800 Subject: [PATCH 209/782] Allow insertion of user operators --- Rx/CPP/src/rxcpp/rx-observable.hpp | 44 +++++++++++++++++++++++++++-- Rx/CPP/src/rxcpp/rx-test.hpp | 6 ++++ Rx/CPP/test/v2/operators/filter.cpp | 11 ++++++-- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index 7d201cf..5f0fec5 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -9,6 +9,23 @@ namespace rxcpp { +namespace detail { + +template +struct is_operator_factory_for +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(CS*)nullptr)); + template + static not_void check(...); + + typedef decltype(check(0)) detail_result; + static const bool value = !std::is_same::value; +}; + +} + template class dynamic_observable : public rxs::source_base @@ -82,6 +99,7 @@ observable make_dynamic_observable(Source&& s) { template class observable { + typedef observable this_type; mutable SourceOperator source_operator; private: @@ -176,6 +194,18 @@ public: observable(const observable& o) : source_operator(o.source_operator) {} + // implicit conversion between observables of the same value_type + template + observable(observable&& o) + : source_operator(std::move(o.source_operator)) + {} + + observable(const observable& o) + : source_operator(o.source_operator) + {} + observable(observable&& o) + : source_operator(std::move(o.source_operator)) + {} #if 0 template @@ -221,6 +251,14 @@ public: return observable>( rxo::detail::filter(*this, std::move(p))); } + + template + auto op(OperatorFactory&& of) const + -> decltype(of(*(this_type*)nullptr)) { + static_assert(detail::is_operator_factory_for::value, "Function passed for op() must have the signature Result(SourceObservable)"); + return of(*this); + } + }; // observable<> has static methods to construct observable sources and adaptors. @@ -241,9 +279,9 @@ public: } template -auto operator >> (rxcpp::observable source, OperatorFactory&& op) - -> decltype(op(source)){ - return op(source); +auto operator >> (const rxcpp::observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } #endif diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp index 4280e1f..d4d6581 100644 --- a/Rx/CPP/src/rxcpp/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -111,6 +111,12 @@ namespace rxt=test; } +template +auto operator >> (const rxcpp::test::testable_observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} + #include "schedulers/rx-test.hpp" #endif diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index a69df05..abe5604 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -140,7 +140,10 @@ SCENARIO("subject test", "[subject][subjects]"){ return 0; }); #endif - sub.get_observable().subscribe([c](int){++(*c);}); + sub.get_observable() + // demonstrates insertion of user definied operator + .op(rxo::filter([](int){return true;})) + .subscribe([c](int){++(*c);}); } auto o = sub.get_observer(); @@ -185,7 +188,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ WHEN("filtered to ints that are primes"){ auto res = sc->start( [&xs, &invoked]() { -#if RXCPP_USE_OBSERVABLE_MEMBERS +#if 0 && RXCPP_USE_OBSERVABLE_MEMBERS return xs .filter([&invoked](int x) { invoked++; @@ -199,6 +202,10 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ invoked++; return IsPrime(x); }) + // demonstrates insertion of user definied operator + >> [](rx::observable o)->rx::observable{ + return rxo::filter([](int){return true;})(o); + } // forget type to workaround lambda deduction bug on msvc 2013 >> rxo::as_dynamic(); #endif -- GitLab From 2aa62955ead93f877291d9b12db1ef6375c0054e Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 21 Feb 2014 09:17:48 -0800 Subject: [PATCH 210/782] add tests for subject --- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 32 +- Rx/CPP/test/v2/operators/filter.cpp | 130 ------- Rx/CPP/test/v2/subjects/subject.cpp | 430 +++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 4 files changed, 454 insertions(+), 139 deletions(-) create mode 100644 Rx/CPP/test/v2/subjects/subject.cpp diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 7c1c67f..7c337a4 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -40,6 +40,7 @@ class multicast_observer : current(mode::Casting) { } + std::atomic has_observers; std::atomic completers; std::mutex lock; typename mode::type current; @@ -75,11 +76,13 @@ class multicast_observer default: abort(); } + state->has_observers.exchange(false); } } completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { + state->has_observers.exchange(true); ++state->completers; if (old) { observers.reserve(old->observers.size() + 1); @@ -125,6 +128,11 @@ public: , b(std::make_shared()) { } + + bool has_observers() const { + return b->state->has_observers; + } + void add(observer o) const { std::unique_lock guard(b->state->lock); switch (b->state->current) { @@ -155,16 +163,18 @@ public: } } void on_next(T t) const { - std::shared_ptr c; - { - std::unique_lock guard(b->state->lock); - if (!b->completer) { - return; + if (has_observers()) { + std::shared_ptr c; + { + std::unique_lock guard(b->state->lock); + if (!b->completer) { + return; + } + c = b->completer; + } + for (auto& o : c->observers) { + o.on_next(std::move(t)); } - c = b->completer; - } - for (auto& o : c->observers) { - o.on_next(std::move(t)); } } void on_error(std::exception_ptr e) const { @@ -205,6 +215,10 @@ public: { } + bool has_observers() const { + return s.has_observers(); + } + observer> get_observer() const { return observer>(s); } diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index abe5604..2c6e134 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -29,136 +29,6 @@ bool IsPrime(int x) } } -SCENARIO("subject test", "[subject][subjects]"){ - GIVEN("a subject"){ - WHEN("multicasting a million ints"){ - using namespace std::chrono; - typedef steady_clock clock; - - const int onnextcalls = 10000000; - - { - int c = 0; - int n = 1; - auto o = rx::make_observer([&c](int){++c;}); - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); - } - o.on_completed(); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } - - { - int c = 0; - int n = 1; - auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe([&c](int){++c;}); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "range no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } - - { - std::mutex m; - int c = 0; - int n = 1; - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - std::unique_lock guard(m); - ++c; - } - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } - - for (int n = 0; n < 10; n++) - { - auto c = std::make_shared(0); - rxsub::subject sub; - -#if RXCPP_SUBJECT_TEST_ASYNC - std::vector> f(n); -#endif - - for (int i = 0; i < n; i++) { -#if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub]() { - auto source = sub.get_observable(); - auto subscription = sub.get_observer(); - while(subscription.is_subscribed()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - rx::composite_subscription cs; - source.subscribe(cs, [cs](int){ - cs.unsubscribe(); - }); - } - return 0; - }); -#endif - sub.get_observable().subscribe([c](int){++(*c);}); - } - - auto o = sub.get_observer(); - - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); - } - o.on_completed(); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } - - for (int n = 0; n < 10; n++) - { - auto c = std::make_shared(0); - rxsub::subject sub; - -#if RXCPP_SUBJECT_TEST_ASYNC - std::vector> f(n); -#endif - - for (int i = 0; i < n; i++) { -#if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub]() { - while(sub.get_observer().is_subscribed()) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - rx::composite_subscription cs; - sub.get_observable().subscribe(cs, [cs](int){ - cs.unsubscribe(); - }); - } - return 0; - }); -#endif - sub.get_observable() - // demonstrates insertion of user definied operator - .op(rxo::filter([](int){return true;})) - .subscribe([c](int){++(*c);}); - } - - auto o = sub.get_observer(); - - auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe(o); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "range : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } - } - } -} - SCENARIO("filter stops on completion", "[filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); diff --git a/Rx/CPP/test/v2/subjects/subject.cpp b/Rx/CPP/test/v2/subjects/subject.cpp new file mode 100644 index 0000000..8be2df8 --- /dev/null +++ b/Rx/CPP/test/v2/subjects/subject.cpp @@ -0,0 +1,430 @@ + +#define RXCPP_USE_OBSERVABLE_MEMBERS 1 +#define RXCPP_SUBJECT_TEST_ASYNC 1 + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +SCENARIO("subject test", "[hide][subject][subjects][perf]"){ + GIVEN("a subject"){ + WHEN("multicasting a million ints"){ + using namespace std::chrono; + typedef steady_clock clock; + + const int onnextcalls = 10000000; + + { + int c = 0; + int n = 1; + auto o = rx::make_observer([&c](int){++c;}); + auto start = clock::now(); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + { + int c = 0; + int n = 1; + auto start = clock::now(); + rxs::range(0, onnextcalls).subscribe([&c](int){++c;}); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + { + std::mutex m; + int c = 0; + int n = 1; + auto start = clock::now(); + for (int i = 0; i < onnextcalls; i++) { + std::unique_lock guard(m); + ++c; + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + for (int n = 0; n < 10; n++) + { + auto c = std::make_shared(0); + rxsub::subject sub; + +#if RXCPP_SUBJECT_TEST_ASYNC + std::vector> f(n); +#endif + + for (int i = 0; i < n; i++) { +#if RXCPP_SUBJECT_TEST_ASYNC + f[i] = std::async([sub]() { + auto source = sub.get_observable(); + auto subscription = sub.get_observer(); + while(subscription.is_subscribed()) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + rx::composite_subscription cs; + source.subscribe(cs, [cs](int){ + cs.unsubscribe(); + }); + } + return 0; + }); +#endif + sub.get_observable().subscribe([c](int){++(*c);}); + } + + auto o = sub.get_observer(); + + auto start = clock::now(); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + for (int n = 0; n < 10; n++) + { + auto c = std::make_shared(0); + rxsub::subject sub; + +#if RXCPP_SUBJECT_TEST_ASYNC + std::vector> f(n); +#endif + + for (int i = 0; i < n; i++) { +#if RXCPP_SUBJECT_TEST_ASYNC + f[i] = std::async([sub]() { + while(sub.get_observer().is_subscribed()) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + rx::composite_subscription cs; + sub.get_observable().subscribe(cs, [cs](int){ + cs.unsubscribe(); + }); + } + return 0; + }); +#endif + sub.get_observable() + // demonstrates insertion of user definied operator + .op(rxo::filter([](int){return true;})) + .subscribe([c](int){++(*c);}); + } + + auto o = sub.get_observer(); + + auto start = clock::now(); + rxs::range(0, onnextcalls).subscribe(o); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + } + } +} + + + +SCENARIO("subject - infinite source", "[subject][subjects]"){ + GIVEN("a subject and an infinite source"){ + + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + m::recorded_type messages[] = { + m::on_next(70, 1), + m::on_next(110, 2), + m::on_next(220, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7), + m::on_next(630, 8), + m::on_next(710, 9), + m::on_next(870, 10), + m::on_next(940, 11), + m::on_next(1020, 12) + }; + auto xs = sc->make_hot_observable(messages); + + rxsub::subject s; + + auto results1 = sc->make_observer(); + + auto results2 = sc->make_observer(); + + auto results3 = sc->make_observer(); + + WHEN("multicasting an infinite source"){ + + + sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ + xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ + s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + + sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); + sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); + sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); + + sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ + results2.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ + results3.unsubscribe(); return rxsc::make_action_empty();}); + + sc->start(); + + THEN("result1 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7) + }; + auto required = rxu::to_vector(items); + auto actual = results1.messages(); + REQUIRE(required == actual); + } + + THEN("result2 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(410, 6), + m::on_next(520, 7), + m::on_next(630, 8) + }; + auto required = rxu::to_vector(items); + auto actual = results2.messages(); + REQUIRE(required == actual); + } + + THEN("result3 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(940, 11) + }; + auto required = rxu::to_vector(items); + auto actual = results3.messages(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("subject - finite source", "[subject][subjects]"){ + GIVEN("a subject and an finite source"){ + + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + m::recorded_type messages[] = { + m::on_next(70, 1), + m::on_next(110, 2), + m::on_next(220, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7), + m::on_completed(630), + m::on_next(640, 9), + m::on_completed(650), + m::on_error(660, std::exception("error on unsubscribed stream")) + }; + auto xs = sc->make_hot_observable(messages); + + rxsub::subject s; + + auto results1 = sc->make_observer(); + + auto results2 = sc->make_observer(); + + auto results3 = sc->make_observer(); + + WHEN("multicasting an infinite source"){ + + + sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ + xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ + s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + + sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); + sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); + sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); + + sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ + results2.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ + results3.unsubscribe(); return rxsc::make_action_empty();}); + + sc->start(); + + THEN("result1 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7) + }; + auto required = rxu::to_vector(items); + auto actual = results1.messages(); + REQUIRE(required == actual); + } + + THEN("result2 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(410, 6), + m::on_next(520, 7), + m::on_completed(630) + }; + auto required = rxu::to_vector(items); + auto actual = results2.messages(); + REQUIRE(required == actual); + } + + THEN("result3 contains expected messages"){ + m::recorded_type items[] = { + m::on_completed(900) + }; + auto required = rxu::to_vector(items); + auto actual = results3.messages(); + REQUIRE(required == actual); + } + + } + } +} + + +SCENARIO("subject - on_error in source", "[subject][subjects]"){ + GIVEN("a subject and a source with an error"){ + + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + std::exception ex("subject on_error in stream"); + + m::recorded_type messages[] = { + m::on_next(70, 1), + m::on_next(110, 2), + m::on_next(220, 3), + m::on_next(270, 4), + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7), + m::on_error(630, ex), + m::on_next(640, 9), + m::on_completed(650), + m::on_error(660, std::exception("error on unsubscribed stream")) + }; + auto xs = sc->make_hot_observable(messages); + + rxsub::subject s; + + auto results1 = sc->make_observer(); + + auto results2 = sc->make_observer(); + + auto results3 = sc->make_observer(); + + WHEN("multicasting an infinite source"){ + + + sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ + xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ + s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + + sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); + sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); + sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ + s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); + + sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ + results2.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ + results1.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ + results3.unsubscribe(); return rxsc::make_action_empty();}); + + sc->start(); + + THEN("result1 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(340, 5), + m::on_next(410, 6), + m::on_next(520, 7) + }; + auto required = rxu::to_vector(items); + auto actual = results1.messages(); + REQUIRE(required == actual); + } + + THEN("result2 contains expected messages"){ + m::recorded_type items[] = { + m::on_next(410, 6), + m::on_next(520, 7), + m::on_error(630, ex) + }; + auto required = rxu::to_vector(items); + auto actual = results2.messages(); + REQUIRE(required == actual); + } + + THEN("result3 contains expected messages"){ + m::recorded_type items[] = { + m::on_error(900, ex) + }; + auto required = rxu::to_vector(items); + auto actual = results3.messages(); + REQUIRE(required == actual); + } + + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 93404a2..337711b 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -37,6 +37,7 @@ set(TEST_SOURCES ${TEST_DIR}/v2/subscriptions/observer.cpp ${TEST_DIR}/v2/subscriptions/subscription.cpp ${TEST_DIR}/v2/operators/filter.cpp + ${TEST_DIR}/v2/subjects/subject.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) -- GitLab From f3ac87ef4af81ce1ee8e895d8b42d88a9c8e126b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 21 Feb 2014 11:07:31 -0800 Subject: [PATCH 211/782] fixes for clang --- Rx/CPP/src/rxcpp/rx-observable.hpp | 15 ++--- Rx/CPP/src/rxcpp/rx-observer.hpp | 22 ++++---- Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 70 +++++++----------------- Rx/CPP/test/v2/operators/filter.cpp | 10 ++-- Rx/CPP/test/v2/subjects/subject.cpp | 6 +- 5 files changed, 47 insertions(+), 76 deletions(-) diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index 5f0fec5..2b83ae1 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -39,6 +39,14 @@ class dynamic_observable }; std::shared_ptr state; + void construct(const dynamic_observable& o, rxs::tag_source&&) { + state = o.state; + } + + void construct(dynamic_observable&& o, rxs::tag_source&&) { + state = std::move(o.state); + } + template void construct(SO so, rxs::tag_source&&) { state->on_subscribe = [so](observer o) mutable { @@ -200,13 +208,6 @@ public: : source_operator(std::move(o.source_operator)) {} - observable(const observable& o) - : source_operator(o.source_operator) - {} - observable(observable&& o) - : source_operator(std::move(o.source_operator)) - {} - #if 0 template void on_subscribe(observer o) const { diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/CPP/src/rxcpp/rx-observer.hpp index 968901b..bdeccae 100644 --- a/Rx/CPP/src/rxcpp/rx-observer.hpp +++ b/Rx/CPP/src/rxcpp/rx-observer.hpp @@ -205,7 +205,7 @@ private: } template Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_next_of::value || std::is_same::value, + static_assert(detail::is_on_next_of::value || std::is_same::value, "Function supplied for on_next must be a function with the signature void(T);"); return std::move(a2); } @@ -215,13 +215,13 @@ private: { template Arg1 operator()(Arg1 a1) { - static_assert(detail::is_on_next_of::value || std::is_same::value, + static_assert(detail::is_on_next_of::value || std::is_same::value, "Function supplied for on_next must be a function with the signature void(T);"); return std::move(a1); } template Arg operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_next_of::value || std::is_same::value, + static_assert(detail::is_on_next_of::value || std::is_same::value, "Function supplied for on_next must be a function with the signature void(T);"); return std::move(a1); } @@ -250,7 +250,7 @@ private: } template Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_error::value || std::is_same::value, + static_assert(detail::is_on_error::value || std::is_same::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); return std::move(a2); } @@ -264,13 +264,13 @@ private: } template Arg1 operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_error::value || std::is_same::value, + static_assert(detail::is_on_error::value || std::is_same::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); return std::move(a1); } }; - template::type> + template::type> struct resolve_oncompleted; template struct resolve_oncompleted @@ -293,7 +293,7 @@ private: } template Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_completed::value || std::is_same::value, + static_assert(detail::is_on_completed::value || std::is_same::value, "Function supplied for on_completed must be a function with the signature void();"); return std::move(a2); } @@ -307,7 +307,7 @@ private: } template Arg1 operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_completed::value || std::is_same::value, + static_assert(detail::is_on_completed::value || std::is_same::value, "Function supplied for on_completed must be a function with the signature void();"); return std::move(a1); } @@ -352,11 +352,11 @@ public: , onerror(std::move(e)) , oncompleted(std::move(c)) { - static_assert(detail::is_on_next_of::value || std::is_same::value, + static_assert(detail::is_on_next_of::value || std::is_same::value, "Function supplied for on_next must be a function with the signature void(T);"); - static_assert(detail::is_on_error::value || std::is_same::value, + static_assert(detail::is_on_error::value || std::is_same::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); - static_assert(detail::is_on_completed::value || std::is_same::value, + static_assert(detail::is_on_completed::value || std::is_same::value, "Function supplied for on_completed must be a function with the signature void();"); } diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 7c337a4..4ee579d 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -40,7 +40,6 @@ class multicast_observer : current(mode::Casting) { } - std::atomic has_observers; std::atomic completers; std::mutex lock; typename mode::type current; @@ -52,37 +51,11 @@ class multicast_observer { ~completer_type() { - if (--state->completers == 0) { - std::unique_lock guard(state->lock); - switch(state->current) { - case mode::Casting: - break; - case mode::Errored: - { - guard.unlock(); - for (auto& o : observers) { - o.on_error(state->error); - } - } - break; - case mode::Completed: - { - guard.unlock(); - for (auto& o : observers) { - o.on_completed(); - } - } - break; - default: - abort(); - } - state->has_observers.exchange(false); - } + --state->completers; } completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { - state->has_observers.exchange(true); ++state->completers; if (old) { observers.reserve(old->observers.size() + 1); @@ -128,11 +101,6 @@ public: , b(std::make_shared()) { } - - bool has_observers() const { - return b->state->has_observers; - } - void add(observer o) const { std::unique_lock guard(b->state->lock); switch (b->state->current) { @@ -163,18 +131,16 @@ public: } } void on_next(T t) const { - if (has_observers()) { - std::shared_ptr c; - { - std::unique_lock guard(b->state->lock); - if (!b->completer) { - return; - } - c = b->completer; - } - for (auto& o : c->observers) { - o.on_next(std::move(t)); + std::shared_ptr c; + { + std::unique_lock guard(b->state->lock); + if (!b->completer) { + return; } + c = b->completer; + } + for (auto& o : c->observers) { + o.on_next(std::move(t)); } } void on_error(std::exception_ptr e) const { @@ -184,7 +150,11 @@ public: b->state->current = mode::Errored; auto c = std::move(b->completer); guard.unlock(); - // destruct completer outside the lock + if (c) { + for (auto& o : c->observers) { + o.on_error(e); + } + } } } void on_completed() const { @@ -193,7 +163,11 @@ public: b->state->current = mode::Completed; auto c = std::move(b->completer); guard.unlock(); - // destruct completer outside the lock + if (c) { + for (auto& o : c->observers) { + o.on_completed(); + } + } } } }; @@ -215,10 +189,6 @@ public: { } - bool has_observers() const { - return s.has_observers(); - } - observer> get_observer() const { return observer>(s); } diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index 2c6e134..fc40652 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -50,7 +50,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ m::on_next(580, 11), m::on_completed(600), m::on_next(610, 12), - m::on_error(620, std::exception()), + m::on_error(620, std::runtime_error("error in unsubscribed stream")), m::on_completed(630) }; auto xs = sc->make_hot_observable(messages); @@ -193,7 +193,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ long invoked = 0; - std::exception ex("filter on_error from source"); + std::runtime_error ex("filter on_error from source"); auto xs = sc->make_hot_observable( [ex]() { @@ -211,7 +211,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ m::on_next(580, 11), m::on_error(600, ex), m::on_next(610, 12), - m::on_error(620, std::exception()), + m::on_error(620, std::runtime_error("error in unsubscribed stream")), m::on_completed(630) }; return rxu::to_vector(messages); @@ -278,7 +278,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ long invoked = 0; - std::exception ex("filter predicate error"); + std::runtime_error ex("filter predicate error"); auto xs = sc->make_hot_observable( []() { @@ -296,7 +296,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ m::on_next(580, 11), m::on_completed(600), m::on_next(610, 12), - m::on_error(620, std::exception()), + m::on_error(620, std::runtime_error("error in unsubscribed stream")), m::on_completed(630) }; return rxu::to_vector(messages); diff --git a/Rx/CPP/test/v2/subjects/subject.cpp b/Rx/CPP/test/v2/subjects/subject.cpp index 8be2df8..c8b8fbd 100644 --- a/Rx/CPP/test/v2/subjects/subject.cpp +++ b/Rx/CPP/test/v2/subjects/subject.cpp @@ -259,7 +259,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ m::on_completed(630), m::on_next(640, 9), m::on_completed(650), - m::on_error(660, std::exception("error on unsubscribed stream")) + m::on_error(660, std::runtime_error("error on unsubscribed stream")) }; auto xs = sc->make_hot_observable(messages); @@ -341,7 +341,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; - std::exception ex("subject on_error in stream"); + std::runtime_error ex("subject on_error in stream"); m::recorded_type messages[] = { m::on_next(70, 1), @@ -354,7 +354,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ m::on_error(630, ex), m::on_next(640, 9), m::on_completed(650), - m::on_error(660, std::exception("error on unsubscribed stream")) + m::on_error(660, std::runtime_error("error on unsubscribed stream")) }; auto xs = sc->make_hot_observable(messages); -- GitLab From 1b7277c2e382c36d6f3e02305766ec2602353999 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 21 Feb 2014 11:18:31 -0800 Subject: [PATCH 212/782] add back has_observers() how did this get lost? --- .gitattributes | 63 ++++++++++++++++++++++++ Rx/CPP/src/rxcpp/subjects/rx-subject.hpp | 33 +++++++++---- 2 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp index 4ee579d..fafdb14 100644 --- a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp @@ -40,6 +40,7 @@ class multicast_observer : current(mode::Casting) { } + std::atomic has_observers; std::atomic completers; std::mutex lock; typename mode::type current; @@ -51,11 +52,14 @@ class multicast_observer { ~completer_type() { - --state->completers; + if (--state->completers == 0) { + state->has_observers.exchange(false); + } } completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { + state->has_observers.exchange(true); ++state->completers; if (old) { observers.reserve(old->observers.size() + 1); @@ -101,6 +105,9 @@ public: , b(std::make_shared()) { } + bool has_observers() const { + return b->state->has_observers; + } void add(observer o) const { std::unique_lock guard(b->state->lock); switch (b->state->current) { @@ -131,16 +138,18 @@ public: } } void on_next(T t) const { - std::shared_ptr c; - { - std::unique_lock guard(b->state->lock); - if (!b->completer) { - return; + if (has_observers()) { + std::shared_ptr c; + { + std::unique_lock guard(b->state->lock); + if (!b->completer) { + return; + } + c = b->completer; + } + for (auto& o : c->observers) { + o.on_next(std::move(t)); } - c = b->completer; - } - for (auto& o : c->observers) { - o.on_next(std::move(t)); } } void on_error(std::exception_ptr e) const { @@ -189,6 +198,10 @@ public: { } + bool has_observers() const { + return s.has_observers(); + } + observer> get_observer() const { return observer>(s); } -- GitLab From db9379a228e1298cc6e1f81a225b9f576ed0f744 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Fri, 21 Feb 2014 13:16:02 -0800 Subject: [PATCH 213/782] add map operator --- Rx/CPP/src/rxcpp/operators/rx-filter.hpp | 1 - Rx/CPP/src/rxcpp/operators/rx-map.hpp | 90 ++++++++++++++++ Rx/CPP/src/rxcpp/rx-includes.hpp | 1 + Rx/CPP/src/rxcpp/rx-observable.hpp | 7 ++ Rx/CPP/src/rxcpp/rx-operators.hpp | 4 +- Rx/CPP/src/rxcpp/rx-util.hpp | 126 +++++++++++++++++++++++ Rx/CPP/test/v2/operators/filter.cpp | 1 - Rx/CPP/test/v2/operators/map.cpp | 77 ++++++++++++++ Rx/CPP/test/v2/subjects/subject.cpp | 1 - projects/CMake/CMakeLists.txt | 1 + 10 files changed, 305 insertions(+), 4 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/operators/rx-map.hpp create mode 100644 Rx/CPP/test/v2/operators/map.cpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp index ffdeca6..d0cf9d2 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp @@ -40,7 +40,6 @@ struct filter : public operator_base filtered = !this->test(t); } catch(...) { o.on_error(std::current_exception()); - o.unsubscribe(); } if (!filtered) { o.on_next(std::move(t)); diff --git a/Rx/CPP/src/rxcpp/operators/rx-map.hpp b/Rx/CPP/src/rxcpp/operators/rx-map.hpp new file mode 100644 index 0000000..0ff9d2c --- /dev/null +++ b/Rx/CPP/src/rxcpp/operators/rx-map.hpp @@ -0,0 +1,90 @@ +// 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_MAP_HPP) +#define RXCPP_OPERATORS_RX_MAP_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct map : public operator_base +{ + typedef map this_type; + Observable source; + Selector select; + + struct tag_not_valid {}; + template + static auto check(int) -> decltype((*(CP*)nullptr)(*(CF*)nullptr)); + template + static tag_not_valid check(...); + + static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); + + map(Observable o, Selector s) + : source(std::move(o)) + , select(std::move(s)) + { + } + template + void on_subscribe(observer o) { + o.add(source.subscribe( + o.get_subscription(), + // on_next + [this, o](typename this_type::source_value_type st) { + util::detail::maybe selected; + try { + selected.reset(this->select(st)); + } catch(...) { + o.on_error(std::current_exception()); + } + if (!selected.empty()) { + o.on_next(std::move(*selected)); + } + }, + // on_error + [o](std::exception_ptr e) { + o.on_error(e); + }, + // on_completed + [o]() { + o.on_completed(); + } + )); + } +}; + +template +class map_factory +{ + Selector selector; +public: + map_factory(Selector p) : selector(std::move(p)) {} + template + auto operator()(Observable source) + -> observable::value_type, map> { + return observable::value_type, map>( + map(source, std::move(selector))); + } +}; + +} + +template +auto map(Selector p) + -> detail::map_factory { + return detail::map_factory(std::move(p)); +} + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 7b53b15..7e13fcc 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -42,6 +42,7 @@ #endif #if _MSC_VER >= 1800 +#pragma warning(disable: 4348) // false positives on : redefinition of default parameter : parameter 2 #define RXCPP_USE_VARIADIC_TEMPLATES 1 #endif diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index 2b83ae1..f934023 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -253,6 +253,13 @@ public: rxo::detail::filter(*this, std::move(p))); } + template + auto map(Selector s) const + -> observable::value_type, rxo::detail::map> { + return observable::value_type, rxo::detail::map>( + rxo::detail::map(*this, std::move(s))); + } + template auto op(OperatorFactory&& of) const -> decltype(of(*(this_type*)nullptr)) { diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/CPP/src/rxcpp/rx-operators.hpp index 497cb6f..535913d 100644 --- a/Rx/CPP/src/rxcpp/rx-operators.hpp +++ b/Rx/CPP/src/rxcpp/rx-operators.hpp @@ -12,10 +12,11 @@ namespace rxcpp { namespace operators { struct tag_operator {}; -template +template struct operator_base { typedef T value_type; + typedef From source_value_type; typedef tag_operator operator_tag; }; template @@ -36,5 +37,6 @@ namespace rxo=operators; #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" +#include "operators/rx-map.hpp" #endif diff --git a/Rx/CPP/src/rxcpp/rx-util.hpp b/Rx/CPP/src/rxcpp/rx-util.hpp index 64a91ae..bb6e680 100644 --- a/Rx/CPP/src/rxcpp/rx-util.hpp +++ b/Rx/CPP/src/rxcpp/rx-util.hpp @@ -39,6 +39,132 @@ std::vector to_vector(const T (&arr) [size]) { namespace detail { +template +class maybe +{ + bool is_set; + typename std::aligned_storage::value>::type + storage; +public: + maybe() + : is_set(false) + { + } + + maybe(T value) + : is_set(false) + { + new (reinterpret_cast(&storage)) T(value); + is_set = true; + } + + maybe(const maybe& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&storage)) T(*other.get()); + is_set = true; + } + } + maybe(maybe&& other) + : is_set(false) + { + if (other.is_set) { + new (reinterpret_cast(&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; + } + + size_t size() const { + return is_set ? 1 : 0; + } + + iterator begin() { + return reinterpret_cast(&storage); + } + const_iterator begin() const { + return reinterpret_cast(&storage); + } + + iterator end() { + return reinterpret_cast(&storage) + size(); + } + const_iterator end() const { + return reinterpret_cast(&storage) + size(); + } + + T* operator->() { + if (!is_set) abort(); + return reinterpret_cast(&storage); + } + const T* operator->() const { + if (!is_set) abort(); + return reinterpret_cast(&storage); + } + + T& operator*() { + if (!is_set) abort(); + return *reinterpret_cast(&storage); + } + const T& operator*() const { + if (!is_set) abort(); + return *reinterpret_cast(&storage); + } + + T& value() { + if (!is_set) abort(); + return *reinterpret_cast(&storage); + } + const T& value() const { + if (!is_set) abort(); + return *reinterpret_cast(&storage); + } + + void reset() + { + if (is_set) { + is_set = false; + reinterpret_cast(&storage)->~T(); + } + } + + void reset(T value) { + if (is_set) { + *reinterpret_cast(&storage) = std::move(value); + } else { + new (reinterpret_cast(&storage)) T(std::move(value)); + is_set = true; + } + } + + maybe& operator=(const T& other) { + set(other); + return *this; + } + maybe& operator=(const maybe& other) { + if (const T* pother = other.get()) { + set(*pother); + } else { + reset(); + } + return *this; + } +}; + template class unwinder { diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/CPP/test/v2/operators/filter.cpp index fc40652..2e202be 100644 --- a/Rx/CPP/test/v2/operators/filter.cpp +++ b/Rx/CPP/test/v2/operators/filter.cpp @@ -1,6 +1,5 @@ #define RXCPP_USE_OBSERVABLE_MEMBERS 1 -#define RXCPP_SUBJECT_TEST_ASYNC 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; diff --git a/Rx/CPP/test/v2/operators/map.cpp b/Rx/CPP/test/v2/operators/map.cpp new file mode 100644 index 0000000..397287c --- /dev/null +++ b/Rx/CPP/test/v2/operators/map.cpp @@ -0,0 +1,77 @@ + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +SCENARIO("map stops on completion", "[map][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + + long invoked = 0; + + m::recorded_type messages[] = { + m::on_next(180, 1), + m::on_next(210, 2), + m::on_next(240, 3), + m::on_next(290, 4), + m::on_next(350, 5), + m::on_completed(400), + m::on_next(410, -1), + m::on_completed(420), + m::on_error(430, std::runtime_error("error on unsubscribed stream")) + }; + auto xs = sc->make_hot_observable(messages); + + WHEN("mapped to ints that are one larger"){ + + auto res = sc->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"){ + m::recorded_type items[] = { + m::on_next(210, 3), + m::on_next(240, 4), + m::on_next(290, 5), + m::on_next(350, 6), + m::on_completed(400) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + rxn::subscription items[] = { + m::subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("map was called until completed"){ + REQUIRE(4 == invoked); + } + } + } +} diff --git a/Rx/CPP/test/v2/subjects/subject.cpp b/Rx/CPP/test/v2/subjects/subject.cpp index c8b8fbd..f1905a2 100644 --- a/Rx/CPP/test/v2/subjects/subject.cpp +++ b/Rx/CPP/test/v2/subjects/subject.cpp @@ -1,5 +1,4 @@ -#define RXCPP_USE_OBSERVABLE_MEMBERS 1 #define RXCPP_SUBJECT_TEST_ASYNC 1 #include "rxcpp/rx.hpp" diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 337711b..593fa6c 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -37,6 +37,7 @@ set(TEST_SOURCES ${TEST_DIR}/v2/subscriptions/observer.cpp ${TEST_DIR}/v2/subscriptions/subscription.cpp ${TEST_DIR}/v2/operators/filter.cpp + ${TEST_DIR}/v2/operators/map.cpp ${TEST_DIR}/v2/subjects/subject.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) -- GitLab From 538a758e1a2aa234cba949a8e200ab1e42ffa9d0 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 25 Feb 2014 17:10:42 -0800 Subject: [PATCH 214/782] add flat_map --- Rx/CPP/src/rxcpp/operators/rx-filter.hpp | 5 +- Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp | 209 +++++++++++++++++++++ Rx/CPP/src/rxcpp/operators/rx-map.hpp | 65 +++++-- Rx/CPP/src/rxcpp/rx-observable.hpp | 10 + Rx/CPP/src/rxcpp/rx-operators.hpp | 4 +- Rx/CPP/src/rxcpp/rx-predef.hpp | 17 ++ Rx/CPP/src/rxcpp/rx-test.hpp | 4 + Rx/CPP/test/v2/operators/flat_map.cpp | 99 ++++++++++ projects/CMake/CMakeLists.txt | 1 + 9 files changed, 391 insertions(+), 23 deletions(-) create mode 100644 Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp create mode 100644 Rx/CPP/test/v2/operators/flat_map.cpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp index d0cf9d2..ee61646 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-filter.hpp @@ -31,7 +31,7 @@ struct filter : public operator_base } template void on_subscribe(observer o) { - o.add(source.subscribe( + source.subscribe( o.get_subscription(), // on_next [this, o](T t) { @@ -40,6 +40,7 @@ struct filter : public operator_base filtered = !this->test(t); } catch(...) { o.on_error(std::current_exception()); + return; } if (!filtered) { o.on_next(std::move(t)); @@ -53,7 +54,7 @@ struct filter : public operator_base [o]() { o.on_completed(); } - )); + ); } }; diff --git a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp new file mode 100644 index 0000000..e1f0b03 --- /dev/null +++ b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp @@ -0,0 +1,209 @@ +// 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_FLATMAP_HPP) +#define RXCPP_OPERATORS_RX_FLATMAP_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct flat_map_traits { + typedef typename Observable::value_type source_value_type; + + struct tag_not_valid {}; + template + static auto collection_check(int) -> decltype((*(CCS*)nullptr)(*(CV*)nullptr)); + template + static tag_not_valid collection_check(...); + + static_assert(!std::is_same(0)), tag_not_valid>::value, "flat_map CollectionSelector must be a function with the signature observable(flat_map::source_value_type)"); + + typedef decltype((*(CollectionSelector*)nullptr)((*(source_value_type*)nullptr))) collection_type; + + static_assert(is_observable::value, "flat_map CollectionSelector must return an observable"); + + typedef typename collection_type::value_type collection_value_type; + + template + static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CV*)nullptr, *(CCV*)nullptr)); + template + static tag_not_valid result_check(...); + + static_assert(!std::is_same(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 decltype((*(ResultSelector*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; +}; + +template +struct flat_map + : public operator_base::value_type> +{ + typedef flat_map this_type; + typedef typename flat_map_traits traits; + + struct values + { + values(Observable o, CollectionSelector s, ResultSelector rs) + : source(std::move(o)) + , selectCollection(std::move(s)) + , selectResult(std::move(rs)) + { + } + Observable source; + CollectionSelector selectCollection; + ResultSelector selectResult; + }; + values initial; + + 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; + + flat_map(Observable o, CollectionSelector s, ResultSelector rs) + : initial(std::move(o), std::move(s), std::move(rs)) + { + } + + template + void on_subscribe(observer o) { + + typedef observer output_type; + struct state_type + : public values + { + state_type(values i, output_type oarg) + : values(std::move(i)) + , out(std::move(oarg)) + { + } + // on_completed on the output must wait until all the + // subscriptions have received on_completed + std::atomic subscriptions; + // because multiple sources are subscribed to by flat_map, + // calls to the output must be serialized by lock. + std::mutex lock; + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::make_shared(initial, std::move(o)); + + composite_subscription cs; + cs.add(make_subscription([state](){ + if (--state->subscriptions == 0) { + std::unique_lock guard(state->lock); + state->out.on_completed(); + } + })); + + ++state->subscriptions; + + // 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 + state->source.subscribe( + cs, + // on_next + [state](source_value_type st) { + util::detail::maybe selectedCollection; + try { + selectedCollection.reset(state->selectCollection(st)); + } catch(...) { + std::unique_lock guard(state->lock); + state->out.on_error(std::current_exception()); + return; + } + + composite_subscription cs; + + ++state->subscriptions; + + cs.add(make_subscription([state](){ + if (--state->subscriptions == 0) { + std::unique_lock guard(state->lock); + state->out.on_completed(); + } + })); + + // this subscribe does not share the source subscription + // so that when it is unsubscribed the source will continue + selectedCollection->subscribe( + cs, + // on_next + [state, st](collection_value_type ct) { + util::detail::maybe selectedResult; + try { + selectedResult.reset(state->selectResult(st, std::move(ct))); + } catch(...) { + std::unique_lock guard(state->lock); + state->out.on_error(std::current_exception()); + return; + } + std::unique_lock guard(state->lock); + state->out.on_next(std::move(*selectedResult)); + }, + // on_error + [state](std::exception_ptr e) { + // no need to track state->subscriptions + // after an error - complete will not be called. + std::unique_lock guard(state->lock); + state->out.on_error(e); + }, + //on_completed + [](){ + } + ); + }, + // on_error + [state](std::exception_ptr e) { + // no need to track state->subscriptions + // after an error - complete will not be called. + std::unique_lock guard(state->lock); + state->out.on_error(e); + }, + // on_completed + []() { + } + ); + } +}; + +template +class flat_map_factory +{ + CollectionSelector selectorCollection; + ResultSelector selectorResult; +public: + flat_map_factory(CollectionSelector s, ResultSelector rs) + : selectorCollection(std::move(rs)) + , selectorResult(std::move(s)) + { + } + + template + auto operator()(Observable source) + -> observable::value_type, flat_map> { + return observable::value_type, flat_map>( + flat_map(source, std::move(selectorCollection), std::move(selectorResult))); + } +}; + +} + +template +auto flat_map(CollectionSelector s, ResultSelector rs) + -> detail::flat_map_factory { + return detail::flat_map_factory(std::move(s), std::move(rs)); +} + +} + +} + +#endif diff --git a/Rx/CPP/src/rxcpp/operators/rx-map.hpp b/Rx/CPP/src/rxcpp/operators/rx-map.hpp index 0ff9d2c..b8f2207 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-map.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-map.hpp @@ -14,11 +14,24 @@ namespace operators { namespace detail { template -struct map : public operator_base +struct map + : public operator_base { typedef map this_type; - Observable source; - Selector select; + + struct values + { + values(Observable o, Selector s) + : source(std::move(o)) + , select(std::move(s)) + { + } + Observable source; + Selector select; + }; + values initial; + + typedef typename Observable::value_type source_value_type; struct tag_not_valid {}; template @@ -26,38 +39,52 @@ struct map : public operator_base static tag_not_valid check(...); - static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); + static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); map(Observable o, Selector s) - : source(std::move(o)) - , select(std::move(s)) + : initial(std::move(o), std::move(s)) { } + template void on_subscribe(observer o) { - o.add(source.subscribe( - o.get_subscription(), + + typedef observer output_type; + struct state_type + : public values + { + state_type(values i, output_type oarg) + : values(std::move(i)) + , out(std::move(oarg)) + { + } + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::make_shared(initial, std::move(o)); + + state->source.subscribe( + state->out.get_subscription(), // on_next - [this, o](typename this_type::source_value_type st) { + [state](typename this_type::source_value_type st) { util::detail::maybe selected; try { - selected.reset(this->select(st)); + selected.reset(state->select(st)); } catch(...) { - o.on_error(std::current_exception()); - } - if (!selected.empty()) { - o.on_next(std::move(*selected)); + state->out.on_error(std::current_exception()); + return; } + state->out.on_next(std::move(*selected)); }, // on_error - [o](std::exception_ptr e) { - o.on_error(e); + [state](std::exception_ptr e) { + state->out.on_error(e); }, // on_completed - [o]() { - o.on_completed(); + [state]() { + state->out.on_completed(); } - )); + ); } }; diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/CPP/src/rxcpp/rx-observable.hpp index f934023..cf1bc87 100644 --- a/Rx/CPP/src/rxcpp/rx-observable.hpp +++ b/Rx/CPP/src/rxcpp/rx-observable.hpp @@ -106,10 +106,13 @@ observable make_dynamic_observable(Source&& s) { template class observable + : public observable_base { typedef observable this_type; mutable SourceOperator source_operator; + static_assert(std::is_same::value, "SourceOperator::value_type must be the same as T in observable"); + private: template friend class observable; @@ -260,6 +263,13 @@ public: rxo::detail::map(*this, std::move(s))); } + template + auto flat_map(CollectionSelector s, ResultSelector rs) const + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::move(s), std::move(rs))); + } + template auto op(OperatorFactory&& of) const -> decltype(of(*(this_type*)nullptr)) { diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/CPP/src/rxcpp/rx-operators.hpp index 535913d..aa48e8c 100644 --- a/Rx/CPP/src/rxcpp/rx-operators.hpp +++ b/Rx/CPP/src/rxcpp/rx-operators.hpp @@ -12,11 +12,10 @@ namespace rxcpp { namespace operators { struct tag_operator {}; -template +template struct operator_base { typedef T value_type; - typedef From source_value_type; typedef tag_operator operator_tag; }; template @@ -38,5 +37,6 @@ namespace rxo=operators; #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" +#include "operators/rx-flat_map.hpp" #endif diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp index 588f2d2..be88f04 100644 --- a/Rx/CPP/src/rxcpp/rx-predef.hpp +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -27,6 +27,23 @@ class observable; template observable make_dynamic_observable(Source&&); +struct tag_observable {}; +template +struct observable_base { + typedef tag_observable observable_tag; + typedef T value_type; +}; +template +class is_observable +{ + template + static typename C::observable_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_observable>::value; +}; + } #endif diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp index d4d6581..a9db66d 100644 --- a/Rx/CPP/src/rxcpp/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -80,6 +80,8 @@ public: } }; +struct tag_test_observable : public tag_observable {}; + template class testable_observable : public observable> @@ -88,6 +90,8 @@ class testable_observable typedef typename detail::test_subject_base::type test_subject; test_subject ts; + typedef tag_test_observable observable_tag; + public: typedef typename detail::test_subject_base::recorded_type recorded_type; diff --git a/Rx/CPP/test/v2/operators/flat_map.cpp b/Rx/CPP/test/v2/operators/flat_map.cpp new file mode 100644 index 0000000..5cda90f --- /dev/null +++ b/Rx/CPP/test/v2/operators/flat_map.cpp @@ -0,0 +1,99 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +SCENARIO("flat_map completes", "[flat_map][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages ms; + + long invoked = 0; + + m::recorded_type int_messages[] = { + m::on_next(100, 4), + m::on_next(200, 2), + m::on_next(300, 3), + m::on_next(400, 1), + m::on_completed(500) + }; + auto xs = sc->make_cold_observable(int_messages); + + ms::recorded_type string_messages[] = { + ms::on_next(50, "foo"), + ms::on_next(100, "bar"), + ms::on_next(150, "baz"), + ms::on_next(200, "qux"), + ms::on_completed(250) + }; + auto ys = sc->make_cold_observable(string_messages); + + WHEN("each int is mapped to the strings"){ + + auto res = sc->start( + [&]() { + return xs + .flat_map([&](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"){ + ms::recorded_type items[] = { + ms::on_next(350, "foo"), + ms::on_next(400, "bar"), + ms::on_next(450, "baz"), + ms::on_next(450, "foo"), + ms::on_next(500, "qux"), + ms::on_next(500, "bar"), + ms::on_next(550, "baz"), + ms::on_next(550, "foo"), + ms::on_next(600, "qux"), + ms::on_next(600, "bar"), + ms::on_next(650, "baz"), + ms::on_next(650, "foo"), + ms::on_next(700, "bar"), + ms::on_next(700, "qux"), + ms::on_next(750, "baz"), + ms::on_next(800, "qux"), + ms::on_completed(850) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rxn::subscription items[] = { + m::subscribe(200, 700) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rxn::subscription items[] = { + ms::subscribe(300, 550), + ms::subscribe(400, 650), + ms::subscribe(500, 750), + ms::subscribe(600, 850) + }; + auto required = rxu::to_vector(items); + auto actual = ys.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 593fa6c..3c43324 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -34,6 +34,7 @@ add_executable(rxcpp_test ${TEST_SOURCES}) # define the sources of the self test set(TEST_SOURCES ${TEST_DIR}/test.cpp + ${TEST_DIR}/v2/operators/flat_map.cpp ${TEST_DIR}/v2/subscriptions/observer.cpp ${TEST_DIR}/v2/subscriptions/subscription.cpp ${TEST_DIR}/v2/operators/filter.cpp -- GitLab From abd81841b216ea0a20b5cffd02cf3a02267f2798 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 25 Feb 2014 20:21:06 -0800 Subject: [PATCH 215/782] add tests and fix bugs --- Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp | 33 ++-- Rx/CPP/src/rxcpp/rx-includes.hpp | 2 +- Rx/CPP/src/rxcpp/rx-subscription.hpp | 2 +- Rx/CPP/test/v2/operators/flat_map.cpp | 174 +++++++++++++++++++++ 4 files changed, 198 insertions(+), 13 deletions(-) diff --git a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp index e1f0b03..b53c5fc 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp @@ -88,22 +88,29 @@ struct flat_map std::atomic subscriptions; // because multiple sources are subscribed to by flat_map, // calls to the output must be serialized by lock. - std::mutex lock; + // the on_error/on_complete and unsubscribe calls can + // cause lock recursion. + std::recursive_mutex lock; output_type out; }; // take a copy of the values for each subscription auto state = std::make_shared(initial, std::move(o)); + ++state->subscriptions; + composite_subscription cs; + + // when the out observer is unsubscribed all the + // inner subscriptions are unsubscribed as well + state->out.get_subscription().add(cs); + cs.add(make_subscription([state](){ if (--state->subscriptions == 0) { - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_completed(); } })); - ++state->subscriptions; - // 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 @@ -115,18 +122,22 @@ struct flat_map try { selectedCollection.reset(state->selectCollection(st)); } catch(...) { - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_error(std::current_exception()); return; } + ++state->subscriptions; + composite_subscription cs; - ++state->subscriptions; + // when the out observer is unsubscribed all the + // inner subscriptions are unsubscribed as well + state->out.get_subscription().add(cs); cs.add(make_subscription([state](){ if (--state->subscriptions == 0) { - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_completed(); } })); @@ -141,18 +152,18 @@ struct flat_map try { selectedResult.reset(state->selectResult(st, std::move(ct))); } catch(...) { - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_error(std::current_exception()); return; } - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_next(std::move(*selectedResult)); }, // on_error [state](std::exception_ptr e) { // no need to track state->subscriptions // after an error - complete will not be called. - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_error(e); }, //on_completed @@ -164,7 +175,7 @@ struct flat_map [state](std::exception_ptr e) { // no need to track state->subscriptions // after an error - complete will not be called. - std::unique_lock guard(state->lock); + std::unique_lock guard(state->lock); state->out.on_error(e); }, // on_completed diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/CPP/src/rxcpp/rx-includes.hpp index 7e13fcc..347e443 100644 --- a/Rx/CPP/src/rxcpp/rx-includes.hpp +++ b/Rx/CPP/src/rxcpp/rx-includes.hpp @@ -38,11 +38,11 @@ #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 -#pragma warning(disable: 4348) // false positives on : redefinition of default parameter : parameter 2 #define RXCPP_USE_VARIADIC_TEMPLATES 1 #endif diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/CPP/src/rxcpp/rx-subscription.hpp index 235d5e5..f1d2329 100644 --- a/Rx/CPP/src/rxcpp/rx-subscription.hpp +++ b/Rx/CPP/src/rxcpp/rx-subscription.hpp @@ -168,7 +168,7 @@ private: auto it = std::find(std::begin(subscriptions), end, s); if (it == end) { - subscriptions.emplace_back(std::move(s)); + subscriptions.emplace_back(s); } } return s; diff --git a/Rx/CPP/test/v2/operators/flat_map.cpp b/Rx/CPP/test/v2/operators/flat_map.cpp index 5cda90f..9e4c108 100644 --- a/Rx/CPP/test/v2/operators/flat_map.cpp +++ b/Rx/CPP/test/v2/operators/flat_map.cpp @@ -97,3 +97,177 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ } } } + + +SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages ms; + + long invoked = 0; + + m::recorded_type int_messages[] = { + m::on_next(100, 4), + m::on_next(200, 2), + m::on_next(300, 3), + m::on_next(400, 1), + m::on_next(500, 5), + m::on_next(700, 0) + }; + auto xs = sc->make_cold_observable(int_messages); + + ms::recorded_type string_messages[] = { + ms::on_next(50, "foo"), + ms::on_next(100, "bar"), + ms::on_next(150, "baz"), + ms::on_next(200, "qux"), + ms::on_completed(250) + }; + auto ys = sc->make_cold_observable(string_messages); + + WHEN("each int is mapped to the strings"){ + + auto res = sc->start( + [&]() { + return xs + .flat_map([&](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"){ + ms::recorded_type items[] = { + ms::on_next(350, "foo"), + ms::on_next(400, "bar"), + ms::on_next(450, "baz"), + ms::on_next(450, "foo"), + ms::on_next(500, "bar"), + ms::on_next(500, "qux"), + ms::on_next(550, "baz"), + ms::on_next(550, "foo"), + ms::on_next(600, "bar"), + ms::on_next(600, "qux"), + ms::on_next(650, "baz"), + ms::on_next(650, "foo"), + ms::on_next(700, "bar"), + ms::on_next(700, "qux"), + ms::on_next(750, "baz"), + ms::on_next(750, "foo"), + ms::on_next(800, "bar"), + ms::on_next(800, "qux"), + ms::on_next(850, "baz"), + ms::on_next(900, "qux"), + ms::on_next(950, "foo") + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rxn::subscription items[] = { + m::subscribe(200, 1000) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rxn::subscription items[] = { + ms::subscribe(300, 550), + ms::subscribe(400, 650), + ms::subscribe(500, 750), + ms::subscribe(600, 850), + ms::subscribe(700, 950), + ms::subscribe(900, 1000) + }; + auto required = rxu::to_vector(items); + auto actual = ys.subscriptions(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto sc = std::make_shared(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages ms; + + long invoked = 0; + + m::recorded_type int_messages[] = { + m::on_next(100, 4), + m::on_next(200, 2), + m::on_next(300, 3), + m::on_next(400, 1), + m::on_completed(500) + }; + auto xs = sc->make_cold_observable(int_messages); + + std::runtime_error ex("filter on_error from inner source"); + + ms::recorded_type string_messages[] = { + ms::on_next(55, "foo"), + ms::on_next(104, "bar"), + ms::on_next(153, "baz"), + ms::on_next(202, "qux"), + ms::on_error(301, ex) + }; + auto ys = sc->make_cold_observable(string_messages); + + WHEN("each int is mapped to the strings"){ + + auto res = sc->start( + [&]() { + return xs + .flat_map([&](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"){ + ms::recorded_type items[] = { + ms::on_next(355, "foo"), + ms::on_next(404, "bar"), + ms::on_next(453, "baz"), + ms::on_next(455, "foo"), + ms::on_next(502, "qux"), + ms::on_next(504, "bar"), + ms::on_next(553, "baz"), + ms::on_next(555, "foo"), + ms::on_error(601, ex) + }; + auto required = rxu::to_vector(items); + auto actual = res.messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + rxn::subscription items[] = { + m::subscribe(200, 601) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were four subscription and unsubscription to the strings"){ + rxn::subscription items[] = { + ms::subscribe(300, 601), + ms::subscribe(400, 601), + ms::subscribe(500, 601), + ms::subscribe(600, 601) + }; + auto required = rxu::to_vector(items); + auto actual = ys.subscriptions(); + REQUIRE(required == actual); + } + } + } +} -- GitLab From 90d3ac9aea3025fc60869289aa261d1c9dfcf307 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 25 Feb 2014 22:48:14 -0800 Subject: [PATCH 216/782] clang fixes flat_map still has 2 failing tests.. ugh --- Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp | 57 ++++++++++------------ Rx/CPP/src/rxcpp/operators/rx-map.hpp | 5 +- Rx/CPP/src/rxcpp/rx-predef.hpp | 2 +- Rx/CPP/src/rxcpp/rx-subscription.hpp | 20 ++++---- Rx/CPP/src/rxcpp/rx-test.hpp | 4 +- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp index b53c5fc..7ff88e1 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp @@ -46,7 +46,7 @@ struct flat_map : public operator_base::value_type> { typedef flat_map this_type; - typedef typename flat_map_traits traits; + typedef flat_map_traits traits; struct values { @@ -76,7 +76,8 @@ struct flat_map typedef observer output_type; struct state_type - : public values + : public std::enable_shared_from_this + , public values { state_type(values i, output_type oarg) : values(std::move(i)) @@ -85,7 +86,7 @@ struct flat_map } // on_completed on the output must wait until all the // subscriptions have received on_completed - std::atomic subscriptions; + std::atomic pendingCompletions; // because multiple sources are subscribed to by flat_map, // calls to the output must be serialized by lock. // the on_error/on_complete and unsubscribe calls can @@ -94,28 +95,20 @@ struct flat_map output_type out; }; // take a copy of the values for each subscription - auto state = std::make_shared(initial, std::move(o)); + auto state = std::shared_ptr(new state_type(initial, std::move(o))); - ++state->subscriptions; - - composite_subscription cs; + composite_subscription outercs; // when the out observer is unsubscribed all the // inner subscriptions are unsubscribed as well - state->out.get_subscription().add(cs); - - cs.add(make_subscription([state](){ - if (--state->subscriptions == 0) { - std::unique_lock guard(state->lock); - state->out.on_completed(); - } - })); + state->out.get_subscription().add(outercs); + ++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 state->source.subscribe( - cs, + outercs, // on_next [state](source_value_type st) { util::detail::maybe selectedCollection; @@ -127,25 +120,21 @@ struct flat_map return; } - ++state->subscriptions; - - composite_subscription cs; + composite_subscription innercs; // when the out observer is unsubscribed all the // inner subscriptions are unsubscribed as well - state->out.get_subscription().add(cs); + auto innercstoken = state->out.get_subscription().add(innercs); - cs.add(make_subscription([state](){ - if (--state->subscriptions == 0) { - std::unique_lock guard(state->lock); - state->out.on_completed(); - } + innercs.add(make_subscription([state, innercstoken](){ + state->out.get_subscription().remove(innercstoken); })); + ++state->pendingCompletions; // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue selectedCollection->subscribe( - cs, + innercs, // on_next [state, st](collection_value_type ct) { util::detail::maybe selectedResult; @@ -161,25 +150,29 @@ struct flat_map }, // on_error [state](std::exception_ptr e) { - // no need to track state->subscriptions - // after an error - complete will not be called. std::unique_lock guard(state->lock); state->out.on_error(e); }, //on_completed - [](){ + [state](){ + if (--state->pendingCompletions == 0) { + std::unique_lock guard(state->lock); + state->out.on_completed(); + } } ); }, // on_error [state](std::exception_ptr e) { - // no need to track state->subscriptions - // after an error - complete will not be called. std::unique_lock guard(state->lock); state->out.on_error(e); }, // on_completed - []() { + [state]() { + if (--state->pendingCompletions == 0) { + std::unique_lock guard(state->lock); + state->out.on_completed(); + } } ); } diff --git a/Rx/CPP/src/rxcpp/operators/rx-map.hpp b/Rx/CPP/src/rxcpp/operators/rx-map.hpp index b8f2207..939d6e3 100644 --- a/Rx/CPP/src/rxcpp/operators/rx-map.hpp +++ b/Rx/CPP/src/rxcpp/operators/rx-map.hpp @@ -51,7 +51,8 @@ struct map typedef observer output_type; struct state_type - : public values + : public std::enable_shared_from_this + , public values { state_type(values i, output_type oarg) : values(std::move(i)) @@ -61,7 +62,7 @@ struct map output_type out; }; // take a copy of the values for each subscription - auto state = std::make_shared(initial, std::move(o)); + auto state = std::shared_ptr(new state_type(initial, std::move(o))); state->source.subscribe( state->out.get_subscription(), diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/CPP/src/rxcpp/rx-predef.hpp index be88f04..81c2292 100644 --- a/Rx/CPP/src/rxcpp/rx-predef.hpp +++ b/Rx/CPP/src/rxcpp/rx-predef.hpp @@ -41,7 +41,7 @@ class is_observable template static void check(...); public: - static const bool value = std::is_convertible(0)), tag_observable>::value; + static const bool value = std::is_convertible::type>(0)), tag_observable>::value; }; } diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/CPP/src/rxcpp/rx-subscription.hpp index f1d2329..ccb8e06 100644 --- a/Rx/CPP/src/rxcpp/rx-subscription.hpp +++ b/Rx/CPP/src/rxcpp/rx-subscription.hpp @@ -20,7 +20,7 @@ class is_subscription template static void check(...); public: - static const bool value = std::is_convertible(0)), tag_subscription>::value; + static const bool value = std::is_convertible::type>(0)), tag_subscription>::value; }; class dynamic_subscription : public subscription_base @@ -177,14 +177,16 @@ private: void remove(weak_subscription w) { std::unique_lock guard(lock); - auto s = w.lock(); - if (s) - { - auto end = std::end(subscriptions); - auto it = std::find(std::begin(subscriptions), end, s); - if (it != end) + if (issubscribed) { + auto s = w.lock(); + if (s) { - subscriptions.erase(it); + auto end = std::end(subscriptions); + auto it = std::find(std::begin(subscriptions), end, s); + if (it != end) + { + subscriptions.erase(it); + } } } } @@ -251,7 +253,7 @@ public: return state->add(std::move(s)); } void remove(weak_subscription w) const { - state->remove(w); + state->remove(std::move(w)); } void clear() const { state->clear(); diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/CPP/src/rxcpp/rx-test.hpp index a9db66d..946ec03 100644 --- a/Rx/CPP/src/rxcpp/rx-test.hpp +++ b/Rx/CPP/src/rxcpp/rx-test.hpp @@ -80,7 +80,7 @@ public: } }; -struct tag_test_observable : public tag_observable {}; +//struct tag_test_observable : public tag_observable {}; template class testable_observable @@ -90,7 +90,7 @@ class testable_observable typedef typename detail::test_subject_base::type test_subject; test_subject ts; - typedef tag_test_observable observable_tag; + //typedef tag_test_observable observable_tag; public: typedef typename detail::test_subject_base::recorded_type recorded_type; -- GitLab From 3c7aa2040c298353cffcd5f41fccfce5407d78c3 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sun, 2 Mar 2014 17:49:04 -0800 Subject: [PATCH 217/782] prep version 2 for release --- Rx/v2/license.txt | 15 ++++++++++ .../src/rxcpp/operators/rx-filter.hpp | 0 .../src/rxcpp/operators/rx-flat_map.hpp | 0 Rx/{CPP => v2}/src/rxcpp/operators/rx-map.hpp | 0 .../src/rxcpp/operators/rx-subscribe.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-includes.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-notification.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-observable.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-observer.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-operators.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-predef.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-scheduler.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-sources.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-subjects.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-subscription.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-test.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx-util.hpp | 0 Rx/{CPP => v2}/src/rxcpp/rx.hpp | 0 .../src/rxcpp/schedulers/rx-currentthread.hpp | 0 .../src/rxcpp/schedulers/rx-test.hpp | 0 .../src/rxcpp/schedulers/rx-virtualtime.hpp | 0 Rx/{CPP => v2}/src/rxcpp/sources/rx-range.hpp | 0 .../src/rxcpp/subjects/rx-subject.hpp | 0 .../test/v2 => v2/test}/operators/filter.cpp | 0 .../v2 => v2/test}/operators/flat_map.cpp | 0 Rx/{CPP/test/v2 => v2/test}/operators/map.cpp | 0 .../test/v2 => v2/test}/subjects/subject.cpp | 0 .../v2 => v2/test}/subscriptions/observer.cpp | 0 .../test}/subscriptions/subscription.cpp | 0 Rx/v2/test/test.cpp | 2 ++ projects/CMake/CMakeLists.txt | 28 ++++++++++--------- 31 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 Rx/v2/license.txt rename Rx/{CPP => v2}/src/rxcpp/operators/rx-filter.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/operators/rx-flat_map.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/operators/rx-map.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/operators/rx-subscribe.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-includes.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-notification.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-observable.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-observer.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-operators.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-predef.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-scheduler.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-sources.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-subjects.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-subscription.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-test.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx-util.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/rx.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/schedulers/rx-currentthread.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/schedulers/rx-test.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/schedulers/rx-virtualtime.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/sources/rx-range.hpp (100%) rename Rx/{CPP => v2}/src/rxcpp/subjects/rx-subject.hpp (100%) rename Rx/{CPP/test/v2 => v2/test}/operators/filter.cpp (100%) rename Rx/{CPP/test/v2 => v2/test}/operators/flat_map.cpp (100%) rename Rx/{CPP/test/v2 => v2/test}/operators/map.cpp (100%) rename Rx/{CPP/test/v2 => v2/test}/subjects/subject.cpp (100%) rename Rx/{CPP/test/v2 => v2/test}/subscriptions/observer.cpp (100%) rename Rx/{CPP/test/v2 => v2/test}/subscriptions/subscription.cpp (100%) create mode 100644 Rx/v2/test/test.cpp diff --git a/Rx/v2/license.txt b/Rx/v2/license.txt new file mode 100644 index 0000000..5b47fbd --- /dev/null +++ b/Rx/v2/license.txt @@ -0,0 +1,15 @@ +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/CPP/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/operators/rx-filter.hpp rename to Rx/v2/src/rxcpp/operators/rx-filter.hpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/operators/rx-flat_map.hpp rename to Rx/v2/src/rxcpp/operators/rx-flat_map.hpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/operators/rx-map.hpp rename to Rx/v2/src/rxcpp/operators/rx-map.hpp diff --git a/Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/operators/rx-subscribe.hpp rename to Rx/v2/src/rxcpp/operators/rx-subscribe.hpp diff --git a/Rx/CPP/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-includes.hpp rename to Rx/v2/src/rxcpp/rx-includes.hpp diff --git a/Rx/CPP/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-notification.hpp rename to Rx/v2/src/rxcpp/rx-notification.hpp diff --git a/Rx/CPP/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-observable.hpp rename to Rx/v2/src/rxcpp/rx-observable.hpp diff --git a/Rx/CPP/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-observer.hpp rename to Rx/v2/src/rxcpp/rx-observer.hpp diff --git a/Rx/CPP/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-operators.hpp rename to Rx/v2/src/rxcpp/rx-operators.hpp diff --git a/Rx/CPP/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-predef.hpp rename to Rx/v2/src/rxcpp/rx-predef.hpp diff --git a/Rx/CPP/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-scheduler.hpp rename to Rx/v2/src/rxcpp/rx-scheduler.hpp diff --git a/Rx/CPP/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-sources.hpp rename to Rx/v2/src/rxcpp/rx-sources.hpp diff --git a/Rx/CPP/src/rxcpp/rx-subjects.hpp b/Rx/v2/src/rxcpp/rx-subjects.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-subjects.hpp rename to Rx/v2/src/rxcpp/rx-subjects.hpp diff --git a/Rx/CPP/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-subscription.hpp rename to Rx/v2/src/rxcpp/rx-subscription.hpp diff --git a/Rx/CPP/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-test.hpp rename to Rx/v2/src/rxcpp/rx-test.hpp diff --git a/Rx/CPP/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx-util.hpp rename to Rx/v2/src/rxcpp/rx-util.hpp diff --git a/Rx/CPP/src/rxcpp/rx.hpp b/Rx/v2/src/rxcpp/rx.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/rx.hpp rename to Rx/v2/src/rxcpp/rx.hpp diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/schedulers/rx-currentthread.hpp rename to Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/schedulers/rx-test.hpp rename to Rx/v2/src/rxcpp/schedulers/rx-test.hpp diff --git a/Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/schedulers/rx-virtualtime.hpp rename to Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp diff --git a/Rx/CPP/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/sources/rx-range.hpp rename to Rx/v2/src/rxcpp/sources/rx-range.hpp diff --git a/Rx/CPP/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp similarity index 100% rename from Rx/CPP/src/rxcpp/subjects/rx-subject.hpp rename to Rx/v2/src/rxcpp/subjects/rx-subject.hpp diff --git a/Rx/CPP/test/v2/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp similarity index 100% rename from Rx/CPP/test/v2/operators/filter.cpp rename to Rx/v2/test/operators/filter.cpp diff --git a/Rx/CPP/test/v2/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp similarity index 100% rename from Rx/CPP/test/v2/operators/flat_map.cpp rename to Rx/v2/test/operators/flat_map.cpp diff --git a/Rx/CPP/test/v2/operators/map.cpp b/Rx/v2/test/operators/map.cpp similarity index 100% rename from Rx/CPP/test/v2/operators/map.cpp rename to Rx/v2/test/operators/map.cpp diff --git a/Rx/CPP/test/v2/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp similarity index 100% rename from Rx/CPP/test/v2/subjects/subject.cpp rename to Rx/v2/test/subjects/subject.cpp diff --git a/Rx/CPP/test/v2/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp similarity index 100% rename from Rx/CPP/test/v2/subscriptions/observer.cpp rename to Rx/v2/test/subscriptions/observer.cpp diff --git a/Rx/CPP/test/v2/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp similarity index 100% rename from Rx/CPP/test/v2/subscriptions/subscription.cpp rename to Rx/v2/test/subscriptions/subscription.cpp diff --git a/Rx/v2/test/test.cpp b/Rx/v2/test/test.cpp new file mode 100644 index 0000000..0c7c351 --- /dev/null +++ b/Rx/v2/test/test.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include "catch.hpp" diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 3c43324..b0f11d0 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -17,7 +17,9 @@ get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) set(TEST_DIR ${RXCPP_DIR}/Rx/CPP/test) -include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src) +set(V2_TEST_DIR ${RXCPP_DIR}/Rx/v2/test) + +include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src ${RXCPP_DIR}/Rx/v2/src) # define the sources of the self test set(TEST_SOURCES @@ -31,24 +33,24 @@ set(TEST_SOURCES ) add_executable(rxcpp_test ${TEST_SOURCES}) -# define the sources of the self test -set(TEST_SOURCES - ${TEST_DIR}/test.cpp - ${TEST_DIR}/v2/operators/flat_map.cpp - ${TEST_DIR}/v2/subscriptions/observer.cpp - ${TEST_DIR}/v2/subscriptions/subscription.cpp - ${TEST_DIR}/v2/operators/filter.cpp - ${TEST_DIR}/v2/operators/map.cpp - ${TEST_DIR}/v2/subjects/subject.cpp -) -add_executable(rxcppv2_test ${TEST_SOURCES}) - # define the sources of testbench set(TESTBENCH_SOURCES ${RXCPP_DIR}/Rx/CPP/testbench/testbench.cpp ) add_executable(testbench ${TESTBENCH_SOURCES}) +# define the sources of the self test +set(V2_TEST_SOURCES + ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/operators/flat_map.cpp + ${V2_TEST_DIR}/subscriptions/observer.cpp + ${V2_TEST_DIR}/subscriptions/subscription.cpp + ${V2_TEST_DIR}/operators/filter.cpp + ${V2_TEST_DIR}/operators/map.cpp + ${V2_TEST_DIR}/subjects/subject.cpp +) +add_executable(rxcppv2_test ${V2_TEST_SOURCES}) + # configure unit tests via CTest enable_testing() -- GitLab From fc01175023fd6e74635d6fe74f2567d4e8539e50 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 11 Mar 2014 07:33:17 -0700 Subject: [PATCH 218/782] subscriber --- Rx/v2/src/rxcpp/rx-regulator.hpp | 100 +++++++++++++++ Rx/v2/src/rxcpp/rx-subscriber.hpp | 205 ++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+) create mode 100644 Rx/v2/src/rxcpp/rx-regulator.hpp create mode 100644 Rx/v2/src/rxcpp/rx-subscriber.hpp diff --git a/Rx/v2/src/rxcpp/rx-regulator.hpp b/Rx/v2/src/rxcpp/rx-regulator.hpp new file mode 100644 index 0000000..d68fa12 --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-regulator.hpp @@ -0,0 +1,100 @@ +// 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_REGULATOR_HPP) +#define RXCPP_RX_REGULATOR_HPP + +#include "rx-includes.hpp" + +namespace rxcpp { + +struct tag_resumption {}; +struct resumption_base +{ + typedef tag_resumption resumption_tag; +}; +template +class is_resumption +{ + template + static typename C::resumption_tag* check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_resumption*>::value; +}; + +namespace detail { + +struct regulator_state_type + : public std::enable_shared_from_this +{ + regulator_state_type() + : isresumed(true) + { + } + rxsc::schedulable resumewith; + bool isresumed; +}; +typedef std::shared_ptr regulator_state; + +} + +// +// passed to subscribe to control the source +// the source must call is_resumed before each onnext +// the source must call resume_with when is_resumed returns false +// the schedulable passed to resume_with must implement a resumption policy; +// forward(undoes drop), unblock(undoes block), subscribe(undoes unsubscribe), +// drain(undoes buffer) +// +class resumption : public resumption_base +{ + detail::regulator_state state; +public: + resumption(){} + explicit resumption(detail::regulator_state st) + : state(st) + { + } + inline bool is_resumed() const { + return state ? state->isresumed : true; + } + inline void resume_with(rxsc::schedulable rw) { + // invalid to call when state is null. + state->resumewith = rw; + } +}; + +// +// owned by observer. the +// observer calls pause to stop the source. The +// observer calls resume when ready for the +// source to send more data. +// +class regulator +{ + detail::regulator_state state; +public: + regulator() + : state(new detail::regulator_state_type()) + { + } + inline void pause() { + state->isresumed = false; + } + inline void resume() { + state->isresumed = true; + auto resumewith = std::move(state->resumewith); + state->resumewith = nullptr; + resumewith.schedule(); + } + inline resumption get_resumption() { + return resumption(state); + } +}; + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp new file mode 100644 index 0000000..c36397a --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -0,0 +1,205 @@ +// 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 subscriber +{ + composite_subscription lifetime; + resumption controller; + Observer destination; + +public: + typedef typename composite_subscription::weak_subscription weak_subscription; + typedef typename composite_subscription::shared_subscription shared_subscription; + + subscriber() + { + } + subscriber(composite_subscription cs, resumption r, Observer o) + : lifetime(std::move(cs)) + , destination(std::move(o)) + , controller(std::move(r)) + { + } + + Observer get_observer() const { + return destination; + } + resumption get_resumption() const { + return controller; + } + composite_subscription get_subscription() const { + return lifetime; + } + + // resumption + // + bool is_resumed() const { + return controller.is_resumed(); + } + void resume_with(rxsc::schedulable rw) { + controller.resume_with(std::move(rw)); + } + + // observer + // + void on_next(T t) const { + destination.on_next(std::move(t)); + } + void on_error(std::exception_ptr e) const { + destination.on_error(e); + } + void on_completed() const { + destination.on_completed(); + } + + // composite_subscription + // + bool is_subscribed() const { + return lifetime.is_subscribed(); + } + weak_subscription add(shared_subscription s) const { + return lifetime.add(std::move(s)); + } + weak_subscription add(dynamic_subscription s) const { + return lifetime.add(std::move(s)); + } + 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 +auto make_observer_resolved(ResolvedArgSet& rs) + -> observer::type::result_type, typename std::tuple_element<3, ResolvedArgSet>::type::result_type, typename std::tuple_element<4, ResolvedArgSet>::type::result_type>> { + return observer::type::result_type, typename std::tuple_element<3, ResolvedArgSet>::type::result_type, typename std::tuple_element<4, ResolvedArgSet>::type::result_type>>( + std::move(std::get<2>(rs).value), std::move(std::get<3>(rs).value), std::move(std::get<4>(rs).value)); + + static_assert(std::tuple_element<2, ResolvedArgSet>::type::is_arg, "onnext is a required parameter"); + static_assert(!(std::tuple_element<2, ResolvedArgSet>::type::is_arg && std::tuple_element<3, ResolvedArgSet>::type::is_arg) || std::tuple_element<2, ResolvedArgSet>::type::n + 1 == std::tuple_element<3, ResolvedArgSet>::type::n, "onnext, onerror parameters must be together and in order"); + static_assert(!(std::tuple_element<3, ResolvedArgSet>::type::is_arg && std::tuple_element<4, ResolvedArgSet>::type::is_arg) || std::tuple_element<3, ResolvedArgSet>::type::n + 1 == std::tuple_element<4, ResolvedArgSet>::type::n, "onerror, oncompleted parameters must be together and in order"); + static_assert(!(std::tuple_element<2, ResolvedArgSet>::type::is_arg && std::tuple_element<4, ResolvedArgSet>::type::is_arg && !std::tuple_element<3, ResolvedArgSet>::type::is_arg) || std::tuple_element<2, ResolvedArgSet>::type::n + 1 == std::tuple_element<4, ResolvedArgSet>::type::n, "onnext, oncompleted parameters must be together and in order"); +} + +template +auto make_subscriber_resolved(ResolvedArgSet& rs) + -> subscriber(rs))> { + return subscriber(rs))>(std::move(std::get<0>(rs).value), std::move(std::get<1>(rs).value), make_observer_resolved(rs)); + + static_assert(std::tuple_element<1, ResolvedArgSet>::type::is_arg, "resumption is a required parameter"); +} + +struct tag_subscription_resolution +{ + template + struct predicate : public is_subscription + { + }; + typedef composite_subscription default_type; +}; + +struct tag_resumption_resolution +{ + template + struct predicate : public is_resumption + { + }; + typedef resumption default_type; +}; + + +template +struct tag_onnext_resolution +{ + template + struct predicate : public is_on_next_of + { + }; + typedef detail::OnNextEmpty default_type; +}; + +struct tag_onerror_resolution +{ + template + struct predicate : public is_on_error + { + }; + typedef detail::OnErrorEmpty default_type; +}; + +struct tag_oncompleted_resolution +{ + template + struct predicate : public is_on_completed + { + }; + typedef detail::OnCompletedEmpty default_type; +}; + +// types to disambiguate +// subscriber with override for subscription, observer, resumption | +// optional subscriber + +// observer | on_next and optional on_error, on_completed + +// resumption + +// subscription | unsubscribe +// + +template +struct tag_subscriber_set + : public rxu::detail::tag_set, + rxu::detail::tag_set>>>>> +{ +}; + +template +auto make_subscriber(Arg0&& a0) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0))); +} +template +auto make_subscriber(Arg0&& a0, Arg1&& a1) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1))); +} +template +auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2))); +} +template +auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); +} +template +auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); +} +template +auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) + -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { + return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); +} + +} + +#endif -- GitLab From 34ccb0334a0b0d75fa703bfb326584f9342f1cf9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 11 Mar 2014 07:34:57 -0700 Subject: [PATCH 219/782] clean up --- Rx/v2/src/rxcpp/rx-observable.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index cf1bc87..26134b8 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -2,8 +2,8 @@ #pragma once -#if !defined(RXCPP_RX_SCHEDULER_OBSERVABLE_HPP) -#define RXCPP_RX_SCHEDULER_OBSERVABLE_HPP +#if !defined(RXCPP_RX_OBSERVABLE_HPP) +#define RXCPP_RX_OBSERVABLE_HPP #include "rx-includes.hpp" @@ -108,11 +108,12 @@ template class observable : public observable_base { + static_assert(std::is_same::value, "SourceOperator::value_type must be the same as T in observable"); + +protected: typedef observable this_type; mutable SourceOperator source_operator; - static_assert(std::is_same::value, "SourceOperator::value_type must be the same as T in observable"); - private: template friend class observable; -- GitLab From 42581391a48ac1f9e703bf13eaae1c4c158946e8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 11 Mar 2014 07:35:16 -0700 Subject: [PATCH 220/782] arg resolver --- Rx/v2/src/rxcpp/rx-util.hpp | 356 ++++++++++++++++++++++++++++++++++++ 1 file changed, 356 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index bb6e680..d797c7d 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -199,6 +199,362 @@ private: Function* function; }; +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 5; + static const bool is_arg = true; + typedef Arg5 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 4; + static const bool is_arg = true; + typedef Arg4 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 3; + static const bool is_arg = true; + typedef Arg3 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 2; + static const bool is_arg = true; + typedef Arg2 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + arg_resolver_n(const Arg0&, const Arg1&, result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 1; + static const bool is_arg = true; + typedef Arg1 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + arg_resolver_n(const Arg0&, result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = 0; + static const bool is_arg = true; + typedef Arg0 result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n prev_type; + typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; + result_type value; + explicit arg_resolver_n(result_type a, ...) + : value(std::move(a)) { + } +}; + +template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ + static const int n = -1; + static const bool is_arg = false; + typedef Default result_type; + typedef arg_resolver_n this_type; + typedef this_type type; + result_type value; + explicit arg_resolver_n(...) + : value() { + } +}; + + +struct tag_unresolvable {}; +template class Predicate, class Default, class Arg0 = tag_unresolvable, class Arg1 = tag_unresolvable, class Arg2 = tag_unresolvable, class Arg3 = tag_unresolvable, class Arg4 = tag_unresolvable, class Arg5 = tag_unresolvable> +struct arg_resolver + : public arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> +{ +}; + + +template class Predicate, class Default> +auto resolve_arg() +-> decltype(typename arg_resolver::type()) { + return typename arg_resolver::type(); +} + +template class Predicate, class Default, + class Arg0> +auto resolve_arg(Arg0 a0) +-> decltype(typename arg_resolver::type(std::move(a0))) { + return typename arg_resolver::type(std::move(a0)); +} + +template class Predicate, class Default, + class Arg0, class Arg1> +auto resolve_arg(Arg0 a0, Arg1 a1) +-> decltype(typename arg_resolver::type( + std::move(a0), std::move(a1))) { + return typename arg_resolver::type( + std::move(a0), std::move(a1)); +} + +template class Predicate, class Default, + class Arg0, class Arg1, class Arg2> +auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2) +-> decltype(typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2))) { + return typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2)); +} + +template class Predicate, class Default, + class Arg0, class Arg1, class Arg2, class Arg3> +auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3) +-> decltype(typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3))) { + return typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3)); +} + +template class Predicate, class Default, + class Arg0, class Arg1, class Arg2, class Arg3, class Arg4> +auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) +-> decltype(typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4))) { + return typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4)); +} + +template class Predicate, class Default, + class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) +-> decltype(typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), std::move(a5))) { + return typename arg_resolver::type( + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), std::move(a5)); +} + +struct arg_resolver_term {}; + +// +// use to build a set of tags +// +template +struct tag_set : Base +{ + typedef Next next_tag; +}; + +template +struct arg_resolver_set; + +template<> +struct arg_resolver_set +{ + std::tuple<> operator()(...){ + return std::tuple<>(); + } +}; + +template +struct arg_resolver_set +{ + typedef arg_resolver_set next_set; + auto operator()() + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg()), + next_set()())) { + return std::tuple_cat( + std::make_tuple(resolve_arg()), + next_set()()); + } + template + auto operator()(Arg0&& a0) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0))), + next_set()(std::forward(a0)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0))), + next_set()(std::forward(a0))); + } + template + auto operator()(Arg0&& a0, Arg1&& a1) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), + next_set()(std::forward(a0), std::forward(a1)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), + next_set()(std::forward(a0), std::forward(a1))); + } + template + auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2))); + } + template + auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); + } + template + auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); + } + template + auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); + } +}; + +std::tuple<> resolve_arg_set(arg_resolver_term&&, ...){ + return std::tuple<>(); +} + +template +auto resolve_arg_set(Tag&&) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg()), + resolve_arg_set(typename Tag::next_tag()))) { + return std::tuple_cat( + std::make_tuple(resolve_arg()), + resolve_arg_set(typename Tag::next_tag())); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0))); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1))); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2))); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); +} +template +auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + resolve_arg_set(typename Tag::next_tag(), + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); +} + } } -- GitLab From 52d6a9cd64ec5256d7320f0dab106e1c944a8df7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 12 Mar 2014 17:00:44 -0700 Subject: [PATCH 221/782] start move to subscriber --- Rx/v2/src/rxcpp/rx-includes.hpp | 2 + Rx/v2/src/rxcpp/rx-observable.hpp | 6 +-- Rx/v2/src/rxcpp/rx-observer.hpp | 5 ++ Rx/v2/src/rxcpp/rx-regulator.hpp | 11 +++- Rx/v2/src/rxcpp/rx-subscriber.hpp | 43 +++++++++------- Rx/v2/src/rxcpp/rx-util.hpp | 74 +++++++++++++++++++-------- Rx/v2/test/subscriptions/observer.cpp | 55 ++++++++++++++++++++ 7 files changed, 152 insertions(+), 44 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 347e443..e210800 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -96,6 +96,8 @@ #include "rx-observer.hpp" #include "rx-notification.hpp" #include "rx-scheduler.hpp" +#include "rx-regulator.hpp" +#include "rx-subscriber.hpp" #include "rx-sources.hpp" #include "rx-subjects.hpp" #include "rx-operators.hpp" diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 26134b8..2dff6a0 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -126,7 +126,7 @@ private: return make_subscription(o); } - auto subscriber = [=]() { + auto safe_subscribe = [=]() { try { source_operator.on_subscribe(o); } @@ -142,11 +142,11 @@ private: if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); sc->schedule([=](rxsc::action, rxsc::scheduler) { - subscriber(); + safe_subscribe(); return rxsc::make_action_empty(); }); } else { - subscriber(); + safe_subscribe(); } return make_subscription(o); diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index bdeccae..369339d 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -79,6 +79,11 @@ public: }; namespace detail { +template +struct OnNextEmpty +{ + void operator()(const T&) const {} +}; struct OnErrorEmpty { void operator()(std::exception_ptr) const {} diff --git a/Rx/v2/src/rxcpp/rx-regulator.hpp b/Rx/v2/src/rxcpp/rx-regulator.hpp index d68fa12..5cb4aff 100644 --- a/Rx/v2/src/rxcpp/rx-regulator.hpp +++ b/Rx/v2/src/rxcpp/rx-regulator.hpp @@ -9,6 +9,15 @@ namespace rxcpp { +// temp to get compiling +namespace schedulers { + struct schedulable + { + schedulable& operator=(std::nullptr_t) {return *this;}; + void schedule() {} + }; +} + struct tag_resumption {}; struct resumption_base { @@ -28,7 +37,7 @@ public: namespace detail { struct regulator_state_type - : public std::enable_shared_from_this + : public std::enable_shared_from_this { regulator_state_type() : isresumed(true) diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index c36397a..5234c5d 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -10,7 +10,7 @@ namespace rxcpp { template> -class subscriber +class subscriber : public observer_root, public subscription_base { composite_subscription lifetime; resumption controller; @@ -85,23 +85,30 @@ public: }; template -auto make_observer_resolved(ResolvedArgSet& rs) - -> observer::type::result_type, typename std::tuple_element<3, ResolvedArgSet>::type::result_type, typename std::tuple_element<4, ResolvedArgSet>::type::result_type>> { - return observer::type::result_type, typename std::tuple_element<3, ResolvedArgSet>::type::result_type, typename std::tuple_element<4, ResolvedArgSet>::type::result_type>>( - std::move(std::get<2>(rs).value), std::move(std::get<3>(rs).value), std::move(std::get<4>(rs).value)); - - static_assert(std::tuple_element<2, ResolvedArgSet>::type::is_arg, "onnext is a required parameter"); - static_assert(!(std::tuple_element<2, ResolvedArgSet>::type::is_arg && std::tuple_element<3, ResolvedArgSet>::type::is_arg) || std::tuple_element<2, ResolvedArgSet>::type::n + 1 == std::tuple_element<3, ResolvedArgSet>::type::n, "onnext, onerror parameters must be together and in order"); - static_assert(!(std::tuple_element<3, ResolvedArgSet>::type::is_arg && std::tuple_element<4, ResolvedArgSet>::type::is_arg) || std::tuple_element<3, ResolvedArgSet>::type::n + 1 == std::tuple_element<4, ResolvedArgSet>::type::n, "onerror, oncompleted parameters must be together and in order"); - static_assert(!(std::tuple_element<2, ResolvedArgSet>::type::is_arg && std::tuple_element<4, ResolvedArgSet>::type::is_arg && !std::tuple_element<3, ResolvedArgSet>::type::is_arg) || std::tuple_element<2, ResolvedArgSet>::type::n + 1 == std::tuple_element<4, ResolvedArgSet>::type::n, "onnext, oncompleted parameters must be together and in order"); +auto make_observer_resolved(ResolvedArgSet&& rs) + -> observer(std::forward(rs)).value), decltype (std::get<3>(std::forward(rs)).value), decltype (std::get<4>(std::forward(rs)).value)>> { + typedef static_observer(std::forward(rs)).value), decltype (std::get<3>(std::forward(rs)).value), decltype (std::get<4>(std::forward(rs)).value)> inner_type; + return observer(inner_type( + std::move(std::get<2>(std::forward(rs)).value), std::move(std::get<3>(std::forward(rs)).value), std::move(std::get<4>(std::forward(rs)).value))); + + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; + + static_assert(rn_t::is_arg, "onnext is a required parameter"); + static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); + static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); + static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } template -auto make_subscriber_resolved(ResolvedArgSet& rs) - -> subscriber(rs))> { - return subscriber(rs))>(std::move(std::get<0>(rs).value), std::move(std::get<1>(rs).value), make_observer_resolved(rs)); +auto make_subscriber_resolved(ResolvedArgSet&& rs) + -> subscriber(std::forward(rs)))> { + return subscriber(std::forward(rs)))>(std::move(std::get<0>(std::forward(rs)).value), std::move(std::get<1>(std::forward(rs)).value), make_observer_resolved(std::forward(rs))); - static_assert(std::tuple_element<1, ResolvedArgSet>::type::is_arg, "resumption is a required parameter"); + typedef typename std::decay(std::forward(rs)))>::type rr_t; + + static_assert(rr_t::is_arg, "resumption is a required parameter"); } struct tag_subscription_resolution @@ -127,7 +134,7 @@ template struct tag_onnext_resolution { template - struct predicate : public is_on_next_of + struct predicate : public detail::is_on_next_of { }; typedef detail::OnNextEmpty default_type; @@ -136,7 +143,7 @@ struct tag_onnext_resolution struct tag_onerror_resolution { template - struct predicate : public is_on_error + struct predicate : public detail::is_on_error { }; typedef detail::OnErrorEmpty default_type; @@ -145,7 +152,7 @@ struct tag_onerror_resolution struct tag_oncompleted_resolution { template - struct predicate : public is_on_completed + struct predicate : public detail::is_on_completed { }; typedef detail::OnCompletedEmpty default_type; @@ -165,7 +172,7 @@ struct tag_subscriber_set rxu::detail::tag_set, rxu::detail::tag_set>>>>> + rxu::detail::tag_set>>>> { }; diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index d797c7d..91074d8 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -212,7 +212,7 @@ struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, result_type a, ...) + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, result_type a) : value(std::move(a)) { } }; @@ -227,7 +227,7 @@ struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, result_type a, ...) + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, result_type a, const Arg5&) : value(std::move(a)) { } }; @@ -242,7 +242,7 @@ struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, result_type a, ...) + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, result_type a, const Arg4&, const Arg5&) : value(std::move(a)) { } }; @@ -257,7 +257,7 @@ struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, result_type a, ...) + arg_resolver_n(const Arg0&, const Arg1&, result_type a, const Arg3&, const Arg4&, const Arg5&) : value(std::move(a)) { } }; @@ -272,7 +272,7 @@ struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, result_type a, ...) + arg_resolver_n(const Arg0&, result_type a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) : value(std::move(a)) { } }; @@ -287,7 +287,7 @@ struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - explicit arg_resolver_n(result_type a, ...) + arg_resolver_n(result_type a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) : value(std::move(a)) { } }; @@ -301,7 +301,7 @@ struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 typedef arg_resolver_n this_type; typedef this_type type; result_type value; - explicit arg_resolver_n(...) + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) : value() { } }; @@ -317,51 +317,51 @@ struct arg_resolver template class Predicate, class Default> auto resolve_arg() --> decltype(typename arg_resolver::type()) { - return typename arg_resolver::type(); +-> decltype(typename arg_resolver::type(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + return typename arg_resolver::type(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0> auto resolve_arg(Arg0 a0) --> decltype(typename arg_resolver::type(std::move(a0))) { - return typename arg_resolver::type(std::move(a0)); +-> decltype(typename arg_resolver::type(std::move(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + return typename arg_resolver::type(std::move(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1> auto resolve_arg(Arg0 a0, Arg1 a1) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1))) { + std::move(a0), std::move(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1)); + std::move(a0), std::move(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2> auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2))) { + std::move(a0), std::move(a1), std::move(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2)); + std::move(a0), std::move(a1), std::move(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3> auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3))) { + std::move(a0), std::move(a1), std::move(a2), std::move(a3), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3)); + std::move(a0), std::move(a1), std::move(a2), std::move(a3), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4> auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4))) { + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4)); + std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), tag_unresolvable()); } template class Predicate, class Default, @@ -390,7 +390,7 @@ struct arg_resolver_set; template<> struct arg_resolver_set { - std::tuple<> operator()(...){ + inline std::tuple<> operator()(...){ return std::tuple<>(); } }; @@ -399,7 +399,7 @@ template struct arg_resolver_set { typedef arg_resolver_set next_set; - auto operator()() + inline auto operator()() -> decltype(std::tuple_cat( std::make_tuple(resolve_arg()), next_set()())) { @@ -463,7 +463,37 @@ struct arg_resolver_set } }; -std::tuple<> resolve_arg_set(arg_resolver_term&&, ...){ +inline std::tuple<> resolve_arg_set(arg_resolver_term&&) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& ) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& ) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& ) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& ) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& , Arg4&& ) { + return std::tuple<>(); +} + +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& , Arg4&& , Arg5&& ) { return std::tuple<>(); } diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 25150c4..5536dc0 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -3,6 +3,61 @@ namespace rx=rxcpp; #include "catch.hpp" +SCENARIO("subscriber traits", "[observer][traits]"){ + GIVEN("given some subscriber types"){ + int result = 0; + auto next = [&result](int i){result += i;}; + auto error = [&result](std::exception_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::type(rx::resumption(), next, error, completed, rx::rxu::detail::tag_unresolvable(), rx::rxu::detail::tag_unresolvable()); +// auto arg = rx::rxu::detail::resolve_arg(rx::resumption(), next, error, completed); +// auto argset = rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed); +// auto o = rx::make_observer_resolved(argset); +// auto scrbResult = rx::subscriber(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::make_subscriber_resolved(rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed)); +// auto scrbResult = rx::make_subscriber_resolved(argset); + auto scrbResult = rx::make_subscriber(rx::resumption(), next, error, completed); + + auto emptyNext = [](int){}; + auto scrb = rx::make_subscriber(rx::resumption(), emptyNext); + WHEN("tested"){ + THEN("is_observer value is true for subscriber"){ + REQUIRE(rx::is_observer::value); + } + THEN("is_subscription value is true for subscriber"){ + REQUIRE(rx::is_subscription::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("onnext is called with 1 after error"){ + THEN("subscriber result is 10"){ + scrbResult.on_error(std::current_exception()); + scrbResult.on_next(1); + REQUIRE(result == 10); + } + } + WHEN("onnext is called with 1 after completed"){ + THEN("subscriber result is 100"){ + scrbResult.on_completed(); + scrbResult.on_next(1); + REQUIRE(result == 100); + } + } + } +} + SCENARIO("observer traits", "[observer][traits]"){ GIVEN("given some observer types"){ auto emptyNext = [](int){}; -- GitLab From 64de52450d8a449257d06d2d33540acefa5a8728 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 13 Mar 2014 19:41:28 -0700 Subject: [PATCH 222/782] add override support to make_subscriber make_subscriber can take an existing subscriber and the some overrides and produce a new subscriber that reuses what has not been overridden. --- Rx/v2/src/rxcpp/rx-observable.hpp | 6 +- Rx/v2/src/rxcpp/rx-observer.hpp | 3 + Rx/v2/src/rxcpp/rx-subscriber.hpp | 112 ++++++++++++++++++++++++-- Rx/v2/src/rxcpp/rx-util.hpp | 2 +- Rx/v2/test/subscriptions/observer.cpp | 5 ++ 5 files changed, 117 insertions(+), 11 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2dff6a0..6a9c02f 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -118,10 +118,12 @@ private: template friend class observable; - template - auto detail_subscribe(observer o, tag_observer&&) const + template + auto detail_subscribe(Observer o, tag_observer&&) const -> decltype(make_subscription(o)) { + static_assert(is_observer::value, "subscribe must be passed an observer"); + if (!o.is_subscribed()) { return make_subscription(o); } diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 369339d..c5cb7a2 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -489,6 +489,9 @@ public: ~observer() { } + observer() + { + } observer(inner_t inner) : inner(std::move(inner)) { diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 5234c5d..1d53ab5 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -9,8 +9,25 @@ namespace rxcpp { +struct tag_subscriber {}; +template +struct subscriber_base : public observer_root, public subscription_base, public resumption_base +{ + typedef tag_subscriber subscriber_tag; +}; +template +class is_subscriber +{ + template + static typename C::subscriber_tag* check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible(0)), tag_subscriber*>::value; +}; + template> -class subscriber : public observer_root, public subscription_base +class subscriber : public subscriber_base { composite_subscription lifetime; resumption controller; @@ -101,21 +118,97 @@ auto make_observer_resolved(ResolvedArgSet&& rs) static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } +template +struct observer_selector; + +template +struct observer_selector +{ + template + static auto get_observer(Set&& rs) + -> decltype(std::get<5>(std::forward(rs))) { + return std::get<5>(std::forward(rs)); + } +}; +template +struct observer_selector +{ + template + static auto get_observer(Set&& rs) + -> decltype(make_observer_resolved(std::forward(rs))) { + return make_observer_resolved(std::forward(rs)); + } +}; +template +struct observer_selector +{ + template + static auto get_observer(Set&& rs) + -> decltype(std::get<6>(std::forward(rs)).value.get_observer()) { + return std::get<6>(std::forward(rs)).value.get_observer(); + } +}; + template -auto make_subscriber_resolved(ResolvedArgSet&& rs) - -> subscriber(std::forward(rs)))> { - return subscriber(std::forward(rs)))>(std::move(std::get<0>(std::forward(rs)).value), std::move(std::get<1>(std::forward(rs)).value), make_observer_resolved(std::forward(rs))); +auto select_observer(ResolvedArgSet&& rs) + -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { + return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); typedef typename std::decay(std::forward(rs)))>::type rr_t; + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; + typedef typename std::decay(std::forward(rs)))>::type ro_t; + typedef typename std::decay(std::forward(rs)))>::type rs_t; - static_assert(rr_t::is_arg, "resumption is a required parameter"); + static_assert(rs_t::is_arg || ro_t::is_arg || rn_t::is_arg, "at least one of; onnext, observer or subscriber is required"); + static_assert(int(ro_t::is_arg) + int(rn_t::is_arg) < 2, "onnext, onerror and oncompleted not allowed with an observer"); } +template +auto make_subscriber_resolved(ResolvedArgSet&& rs) + -> subscriber(std::forward(rs)))> { + auto rsub = std::get<0>(std::forward(rs)); + auto rr = std::get<1>(std::forward(rs)); + const auto& rscrbr = std::get<6>(std::forward(rs)); + auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : std::move(rr.value); + auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : std::move(rsub.value); + return subscriber(std::forward(rs)))>( + std::move(s), std::move(r), select_observer(std::forward(rs))); + + typedef typename std::decay::type rr_t; + typedef typename std::decay::type rs_t; + + static_assert(rs_t::is_arg || rr_t::is_arg, "at least one of; resumption or subscriber is a required parameter"); +} + +template +struct tag_subscriber_resolution +{ + template + struct predicate : public is_subscriber + { + }; + typedef subscriber> default_type; +}; + +template +struct tag_observer_resolution +{ + template + struct predicate + { + static const bool value = !is_subscriber::value && is_observer::value; + }; + typedef observer default_type; +}; + struct tag_subscription_resolution { template - struct predicate : public is_subscription + struct predicate { + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; }; typedef composite_subscription default_type; }; @@ -123,8 +216,9 @@ struct tag_subscription_resolution struct tag_resumption_resolution { template - struct predicate : public is_resumption + struct predicate { + static const bool value = !is_subscriber::value && is_resumption::value; }; typedef resumption default_type; }; @@ -172,7 +266,9 @@ struct tag_subscriber_set rxu::detail::tag_set, rxu::detail::tag_set>>>> + rxu::detail::tag_set, + rxu::detail::tag_set>>>>>>> { }; diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 91074d8..53f1b3c 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -310,8 +310,8 @@ struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 struct tag_unresolvable {}; template class Predicate, class Default, class Arg0 = tag_unresolvable, class Arg1 = tag_unresolvable, class Arg2 = tag_unresolvable, class Arg3 = tag_unresolvable, class Arg4 = tag_unresolvable, class Arg5 = tag_unresolvable> struct arg_resolver - : public arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> { + typedef typename arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5>::type type; }; diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 5536dc0..588ffab 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -14,11 +14,16 @@ SCENARIO("subscriber traits", "[observer][traits]"){ // auto arg = rx::rxu::detail::resolve_arg(rx::resumption(), next, error, completed); // auto argset = rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed); // auto o = rx::make_observer_resolved(argset); +// auto o = rx::select_observer(argset); // auto scrbResult = rx::subscriber(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::make_subscriber_resolved(rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed)); // auto scrbResult = rx::make_subscriber_resolved(argset); auto scrbResult = rx::make_subscriber(rx::resumption(), next, error, completed); + auto scrbdup = rx::make_subscriber(scrbResult); + auto scrbop = rx::make_subscriber(scrbResult, next, error, completed); + auto scrbsharelifetime = rx::make_subscriber(scrbResult, scrbop.get_resumption(), scrbop.get_observer()); + auto scrbuniquelifetime = rx::make_subscriber(scrbResult, rx::composite_subscription()); auto emptyNext = [](int){}; auto scrb = rx::make_subscriber(rx::resumption(), emptyNext); -- GitLab From cb42db9eaa8dc288e42584d1ae892b8b811a28f9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 19 Mar 2014 18:11:40 -0700 Subject: [PATCH 223/782] switch subscribe from observer to subscriber --- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 33 +- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 72 ++-- Rx/v2/src/rxcpp/operators/rx-map.hpp | 34 +- Rx/v2/src/rxcpp/operators/rx-subscribe.hpp | 145 ++----- Rx/v2/src/rxcpp/rx-includes.hpp | 2 +- Rx/v2/src/rxcpp/rx-notification.hpp | 69 ++-- Rx/v2/src/rxcpp/rx-observable.hpp | 172 ++++---- Rx/v2/src/rxcpp/rx-observer.hpp | 446 ++++++--------------- Rx/v2/src/rxcpp/rx-predef.hpp | 13 + Rx/v2/src/rxcpp/rx-subscriber.hpp | 204 +++++----- Rx/v2/src/rxcpp/rx-subscription.hpp | 27 +- Rx/v2/src/rxcpp/rx-test.hpp | 46 ++- Rx/v2/src/rxcpp/rx-util.hpp | 81 ++-- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 121 ++++-- Rx/v2/src/rxcpp/sources/rx-range.hpp | 4 +- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 10 +- Rx/v2/test/operators/filter.cpp | 20 +- Rx/v2/test/operators/flat_map.cpp | 18 +- Rx/v2/test/operators/map.cpp | 23 +- Rx/v2/test/subjects/subject.cpp | 12 +- Rx/v2/test/subscriptions/observer.cpp | 6 +- projects/CMake/CMakeLists.txt | 4 +- 22 files changed, 717 insertions(+), 845 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index ee61646..28f2caa 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -16,23 +16,25 @@ namespace detail { template struct filter : public operator_base { - Observable source; - Predicate test; + typedef typename std::decay::type source_type; + typedef typename std::decay::type test_type; + source_type source; + test_type test; template static auto check(int) -> decltype((*(CP*)nullptr)(*(CT*)nullptr)); template static void check(...); - filter(Observable o, Predicate p) + filter(source_type o, test_type p) : source(std::move(o)) , test(std::move(p)) { - static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); + static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); } - template - void on_subscribe(observer o) { + template + void on_subscribe(Subscriber o) { source.subscribe( - o.get_subscription(), + o, // on_next [this, o](T t) { bool filtered = false; @@ -61,23 +63,24 @@ struct filter : public operator_base template class filter_factory { - Predicate predicate; + typedef typename std::decay::type test_type; + test_type predicate; public: - filter_factory(Predicate p) : predicate(std::move(p)) {} + filter_factory(test_type p) : predicate(std::move(p)) {} template - auto operator()(Observable source) - -> observable> { - return observable>( - filter(source, std::move(predicate))); + auto operator()(Observable&& source) + -> observable::type::value_type, filter::type::value_type, Observable, Predicate>> { + return observable::type::value_type, filter::type::value_type, Observable, Predicate>>( + filter::type::value_type, Observable, Predicate>(std::forward(source), std::move(predicate))); } }; } template -auto filter(Predicate p) +auto filter(Predicate&& p) -> detail::filter_factory { - return detail::filter_factory(std::move(p)); + return detail::filter_factory(std::forward(p)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 7ff88e1..a52d3c8 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -15,7 +15,11 @@ namespace detail { template struct flat_map_traits { - typedef typename Observable::value_type source_value_type; + typedef typename std::decay::type source_type; + typedef typename std::decay::type collection_selector_type; + typedef typename std::decay::type result_selector_type; + + typedef typename source_type::value_type source_value_type; struct tag_not_valid {}; template @@ -23,9 +27,9 @@ struct flat_map_traits { template static tag_not_valid collection_check(...); - static_assert(!std::is_same(0)), tag_not_valid>::value, "flat_map CollectionSelector must be a function with the signature observable(flat_map::source_value_type)"); + static_assert(!std::is_same(0)), tag_not_valid>::value, "flat_map CollectionSelector must be a function with the signature observable(flat_map::source_value_type)"); - typedef decltype((*(CollectionSelector*)nullptr)((*(source_value_type*)nullptr))) collection_type; + typedef decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr))) collection_type; static_assert(is_observable::value, "flat_map CollectionSelector must return an observable"); @@ -36,9 +40,9 @@ struct flat_map_traits { template static tag_not_valid result_check(...); - static_assert(!std::is_same(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)"); + static_assert(!std::is_same(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 decltype((*(ResultSelector*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; + typedef decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; }; template @@ -48,39 +52,46 @@ struct flat_map typedef flat_map this_type; typedef flat_map_traits 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; + struct values { - values(Observable o, CollectionSelector s, ResultSelector rs) + values(source_type o, collection_selector_type s, result_selector_type rs) : source(std::move(o)) , selectCollection(std::move(s)) , selectResult(std::move(rs)) { } - Observable source; - CollectionSelector selectCollection; - ResultSelector selectResult; + source_type source; + collection_selector_type selectCollection; + result_selector_type selectResult; }; values initial; - 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; - - flat_map(Observable o, CollectionSelector s, ResultSelector rs) + flat_map(source_type o, collection_selector_type s, result_selector_type rs) : initial(std::move(o), std::move(s), std::move(rs)) { } - template - void on_subscribe(observer o) { + template + void on_subscribe(Observer&& o) { + static_assert(is_observer::value, "subscribe must be passed an observer"); + + typedef typename std::decay::type output_type; - typedef observer output_type; struct state_type : public std::enable_shared_from_this , public values { state_type(values i, output_type oarg) : values(std::move(i)) + , pendingCompletions(0) , out(std::move(oarg)) { } @@ -95,19 +106,20 @@ struct flat_map output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::move(o))); + auto state = std::shared_ptr(new state_type(initial, std::forward(o))); composite_subscription outercs; // when the out observer is unsubscribed all the // inner subscriptions are unsubscribed as well - state->out.get_subscription().add(outercs); + state->out.add(outercs); ++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 state->source.subscribe( + state->out, outercs, // on_next [state](source_value_type st) { @@ -124,16 +136,17 @@ struct flat_map // when the out observer is unsubscribed all the // inner subscriptions are unsubscribed as well - auto innercstoken = state->out.get_subscription().add(innercs); + auto innercstoken = state->out.add(innercs); innercs.add(make_subscription([state, innercstoken](){ - state->out.get_subscription().remove(innercstoken); + state->out.remove(innercstoken); })); ++state->pendingCompletions; // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue selectedCollection->subscribe( + state->out, innercs, // on_next [state, st](collection_value_type ct) { @@ -181,29 +194,32 @@ struct flat_map template class flat_map_factory { - CollectionSelector selectorCollection; - ResultSelector selectorResult; + typedef typename std::decay::type collection_selector_type; + typedef typename std::decay::type result_selector_type; + + collection_selector_type selectorCollection; + result_selector_type selectorResult; public: - flat_map_factory(CollectionSelector s, ResultSelector rs) + flat_map_factory(collection_selector_type s, result_selector_type rs) : selectorCollection(std::move(rs)) , selectorResult(std::move(s)) { } template - auto operator()(Observable source) + auto operator()(Observable&& source) -> observable::value_type, flat_map> { return observable::value_type, flat_map>( - flat_map(source, std::move(selectorCollection), std::move(selectorResult))); + flat_map(std::forward(source), std::move(selectorCollection), std::move(selectorResult))); } }; } template -auto flat_map(CollectionSelector s, ResultSelector rs) +auto flat_map(CollectionSelector&& s, ResultSelector&& rs) -> detail::flat_map_factory { - return detail::flat_map_factory(std::move(s), std::move(rs)); + return detail::flat_map_factory(std::forward(s), std::forward(rs)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 939d6e3..91d6673 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -19,15 +19,18 @@ struct map { typedef map this_type; + typedef typename std::decay::type source_type; + typedef typename std::decay::type select_type; + struct values { - values(Observable o, Selector s) + values(source_type o, select_type s) : source(std::move(o)) , select(std::move(s)) { } - Observable source; - Selector select; + source_type source; + select_type select; }; values initial; @@ -39,17 +42,17 @@ struct map template static tag_not_valid check(...); - static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); + static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); - map(Observable o, Selector s) + map(source_type o, select_type s) : initial(std::move(o), std::move(s)) { } - template - void on_subscribe(observer o) { + template + void on_subscribe(Subscriber o) { - typedef observer output_type; + typedef Subscriber output_type; struct state_type : public std::enable_shared_from_this , public values @@ -65,7 +68,7 @@ struct map auto state = std::shared_ptr(new state_type(initial, std::move(o))); state->source.subscribe( - state->out.get_subscription(), + state->out, // on_next [state](typename this_type::source_value_type st) { util::detail::maybe selected; @@ -92,23 +95,24 @@ struct map template class map_factory { - Selector selector; + typedef typename std::decay::type select_type; + select_type selector; public: - map_factory(Selector p) : selector(std::move(p)) {} + map_factory(select_type p) : selector(std::move(p)) {} template - auto operator()(Observable source) + auto operator()(Observable&& source) -> observable::value_type, map> { return observable::value_type, map>( - map(source, std::move(selector))); + map(std::forward(source), std::move(selector))); } }; } template -auto map(Selector p) +auto map(Selector&& p) -> detail::map_factory { - return detail::map_factory(std::move(p)); + return detail::map_factory(std::forward(p)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp index 0a53734..cc25c1d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp @@ -13,118 +13,61 @@ namespace operators { namespace detail { -template -class subscribe_to_observer_factory -{ - Observer observer; -public: - subscribe_to_observer_factory(Observer o) : observer(std::move(o)) {} - template - auto operator()(Observable source) - -> decltype(source.subscribe(std::move(observer))) { - return source.subscribe(std::move(observer)); - } -}; -template -class subscribe_factory -{ - OnNext onnext; - OnError onerror; - OnCompleted oncompleted; -public: - subscribe_factory(OnNext n, OnError e, OnCompleted c) - : onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - {} - template - auto operator()(Observable source) - -> decltype(source.subscribe(make_observer(std::move(onnext), std::move(onerror), std::move(oncompleted)))) { - return source.subscribe(make_observer(std::move(onnext), std::move(onerror), std::move(oncompleted))); - } -}; -template -class subscribe_factory_chained +template +class subscribe_factory; + +template +class subscribe_factory> { - composite_subscription cs; - OnNext onnext; - OnError onerror; - OnCompleted oncompleted; + subscriber scrbr; public: - subscribe_factory_chained(OnNext n, OnError e, OnCompleted c) - : cs(std::move(cs)) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) + subscribe_factory(subscriber s) + : scrbr(std::move(s)) {} template - auto operator()(Observable source) - -> decltype(source.subscribe(make_observer(std::move(cs), std::move(onnext), std::move(onerror), std::move(oncompleted)))) { - return source.subscribe(make_observer(std::move(cs), std::move(onnext), std::move(onerror), std::move(oncompleted))); + auto operator()(Observable&& source) + -> decltype(std::forward(source).subscribe(std::move(scrbr))) { + return std::forward(source).subscribe(std::move(scrbr)); } }; -template -auto subscribe(Observer o, tag_observer&&) - -> subscribe_to_observer_factory { - return subscribe_to_observer_factory(std::move(o)); } -struct tag_function {}; -template -auto subscribe(OnNext n, tag_function&&) - -> subscribe_factory { - return subscribe_factory(std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); +template +auto subscribe(Arg0&& a0) + -> detail::subscribe_factory(std::forward(a0)))> { + return detail::subscribe_factory(std::forward(a0)))> + (make_subscriber(std::forward(a0))); } - -template -auto subscribe(OnNext n, OnError e, tag_function&&) - -> subscribe_factory { - return subscribe_factory(std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); +template +auto subscribe(Arg0&& a0, Arg1&& a1) + -> detail::subscribe_factory(std::forward(a0), std::forward(a1)))> { + return detail::subscribe_factory(std::forward(a0), std::forward(a1)))> + (make_subscriber(std::forward(a0), std::forward(a1))); } - -template -auto subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) - -> subscribe_factory { - return subscribe_factory(std::move(n), std::move(e), std::move(c)); -} - -template -auto subscribe(composite_subscription cs, OnNext n, tag_subscription&&) - -> subscribe_factory_chained { - return subscribe_factory_chained(std::move(cs), std::move(n), rxcpp::detail::OnErrorEmpty(), rxcpp::detail::OnCompletedEmpty()); -} - -template -auto subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) - -> subscribe_factory_chained { - return subscribe_factory_chained(std::move(cs), std::move(n), std::move(e), rxcpp::detail::OnCompletedEmpty()); -} - -} - -template -auto subscribe(Arg a) - -> decltype(detail::subscribe(std::move(a), typename std::conditional::value, tag_observer, detail::tag_function>::type())) { - return detail::subscribe(std::move(a), typename std::conditional::value, tag_observer, detail::tag_function>::type()); +template +auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2)))> { + return detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2)))> + (make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2))); } - -template -auto subscribe(Arg1 a1, Arg2 a2) - -> decltype(detail::subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { - return detail::subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); +template +auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))> { + return detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))> + (make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } - -template -auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) - -> decltype(detail::subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { - return detail::subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); +template +auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) + -> detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))> { + return detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))> + (make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } - -template -auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) - -> detail::subscribe_factory { - return detail::subscribe_factory(std::move(cs), std::move(n), std::move(e), std::move(c)); +template +auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) + -> detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))> { + return detail::subscribe_factory(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))> + (make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } namespace detail { @@ -133,9 +76,9 @@ class dynamic_factory { public: template - auto operator()(Observable source) - -> observable { - return observable(source); + auto operator()(Observable&& source) + -> observable::type::value_type> { + return observable::type::value_type>(std::forward(source)); } }; diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index e210800..9131716 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -94,10 +94,10 @@ #include "rx-predef.hpp" #include "rx-subscription.hpp" #include "rx-observer.hpp" -#include "rx-notification.hpp" #include "rx-scheduler.hpp" #include "rx-regulator.hpp" #include "rx-subscriber.hpp" +#include "rx-notification.hpp" #include "rx-sources.hpp" #include "rx-subjects.hpp" #include "rx-operators.hpp" diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index 503c392..dd1ff78 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -46,7 +46,7 @@ template struct notification_base : public std::enable_shared_from_this> { - typedef observer observer_type; + typedef subscriber observer_type; typedef std::shared_ptr> type; virtual ~notification_base() {} @@ -75,9 +75,9 @@ private: } virtual bool equals(const typename base::type& other) const { bool result = false; - other->accept(make_observer_dynamic([this, &result](T value) { + other->accept(make_subscriber(make_observer_dynamic([this, &result](T value) { result = this->value == value; - })); + }))); return result; } virtual void accept(const typename base::observer_type& o) const { @@ -103,9 +103,9 @@ private: virtual bool equals(const typename base::type& other) const { bool result = false; // not trying to compare exceptions - other->accept(make_observer_dynamic(nullptr, [&result](std::exception_ptr){ + other->accept(make_subscriber(make_observer_dynamic([](T){}, [&result](std::exception_ptr){ result = true; - })); + }))); return result; } virtual void accept(const typename base::observer_type& o) const { @@ -122,9 +122,9 @@ private: } virtual bool equals(const typename base::type& other) const { bool result = false; - other->accept(make_observer_dynamic(nullptr, nullptr, [&result](){ + other->accept(make_subscriber(make_observer_dynamic([](T){}, [&result](){ result = true; - })); + }))); return result; } virtual void accept(const typename base::observer_type& o) const { @@ -154,25 +154,48 @@ private: return std::make_shared(ep); } + struct on_next_factory + { + type operator()(T value) const { + return std::make_shared(std::move(value)); + } + }; + + struct on_completed_factory + { + type operator()() const { + return std::make_shared(); + } + }; + + struct on_error_factory + { + template + type operator()(Exception&& e) const { + return make_on_error(typename std::conditional< + std::is_same::type, std::exception_ptr>::value, + exception_ptr_tag, exception_tag>::type(), + std::forward(e)); + } + }; public: - static - type make_on_next(T value) { - return std::make_shared(std::move(value)); - } - static - type make_on_completed() { - return std::make_shared(); - } - template - static - type make_on_error(Exception&& e) { - return make_on_error(typename std::conditional< - std::is_same::type, std::exception_ptr>::value, - exception_ptr_tag, exception_tag>::type(), - std::forward(e)); - } + const static on_next_factory on_next; + const static on_completed_factory on_completed; + const static on_error_factory on_error; }; +template +//static +RXCPP_SELECT_ANY const typename notification::on_next_factory notification::on_next = notification::on_next_factory(); + +template +//static +RXCPP_SELECT_ANY const typename notification::on_completed_factory notification::on_completed = notification::on_completed_factory(); + +template +//static +RXCPP_SELECT_ANY const typename notification::on_error_factory notification::on_error = notification::on_error_factory(); + template bool operator == (const std::shared_ptr>& lhs, const std::shared_ptr>& rhs) { if (!lhs && !rhs) {return true;} diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 6a9c02f..7b1f336 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -20,10 +20,23 @@ struct is_operator_factory_for template static not_void check(...); - typedef decltype(check(0)) detail_result; + typedef decltype(check::type, typename std::decay::type>(0)) detail_result; static const bool value = !std::is_same::value; }; +template +struct has_on_subscribe_for +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CT*)nullptr).on_subscribe(*(CS*)nullptr)); + template + static not_void check(...); + + typedef decltype(check::type, T>(0)) detail_result; + static const bool value = std::is_same::value; +}; + } template @@ -33,7 +46,7 @@ class dynamic_observable struct state_type : public std::enable_shared_from_this { - typedef std::function)> onsubscribe_type; + typedef std::function)> onsubscribe_type; onsubscribe_type on_subscribe; }; @@ -48,8 +61,9 @@ class dynamic_observable } template - void construct(SO so, rxs::tag_source&&) { - state->on_subscribe = [so](observer o) mutable { + void construct(SO&& source, rxs::tag_source&&) { + typename std::decay::type so = std::forward(source); + state->on_subscribe = [so](subscriber o) mutable { so.on_subscribe(std::move(o)); }; } @@ -74,28 +88,29 @@ public: typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); } - void on_subscribe(observer o) const { + void on_subscribe(subscriber o) const { state->on_subscribe(std::move(o)); } - template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Observer o) const { - auto so = std::make_shared(o); - state->on_subscribe(make_observer_dynamic( - so->get_subscription(), - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - })); + template + typename std::enable_if::type, observer>::value, void>::type + on_subscribe(Subscriber&& o) const { + auto so = std::make_shared::type>(std::forward(o)); + state->on_subscribe(make_subscriber( + *so, + make_observer_dynamic( + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + }))); } }; @@ -112,17 +127,23 @@ class observable protected: typedef observable this_type; - mutable SourceOperator source_operator; + typedef typename std::decay::type source_operator_type; + mutable source_operator_type source_operator; private: template friend class observable; - template - auto detail_subscribe(Observer o, tag_observer&&) const - -> decltype(make_subscription(o)) { + template + auto detail_subscribe(Subscriber&& scrbr) const + -> decltype(make_subscription(*(typename std::decay::type*)nullptr)) { - static_assert(is_observer::value, "subscribe must be passed an observer"); + typedef typename std::decay::type subscriber_type; + subscriber_type o = std::forward(scrbr); + + static_assert(is_observer::value, "subscribe must be passed an observer"); + static_assert(std::is_same::value && std::is_convertible::value, "the value types in the sequence must match or be convertible"); + static_assert(detail::has_on_subscribe_for::value, "inner must have on_subscribe method that accepts this subscriber "); if (!o.is_subscribed()) { return make_subscription(o); @@ -154,51 +175,20 @@ private: return make_subscription(o); } - struct tag_function {}; - template - auto detail_subscribe(OnNext n, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n)))) { - return subscribe( make_observer(std::move(n))); - } - - template - auto detail_subscribe(OnNext n, OnError e, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n), std::move(e)))) { - return subscribe( make_observer(std::move(n), std::move(e))); - } - - template - auto detail_subscribe(OnNext n, OnError e, OnCompleted c, tag_function&&) const - -> decltype(make_subscription( make_observer(std::move(n), std::move(e), std::move(c)))) { - return subscribe( make_observer(std::move(n), std::move(e), std::move(c))); - } - - template - auto detail_subscribe(composite_subscription cs, OnNext n, tag_subscription&&) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n)))) { - return subscribe( make_observer(std::move(cs), std::move(n))); - } - - template - auto detail_subscribe(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e)))) { - return subscribe( make_observer(std::move(cs), std::move(n), std::move(e))); - } - public: typedef T value_type; - static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); observable() { } - explicit observable(const SourceOperator& o) + explicit observable(const source_operator_type& o) : source_operator(o) { } - explicit observable(SourceOperator&& o) + explicit observable(source_operator_type&& o) : source_operator(std::move(o)) { } @@ -228,54 +218,66 @@ public: return *this; } - template - auto subscribe(Arg a) const - -> decltype(detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type())) { - return detail_subscribe(std::move(a), typename std::conditional::value, tag_observer, tag_function>::type()); + template + auto subscribe(Arg0&& a0) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0)))) { + return detail_subscribe(make_subscriber(std::forward(a0))); + } + + template + auto subscribe(Arg0&& a0, Arg1&& a1) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1)))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1))); + } + + template + auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2)))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2))); } - template - auto subscribe(Arg1 a1, Arg2 a2) const - -> decltype(detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type())) { - return detail_subscribe(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, tag_function>::type()); + template + auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } - template - auto subscribe(Arg1 a1, Arg2 a2, Arg3 a3) const - -> decltype(detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type())) { - return detail_subscribe(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, tag_function>::type()); + template + auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } - template - auto subscribe(composite_subscription cs, OnNext n, OnError e, OnCompleted c) const - -> decltype(make_subscription( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c)))) { - return subscribe( make_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); + template + auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } template - auto filter(Predicate p) const + auto filter(Predicate&& p) const -> observable> { return observable>( - rxo::detail::filter(*this, std::move(p))); + rxo::detail::filter(*this, std::forward(p))); } template - auto map(Selector s) const + auto map(Selector&& s) const -> observable::value_type, rxo::detail::map> { return observable::value_type, rxo::detail::map>( - rxo::detail::map(*this, std::move(s))); + rxo::detail::map(*this, std::forward(s))); } template - auto flat_map(CollectionSelector s, ResultSelector rs) const + auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const -> observable::value_type, rxo::detail::flat_map> { return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::move(s), std::move(rs))); + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); } template auto op(OperatorFactory&& of) const - -> decltype(of(*(this_type*)nullptr)) { + -> decltype(of(*(const this_type*)nullptr)) { static_assert(detail::is_operator_factory_for::value, "Function passed for op() must have the signature Result(SourceObservable)"); return of(*this); } diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index c5cb7a2..8d2ddcf 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -51,7 +51,7 @@ public: using std::swap; swap(s, o.s); } - typename this_type::subscription_type get_subscription() { + const typename this_type::subscription_type& get_subscription() const { return s; } bool is_subscribed() const { @@ -75,7 +75,7 @@ class is_observer template static void check(...); public: - static const bool value = std::is_convertible(0)), tag_observer>::value; + static const bool value = std::is_convertible::type>(0)), tag_observer>::value; }; namespace detail { @@ -102,7 +102,7 @@ struct is_on_next_of template static not_void check(...); - typedef decltype(check(0)) detail_result; + typedef decltype(check::type>(0)) detail_result; static const bool value = std::is_same::value; }; @@ -115,7 +115,7 @@ struct is_on_error template static not_void check(...); - static const bool value = std::is_same(0)), void>::value; + static const bool value = std::is_same::type>(0)), void>::value; }; template @@ -127,7 +127,7 @@ struct is_on_completed template static not_void check(...); - static const bool value = std::is_same(0)), void>::value; + static const bool value = std::is_same::type>(0)), void>::value; }; } @@ -147,215 +147,17 @@ private: on_error_t onerror; on_completed_t oncompleted; - struct tag_this_type {}; - struct tag_function {}; - - template - struct resolve_tag - { - typedef typename std::conditional::type, dynamic_observer>::value, tag_this_type, - typename std::conditional::value, tag_subscription, tag_function>::type - >::type type; - }; - - template::type> - struct resolve_cs; - template - struct resolve_cs - { - auto operator()(const Arg& a) - -> decltype(a.cs) { - return a.cs; - } - auto operator()(Arg&& a) - -> decltype(a.cs) { - return std::move(a.cs); - } - }; - template - struct resolve_cs - { - Arg operator()(Arg a) { - return std::move(a); - } - }; - template - struct resolve_cs - { - composite_subscription operator()(const Arg& a) { - return composite_subscription(); - } - }; - - template::type> - struct resolve_onnext; - template - struct resolve_onnext - { - auto operator()(const Arg& a) - -> decltype(a.onnext) { - return a.onnext; - } - auto operator()(Arg&& a) - -> decltype(a.onnext) { - return std::move(a.onnext); - } - }; - template - struct resolve_onnext - { - template - on_next_t operator()(const Arg1& a1) { - return on_next_t(); - } - template - Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_next_of::value || std::is_same::value, - "Function supplied for on_next must be a function with the signature void(T);"); - return std::move(a2); - } - }; - template - struct resolve_onnext - { - template - Arg1 operator()(Arg1 a1) { - static_assert(detail::is_on_next_of::value || std::is_same::value, - "Function supplied for on_next must be a function with the signature void(T);"); - return std::move(a1); - } - template - Arg operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_next_of::value || std::is_same::value, - "Function supplied for on_next must be a function with the signature void(T);"); - return std::move(a1); - } - }; - - template::type> - struct resolve_onerror; - template - struct resolve_onerror - { - auto operator()(const Arg& a) - -> decltype(a.onerror) { - return a.onerror; - } - auto operator()(Arg&& a) - -> decltype(a.onerror) { - return std::move(a.onerror); - } - }; - template - struct resolve_onerror - { - template - on_error_t operator()(const Arg1& a1) { - return on_error_t(); - } - template - Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_error::value || std::is_same::value, - "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); - return std::move(a2); - } - }; - template - struct resolve_onerror - { - template - on_error_t operator()(const Arg1& a1) { - return on_error_t(); - } - template - Arg1 operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_error::value || std::is_same::value, - "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); - return std::move(a1); - } - }; - - template::type> - struct resolve_oncompleted; - template - struct resolve_oncompleted - { - auto operator()(const Arg& a) - -> decltype(a.oncompleted) { - return a.oncompleted; - } - auto operator()(Arg&& a) - -> decltype(a.oncompleted) { - return std::move(a.oncompleted); - } - }; - template - struct resolve_oncompleted - { - template - on_completed_t operator()(const Arg1& a1) { - return on_completed_t(); - } - template - Arg2 operator()(const Arg1&, Arg2 a2) { - static_assert(detail::is_on_completed::value || std::is_same::value, - "Function supplied for on_completed must be a function with the signature void();"); - return std::move(a2); - } - }; - template - struct resolve_oncompleted - { - template - on_completed_t operator()(const Arg1& a1) { - return on_completed_t(); - } - template - Arg1 operator()(Arg1 a1, const Arg2&) { - static_assert(detail::is_on_completed::value || std::is_same::value, - "Function supplied for on_completed must be a function with the signature void();"); - return std::move(a1); - } - }; - public: dynamic_observer() { } - template - explicit dynamic_observer(Arg a) - : base_type(resolve_cs()(a)) - , onnext(resolve_onnext()(a)) - , onerror(resolve_onerror()(a)) - , oncompleted(resolve_oncompleted()(a)) - { - } - - template - dynamic_observer(Arg1 a1, Arg2 a2) - : base_type(resolve_cs()(a1)) - , onnext(resolve_onnext()(a1, a2)) - , onerror(resolve_onerror()(a2, on_error_t())) - , oncompleted(resolve_oncompleted()(on_completed_t(), on_completed_t())) - { - } - - template - dynamic_observer(Arg1 a1, Arg2 a2, Arg3 a3) - : base_type(resolve_cs()(a1)) - , onnext(resolve_onnext()(a1, a2)) - , onerror(resolve_onerror()(a2, a3)) - , oncompleted(resolve_oncompleted()(a3, on_completed_t())) - { - } - template - dynamic_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c) + dynamic_observer(composite_subscription cs, OnNext&& n, OnError&& e, OnCompleted&& c) : base_type(std::move(cs)) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) + , onnext(std::forward(n)) + , onerror(std::forward(e)) + , oncompleted(std::forward(c)) { static_assert(detail::is_on_next_of::value || std::is_same::value, "Function supplied for on_next must be a function with the signature void(T);"); @@ -394,13 +196,14 @@ public: } }; -template +template class static_observer : public observer_base { public: - typedef OnNext on_next_t; - typedef OnError on_error_t; - typedef OnCompleted on_completed_t; + typedef static_observer this_type; + typedef typename std::decay::type on_next_t; + typedef typename std::decay::type on_error_t; + typedef typename std::decay::type on_completed_t; private: on_next_t onnext; @@ -412,39 +215,32 @@ public: static_assert(detail::is_on_error::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); static_assert(detail::is_on_completed::value, "Function supplied for on_completed must be a function with the signature void();"); - explicit static_observer(on_next_t n = on_next_t(), on_error_t e = on_error_t(), on_completed_t c = on_completed_t()) - : observer_base(composite_subscription()) - , onnext(std::move(n)) - , onerror(std::move(e)) - , oncompleted(std::move(c)) - { - } - explicit static_observer(composite_subscription cs, on_next_t n = on_next_t(), on_error_t e = on_error_t(), on_completed_t c = on_completed_t()) + explicit static_observer(composite_subscription cs, on_next_t n, on_error_t e, on_completed_t c) : observer_base(std::move(cs)) , onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } - static_observer(const static_observer& o) + static_observer(const this_type& o) : observer_base(o) , onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } - static_observer(static_observer&& o) + static_observer(this_type&& o) : observer_base(std::move(o)) , onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) { } - static_observer& operator=(static_observer o) { + static_observer& operator=(this_type o) { swap(o); return *this; } - void swap(static_observer& o) { + void swap(this_type& o) { using std::swap; observer_base::swap(o); swap(onnext, o.onnext); @@ -466,8 +262,8 @@ public: template class observer : public observer_root { - typedef observer this_type; - typedef typename std::conditional::value, I, dynamic_observer>::type inner_t; + typedef observer this_type; + typedef typename std::conditional::value, typename std::decay::type, dynamic_observer>::type inner_t; struct detacher { @@ -515,7 +311,7 @@ public: inner.on_completed(); } } - typename this_type::subscription_type get_subscription() { + const typename this_type::subscription_type& get_subscription() const { return inner.get_subscription(); } bool is_subscribed() const { @@ -545,7 +341,7 @@ public: } void on_completed() const { } - typename this_type::subscription_type get_subscription() { + const typename this_type::subscription_type& get_subscription() const { static typename this_type::subscription_type result; result.unsubscribe(); return result; @@ -571,115 +367,135 @@ auto make_observer() namespace detail { -struct tag_require_observer {}; - -struct tag_require_function {}; - -template -auto make_observer(I i, tag_observer&&) - -> observer { - return observer(std::move(i)); +template +auto make_observer_resolved(ResolvedArgSet&& rs) + -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { + return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); } - -struct tag_function {}; -template -auto make_observer(OnNext n, tag_function&&) - -> observer> { - return observer>( - static_observer(std::move(n))); +template +auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) + -> observer> { + return make_observer_resolved>(std::forward(rs)); } -template -auto make_observer(OnNext n, OnError e, tag_function&&) - -> observer> { - return observer>( - static_observer(std::move(n), std::move(e))); +template +auto make_observer_resolved(ResolvedArgSet&& rs) + -> observer { + typedef I inner_type; + return observer(inner_type( + std::get<0>(std::forward(rs)).value, + std::move(std::get<1>(std::forward(rs)).value), + std::move(std::get<2>(std::forward(rs)).value), + std::move(std::get<3>(std::forward(rs)).value))); + + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; + + static_assert(rn_t::is_arg, "onnext is a required parameter"); + static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); + static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); + static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } -template -auto make_observer(OnNext n, OnError e, OnCompleted c, tag_function&&) - -> observer> { - return observer>( - static_observer(std::move(n), std::move(e), std::move(c))); -} +struct tag_subscription_resolution +{ + template + struct predicate + { + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; + }; + typedef composite_subscription default_type; +}; -template -auto make_observer(composite_subscription cs, OnNext n, tag_subscription&&) - -> observer> { - return observer>( - static_observer(std::move(cs), std::move(n))); -} +template +struct tag_onnext_resolution +{ + template + struct predicate + { + static const bool value = is_on_next_of::value; + }; + typedef OnNextEmpty default_type; +}; -template -auto make_observer(composite_subscription cs, OnNext n, OnError e, tag_subscription&&) - -> observer> { - return observer>( - static_observer(std::move(cs), std::move(n), std::move(e))); -} +struct tag_onerror_resolution +{ + template + struct predicate + { + static const bool value = is_on_error::value; + }; + typedef OnErrorEmpty default_type; +}; -} +struct tag_oncompleted_resolution +{ + template + struct predicate + { + static const bool value = is_on_completed::value; + }; + typedef OnCompletedEmpty default_type; +}; -template -auto make_observer(Arg a) - -> decltype(detail::make_observer(std::move(a), typename std::conditional::value, tag_observer, detail::tag_require_observer>::type())) { - return detail::make_observer(std::move(a), typename std::conditional::value, tag_observer, detail::tag_require_observer>::type()); -} +// types to disambiguate +// on_next and optional on_error, on_completed + +// optional subscription +// -template -auto make_observer(Arg a) - -> decltype(detail::make_observer(std::move(a), typename std::conditional::value, detail::tag_require_function, detail::tag_function>::type())) { - return detail::make_observer(std::move(a), typename std::conditional::value, detail::tag_require_function, detail::tag_function>::type()); -} +template +struct tag_observer_set + : public rxu::detail::tag_set, + rxu::detail::tag_set>>> +{ +}; -template -auto make_observer(Arg1 a1, Arg2 a2) - -> decltype(detail::make_observer(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { - return detail::make_observer(std::move(a1), std::move(a2), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); -} -template -auto make_observer(Arg1 a1, Arg2 a2, Arg3 a3) - -> decltype(detail::make_observer(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type())) { - return detail::make_observer(std::move(a1), std::move(a2), std::move(a3), typename std::conditional::value, tag_subscription, detail::tag_function>::type()); } -template -auto make_observer(composite_subscription cs, OnNext n, OnError e, OnCompleted c) - -> observer> { - return observer>( - static_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); +template +auto make_observer(Arg0&& a0) + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0))); } - -template -auto make_observer_dynamic(OnNext n) - -> observer { - return observer(dynamic_observer(std::move(n))); +template +auto make_observer(Arg0&& a0, Arg1&& a1) + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1)))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1))); } -template -auto make_observer_dynamic(OnNext n, OnError e) - -> observer { - return observer(dynamic_observer(std::move(n), std::move(e))); +template +auto make_observer(Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2))); } -template -auto make_observer_dynamic(OnNext n, OnError e, OnCompleted c) - -> observer { - return observer(dynamic_observer(std::move(n), std::move(e), std::move(c))); +template +auto make_observer(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } -template -auto make_observer_dynamic(composite_subscription cs, OnNext n) - -> observer { - return observer(dynamic_observer(std::move(cs), std::move(n))); +template +auto make_observer_dynamic(Arg0&& a0) + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0))); } -template -auto make_observer_dynamic(composite_subscription cs, OnNext n, OnError e) - -> observer { - return observer(dynamic_observer(std::move(cs), std::move(n), std::move(e))); +template +auto make_observer_dynamic(Arg0&& a0, Arg1&& a1) + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1)))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1))); } -template -auto make_observer_dynamic(composite_subscription cs, OnNext n, OnError e, OnCompleted c) - -> observer { - return observer(dynamic_observer(std::move(cs), std::move(n), std::move(e), std::move(c))); +template +auto make_observer_dynamic(Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2))); +} +template +auto make_observer_dynamic(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } } diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 81c2292..0a25131 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -15,6 +15,19 @@ class dynamic_observer; template> class observer; +struct tag_subscriber {}; +template +class is_subscriber +{ + struct not_void {}; + template + static typename C::subscriber_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_subscriber*>::value; +}; + template class dynamic_observable; diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 1d53ab5..7bca7ad 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -9,29 +9,36 @@ namespace rxcpp { -struct tag_subscriber {}; template struct subscriber_base : public observer_root, public subscription_base, public resumption_base { typedef tag_subscriber subscriber_tag; }; -template -class is_subscriber -{ - template - static typename C::subscriber_tag* check(int); - template - static void check(...); -public: - static const bool value = std::is_convertible(0)), tag_subscriber*>::value; -}; template> class subscriber : public subscriber_base { + typedef subscriber this_type; + typedef typename std::decay::type observer_type; + composite_subscription lifetime; resumption controller; - Observer destination; + observer_type destination; + + struct detacher + { + ~detacher() + { + if (that) { + that->unsubscribe(); + } + } + detacher(const this_type* that) + : that(that) + { + } + const this_type* that; + }; public: typedef typename composite_subscription::weak_subscription weak_subscription; @@ -40,20 +47,30 @@ public: subscriber() { } - subscriber(composite_subscription cs, resumption r, Observer o) + template + subscriber(composite_subscription cs, resumption r, U&& o) : lifetime(std::move(cs)) - , destination(std::move(o)) , controller(std::move(r)) + , destination(std::forward(o)) { } - Observer get_observer() const { + const observer_type& get_observer() const { + return destination; + } + observer_type& get_observer() { return destination; } - resumption get_resumption() const { + const resumption& get_resumption() const { return controller; } - composite_subscription get_subscription() const { + resumption& get_resumption() { + return controller; + } + const composite_subscription& get_subscription() const { + return lifetime; + } + composite_subscription& get_subscription() { return lifetime; } @@ -69,13 +86,23 @@ public: // observer // void on_next(T t) const { - destination.on_next(std::move(t)); + if (is_subscribed()) { + detacher protect(this); + destination.on_next(std::move(t)); + protect.that = nullptr; + } } void on_error(std::exception_ptr e) const { - destination.on_error(e); + if (is_subscribed()) { + detacher protect(this); + destination.on_error(e); + } } void on_completed() const { - destination.on_completed(); + if (is_subscribed()) { + detacher protect(this); + destination.on_completed(); + } } // composite_subscription @@ -101,22 +128,7 @@ public: }; -template -auto make_observer_resolved(ResolvedArgSet&& rs) - -> observer(std::forward(rs)).value), decltype (std::get<3>(std::forward(rs)).value), decltype (std::get<4>(std::forward(rs)).value)>> { - typedef static_observer(std::forward(rs)).value), decltype (std::get<3>(std::forward(rs)).value), decltype (std::get<4>(std::forward(rs)).value)> inner_type; - return observer(inner_type( - std::move(std::get<2>(std::forward(rs)).value), std::move(std::get<3>(std::forward(rs)).value), std::move(std::get<4>(std::forward(rs)).value))); - - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; - - static_assert(rn_t::is_arg, "onnext is a required parameter"); - static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); - static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); - static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); -} +namespace detail { template struct observer_selector; @@ -126,8 +138,8 @@ struct observer_selector { template static auto get_observer(Set&& rs) - -> decltype(std::get<5>(std::forward(rs))) { - return std::get<5>(std::forward(rs)); + -> decltype(std::get<5>(std::forward(rs)).value) { + return std::get<5>(std::forward(rs)).value; } }; template @@ -136,6 +148,9 @@ struct observer_selector template static auto get_observer(Set&& rs) -> decltype(make_observer_resolved(std::forward(rs))) { + if (!std::get<0>(std::forward(rs)).value.is_subscribed()) { + abort(); + } return make_observer_resolved(std::forward(rs)); } }; @@ -144,20 +159,23 @@ struct observer_selector { template static auto get_observer(Set&& rs) - -> decltype(std::get<6>(std::forward(rs)).value.get_observer()) { - return std::get<6>(std::forward(rs)).value.get_observer(); + -> const decltype( std::get<6>(std::forward(rs)).value.get_observer())& { + return std::get<6>(std::forward(rs)).value.get_observer(); } }; template auto select_observer(ResolvedArgSet&& rs) - -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { - return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); + -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { + if (!std::get<0>(std::forward(rs)).value.is_subscribed()) { + abort(); + } + return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); - typedef typename std::decay(std::forward(rs)))>::type rr_t; - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; + typedef typename std::decay(std::forward(rs)))>::type rr_t; + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; typedef typename std::decay(std::forward(rs)))>::type ro_t; typedef typename std::decay(std::forward(rs)))>::type rs_t; @@ -166,20 +184,27 @@ auto select_observer(ResolvedArgSet&& rs) } template -auto make_subscriber_resolved(ResolvedArgSet&& rs) - -> subscriber(std::forward(rs)))> { - auto rsub = std::get<0>(std::forward(rs)); - auto rr = std::get<1>(std::forward(rs)); - const auto& rscrbr = std::get<6>(std::forward(rs)); - auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : std::move(rr.value); - auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : std::move(rsub.value); - return subscriber(std::forward(rs)))>( - std::move(s), std::move(r), select_observer(std::forward(rs))); - +auto make_subscriber_resolved(ResolvedArgSet&& rsArg) + -> subscriber(std::move(rsArg)))> { + const auto rs = std::forward(rsArg); + if (!std::get<0>(rs).value.is_subscribed()) { + abort(); + } + const auto rsub = std::get<0>(rs); + const auto rr = std::get<4>(rs); + const auto rscrbr = std::get<6>(rs); + const auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : rr.value; + const auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; + return subscriber(std::move(rsArg)))>( + s, r, select_observer(std::move(rs))); + +// at least for now do not enforce resolver +#if 0 typedef typename std::decay::type rr_t; typedef typename std::decay::type rs_t; static_assert(rs_t::is_arg || rr_t::is_arg, "at least one of; resumption or subscriber is a required parameter"); +#endif } template @@ -203,16 +228,6 @@ struct tag_observer_resolution typedef observer default_type; }; -struct tag_subscription_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - typedef composite_subscription default_type; -}; - struct tag_resumption_resolution { template @@ -224,34 +239,6 @@ struct tag_resumption_resolution }; -template -struct tag_onnext_resolution -{ - template - struct predicate : public detail::is_on_next_of - { - }; - typedef detail::OnNextEmpty default_type; -}; - -struct tag_onerror_resolution -{ - template - struct predicate : public detail::is_on_error - { - }; - typedef detail::OnErrorEmpty default_type; -}; - -struct tag_oncompleted_resolution -{ - template - struct predicate : public detail::is_on_completed - { - }; - typedef detail::OnCompletedEmpty default_type; -}; - // types to disambiguate // subscriber with override for subscription, observer, resumption | // optional subscriber + @@ -262,45 +249,48 @@ struct tag_oncompleted_resolution template struct tag_subscriber_set + // the first four must be the same as tag_observer_set or the indexing will fail : public rxu::detail::tag_set, rxu::detail::tag_set, rxu::detail::tag_set>>>>>>> { }; +} + template auto make_subscriber(Arg0&& a0) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0))); } template auto make_subscriber(Arg0&& a0, Arg1&& a1) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1))); } template auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2))); } template auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } template auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } template auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) - -> decltype(make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { - return make_subscriber_resolved(rxu::detail::resolve_arg_set(tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } } diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index ccb8e06..6adba54 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -57,7 +57,7 @@ public: template class static_subscription : public subscription_base { - typedef Unsubscribe unsubscribe_call_type; + typedef typename std::decay::type unsubscribe_call_type; unsubscribe_call_type unsubscribe_call; static_subscription() { @@ -83,7 +83,7 @@ public: template class subscription : public subscription_base { - typedef I inner_t; + typedef typename std::decay::type inner_t; inner_t inner; mutable bool issubscribed; public: @@ -120,17 +120,17 @@ inline auto make_subscription() return subscription(); } template -auto make_subscription(I i) +auto make_subscription(I&& i) -> typename std::enable_if::value, subscription>::type { - return subscription(std::move(i)); + return subscription(std::forward(i)); } template -auto make_subscription(Unsubscribe u) +auto make_subscription(Unsubscribe&& u) -> typename std::enable_if::value, subscription< static_subscription>>::type { return subscription< static_subscription>( - static_subscription(std::move(u))); + static_subscription(std::forward(u))); } class composite_subscription : public subscription_base @@ -222,24 +222,39 @@ public: composite_subscription() : state(std::make_shared()) { + if (!state) { + abort(); + } } composite_subscription(const composite_subscription& o) : state(o.state) { + if (!state) { + abort(); + } } composite_subscription(composite_subscription&& o) : state(std::move(o.state)) { + if (!state) { + abort(); + } } composite_subscription& operator=(const composite_subscription& o) { state = o.state; + if (!state) { + abort(); + } return *this; } composite_subscription& operator=(composite_subscription&& o) { state = std::move(o.state); + if (!state) { + abort(); + } return *this; } diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index 946ec03..e519cf8 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -18,7 +18,7 @@ struct test_subject_base typedef rxn::recorded::type> recorded_type; typedef std::shared_ptr> type; - virtual void on_subscribe(observer) const =0; + virtual void on_subscribe(subscriber) const =0; virtual std::vector messages() const =0; virtual std::vector subscriptions() const =0; }; @@ -30,29 +30,35 @@ struct test_source explicit test_source(typename test_subject_base::type ts) : ts(std::move(ts)) { + if (!this->ts) abort(); } typename test_subject_base::type ts; - void on_subscribe(observer o) const { + void on_subscribe(subscriber o) const { ts->on_subscribe(std::move(o)); } - template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Observer o) const { - auto so = std::make_shared(o); - ts->on_subscribe(make_observer_dynamic( - so->get_subscription(), - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - })); + template + typename std::enable_if::type, subscriber>::value, void>::type + on_subscribe(Subscriber&& o) const { + + static_assert(is_subscriber::value, "on_subscribe must be passed a subscriber."); + + auto so = std::make_shared::type>(std::forward(o)); + ts->on_subscribe( + make_subscriber( + *so, + make_observer_dynamic( + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + }))); } }; diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 53f1b3c..fa6efe9 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -139,16 +139,15 @@ public: if (is_set) { is_set = false; reinterpret_cast(&storage)->~T(); + std::fill_n(reinterpret_cast(&storage), sizeof(T), 0); } } - void reset(T value) { - if (is_set) { - *reinterpret_cast(&storage) = std::move(value); - } else { - new (reinterpret_cast(&storage)) T(std::move(value)); - is_set = true; - } + template + void reset(U&& value) { + reset(); + new (reinterpret_cast(&storage)) T(std::forward(value)); + is_set = true; } maybe& operator=(const T& other) { @@ -212,8 +211,9 @@ struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, result_type a) - : value(std::move(a)) { + template + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) + : value(std::forward(a)) { } }; @@ -227,8 +227,9 @@ struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, result_type a, const Arg5&) - : value(std::move(a)) { + template + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) + : value(std::forward(a)) { } }; @@ -242,8 +243,9 @@ struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, result_type a, const Arg4&, const Arg5&) - : value(std::move(a)) { + template + arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) + : value(std::forward(a)) { } }; @@ -257,8 +259,9 @@ struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, result_type a, const Arg3&, const Arg4&, const Arg5&) - : value(std::move(a)) { + template + arg_resolver_n(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) + : value(std::forward(a)) { } }; @@ -272,8 +275,9 @@ struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(const Arg0&, result_type a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - : value(std::move(a)) { + template + arg_resolver_n(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + : value(std::forward(a)) { } }; @@ -287,8 +291,9 @@ struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; - arg_resolver_n(result_type a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - : value(std::move(a)) { + template + arg_resolver_n(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + : value(std::forward(a)) { } }; @@ -311,7 +316,7 @@ struct tag_unresolvable {}; template class Predicate, class Default, class Arg0 = tag_unresolvable, class Arg1 = tag_unresolvable, class Arg2 = tag_unresolvable, class Arg3 = tag_unresolvable, class Arg4 = tag_unresolvable, class Arg5 = tag_unresolvable> struct arg_resolver { - typedef typename arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5>::type type; + typedef typename arg_resolver_n<5, Predicate, Default, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type>::type type; }; @@ -323,54 +328,54 @@ auto resolve_arg() template class Predicate, class Default, class Arg0> -auto resolve_arg(Arg0 a0) --> decltype(typename arg_resolver::type(std::move(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type(std::move(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); +auto resolve_arg(Arg0&& a0) +-> decltype(typename arg_resolver::type(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + return typename arg_resolver::type(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1> -auto resolve_arg(Arg0 a0, Arg1 a1) +auto resolve_arg(Arg0&& a0, Arg1&& a1) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); + std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2> -auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2) +auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); + std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3> -auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3) +auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), tag_unresolvable(), tag_unresolvable())) { + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), tag_unresolvable(), tag_unresolvable()); + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4> -auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) +auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), tag_unresolvable())) { + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable())) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), tag_unresolvable()); + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -auto resolve_arg(Arg0 a0, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) +auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) -> decltype(typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), std::move(a5))) { + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))) { return typename arg_resolver::type( - std::move(a0), std::move(a1), std::move(a2), std::move(a3), std::move(a4), std::move(a5)); + std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); } struct arg_resolver_term {}; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 250dbf6..cd3b7ff 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -28,30 +28,37 @@ public: typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - static - recorded_type on_next(long ticks, T value) + struct on_next_factory { - return recorded_type(ticks, notification_type::make_on_next(value)); - } - - static - recorded_type on_completed(long ticks) + recorded_type operator()(long ticks, T value) const { + return recorded_type(ticks, notification_type::on_next(value)); + } + }; + struct on_completed_factory { - return recorded_type(ticks, notification_type::make_on_completed()); - } - - template - static - recorded_type on_error(long ticks, Exception e) + recorded_type operator()(long ticks) const { + return recorded_type(ticks, notification_type::on_completed()); + } + }; + struct on_error_factory { - return recorded_type(ticks, notification_type::make_on_error(e)); - } + template + recorded_type operator()(long ticks, Exception&& e) const { + return recorded_type(ticks, notification_type::on_error(std::forward(e))); + } + }; + + static const on_next_factory on_next; + static const on_completed_factory on_completed; + static const on_error_factory on_error; - static - rxn::subscription subscribe(long subscribe, long unsubscribe) + struct subscribe_factory { - return rxn::subscription(subscribe, unsubscribe); - } + rxn::subscription operator()(long subscribe, long unsubscribe) const { + return rxn::subscription(subscribe, unsubscribe); + } + }; + static const subscribe_factory subscribe; private: ~messages(); @@ -86,27 +93,29 @@ public: using base::start; template - auto start(F createSource, long created, long subscribed, long unsubscribed) - -> rxt::testable_observer + auto start(F&& createSource, long created, long subscribed, long unsubscribed) + -> subscriber> { + typename std::decay::type createSrc = std::forward(createSource); + struct state_type : public std::enable_shared_from_this { - typedef decltype(createSource()) source_type; + typedef decltype(std::forward(createSrc)()) source_type; std::unique_ptr source; - rxt::testable_observer o; + subscriber> o; - explicit state_type(rxt::testable_observer o) + explicit state_type(subscriber> o) : source() , o(o) { } }; - std::shared_ptr state(new state_type(this->make_observer())); + std::shared_ptr state(new state_type(this->make_subscriber())); - schedule_absolute(created, make_action([createSource, state](action, scheduler) { - state->source.reset(new typename state_type::source_type(createSource())); + schedule_absolute(created, make_action([createSrc, state](action, scheduler) { + state->source.reset(new typename state_type::source_type(createSrc())); return make_action_empty(); })); schedule_absolute(subscribed, make_action([state](action, scheduler) { @@ -124,17 +133,17 @@ public: } template - auto start(F createSource, long unsubscribed) - -> rxt::testable_observer + auto start(F&& createSource, long unsubscribed) + -> subscriber> { - return start(std::move(createSource), created_time, subscribed_time, unsubscribed); + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); } template - auto start(F createSource) - -> rxt::testable_observer + auto start(F&& createSource) + -> subscriber> { - return start(std::move(createSource), created_time, subscribed_time, unsubscribed_time); + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); } template @@ -157,8 +166,27 @@ public: template rxt::testable_observer make_observer(); + + template + subscriber> make_subscriber(); }; +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::on_next = test::messages::on_next_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::on_completed = test::messages::on_completed_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::on_error = test::messages::on_error_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::subscribe_factory test::messages::subscribe = test::messages::subscribe_factory(); + template class mock_observer : public rxt::detail::test_subject_base @@ -175,7 +203,7 @@ public: typename test::shared sc; std::vector m; - virtual void on_subscribe(observer) const { + virtual void on_subscribe(subscriber) const { abort(); } virtual std::vector subscriptions() const { @@ -193,30 +221,37 @@ rxt::testable_observer test::make_observer() typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - auto ts = std::make_shared>( - std::static_pointer_cast(shared_from_this())); + std::shared_ptr> ts(new mock_observer( + std::static_pointer_cast(shared_from_this()))); return rxt::testable_observer(ts, make_observer_dynamic( // on_next [ts](T value) { ts->m.push_back( - recorded_type(ts->sc->clock(), notification_type::make_on_next(value))); + recorded_type(ts->sc->clock(), notification_type::on_next(value))); }, // on_error [ts](std::exception_ptr e) { ts->m.push_back( - recorded_type(ts->sc->clock(), notification_type::make_on_error(e))); + recorded_type(ts->sc->clock(), notification_type::on_error(e))); }, // on_completed [ts]() { ts->m.push_back( - recorded_type(ts->sc->clock(), notification_type::make_on_completed())); + recorded_type(ts->sc->clock(), notification_type::on_completed())); })); } +template +subscriber> test::make_subscriber() +{ + auto to = this->make_observer(); + return rxcpp::make_subscriber(to.get_subscription(), to); +} + template class cold_observable : public rxt::detail::test_subject_base @@ -242,7 +277,7 @@ public: { } - virtual void on_subscribe(observer o) const { + virtual void on_subscribe(subscriber o) const { sv.push_back(rxn::subscription(sc->clock())); auto index = sv.size() - 1; @@ -272,8 +307,8 @@ public: template rxt::testable_observable test::make_cold_observable(std::vector>>> messages) { - return rxt::testable_observable(std::make_shared>( - std::static_pointer_cast(shared_from_this()), std::move(messages))); + auto co = std::shared_ptr>(new cold_observable(std::static_pointer_cast(shared_from_this()), std::move(messages))); + return rxt::testable_observable(co); } template @@ -283,7 +318,7 @@ class hot_observable typedef hot_observable this_type; typename test::shared sc; typedef rxn::recorded::type> recorded_type; - typedef observer observer_type; + typedef subscriber observer_type; mutable std::vector mv; mutable std::vector sv; mutable std::vector observers; diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 9a44ba9..418c292 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -31,8 +31,8 @@ struct range : public source_base init.step = s; init.sc = sc; } - template - void on_subscribe(observer o) { + template + void on_subscribe(Subscriber o) { auto state = std::make_shared(init); state->sc->schedule(o.get_subscription(), [=](rxsc::action that, rxsc::scheduler){ if (state->remaining == 0) { diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index fafdb14..82b05e7 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -18,7 +18,7 @@ class multicast_observer : public observer_base { typedef observer_base base; - typedef observer observer_type; + typedef subscriber observer_type; typedef std::vector list_type; struct mode @@ -66,7 +66,7 @@ class multicast_observer std::copy_if( old->observers.begin(), old->observers.end(), std::inserter(observers, observers.end()), - [](const observer& o){ + [](const observer_type& o){ return o.is_subscribed(); }); } @@ -108,7 +108,7 @@ public: bool has_observers() const { return b->state->has_observers; } - void add(observer o) const { + void add(observer_type o) const { std::unique_lock guard(b->state->lock); switch (b->state->current) { case mode::Casting: @@ -148,7 +148,7 @@ public: c = b->completer; } for (auto& o : c->observers) { - o.on_next(std::move(t)); + o.on_next(t); } } } @@ -206,7 +206,7 @@ public: return observer>(s); } observable get_observable() const { - return make_dynamic_observable([this](observer o){ + return make_dynamic_observable([this](subscriber o){ this->s.add(std::move(o)); }); } diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index 2e202be..ad92bbb 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -89,7 +89,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ m::on_completed(600) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -110,7 +110,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ } -SCENARIO("where stops on disposal", "[where][filter][operators]"){ +SCENARIO("filter stops on disposal", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; @@ -165,7 +165,7 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ m::on_next(390, 7) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -185,7 +185,7 @@ SCENARIO("where stops on disposal", "[where][filter][operators]"){ } } -SCENARIO("where stops on error", "[where][filter][operators]"){ +SCENARIO("filter stops on error", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; @@ -250,7 +250,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ m::on_error(600, ex), }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -270,7 +270,7 @@ SCENARIO("where stops on error", "[where][filter][operators]"){ } } -SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ +SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; @@ -339,7 +339,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ m::on_error(380, ex) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -359,7 +359,7 @@ SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ } } -SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ +SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; @@ -389,7 +389,7 @@ SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ }() ); - auto res = sc->make_observer(); + auto res = sc->make_subscriber(); rx::observable> ys; @@ -436,7 +436,7 @@ SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ m::on_next(390, 7) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 9e4c108..ffceaf4 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -18,8 +18,6 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ typedef rxsc::test::messages m; typedef rxsc::test::messages ms; - long invoked = 0; - m::recorded_type int_messages[] = { m::on_next(100, 4), m::on_next(200, 2), @@ -43,7 +41,11 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ auto res = sc->start( [&]() { return xs - .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) + .flat_map( + [&](int){ + return ys;}, + [](int, std::string s){ + return s;}) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); } @@ -70,7 +72,7 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ ms::on_completed(850) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -105,8 +107,6 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ typedef rxsc::test::messages m; typedef rxsc::test::messages ms; - long invoked = 0; - m::recorded_type int_messages[] = { m::on_next(100, 4), m::on_next(200, 2), @@ -162,7 +162,7 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ ms::on_next(950, "foo") }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -198,8 +198,6 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ typedef rxsc::test::messages m; typedef rxsc::test::messages ms; - long invoked = 0; - m::recorded_type int_messages[] = { m::on_next(100, 4), m::on_next(200, 2), @@ -244,7 +242,7 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ ms::on_error(601, ex) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp index 397287c..61da39c 100644 --- a/Rx/v2/test/operators/map.cpp +++ b/Rx/v2/test/operators/map.cpp @@ -17,19 +17,22 @@ SCENARIO("map stops on completion", "[map][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = std::make_shared(); typedef rxsc::test::messages m; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; long invoked = 0; m::recorded_type messages[] = { - m::on_next(180, 1), - m::on_next(210, 2), - m::on_next(240, 3), - m::on_next(290, 4), - m::on_next(350, 5), - m::on_completed(400), - m::on_next(410, -1), - m::on_completed(420), - m::on_error(430, std::runtime_error("error on unsubscribed stream")) + 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 xs = sc->make_hot_observable(messages); @@ -56,7 +59,7 @@ SCENARIO("map stops on completion", "[map][operators]"){ m::on_completed(400) }; auto required = rxu::to_vector(items); - auto actual = res.messages(); + auto actual = res.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index f1905a2..efa84e8 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -172,11 +172,11 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc->make_observer(); + auto results1 = sc->make_subscriber(); - auto results2 = sc->make_observer(); + auto results2 = sc->make_subscriber(); - auto results3 = sc->make_observer(); + auto results3 = sc->make_subscriber(); WHEN("multicasting an infinite source"){ @@ -213,7 +213,7 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ m::on_next(520, 7) }; auto required = rxu::to_vector(items); - auto actual = results1.messages(); + auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } @@ -224,7 +224,7 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ m::on_next(630, 8) }; auto required = rxu::to_vector(items); - auto actual = results2.messages(); + auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } @@ -233,7 +233,7 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ m::on_next(940, 11) }; auto required = rxu::to_vector(items); - auto actual = results3.messages(); + auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 588ffab..42caf7b 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -66,7 +66,7 @@ SCENARIO("subscriber traits", "[observer][traits]"){ SCENARIO("observer traits", "[observer][traits]"){ GIVEN("given some observer types"){ auto emptyNext = [](int){}; - rx::dynamic_observer dob(emptyNext); + auto dob = rx::make_observer_dynamic(emptyNext); auto so = rx::make_observer(emptyNext); auto eo = rx::make_observer(); WHEN("tested"){ @@ -110,7 +110,7 @@ SCENARIO("non-observer traits", "[observer][traits]"){ SCENARIO("observers with subscription traits", "[observer][subscription][traits]"){ GIVEN("given some observer types"){ auto emptyNext = [](int){}; - rx::dynamic_observer dob(emptyNext); + auto dob = rx::make_observer_dynamic(emptyNext); auto so = rx::make_observer(emptyNext); auto eo = rx::make_observer(); WHEN("tested"){ @@ -133,7 +133,7 @@ SCENARIO("observer behavior", "[observer][traits]"){ auto next = [&result](int i){result += i;}; auto error = [&result](std::exception_ptr){result += 10;}; auto completed = [&result](){result += 100;}; - auto dob = rx::make_observer(rx::dynamic_observer(next, error, completed)); + auto dob = rx::make_observer_dynamic(next, error, completed); auto so = rx::make_observer(next, error, completed); auto eo = rx::make_observer(); WHEN("nothing is called"){ diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b0f11d0..74cfc08 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,12 +42,12 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp - ${V2_TEST_DIR}/operators/flat_map.cpp + ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp + ${V2_TEST_DIR}/operators/flat_map.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/operators/map.cpp - ${V2_TEST_DIR}/subjects/subject.cpp ) add_executable(rxcppv2_test ${V2_TEST_SOURCES}) -- GitLab From 3ce422e73b636d17a9189b0096cbb15821a29f8e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 19 Mar 2014 23:18:54 -0700 Subject: [PATCH 224/782] fix a runtime crash --- Rx/v2/src/rxcpp/rx-observable.hpp | 10 ++++-- Rx/v2/src/rxcpp/rx-observer.hpp | 14 ++------ Rx/v2/src/rxcpp/rx-operators.hpp | 4 +-- Rx/v2/src/rxcpp/rx-predef.hpp | 38 +++++++++++++++++++++ Rx/v2/src/rxcpp/rx-sources.hpp | 4 +-- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 4 +-- Rx/v2/test/subjects/subject.cpp | 45 +++++++++++++------------ 7 files changed, 77 insertions(+), 42 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 7b1f336..ced294b 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -52,11 +52,13 @@ class dynamic_observable }; std::shared_ptr state; - void construct(const dynamic_observable& o, rxs::tag_source&&) { + template + void construct(const dynamic_observable& o, tag_dynamic_observable&&) { state = o.state; } - void construct(dynamic_observable&& o, rxs::tag_source&&) { + template + void construct(dynamic_observable&& o, tag_dynamic_observable&&) { state = std::move(o.state); } @@ -76,6 +78,8 @@ class dynamic_observable public: + typedef tag_dynamic_observable dynamic_observable_tag; + dynamic_observable() { } @@ -85,7 +89,7 @@ public: : state(std::make_shared()) { construct(std::forward(sof), - typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); + typename std::conditional::value, tag_dynamic_observable, typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type>::type()); } void on_subscribe(subscriber o) const { diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 8d2ddcf..f3e5181 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -10,7 +10,6 @@ namespace rxcpp { -struct tag_observer {}; template struct observer_root : public subscription_base { @@ -67,16 +66,6 @@ public: s.unsubscribe(); } }; -template -class is_observer -{ - template - static typename C::observer_tag check(int); - template - static void check(...); -public: - static const bool value = std::is_convertible::type>(0)), tag_observer>::value; -}; namespace detail { template @@ -136,10 +125,11 @@ template class dynamic_observer : public observer_base { public: + typedef tag_dynamic_observer dynamic_observer_tag; + typedef std::function on_next_t; typedef std::function on_error_t; typedef std::function on_completed_t; - private: typedef observer_base base_type; diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index aa48e8c..a6071c9 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -22,11 +22,11 @@ template class is_operator { template - static typename C::operator_tag check(int); + static typename C::operator_tag* check(int); template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_operator>::value; + static const bool value = std::is_convertible::type>(0)), tag_operator*>::value; }; } diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 0a25131..5779f79 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -15,6 +15,31 @@ class dynamic_observer; template> class observer; +struct tag_observer {}; +template +class is_observer +{ + template + static typename C::observer_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_observer>::value; +}; + +struct tag_dynamic_observer {}; +template +class is_dynamic_observer +{ + struct not_void {}; + template + static typename C::dynamic_observer_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_dynamic_observer*>::value; +}; + struct tag_subscriber {}; template class is_subscriber @@ -28,6 +53,19 @@ public: static const bool value = std::is_convertible::type>(0)), tag_subscriber*>::value; }; +struct tag_dynamic_observable {}; +template +class is_dynamic_observable +{ + struct not_void {}; + template + static typename C::dynamic_observable_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_dynamic_observable*>::value; +}; + template class dynamic_observable; diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index 7e585a1..c504372 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -23,11 +23,11 @@ template class is_source { template - static typename C::source_tag check(int); + static typename C::source_tag* check(int); template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_source>::value; + static const bool value = std::is_convertible::type>(0)), tag_source*>::value; }; } diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index 82b05e7..bf4d1a8 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -202,8 +202,8 @@ public: return s.has_observers(); } - observer> get_observer() const { - return observer>(s); + subscriber>> get_subscriber(composite_subscription cs = composite_subscription()) const { + return make_subscriber(cs, observer>(s)); } observable get_observable() const { return make_dynamic_observable([this](subscriber o){ diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index efa84e8..364cd4e 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -74,12 +74,13 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ std::vector> f(n); #endif + auto o = sub.get_subscriber(); + for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub]() { + f[i] = std::async([sub, o]() { auto source = sub.get_observable(); - auto subscription = sub.get_observer(); - while(subscription.is_subscribed()) { + while(o.is_subscribed()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); rx::composite_subscription cs; source.subscribe(cs, [cs](int){ @@ -92,8 +93,6 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ sub.get_observable().subscribe([c](int){++(*c);}); } - auto o = sub.get_observer(); - auto start = clock::now(); for (int i = 0; i < onnextcalls; i++) { o.on_next(i); @@ -114,10 +113,12 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ std::vector> f(n); #endif + auto o = sub.get_subscriber(); + for (int i = 0; i < n; i++) { #if RXCPP_SUBJECT_TEST_ASYNC - f[i] = std::async([sub]() { - while(sub.get_observer().is_subscribed()) { + f[i] = std::async([sub, o]() { + while(o.is_subscribed()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); rx::composite_subscription cs; sub.get_observable().subscribe(cs, [cs](int){ @@ -133,8 +134,6 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ .subscribe([c](int){++(*c);}); } - auto o = sub.get_observer(); - auto start = clock::now(); rxs::range(0, onnextcalls).subscribe(o); auto finish = clock::now(); @@ -180,13 +179,14 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ WHEN("multicasting an infinite source"){ + auto o = s.get_subscriber(); sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ s = rxsub::subject(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ - xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ - s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ + xs.subscribe(o); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ + o.unsubscribe(); return rxsc::make_action_empty();}); sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); @@ -272,13 +272,14 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ WHEN("multicasting an infinite source"){ + auto o = s.get_subscriber(); sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ s = rxsub::subject(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ - xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ - s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ + xs.subscribe(o); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ + o.unsubscribe(); return rxsc::make_action_empty();}); sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); @@ -368,12 +369,14 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ WHEN("multicasting an infinite source"){ + auto o = s.get_subscriber(); + sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ s = rxsub::subject(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &s](rxsc::action, rxsc::scheduler){ - xs.subscribe(s.get_observer()); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&s](rxsc::action, rxsc::scheduler){ - s.get_observer().unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ + xs.subscribe(o); return rxsc::make_action_empty();}); + sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ + o.unsubscribe(); return rxsc::make_action_empty();}); sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); -- GitLab From c1d02264d81b361aa131b3a6a9a4dc0b71b70ab8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Mar 2014 07:59:42 -0700 Subject: [PATCH 225/782] add variadic versions of make_... --- Rx/v2/src/rxcpp/rx-observer.hpp | 16 ++++ Rx/v2/src/rxcpp/rx-subscriber.hpp | 8 ++ Rx/v2/src/rxcpp/rx-util.hpp | 117 +++++++++++++++++++++++++++++- 3 files changed, 140 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index f3e5181..6f3650c 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -446,6 +446,13 @@ struct tag_observer_set } +#if RXCPP_USE_VARIADIC_TEMPLATES +template +auto make_observer(Arg0&& a0, ArgN&&... an) + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...)); +} +#else template auto make_observer(Arg0&& a0) -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { @@ -466,7 +473,15 @@ auto make_observer(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } +#endif +#if RXCPP_USE_VARIADIC_TEMPLATES +template +auto make_observer_dynamic(Arg0&& a0, ArgN&&... an) + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...)); +} +#else template auto make_observer_dynamic(Arg0&& a0) -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { @@ -487,6 +502,7 @@ auto make_observer_dynamic(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } +#endif } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 7bca7ad..0fdbbce 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -262,6 +262,13 @@ struct tag_subscriber_set } +#if RXCPP_USE_VARIADIC_TEMPLATES +template +auto make_subscriber(Arg0&& a0, ArgN&&... an) + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(an)...))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(an)...)); +} +#else template auto make_subscriber(Arg0&& a0) -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0)))) { @@ -292,6 +299,7 @@ auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5 -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } +#endif } diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index fa6efe9..71d75c7 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -198,6 +198,69 @@ private: Function* function; }; +#if RXCPP_USE_VARIADIC_TEMPLATES + +namespace detail { + +template +struct select_arg +{ + template + static auto get(GArg&&, GArgN&&... gan) + -> decltype(select_arg::get(std::forward(gan)...)) { + return select_arg::get(std::forward(gan)...); + } +}; +template +struct select_arg +{ + template + static auto get(GArg&& ga, GArgN&&...) + -> decltype(std::forward(ga)) { + return std::forward(ga); + } +}; + +} + +template class Predicate, class Default, class... ArgN> +struct arg_resolver_n; + +template class Predicate, class Default, class Arg, class... ArgN> +struct arg_resolver_n +{ + static const int n = N; + static const bool is_arg = true; + typedef Arg result_type; + typedef arg_resolver_n this_type; + typedef arg_resolver_n next_type; + typedef typename std::conditional::value, this_type, typename next_type::type>::type type; + result_type value; + template + arg_resolver_n(CArgN&&... can) + : value(detail::select_arg::get(std::forward(can)...)) { + } +}; + +template class Predicate, class Default> +struct arg_resolver_n +{ + static const int n = -1; + static const bool is_arg = false; + typedef Default result_type; + typedef arg_resolver_n this_type; + typedef this_type type; + result_type value; + template + struct select_arg + { + }; + template + arg_resolver_n(CArgN&&...) + : value() { + } +}; +#else template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> struct arg_resolver_n; @@ -310,16 +373,32 @@ struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 : value() { } }; +#endif +#if RXCPP_USE_VARIADIC_TEMPLATES +template class Predicate, class Default, class... ArgN> +struct arg_resolver +{ + typedef typename arg_resolver_n::type...>::type type; +}; +#else struct tag_unresolvable {}; template class Predicate, class Default, class Arg0 = tag_unresolvable, class Arg1 = tag_unresolvable, class Arg2 = tag_unresolvable, class Arg3 = tag_unresolvable, class Arg4 = tag_unresolvable, class Arg5 = tag_unresolvable> struct arg_resolver { typedef typename arg_resolver_n<5, Predicate, Default, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type>::type type; }; +#endif - +#if RXCPP_USE_VARIADIC_TEMPLATES +template class Predicate, class Default, + class... ArgN> +auto resolve_arg(ArgN&&... an) +-> decltype(typename arg_resolver::type(std::forward(an)...)) { + return typename arg_resolver::type(std::forward(an)...); +} +#else template class Predicate, class Default> auto resolve_arg() -> decltype(typename arg_resolver::type(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { @@ -377,6 +456,7 @@ auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a return typename arg_resolver::type( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); } +#endif struct arg_resolver_term {}; @@ -404,6 +484,17 @@ template struct arg_resolver_set { typedef arg_resolver_set next_set; +#if RXCPP_USE_VARIADIC_TEMPLATES + template + auto operator()(ArgN&&... an) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(an)...)), + next_set()(std::forward(an)...))) { + return std::tuple_cat( + std::make_tuple(resolve_arg(std::forward(an)...)), + next_set()(std::forward(an)...)); + } +#else inline auto operator()() -> decltype(std::tuple_cat( std::make_tuple(resolve_arg()), @@ -466,8 +557,15 @@ struct arg_resolver_set std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } +#endif }; +#if RXCPP_USE_VARIADIC_TEMPLATES +template +inline std::tuple<> resolve_arg_set(arg_resolver_term&&, ArgN&&... ) { + return std::tuple<>(); +} +#else inline std::tuple<> resolve_arg_set(arg_resolver_term&&) { return std::tuple<>(); } @@ -501,7 +599,23 @@ template inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& , Arg4&& , Arg5&& ) { return std::tuple<>(); } +#endif +#if RXCPP_USE_VARIADIC_TEMPLATES +template +auto resolve_arg_set(Tag&&, ArgN&&... an) + -> decltype(std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(an)...)), + resolve_arg_set(typename Tag::next_tag(), + std::forward(an)...))) { + return std::tuple_cat( + std::make_tuple(resolve_arg( + std::forward(an)...)), + resolve_arg_set(typename Tag::next_tag(), + std::forward(an)...)); +} +#else template auto resolve_arg_set(Tag&&) -> decltype(std::tuple_cat( @@ -589,6 +703,7 @@ auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a resolve_arg_set(typename Tag::next_tag(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } +#endif } -- GitLab From babf204eebab2a9a3ed525e6a68d8af212fa4cb0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Mar 2014 08:26:14 -0700 Subject: [PATCH 226/782] remove subscription from observer --- Rx/v2/src/rxcpp/rx-observer.hpp | 166 ++++--------------------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 37 +++--- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 57 ++++----- Rx/v2/test/subjects/subject.cpp | 24 ++-- Rx/v2/test/subscriptions/observer.cpp | 40 +----- 5 files changed, 79 insertions(+), 245 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 6f3650c..0aee374 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -11,61 +11,11 @@ namespace rxcpp { template -struct observer_root : public subscription_base +struct observer_base { typedef T value_type; - typedef composite_subscription subscription_type; - typedef typename subscription_type::weak_subscription weak_subscription; typedef tag_observer observer_tag; }; -template -struct observer_base : public observer_root -{ -private: - typedef observer_base this_type; - - mutable typename this_type::subscription_type s; - -public: - observer_base() - { - } - observer_base(typename this_type::subscription_type s) - : s(std::move(s)) - { - } - observer_base(const observer_base& o) - : s(o.s) - { - } - observer_base(observer_base&& o) - : s(std::move(o.s)) - { - } - observer_base& operator=(observer_base o) { - swap(o); - return *this; - } - void swap(observer_base& o) { - using std::swap; - swap(s, o.s); - } - const typename this_type::subscription_type& get_subscription() const { - return s; - } - bool is_subscribed() const { - return s.is_subscribed(); - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - return s.add(std::move(ds)); - } - void remove(typename this_type::weak_subscription ws) const { - s.remove(ws); - } - void unsubscribe() const { - s.unsubscribe(); - } -}; namespace detail { template @@ -143,9 +93,8 @@ public: } template - dynamic_observer(composite_subscription cs, OnNext&& n, OnError&& e, OnCompleted&& c) - : base_type(std::move(cs)) - , onnext(std::forward(n)) + dynamic_observer(OnNext&& n, OnError&& e, OnCompleted&& c) + : onnext(std::forward(n)) , onerror(std::forward(e)) , oncompleted(std::forward(c)) { @@ -163,7 +112,6 @@ public: } void swap(dynamic_observer& o) { using std::swap; - observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -205,23 +153,20 @@ public: static_assert(detail::is_on_error::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); static_assert(detail::is_on_completed::value, "Function supplied for on_completed must be a function with the signature void();"); - explicit static_observer(composite_subscription cs, on_next_t n, on_error_t e, on_completed_t c) - : observer_base(std::move(cs)) - , onnext(std::move(n)) + explicit static_observer(on_next_t n, on_error_t e, on_completed_t c) + : onnext(std::move(n)) , onerror(std::move(e)) , oncompleted(std::move(c)) { } static_observer(const this_type& o) - : observer_base(o) - , onnext(o.onnext) + : onnext(o.onnext) , onerror(o.onerror) , oncompleted(o.oncompleted) { } static_observer(this_type&& o) - : observer_base(std::move(o)) - , onnext(std::move(o.onnext)) + : onnext(std::move(o.onnext)) , onerror(std::move(o.onerror)) , oncompleted(std::move(o.oncompleted)) { @@ -232,7 +177,6 @@ public: } void swap(this_type& o) { using std::swap; - observer_base::swap(o); swap(onnext, o.onnext); swap(onerror, o.onerror); swap(oncompleted, o.oncompleted); @@ -250,26 +194,11 @@ public: }; template -class observer : public observer_root +class observer : public observer_base { typedef observer this_type; typedef typename std::conditional::value, typename std::decay::type, dynamic_observer>::type inner_t; - struct detacher - { - ~detacher() - { - if (that) { - that->unsubscribe(); - } - } - detacher(const observer* that) - : that(that) - { - } - const observer* that; - }; - inner_t inner; public: ~observer() @@ -283,42 +212,17 @@ public: { } void on_next(T t) const { - if (is_subscribed()) { - detacher protect(this); - inner.on_next(std::move(t)); - protect.that = nullptr; - } + inner.on_next(std::move(t)); } void on_error(std::exception_ptr e) const { - if (is_subscribed()) { - detacher protect(this); - inner.on_error(e); - } + inner.on_error(e); } void on_completed() const { - if (is_subscribed()) { - detacher protect(this); - inner.on_completed(); - } - } - const typename this_type::subscription_type& get_subscription() const { - return inner.get_subscription(); - } - bool is_subscribed() const { - return inner.is_subscribed(); - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - return inner.add(std::move(ds)); - } - void remove(typename this_type::weak_subscription ws) const { - inner.remove(ws); - } - void unsubscribe() const { - inner.unsubscribe(); + inner.on_completed(); } }; template -class observer : public observer_root +class observer : public observer_base { typedef observer this_type; public: @@ -331,22 +235,6 @@ public: } void on_completed() const { } - const typename this_type::subscription_type& get_subscription() const { - static typename this_type::subscription_type result; - result.unsubscribe(); - return result; - } - bool is_subscribed() const { - return false; - } - typename this_type::weak_subscription add(dynamic_subscription ds) const { - ds.unsubscribe(); - return typename this_type::weak_subscription(); - } - void remove(typename this_type::weak_subscription) const { - } - void unsubscribe() const { - } }; template @@ -359,8 +247,8 @@ namespace detail { template auto make_observer_resolved(ResolvedArgSet&& rs) - -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { - return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); + -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { + return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); } template auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) @@ -373,14 +261,13 @@ auto make_observer_resolved(ResolvedArgSet&& rs) -> observer { typedef I inner_type; return observer(inner_type( - std::get<0>(std::forward(rs)).value, + std::move(std::get<0>(std::forward(rs)).value), std::move(std::get<1>(std::forward(rs)).value), - std::move(std::get<2>(std::forward(rs)).value), - std::move(std::get<3>(std::forward(rs)).value))); + std::move(std::get<2>(std::forward(rs)).value))); - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; static_assert(rn_t::is_arg, "onnext is a required parameter"); static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); @@ -388,16 +275,6 @@ auto make_observer_resolved(ResolvedArgSet&& rs) static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } -struct tag_subscription_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - typedef composite_subscription default_type; -}; - template struct tag_onnext_resolution { @@ -436,10 +313,9 @@ struct tag_oncompleted_resolution template struct tag_observer_set - : public rxu::detail::tag_set, + : public rxu::detail::tag_set, rxu::detail::tag_set>>> + rxu::detail::tag_set>> { }; diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 0fdbbce..72c9133 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -10,7 +10,7 @@ namespace rxcpp { template -struct subscriber_base : public observer_root, public subscription_base, public resumption_base +struct subscriber_base : public observer_base, public subscription_base, public resumption_base { typedef tag_subscriber subscriber_tag; }; @@ -148,9 +148,6 @@ struct observer_selector template static auto get_observer(Set&& rs) -> decltype(make_observer_resolved(std::forward(rs))) { - if (!std::get<0>(std::forward(rs)).value.is_subscribed()) { - abort(); - } return make_observer_resolved(std::forward(rs)); } }; @@ -166,16 +163,13 @@ struct observer_selector template auto select_observer(ResolvedArgSet&& rs) - -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { - if (!std::get<0>(std::forward(rs)).value.is_subscribed()) { - abort(); - } - return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); + -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { + return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); typedef typename std::decay(std::forward(rs)))>::type rr_t; - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; + typedef typename std::decay(std::forward(rs)))>::type rn_t; + typedef typename std::decay(std::forward(rs)))>::type re_t; + typedef typename std::decay(std::forward(rs)))>::type rc_t; typedef typename std::decay(std::forward(rs)))>::type ro_t; typedef typename std::decay(std::forward(rs)))>::type rs_t; @@ -187,10 +181,7 @@ template auto make_subscriber_resolved(ResolvedArgSet&& rsArg) -> subscriber(std::move(rsArg)))> { const auto rs = std::forward(rsArg); - if (!std::get<0>(rs).value.is_subscribed()) { - abort(); - } - const auto rsub = std::get<0>(rs); + const auto rsub = std::get<3>(rs); const auto rr = std::get<4>(rs); const auto rscrbr = std::get<6>(rs); const auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : rr.value; @@ -207,6 +198,16 @@ auto make_subscriber_resolved(ResolvedArgSet&& rsArg) #endif } +struct tag_subscription_resolution +{ + template + struct predicate + { + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; + }; + typedef composite_subscription default_type; +}; + template struct tag_subscriber_resolution { @@ -250,10 +251,10 @@ struct tag_resumption_resolution template struct tag_subscriber_set // the first four must be the same as tag_observer_set or the indexing will fail - : public rxu::detail::tag_set, + : public rxu::detail::tag_set, rxu::detail::tag_set, rxu::detail::tag_set>>>>>>> diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index cd3b7ff..60dcff9 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -164,9 +164,6 @@ public: return make_cold_observable(rxu::to_vector(arr)); } - template - rxt::testable_observer make_observer(); - template subscriber> make_subscriber(); }; @@ -216,40 +213,32 @@ public: }; template -rxt::testable_observer test::make_observer() +subscriber> test::make_subscriber() { typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - - std::shared_ptr> ts(new mock_observer( - std::static_pointer_cast(shared_from_this()))); - - return rxt::testable_observer(ts, make_observer_dynamic( - // on_next - [ts](T value) - { - ts->m.push_back( - recorded_type(ts->sc->clock(), notification_type::on_next(value))); - }, - // on_error - [ts](std::exception_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 -subscriber> test::make_subscriber() -{ - auto to = this->make_observer(); - return rxcpp::make_subscriber(to.get_subscription(), to); + + std::shared_ptr> ts(new mock_observer(std::static_pointer_cast(shared_from_this()))); + + return rxcpp::make_subscriber(rxt::testable_observer(ts, make_observer_dynamic( + // on_next + [ts](T value) + { + ts->m.push_back( + recorded_type(ts->sc->clock(), notification_type::on_next(value))); + }, + // on_error + [ts](std::exception_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 diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 364cd4e..353c6dc 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -264,11 +264,11 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc->make_observer(); + auto results1 = sc->make_subscriber(); - auto results2 = sc->make_observer(); + auto results2 = sc->make_subscriber(); - auto results3 = sc->make_observer(); + auto results3 = sc->make_subscriber(); WHEN("multicasting an infinite source"){ @@ -306,7 +306,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ m::on_next(520, 7) }; auto required = rxu::to_vector(items); - auto actual = results1.messages(); + auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } @@ -317,7 +317,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ m::on_completed(630) }; auto required = rxu::to_vector(items); - auto actual = results2.messages(); + auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } @@ -326,7 +326,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ m::on_completed(900) }; auto required = rxu::to_vector(items); - auto actual = results3.messages(); + auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } @@ -360,11 +360,11 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc->make_observer(); + auto results1 = sc->make_subscriber(); - auto results2 = sc->make_observer(); + auto results2 = sc->make_subscriber(); - auto results3 = sc->make_observer(); + auto results3 = sc->make_subscriber(); WHEN("multicasting an infinite source"){ @@ -403,7 +403,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ m::on_next(520, 7) }; auto required = rxu::to_vector(items); - auto actual = results1.messages(); + auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } @@ -414,7 +414,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ m::on_error(630, ex) }; auto required = rxu::to_vector(items); - auto actual = results2.messages(); + auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } @@ -423,7 +423,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ m::on_error(900, ex) }; auto required = rxu::to_vector(items); - auto actual = results3.messages(); + auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 42caf7b..34ce458 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -127,15 +127,14 @@ SCENARIO("observers with subscription traits", "[observer][subscription][traits] } } -SCENARIO("observer behavior", "[observer][traits]"){ - GIVEN("given some observer types"){ +SCENARIO("subscriber behavior", "[observer][traits]"){ + GIVEN("given some subscriber types"){ int result = 0; auto next = [&result](int i){result += i;}; auto error = [&result](std::exception_ptr){result += 10;}; auto completed = [&result](){result += 100;}; - auto dob = rx::make_observer_dynamic(next, error, completed); - auto so = rx::make_observer(next, error, completed); - auto eo = rx::make_observer(); + auto dob = rx::make_subscriber(rx::make_observer_dynamic(next, error, completed)); + auto so = rx::make_subscriber(next, error, completed); WHEN("nothing is called"){ THEN("dynamic_observer result is 0"){ REQUIRE(result == 0); @@ -152,9 +151,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ THEN("static_observer is subscribed"){ REQUIRE(so.is_subscribed()); } - THEN("observer is subscribed"){ - REQUIRE(!eo.is_subscribed()); - } } WHEN("onnext is called with 1"){ THEN("dynamic_observer result is 1"){ @@ -165,10 +161,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(result == 1); } - THEN("observer result is 0"){ - eo.on_next(1); - REQUIRE(result == 0); - } THEN("dynamic_observer is subscribed"){ dob.on_next(1); REQUIRE(dob.is_subscribed()); @@ -177,10 +169,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(so.is_subscribed()); } - THEN("observer is not subscribed"){ - eo.on_next(1); - REQUIRE(!eo.is_subscribed()); - } } WHEN("onnext is called with 1 after error"){ THEN("dynamic_observer result is 10"){ @@ -193,11 +181,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(result == 10); } - THEN("observer result is 0"){ - eo.on_error(std::current_exception()); - eo.on_next(1); - REQUIRE(result == 0); - } THEN("dynamic_observer is not subscribed"){ dob.on_error(std::current_exception()); dob.on_next(1); @@ -208,11 +191,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(!so.is_subscribed()); } - THEN("observer is not subscribed"){ - eo.on_error(std::current_exception()); - eo.on_next(1); - REQUIRE(!eo.is_subscribed()); - } } WHEN("onnext is called with 1 after completed"){ THEN("dynamic_observer result is 100"){ @@ -225,11 +203,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(result == 100); } - THEN("observer result is 0"){ - eo.on_completed(); - eo.on_next(1); - REQUIRE(result == 0); - } THEN("dynamic_observer is not subscribed"){ dob.on_completed(); dob.on_next(1); @@ -240,11 +213,6 @@ SCENARIO("observer behavior", "[observer][traits]"){ so.on_next(1); REQUIRE(!so.is_subscribed()); } - THEN("observer is not subscribed"){ - eo.on_completed(); - eo.on_next(1); - REQUIRE(!eo.is_subscribed()); - } } } } -- GitLab From 550cfb42b2e524c0b438634b805d7924b0156025 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Mar 2014 15:52:38 -0700 Subject: [PATCH 227/782] test fixes --- Rx/v2/test/subjects/subject.cpp | 13 ++++++------- Rx/v2/test/subscriptions/observer.cpp | 20 -------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 353c6dc..620863a 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -181,8 +181,8 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ xs.subscribe(o); return rxsc::make_action_empty();}); sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ @@ -274,8 +274,8 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ xs.subscribe(o); return rxsc::make_action_empty();}); sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ @@ -368,11 +368,10 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ WHEN("multicasting an infinite source"){ - auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ + s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ xs.subscribe(o); return rxsc::make_action_empty();}); sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 34ce458..1bed6b6 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -107,26 +107,6 @@ SCENARIO("non-observer traits", "[observer][traits]"){ } } -SCENARIO("observers with subscription traits", "[observer][subscription][traits]"){ - GIVEN("given some observer types"){ - auto emptyNext = [](int){}; - auto dob = rx::make_observer_dynamic(emptyNext); - auto so = rx::make_observer(emptyNext); - auto eo = rx::make_observer(); - WHEN("tested"){ - THEN("is_subscription value is true for dynamic_observer"){ - REQUIRE(rx::is_subscription::value); - } - THEN("is_subscription value is true for static_observer"){ - REQUIRE(rx::is_subscription::value); - } - THEN("is_subscription value is true for observer"){ - REQUIRE(rx::is_subscription::value); - } - } - } -} - SCENARIO("subscriber behavior", "[observer][traits]"){ GIVEN("given some subscriber types"){ int result = 0; -- GitLab From 9939674948d96ce1d1492fcb442c23e64c3a4de5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 20 Mar 2014 16:00:34 -0700 Subject: [PATCH 228/782] add support for operator | and well as operator >> --- Rx/v2/src/rxcpp/rx-observable.hpp | 14 ++++++++++++++ Rx/v2/src/rxcpp/rx-test.hpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index ced294b..5c646ca 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -305,10 +305,24 @@ public: } +// +// support range() >> filter() >> subscribe() syntax +// '>>' is spelled 'stream' +// template auto operator >> (const rxcpp::observable& source, OperatorFactory&& of) -> decltype(source.op(std::forward(of))) { return source.op(std::forward(of)); } +// +// support range() | filter() | subscribe() syntax +// '|' is spelled 'pipe' +// +template +auto operator | (const rxcpp::observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} + #endif diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index e519cf8..4038eb7 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -121,12 +121,26 @@ namespace rxt=test; } +// +// support range() >> filter() >> subscribe() syntax +// '>>' is spelled 'stream' +// template auto operator >> (const rxcpp::test::testable_observable& source, OperatorFactory&& of) -> decltype(source.op(std::forward(of))) { return source.op(std::forward(of)); } +// +// support range() | filter() | subscribe() syntax +// '|' is spelled 'pipe' +// +template +auto operator | (const rxcpp::test::testable_observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} + #include "schedulers/rx-test.hpp" #endif -- GitLab From 7bf5176350f3b8d34d9af255dd74b651c3bf3c6a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 22 Mar 2014 12:20:40 -0700 Subject: [PATCH 229/782] start switch to schedulable --- Rx/v2/src/rxcpp/rx-predef.hpp | 40 ++ Rx/v2/src/rxcpp/rx-scheduler.hpp | 589 ++++++++++++++++++++++++---- Rx/v2/src/rxcpp/rx-subscriber.hpp | 59 ++- Rx/v2/src/rxcpp/rx-subscription.hpp | 47 +++ 4 files changed, 629 insertions(+), 106 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 5779f79..18c356d 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -9,6 +9,46 @@ namespace rxcpp { +struct tag_action {}; +template +class is_action +{ + struct not_void {}; + template + static typename C::action_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_action*>::value; +}; + +struct tag_scheduler {}; +template +class is_scheduler +{ + struct not_void {}; + template + static typename C::scheduler_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_scheduler*>::value; +}; + +struct tag_schedulable {}; +template +class is_schedulable +{ + struct not_void {}; + template + static typename C::schedulable_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_schedulable*>::value; +}; + + template class dynamic_observer; diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 7ebc2cb..98f2f9e 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -11,139 +11,582 @@ namespace rxcpp { namespace schedulers { +namespace detail { + class action_type; -typedef std::shared_ptr action; +typedef std::shared_ptr action_ptr; -class scheduler_base; -typedef std::shared_ptr scheduler; +class scheduler_interface; +typedef std::shared_ptr scheduler_interface_ptr; -class action_type - : public subscription_base - , public std::enable_shared_from_this +} + +struct action_base { - typedef action_type this_type; + typedef tag_action action_tag; +}; + +struct scheduler_base +{ + typedef tag_scheduler scheduler_tag; +}; + +class scheduler_interface + : public std::enable_shared_from_this +{ + typedef scheduler_interface this_type; public: - typedef composite_subscription subscription_type; - typedef subscription_type::weak_subscription weak_subscription; - typedef std::function function_type; + typedef std::chrono::steady_clock clock_type; -private: - mutable this_type::subscription_type s; - function_type f; + virtual ~scheduler_interface() {} + + virtual clock_type::time_point now() const = 0; + + virtual bool is_tail_recursion_allowed() const = 0; + + virtual void schedule(composite_subscription cs, action a) const = 0; + virtual void schedule(clock_type::duration when, composite_subscription cs, action a) const = 0; + virtual void schedule(clock_type::time_point when, composite_subscription cs, action a) const = 0; +}; + + +struct schedulable_base : public subscription_base, public scheduler_base, public action_base +{ + typedef tag_schedulable schedulable_tag; +}; + +class schedulable; - static action shared_empty; +namespace action_duration { + enum type { + invalid, + runs_short, + runs_long + }; +} +class action : public action_base +{ + typedef action this_type; + detail::action_ptr inner; + static detail::action_ptr shared_empty; + friend bool operator==(const action&, const action&); public: - action_type() + action() + { + } + explicit action(detail::action_ptr i) + : inner(std::move(i)) { - s.unsubscribe(); } - explicit action_type(function_type f) - : f(std::move(f)) + inline static action empty() { + return action(shared_empty); + } + + inline action_duration::type get_duration() const { + return inner->get_duration(); + } + + inline void operator()(const schedulable& s) const; +}; + +//static +RXCPP_SELECT_ANY detail::action_ptr action::shared_empty = std::make_shared(); + +inline bool operator==(const action& lhs, const action& rhs) { + return lhs.inner == rhs.inner; +} +inline bool operator!=(const action& lhs, const action& rhs) { + return !(lhs == rhs); +} + +class scheduler : public scheduler_base +{ + typedef scheduler this_type; + detail::scheduler_interface_ptr inner; + friend bool operator==(const scheduler&, const scheduler&); +public: + typedef std::chrono::steady_clock clock_type; + + scheduler() { - if (!this->f) { - s.unsubscribe(); - } } - action_type(this_type::subscription_type s, function_type f) - : s(std::move(s)) - , f(std::move(f)) + explicit scheduler(detail::scheduler_interface_ptr i) + : inner(std::move(i)) { - if (!this->f) { - this->s.unsubscribe(); - } } - inline static action empty() { - return shared_empty; + inline clock_type::time_point now() const { + return inner->now(); } - inline action operator()(scheduler sc) { - if (is_subscribed() && f) { - return f(this->shared_from_this(), std::move(sc)); + inline bool is_tail_recursion_allowed() const { + return inner->is_tail_recursion_allowed(); + } + + inline void schedule(composite_subscription cs, action a) const { + inner->schedule(std::move(cs), std::move(a)); + } + inline void schedule(clock_type::duration when, composite_subscription cs, action a) const { + inner->schedule(when, std::move(cs), std::move(a)); + } + inline void schedule(clock_type::time_point when, composite_subscription cs, action a) const { + inner->schedule(when, std::move(cs), std::move(a)); + } +}; + +inline bool operator==(const scheduler& lhs, const scheduler& rhs) { + return lhs.inner == rhs.inner; +} +inline bool operator!=(const scheduler& lhs, const scheduler& rhs) { + return !(lhs == rhs); +} + +class schedulable : public schedulable_base +{ + typedef schedulable this_type; + + composite_subscription lifetime; + scheduler controller; + action activity; + + struct detacher + { + ~detacher() + { + if (that) { + that->unsubscribe(); + } + } + detacher(const this_type* that) + : that(that) + { } - return empty(); + const this_type* that; + }; + +public: + typedef typename composite_subscription::weak_subscription weak_subscription; + typedef typename composite_subscription::shared_subscription shared_subscription; + typedef std::chrono::steady_clock clock_type; + + schedulable() + { + } + schedulable(composite_subscription cs, scheduler q, action a) + : lifetime(std::move(cs)) + , controller(std::move(q)) + , activity(std::move(a)) + { } + inline const composite_subscription& get_subscription() const { + return lifetime; + } + inline composite_subscription& get_subscription() { + return lifetime; + } + inline const scheduler& get_scheduler() const { + return controller; + } + inline scheduler& get_scheduler() { + return controller; + } + inline const action& get_action() const { + return activity; + } + inline action& get_action() { + return activity; + } + + inline static schedulable empty() { + return schedulable(composite_subscription::empty(), controller, action::empty()); + } + + // composite_subscription + // inline bool is_subscribed() const { - return s.is_subscribed(); + return lifetime.is_subscribed(); } - inline this_type::weak_subscription add(dynamic_subscription ds) const { - return s.add(std::move(ds)); + inline weak_subscription add(shared_subscription s) const { + return lifetime.add(std::move(s)); } - inline void remove(this_type::weak_subscription ws) const { - s.remove(ws); + inline weak_subscription add(dynamic_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 { - s.unsubscribe(); + return lifetime.unsubscribe(); + } + + // scheduler + // + inline clock_type::time_point now() const { + return controller.now(); + } + inline bool is_tail_recursion_allowed() const { + return controller.is_tail_recursion_allowed(); + } + inline void schedule() const { + controller.schedule(lifetime, activity); + } + inline void schedule(clock_type::duration when) const { + controller.schedule(when, lifetime, activity); + } + inline void schedule(clock_type::time_point when) const { + controller.schedule(when, lifetime, activity); + } + + // action + // + inline action_duration::type get_duration() const { + return activity.get_duration(); + } + inline void operator()() const { + if (!is_subscribed()) { + abort(); + } + detacher protect(this); + activity(*this); + protect.that = nullptr; } }; -//static -RXCPP_SELECT_ANY action action_type::shared_empty = std::make_shared(); +inline bool operator==(const schedulable& lhs, const schedulable& rhs) { + return lhs.get_action() == rhs.get_action() && + lhs.get_scheduler() == rhs.get_scheduler() && + lhs.get_subscription() == rhs.get_subscription(); +} +inline bool operator!=(const schedulable& lhs, const schedulable& rhs) { + return !(lhs == rhs); +} + + +inline void action::operator()(const schedulable& s) const { + auto next = (*inner)(s); + if (next.is_subscribed()) { + next.schedule(); + } +} + + +namespace detail { + +class action_type + : public std::enable_shared_from_this +{ + typedef action_type this_type; + +public: + typedef std::function function_type; + +private: + action_duration::type d; + function_type f; + +public: + action_type() + { + } + + action_type(action_duration::type d, function_type f) + : d(d) + , f(std::move(f)) + { + } + + inline action_duration::type get_duration() const { + return d; + } + + inline schedulable operator()(const schedulable& s) { + if (f) { + return f(s); + } + return schedulable::empty(); + } +}; + +} inline action make_action_empty() { return action_type::empty(); } -inline action make_action(action_type::function_type f) { - return std::make_shared(std::move(f)); +template +inline action make_action(F&& f, action_duration::type d = action_duration::runs_short) { + auto fn = std::forward(f); + return action(std::make_shared( + d, + // tail-recurse inside of the virtual function call + // until a new action, lifetime or scheduler is returned + [fn](const schedulable& s) { + auto next = s; + auto last = s; + while (next.is_subscribed() && last == next && next.get_scheduler().is_tail_recursion_allowed()) { + last = next; + next = fn(next); + } + return next; + })); } -inline action make_action(action_type::subscription_type s, action_type::function_type f) { - return std::make_shared(std::move(s), std::move(f)); +template +inline scheduler make_scheduler() { + return scheduler(std::static_pointer_cast(std::make_shared())); } -class scheduler_base - : public std::enable_shared_from_this +namespace detail { + +template +struct is_action_function { - typedef scheduler_base this_type; + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(schedulable*)nullptr)); + template + static not_void check(...); -public: - typedef std::chrono::steady_clock clock_type; + static const bool value = std::is_same::type>(0)), schedulable>::value; +}; - virtual ~scheduler_base() {} +struct tag_action_function_resolution +{ + template + struct predicate + { + static const bool value = is_action_function::value; + }; + typedef detail::action_type::function_type default_type; +}; - virtual clock_type::time_point now() = 0; +struct tag_action_duration_resolution +{ + template + struct predicate + { + static const bool value = std::is_same::type, action_duration::type>::value; + }; + struct default_type { + inline operator action_duration::type() { + return action_duration::runs_short; + } + }; +}; - virtual void schedule(action a) = 0; - virtual void schedule(clock_type::duration when, action a) = 0; - virtual void schedule(clock_type::time_point when, action a) = 0; +struct tag_when_resolution +{ + typedef scheduler_interface::clock_type clock_type; + typedef clock_type::duration duration_type; + typedef clock_type::duration time_point_type; + template + struct predicate + { + typedef typename std::decay::type decayedlhs; + static const bool value = std::is_same::value || + std::is_same::value; + }; + struct default_type { + inline operator time_point_type() { + return clock_type::now(); + } + }; +}; - inline void schedule(action_type::function_type f){ - return schedule(make_action(std::move(f))); - } - inline void schedule(clock_type::duration when, action_type::function_type f){ - return schedule(when, make_action(std::move(f))); - } - inline void schedule(clock_type::time_point when, action_type::function_type f){ - return schedule(when, make_action(std::move(f))); - } - inline void schedule(action_type::subscription_type s, action_type::function_type f){ - return schedule(make_action(std::move(s), std::move(f))); +struct tag_schedulable_resolution +{ + template + struct predicate : public is_schedulable + { + }; + typedef schedulable default_type; +}; + +struct tag_action_resolution +{ + template + struct predicate + { + static const bool value = !is_schedulable::value && is_action::value; + }; + typedef action default_type; +}; + +struct tag_scheduler_resolution +{ + template + struct predicate + { + static const bool value = !is_schedulable::value && is_scheduler::value; + }; + typedef scheduler default_type; +}; + + +template +struct tag_schedulable_set + // the first four must be the same as tag_observer_set or the indexing will fail + : public rxu::detail::tag_set, + rxu::detail::tag_set, + rxu::detail::tag_set>>>>>> +{ +}; + +template +struct action_selector; + +template +struct action_selector +{ + template + static action get_action(Set& rs) { + return std::get<4>(rs).value; } - inline void schedule(clock_type::duration when, action_type::subscription_type s, action_type::function_type f){ - return schedule(when, make_action(std::move(s), std::move(f))); +}; +template +struct action_selector +{ + template + static action get_action(Set& rs) { + return make_action(std::move(std::get<5>(rs).value), std::get<6>(rs).value); } - inline void schedule(clock_type::time_point when, action_type::subscription_type s, action_type::function_type f){ - return schedule(when, make_action(std::move(s), std::move(f))); +}; +template<> +struct action_selector +{ + template + static action get_action(Set& rs) { + return std::get<1>(rs).value.get_action(); } }; +template +action select_action(ResolvedArgSet& rs) + -> decltype(action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs)) { + return action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs); + + typedef typename std::decay(std::forward(rs)))>::type rsc_t; + typedef typename std::decay(std::forward(rs)))>::type raf_t; + typedef typename std::decay(std::forward(rs)))>::type rad_t; + typedef typename std::decay(std::forward(rs)))>::type ra_t; + typedef typename std::decay(std::forward(rs)))>::type rscbl_t; + + static_assert(rscbl_t::is_arg || ra_t::is_arg || raf_t::is_arg, "at least one of; action_function, action or schedulable is required"); + static_assert(int(ra_t::is_arg) + int(raf_t::is_arg) < 2, "action_function not allowed with an action"); + static_assert(int(ra_t::is_arg) + int(rad_t::is_arg) < 2, "action_duration not allowed with an action"); +} + +template +schedulable make_schedulable_resolved(ResolvedArgSet&& rsArg) { + const auto rs = std::forward(rsArg); + const auto rsub = std::get<2>(rs); + const auto rsc = std::get<3>(rs); + const auto rscbl = std::get<1>(rs); + const auto sc = (rscbl.is_arg && !rsc.is_arg) ? rscrbr.value.get_scheduler() : rsc.value; + const auto sub = (rscbl.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; + return schedulable(sub, sc, select_action(rs)); + + typedef typename std::decay(std::forward(rs)))>::type rw_t; + typedef typename std::decay(std::forward(rs)))>::type rsc_t; + typedef typename std::decay(std::forward(rs)))>::type rscbl_t; + + static_assert(when_invalid || !rw_t::is_arg, "when is an invalid parameter"); + static_assert(rscbl_t::is_arg || rsc_t::is_arg, "at least one of; scheduler or schedulable is required"); +} + +template +schedulable schedule_resolved(ResolvedArgSet&& rsArg) { + schedulable result = make_schedulable_resolved(std::forward(rsArg)); + const auto rw = std::get<0>(rs); + if (rx.is_arg) { + result.schedule(rw.value); + } else { + result.schedule(); + } + return result; +} + +} + +#if RXCPP_USE_VARIADIC_TEMPLATES +template +schedulable make_schedulable(Arg0&& a0, ArgN&&... an) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); +} +#else +template +schedulable make_schedulable(Arg0&& a0) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); +} +template +schedulable make_schedulable(Arg0&& a0, Arg1&& a1) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); +} +template +schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); +} +template +schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); +} +template +schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) { + return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); +} +#endif + +#if RXCPP_USE_VARIADIC_TEMPLATES +template +schedulable schedule(Arg0&& a0, ArgN&&... an) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); +} +#else +template +schedulable schedule(Arg0&& a0) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); +} +template +schedulable schedule(Arg0&& a0, Arg1&& a1) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); +} +template +schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); +} +template +schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); +} +template +schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) { + detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); +} +#endif + namespace detail { template -struct time_action +struct time_schedulable { - time_action(TimePoint when, action a) + time_schedulable(TimePoint when, schedulable a) : when(when) , a(std::move(a)) { } TimePoint when; - action a; + schedulable a; }; } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 72c9133..9a46cfa 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -86,23 +86,26 @@ public: // observer // void on_next(T t) const { - if (is_subscribed()) { - detacher protect(this); - destination.on_next(std::move(t)); - protect.that = nullptr; + if (!is_subscribed()) { + abort(); } + detacher protect(this); + destination.on_next(std::move(t)); + protect.that = nullptr; } void on_error(std::exception_ptr e) const { - if (is_subscribed()) { - detacher protect(this); - destination.on_error(e); + if (!is_subscribed()) { + abort(); } + detacher protect(this); + destination.on_error(e); } void on_completed() const { - if (is_subscribed()) { - detacher protect(this); - destination.on_completed(); + if (!is_subscribed()) { + abort(); } + detacher protect(this); + destination.on_completed(); } // composite_subscription @@ -137,34 +140,34 @@ template struct observer_selector { template - static auto get_observer(Set&& rs) - -> decltype(std::get<5>(std::forward(rs)).value) { - return std::get<5>(std::forward(rs)).value; + static auto get_observer(Set& rs) + -> decltype(std::get<5>(rs).value) { + return std::get<5>(rs).value; } }; template struct observer_selector { template - static auto get_observer(Set&& rs) - -> decltype(make_observer_resolved(std::forward(rs))) { - return make_observer_resolved(std::forward(rs)); + static auto get_observer(Set& rs) + -> decltype(make_observer_resolved(rs)) { + return make_observer_resolved(rs); } }; template struct observer_selector { template - static auto get_observer(Set&& rs) - -> const decltype( std::get<6>(std::forward(rs)).value.get_observer())& { - return std::get<6>(std::forward(rs)).value.get_observer(); + static auto get_observer(Set& rs) + -> decltype( std::get<6>(rs).value.get_observer()) { + return std::get<6>(rs).value.get_observer(); } }; template -auto select_observer(ResolvedArgSet&& rs) - -> decltype(observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs))) { - return observer_selector(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg, std::decay(std::forward(rs)))>::type::is_arg>::get_observer(std::forward(rs)); +auto select_observer(ResolvedArgSet& rs) + -> decltype(observer_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs)) { + return observer_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs); typedef typename std::decay(std::forward(rs)))>::type rr_t; typedef typename std::decay(std::forward(rs)))>::type rn_t; @@ -187,7 +190,7 @@ auto make_subscriber_resolved(ResolvedArgSet&& rsArg) const auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : rr.value; const auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; return subscriber(std::move(rsArg)))>( - s, r, select_observer(std::move(rs))); + s, r, select_observer(rs)); // at least for now do not enforce resolver #if 0 @@ -198,16 +201,6 @@ auto make_subscriber_resolved(ResolvedArgSet&& rsArg) #endif } -struct tag_subscription_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - typedef composite_subscription default_type; -}; - template struct tag_subscriber_resolution { diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 6adba54..204bef8 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -23,6 +23,20 @@ public: static const bool value = std::is_convertible::type>(0)), tag_subscription>::value; }; +namespace detail { + +struct tag_subscription_resolution +{ + template + struct predicate + { + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; + }; + typedef composite_subscription default_type; +}; + +} + class dynamic_subscription : public subscription_base { typedef std::function unsubscribe_call_type; @@ -139,6 +153,7 @@ public: typedef std::shared_ptr shared_subscription; typedef std::weak_ptr weak_subscription; private: + struct tag_empty {}; struct state_t : public std::enable_shared_from_this { std::vector subscriptions; @@ -150,6 +165,11 @@ private: { } + state_t(tag_empty&&) + : issubscribed(false) + { + } + bool is_subscribed() { return issubscribed; } @@ -217,6 +237,18 @@ private: mutable std::shared_ptr state; + static std::shared_ptr shared_empty; + + composite_subscription(std::shared_ptr s) + : state(std::move(s)) + { + if (!state) { + abort(); + } + } + + friend bool operator==(const composite_subscription&, const composite_subscription&); + public: composite_subscription() @@ -258,6 +290,10 @@ public: return *this; } + static composite_subscription empty() { + return composite_subscription(shared_empty); + } + bool is_subscribed() const { return state->is_subscribed(); } @@ -278,6 +314,17 @@ public: } }; +bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) { + return lhs.state == rhs.state; +} +bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) { + return !(lhs == rhs); +} + +//static +RXCPP_SELECT_ANY std::shared_ptr composite_subscription::shared_empty = std::make_shared(composite_subscription::tag_empty()); + + } #endif -- GitLab From 2f7d4f683a3a1506b85cb2f080c9a58c22b43b15 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 22 Mar 2014 16:14:19 -0700 Subject: [PATCH 230/782] compiles on clang at least. --- Rx/v2/src/rxcpp/rx-observable.hpp | 4 +- Rx/v2/src/rxcpp/rx-regulator.hpp | 14 +- Rx/v2/src/rxcpp/rx-scheduler.hpp | 206 +++++++++--------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 4 +- Rx/v2/src/rxcpp/rx-subscription.hpp | 58 ++--- .../src/rxcpp/schedulers/rx-currentthread.hpp | 68 +++--- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 57 ++--- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 107 ++++----- Rx/v2/src/rxcpp/sources/rx-range.hpp | 6 +- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 12 +- Rx/v2/test/operators/filter.cpp | 15 +- Rx/v2/test/subjects/subject.cpp | 137 ++++++------ Rx/v2/test/subscriptions/observer.cpp | 10 +- 13 files changed, 359 insertions(+), 339 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 5c646ca..ede6c47 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -168,9 +168,9 @@ private: if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); - sc->schedule([=](rxsc::action, rxsc::scheduler) { + schedule(sc, [=](const rxsc::schedulable& scbl) { safe_subscribe(); - return rxsc::make_action_empty(); + return rxsc::schedulable::empty(scbl.get_scheduler()); }); } else { safe_subscribe(); diff --git a/Rx/v2/src/rxcpp/rx-regulator.hpp b/Rx/v2/src/rxcpp/rx-regulator.hpp index 5cb4aff..e8bcdca 100644 --- a/Rx/v2/src/rxcpp/rx-regulator.hpp +++ b/Rx/v2/src/rxcpp/rx-regulator.hpp @@ -9,15 +9,6 @@ namespace rxcpp { -// temp to get compiling -namespace schedulers { - struct schedulable - { - schedulable& operator=(std::nullptr_t) {return *this;}; - void schedule() {} - }; -} - struct tag_resumption {}; struct resumption_base { @@ -96,8 +87,9 @@ public: inline void resume() { state->isresumed = true; auto resumewith = std::move(state->resumewith); - state->resumewith = nullptr; - resumewith.schedule(); + auto local = state->resumewith; + state->resumewith = rxsc::schedulable::empty(local.get_scheduler()); + local.schedule(); } inline resumption get_resumption() { return resumption(state); diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 98f2f9e..e59abbf 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -11,13 +11,15 @@ namespace rxcpp { namespace schedulers { +class scheduler_interface; + namespace detail { class action_type; typedef std::shared_ptr action_ptr; -class scheduler_interface; typedef std::shared_ptr scheduler_interface_ptr; +typedef std::shared_ptr const_scheduler_interface_ptr; } @@ -26,36 +28,6 @@ struct action_base typedef tag_action action_tag; }; -struct scheduler_base -{ - typedef tag_scheduler scheduler_tag; -}; - -class scheduler_interface - : public std::enable_shared_from_this -{ - typedef scheduler_interface this_type; - -public: - typedef std::chrono::steady_clock clock_type; - - virtual ~scheduler_interface() {} - - virtual clock_type::time_point now() const = 0; - - virtual bool is_tail_recursion_allowed() const = 0; - - virtual void schedule(composite_subscription cs, action a) const = 0; - virtual void schedule(clock_type::duration when, composite_subscription cs, action a) const = 0; - virtual void schedule(clock_type::time_point when, composite_subscription cs, action a) const = 0; -}; - - -struct schedulable_base : public subscription_base, public scheduler_base, public action_base -{ - typedef tag_schedulable schedulable_tag; -}; - class schedulable; namespace action_duration { @@ -77,7 +49,7 @@ public: { } explicit action(detail::action_ptr i) - : inner(std::move(i)) + : inner(std::move(i)) { } @@ -85,15 +57,43 @@ public: return action(shared_empty); } - inline action_duration::type get_duration() const { - return inner->get_duration(); - } + inline action_duration::type get_duration() const; inline void operator()(const schedulable& s) const; }; -//static -RXCPP_SELECT_ANY detail::action_ptr action::shared_empty = std::make_shared(); +struct scheduler_base +{ + typedef std::chrono::steady_clock clock_type; + typedef tag_scheduler scheduler_tag; +}; + +class schedulable; + +class scheduler_interface + : public std::enable_shared_from_this +{ + 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 bool is_tail_recursion_allowed() const = 0; + + virtual void schedule(const schedulable& scbl) const = 0; + virtual void schedule(clock_type::duration when, const schedulable& scbl) const = 0; + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const = 0; +}; + + +struct schedulable_base : public subscription_base, public scheduler_base, public action_base +{ + typedef tag_schedulable schedulable_tag; +}; inline bool operator==(const action& lhs, const action& rhs) { return lhs.inner == rhs.inner; @@ -108,7 +108,7 @@ class scheduler : public scheduler_base detail::scheduler_interface_ptr inner; friend bool operator==(const scheduler&, const scheduler&); public: - typedef std::chrono::steady_clock clock_type; + typedef scheduler_base::clock_type clock_type; scheduler() { @@ -117,6 +117,10 @@ public: : inner(std::move(i)) { } + explicit scheduler(detail::const_scheduler_interface_ptr i) + : inner(std::const_pointer_cast(i)) + { + } inline clock_type::time_point now() const { return inner->now(); @@ -126,14 +130,14 @@ public: return inner->is_tail_recursion_allowed(); } - inline void schedule(composite_subscription cs, action a) const { - inner->schedule(std::move(cs), std::move(a)); + inline void schedule(const schedulable& scbl) const { + inner->schedule(scbl); } - inline void schedule(clock_type::duration when, composite_subscription cs, action a) const { - inner->schedule(when, std::move(cs), std::move(a)); + inline void schedule(clock_type::duration when, const schedulable& scbl) const { + inner->schedule(when, scbl); } - inline void schedule(clock_type::time_point when, composite_subscription cs, action a) const { - inner->schedule(when, std::move(cs), std::move(a)); + inline void schedule(clock_type::time_point when, const schedulable& scbl) const { + inner->schedule(when, scbl); } }; @@ -144,6 +148,12 @@ inline bool operator!=(const scheduler& lhs, const scheduler& rhs) { return !(lhs == rhs); } +template +inline scheduler make_scheduler() { + return scheduler(std::static_pointer_cast(std::make_shared())); +} + + class schedulable : public schedulable_base { typedef schedulable this_type; @@ -170,7 +180,7 @@ class schedulable : public schedulable_base public: typedef typename composite_subscription::weak_subscription weak_subscription; typedef typename composite_subscription::shared_subscription shared_subscription; - typedef std::chrono::steady_clock clock_type; + typedef scheduler_base::clock_type clock_type; schedulable() { @@ -201,8 +211,8 @@ public: return activity; } - inline static schedulable empty() { - return schedulable(composite_subscription::empty(), controller, action::empty()); + inline static schedulable empty(scheduler sc) { + return schedulable(composite_subscription::empty(), sc, action::empty()); } // composite_subscription @@ -235,13 +245,13 @@ public: return controller.is_tail_recursion_allowed(); } inline void schedule() const { - controller.schedule(lifetime, activity); + controller.schedule(*this); } inline void schedule(clock_type::duration when) const { - controller.schedule(when, lifetime, activity); + controller.schedule(when, *this); } inline void schedule(clock_type::time_point when) const { - controller.schedule(when, lifetime, activity); + controller.schedule(when, *this); } // action @@ -268,14 +278,7 @@ inline bool operator!=(const schedulable& lhs, const schedulable& rhs) { return !(lhs == rhs); } - -inline void action::operator()(const schedulable& s) const { - auto next = (*inner)(s); - if (next.is_subscribed()) { - next.schedule(); - } -} - +struct current_thread; namespace detail { @@ -310,14 +313,30 @@ public: if (f) { return f(s); } - return schedulable::empty(); + return schedulable::empty(make_scheduler()); } }; } + +inline action_duration::type action::get_duration() const { + return inner->get_duration(); +} + +inline void action::operator()(const schedulable& s) const { + auto next = (*inner)(s); + if (next.is_subscribed()) { + next.schedule(); + } +} + +//static +RXCPP_SELECT_ANY detail::action_ptr action::shared_empty = detail::action_ptr(new detail::action_type()); + + inline action make_action_empty() { - return action_type::empty(); + return action::empty(); } template @@ -338,11 +357,6 @@ inline action make_action(F&& f, action_duration::type d = action_duration::runs })); } -template -inline scheduler make_scheduler() { - return scheduler(std::static_pointer_cast(std::make_shared())); -} - namespace detail { template @@ -375,7 +389,7 @@ struct tag_action_duration_resolution static const bool value = std::is_same::type, action_duration::type>::value; }; struct default_type { - inline operator action_duration::type() { + inline operator action_duration::type() const { return action_duration::runs_short; } }; @@ -385,7 +399,7 @@ struct tag_when_resolution { typedef scheduler_interface::clock_type clock_type; typedef clock_type::duration duration_type; - typedef clock_type::duration time_point_type; + typedef clock_type::time_point time_point_type; template struct predicate { @@ -394,7 +408,7 @@ struct tag_when_resolution std::is_same::value; }; struct default_type { - inline operator time_point_type() { + inline operator time_point_type() const { return clock_type::now(); } }; @@ -430,36 +444,35 @@ struct tag_scheduler_resolution }; -template struct tag_schedulable_set // the first four must be the same as tag_observer_set or the indexing will fail - : public rxu::detail::tag_set, + : public rxu::detail::tag_set, + rxu::detail::tag_set>>>>>> { }; -template +template struct action_selector; -template -struct action_selector +template +struct action_selector { template static action get_action(Set& rs) { return std::get<4>(rs).value; } }; -template -struct action_selector +template +struct action_selector { template static action get_action(Set& rs) { - return make_action(std::move(std::get<5>(rs).value), std::get<6>(rs).value); + return make_action(std::get<5>(rs).value, std::get<6>(rs).value); } }; template<> @@ -472,9 +485,8 @@ struct action_selector }; template -action select_action(ResolvedArgSet& rs) - -> decltype(action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs)) { - return action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs); +action select_action(ResolvedArgSet& rs) { + return action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_action(rs); typedef typename std::decay(std::forward(rs)))>::type rsc_t; typedef typename std::decay(std::forward(rs)))>::type raf_t; @@ -493,23 +505,23 @@ schedulable make_schedulable_resolved(ResolvedArgSet&& rsArg) { const auto rsub = std::get<2>(rs); const auto rsc = std::get<3>(rs); const auto rscbl = std::get<1>(rs); - const auto sc = (rscbl.is_arg && !rsc.is_arg) ? rscrbr.value.get_scheduler() : rsc.value; - const auto sub = (rscbl.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; + const auto sc = (rscbl.is_arg && !rsc.is_arg) ? rscbl.value.get_scheduler() : rsc.value; + const auto sub = (rscbl.is_arg && !rsub.is_arg) ? rscbl.value.get_subscription() : rsub.value; return schedulable(sub, sc, select_action(rs)); - typedef typename std::decay(std::forward(rs)))>::type rw_t; - typedef typename std::decay(std::forward(rs)))>::type rsc_t; - typedef typename std::decay(std::forward(rs)))>::type rscbl_t; + typedef typename std::decay(rs))>::type rw_t; + typedef typename std::decay(rs))>::type rsc_t; + typedef typename std::decay(rs))>::type rscbl_t; static_assert(when_invalid || !rw_t::is_arg, "when is an invalid parameter"); static_assert(rscbl_t::is_arg || rsc_t::is_arg, "at least one of; scheduler or schedulable is required"); } -template +template schedulable schedule_resolved(ResolvedArgSet&& rsArg) { + const auto rw = std::get<0>(rsArg); schedulable result = make_schedulable_resolved(std::forward(rsArg)); - const auto rw = std::get<0>(rs); - if (rx.is_arg) { + if (rw.is_arg) { result.schedule(rw.value); } else { result.schedule(); @@ -550,28 +562,28 @@ schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& #if RXCPP_USE_VARIADIC_TEMPLATES template schedulable schedule(Arg0&& a0, ArgN&&... an) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); } #else template schedulable schedule(Arg0&& a0) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); } template schedulable schedule(Arg0&& a0, Arg1&& a1) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); } template schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); } template schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } template schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) { - detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); + return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } #endif @@ -582,11 +594,11 @@ struct time_schedulable { time_schedulable(TimePoint when, schedulable a) : when(when) - , a(std::move(a)) + , what(std::move(a)) { } TimePoint when; - schedulable a; + schedulable what; }; } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 9a46cfa..91086d8 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -182,14 +182,14 @@ auto select_observer(ResolvedArgSet& rs) template auto make_subscriber_resolved(ResolvedArgSet&& rsArg) - -> subscriber(std::move(rsArg)))> { + -> subscriber(*(typename std::decay::type*)nullptr))> { const auto rs = std::forward(rsArg); const auto rsub = std::get<3>(rs); const auto rr = std::get<4>(rs); const auto rscrbr = std::get<6>(rs); const auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : rr.value; const auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; - return subscriber(std::move(rsArg)))>( + return subscriber(*(typename std::decay::type*)nullptr))>( s, r, select_observer(rs)); // at least for now do not enforce resolver diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 204bef8..b6c8d6f 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -23,20 +23,6 @@ public: static const bool value = std::is_convertible::type>(0)), tag_subscription>::value; }; -namespace detail { - -struct tag_subscription_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - typedef composite_subscription default_type; -}; - -} - class dynamic_subscription : public subscription_base { typedef std::function unsubscribe_call_type; @@ -170,15 +156,15 @@ private: { } - bool is_subscribed() { + inline bool is_subscribed() { return issubscribed; } - weak_subscription add(dynamic_subscription s) { + inline weak_subscription add(dynamic_subscription s) { return add(std::make_shared(std::move(s))); } - weak_subscription add(shared_subscription s) { + inline weak_subscription add(shared_subscription s) { std::unique_lock guard(lock); if (!issubscribed) { @@ -194,7 +180,7 @@ private: return s; } - void remove(weak_subscription w) { + inline void remove(weak_subscription w) { std::unique_lock guard(lock); if (issubscribed) { @@ -211,7 +197,7 @@ private: } } - void clear() { + inline void clear() { std::unique_lock guard(lock); if (issubscribed) { @@ -222,7 +208,7 @@ private: } } - void unsubscribe() { + inline void unsubscribe() { std::unique_lock guard(lock); if (issubscribed) { @@ -290,34 +276,34 @@ public: return *this; } - static composite_subscription empty() { + static inline composite_subscription empty() { return composite_subscription(shared_empty); } - bool is_subscribed() const { + inline bool is_subscribed() const { return state->is_subscribed(); } - weak_subscription add(shared_subscription s) const { + inline weak_subscription add(shared_subscription s) const { return state->add(std::move(s)); } - weak_subscription add(dynamic_subscription s) const { + inline weak_subscription add(dynamic_subscription s) const { return state->add(std::move(s)); } - void remove(weak_subscription w) const { + inline void remove(weak_subscription w) const { state->remove(std::move(w)); } - void clear() const { + inline void clear() const { state->clear(); } - void unsubscribe() const { + inline void unsubscribe() const { state->unsubscribe(); } }; -bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) { +inline bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) { return lhs.state == rhs.state; } -bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) { +inline bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) { return !(lhs == rhs); } @@ -325,6 +311,20 @@ bool operator!=(const composite_subscription& lhs, const composite_subscription& RXCPP_SELECT_ANY std::shared_ptr composite_subscription::shared_empty = std::make_shared(composite_subscription::tag_empty()); +namespace detail { + + struct tag_subscription_resolution + { + template + struct predicate + { + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; + }; + typedef composite_subscription default_type; + }; + +} + } #endif diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 205c93d..f5f2b85 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -18,7 +18,7 @@ struct action_queue typedef action_queue this_type; typedef scheduler_base::clock_type clock; - typedef time_action item_type; + typedef time_schedulable item_type; private: struct compare_item_time @@ -73,7 +73,7 @@ public: if (!current_thread_queue()) { abort(); } - if (!item.a->is_subscribed()) { + if (!item.what.is_subscribed()) { return; } current_thread_queue()->queue.push(std::move(item)); @@ -114,7 +114,7 @@ public: } -struct current_thread : public scheduler_base +struct current_thread : public scheduler_interface { private: typedef current_thread this_type; @@ -122,7 +122,7 @@ private: typedef detail::action_queue queue; - struct derecurser : public scheduler_base + struct derecurser : public scheduler_interface { private: typedef current_thread this_type; @@ -135,20 +135,24 @@ private: { } - virtual clock_type::time_point now() { + virtual clock_type::time_point now() const { return clock_type::now(); } - virtual void schedule(action a) { - queue::push(queue::item_type(now(), std::move(a))); + inline bool is_tail_recursion_allowed() const { + return queue::empty(); } - virtual void schedule(clock_type::duration when, action a) { - queue::push(queue::item_type(now() + when, std::move(a))); + virtual void schedule(const schedulable& scbl) const { + queue::push(queue::item_type(now(), scbl)); } - virtual void schedule(clock_type::time_point when, action a) { - queue::push(queue::item_type(when, std::move(a))); + virtual void schedule(clock_type::duration when, const schedulable& scbl) const { + queue::push(queue::item_type(now() + when, scbl)); + } + + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { + queue::push(queue::item_type(when, scbl)); } }; @@ -160,41 +164,45 @@ public: { } - static bool is_schedule_required() { return !queue::get_scheduler(); } + static bool is_schedule_required() { return queue::get_scheduler() == scheduler(); } - virtual clock_type::time_point now() { + virtual clock_type::time_point now() const { return clock_type::now(); } - virtual void schedule(action a) { - schedule(now(), std::move(a)); + inline bool is_tail_recursion_allowed() const { + return queue::empty(); + } + + virtual void schedule(const schedulable& scbl) const { + schedule(now(), scbl); } - virtual void schedule(clock_type::duration when, action a) { - schedule(now() + when, std::move(a)); + virtual void schedule(clock_type::duration when, const schedulable& scbl) const { + schedule(now() + when, scbl); } - virtual void schedule(clock_type::time_point when, action a) { - if (!a->is_subscribed()) { + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { + if (!scbl.is_subscribed()) { return; } auto sc = queue::get_scheduler(); // check ownership - if (!!sc) + if (sc != scheduler()) { // already has an owner - delegate - return sc->schedule(when, std::move(a)); + return sc.schedule(when, scbl); } // take ownership - sc = queue::ensure(std::make_shared()); + sc = queue::ensure(make_scheduler()); RXCPP_UNWIND_AUTO([]{ queue::destroy(); }); - queue::push(queue::item_type(when, std::move(a))); + queue::push(queue::item_type(when, scbl)); // loop until queue is empty for ( @@ -203,18 +211,12 @@ public: when = queue::top().when ) { - auto a = queue::top().a; + auto what = queue::top().what; queue::pop(); - while (a->is_subscribed()) { - a = (*a)(sc); - if (!queue::empty()) { - // take proper place in line - sc->schedule(std::move(a)); - break; - } - // tail recurse to a + if (what.is_subscribed()) { + what.get_action()(what); } if (queue::empty()) { @@ -225,7 +227,7 @@ public: }; inline scheduler make_current_thread() { - return std::make_shared(); + return make_scheduler(); } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 60dcff9..4d0ab00 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -67,7 +67,7 @@ public: using base::schedule_absolute; using base::schedule_relative; - virtual void schedule_absolute(long when, action a) + virtual void schedule_absolute(long when, action a) const { if (when <= base::clock_now) when = base::clock_now + 1; @@ -75,17 +75,17 @@ public: return base::schedule_absolute(when, std::move(a)); } - virtual long add(long absolute, long relative) + virtual long add(long absolute, long relative) const { return absolute + relative; } - virtual clock_type::time_point to_time_point(long absolute) + virtual clock_type::time_point to_time_point(long absolute) const { return clock_type::time_point(clock_type::duration(absolute)); } - virtual long to_relative(clock_type::duration d) + virtual long to_relative(clock_type::duration d) const { return static_cast(d.count()); } @@ -93,7 +93,7 @@ public: using base::start; template - auto start(F&& createSource, long created, long subscribed, long unsubscribed) + auto start(F&& createSource, long created, long subscribed, long unsubscribed) const -> subscriber> { typename std::decay::type createSrc = std::forward(createSource); @@ -114,17 +114,17 @@ public: }; std::shared_ptr state(new state_type(this->make_subscriber())); - schedule_absolute(created, make_action([createSrc, state](action, scheduler) { + schedule_absolute(created, make_action([createSrc, state](const schedulable& scbl) { state->source.reset(new typename state_type::source_type(createSrc())); - return make_action_empty(); + return schedulable::empty(scbl.get_scheduler()); })); - schedule_absolute(subscribed, make_action([state](action, scheduler) { + schedule_absolute(subscribed, make_action([state](const schedulable& scbl) { state->source->subscribe(state->o); - return make_action_empty(); + return schedulable::empty(scbl.get_scheduler()); })); - schedule_absolute(unsubscribed, make_action([state](action, scheduler) { + schedule_absolute(unsubscribed, make_action([state](const schedulable& scbl) { state->o.unsubscribe(); - return make_action_empty(); + return schedulable::empty(scbl.get_scheduler()); })); start(); @@ -133,39 +133,39 @@ public: } template - auto start(F&& createSource, long unsubscribed) + auto start(F&& createSource, long unsubscribed) const -> subscriber> { return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); } template - auto start(F&& createSource) + auto start(F&& createSource) const -> subscriber> { return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); } template - rxt::testable_observable make_hot_observable(std::vector>>> messages); + rxt::testable_observable make_hot_observable(std::vector>>> messages) const; template - auto make_hot_observable(const T (&arr) [size]) + auto make_hot_observable(const T (&arr) [size]) const -> decltype(make_hot_observable(std::vector())) { return make_hot_observable(rxu::to_vector(arr)); } template - rxt::testable_observable make_cold_observable(std::vector>>> messages); + rxt::testable_observable make_cold_observable(std::vector>>> messages) const; template - auto make_cold_observable(const T (&arr) [size]) + auto make_cold_observable(const T (&arr) [size]) const -> decltype(make_cold_observable(std::vector())) { return make_cold_observable(rxu::to_vector(arr)); } template - subscriber> make_subscriber(); + subscriber> make_subscriber() const; }; template @@ -213,12 +213,12 @@ public: }; template -subscriber> test::make_subscriber() +subscriber> test::make_subscriber() const { typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - std::shared_ptr> ts(new mock_observer(std::static_pointer_cast(shared_from_this()))); + std::shared_ptr> ts(new mock_observer(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())))); return rxcpp::make_subscriber(rxt::testable_observer(ts, make_observer_dynamic( // on_next @@ -272,9 +272,10 @@ public: for (auto& message : mv) { auto n = message.value(); - sc->schedule_relative(message.time(), make_action([n, o](action, scheduler) { + sc->schedule_relative(message.time(), make_action([n, o](const schedulable& scbl) { n->accept(o); - return make_action_empty(); + scbl.unsubscribe(); + return scbl; })); } @@ -294,9 +295,9 @@ public: }; template -rxt::testable_observable test::make_cold_observable(std::vector>>> messages) +rxt::testable_observable test::make_cold_observable(std::vector>>> messages) const { - auto co = std::shared_ptr>(new cold_observable(std::static_pointer_cast(shared_from_this()), std::move(messages))); + auto co = std::shared_ptr>(new cold_observable(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); return rxt::testable_observable(co); } @@ -320,12 +321,12 @@ public: { for (auto& message : mv) { auto n = message.value(); - sc->schedule_absolute(message.time(), make_action([this, n](action, scheduler) { + sc->schedule_absolute(message.time(), make_action([this, n](const schedulable& scbl) { auto local = this->observers; for (auto& o : local) { n->accept(o); } - return make_action_empty(); + return schedulable::empty(scbl.get_scheduler()); })); } } @@ -351,10 +352,10 @@ public: }; template -rxt::testable_observable test::make_hot_observable(std::vector>>> messages) +rxt::testable_observable test::make_hot_observable(std::vector>>> messages) const { return rxt::testable_observable(std::make_shared>( - std::static_pointer_cast(shared_from_this()), std::move(messages))); + std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 42f87f8..169bad1 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -14,13 +14,13 @@ namespace schedulers { namespace detail { template -struct virtual_time_base : public scheduler_base +struct virtual_time_base : public scheduler_interface { private: typedef virtual_time_base this_type; virtual_time_base(const virtual_time_base&); - bool isenabled; + mutable bool isenabled; public: typedef Absolute absolute; @@ -42,57 +42,54 @@ protected: { } - absolute clock_now; + mutable absolute clock_now; - typedef time_action item_type; + typedef time_schedulable item_type; - virtual absolute add(absolute, relative) =0; + virtual absolute add(absolute, relative) const =0; - virtual typename scheduler_base::clock_type::time_point to_time_point(absolute) =0; - virtual relative to_relative(typename scheduler_base::clock_type::duration) =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() =0; - virtual void pop() =0; - virtual bool empty() =0; + virtual item_type top() const =0; + virtual void pop() const =0; + virtual bool empty() const =0; public: - virtual void schedule_absolute(absolute, action) =0; + virtual void schedule_absolute(absolute, action) const =0; template - typename std::enable_if::type, action>::value, void>::type - schedule_absolute(absolute when, F f) { + typename std::enable_if::type, action>::value, void>::type + schedule_absolute(absolute when, F f) const { schedule_absolute(when, make_action(f)); } - virtual void schedule_relative(relative when, action a) { + virtual void schedule_relative(relative when, action a) const { auto at = add(clock_now, when); return schedule_absolute(at, std::move(a)); } template - typename std::enable_if::type, action>::value, void>::type - schedule_relative(relative when, F f) { + typename std::enable_if::type, action>::value, void>::type + schedule_relative(relative when, F f) const { schedule_relative(when, make_action(f)); } - bool is_enabled() {return isenabled;} - absolute clock() {return clock_now;} + bool is_enabled() const {return isenabled;} + absolute clock() const {return clock_now;} - void start() + void start() const { if (!isenabled) { isenabled = true; while (!empty() && isenabled) { auto next = top(); pop(); - if (next.a->is_subscribed()) { + if (next.what.is_subscribed()) { if (next.when > clock_now) { clock_now = next.when; } - auto a = (*next.a)(shared_from_this()); - if (a->is_subscribed()) { - schedule(a); - } + next.what.get_action()(next.what); } else { isenabled = false; @@ -101,12 +98,12 @@ public: } } - void stop() + void stop() const { isenabled = false; } - void advance_to(absolute time) + void advance_to(absolute time) const { if (time < clock_now) { abort(); @@ -121,14 +118,11 @@ public: while (!empty() && isenabled) { auto next = top(); pop(); - if (next.a->is_subscribed() && next.when <= time) { + if (next.what.is_subscribed() && next.when <= time) { if (next.when > clock_now) { clock_now = next.when; } - auto a = (*next.a)(shared_from_this()); - if (a.subscribed()) { - schedule(a); - } + next.what.get_action()(next.what); } else { isenabled = false; @@ -142,7 +136,7 @@ public: } } - void advance_by(relative time) + void advance_by(relative time) const { auto dt = add(clock_now, time); @@ -162,7 +156,7 @@ public: } } - void sleep(relative time) + void sleep(relative time) const { auto dt = add(clock_now, time); @@ -173,20 +167,24 @@ public: clock_now = dt; } - virtual clock_type::time_point now() { + virtual clock_type::time_point now() const { return to_time_point(clock_now); } - virtual void schedule(action a) { - schedule_absolute(clock_now, std::move(a)); + virtual bool is_tail_recursion_allowed() const { + return false; + } + + virtual void schedule(const schedulable& scbl) const { + schedule_absolute(clock_now, scbl.get_action()); } - virtual void schedule(clock_type::duration when, action a) { - schedule_absolute(to_relative(when), std::move(a)); + virtual void schedule(clock_type::duration when, const schedulable& scbl) const { + schedule_absolute(to_relative(when), scbl.get_action()); } - virtual void schedule(clock_type::time_point when, action a) { - schedule_absolute(to_relative(when - now()), std::move(a)); + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { + schedule_absolute(to_relative(when - now()), scbl.get_action()); } }; @@ -197,7 +195,8 @@ template class virtual_time : public detail::virtual_time_base { private: - virtual_time(const virtual_time&); + typedef virtual_time this_type; + virtual_time(const this_type&); typedef detail::virtual_time_base base; @@ -216,7 +215,7 @@ private: compare_item_time > queue_item_time; - queue_item_time queue; + mutable queue_item_time queue; public: virtual ~virtual_time() @@ -232,29 +231,31 @@ protected: { } - virtual item_type top() { + virtual item_type top() const { return queue.top(); } - virtual void pop() { + virtual void pop() const { queue.pop(); } - virtual bool empty() { + virtual bool empty() const { return queue.empty(); } using base::schedule_absolute; using base::schedule_relative; - virtual void schedule_absolute(typename base::absolute when, action a) + virtual void schedule_absolute(typename base::absolute when, action a) const { // use a separate subscription here so that a's subscription is not affected - auto run = make_action([a](action that, scheduler sc) { - if (that->is_subscribed()) { - that->unsubscribe(); // unsubscribe() run, not a; - (*a)(sc); - } - return make_action_empty(); - }); + auto run = make_schedulable( + scheduler(this->shared_from_this()), + [a](const schedulable& scbl) { + if (scbl.is_subscribed()) { + scbl.unsubscribe(); // unsubscribe() run, not a; + a(scbl); + } + return schedulable::empty(scbl.get_scheduler()); + }); queue.push(item_type(when, run)); } diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 418c292..d7514c1 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -34,14 +34,14 @@ struct range : public source_base template void on_subscribe(Subscriber o) { auto state = std::make_shared(init); - state->sc->schedule(o.get_subscription(), [=](rxsc::action that, rxsc::scheduler){ + schedule(state->sc, o.get_subscription(), [=](rxsc::schedulable scbl){ if (state->remaining == 0) { o.on_completed(); // o is unsubscribed } if (!o.is_subscribed()) { // terminate loop - return rxsc::make_action_empty(); + return scbl; } // send next value @@ -50,7 +50,7 @@ struct range : public source_base state->next = static_cast(state->step + state->next); // tail recurse this same action to continue loop - return that; + return scbl; }); } }; diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index bf4d1a8..ff853ec 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -148,7 +148,9 @@ public: c = b->completer; } for (auto& o : c->observers) { - o.on_next(t); + if (o.is_subscribed()) { + o.on_next(t); + } } } } @@ -161,7 +163,9 @@ public: guard.unlock(); if (c) { for (auto& o : c->observers) { - o.on_error(e); + if (o.is_subscribed()) { + o.on_error(e); + } } } } @@ -174,7 +178,9 @@ public: guard.unlock(); if (c) { for (auto& o : c->observers) { - o.on_completed(); + if (o.is_subscribed()) { + o.on_completed(); + } } } } diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index ad92bbb..f68fb4c 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -396,7 +396,7 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") WHEN("filtered to ints that are primes"){ sc->schedule_absolute(rxsc::test::created_time, - [&invoked, &res, &ys, &xs](rxsc::action, rxsc::scheduler) { + [&invoked, &res, &ys, &xs](const rxsc::schedulable& scbl) { #if RXCPP_USE_OBSERVABLE_MEMBERS ys = xs .filter([&invoked, &res](int x) { @@ -414,17 +414,20 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") return IsPrime(x); }); #endif - return rxsc::make_action_empty(); + scbl.unsubscribe(); + return scbl; }); - sc->schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](rxsc::action, rxsc::scheduler) { + sc->schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { ys.subscribe(res); - return rxsc::make_action_empty(); + scbl.unsubscribe(); + return scbl; }); - sc->schedule_absolute(rxsc::test::unsubscribed_time, [&res](rxsc::action, rxsc::scheduler) { + sc->schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl) { res.unsubscribe(); - return rxsc::make_action_empty(); + scbl.unsubscribe(); + return scbl; }); sc->start(); diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 620863a..bac779b 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -43,7 +43,10 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ int c = 0; int n = 1; auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe([&c](int){++c;}); + rxs::range(0, onnextcalls).subscribe( + [&c](int){ + ++c; + }); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); @@ -181,28 +184,28 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ - xs.subscribe(o); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ - o.unsubscribe(); return rxsc::make_action_empty();}); - - sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); - sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); - sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); - - sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ - results2.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ - results3.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); sc->start(); @@ -274,28 +277,28 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ - xs.subscribe(o); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ - o.unsubscribe(); return rxsc::make_action_empty();}); - - sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); - sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); - sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); - - sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ - results2.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ - results3.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); sc->start(); @@ -370,28 +373,28 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](rxsc::action, rxsc::scheduler){ - s = rxsub::subject(); o = s.get_subscriber(); return rxsc::make_action_empty();}); - sc->schedule_absolute(200, [&xs, &o](rxsc::action, rxsc::scheduler){ - xs.subscribe(o); return rxsc::make_action_empty();}); - sc->schedule_absolute(1000, [&o](rxsc::action, rxsc::scheduler){ - o.unsubscribe(); return rxsc::make_action_empty();}); - - sc->schedule_absolute(300, [&s, &results1](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results1); return rxsc::make_action_empty();}); - sc->schedule_absolute(400, [&s, &results2](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results2); return rxsc::make_action_empty();}); - sc->schedule_absolute(900, [&s, &results3](rxsc::action, rxsc::scheduler){ - s.get_observable().subscribe(results3); return rxsc::make_action_empty();}); - - sc->schedule_absolute(600, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(700, [&results2](rxsc::action, rxsc::scheduler){ - results2.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(800, [&results1](rxsc::action, rxsc::scheduler){ - results1.unsubscribe(); return rxsc::make_action_empty();}); - sc->schedule_absolute(950, [&results3](rxsc::action, rxsc::scheduler){ - results3.unsubscribe(); return rxsc::make_action_empty();}); + sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + + sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); sc->start(); diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 1bed6b6..1d1f002 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -12,13 +12,13 @@ SCENARIO("subscriber traits", "[observer][traits]"){ // 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::type(rx::resumption(), next, error, completed, rx::rxu::detail::tag_unresolvable(), rx::rxu::detail::tag_unresolvable()); // auto arg = rx::rxu::detail::resolve_arg(rx::resumption(), next, error, completed); -// auto argset = rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed); -// auto o = rx::make_observer_resolved(argset); -// auto o = rx::select_observer(argset); +// auto argset = rx::rxu::detail::resolve_arg_set(rxcpp::detail::tag_subscriber_set(), rx::resumption(), next, error, completed); +// auto o = rx::detail::make_observer_resolved(argset); +// auto o = rx::detail::select_observer(argset); // auto scrbResult = rx::subscriber(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::make_subscriber_resolved(rx::rxu::detail::resolve_arg_set(rx::tag_subscriber_set(), rx::resumption(), next, error, completed)); -// auto scrbResult = rx::make_subscriber_resolved(argset); +// auto scrbResult = rx::detail::make_subscriber_resolved(rx::rxu::detail::resolve_arg_set(rx::detail::tag_subscriber_set(), rx::resumption(), next, error, completed)); +// auto scrbResult = rx::detail::make_subscriber_resolved(argset); auto scrbResult = rx::make_subscriber(rx::resumption(), next, error, completed); auto scrbdup = rx::make_subscriber(scrbResult); auto scrbop = rx::make_subscriber(scrbResult, next, error, completed); -- GitLab From 31c9787d25d5c296ed74d3746f5ed0b8e8a657ba Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 23 Mar 2014 13:58:52 -0700 Subject: [PATCH 231/782] restructuring tail-recursion to make range and for-loop perf similar when no marble schedules to the current thread. --- Rx/v2/src/rxcpp/rx-observable.hpp | 1 - Rx/v2/src/rxcpp/rx-scheduler.hpp | 170 ++++++++++++++---- Rx/v2/src/rxcpp/rx-subscription.hpp | 18 +- .../src/rxcpp/schedulers/rx-currentthread.hpp | 30 ++-- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 3 - Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 13 +- Rx/v2/src/rxcpp/sources/rx-range.hpp | 6 +- Rx/v2/test/subjects/subject.cpp | 60 +++---- 8 files changed, 208 insertions(+), 93 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index ede6c47..6a57bf4 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -170,7 +170,6 @@ private: auto sc = rxsc::make_current_thread(); schedule(sc, [=](const rxsc::schedulable& scbl) { safe_subscribe(); - return rxsc::schedulable::empty(scbl.get_scheduler()); }); } else { safe_subscribe(); diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index e59abbf..6bd5a8b 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -23,6 +23,69 @@ typedef std::shared_ptr const_scheduler_interface_ptr } +class recursed +{ + bool& isrequested; +public: + explicit recursed(bool& r) + : isrequested(r) + { + } + inline void operator()() const { + isrequested = true; + } +}; + +class recurse +{ + bool& isallowed; + mutable bool isrequested; + recursed requestor; +public: + explicit recurse(bool& a) + : isallowed(a) + , isrequested(true) + , requestor(isrequested) + { + } + inline bool is_allowed() const { + return isallowed; + } + inline bool is_requested() const { + return isrequested; + } + inline void reset() const { + isrequested = false; + } + inline const recursed& get_recursed() const { + return requestor; + } +}; + +class recursion +{ + mutable bool isallowed; + recurse recursor; +public: + recursion() + : isallowed(true) + , recursor(isallowed) + { + } + explicit recursion(bool b) + : isallowed(b) + , recursor(isallowed) + { + } + inline void reset(bool b = true) const { + isallowed = b; + } + inline const recurse& get_recurse() const { + return recursor; + } +}; + + struct action_base { typedef tag_action action_tag; @@ -59,7 +122,7 @@ public: inline action_duration::type get_duration() const; - inline void operator()(const schedulable& s) const; + inline void operator()(const schedulable& s, const recurse& r) const; }; struct scheduler_base @@ -82,8 +145,6 @@ public: virtual clock_type::time_point now() const = 0; - virtual bool is_tail_recursion_allowed() const = 0; - virtual void schedule(const schedulable& scbl) const = 0; virtual void schedule(clock_type::duration when, const schedulable& scbl) const = 0; virtual void schedule(clock_type::time_point when, const schedulable& scbl) const = 0; @@ -126,10 +187,6 @@ public: return inner->now(); } - inline bool is_tail_recursion_allowed() const { - return inner->is_tail_recursion_allowed(); - } - inline void schedule(const schedulable& scbl) const { inner->schedule(scbl); } @@ -177,6 +234,48 @@ class schedulable : public schedulable_base 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() + { + that->requestor = nullptr; + } + exit_recursed_scope_type(const recursed_scope_type* that) + : that(that) + { + } + }; + 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& o) + { + // 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); + } + void operator()() const { + (*requestor)(); + } + }; + recursed_scope_type recursed_scope; + public: typedef typename composite_subscription::weak_subscription weak_subscription; typedef typename composite_subscription::shared_subscription shared_subscription; @@ -215,6 +314,17 @@ public: 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 + // + inline void operator()() const { + recursed_scope(); + } + // composite_subscription // inline bool is_subscribed() const { @@ -241,9 +351,6 @@ public: inline clock_type::time_point now() const { return controller.now(); } - inline bool is_tail_recursion_allowed() const { - return controller.is_tail_recursion_allowed(); - } inline void schedule() const { controller.schedule(*this); } @@ -259,12 +366,12 @@ public: inline action_duration::type get_duration() const { return activity.get_duration(); } - inline void operator()() const { + inline void operator()(const schedulable& scbl, const recurse& r) const { if (!is_subscribed()) { abort(); } detacher protect(this); - activity(*this); + activity(scbl, r); protect.that = nullptr; } }; @@ -288,7 +395,7 @@ class action_type typedef action_type this_type; public: - typedef std::function function_type; + typedef std::function function_type; private: action_duration::type d; @@ -309,11 +416,11 @@ public: return d; } - inline schedulable operator()(const schedulable& s) { - if (f) { - return f(s); + inline void operator()(const schedulable& s, const recurse& r) { + if (!f) { + abort(); } - return schedulable::empty(make_scheduler()); + f(s, r); } }; @@ -324,13 +431,10 @@ inline action_duration::type action::get_duration() const { return inner->get_duration(); } -inline void action::operator()(const schedulable& s) const { - auto next = (*inner)(s); - if (next.is_subscribed()) { - next.schedule(); - } +inline void action::operator()(const schedulable& s, const recurse& r) const { + (*inner)(s, r); } - + //static RXCPP_SELECT_ANY detail::action_ptr action::shared_empty = detail::action_ptr(new detail::action_type()); @@ -346,14 +450,18 @@ inline action make_action(F&& f, action_duration::type d = action_duration::runs d, // tail-recurse inside of the virtual function call // until a new action, lifetime or scheduler is returned - [fn](const schedulable& s) { - auto next = s; - auto last = s; - while (next.is_subscribed() && last == next && next.get_scheduler().is_tail_recursion_allowed()) { - last = next; - next = fn(next); + [fn](const schedulable& s, const recurse& r) { + auto scope = s.set_recursed(r); + while (s.is_subscribed()) { + r.reset(); + fn(s); + if (!r.is_allowed() || !r.is_requested()) { + if (r.is_requested()) { + s.schedule(); + } + break; + } } - return next; })); } @@ -368,7 +476,7 @@ struct is_action_function template static not_void check(...); - static const bool value = std::is_same::type>(0)), schedulable>::value; + static const bool value = std::is_same::type>(0)), void>::value; }; struct tag_action_function_resolution diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index b6c8d6f..192bff4 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -313,15 +313,19 @@ RXCPP_SELECT_ANY std::shared_ptr composite_subs namespace detail { - struct tag_subscription_resolution +struct tag_subscription_resolution +{ + template + struct predicate { - template - struct predicate - { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - typedef composite_subscription default_type; + static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; }; + struct default_type { + inline operator composite_subscription() const { + return composite_subscription(); + } + }; +}; } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index f5f2b85..72a8ab7 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -37,6 +37,7 @@ private: public: struct current_thread_queue_type { scheduler sc; + recursion r; queue_item_time queue; }; @@ -51,6 +52,9 @@ public: static scheduler get_scheduler() { return !!current_thread_queue() ? current_thread_queue()->sc : scheduler(); } + static recursion& get_recursion() { + return current_thread_queue()->r; + } static bool empty() { if (!current_thread_queue()) { abort(); @@ -64,19 +68,27 @@ public: return current_thread_queue()->queue.top(); } static void pop() { - if (!current_thread_queue()) { + auto state = current_thread_queue(); + if (!state) { abort(); } - current_thread_queue()->queue.pop(); + state->queue.pop(); + if (state->queue.empty()) { + // allow recursion + state->r.reset(true); + } } static void push(item_type item) { - if (!current_thread_queue()) { + auto state = current_thread_queue(); + if (!state) { abort(); } if (!item.what.is_subscribed()) { return; } - current_thread_queue()->queue.push(std::move(item)); + state->queue.push(std::move(item)); + // disallow recursion + state->r.reset(false); } static scheduler ensure(scheduler sc) { if (!!current_thread_queue()) { @@ -139,10 +151,6 @@ private: return clock_type::now(); } - inline bool is_tail_recursion_allowed() const { - return queue::empty(); - } - virtual void schedule(const schedulable& scbl) const { queue::push(queue::item_type(now(), scbl)); } @@ -204,6 +212,8 @@ public: queue::push(queue::item_type(when, scbl)); + const auto& recursor = queue::get_recursion().get_recurse(); + // loop until queue is empty for ( auto when = queue::top().when; @@ -215,9 +225,7 @@ public: queue::pop(); - if (what.is_subscribed()) { - what.get_action()(what); - } + what(what, recursor); if (queue::empty()) { break; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 4d0ab00..e832b52 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -116,15 +116,12 @@ public: schedule_absolute(created, make_action([createSrc, state](const schedulable& scbl) { state->source.reset(new typename state_type::source_type(createSrc())); - return schedulable::empty(scbl.get_scheduler()); })); schedule_absolute(subscribed, make_action([state](const schedulable& scbl) { state->source->subscribe(state->o); - return schedulable::empty(scbl.get_scheduler()); })); schedule_absolute(unsubscribed, make_action([state](const schedulable& scbl) { state->o.unsubscribe(); - return schedulable::empty(scbl.get_scheduler()); })); start(); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 169bad1..82f426d 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -82,6 +82,8 @@ public: { if (!isenabled) { isenabled = true; + rxsc::recursion r; + r.reset(false); while (!empty() && isenabled) { auto next = top(); pop(); @@ -89,7 +91,7 @@ public: if (next.when > clock_now) { clock_now = next.when; } - next.what.get_action()(next.what); + next.what(next.what, r.get_recurse()); } else { isenabled = false; @@ -171,10 +173,6 @@ public: return to_time_point(clock_now); } - virtual bool is_tail_recursion_allowed() const { - return false; - } - virtual void schedule(const schedulable& scbl) const { schedule_absolute(clock_now, scbl.get_action()); } @@ -250,11 +248,12 @@ protected: auto run = make_schedulable( scheduler(this->shared_from_this()), [a](const schedulable& scbl) { + rxsc::recursion r; + r.reset(false); if (scbl.is_subscribed()) { scbl.unsubscribe(); // unsubscribe() run, not a; - a(scbl); + a(scbl, r.get_recurse()); } - return schedulable::empty(scbl.get_scheduler()); }); queue.push(item_type(when, run)); } diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index d7514c1..de4b753 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -34,14 +34,14 @@ struct range : public source_base template void on_subscribe(Subscriber o) { auto state = std::make_shared(init); - schedule(state->sc, o.get_subscription(), [=](rxsc::schedulable scbl){ + schedule(state->sc, o.get_subscription(), [=](const rxsc::schedulable& self){ if (state->remaining == 0) { o.on_completed(); // o is unsubscribed } if (!o.is_subscribed()) { // terminate loop - return scbl; + return; } // send next value @@ -50,7 +50,7 @@ struct range : public source_base state->next = static_cast(state->step + state->next); // tail recurse this same action to continue loop - return scbl; + self(); }); } }; diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index bac779b..197bc33 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -185,27 +185,27 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ auto o = s.get_subscriber(); sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ - s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + s = rxsub::subject(); o = s.get_subscriber();}); sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ - xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + xs.subscribe(o);}); sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ - o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + o.unsubscribe();}); sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results1);}); sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results2);}); sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results3);}); sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ - results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results2.unsubscribe();}); sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ - results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results3.unsubscribe();}); sc->start(); @@ -278,27 +278,27 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ auto o = s.get_subscriber(); sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ - s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + s = rxsub::subject(); o = s.get_subscriber();}); sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ - xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + xs.subscribe(o);}); sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ - o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + o.unsubscribe();}); sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results1);}); sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results2);}); sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results3);}); sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ - results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results2.unsubscribe();}); sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ - results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results3.unsubscribe();}); sc->start(); @@ -374,27 +374,27 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ auto o = s.get_subscriber(); sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ - s = rxsub::subject(); o = s.get_subscriber(); scbl.unsubscribe(); return scbl;}); + s = rxsub::subject(); o = s.get_subscriber();}); sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ - xs.subscribe(o); scbl.unsubscribe(); return scbl;}); + xs.subscribe(o);}); sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ - o.unsubscribe(); scbl.unsubscribe(); return scbl;}); + o.unsubscribe();}); sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results1); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results1);}); sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results2); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results2);}); sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ - s.get_observable().subscribe(results3); scbl.unsubscribe(); return scbl;}); + s.get_observable().subscribe(results3);}); sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ - results2.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results2.unsubscribe();}); sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ - results1.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results1.unsubscribe();}); sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ - results3.unsubscribe(); scbl.unsubscribe(); return scbl;}); + results3.unsubscribe();}); sc->start(); -- GitLab From 5b259eea6f184a37e1e9d1e308417c82ebbcc8f2 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 23 Mar 2014 19:50:12 -0700 Subject: [PATCH 232/782] added some comments and variadic subscribe --- Rx/v2/src/rxcpp/rx-observable.hpp | 96 ++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 6a57bf4..b81fa5d 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -166,12 +166,14 @@ private: } }; + // make sure to let current_thread take ownership of the thread as early as possible. if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); schedule(sc, [=](const rxsc::schedulable& scbl) { safe_subscribe(); }); } else { + // current_thread already owns this thread. safe_subscribe(); } @@ -215,48 +217,129 @@ public: #endif // - // performs type-forgetting conversion + // performs type-forgetting conversion to a new observable // observable as_dynamic() { return *this; } +#if RXCPP_USE_VARIADIC_TEMPLATES + // + // subscribe will cause this observable to emit values to the provided 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 + auto subscribe(Arg0&& a0, ArgN&&... an) const + -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...))) { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); + } +#else + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0)))) { return detail_subscribe(make_subscriber(std::forward(a0))); } + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1))); } + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2))); } + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } + // + // subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } +#endif + // + // for each item from this observable use Predicate to select which items to emit from the new observable that is returned. + // template auto filter(Predicate&& p) const -> observable> { @@ -264,6 +347,9 @@ public: rxo::detail::filter(*this, std::forward(p))); } + // + // for each item from this observable use Selector to produce an item to emit from the new observable that is returned. + // template auto map(Selector&& s) const -> observable::value_type, rxo::detail::map> { @@ -271,6 +357,10 @@ public: rxo::detail::map(*this, std::forward(s))); } + // + // for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. + // for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. + // template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const -> observable::value_type, rxo::detail::flat_map> { @@ -278,6 +368,10 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); } + // + // takes any function that will take this observable and produce a result value. + // this is intended to allow externally defined operators to be connected into the expression. + // template auto op(OperatorFactory&& of) const -> decltype(of(*(const this_type*)nullptr)) { -- GitLab From 81c3ea8bd75adeab64f64ece3754fbfe2e84e777 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 23 Mar 2014 21:12:57 -0700 Subject: [PATCH 233/782] add some comments an clean up test structure --- Rx/v2/src/rxcpp/rx-observable.hpp | 178 ++++----- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 347 +++++++++++------- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 12 - Rx/v2/test/operators/filter.cpp | 313 ++++++++-------- Rx/v2/test/operators/flat_map.cpp | 280 +++++++------- Rx/v2/test/operators/map.cpp | 27 +- Rx/v2/test/subjects/subject.cpp | 247 +++++++------ Rx/v2/test/subscriptions/observer.cpp | 18 +- 8 files changed, 761 insertions(+), 661 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index b81fa5d..c062ae2 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -198,12 +198,12 @@ public: { } - // implicit conversion between observables of the same value_type + /// implicit conversion between observables of the same value_type template observable(const observable& o) : source_operator(o.source_operator) {} - // implicit conversion between observables of the same value_type + /// implicit conversion between observables of the same value_type template observable(observable&& o) : source_operator(std::move(o.source_operator)) @@ -216,120 +216,120 @@ public: } #endif - // - // performs type-forgetting conversion to a new observable - // + /// + /// performs type-forgetting conversion to a new observable + /// observable as_dynamic() { return *this; } #if RXCPP_USE_VARIADIC_TEMPLATES - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, ArgN&&... an) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); } #else - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0)))) { return detail_subscribe(make_subscriber(std::forward(a0))); } - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1))); } - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2))); } - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } - // - // subscribe will cause this observable to emit values to the provided 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. - // + /// + /// subscribe will cause this observable to emit values to the provided 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 auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) const -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { @@ -337,9 +337,9 @@ public: } #endif - // - // for each item from this observable use Predicate to select which items to emit from the new observable that is returned. - // + /// filter (AKA Where) -> + /// for each item from this observable use Predicate to select which items to emit from the new observable that is returned. + /// template auto filter(Predicate&& p) const -> observable> { @@ -347,9 +347,9 @@ public: rxo::detail::filter(*this, std::forward(p))); } - // - // for each item from this observable use Selector to produce an item to emit from the new observable that is returned. - // + /// map (AKA Select) -> + /// for each item from this observable use Selector to produce an item to emit from the new observable that is returned. + /// template auto map(Selector&& s) const -> observable::value_type, rxo::detail::map> { @@ -357,10 +357,10 @@ public: rxo::detail::map(*this, std::forward(s))); } - // - // for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. - // for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. - // + /// flat_map (AKA SelectMany) -> + /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. + /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. + /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const -> observable::value_type, rxo::detail::flat_map> { @@ -368,10 +368,10 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); } - // - // takes any function that will take this observable and produce a result value. - // this is intended to allow externally defined operators to be connected into the expression. - // + /// + /// takes any function that will take this observable and produce a result value. + /// this is intended to allow externally defined operators to be connected into the expression. + /// template auto op(OperatorFactory&& of) const -> decltype(of(*(const this_type*)nullptr)) { diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index e832b52..22e3897 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -11,58 +11,14 @@ namespace rxcpp { namespace schedulers { -class test : public virtual_time +namespace detail { + +class test_type : public virtual_time { public: typedef virtual_time base; typedef base::clock_type clock_type; - typedef std::shared_ptr shared; - - static const long created_time = 100; - static const long subscribed_time = 200; - static const long unsubscribed_time = 1000; - - template - struct messages - { - typedef typename rxn::notification notification_type; - typedef rxn::recorded recorded_type; - - struct on_next_factory - { - recorded_type operator()(long ticks, T value) const { - return recorded_type(ticks, notification_type::on_next(value)); - } - }; - struct on_completed_factory - { - recorded_type operator()(long ticks) const { - return recorded_type(ticks, notification_type::on_completed()); - } - }; - struct on_error_factory - { - template - recorded_type operator()(long ticks, Exception&& e) const { - return recorded_type(ticks, notification_type::on_error(std::forward(e))); - } - }; - - static const on_next_factory on_next; - static const on_completed_factory on_completed; - static const on_error_factory on_error; - - struct subscribe_factory - { - rxn::subscription operator()(long subscribe, long unsubscribe) const { - return rxn::subscription(subscribe, unsubscribe); - } - }; - static const subscribe_factory subscribe; - - private: - ~messages(); - }; + typedef std::shared_ptr shared; using base::schedule_absolute; using base::schedule_relative; @@ -92,95 +48,16 @@ public: using base::start; - template - auto start(F&& createSource, long created, long subscribed, long unsubscribed) const - -> subscriber> - { - typename std::decay::type createSrc = std::forward(createSource); - - struct state_type - : public std::enable_shared_from_this - { - typedef decltype(std::forward(createSrc)()) source_type; - - std::unique_ptr source; - subscriber> o; - - explicit state_type(subscriber> o) - : source() - , o(o) - { - } - }; - std::shared_ptr state(new state_type(this->make_subscriber())); - - schedule_absolute(created, make_action([createSrc, state](const schedulable& scbl) { - state->source.reset(new typename state_type::source_type(createSrc())); - })); - schedule_absolute(subscribed, make_action([state](const schedulable& scbl) { - state->source->subscribe(state->o); - })); - schedule_absolute(unsubscribed, make_action([state](const schedulable& scbl) { - state->o.unsubscribe(); - })); - - start(); - - return state->o; - } - - template - auto start(F&& createSource, long unsubscribed) const - -> subscriber> - { - return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); - } - - template - auto start(F&& createSource) const - -> subscriber> - { - return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); - } - template rxt::testable_observable make_hot_observable(std::vector>>> messages) const; - template - auto make_hot_observable(const T (&arr) [size]) const - -> decltype(make_hot_observable(std::vector())) { - return make_hot_observable(rxu::to_vector(arr)); - } - template rxt::testable_observable make_cold_observable(std::vector>>> messages) const; - template - auto make_cold_observable(const T (&arr) [size]) const - -> decltype(make_cold_observable(std::vector())) { - return make_cold_observable(rxu::to_vector(arr)); - } - template subscriber> make_subscriber() const; }; -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::on_next = test::messages::on_next_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::on_completed = test::messages::on_completed_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::on_error = test::messages::on_error_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::subscribe_factory test::messages::subscribe = test::messages::subscribe_factory(); - template class mock_observer : public rxt::detail::test_subject_base @@ -189,12 +66,12 @@ class mock_observer typedef rxn::recorded recorded_type; public: - mock_observer(typename test::shared sc) + mock_observer(typename test_type::shared sc) : sc(sc) { } - typename test::shared sc; + typename test_type::shared sc; std::vector m; virtual void on_subscribe(subscriber) const { @@ -210,13 +87,13 @@ public: }; template -subscriber> test::make_subscriber() const +subscriber> test_type::make_subscriber() const { typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - - std::shared_ptr> ts(new mock_observer(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())))); - + + std::shared_ptr> ts(new mock_observer(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())))); + return rxcpp::make_subscriber(rxt::testable_observer(ts, make_observer_dynamic( // on_next [ts](T value) @@ -243,21 +120,21 @@ class cold_observable : public rxt::detail::test_subject_base { typedef cold_observable this_type; - typename test::shared sc; + typename test_type::shared sc; typedef rxn::recorded::type> recorded_type; mutable std::vector mv; mutable std::vector sv; public: - cold_observable(typename test::shared sc, std::vector mv) + cold_observable(typename test_type::shared sc, std::vector mv) : sc(sc) , mv(std::move(mv)) { } template - cold_observable(typename test::shared sc, Iterator begin, Iterator end) + cold_observable(typename test_type::shared sc, Iterator begin, Iterator end) : scheduler(sc) , mv(begin, end) { @@ -292,9 +169,9 @@ public: }; template -rxt::testable_observable test::make_cold_observable(std::vector>>> messages) const +rxt::testable_observable test_type::make_cold_observable(std::vector>>> messages) const { - auto co = std::shared_ptr>(new cold_observable(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); + auto co = std::shared_ptr>(new cold_observable(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); return rxt::testable_observable(co); } @@ -303,7 +180,7 @@ class hot_observable : public rxt::detail::test_subject_base { typedef hot_observable this_type; - typename test::shared sc; + typename test_type::shared sc; typedef rxn::recorded::type> recorded_type; typedef subscriber observer_type; mutable std::vector mv; @@ -312,7 +189,7 @@ class hot_observable public: - hot_observable(typename test::shared sc, std::vector mv) + hot_observable(typename test_type::shared sc, std::vector mv) : sc(sc) , mv(mv) { @@ -349,10 +226,196 @@ public: }; template -rxt::testable_observable test::make_hot_observable(std::vector>>> messages) const +rxt::testable_observable test_type::make_hot_observable(std::vector>>> messages) const { return rxt::testable_observable(std::make_shared>( - std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); + std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); +} + +} + +class test +{ + detail::test_type::shared tester; +public: + + explicit test(detail::test_type::shared t) + : tester(std::move(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 + struct messages + { + typedef typename rxn::notification notification_type; + typedef rxn::recorded recorded_type; + + struct on_next_factory + { + recorded_type operator()(long ticks, T value) const { + return recorded_type(ticks, notification_type::on_next(value)); + } + }; + struct on_completed_factory + { + recorded_type operator()(long ticks) const { + return recorded_type(ticks, notification_type::on_completed()); + } + }; + struct on_error_factory + { + template + recorded_type operator()(long ticks, Exception&& e) const { + return recorded_type(ticks, notification_type::on_error(std::forward(e))); + } + }; + + static const on_next_factory on_next; + static const on_completed_factory on_completed; + static const on_error_factory on_error; + + struct subscribe_factory + { + rxn::subscription operator()(long subscribe, long unsubscribe) const { + return rxn::subscription(subscribe, unsubscribe); + } + }; + static const subscribe_factory subscribe; + + private: + ~messages(); + }; + + void schedule_absolute(long when, action a) const { + tester->schedule_absolute(when, std::move(a)); + } + + void schedule_relative(long when, action a) const { + tester->schedule_relative(when, std::move(a)); + } + + template + typename std::enable_if::type, action>::value, void>::type + schedule_absolute(long when, F f) const { + tester->schedule_absolute(when, make_action(f)); + } + + + template + typename std::enable_if::type, action>::value, void>::type + schedule_relative(long when, F f) const { + tester->schedule_relative(when, make_action(f)); + } + + template + auto start(F&& createSource, long created, long subscribed, long unsubscribed) const + -> subscriber> + { + typename std::decay::type createSrc = std::forward(createSource); + + struct state_type + : public std::enable_shared_from_this + { + typedef decltype(std::forward(createSrc)()) source_type; + + std::unique_ptr source; + subscriber> o; + + explicit state_type(subscriber> o) + : source() + , o(o) + { + } + }; + std::shared_ptr state(new state_type(this->make_subscriber())); + + schedule_absolute(created, make_action([createSrc, state](const schedulable& scbl) { + state->source.reset(new typename state_type::source_type(createSrc())); + })); + schedule_absolute(subscribed, make_action([state](const schedulable& scbl) { + state->source->subscribe(state->o); + })); + schedule_absolute(unsubscribed, make_action([state](const schedulable& scbl) { + state->o.unsubscribe(); + })); + + tester->start(); + + return state->o; + } + + template + auto start(F&& createSource, long unsubscribed) const + -> subscriber> + { + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); + } + + template + auto start(F&& createSource) const + -> subscriber> + { + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); + } + + void start() const { + tester->start(); + } + + template + rxt::testable_observable make_hot_observable(std::vector>>> messages) const{ + return tester->make_hot_observable(std::move(messages)); + } + + template + auto make_hot_observable(const T (&arr) [size]) const + -> decltype(tester->make_hot_observable(std::vector())) { + return tester->make_hot_observable(rxu::to_vector(arr)); + } + + template + rxt::testable_observable make_cold_observable(std::vector>>> messages) const { + return tester->make_cold_observable(std::move(messages)); + } + + template + auto make_cold_observable(const T (&arr) [size]) const + -> decltype(tester->make_cold_observable(std::vector())) { + return tester->make_cold_observable(rxu::to_vector(arr)); + } + + template + subscriber> make_subscriber() const { + return tester->make_subscriber(); + } +}; + +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::on_next = test::messages::on_next_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::on_completed = test::messages::on_completed_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::on_error = test::messages::on_error_factory(); + +template +//static +RXCPP_SELECT_ANY const typename test::messages::subscribe_factory test::messages::subscribe = test::messages::subscribe_factory(); + + + +inline test make_test() { + return test(std::make_shared()); } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 82f426d..974e6d6 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -58,23 +58,11 @@ protected: public: virtual void schedule_absolute(absolute, action) const =0; - template - typename std::enable_if::type, action>::value, void>::type - schedule_absolute(absolute when, F f) const { - schedule_absolute(when, make_action(f)); - } - virtual void schedule_relative(relative when, action a) const { auto at = add(clock_now, when); return schedule_absolute(at, std::move(a)); } - template - typename std::enable_if::type, action>::value, void>::type - schedule_relative(relative when, F f) const { - schedule_relative(when, make_action(f)); - } - bool is_enabled() const {return isenabled;} absolute clock() const {return clock_now;} diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index f68fb4c..ac101ef 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -30,32 +30,38 @@ bool IsPrime(int x) SCENARIO("filter stops on completion", "[filter][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; - m::recorded_type messages[] = { - m::on_next(110, 1), - m::on_next(180, 2), - m::on_next(230, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(380, 6), - m::on_next(390, 7), - m::on_next(450, 8), - m::on_next(470, 9), - m::on_next(560, 10), - m::on_next(580, 11), - m::on_completed(600), - m::on_next(610, 12), - m::on_error(620, std::runtime_error("error in unsubscribed stream")), - m::on_completed(630) + record messages[] = { + 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) }; - auto xs = sc->make_hot_observable(messages); + auto xs = sc.make_hot_observable(messages); WHEN("filtered to ints that are primes"){ - auto res = sc->start( + auto res = sc.start( [&xs, &invoked]() { #if 0 && RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -81,12 +87,12 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ } ); THEN("the output only contains primes"){ - m::recorded_type items[] = { - m::on_next(230, 3), - m::on_next(340, 5), - m::on_next(390, 7), - m::on_next(580, 11), - m::on_completed(600) + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7), + on_next(580, 11), + on_completed(600) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -94,8 +100,8 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 600) + life items[] = { + subscribe(200, 600) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -112,30 +118,35 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; - m::recorded_type messages[] = { - m::on_next(110, 1), - m::on_next(180, 2), - m::on_next(230, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(380, 6), - m::on_next(390, 7), - m::on_next(450, 8), - m::on_next(470, 9), - m::on_next(560, 10), - m::on_next(580, 11), - m::on_completed(600) + record messages[] = { + 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) }; - auto xs = sc->make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); WHEN("filtered to ints that are primes"){ - auto res = sc->start( + auto res = sc.start( [&xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -159,10 +170,10 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ ); THEN("the output only contains primes that arrived before disposal"){ - m::recorded_type items[] = { - m::on_next(230, 3), - m::on_next(340, 5), - m::on_next(390, 7) + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -170,8 +181,8 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 400) + life items[] = { + subscribe(200, 400) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -187,39 +198,41 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ SCENARIO("filter stops on error", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; std::runtime_error ex("filter on_error from source"); - auto xs = sc->make_hot_observable( - [ex]() { - m::recorded_type messages[] = { - m::on_next(110, 1), - m::on_next(180, 2), - m::on_next(230, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(380, 6), - m::on_next(390, 7), - m::on_next(450, 8), - m::on_next(470, 9), - m::on_next(560, 10), - m::on_next(580, 11), - m::on_error(600, ex), - m::on_next(610, 12), - m::on_error(620, std::runtime_error("error in unsubscribed stream")), - m::on_completed(630) - }; - return rxu::to_vector(messages); - }() - ); + record messages[] = { + 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) + }; + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); WHEN("filtered to ints that are primes"){ - auto res = sc->start( + auto res = sc.start( [xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -242,12 +255,12 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ ); THEN("the output only contains primes"){ - m::recorded_type items[] = { - m::on_next(230, 3), - m::on_next(340, 5), - m::on_next(390, 7), - m::on_next(580, 11), - m::on_error(600, ex), + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7), + on_next(580, 11), + on_error(600, ex), }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -255,8 +268,8 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 600) + life items[] = { + subscribe(200, 600) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -272,39 +285,41 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; std::runtime_error ex("filter predicate error"); - auto xs = sc->make_hot_observable( - []() { - m::recorded_type messages[] = { - m::on_next(110, 1), - m::on_next(180, 2), - m::on_next(230, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(380, 6), - m::on_next(390, 7), - m::on_next(450, 8), - m::on_next(470, 9), - m::on_next(560, 10), - m::on_next(580, 11), - m::on_completed(600), - m::on_next(610, 12), - m::on_error(620, std::runtime_error("error in unsubscribed stream")), - m::on_completed(630) - }; - return rxu::to_vector(messages); - }() - ); + record messages[] = { + 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) + }; + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); WHEN("filtered to ints that are primes"){ - auto res = sc->start( + auto res = sc.start( [ex, xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -333,10 +348,10 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ ); THEN("the output only contains primes"){ - m::recorded_type items[] = { - m::on_next(230, 3), - m::on_next(340, 5), - m::on_error(380, ex) + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_error(380, ex) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -344,8 +359,8 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 380) + life items[] = { + subscribe(200, 380) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -361,41 +376,43 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; - auto xs = sc->make_hot_observable( - []() { - m::recorded_type messages[] = { - m::on_next(110, 1), - m::on_next(180, 2), - m::on_next(230, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(380, 6), - m::on_next(390, 7), - m::on_next(450, 8), - m::on_next(470, 9), - m::on_next(560, 10), - m::on_next(580, 11), - m::on_completed(600), - m::on_next(610, 12), - m::on_error(620, std::exception()), - m::on_completed(630) - }; - return rxu::to_vector(messages); - }() - ); + record messages[] = { + 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 xs = sc.make_hot_observable(rxu::to_vector(messages)); - auto res = sc->make_subscriber(); + auto res = sc.make_subscriber(); rx::observable> ys; WHEN("filtered to ints that are primes"){ - sc->schedule_absolute(rxsc::test::created_time, + sc.schedule_absolute(rxsc::test::created_time, [&invoked, &res, &ys, &xs](const rxsc::schedulable& scbl) { #if RXCPP_USE_OBSERVABLE_MEMBERS ys = xs @@ -414,29 +431,23 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") return IsPrime(x); }); #endif - scbl.unsubscribe(); - return scbl; }); - sc->schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { + sc.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { ys.subscribe(res); - scbl.unsubscribe(); - return scbl; }); - sc->schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl) { + sc.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl) { res.unsubscribe(); - scbl.unsubscribe(); - return scbl; }); - sc->start(); + sc.start(); THEN("the output only contains primes"){ - m::recorded_type items[] = { - m::on_next(230, 3), - m::on_next(340, 5), - m::on_next(390, 7) + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -444,8 +455,8 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 450) + life items[] = { + subscribe(200, 450) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index ffceaf4..1fff6a4 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -14,31 +14,42 @@ namespace rxt=rxcpp::test; SCENARIO("flat_map completes", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; + typedef rxn::subscription life; - m::recorded_type int_messages[] = { - m::on_next(100, 4), - m::on_next(200, 2), - m::on_next(300, 3), - m::on_next(400, 1), - m::on_completed(500) + typedef m::recorded_type irecord; + auto ion_next = m::on_next; + auto ion_completed = m::on_completed; + auto isubscribe = m::subscribe; + + typedef ms::recorded_type srecord; + auto son_next = ms::on_next; + auto son_completed = ms::on_completed; + auto ssubscribe = ms::subscribe; + + irecord int_messages[] = { + ion_next(100, 4), + ion_next(200, 2), + ion_next(300, 3), + ion_next(400, 1), + ion_completed(500) }; - auto xs = sc->make_cold_observable(int_messages); - - ms::recorded_type string_messages[] = { - ms::on_next(50, "foo"), - ms::on_next(100, "bar"), - ms::on_next(150, "baz"), - ms::on_next(200, "qux"), - ms::on_completed(250) + auto xs = sc.make_cold_observable(int_messages); + + srecord string_messages[] = { + son_next(50, "foo"), + son_next(100, "bar"), + son_next(150, "baz"), + son_next(200, "qux"), + son_completed(250) }; - auto ys = sc->make_cold_observable(string_messages); + auto ys = sc.make_cold_observable(string_messages); WHEN("each int is mapped to the strings"){ - auto res = sc->start( + auto res = sc.start( [&]() { return xs .flat_map( @@ -52,24 +63,24 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - ms::recorded_type items[] = { - ms::on_next(350, "foo"), - ms::on_next(400, "bar"), - ms::on_next(450, "baz"), - ms::on_next(450, "foo"), - ms::on_next(500, "qux"), - ms::on_next(500, "bar"), - ms::on_next(550, "baz"), - ms::on_next(550, "foo"), - ms::on_next(600, "qux"), - ms::on_next(600, "bar"), - ms::on_next(650, "baz"), - ms::on_next(650, "foo"), - ms::on_next(700, "bar"), - ms::on_next(700, "qux"), - ms::on_next(750, "baz"), - ms::on_next(800, "qux"), - ms::on_completed(850) + srecord items[] = { + son_next(350, "foo"), + son_next(400, "bar"), + son_next(450, "baz"), + son_next(450, "foo"), + son_next(500, "qux"), + son_next(500, "bar"), + son_next(550, "baz"), + son_next(550, "foo"), + son_next(600, "qux"), + son_next(600, "bar"), + son_next(650, "baz"), + son_next(650, "foo"), + son_next(700, "bar"), + son_next(700, "qux"), + son_next(750, "baz"), + son_next(800, "qux"), + son_completed(850) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -77,8 +88,8 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ } THEN("there was one subscription and one unsubscription to the ints"){ - rxn::subscription items[] = { - m::subscribe(200, 700) + life items[] = { + isubscribe(200, 700) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -86,11 +97,11 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ } THEN("there were four subscription and unsubscription to the strings"){ - rxn::subscription items[] = { - ms::subscribe(300, 550), - ms::subscribe(400, 650), - ms::subscribe(500, 750), - ms::subscribe(600, 850) + life items[] = { + ssubscribe(300, 550), + ssubscribe(400, 650), + ssubscribe(500, 750), + ssubscribe(600, 850) }; auto required = rxu::to_vector(items); auto actual = ys.subscriptions(); @@ -103,32 +114,42 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; + typedef rxn::subscription life; + + typedef m::recorded_type irecord; + auto ion_next = m::on_next; + auto isubscribe = m::subscribe; - m::recorded_type int_messages[] = { - m::on_next(100, 4), - m::on_next(200, 2), - m::on_next(300, 3), - m::on_next(400, 1), - m::on_next(500, 5), - m::on_next(700, 0) + typedef ms::recorded_type srecord; + auto son_next = ms::on_next; + auto son_completed = ms::on_completed; + auto ssubscribe = ms::subscribe; + + irecord int_messages[] = { + ion_next(100, 4), + ion_next(200, 2), + ion_next(300, 3), + ion_next(400, 1), + ion_next(500, 5), + ion_next(700, 0) }; - auto xs = sc->make_cold_observable(int_messages); - - ms::recorded_type string_messages[] = { - ms::on_next(50, "foo"), - ms::on_next(100, "bar"), - ms::on_next(150, "baz"), - ms::on_next(200, "qux"), - ms::on_completed(250) + auto xs = sc.make_cold_observable(int_messages); + + srecord string_messages[] = { + son_next(50, "foo"), + son_next(100, "bar"), + son_next(150, "baz"), + son_next(200, "qux"), + son_completed(250) }; - auto ys = sc->make_cold_observable(string_messages); + auto ys = sc.make_cold_observable(string_messages); WHEN("each int is mapped to the strings"){ - auto res = sc->start( + auto res = sc.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) @@ -138,28 +159,28 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - ms::recorded_type items[] = { - ms::on_next(350, "foo"), - ms::on_next(400, "bar"), - ms::on_next(450, "baz"), - ms::on_next(450, "foo"), - ms::on_next(500, "bar"), - ms::on_next(500, "qux"), - ms::on_next(550, "baz"), - ms::on_next(550, "foo"), - ms::on_next(600, "bar"), - ms::on_next(600, "qux"), - ms::on_next(650, "baz"), - ms::on_next(650, "foo"), - ms::on_next(700, "bar"), - ms::on_next(700, "qux"), - ms::on_next(750, "baz"), - ms::on_next(750, "foo"), - ms::on_next(800, "bar"), - ms::on_next(800, "qux"), - ms::on_next(850, "baz"), - ms::on_next(900, "qux"), - ms::on_next(950, "foo") + srecord items[] = { + son_next(350, "foo"), + son_next(400, "bar"), + son_next(450, "baz"), + son_next(450, "foo"), + son_next(500, "bar"), + son_next(500, "qux"), + son_next(550, "baz"), + son_next(550, "foo"), + son_next(600, "bar"), + son_next(600, "qux"), + son_next(650, "baz"), + son_next(650, "foo"), + son_next(700, "bar"), + son_next(700, "qux"), + son_next(750, "baz"), + son_next(750, "foo"), + son_next(800, "bar"), + son_next(800, "qux"), + son_next(850, "baz"), + son_next(900, "qux"), + son_next(950, "foo") }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -167,8 +188,8 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ } THEN("there was one subscription and one unsubscription to the ints"){ - rxn::subscription items[] = { - m::subscribe(200, 1000) + life items[] = { + isubscribe(200, 1000) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -176,13 +197,13 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ } THEN("there were four subscription and unsubscription to the strings"){ - rxn::subscription items[] = { - ms::subscribe(300, 550), - ms::subscribe(400, 650), - ms::subscribe(500, 750), - ms::subscribe(600, 850), - ms::subscribe(700, 950), - ms::subscribe(900, 1000) + life items[] = { + ssubscribe(300, 550), + ssubscribe(400, 650), + ssubscribe(500, 750), + ssubscribe(600, 850), + ssubscribe(700, 950), + ssubscribe(900, 1000) }; auto required = rxu::to_vector(items); auto actual = ys.subscriptions(); @@ -194,33 +215,44 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; + typedef rxn::subscription life; + + typedef m::recorded_type irecord; + auto ion_next = m::on_next; + auto ion_completed = m::on_completed; + auto isubscribe = m::subscribe; + + typedef ms::recorded_type srecord; + auto son_next = ms::on_next; + auto son_error = ms::on_error; + auto ssubscribe = ms::subscribe; - m::recorded_type int_messages[] = { - m::on_next(100, 4), - m::on_next(200, 2), - m::on_next(300, 3), - m::on_next(400, 1), - m::on_completed(500) + irecord int_messages[] = { + ion_next(100, 4), + ion_next(200, 2), + ion_next(300, 3), + ion_next(400, 1), + ion_completed(500) }; - auto xs = sc->make_cold_observable(int_messages); + auto xs = sc.make_cold_observable(int_messages); std::runtime_error ex("filter on_error from inner source"); - ms::recorded_type string_messages[] = { - ms::on_next(55, "foo"), - ms::on_next(104, "bar"), - ms::on_next(153, "baz"), - ms::on_next(202, "qux"), - ms::on_error(301, ex) + srecord string_messages[] = { + son_next(55, "foo"), + son_next(104, "bar"), + son_next(153, "baz"), + son_next(202, "qux"), + son_error(301, ex) }; - auto ys = sc->make_cold_observable(string_messages); + auto ys = sc.make_cold_observable(string_messages); WHEN("each int is mapped to the strings"){ - auto res = sc->start( + auto res = sc.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) @@ -230,16 +262,16 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - ms::recorded_type items[] = { - ms::on_next(355, "foo"), - ms::on_next(404, "bar"), - ms::on_next(453, "baz"), - ms::on_next(455, "foo"), - ms::on_next(502, "qux"), - ms::on_next(504, "bar"), - ms::on_next(553, "baz"), - ms::on_next(555, "foo"), - ms::on_error(601, ex) + srecord items[] = { + son_next(355, "foo"), + son_next(404, "bar"), + son_next(453, "baz"), + son_next(455, "foo"), + son_next(502, "qux"), + son_next(504, "bar"), + son_next(553, "baz"), + son_next(555, "foo"), + son_error(601, ex) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -247,8 +279,8 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ } THEN("there was one subscription and one unsubscription to the ints"){ - rxn::subscription items[] = { - m::subscribe(200, 601) + life items[] = { + isubscribe(200, 601) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); @@ -256,11 +288,11 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ } THEN("there were four subscription and unsubscription to the strings"){ - rxn::subscription items[] = { - ms::subscribe(300, 601), - ms::subscribe(400, 601), - ms::subscribe(500, 601), - ms::subscribe(600, 601) + life items[] = { + ssubscribe(300, 601), + ssubscribe(400, 601), + ssubscribe(500, 601), + ssubscribe(600, 601) }; auto required = rxu::to_vector(items); auto actual = ys.subscriptions(); diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp index 61da39c..354fd24 100644 --- a/Rx/v2/test/operators/map.cpp +++ b/Rx/v2/test/operators/map.cpp @@ -15,15 +15,18 @@ namespace rxt=rxcpp::test; SCENARIO("map stops on completion", "[map][operators]"){ GIVEN("a test hot observable of ints"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; auto on_next = m::on_next; auto on_error = m::on_error; auto on_completed = m::on_completed; + auto subscribe = m::subscribe; long invoked = 0; - m::recorded_type messages[] = { + record messages[] = { on_next(180, 1), on_next(210, 2), on_next(240, 3), @@ -34,11 +37,11 @@ SCENARIO("map stops on completion", "[map][operators]"){ on_completed(420), on_error(430, std::runtime_error("error on unsubscribed stream")) }; - auto xs = sc->make_hot_observable(messages); + auto xs = sc.make_hot_observable(messages); WHEN("mapped to ints that are one larger"){ - auto res = sc->start( + auto res = sc.start( [xs, &invoked]() { return xs .map([&invoked](int x) { @@ -51,12 +54,12 @@ SCENARIO("map stops on completion", "[map][operators]"){ ); THEN("the output stops on completion"){ - m::recorded_type items[] = { - m::on_next(210, 3), - m::on_next(240, 4), - m::on_next(290, 5), - m::on_next(350, 6), - m::on_completed(400) + record items[] = { + on_next(210, 3), + on_next(240, 4), + on_next(290, 5), + on_next(350, 6), + on_completed(400) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -64,8 +67,8 @@ SCENARIO("map stops on completion", "[map][operators]"){ } THEN("there was one subscription and one unsubscription"){ - rxn::subscription items[] = { - m::subscribe(200, 400) + life items[] = { + subscribe(200, 400) }; auto required = rxu::to_vector(items); auto actual = xs.subscriptions(); diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 197bc33..06c2f49 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -153,67 +153,70 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; - - m::recorded_type messages[] = { - m::on_next(70, 1), - m::on_next(110, 2), - m::on_next(220, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7), - m::on_next(630, 8), - m::on_next(710, 9), - m::on_next(870, 10), - m::on_next(940, 11), - m::on_next(1020, 12) + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + + record messages[] = { + 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) }; - auto xs = sc->make_hot_observable(messages); + auto xs = sc.make_hot_observable(messages); rxsub::subject s; - auto results1 = sc->make_subscriber(); + auto results1 = sc.make_subscriber(); - auto results2 = sc->make_subscriber(); + auto results2 = sc.make_subscriber(); - auto results3 = sc->make_subscriber(); + auto results3 = sc.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc->start(); + sc.start(); THEN("result1 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7) + record items[] = { + on_next(340, 5), + on_next(410, 6), + on_next(520, 7) }; auto required = rxu::to_vector(items); auto actual = results1.get_observer().messages(); @@ -221,10 +224,10 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ } THEN("result2 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(410, 6), - m::on_next(520, 7), - m::on_next(630, 8) + record items[] = { + on_next(410, 6), + on_next(520, 7), + on_next(630, 8) }; auto required = rxu::to_vector(items); auto actual = results2.get_observer().messages(); @@ -232,8 +235,8 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ } THEN("result3 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(940, 11) + record items[] = { + on_next(940, 11) }; auto required = rxu::to_vector(items); auto actual = results3.get_observer().messages(); @@ -247,66 +250,71 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ SCENARIO("subject - finite source", "[subject][subjects]"){ GIVEN("a subject and an finite source"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; - - m::recorded_type messages[] = { - m::on_next(70, 1), - m::on_next(110, 2), - m::on_next(220, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7), - m::on_completed(630), - m::on_next(640, 9), - m::on_completed(650), - m::on_error(660, std::runtime_error("error on unsubscribed stream")) + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + + record messages[] = { + 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")) }; - auto xs = sc->make_hot_observable(messages); + auto xs = sc.make_hot_observable(messages); rxsub::subject s; - auto results1 = sc->make_subscriber(); + auto results1 = sc.make_subscriber(); - auto results2 = sc->make_subscriber(); + auto results2 = sc.make_subscriber(); - auto results3 = sc->make_subscriber(); + auto results3 = sc.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc->start(); + sc.start(); THEN("result1 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7) + record items[] = { + on_next(340, 5), + on_next(410, 6), + on_next(520, 7) }; auto required = rxu::to_vector(items); auto actual = results1.get_observer().messages(); @@ -314,10 +322,10 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ } THEN("result2 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(410, 6), - m::on_next(520, 7), - m::on_completed(630) + record items[] = { + on_next(410, 6), + on_next(520, 7), + on_completed(630) }; auto required = rxu::to_vector(items); auto actual = results2.get_observer().messages(); @@ -325,8 +333,8 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ } THEN("result3 contains expected messages"){ - m::recorded_type items[] = { - m::on_completed(900) + record items[] = { + on_completed(900) }; auto required = rxu::to_vector(items); auto actual = results3.get_observer().messages(); @@ -341,68 +349,73 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ SCENARIO("subject - on_error in source", "[subject][subjects]"){ GIVEN("a subject and a source with an error"){ - auto sc = std::make_shared(); + auto sc = rxsc::make_test(); typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; std::runtime_error ex("subject on_error in stream"); - m::recorded_type messages[] = { - m::on_next(70, 1), - m::on_next(110, 2), - m::on_next(220, 3), - m::on_next(270, 4), - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7), - m::on_error(630, ex), - m::on_next(640, 9), - m::on_completed(650), - m::on_error(660, std::runtime_error("error on unsubscribed stream")) + record messages[] = { + 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")) }; - auto xs = sc->make_hot_observable(messages); + auto xs = sc.make_hot_observable(messages); rxsub::subject s; - auto results1 = sc->make_subscriber(); + auto results1 = sc.make_subscriber(); - auto results2 = sc->make_subscriber(); + auto results2 = sc.make_subscriber(); - auto results3 = sc->make_subscriber(); + auto results3 = sc.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc->schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc->schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc->schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc->schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc->schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc->schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc->schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc->schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc->schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc->start(); + sc.start(); THEN("result1 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(340, 5), - m::on_next(410, 6), - m::on_next(520, 7) + record items[] = { + on_next(340, 5), + on_next(410, 6), + on_next(520, 7) }; auto required = rxu::to_vector(items); auto actual = results1.get_observer().messages(); @@ -410,10 +423,10 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ } THEN("result2 contains expected messages"){ - m::recorded_type items[] = { - m::on_next(410, 6), - m::on_next(520, 7), - m::on_error(630, ex) + record items[] = { + on_next(410, 6), + on_next(520, 7), + on_error(630, ex) }; auto required = rxu::to_vector(items); auto actual = results2.get_observer().messages(); @@ -421,8 +434,8 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ } THEN("result3 contains expected messages"){ - m::recorded_type items[] = { - m::on_error(900, ex) + record items[] = { + on_error(900, ex) }; auto required = rxu::to_vector(items); auto actual = results3.get_observer().messages(); diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 1d1f002..2ea1999 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -46,17 +46,15 @@ SCENARIO("subscriber traits", "[observer][traits]"){ REQUIRE(result == 1); } } - WHEN("onnext is called with 1 after error"){ + WHEN("after error"){ THEN("subscriber result is 10"){ scrbResult.on_error(std::current_exception()); - scrbResult.on_next(1); REQUIRE(result == 10); } } - WHEN("onnext is called with 1 after completed"){ + WHEN("after completed"){ THEN("subscriber result is 100"){ scrbResult.on_completed(); - scrbResult.on_next(1); REQUIRE(result == 100); } } @@ -150,47 +148,39 @@ SCENARIO("subscriber behavior", "[observer][traits]"){ REQUIRE(so.is_subscribed()); } } - WHEN("onnext is called with 1 after error"){ + WHEN("after error"){ THEN("dynamic_observer result is 10"){ dob.on_error(std::current_exception()); - dob.on_next(1); REQUIRE(result == 10); } THEN("static_observer result is 10"){ so.on_error(std::current_exception()); - so.on_next(1); REQUIRE(result == 10); } THEN("dynamic_observer is not subscribed"){ dob.on_error(std::current_exception()); - dob.on_next(1); REQUIRE(!dob.is_subscribed()); } THEN("static_observer is not subscribed"){ so.on_error(std::current_exception()); - so.on_next(1); REQUIRE(!so.is_subscribed()); } } - WHEN("onnext is called with 1 after completed"){ + WHEN("after completed"){ THEN("dynamic_observer result is 100"){ dob.on_completed(); - dob.on_next(1); REQUIRE(result == 100); } THEN("static_observer result is 100"){ so.on_completed(); - so.on_next(1); REQUIRE(result == 100); } THEN("dynamic_observer is not subscribed"){ dob.on_completed(); - dob.on_next(1); REQUIRE(!dob.is_subscribed()); } THEN("static_observer is not subscribed"){ so.on_completed(); - so.on_next(1); REQUIRE(!so.is_subscribed()); } } -- GitLab From 0519373432d51ae2ecdfa6a12e16df9c9c08103d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 23 Mar 2014 22:41:28 -0700 Subject: [PATCH 234/782] fix test scheduler - tests pass again --- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 68 ++++++++++--------- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 16 ++--- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 22e3897..443f7e8 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -23,12 +23,12 @@ public: using base::schedule_absolute; using base::schedule_relative; - virtual void schedule_absolute(long when, action a) const + 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, std::move(a)); + return base::schedule_absolute(when, a); } virtual long add(long absolute, long relative) const @@ -135,7 +135,7 @@ public: template cold_observable(typename test_type::shared sc, Iterator begin, Iterator end) - : scheduler(sc) + : sc(sc) , mv(begin, end) { } @@ -146,11 +146,13 @@ public: for (auto& message : mv) { auto n = message.value(); - sc->schedule_relative(message.time(), make_action([n, o](const schedulable& scbl) { - n->accept(o); - scbl.unsubscribe(); - return scbl; - })); + sc->schedule_relative(message.time(), make_schedulable( + scheduler(std::static_pointer_cast(sc)), + [n, o](const schedulable& scbl) { + if (o.is_subscribed()) { + n->accept(o); + } + })); } auto sharedThis = std::static_pointer_cast(this->shared_from_this()); @@ -195,13 +197,16 @@ public: { for (auto& message : mv) { auto n = message.value(); - sc->schedule_absolute(message.time(), make_action([this, n](const schedulable& scbl) { - auto local = this->observers; - for (auto& o : local) { - n->accept(o); - } - return schedulable::empty(scbl.get_scheduler()); - })); + sc->schedule_absolute(message.time(), make_schedulable( + scheduler(std::static_pointer_cast(sc)), + [this, n](const schedulable& scbl) { + auto local = this->observers; + for (auto& o : local) { + if (o.is_subscribed()) { + n->accept(o); + } + } + })); } } @@ -234,13 +239,14 @@ rxt::testable_observable test_type::make_hot_observable(std::vector(t)) + , tester(t) { } @@ -292,25 +298,25 @@ public: ~messages(); }; - void schedule_absolute(long when, action a) const { - tester->schedule_absolute(when, std::move(a)); + void schedule_absolute(long when, const schedulable& a) const { + tester->schedule_absolute(when, a); } - void schedule_relative(long when, action a) const { - tester->schedule_relative(when, std::move(a)); + void schedule_relative(long when, const schedulable& a) const { + tester->schedule_relative(when, a); } template - typename std::enable_if::type, action>::value, void>::type + typename std::enable_if::type, schedulable>::value, void>::type schedule_absolute(long when, F f) const { - tester->schedule_absolute(when, make_action(f)); + tester->schedule_absolute(when, make_schedulable(*this, f)); } template - typename std::enable_if::type, action>::value, void>::type + typename std::enable_if::type, schedulable>::value, void>::type schedule_relative(long when, F f) const { - tester->schedule_relative(when, make_action(f)); + tester->schedule_relative(when, make_schedulable(*this, f)); } template @@ -335,15 +341,15 @@ public: }; std::shared_ptr state(new state_type(this->make_subscriber())); - schedule_absolute(created, make_action([createSrc, state](const schedulable& scbl) { + schedule_absolute(created, [createSrc, state](const schedulable& scbl) { state->source.reset(new typename state_type::source_type(createSrc())); - })); - schedule_absolute(subscribed, make_action([state](const schedulable& scbl) { + }); + schedule_absolute(subscribed, [state](const schedulable& scbl) { state->source->subscribe(state->o); - })); - schedule_absolute(unsubscribed, make_action([state](const schedulable& scbl) { + }); + schedule_absolute(unsubscribed, [state](const schedulable& scbl) { state->o.unsubscribe(); - })); + }); tester->start(); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 974e6d6..5d6c759 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -56,11 +56,11 @@ protected: virtual bool empty() const =0; public: - virtual void schedule_absolute(absolute, action) const =0; + virtual void schedule_absolute(absolute, const schedulable&) const =0; - virtual void schedule_relative(relative when, action a) const { + virtual void schedule_relative(relative when, const schedulable& a) const { auto at = add(clock_now, when); - return schedule_absolute(at, std::move(a)); + return schedule_absolute(at, a); } bool is_enabled() const {return isenabled;} @@ -162,15 +162,15 @@ public: } virtual void schedule(const schedulable& scbl) const { - schedule_absolute(clock_now, scbl.get_action()); + schedule_absolute(clock_now, scbl); } virtual void schedule(clock_type::duration when, const schedulable& scbl) const { - schedule_absolute(to_relative(when), scbl.get_action()); + schedule_absolute(to_relative(when), scbl); } virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { - schedule_absolute(to_relative(when - now()), scbl.get_action()); + schedule_absolute(to_relative(when - now()), scbl); } }; @@ -230,7 +230,7 @@ protected: using base::schedule_absolute; using base::schedule_relative; - virtual void schedule_absolute(typename base::absolute when, action a) const + 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( @@ -240,7 +240,7 @@ protected: r.reset(false); if (scbl.is_subscribed()) { scbl.unsubscribe(); // unsubscribe() run, not a; - a(scbl, r.get_recurse()); + a(a, r.get_recurse()); } }); queue.push(item_type(when, run)); -- GitLab From 4e02f4b3cbda35b4b92ea07338a28b5703db078b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 24 Mar 2014 08:10:22 -0700 Subject: [PATCH 235/782] reduce race in subject --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 2 +- Rx/v2/test/subjects/subject.cpp | 97 +++++++++++++++++++------ 2 files changed, 76 insertions(+), 23 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index ff853ec..b74b356 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -59,8 +59,8 @@ class multicast_observer completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { - state->has_observers.exchange(true); ++state->completers; + state->has_observers.exchange(true); if (old) { observers.reserve(old->observers.size() + 1); std::copy_if( diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 06c2f49..ac8ed91 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -25,51 +25,72 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ const int onnextcalls = 10000000; { + std::mutex m; int c = 0; int n = 1; - auto o = rx::make_observer([&c](int){++c;}); auto start = clock::now(); for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); + std::unique_lock guard(m); + ++c; } - o.on_completed(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } { int c = 0; int n = 1; + auto o = rx::make_observer( + [&c](int){++c;}, + [](std::exception_ptr){abort();}); auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe( - [&c](int){ - ++c; - }); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); + } + o.on_completed(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "range no subject : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop -> observer : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } { - std::mutex m; int c = 0; int n = 1; + auto o = rx::make_observer( + [&c](int){++c;}, + [](std::exception_ptr){abort();}); auto start = clock::now(); for (int i = 0; i < onnextcalls; i++) { - std::unique_lock guard(m); - ++c; + o.on_next(i); } + o.on_completed(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + + { + int c = 0; + int n = 1; + auto start = clock::now(); + rxs::range(0, onnextcalls).subscribe( + [&c](int){ + ++c; + }, + [](std::exception_ptr){abort();}); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } for (int n = 0; n < 10; n++) { + auto p = std::make_shared(0); auto c = std::make_shared(0); rxsub::subject sub; @@ -79,6 +100,11 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ auto o = sub.get_subscriber(); + o.add(rx::make_subscription([c, n, onnextcalls](){ + 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]() { @@ -88,27 +114,37 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ rx::composite_subscription cs; source.subscribe(cs, [cs](int){ cs.unsubscribe(); - }); + }, + [](std::exception_ptr){abort();}); } return 0; }); #endif - sub.get_observable().subscribe([c](int){++(*c);}); + sub.get_observable().subscribe( + [c, p](int){ + ++(*c); + }, + [](std::exception_ptr){abort();}); } auto start = clock::now(); for (int i = 0; i < onnextcalls; 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(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "loop : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "loop -> subject : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } for (int n = 0; n < 10; n++) { + auto p = std::make_shared(0); auto c = std::make_shared(0); rxsub::subject sub; @@ -118,6 +154,11 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ auto o = sub.get_subscriber(); + o.add(rx::make_subscription([c, n, onnextcalls](){ + 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]() { @@ -126,23 +167,35 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ rx::composite_subscription cs; sub.get_observable().subscribe(cs, [cs](int){ cs.unsubscribe(); - }); + }, + [](std::exception_ptr){abort();}); } return 0; }); #endif sub.get_observable() - // demonstrates insertion of user definied operator - .op(rxo::filter([](int){return true;})) - .subscribe([c](int){++(*c);}); + .subscribe( + [c, p](int){ + ++(*c); + }, + [](std::exception_ptr){abort();} + ); } auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe(o); + rxs::range(0, 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(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "range : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "range -> subject : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } } -- GitLab From 087ba2b7de05e9922809799754fce7a40bd09698 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 24 Mar 2014 11:50:39 -0700 Subject: [PATCH 236/782] fix race *and* improve perf in subject that is rare! --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 42 ++++++++++++------------- Rx/v2/test/subjects/subject.cpp | 4 +-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index b74b356..b252674 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -40,8 +40,7 @@ class multicast_observer : current(mode::Casting) { } - std::atomic has_observers; - std::atomic completers; + std::atomic generation; std::mutex lock; typename mode::type current; std::exception_ptr error; @@ -52,15 +51,10 @@ class multicast_observer { ~completer_type() { - if (--state->completers == 0) { - state->has_observers.exchange(false); - } } completer_type(std::shared_ptr s, const std::shared_ptr& old, observer_type o) : state(s) { - ++state->completers; - state->has_observers.exchange(true); if (old) { observers.reserve(old->observers.size() + 1); std::copy_if( @@ -76,7 +70,7 @@ class multicast_observer list_type observers; }; - // this type exists to prevent a circular ref between state and completer + // this type prevents a circular ref between state and completer struct binder_type : public std::enable_shared_from_this { @@ -87,6 +81,10 @@ class multicast_observer std::shared_ptr state; + // used to avoid taking lock in on_next + mutable int current_generation; + mutable std::shared_ptr current_completer; + // must only be accessed under state->lock mutable std::shared_ptr completer; }; @@ -106,7 +104,7 @@ public: { } bool has_observers() const { - return b->state->has_observers; + return b->current_completer && !b->current_completer->observers.empty(); } void add(observer_type o) const { std::unique_lock guard(b->state->lock); @@ -115,6 +113,7 @@ public: { if (o.is_subscribed()) { b->completer = std::make_shared(b->state, b->completer, o); + ++b->state->generation; } } break; @@ -138,19 +137,20 @@ public: } } void on_next(T t) const { - if (has_observers()) { - std::shared_ptr c; - { - std::unique_lock guard(b->state->lock); - if (!b->completer) { - return; - } - c = b->completer; + if (b->current_generation != b->state->generation) { + std::unique_lock guard(b->state->lock); + if (!b->completer) { + return; } - for (auto& o : c->observers) { - if (o.is_subscribed()) { - o.on_next(t); - } + b->current_generation = b->state->generation; + b->current_completer = b->completer; + } + if (!b->current_completer || b->current_completer->observers.empty()) { + return; + } + for (auto& o : b->current_completer->observers) { + if (o.is_subscribed()) { + o.on_next(t); } } } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index ac8ed91..0cec63f 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -1,5 +1,5 @@ -#define RXCPP_SUBJECT_TEST_ASYNC 1 +#define RXCPP_SUBJECT_TEST_ASYNC 0 #include "rxcpp/rx.hpp" namespace rx=rxcpp; @@ -22,7 +22,7 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ using namespace std::chrono; typedef steady_clock clock; - const int onnextcalls = 10000000; + const int onnextcalls = 100000000; { std::mutex m; -- GitLab From 1f064fed0f023426bfbe8e00dd751999665d40f1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 24 Mar 2014 12:21:11 -0700 Subject: [PATCH 237/782] initialize current_generation --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 1 + Rx/v2/test/subjects/subject.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index b252674..a0b606f 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -76,6 +76,7 @@ class multicast_observer { binder_type() : state(std::make_shared()) + , current_generation(0) { } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 0cec63f..9a7544a 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -1,5 +1,5 @@ -#define RXCPP_SUBJECT_TEST_ASYNC 0 +#define RXCPP_SUBJECT_TEST_ASYNC 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; -- GitLab From c64d4b8319d7198fdb16721b5ae3c3577dd3935e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 25 Mar 2014 12:49:46 -0700 Subject: [PATCH 238/782] changes to arg resolver --- Rx/v2/src/rxcpp/rx-observer.hpp | 28 ++--- Rx/v2/src/rxcpp/rx-util.hpp | 188 +++++++++++++++++++++++--------- 2 files changed, 148 insertions(+), 68 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 0aee374..c1e22a9 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -244,18 +244,7 @@ auto make_observer() } namespace detail { - -template -auto make_observer_resolved(ResolvedArgSet&& rs) - -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { - return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); -} -template -auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) - -> observer> { - return make_observer_resolved>(std::forward(rs)); -} - + template auto make_observer_resolved(ResolvedArgSet&& rs) -> observer { @@ -264,17 +253,28 @@ auto make_observer_resolved(ResolvedArgSet&& rs) std::move(std::get<0>(std::forward(rs)).value), std::move(std::get<1>(std::forward(rs)).value), std::move(std::get<2>(std::forward(rs)).value))); - + typedef typename std::decay(std::forward(rs)))>::type rn_t; typedef typename std::decay(std::forward(rs)))>::type re_t; typedef typename std::decay(std::forward(rs)))>::type rc_t; - + static_assert(rn_t::is_arg, "onnext is a required parameter"); static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } +template +auto make_observer_resolved(ResolvedArgSet&& rs) + -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { + return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); +} +template +auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) + -> observer> { + return make_observer_resolved>(std::forward(rs)); +} + template struct tag_onnext_resolution { diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 71d75c7..61d4786 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -200,8 +200,6 @@ private: #if RXCPP_USE_VARIADIC_TEMPLATES -namespace detail { - template struct select_arg { @@ -221,44 +219,59 @@ struct select_arg } }; -} +template +struct resolved_arg +{ + typedef resolved_arg this_type; + static const int n = N; + static const bool is_arg = true; + typedef T result_type; + result_type value; + template + explicit resolved_arg(Value&& v) + : value(std::forward(v)) + { + } + template + static this_type make(CArgN&&... can) { + return this_type(select_arg::get(std::forward(can)...)); + } +}; + +template +struct resolved_arg<-1, T> +{ + typedef resolved_arg<-1, T> this_type; + static const int n = -1; + static const bool is_arg = false; + typedef T result_type; + result_type value; + template + static this_type make(CArgN&&... can) { + return this_type(); + } +}; template class Predicate, class Default, class... ArgN> struct arg_resolver_n; - + template class Predicate, class Default, class Arg, class... ArgN> struct arg_resolver_n { static const int n = N; - static const bool is_arg = true; - typedef Arg result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n next_type; - typedef typename std::conditional::value, this_type, typename next_type::type>::type type; - result_type value; - template - arg_resolver_n(CArgN&&... can) - : value(detail::select_arg::get(std::forward(can)...)) { - } + typedef typename std::conditional::value, this_type, typename next_type::type>::type type; }; template class Predicate, class Default> struct arg_resolver_n { static const int n = -1; - static const bool is_arg = false; - typedef Default result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef this_type type; - result_type value; - template - struct select_arg - { - }; - template - arg_resolver_n(CArgN&&...) - : value() { - } }; #else template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> @@ -274,9 +287,14 @@ struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) - : value(std::forward(a)) { + static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) + { + return this_type(std::forward(a)); } }; @@ -290,9 +308,14 @@ struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) - : value(std::forward(a)) { + static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) + { + return this_type(std::forward(a)); } }; @@ -306,9 +329,14 @@ struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) - : value(std::forward(a)) { + static this_type make(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) + { + return this_type(std::forward(a)); } }; @@ -322,9 +350,14 @@ struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) - : value(std::forward(a)) { + static this_type make(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) + { + return this_type(std::forward(a)); } }; @@ -338,9 +371,14 @@ struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - : value(std::forward(a)) { + static this_type make(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + { + return this_type(std::forward(a)); } }; @@ -354,9 +392,14 @@ struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; result_type value; + arg_resolver_n(result_type v) + : value(std::move(v)) + { + } template - arg_resolver_n(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - : value(std::forward(a)) { + static this_type make(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + { + return this_type(std::forward(a)); } }; @@ -369,18 +412,55 @@ struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 typedef arg_resolver_n this_type; typedef this_type type; result_type value; - arg_resolver_n(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - : value() { + static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + { + return this_type(); } }; #endif #if RXCPP_USE_VARIADIC_TEMPLATES +template +struct select_first; + +template +struct select_first +{ + static const int value = Predicate0 ? N : select_first::value; +}; +template +struct select_first +{ + static const int value = -1; +}; + +template +struct select_n +{ + struct type; +}; + +template +struct select_n : public select_n +{ +}; + +template +struct select_n +{ + typedef SArg0 type; +}; + template class Predicate, class Default, class... ArgN> struct arg_resolver { - typedef typename arg_resolver_n::type...>::type type; + typedef select_first<0, Predicate::value...> match; + typedef typename std::conditional< + match::value != -1, + typename select_n::type, + Default>::type result_type; + typedef resolved_arg resolved_type; }; #else struct tag_unresolvable {}; @@ -395,65 +475,65 @@ struct arg_resolver template class Predicate, class Default, class... ArgN> auto resolve_arg(ArgN&&... an) --> decltype(typename arg_resolver::type(std::forward(an)...)) { - return typename arg_resolver::type(std::forward(an)...); +-> decltype(arg_resolver::resolved_type::make(std::forward(an)...)) { + return arg_resolver::resolved_type::make(std::forward(an)...); } #else template class Predicate, class Default> auto resolve_arg() --> decltype(typename arg_resolver::type(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); +-> decltype(typename arg_resolver::type::make(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + return typename arg_resolver::type::make(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0> auto resolve_arg(Arg0&& a0) --> decltype(typename arg_resolver::type(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); +-> decltype(typename arg_resolver::type::make(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { + return typename arg_resolver::type::make(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1> auto resolve_arg(Arg0&& a0, Arg1&& a1) --> decltype(typename arg_resolver::type( +-> decltype(typename arg_resolver::type::make( std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type( + return typename arg_resolver::type::make( std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2> auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2) --> decltype(typename arg_resolver::type( +-> decltype(typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type( + return typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3> auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) --> decltype(typename arg_resolver::type( +-> decltype(typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type( + return typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4> auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) --> decltype(typename arg_resolver::type( +-> decltype(typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable())) { - return typename arg_resolver::type( + return typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable()); } template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) --> decltype(typename arg_resolver::type( +-> decltype(typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))) { - return typename arg_resolver::type( + return typename arg_resolver::type::make( std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); } #endif -- GitLab From 74584fa6e19877fb41d3ef4964467bb890b1fa3a Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Tue, 25 Mar 2014 12:50:36 -0700 Subject: [PATCH 239/782] changes for windows compilation --- Rx/v2/src/rxcpp/rx-predef.hpp | 4 ++-- Rx/v2/src/rxcpp/rx-scheduler.hpp | 4 ++-- Rx/v2/src/rxcpp/rx-subscription.hpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 18c356d..1926c17 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -60,11 +60,11 @@ template class is_observer { template - static typename C::observer_tag check(int); + static typename C::observer_tag* check(int); template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_observer>::value; + static const bool value = std::is_convertible::type>(0)), tag_observer*>::value; }; struct tag_dynamic_observer {}; diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 6bd5a8b..cadc173 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -277,8 +277,8 @@ class schedulable : public schedulable_base recursed_scope_type recursed_scope; public: - typedef typename composite_subscription::weak_subscription weak_subscription; - typedef typename composite_subscription::shared_subscription shared_subscription; + typedef composite_subscription::weak_subscription weak_subscription; + typedef composite_subscription::shared_subscription shared_subscription; typedef scheduler_base::clock_type clock_type; schedulable() diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 192bff4..8d11f4d 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -16,11 +16,11 @@ template class is_subscription { template - static typename C::subscription_tag check(int); + static typename C::subscription_tag* check(int); template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_subscription>::value; + static const bool value = std::is_convertible::type>(0)), tag_subscription*>::value; }; class dynamic_subscription : public subscription_base -- GitLab From 3c54077a4f8f1eaa6203fdb8f942235b8cdfcb2c Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 26 Mar 2014 11:14:05 -0700 Subject: [PATCH 240/782] more windows compilation work still running into hard limit on linkage spec's in msvc --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 2 + Rx/v2/src/rxcpp/rx-includes.hpp | 63 +++-- Rx/v2/src/rxcpp/rx-observer.hpp | 30 +- Rx/v2/src/rxcpp/rx-util.hpp | 317 ++++++++-------------- 4 files changed, 170 insertions(+), 242 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index a52d3c8..554ea15 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -31,7 +31,9 @@ struct flat_map_traits { typedef decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr))) collection_type; +#if _MSC_VER >= 1900 static_assert(is_observable::value, "flat_map CollectionSelector must return an observable"); +#endif typedef typename collection_type::value_type collection_value_type; diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 9131716..ba13539 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -5,35 +5,6 @@ #if !defined(RXCPP_RX_INCLUDES_HPP) #define RXCPP_RX_INCLUDES_HPP -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - // some configuration macros #if defined(_MSC_VER) @@ -90,6 +61,40 @@ #define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT #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 + +#pragma push_macro("min") +#pragma push_macro("max") +#undef min +#undef max + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "rx-util.hpp" #include "rx-predef.hpp" #include "rx-subscription.hpp" diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index c1e22a9..26d998f 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -244,35 +244,51 @@ auto make_observer() } namespace detail { - + template -auto make_observer_resolved(ResolvedArgSet&& rs) +auto make_observer_resolved_explicit(ResolvedArgSet&& rs) -> observer { typedef I inner_type; return observer(inner_type( std::move(std::get<0>(std::forward(rs)).value), std::move(std::get<1>(std::forward(rs)).value), std::move(std::get<2>(std::forward(rs)).value))); - + typedef typename std::decay(std::forward(rs)))>::type rn_t; typedef typename std::decay(std::forward(rs)))>::type re_t; typedef typename std::decay(std::forward(rs)))>::type rc_t; - + static_assert(rn_t::is_arg, "onnext is a required parameter"); static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); } +template +struct resolved_observer_traits +{ + typedef typename std::decay::type resolved_set; + typedef typename std::tuple_element<0, resolved_set>::type resolved_on_next; + typedef typename std::tuple_element<1, resolved_set>::type resolved_on_error; + typedef typename std::tuple_element<2, resolved_set>::type resolved_on_completed; + template + struct static_observer_of + { + typedef static_observer type; + }; +}; template auto make_observer_resolved(ResolvedArgSet&& rs) - -> observer(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>> { - return make_observer_resolved(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type, typename std::decay(std::forward(rs)))>::type::result_type>>(std::forward(rs)); + -> observer::template static_observer_of::type> { + return make_observer_resolved_explicit::template static_observer_of::type>(std::forward(rs)); } template auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) -> observer> { - return make_observer_resolved>(std::forward(rs)); + return make_observer_resolved_explicit>(std::forward(rs)); } template diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 61d4786..9132aaf 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -227,14 +227,15 @@ struct resolved_arg static const bool is_arg = true; typedef T result_type; result_type value; + struct tag_value {}; template - explicit resolved_arg(Value&& v) - : value(std::forward(v)) + resolved_arg(Value&& v, tag_value&&) + : value(std::forward(v)) { } template static this_type make(CArgN&&... can) { - return this_type(select_arg::get(std::forward(can)...)); + return this_type(select_arg::get(std::forward(can)...), tag_value()); } }; @@ -252,28 +253,41 @@ struct resolved_arg<-1, T> } }; -template class Predicate, class Default, class... ArgN> -struct arg_resolver_n; +#else -template class Predicate, class Default, class Arg, class... ArgN> -struct arg_resolver_n +template +struct resolved_arg { + typedef resolved_arg this_type; static const int n = N; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n next_type; - typedef typename std::conditional::value, this_type, typename next_type::type>::type type; + static const bool is_arg = true; + typedef T result_type; + result_type value; + struct tag_value {}; + template + resolved_arg(Value&& v, tag_value&&) + : value(std::forward(v)) + { + } + template + static this_type make(Arg0&& a0) { + return this_type(std::forward(a0), tag_value()); + } }; -template class Predicate, class Default> -struct arg_resolver_n +template +struct resolved_arg<-1, T> { + typedef resolved_arg<-1, T> this_type; static const int n = -1; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef this_type type; + static const bool is_arg = false; + typedef T result_type; + result_type value; + static this_type make() { + return this_type(); + } }; -#else + template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> struct arg_resolver_n; @@ -283,18 +297,14 @@ struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 5; static const bool is_arg = true; typedef Arg5 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) + static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -304,18 +314,14 @@ struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 4; static const bool is_arg = true; typedef Arg4 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) + static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -325,18 +331,14 @@ struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 3; static const bool is_arg = true; typedef Arg3 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) + static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -346,18 +348,14 @@ struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 2; static const bool is_arg = true; typedef Arg2 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) + static resolved_arg make(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -367,18 +365,14 @@ struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 1; static const bool is_arg = true; typedef Arg1 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + static resolved_arg make(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -388,18 +382,14 @@ struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> static const int n = 0; static const bool is_arg = true; typedef Arg0 result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef arg_resolver_n prev_type; typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - result_type value; - arg_resolver_n(result_type v) - : value(std::move(v)) - { - } template - static this_type make(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + static resolved_arg make(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) { - return this_type(std::forward(a)); + return resolved_arg::make(std::forward(a)); } }; @@ -409,12 +399,12 @@ struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 static const int n = -1; static const bool is_arg = false; typedef Default result_type; + typedef resolved_arg resolved_type; typedef arg_resolver_n this_type; typedef this_type type; - result_type value; - static this_type make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) + static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) { - return this_type(); + return resolved_arg(); } }; #endif @@ -475,7 +465,8 @@ struct arg_resolver template class Predicate, class Default, class... ArgN> auto resolve_arg(ArgN&&... an) --> decltype(arg_resolver::resolved_type::make(std::forward(an)...)) { +-> typename arg_resolver::resolved_type +{ return arg_resolver::resolved_type::make(std::forward(an)...); } #else @@ -543,10 +534,11 @@ struct arg_resolver_term {}; // // use to build a set of tags // -template -struct tag_set : Base +template +struct tag_set { - typedef Next next_tag; + typedef Tag tag; + typedef NextSet next_set; }; template @@ -560,81 +552,82 @@ struct arg_resolver_set } }; -template +template struct arg_resolver_set { - typedef arg_resolver_set next_set; + typedef typename TagSet::tag tag; + typedef arg_resolver_set next_set; #if RXCPP_USE_VARIADIC_TEMPLATES template auto operator()(ArgN&&... an) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(an)...)), + std::make_tuple(resolve_arg(std::forward(an)...)), next_set()(std::forward(an)...))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(an)...)), + std::make_tuple(resolve_arg(std::forward(an)...)), next_set()(std::forward(an)...)); } #else inline auto operator()() -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg()), + std::make_tuple(resolve_arg()), next_set()())) { return std::tuple_cat( - std::make_tuple(resolve_arg()), + std::make_tuple(resolve_arg()), next_set()()); } template auto operator()(Arg0&& a0) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0))), + std::make_tuple(resolve_arg(std::forward(a0))), next_set()(std::forward(a0)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0))), + std::make_tuple(resolve_arg(std::forward(a0))), next_set()(std::forward(a0))); } template auto operator()(Arg0&& a0, Arg1&& a1) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), next_set()(std::forward(a0), std::forward(a1)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), next_set()(std::forward(a0), std::forward(a1))); } template auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2))); } template auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); } template auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); } template auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), + std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); } #endif @@ -645,143 +638,55 @@ template inline std::tuple<> resolve_arg_set(arg_resolver_term&&, ArgN&&... ) { return std::tuple<>(); } -#else -inline std::tuple<> resolve_arg_set(arg_resolver_term&&) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& ) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& ) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& ) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& ) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& , Arg4&& ) { - return std::tuple<>(); -} - -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, Arg0&& , Arg1&& , Arg2&& , Arg3&& , Arg4&& , Arg5&& ) { - return std::tuple<>(); -} -#endif -#if RXCPP_USE_VARIADIC_TEMPLATES -template -auto resolve_arg_set(Tag&&, ArgN&&... an) +template +auto resolve_arg_set(TagSet&&, ArgN&&... an) -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( + std::make_tuple(resolve_arg( std::forward(an)...)), - resolve_arg_set(typename Tag::next_tag(), + resolve_arg_set(typename TagSet::next_set(), std::forward(an)...))) { return std::tuple_cat( - std::make_tuple(resolve_arg( + std::make_tuple(resolve_arg( std::forward(an)...)), - resolve_arg_set(typename Tag::next_tag(), + resolve_arg_set(typename TagSet::next_set(), std::forward(an)...)); } #else -template -auto resolve_arg_set(Tag&&) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg()), - resolve_arg_set(typename Tag::next_tag()))) { - return std::tuple_cat( - std::make_tuple(resolve_arg()), - resolve_arg_set(typename Tag::next_tag())); +template +auto resolve_arg_set(TagSet&&) + -> decltype(arg_resolver_set()()) { + return arg_resolver_set()(); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0) + -> decltype(arg_resolver_set()(std::forward(a0))) { + return arg_resolver_set()(std::forward(a0)); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1) + -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1))) { + return arg_resolver_set()(std::forward(a0), std::forward(a1)); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2) + -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2))) { + return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2)); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) + -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))) { + return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) + -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))) { + return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)); } -template -auto resolve_arg_set(Tag&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), - resolve_arg_set(typename Tag::next_tag(), - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); +template +auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) + -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))) { + return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); } #endif -- GitLab From 5fb44100464a3aaefe8bd4d8dc4a42afd5e2de19 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Wed, 26 Mar 2014 23:03:21 -0700 Subject: [PATCH 241/782] windows compiles! gave up on compilers that do not have variadic support - at least for now --- Rx/v2/src/rxcpp/rx-observable.hpp | 98 ------- Rx/v2/src/rxcpp/rx-observer.hpp | 64 +---- Rx/v2/src/rxcpp/rx-scheduler.hpp | 64 +---- Rx/v2/src/rxcpp/rx-subscriber.hpp | 55 +--- Rx/v2/src/rxcpp/rx-util.hpp | 417 +++--------------------------- Rx/v2/test/subjects/subject.cpp | 22 ++ 6 files changed, 91 insertions(+), 629 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index c062ae2..2b59544 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -223,7 +223,6 @@ public: return *this; } -#if RXCPP_USE_VARIADIC_TEMPLATES /// /// subscribe will cause this observable to emit values to the provided subscriber. /// callers must provide enough arguments to make a subscriber. @@ -239,103 +238,6 @@ public: -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...))) { return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); } -#else - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0)))) { - return detail_subscribe(make_subscriber(std::forward(a0))); - } - - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0, Arg1&& a1) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1)))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1))); - } - - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2)))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2))); - } - - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); - } - - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); - } - - /// - /// subscribe will cause this observable to emit values to the provided 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 - auto subscribe(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); - } -#endif /// filter (AKA Where) -> /// for each item from this observable use Predicate to select which items to emit from the new observable that is returned. diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 26d998f..ec40195 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -267,6 +267,9 @@ template struct resolved_observer_traits { typedef typename std::decay::type resolved_set; + + static_assert(std::tuple_size::value >= 3, "must have at least three resolved arguments"); + typedef typename std::tuple_element<0, resolved_set>::type resolved_on_next; typedef typename std::tuple_element<1, resolved_set>::type resolved_on_error; typedef typename std::tuple_element<2, resolved_set>::type resolved_on_completed; @@ -323,78 +326,29 @@ struct tag_oncompleted_resolution }; // types to disambiguate -// on_next and optional on_error, on_completed + -// optional subscription +// on_next and optional on_error, on_completed // template struct tag_observer_set - : public rxu::detail::tag_set, - rxu::detail::tag_set>> { + typedef rxu::detail::tag_set, tag_onerror_resolution, tag_oncompleted_resolution> type; }; } -#if RXCPP_USE_VARIADIC_TEMPLATES template auto make_observer(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...)); -} -#else -template -auto make_observer(Arg0&& a0) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0))); -} -template -auto make_observer(Arg0&& a0, Arg1&& a1) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1)))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1))); -} -template -auto make_observer(Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2))); -} -template -auto make_observer(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); + -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...))) { + return detail::make_observer_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...)); } -#endif -#if RXCPP_USE_VARIADIC_TEMPLATES template auto make_observer_dynamic(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(an)...)); -} -#else -template -auto make_observer_dynamic(Arg0&& a0) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0)))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0))); -} -template -auto make_observer_dynamic(Arg0&& a0, Arg1&& a1) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1)))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1))); + -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...))) { + return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...)); } -template -auto make_observer_dynamic(Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2))); -} -template -auto make_observer_dynamic(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(detail::tag_observer_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); -} -#endif } diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index cadc173..f92a981 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -552,17 +552,13 @@ struct tag_scheduler_resolution }; -struct tag_schedulable_set - // the first four must be the same as tag_observer_set or the indexing will fail - : public rxu::detail::tag_set>>>>>> -{ -}; +typedef rxu::detail::tag_set tag_schedulable_set; template struct action_selector; @@ -639,61 +635,15 @@ schedulable schedule_resolved(ResolvedArgSet&& rsArg) { } -#if RXCPP_USE_VARIADIC_TEMPLATES template schedulable make_schedulable(Arg0&& a0, ArgN&&... an) { return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); } -#else -template -schedulable make_schedulable(Arg0&& a0) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); -} -template -schedulable make_schedulable(Arg0&& a0, Arg1&& a1) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); -} -template -schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); -} -template -schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); -} -template -schedulable make_schedulable(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); -} -#endif -#if RXCPP_USE_VARIADIC_TEMPLATES template schedulable schedule(Arg0&& a0, ArgN&&... an) { return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); } -#else -template -schedulable schedule(Arg0&& a0) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0))); -} -template -schedulable schedule(Arg0&& a0, Arg1&& a1) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1))); -} -template -schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2))); -} -template -schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); -} -template -schedulable schedule(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); -} -#endif namespace detail { diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 91086d8..d6a4deb 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -192,6 +192,7 @@ auto make_subscriber_resolved(ResolvedArgSet&& rsArg) return subscriber(*(typename std::decay::type*)nullptr))>( s, r, select_observer(rs)); + static_assert(std::tuple_size::value == 7, "must have 7 resolved args"); // at least for now do not enforce resolver #if 0 typedef typename std::decay::type rr_t; @@ -243,57 +244,25 @@ struct tag_resumption_resolution template struct tag_subscriber_set - // the first four must be the same as tag_observer_set or the indexing will fail - : public rxu::detail::tag_set, - rxu::detail::tag_set, - rxu::detail::tag_set>>>>>>> { + // the first four must be the same as tag_observer_set or the indexing will fail + typedef rxu::detail::tag_set< + tag_onnext_resolution, + tag_onerror_resolution, + tag_oncompleted_resolution, + tag_subscription_resolution, + tag_resumption_resolution, + tag_observer_resolution, + tag_subscriber_resolution> type; }; } -#if RXCPP_USE_VARIADIC_TEMPLATES template auto make_subscriber(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(an)...))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(an)...)); + -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(typename detail::tag_subscriber_set::type(), std::forward(a0), std::forward(an)...))) { + return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(typename detail::tag_subscriber_set::type(), std::forward(a0), std::forward(an)...)); } -#else -template -auto make_subscriber(Arg0&& a0) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0))); -} -template -auto make_subscriber(Arg0&& a0, Arg1&& a1) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1))); -} -template -auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2))); -} -template -auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); -} -template -auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); -} -template -auto make_subscriber(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(detail::tag_subscriber_set(), std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); -} -#endif } diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 9132aaf..6c7efa2 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -198,8 +198,6 @@ private: Function* function; }; -#if RXCPP_USE_VARIADIC_TEMPLATES - template struct select_arg { @@ -253,164 +251,7 @@ struct resolved_arg<-1, T> } }; -#else - -template -struct resolved_arg -{ - typedef resolved_arg this_type; - static const int n = N; - static const bool is_arg = true; - typedef T result_type; - result_type value; - struct tag_value {}; - template - resolved_arg(Value&& v, tag_value&&) - : value(std::forward(v)) - { - } - template - static this_type make(Arg0&& a0) { - return this_type(std::forward(a0), tag_value()); - } -}; - -template -struct resolved_arg<-1, T> -{ - typedef resolved_arg<-1, T> this_type; - static const int n = -1; - static const bool is_arg = false; - typedef T result_type; - result_type value; - static this_type make() { - return this_type(); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n; -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<5, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 5; - static const bool is_arg = true; - typedef Arg5 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, R&& a) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<4, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 4; - static const bool is_arg = true; - typedef Arg4 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, R&& a, const Arg5&) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<3, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 3; - static const bool is_arg = true; - typedef Arg3 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, R&& a, const Arg4&, const Arg5&) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<2, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 2; - static const bool is_arg = true; - typedef Arg2 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(const Arg0&, const Arg1&, R&& a, const Arg3&, const Arg4&, const Arg5&) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 1; - static const bool is_arg = true; - typedef Arg1 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(const Arg0&, R&& a, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<0, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = 0; - static const bool is_arg = true; - typedef Arg0 result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef arg_resolver_n prev_type; - typedef typename std::conditional::value, this_type, typename prev_type::type>::type type; - template - static resolved_arg make(R&& a, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - { - return resolved_arg::make(std::forward(a)); - } -}; - -template class Predicate, class Default, class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -struct arg_resolver_n<-1, Predicate, Default, Arg0, Arg1, Arg2, Arg3, Arg4, Arg5> -{ - static const int n = -1; - static const bool is_arg = false; - typedef Default result_type; - typedef resolved_arg resolved_type; - typedef arg_resolver_n this_type; - typedef this_type type; - static resolved_arg make(const Arg0&, const Arg1&, const Arg2&, const Arg3&, const Arg4&, const Arg5&) - { - return resolved_arg(); - } -}; -#endif - - -#if RXCPP_USE_VARIADIC_TEMPLATES template struct select_first; @@ -452,243 +293,67 @@ struct arg_resolver Default>::type result_type; typedef resolved_arg resolved_type; }; -#else -struct tag_unresolvable {}; -template class Predicate, class Default, class Arg0 = tag_unresolvable, class Arg1 = tag_unresolvable, class Arg2 = tag_unresolvable, class Arg3 = tag_unresolvable, class Arg4 = tag_unresolvable, class Arg5 = tag_unresolvable> -struct arg_resolver -{ - typedef typename arg_resolver_n<5, Predicate, Default, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type, typename std::decay::type>::type type; -}; -#endif -#if RXCPP_USE_VARIADIC_TEMPLATES -template class Predicate, class Default, - class... ArgN> +template class Predicate, class Default, class... ArgN> auto resolve_arg(ArgN&&... an) -> typename arg_resolver::resolved_type { return arg_resolver::resolved_type::make(std::forward(an)...); } -#else -template class Predicate, class Default> -auto resolve_arg() --> decltype(typename arg_resolver::type::make(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type::make(tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); -} - -template class Predicate, class Default, - class Arg0> -auto resolve_arg(Arg0&& a0) --> decltype(typename arg_resolver::type::make(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type::make(std::forward(a0), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); -} - -template class Predicate, class Default, - class Arg0, class Arg1> -auto resolve_arg(Arg0&& a0, Arg1&& a1) --> decltype(typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), tag_unresolvable(), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); -} - -template class Predicate, class Default, - class Arg0, class Arg1, class Arg2> -auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2) --> decltype(typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), tag_unresolvable(), tag_unresolvable(), tag_unresolvable()); -} - -template class Predicate, class Default, - class Arg0, class Arg1, class Arg2, class Arg3> -auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) --> decltype(typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable())) { - return typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), tag_unresolvable(), tag_unresolvable()); -} - -template class Predicate, class Default, - class Arg0, class Arg1, class Arg2, class Arg3, class Arg4> -auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) --> decltype(typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable())) { - return typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), tag_unresolvable()); -} -template class Predicate, class Default, - class Arg0, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> -auto resolve_arg(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) --> decltype(typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))) { - return typename arg_resolver::type::make( - std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); -} -#endif +template +struct tag_set {}; -struct arg_resolver_term {}; +template +struct arg_resolver_set; -// -// use to build a set of tags -// -template -struct tag_set +template +struct arg_resolver_set> { - typedef Tag tag; - typedef NextSet next_set; -}; + template + struct expand + { + typedef typename arg_resolver::resolved_type type; + }; -template -struct arg_resolver_set; + template + struct expanded; -template<> -struct arg_resolver_set -{ - inline std::tuple<> operator()(...){ - return std::tuple<>(); - } -}; + template + struct expanded> + { + template + static std::tuple make(ArgN&&... an) { + return std::tuple(Resolved0::make(std::forward(an)...)); + } + }; + + template + struct expanded> + { + typedef std::tuple result_type; + template + static result_type make(ArgN&&... an) { + return std::tuple_cat(std::tuple(Resolved0::make(std::forward(an)...)), expanded>::make(std::forward(an)...)); + } + }; -template -struct arg_resolver_set -{ - typedef typename TagSet::tag tag; - typedef arg_resolver_set next_set; -#if RXCPP_USE_VARIADIC_TEMPLATES template auto operator()(ArgN&&... an) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(an)...)), - next_set()(std::forward(an)...))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(an)...)), - next_set()(std::forward(an)...)); - } -#else - inline auto operator()() - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg()), - next_set()())) { - return std::tuple_cat( - std::make_tuple(resolve_arg()), - next_set()()); - } - template - auto operator()(Arg0&& a0) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0))), - next_set()(std::forward(a0)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0))), - next_set()(std::forward(a0))); - } - template - auto operator()(Arg0&& a0, Arg1&& a1) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), - next_set()(std::forward(a0), std::forward(a1)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1))), - next_set()(std::forward(a0), std::forward(a1))); - } - template - auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2))); + -> std::tuple< typename expand::type, + typename expand::type...> { + typedef std::tuple< typename expand::type, + typename expand::type...> out_type; + static_assert(std::tuple_size::value == (sizeof...(TagN) + 1), "tuple must have a value per tag"); + return expanded::make(std::forward(an)...); } - template - auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))); - } - template - auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))); - } - template - auto operator()(Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)))) { - return std::tuple_cat( - std::make_tuple(resolve_arg(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))), - next_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))); - } -#endif }; -#if RXCPP_USE_VARIADIC_TEMPLATES -template -inline std::tuple<> resolve_arg_set(arg_resolver_term&&, ArgN&&... ) { - return std::tuple<>(); -} - template -auto resolve_arg_set(TagSet&&, ArgN&&... an) - -> decltype(std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(an)...)), - resolve_arg_set(typename TagSet::next_set(), - std::forward(an)...))) { - return std::tuple_cat( - std::make_tuple(resolve_arg( - std::forward(an)...)), - resolve_arg_set(typename TagSet::next_set(), - std::forward(an)...)); -} -#else -template -auto resolve_arg_set(TagSet&&) - -> decltype(arg_resolver_set()()) { - return arg_resolver_set()(); -} -template -auto resolve_arg_set(TagSet&&, Arg0&& a0) - -> decltype(arg_resolver_set()(std::forward(a0))) { - return arg_resolver_set()(std::forward(a0)); -} -template -auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1) - -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1))) { - return arg_resolver_set()(std::forward(a0), std::forward(a1)); -} -template -auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2) - -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2))) { - return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2)); +auto resolve_arg_set(const TagSet&, ArgN&&... an) + -> decltype(arg_resolver_set()(std::forward(an)...)) { + return arg_resolver_set()(std::forward(an)...); } -template -auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3) - -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3))) { - return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3)); -} -template -auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4) - -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4))) { - return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4)); -} -template -auto resolve_arg_set(TagSet&&, Arg0&& a0, Arg1&& a1, Arg2&& a2, Arg3&& a3, Arg4&& a4, Arg5&& a5) - -> decltype(arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5))) { - return arg_resolver_set()(std::forward(a0), std::forward(a1), std::forward(a2), std::forward(a3), std::forward(a4), std::forward(a5)); -} -#endif } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 9a7544a..6b5df0b 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -42,6 +42,12 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ { int c = 0; int n = 1; +#if 0 + auto onnext = [&c](int){++c;}; + auto onerror = [](std::exception_ptr){abort();}; + + auto oex = rxu::detail::arg_resolver_set::type>()(onnext, onerror); +#endif auto o = rx::make_observer( [&c](int){++c;}, [](std::exception_ptr){abort();}); @@ -77,6 +83,22 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ int c = 0; int n = 1; auto start = clock::now(); +#if 0 + auto rso = rxu::detail::arg_resolver_set::type>()( + [&c](int){ + ++c; + }, + [](std::exception_ptr){abort();}); + static_assert(std::tuple_size::value == 7, "object must resolve 7 args"); + auto rsf = rxu::detail::resolve_arg_set( + rx::detail::tag_subscriber_set::type(), + [&c](int){ + ++c; + }, + [](std::exception_ptr){abort();}); + static_assert(std::tuple_size::value == 7, "func must resolve 7 args"); + auto ss = rx::detail::make_subscriber_resolved(rsf); +#endif rxs::range(0, onnextcalls).subscribe( [&c](int){ ++c; -- GitLab From e9d750d9aca3bd907db58a41f349a2bdc8b3a386 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 27 Mar 2014 08:30:00 -0700 Subject: [PATCH 242/782] use perfect forwarding - duh --- Rx/v2/src/rxcpp/rx-observer.hpp | 26 ++++++++++++++----------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 5 +++-- Rx/v2/src/rxcpp/rx-util.hpp | 4 ++-- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 5 +++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index ec40195..4de5ffd 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -117,9 +117,10 @@ public: swap(oncompleted, o.oncompleted); } - void on_next(T t) const { + template + void on_next(V&& v) const { if (onnext) { - onnext(std::move(t)); + onnext(std::forward(v)); } } void on_error(std::exception_ptr e) const { @@ -182,8 +183,9 @@ public: swap(oncompleted, o.oncompleted); } - void on_next(T t) const { - onnext(std::move(t)); + template + void on_next(V&& v) const { + onnext(std::forward(v)); } void on_error(std::exception_ptr e) const { onerror(e); @@ -211,8 +213,9 @@ public: : inner(std::move(inner)) { } - void on_next(T t) const { - inner.on_next(std::move(t)); + template + void on_next(V&& v) const { + inner.on_next(std::forward(v)); } void on_error(std::exception_ptr e) const { inner.on_error(e); @@ -229,7 +232,8 @@ public: observer() { } - void on_next(T&&) const { + template + void on_next(V&&) const { } void on_error(std::exception_ptr) const { } @@ -277,9 +281,9 @@ struct resolved_observer_traits template struct static_observer_of { - typedef static_observer type; }; }; @@ -326,7 +330,7 @@ struct tag_oncompleted_resolution }; // types to disambiguate -// on_next and optional on_error, on_completed +// on_next and optional on_error, on_completed // template diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index d6a4deb..b9ff3e9 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -85,12 +85,13 @@ public: // observer // - void on_next(T t) const { + template + void on_next(V&& v) const { if (!is_subscribed()) { abort(); } detacher protect(this); - destination.on_next(std::move(t)); + destination.on_next(std::forward(v)); protect.that = nullptr; } void on_error(std::exception_ptr e) const { diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 6c7efa2..db964c5 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -139,7 +139,7 @@ public: if (is_set) { is_set = false; reinterpret_cast(&storage)->~T(); - std::fill_n(reinterpret_cast(&storage), sizeof(T), 0); + //std::fill_n(reinterpret_cast(&storage), sizeof(T), 0); } } @@ -331,7 +331,7 @@ struct arg_resolver_set> template struct expanded> { - typedef std::tuple result_type; + typedef std::tuple result_type; template static result_type make(ArgN&&... an) { return std::tuple_cat(std::tuple(Resolved0::make(std::forward(an)...)), expanded>::make(std::forward(an)...)); diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index a0b606f..85412e2 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -137,7 +137,8 @@ public: abort(); } } - void on_next(T t) const { + template + void on_next(V&& v) const { if (b->current_generation != b->state->generation) { std::unique_lock guard(b->state->lock); if (!b->completer) { @@ -151,7 +152,7 @@ public: } for (auto& o : b->current_completer->observers) { if (o.is_subscribed()) { - o.on_next(t); + o.on_next(std::forward(v)); } } } -- GitLab From 0286ccadc657eafdcaf61a10be1abc97f3e35c5d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 27 Mar 2014 12:36:28 -0700 Subject: [PATCH 243/782] sometimes - don't use perfect forwarding --- Rx/v2/src/rxcpp/rx-util.hpp | 49 +++++++++++++++---------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index db964c5..9b0e98c 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -202,18 +202,18 @@ template struct select_arg { template - static auto get(GArg&&, GArgN&&... gan) - -> decltype(select_arg::get(std::forward(gan)...)) { - return select_arg::get(std::forward(gan)...); + static auto get(const GArg&, const GArgN&... gan) + -> decltype(select_arg::get(gan...)) { + return select_arg::get(gan...); } }; template struct select_arg { template - static auto get(GArg&& ga, GArgN&&...) - -> decltype(std::forward(ga)) { - return std::forward(ga); + static auto get(const GArg& ga, const GArgN&...) + -> decltype(ga) { + return ga; } }; @@ -227,13 +227,13 @@ struct resolved_arg result_type value; struct tag_value {}; template - resolved_arg(Value&& v, tag_value&&) - : value(std::forward(v)) + resolved_arg(const Value& v, tag_value&&) + : value(v) { } template - static this_type make(CArgN&&... can) { - return this_type(select_arg::get(std::forward(can)...), tag_value()); + static this_type make(const CArgN&... can) { + return this_type(select_arg::get(can...), tag_value()); } }; @@ -246,7 +246,7 @@ struct resolved_arg<-1, T> typedef T result_type; result_type value; template - static this_type make(CArgN&&... can) { + static this_type make(const CArgN&... can) { return this_type(); } }; @@ -295,10 +295,10 @@ struct arg_resolver }; template class Predicate, class Default, class... ArgN> -auto resolve_arg(ArgN&&... an) +auto resolve_arg(const ArgN&... an) -> typename arg_resolver::resolved_type { - return arg_resolver::resolved_type::make(std::forward(an)...); + return arg_resolver::resolved_type::make(an...); } template @@ -319,40 +319,31 @@ struct arg_resolver_set> template struct expanded; - template - struct expanded> - { - template - static std::tuple make(ArgN&&... an) { - return std::tuple(Resolved0::make(std::forward(an)...)); - } - }; - template struct expanded> { typedef std::tuple result_type; template - static result_type make(ArgN&&... an) { - return std::tuple_cat(std::tuple(Resolved0::make(std::forward(an)...)), expanded>::make(std::forward(an)...)); + static result_type make(const ArgN&... an) { + return result_type(Resolved0::make(an...), ResolvedN::make(an...)...); } }; template - auto operator()(ArgN&&... an) + auto operator()(const ArgN&... an) -> std::tuple< typename expand::type, typename expand::type...> { typedef std::tuple< typename expand::type, typename expand::type...> out_type; static_assert(std::tuple_size::value == (sizeof...(TagN) + 1), "tuple must have a value per tag"); - return expanded::make(std::forward(an)...); + return expanded::make(an...); } }; template -auto resolve_arg_set(const TagSet&, ArgN&&... an) - -> decltype(arg_resolver_set()(std::forward(an)...)) { - return arg_resolver_set()(std::forward(an)...); +auto resolve_arg_set(const TagSet&, const ArgN&... an) + -> decltype(arg_resolver_set()(an...)) { + return arg_resolver_set()(an...); } } -- GitLab From 7ad0f39a4a33e80071db74edc295ec049e4c0b0d Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sat, 29 Mar 2014 11:44:04 -0700 Subject: [PATCH 244/782] add some comments and remove redundant param --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 30 +++++++++++++++++-- .../src/rxcpp/schedulers/rx-currentthread.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 4 +-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index f92a981..c6069cf 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -23,6 +23,12 @@ typedef std::shared_ptr const_scheduler_interface_ptr } +// 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. + class recursed { bool& isrequested; @@ -270,6 +276,9 @@ class schedulable : public schedulable_base requestor = std::addressof(r.get_recursed()); return exit_recursed_scope_type(this); } + bool is_recursed() const { + return !!requestor; + } void operator()() const { (*requestor)(); } @@ -321,6 +330,17 @@ public: // 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(); } @@ -351,27 +371,33 @@ public: inline clock_type::time_point now() const { return controller.now(); } + /// put this on the queue of the stored scheduler to run asap inline void schedule() const { controller.schedule(*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 { controller.schedule(when, *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 { controller.schedule(when, *this); } // action // + /// some schedulers care about how long an action will run + /// this is how an action declares its behavior inline action_duration::type get_duration() const { return activity.get_duration(); } - inline void operator()(const schedulable& scbl, const recurse& r) const { + /// + inline void operator()(const recurse& r) const { if (!is_subscribed()) { abort(); } detacher protect(this); - activity(scbl, r); + activity(*this, r); protect.that = nullptr; } }; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 72a8ab7..2384581 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -225,7 +225,7 @@ public: queue::pop(); - what(what, recursor); + what(recursor); if (queue::empty()) { break; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 5d6c759..c162a02 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -79,7 +79,7 @@ public: if (next.when > clock_now) { clock_now = next.when; } - next.what(next.what, r.get_recurse()); + next.what(r.get_recurse()); } else { isenabled = false; @@ -240,7 +240,7 @@ protected: r.reset(false); if (scbl.is_subscribed()) { scbl.unsubscribe(); // unsubscribe() run, not a; - a(a, r.get_recurse()); + a(r.get_recurse()); } }); queue.push(item_type(when, run)); -- GitLab From 267228d08d0e4917664b2ff82409431a98213546 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sat, 29 Mar 2014 16:08:12 -0700 Subject: [PATCH 245/782] reimplement make_subscriber the verbose way --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 18 +- Rx/v2/src/rxcpp/rx-observable.hpp | 18 +- Rx/v2/src/rxcpp/rx-observer.hpp | 193 ++++----- Rx/v2/src/rxcpp/rx-subscriber.hpp | 484 ++++++++++++++++------ projects/CMake/CMakeLists.txt | 4 +- 5 files changed, 477 insertions(+), 240 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 554ea15..b426a6b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -31,9 +31,9 @@ struct flat_map_traits { typedef decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr))) collection_type; -#if _MSC_VER >= 1900 +//#if _MSC_VER >= 1900 static_assert(is_observable::value, "flat_map CollectionSelector must return an observable"); -#endif +//#endif typedef typename collection_type::value_type collection_value_type; @@ -81,11 +81,11 @@ struct flat_map { } - template - void on_subscribe(Observer&& o) { - static_assert(is_observer::value, "subscribe must be passed an observer"); + template + void on_subscribe(Subscriber&& scbr) { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename std::decay::type output_type; + typedef typename std::decay::type output_type; struct state_type : public std::enable_shared_from_this @@ -108,7 +108,7 @@ struct flat_map output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::forward(o))); + auto state = std::shared_ptr(new state_type(initial, std::forward(scbr))); composite_subscription outercs; @@ -120,7 +120,7 @@ struct flat_map // 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 - state->source.subscribe( + state->source.subscribe(make_subscriber_cs5( state->out, outercs, // on_next @@ -189,7 +189,7 @@ struct flat_map state->out.on_completed(); } } - ); + )); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2b59544..bac30b1 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -244,9 +244,9 @@ public: /// template auto filter(Predicate&& p) const - -> observable> { - return observable>( - rxo::detail::filter(*this, std::forward(p))); + -> observable> { + return observable>( + rxo::detail::filter(*this, std::forward(p))); } /// map (AKA Select) -> @@ -254,9 +254,9 @@ public: /// template auto map(Selector&& s) const - -> observable::value_type, rxo::detail::map> { - return observable::value_type, rxo::detail::map>( - rxo::detail::map(*this, std::forward(s))); + -> observable::value_type, rxo::detail::map> { + return observable::value_type, rxo::detail::map>( + rxo::detail::map(*this, std::forward(s))); } /// flat_map (AKA SelectMany) -> @@ -265,9 +265,9 @@ public: /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); } /// diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 4de5ffd..74946e8 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -72,7 +72,7 @@ struct is_on_completed } template -class dynamic_observer : public observer_base +class dynamic_observer { public: typedef tag_dynamic_observer dynamic_observer_tag; @@ -135,8 +135,8 @@ public: } }; -template -class static_observer : public observer_base +template +class static_observer { public: typedef static_observer this_type; @@ -154,7 +154,7 @@ public: static_assert(detail::is_on_error::value, "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); static_assert(detail::is_on_completed::value, "Function supplied for on_completed must be a function with the signature void();"); - explicit static_observer(on_next_t n, on_error_t e, on_completed_t c) + explicit static_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)) @@ -199,7 +199,7 @@ template class observer : public observer_base { typedef observer this_type; - typedef typename std::conditional::value, typename std::decay::type, dynamic_observer>::type inner_t; + typedef typename std::decay::type inner_t; inner_t inner; public: @@ -247,111 +247,102 @@ auto make_observer() return observer(); } -namespace detail { - -template -auto make_observer_resolved_explicit(ResolvedArgSet&& rs) +template +auto make_observer(const observer& o) -> observer { - typedef I inner_type; - return observer(inner_type( - std::move(std::get<0>(std::forward(rs)).value), - std::move(std::get<1>(std::forward(rs)).value), - std::move(std::get<2>(std::forward(rs)).value))); - - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; - - static_assert(rn_t::is_arg, "onnext is a required parameter"); - static_assert(!(rn_t::is_arg && re_t::is_arg) || rn_t::n + 1 == re_t::n, "onnext, onerror parameters must be together and in order"); - static_assert(!(re_t::is_arg && rc_t::is_arg) || re_t::n + 1 == rc_t::n, "onerror, oncompleted parameters must be together and in order"); - static_assert(!(rn_t::is_arg && rc_t::is_arg && !re_t::is_arg) || rn_t::n + 1 == rc_t::n, "onnext, oncompleted parameters must be together and in order"); + return observer( + I(o)); } -template -struct resolved_observer_traits -{ - typedef typename std::decay::type resolved_set; - - static_assert(std::tuple_size::value >= 3, "must have at least three resolved arguments"); - - typedef typename std::tuple_element<0, resolved_set>::type resolved_on_next; - typedef typename std::tuple_element<1, resolved_set>::type resolved_on_error; - typedef typename std::tuple_element<2, resolved_set>::type resolved_on_completed; - - template - struct static_observer_of - { - typedef static_observer type; - }; -}; -template -auto make_observer_resolved(ResolvedArgSet&& rs) - -> observer::template static_observer_of::type> { - return make_observer_resolved_explicit::template static_observer_of::type>(std::forward(rs)); +template +auto make_observer(observer&& o) + -> observer { + return observer( + I(std::move(o))); +} +template +auto make_observer(const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + observer>>::type { + return observer>( + static_observer(on)); +} +template +auto make_observer(const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + observer>>::type { + return observer>( + static_observer(on, oe)); +} +template +auto make_observer(const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + observer>>::type { + return observer>( + static_observer(on, detail::OnErrorEmpty(), oc)); } -template -auto make_observer_dynamic_resolved(ResolvedArgSet&& rs) - -> observer> { - return make_observer_resolved_explicit>(std::forward(rs)); +template +auto make_observer(const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + observer>>::type { + return observer>( + static_observer(on, oe, oc)); } template -struct tag_onnext_resolution -{ - template - struct predicate - { - static const bool value = is_on_next_of::value; - }; - typedef OnNextEmpty default_type; -}; - -struct tag_onerror_resolution -{ - template - struct predicate - { - static const bool value = is_on_error::value; - }; - typedef OnErrorEmpty default_type; -}; - -struct tag_oncompleted_resolution -{ - template - struct predicate - { - static const bool value = is_on_completed::value; - }; - typedef OnCompletedEmpty default_type; -}; - -// types to disambiguate -// on_next and optional on_error, on_completed -// - +auto make_observer_dynamic(const observer& o) + -> observer { + return observer( + dynamic_observer(o)); +} template -struct tag_observer_set -{ - typedef rxu::detail::tag_set, tag_onerror_resolution, tag_oncompleted_resolution> type; -}; - - +auto make_observer_dynamic(observer&& o) + -> observer { + return observer( + dynamic_observer(std::move(o))); } - -template -auto make_observer(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_observer_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...))) { - return detail::make_observer_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...)); +template +auto make_observer_dynamic(OnNext&& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + observer>>::type { + return observer>( + dynamic_observer(std::forward(on), nullptr, nullptr)); } - -template -auto make_observer_dynamic(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...))) { - return detail::make_observer_dynamic_resolved(rxu::detail::resolve_arg_set(typename detail::tag_observer_set::type(), std::forward(a0), std::forward(an)...)); +template +auto make_observer_dynamic(OnNext&& on, OnError&& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + observer>>::type { + return observer>( + dynamic_observer(std::forward(on), std::forward(oe), nullptr)); +} +template +auto make_observer_dynamic(OnNext&& on, OnCompleted&& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + observer>>::type { + return observer>( + dynamic_observer(std::forward(on), nullptr, std::forward(oc))); +} +template +auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + observer>>::type { + return observer>( + dynamic_observer(std::forward(on), std::forward(oe), std::forward(oc))); } } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index b9ff3e9..65cbfde 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -132,137 +132,383 @@ public: }; -namespace detail { - -template -struct observer_selector; - -template -struct observer_selector -{ - template - static auto get_observer(Set& rs) - -> decltype(std::get<5>(rs).value) { - return std::get<5>(rs).value; - } -}; -template -struct observer_selector -{ - template - static auto get_observer(Set& rs) - -> decltype(make_observer_resolved(rs)) { - return make_observer_resolved(rs); - } -}; -template -struct observer_selector -{ - template - static auto get_observer(Set& rs) - -> decltype( std::get<6>(rs).value.get_observer()) { - return std::get<6>(rs).value.get_observer(); - } -}; - -template -auto select_observer(ResolvedArgSet& rs) - -> decltype(observer_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs)) { - return observer_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_observer(rs); - - typedef typename std::decay(std::forward(rs)))>::type rr_t; - typedef typename std::decay(std::forward(rs)))>::type rn_t; - typedef typename std::decay(std::forward(rs)))>::type re_t; - typedef typename std::decay(std::forward(rs)))>::type rc_t; - typedef typename std::decay(std::forward(rs)))>::type ro_t; - typedef typename std::decay(std::forward(rs)))>::type rs_t; - - static_assert(rs_t::is_arg || ro_t::is_arg || rn_t::is_arg, "at least one of; onnext, observer or subscriber is required"); - static_assert(int(ro_t::is_arg) + int(rn_t::is_arg) < 2, "onnext, onerror and oncompleted not allowed with an observer"); +// copy +template +auto make_subscriber( + const subscriber& o) + -> subscriber { + return subscriber(o); } - -template -auto make_subscriber_resolved(ResolvedArgSet&& rsArg) - -> subscriber(*(typename std::decay::type*)nullptr))> { - const auto rs = std::forward(rsArg); - const auto rsub = std::get<3>(rs); - const auto rr = std::get<4>(rs); - const auto rscrbr = std::get<6>(rs); - const auto r = (rscrbr.is_arg && !rr.is_arg) ? rscrbr.value.get_resumption() : rr.value; - const auto s = (rscrbr.is_arg && !rsub.is_arg) ? rscrbr.value.get_subscription() : rsub.value; - return subscriber(*(typename std::decay::type*)nullptr))>( - s, r, select_observer(rs)); - - static_assert(std::tuple_size::value == 7, "must have 7 resolved args"); -// at least for now do not enforce resolver -#if 0 - typedef typename std::decay::type rr_t; - typedef typename std::decay::type rs_t; - - static_assert(rs_t::is_arg || rr_t::is_arg, "at least one of; resumption or subscriber is a required parameter"); -#endif +// move +template +auto make_subscriber( + subscriber&& o) + -> subscriber { + return subscriber(std::move(o)); } -template -struct tag_subscriber_resolution -{ - template - struct predicate : public is_subscriber - { - }; - typedef subscriber> default_type; -}; +// observer +// -template -struct tag_observer_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && is_observer::value; - }; - typedef observer default_type; -}; +template +auto make_subscriber( + const observer& o) + -> subscriber> { + return subscriber>(composite_subscription(), resumption(), o); +} +template +auto make_subscriber(const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(composite_subscription(), resumption(), o); +} +template +auto make_subscriber(const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), resumption(), + observer>( + static_observer>(on))); +} +template +auto make_subscriber(const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), resumption(), + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), resumption(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), resumption(), + observer>( + static_observer(on, oe, oc))); +} -struct tag_resumption_resolution -{ - template - struct predicate - { - static const bool value = !is_subscriber::value && is_resumption::value; - }; - typedef resumption default_type; -}; +// explicit lifetime +// +template +auto make_subscriber(const composite_subscription& cs, + const observer& o) + -> subscriber> { + return subscriber>(cs, resumption(), o); +} +template +auto make_subscriber(const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(cs, resumption(), o); +} +template +auto make_subscriber(const composite_subscription& cs, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(cs, resumption(), + observer>( + static_observer(on))); +} +template +auto make_subscriber(const composite_subscription& cs, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(cs, resumption(), + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const composite_subscription& cs, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(cs, resumption(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +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::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(cs, resumption(), + observer>( + static_observer(on, oe, oc))); +} +template +auto make_subscriber(const resumption& r, + const observer& o) + -> subscriber> { + return subscriber>(composite_subscription(), r, o); +} +template +auto make_subscriber(const resumption& r, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(composite_subscription(), r, o); +} +template +auto make_subscriber(const resumption& r, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), r, + observer>( + static_observer(on))); +} +template +auto make_subscriber(const resumption& r, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), r, + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const resumption& r, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), r, + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(const resumption& r, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(composite_subscription(), r, + observer>( + static_observer(on, oe, oc))); +} -// types to disambiguate -// subscriber with override for subscription, observer, resumption | -// optional subscriber + -// observer | on_next and optional on_error, on_completed + -// resumption + -// subscription | unsubscribe +// chain defaults from subscriber // +template +auto make_subscriber(const subscriber& scbr, + const observer& o) + -> subscriber> { + return subscriber>(scbr.get_subscription(), scbr.get_resumption(), o); +} +template +auto make_subscriber(const subscriber& scbr, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(scbr.get_subscription(), scbr.get_resumption(), o); +} +template +auto make_subscriber(const subscriber& scbr, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + observer>( + static_observer(on))); +} +template +auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + observer>( + static_observer(on, oe, oc))); +} -template -struct tag_subscriber_set -{ - // the first four must be the same as tag_observer_set or the indexing will fail - typedef rxu::detail::tag_set< - tag_onnext_resolution, - tag_onerror_resolution, - tag_oncompleted_resolution, - tag_subscription_resolution, - tag_resumption_resolution, - tag_observer_resolution, - tag_subscriber_resolution> type; -}; +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, + const observer& o) + -> subscriber> { + return subscriber>(cs, scbr.get_resumption(), o); +} +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(cs, scbr.get_resumption(), o); +} +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(cs, scbr.get_resumption(), + observer>( + static_observer(on))); +} +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(cs, scbr.get_resumption(), + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(cs, scbr.get_resumption(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(cs, scbr.get_resumption(), + observer>( + static_observer(on, oe, oc))); +} +template +auto make_subscriber_cs5(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(cs, scbr.get_resumption(), + observer>( + static_observer(on, oe, oc))); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, + const observer& o) + -> subscriber> { + return subscriber>(scbr.get_subscription(), r, o); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(scbr.get_subscription(), r, o); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), r, + observer>( + static_observer(on))); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), r, + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), r, + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(scbr.get_subscription(), r, + observer>( + static_observer(on, oe, oc))); } -template -auto make_subscriber(Arg0&& a0, ArgN&&... an) - -> decltype(detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(typename detail::tag_subscriber_set::type(), std::forward(a0), std::forward(an)...))) { - return detail::make_subscriber_resolved(rxu::detail::resolve_arg_set(typename detail::tag_subscriber_set::type(), std::forward(a0), std::forward(an)...)); +// override lifetime +// +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs) + -> subscriber { + return subscriber(cs, scbr.get_resumption(), scbr.get_observer()); +} +// override back-pressure +// +template +auto make_subscriber(const subscriber& scbr, const resumption& r) + -> subscriber { + return subscriber(scbr.get_subscription(), r, scbr.get_observer()); +} +// only keep observer +// +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const resumption& r) + -> subscriber { + return subscriber(cs, r, scbr.get_observer()); } } diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 74cfc08..11447e4 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,10 +42,10 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp - ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp - ${V2_TEST_DIR}/operators/flat_map.cpp + ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp + ${V2_TEST_DIR}/operators/flat_map.cpp ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/operators/map.cpp ) -- GitLab From 282d43a2f33e914c4226dc6184fcc4ef93a0cd5b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Sat, 29 Mar 2014 17:57:14 -0700 Subject: [PATCH 246/782] remove resolve_arg library --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 4 +- Rx/v2/src/rxcpp/rx-observable.hpp | 2 +- Rx/v2/src/rxcpp/rx-scheduler.hpp | 258 ++++++++-------------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 11 - Rx/v2/src/rxcpp/rx-util.hpp | 148 ------------- Rx/v2/src/rxcpp/sources/rx-range.hpp | 34 +-- 6 files changed, 112 insertions(+), 345 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index b426a6b..38dd15f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -120,7 +120,7 @@ struct flat_map // 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 - state->source.subscribe(make_subscriber_cs5( + state->source.subscribe( state->out, outercs, // on_next @@ -189,7 +189,7 @@ struct flat_map state->out.on_completed(); } } - )); + ); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index bac30b1..8282ea2 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -169,7 +169,7 @@ private: // make sure to let current_thread take ownership of the thread as early as possible. if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); - schedule(sc, [=](const rxsc::schedulable& scbl) { + sc.schedule(o.get_subscription(), [=](const rxsc::schedulable& scbl) { safe_subscribe(); }); } else { diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index c6069cf..b323449 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -169,6 +169,22 @@ inline bool operator!=(const action& lhs, const action& rhs) { return !(lhs == rhs); } +namespace detail { + +template +struct is_action_function +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(schedulable*)nullptr)); + template + static not_void check(...); + + static const bool value = std::is_same::type>(0)), void>::value; +}; + +} + class scheduler : public scheduler_base { typedef scheduler this_type; @@ -202,6 +218,20 @@ public: inline void schedule(clock_type::time_point when, const schedulable& scbl) const { inner->schedule(when, scbl); } + + template + auto schedule(Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type; + template + auto schedule(Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + !detail::is_action_function::value && + !is_subscription::value && + !is_scheduler::value && + !is_schedulable::value>::type; }; inline bool operator==(const scheduler& lhs, const scheduler& rhs) { @@ -471,6 +501,7 @@ inline action make_action_empty() { template inline action make_action(F&& f, action_duration::type d = action_duration::runs_short) { + static_assert(detail::is_action_function::value, "action function must be void(schedulable)"); auto fn = std::forward(f); return action(std::make_shared( d, @@ -491,184 +522,77 @@ inline action make_action(F&& f, action_duration::type d = action_duration::runs })); } -namespace detail { - -template -struct is_action_function -{ - struct not_void {}; - template - static auto check(int) -> decltype((*(CF*)nullptr)(*(schedulable*)nullptr)); - template - static not_void check(...); - - static const bool value = std::is_same::type>(0)), void>::value; -}; - -struct tag_action_function_resolution -{ - template - struct predicate - { - static const bool value = is_action_function::value; - }; - typedef detail::action_type::function_type default_type; -}; - -struct tag_action_duration_resolution -{ - template - struct predicate - { - static const bool value = std::is_same::type, action_duration::type>::value; - }; - struct default_type { - inline operator action_duration::type() const { - return action_duration::runs_short; - } - }; -}; - -struct tag_when_resolution -{ - typedef scheduler_interface::clock_type clock_type; - typedef clock_type::duration duration_type; - typedef clock_type::time_point time_point_type; - template - struct predicate - { - typedef typename std::decay::type decayedlhs; - static const bool value = std::is_same::value || - std::is_same::value; - }; - struct default_type { - inline operator time_point_type() const { - return clock_type::now(); - } - }; -}; - -struct tag_schedulable_resolution -{ - template - struct predicate : public is_schedulable - { - }; - typedef schedulable default_type; -}; - -struct tag_action_resolution -{ - template - struct predicate - { - static const bool value = !is_schedulable::value && is_action::value; - }; - typedef action default_type; -}; - -struct tag_scheduler_resolution -{ - template - struct predicate - { - static const bool value = !is_schedulable::value && is_scheduler::value; - }; - typedef scheduler default_type; -}; - - -typedef rxu::detail::tag_set tag_schedulable_set; - -template -struct action_selector; - -template -struct action_selector -{ - template - static action get_action(Set& rs) { - return std::get<4>(rs).value; - } -}; -template -struct action_selector -{ - template - static action get_action(Set& rs) { - return make_action(std::get<5>(rs).value, std::get<6>(rs).value); - } -}; -template<> -struct action_selector -{ - template - static action get_action(Set& rs) { - return std::get<1>(rs).value.get_action(); - } -}; - -template -action select_action(ResolvedArgSet& rs) { - return action_selector(rs))>::type::is_arg, std::decay(rs))>::type::is_arg, std::decay(rs))>::type::is_arg>::get_action(rs); +// 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)); +} - typedef typename std::decay(std::forward(rs)))>::type rsc_t; - typedef typename std::decay(std::forward(rs)))>::type raf_t; - typedef typename std::decay(std::forward(rs)))>::type rad_t; - typedef typename std::decay(std::forward(rs)))>::type ra_t; - typedef typename std::decay(std::forward(rs)))>::type rscbl_t; +// action +// - static_assert(rscbl_t::is_arg || ra_t::is_arg || raf_t::is_arg, "at least one of; action_function, action or schedulable is required"); - static_assert(int(ra_t::is_arg) + int(raf_t::is_arg) < 2, "action_function not allowed with an action"); - static_assert(int(ra_t::is_arg) + int(rad_t::is_arg) < 2, "action_duration not allowed with an action"); +template +auto make_schedulable(scheduler sc, F&& f, action_duration::type d = action_duration::runs_short) + -> typename std::enable_if::value, schedulable>::type { + return schedulable(composite_subscription(), sc, make_action(std::forward(f), d)); } - -template -schedulable make_schedulable_resolved(ResolvedArgSet&& rsArg) { - const auto rs = std::forward(rsArg); - const auto rsub = std::get<2>(rs); - const auto rsc = std::get<3>(rs); - const auto rscbl = std::get<1>(rs); - const auto sc = (rscbl.is_arg && !rsc.is_arg) ? rscbl.value.get_scheduler() : rsc.value; - const auto sub = (rscbl.is_arg && !rsub.is_arg) ? rscbl.value.get_subscription() : rsub.value; - return schedulable(sub, sc, select_action(rs)); - - typedef typename std::decay(rs))>::type rw_t; - typedef typename std::decay(rs))>::type rsc_t; - typedef typename std::decay(rs))>::type rscbl_t; - - static_assert(when_invalid || !rw_t::is_arg, "when is an invalid parameter"); - static_assert(rscbl_t::is_arg || rsc_t::is_arg, "at least one of; scheduler or schedulable is required"); +template +auto make_schedulable(scheduler sc, composite_subscription cs, F&& f, action_duration::type d = action_duration::runs_short) + -> typename std::enable_if::value, schedulable>::type { + return schedulable(cs, sc, make_action(std::forward(f), d)); } - -template -schedulable schedule_resolved(ResolvedArgSet&& rsArg) { - const auto rw = std::get<0>(rsArg); - schedulable result = make_schedulable_resolved(std::forward(rsArg)); - if (rw.is_arg) { - result.schedule(rw.value); - } else { - result.schedule(); - } - return result; +template +auto make_schedulable(schedulable scbl, composite_subscription cs, F&& f, action_duration::type d = action_duration::runs_short) + -> typename std::enable_if::value, schedulable>::type { + return schedulable(cs, scbl.get_scheduler(), make_action(std::forward(f), d)); +} +template +auto make_schedulable(schedulable scbl, scheduler sc, F&& f, action_duration::type d = action_duration::runs_short) + -> typename std::enable_if::value, schedulable>::type { + return schedulable(scbl.get_subscription(), sc, make_action(std::forward(f), d)); +} +template +auto make_schedulable(schedulable scbl, F&& f, action_duration::type d = action_duration::runs_short) + -> typename std::enable_if::value, schedulable>::type { + return schedulable(scbl.get_subscription(), scbl.get_scheduler(), make_action(std::forward(f), d)); } +inline auto make_schedulable(schedulable scbl, composite_subscription cs) + -> schedulable { + return schedulable(cs, scbl.get_scheduler(), scbl.get_action()); +} +inline auto make_schedulable(schedulable scbl, scheduler sc, composite_subscription cs) + -> schedulable { + return schedulable(cs, sc, scbl.get_action()); +} +inline auto make_schedulable(schedulable scbl, scheduler sc) + -> schedulable { + return schedulable(composite_subscription(), sc, scbl.get_action()); } template -schedulable make_schedulable(Arg0&& a0, ArgN&&... an) { - return detail::make_schedulable_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); +auto scheduler::schedule(Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + return this->schedule(make_schedulable(*this, std::forward(a0), std::forward(an)...)); } - template -schedulable schedule(Arg0&& a0, ArgN&&... an) { - return detail::schedule_resolved(rxu::detail::resolve_arg_set(detail::tag_schedulable_set(), std::forward(a0), std::forward(an)...)); +auto scheduler::schedule(Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + !detail::is_action_function::value && + !is_subscription::value && + !is_scheduler::value && + !is_schedulable::value>::type { + return this->schedule(std::forward(a0), make_schedulable(*this, std::forward(an)...)); } namespace detail { diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 65cbfde..3cb1e60 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -423,17 +423,6 @@ auto make_subscriber(const subscriber& scbr, const compos observer>( static_observer(on, oe, oc))); } -template -auto make_subscriber_cs5(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_error::value && - detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(cs, scbr.get_resumption(), - observer>( - static_observer(on, oe, oc))); -} template auto make_subscriber(const subscriber& scbr, const resumption& r, diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 9b0e98c..6e7db79 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -198,154 +198,6 @@ private: Function* function; }; -template -struct select_arg -{ - template - static auto get(const GArg&, const GArgN&... gan) - -> decltype(select_arg::get(gan...)) { - return select_arg::get(gan...); - } -}; -template -struct select_arg -{ - template - static auto get(const GArg& ga, const GArgN&...) - -> decltype(ga) { - return ga; - } -}; - -template -struct resolved_arg -{ - typedef resolved_arg this_type; - static const int n = N; - static const bool is_arg = true; - typedef T result_type; - result_type value; - struct tag_value {}; - template - resolved_arg(const Value& v, tag_value&&) - : value(v) - { - } - template - static this_type make(const CArgN&... can) { - return this_type(select_arg::get(can...), tag_value()); - } -}; - -template -struct resolved_arg<-1, T> -{ - typedef resolved_arg<-1, T> this_type; - static const int n = -1; - static const bool is_arg = false; - typedef T result_type; - result_type value; - template - static this_type make(const CArgN&... can) { - return this_type(); - } -}; - - -template -struct select_first; - -template -struct select_first -{ - static const int value = Predicate0 ? N : select_first::value; -}; -template -struct select_first -{ - static const int value = -1; -}; - -template -struct select_n -{ - struct type; -}; - -template -struct select_n : public select_n -{ -}; - -template -struct select_n -{ - typedef SArg0 type; -}; - -template class Predicate, class Default, class... ArgN> -struct arg_resolver -{ - typedef select_first<0, Predicate::value...> match; - typedef typename std::conditional< - match::value != -1, - typename select_n::type, - Default>::type result_type; - typedef resolved_arg resolved_type; -}; - -template class Predicate, class Default, class... ArgN> -auto resolve_arg(const ArgN&... an) --> typename arg_resolver::resolved_type -{ - return arg_resolver::resolved_type::make(an...); -} - -template -struct tag_set {}; - -template -struct arg_resolver_set; - -template -struct arg_resolver_set> -{ - template - struct expand - { - typedef typename arg_resolver::resolved_type type; - }; - - template - struct expanded; - - template - struct expanded> - { - typedef std::tuple result_type; - template - static result_type make(const ArgN&... an) { - return result_type(Resolved0::make(an...), ResolvedN::make(an...)...); - } - }; - - template - auto operator()(const ArgN&... an) - -> std::tuple< typename expand::type, - typename expand::type...> { - typedef std::tuple< typename expand::type, - typename expand::type...> out_type; - static_assert(std::tuple_size::value == (sizeof...(TagN) + 1), "tuple must have a value per tag"); - return expanded::make(an...); - } -}; - -template -auto resolve_arg_set(const TagSet&, const ArgN&... an) - -> decltype(arg_resolver_set()(an...)) { - return arg_resolver_set()(an...); -} - } } diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index de4b753..69d5984 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -34,24 +34,26 @@ struct range : public source_base template void on_subscribe(Subscriber o) { auto state = std::make_shared(init); - schedule(state->sc, o.get_subscription(), [=](const rxsc::schedulable& self){ - if (state->remaining == 0) { - o.on_completed(); - // o is unsubscribed - } - if (!o.is_subscribed()) { - // terminate loop - return; - } + state->sc.schedule( + o.get_subscription(), + [=](const rxsc::schedulable& self){ + if (state->remaining == 0) { + o.on_completed(); + // o is unsubscribed + } + if (!o.is_subscribed()) { + // terminate loop + return; + } - // send next value - --state->remaining; - o.on_next(state->next); - state->next = static_cast(state->step + state->next); + // send next value + --state->remaining; + o.on_next(state->next); + state->next = static_cast(state->step + state->next); - // tail recurse this same action to continue loop - self(); - }); + // tail recurse this same action to continue loop + self(); + }); } }; -- GitLab From 142b59871330dd34a6c49d70b802d5baf833e7a0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 29 Mar 2014 18:06:15 -0700 Subject: [PATCH 247/782] clang caught a typo --- Rx/v2/src/rxcpp/rx-subscriber.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 3cb1e60..fbf04be 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -170,7 +170,7 @@ auto make_subscriber(const OnNext& on) subscriber>>>::type { return subscriber>>(composite_subscription(), resumption(), observer>( - static_observer>(on))); + static_observer(on))); } template auto make_subscriber(const OnNext& on, const OnError& oe) -- GitLab From 61e08eb09b856e63bea069e548de75aa87770d38 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 3 Apr 2014 16:27:00 -0700 Subject: [PATCH 248/782] split out the perf tests --- Rx/v2/test/subjects/subject.cpp | 209 ++++++++++++++++++-------------- 1 file changed, 121 insertions(+), 88 deletions(-) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 6b5df0b..f765f03 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -16,99 +16,121 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -SCENARIO("subject test", "[hide][subject][subjects][perf]"){ - GIVEN("a subject"){ - WHEN("multicasting a million ints"){ +const int static_onnextcalls = 100000000; + +SCENARIO("for loop locks mutex", "[hide][for][mutex][perf]"){ + const int& onnextcalls = static_onnextcalls; + GIVEN("a for loop"){ + WHEN("locking mutex 100 million times"){ using namespace std::chrono; typedef steady_clock clock; - const int onnextcalls = 100000000; - - { - std::mutex m; - int c = 0; - int n = 1; - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - std::unique_lock guard(m); - ++c; - } - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + int c = 0; + int n = 1; + auto start = clock::now(); + std::mutex m; + for (int i = 0; i < onnextcalls; i++) { + std::unique_lock guard(m); + ++c; } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - { - int c = 0; - int n = 1; -#if 0 - auto onnext = [&c](int){++c;}; - auto onerror = [](std::exception_ptr){abort();}; + } + } +} - auto oex = rxu::detail::arg_resolver_set::type>()(onnext, onerror); -#endif - auto o = rx::make_observer( - [&c](int){++c;}, - [](std::exception_ptr){abort();}); - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); - } - o.on_completed(); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop -> observer : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; - } +int aliased = 0; - { - int c = 0; - int n = 1; - auto o = rx::make_observer( - [&c](int){++c;}, - [](std::exception_ptr){abort();}); - auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { - o.on_next(i); - } - o.on_completed(); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "loop -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << 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; + + int& c = aliased; + int n = 1; + + c = 0; + auto start = clock::now(); + auto o = rx::make_observer( + [&c](int){++c;}, + [](std::exception_ptr){abort();}); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop -> observer : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + } +} - { - int c = 0; - int n = 1; - auto start = clock::now(); -#if 0 - auto rso = rxu::detail::arg_resolver_set::type>()( - [&c](int){ - ++c; - }, - [](std::exception_ptr){abort();}); - static_assert(std::tuple_size::value == 7, "object must resolve 7 args"); - auto rsf = rxu::detail::resolve_arg_set( - rx::detail::tag_subscriber_set::type(), - [&c](int){ - ++c; - }, - [](std::exception_ptr){abort();}); - static_assert(std::tuple_size::value == 7, "func must resolve 7 args"); - auto ss = rx::detail::make_subscriber_resolved(rsf); -#endif - rxs::range(0, onnextcalls).subscribe( - [&c](int){ - ++c; - }, - [](std::exception_ptr){abort();}); - auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); - std::cout << "range -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << 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; + + int& c = aliased; + int n = 1; + + c = 0; + auto start = clock::now(); + auto o = rx::make_subscriber( + [&c](int){++c;}, + [](std::exception_ptr){abort();}); + for (int i = 0; i < onnextcalls; i++) { + o.on_next(i); } + o.on_completed(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "loop -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << 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; + + int& c = aliased; + int n = 1; + + c = 0; + auto start = clock::now(); + + rxs::range(0, onnextcalls).subscribe( + [&c](int){ + ++c; + }, + [](std::exception_ptr){abort();}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "range -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + } + } +} + +SCENARIO("for loop calls subject", "[hide][for][subject][subjects][perf]"){ + 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++) { @@ -134,10 +156,13 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ while(o.is_subscribed()) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); rx::composite_subscription cs; - source.subscribe(cs, [cs](int){ - cs.unsubscribe(); - }, - [](std::exception_ptr){abort();}); + source.subscribe( + rx::make_subscriber( + cs, + [cs](int){ + cs.unsubscribe(); + }, + [](std::exception_ptr){abort();})); } return 0; }); @@ -163,7 +188,16 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ duration_cast(start.time_since_epoch()); std::cout << "loop -> subject : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } + } + } +} +SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ + 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(0); @@ -224,7 +258,6 @@ SCENARIO("subject test", "[hide][subject][subjects][perf]"){ } - SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ -- GitLab From 6830d6fa1df0a502e30264b6d4b94089cfc4d849 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 4 Apr 2014 16:52:50 -0700 Subject: [PATCH 249/782] add publish, ref_count and connectable_observable --- Rx/v2/src/rxcpp/operators/rx-publish.hpp | 78 +++++++++++++++++++ Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 70 +++++++++++++++++ Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 64 +++++++++++++++ Rx/v2/src/rxcpp/rx-includes.hpp | 1 + Rx/v2/src/rxcpp/rx-observable.hpp | 11 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 2 + Rx/v2/src/rxcpp/rx-predef.hpp | 5 ++ Rx/v2/src/rxcpp/rx-util.hpp | 10 +-- Rx/v2/test/operators/publish.cpp | 28 +++++++ projects/CMake/CMakeLists.txt | 1 + 10 files changed, 265 insertions(+), 5 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-publish.hpp create mode 100644 Rx/v2/src/rxcpp/operators/rx-ref_count.hpp create mode 100644 Rx/v2/src/rxcpp/rx-connectable_observable.hpp create mode 100644 Rx/v2/test/operators/publish.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-publish.hpp b/Rx/v2/src/rxcpp/operators/rx-publish.hpp new file mode 100644 index 0000000..fcb89f3 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-publish.hpp @@ -0,0 +1,78 @@ +// 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_PUBLISH_HPP) +#define RXCPP_OPERATORS_RX_PUBLISH_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct publish : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type subject_type; + source_type source; + subject_type subject_value; + rxu::detail::maybe connection; + + explicit publish(source_type o) + : source(std::move(o)) + { + } + template + void on_subscribe(Subscriber&& o) { + subject_value.get_observable().subscribe(std::forward(o)); + } + void on_connect(composite_subscription cs) { + if (connection.empty()) { + // the lifetime of each connect is independent + auto destination = subject_value.get_subscriber(); + + // when the paramter is unsubscribed it should + // unsubscribe the most recent connection + connection.reset(cs.add(destination.get_subscription())); + + // when the connection is finished it should shutdown the connection + destination.add(make_subscription( + [cs, this](){ + cs.remove(this->connection.get()); + this->connection.reset(); + })); + + source.subscribe(destination); + } + } +}; + +template class Subject> +class publish_factory +{ +public: + publish_factory() {} + template + auto operator()(Observable&& source) + -> connectable_observable::type::value_type, publish::type::value_type, Observable, Subject::type::value_type>>> { + return connectable_observable::type::value_type, publish::type::value_type, Observable, Subject::type::value_type>>>( + publish::type::value_type, Observable, Subject::type::value_type>>(std::forward(source))); + } +}; + +} + +inline auto publish() + -> detail::publish_factory { + return detail::publish_factory(); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp new file mode 100644 index 0000000..8d8b1a7 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -0,0 +1,70 @@ +// 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_REF_COUNT_HPP) +#define RXCPP_OPERATORS_RX_REF_COUNT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct ref_count : public operator_base +{ + typedef typename std::decay::type source_type; + + source_type source; + long subscribers; + composite_subscription connection; + + explicit ref_count(source_type o) + : source(std::move(o)) + , subscribers(0) + { + } + + template + void on_subscribe(Subscriber&& o) { + auto needConnect = ++subscribers == 1; + o.add(make_subscription( + [this](){ + if (--this->subscribers == 0) { + this->connection.unsubscribe(); + } + })); + source.subscribe(std::forward(o)); + if (needConnect) { + connection = source.connect(); + } + } +}; + +class ref_count_factory +{ +public: + ref_count_factory() {} + template + auto operator()(Observable&& source) + -> observable::type::value_type, ref_count::type::value_type, Observable>> { + return observable::type::value_type, ref_count::type::value_type, Observable>>( + ref_count::type::value_type, Observable>(std::forward(source))); + } +}; + +} + +inline auto ref_count() + -> detail::ref_count_factory { + return detail::ref_count_factory(); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp new file mode 100644 index 0000000..590c5dd --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -0,0 +1,64 @@ +// 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 { + +template +class connectable_observable + : public observable +{ +public: + typedef connectable_observable this_type; + typedef tag_connectable_observable observable_tag; + typedef observable base_type; + + 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 + connectable_observable(const connectable_observable& o) + : base_type(o) + {} + // implicit conversion between observables of the same value_type + template + connectable_observable(connectable_observable&& o) + : base_type(std::move(o)) + {} + + composite_subscription connect(composite_subscription cs = composite_subscription()) { + base_type::source_operator.on_connect(cs); + return cs; + } + + /// -> + /// + /// + auto ref_count() const + -> observable> { + return observable>( + rxo::detail::ref_count(*this)); + } + +}; + + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index ba13539..b15a3d1 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -107,6 +107,7 @@ #include "rx-subjects.hpp" #include "rx-operators.hpp" #include "rx-observable.hpp" +#include "rx-connectable_observable.hpp" #pragma pop_macro("min") #pragma pop_macro("max") diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 8282ea2..10cf825 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -270,6 +270,17 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); } + /// publish -> + /// turns a cold observable hot and allows connections to the source to be independent of subscriptions + /// +#if 1 + auto publish() const + -> connectable_observable>> { + return connectable_observable>>( + rxo::detail::publish>(*this)); + } +#endif + /// /// takes any function that will take this observable and produce a result value. /// this is intended to allow externally defined operators to be connected into the expression. diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index a6071c9..e23a936 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -38,5 +38,7 @@ namespace rxo=operators; #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" #include "operators/rx-flat_map.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 index 1926c17..7e6f987 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -135,6 +135,11 @@ public: static const bool value = std::is_convertible::type>(0)), tag_observable>::value; }; +struct tag_connectable_observable {}; + +template +class connectable_observable; + } #endif diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 6e7db79..eb25e67 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -62,7 +62,7 @@ public: : is_set(false) { if (other.is_set) { - new (reinterpret_cast(&storage)) T(*other.get()); + new (reinterpret_cast(&storage)) T(other.get()); is_set = true; } } @@ -70,7 +70,7 @@ public: : is_set(false) { if (other.is_set) { - new (reinterpret_cast(&storage)) T(std::move(*other.get())); + new (reinterpret_cast(&storage)) T(std::move(other.get())); is_set = true; other.reset(); } @@ -125,13 +125,13 @@ public: return *reinterpret_cast(&storage); } - T& value() { + T& get() { if (!is_set) abort(); return *reinterpret_cast(&storage); } - const T& value() const { + const T& get() const { if (!is_set) abort(); - return *reinterpret_cast(&storage); + return *reinterpret_cast(&storage); } void reset() diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp new file mode 100644 index 0000000..56fa2f2 --- /dev/null +++ b/Rx/v2/test/operators/publish.cpp @@ -0,0 +1,28 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +SCENARIO("publish range", "[range][subject][publish][operators]"){ + GIVEN("a range"){ + WHEN("published"){ + auto published = rxs::range(0, 1000).publish().ref_count(); + std::cout << "connect to published" << std::endl; + published.subscribe( + // on_next + [](int v){std::cout << v << ", ";}, + // on_completed + [](){std::cout << std::endl;}); + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 11447e4..27b69b3 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -43,6 +43,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp + ${V2_TEST_DIR}/operators/publish.cpp ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp ${V2_TEST_DIR}/operators/flat_map.cpp -- GitLab From 0f12d12602aef386e1c3cdbea4f899144fc50129 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 4 Apr 2014 18:20:35 -0700 Subject: [PATCH 250/782] added connect_now --- Rx/v2/src/rxcpp/operators/rx-connect_now.hpp | 58 +++++++++++++++++++ Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 18 +++++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/publish.cpp | 4 +- 4 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-connect_now.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-connect_now.hpp b/Rx/v2/src/rxcpp/operators/rx-connect_now.hpp new file mode 100644 index 0000000..ff998f0 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-connect_now.hpp @@ -0,0 +1,58 @@ +// 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_CONNECT_NOW_HPP) +#define RXCPP_OPERATORS_RX_CONNECT_NOW_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct connect_now : public operator_base +{ + typedef typename std::decay::type source_type; + + source_type source; + + explicit connect_now(source_type o) + : source(std::move(o)) + { + source.connect(); + } + + template + void on_subscribe(Subscriber&& o) { + source.subscribe(std::forward(o)); + } +}; + +class connect_now_factory +{ +public: + connect_now_factory() {} + template + auto operator()(Observable&& source) + -> observable::type::value_type, connect_now::type::value_type, Observable>> { + return observable::type::value_type, connect_now::type::value_type, Observable>>( + connect_now::type::value_type, Observable>(std::forward(source))); + } +}; + +} + +inline auto connect_now() + -> detail::connect_now_factory { + return detail::connect_now_factory(); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 590c5dd..39590dd 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -47,8 +47,11 @@ public: return cs; } - /// -> - /// + /// ref_count -> + /// takes a connectable_observable source and uses a ref_count of the subscribers + /// to control the connection to the published source. The first subscription + /// will cause a call to connect() and the last unsubscribe will unsubscribe the + /// connection. /// auto ref_count() const -> observable> { @@ -56,6 +59,17 @@ public: rxo::detail::ref_count(*this)); } + /// connect_now -> + /// 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. + /// + auto connect_now() const + -> observable> { + return observable>( + rxo::detail::connect_now(*this)); + } }; diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index e23a936..3ada268 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -40,5 +40,6 @@ namespace rxo=operators; #include "operators/rx-flat_map.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" +#include "operators/rx-connect_now.hpp" #endif diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 56fa2f2..5a0fd2b 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -16,13 +16,13 @@ namespace rxt=rxcpp::test; SCENARIO("publish range", "[range][subject][publish][operators]"){ GIVEN("a range"){ WHEN("published"){ - auto published = rxs::range(0, 1000).publish().ref_count(); + auto published = rxs::range(0, 1000).publish().connect_now(); std::cout << "connect to published" << std::endl; published.subscribe( // on_next [](int v){std::cout << v << ", ";}, // on_completed - [](){std::cout << std::endl;}); + [](){std::cout << " done." << std::endl;}); } } } -- GitLab From 0a583f0cb92926aa916302f66c8e5a13f7e43ccd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 4 Apr 2014 19:48:45 -0700 Subject: [PATCH 251/782] add dynamic_connectable_observable --- Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 129 +++++++++++++++- Rx/v2/src/rxcpp/rx-observable.hpp | 2 - Rx/v2/src/rxcpp/rx-predef.hpp | 33 +++- Rx/v2/test/operators/publish.cpp | 145 +++++++++++++++++- 4 files changed, 302 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 39590dd..bf63dd0 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -9,14 +9,132 @@ namespace rxcpp { +namespace detail { + +template +struct has_on_connect +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CT*)nullptr).on_connect(composite_subscription())); + template + static not_void check(...); + + typedef decltype(check(0)) detail_result; + static const bool value = std::is_same::value; +}; + +} + +template +class dynamic_connectable_observable + : public rxs::source_base +{ + struct state_type + : public std::enable_shared_from_this + { + typedef std::function)> onsubscribe_type; + typedef std::function onconnect_type; + + onsubscribe_type on_subscribe; + onconnect_type on_connect; + }; + std::shared_ptr state; + + template + void construct(const dynamic_observable& o, tag_dynamic_observable&&) { + state = o.state; + } + + template + void construct(dynamic_observable&& o, tag_dynamic_observable&&) { + state = std::move(o.state); + } + + template + void construct(SO&& source, rxs::tag_source&&) { + auto so = std::make_shared::type>(std::forward(source)); + state->on_subscribe = [so](subscriber o) mutable { + so->on_subscribe(std::move(o)); + }; + 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 + explicit dynamic_connectable_observable(SOF&& sof) + : state(std::make_shared()) + { + construct(std::forward(sof), + typename std::conditional::value, tag_dynamic_observable, rxs::tag_source>::type()); + } + + template + dynamic_connectable_observable(SF&& sf, CF&& cf) + : state(std::make_shared()) + { + state->on_subscribe = std::forward(sf); + state->on_connect = std::forward(cf); + } + + void on_subscribe(subscriber o) const { + state->on_subscribe(std::move(o)); + } + + template + typename std::enable_if::type, observer>::value, void>::type + on_subscribe(Subscriber&& o) const { + auto so = std::make_shared::type>(std::forward(o)); + state->on_subscribe(make_subscriber( + *so, + make_observer_dynamic( + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + }))); + } + + void on_connect(composite_subscription cs) const { + state->on_connect(std::move(cs)); + } +}; + +template +connectable_observable make_dynamic_connectable_observable(Source&& s) { + return connectable_observable(dynamic_connectable_observable(std::forward(s))); +} + + + template class connectable_observable : public observable { -public: typedef connectable_observable this_type; - typedef tag_connectable_observable observable_tag; typedef observable base_type; + typedef typename std::decay::type source_operator_type; + + static_assert(detail::has_on_connect::value, "inner must have on_connect method void(composite_subscription)"); + +public: + typedef tag_connectable_observable observable_tag; connectable_observable() { @@ -42,6 +160,13 @@ public: : base_type(std::move(o)) {} + /// + /// performs type-forgetting conversion to a new composite_observable + /// + connectable_observable as_dynamic() { + return *this; + } + composite_subscription connect(composite_subscription cs = composite_subscription()) { base_type::source_operator.on_connect(cs); return cs; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 10cf825..dd471f7 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -273,13 +273,11 @@ public: /// publish -> /// turns a cold observable hot and allows connections to the source to be independent of subscriptions /// -#if 1 auto publish() const -> connectable_observable>> { return connectable_observable>>( rxo::detail::publish>(*this)); } -#endif /// /// takes any function that will take this observable and produce a result value. diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 7e6f987..41cb223 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -135,11 +135,40 @@ public: static const bool value = std::is_convertible::type>(0)), tag_observable>::value; }; -struct tag_connectable_observable {}; +struct tag_dynamic_connectable_observable : public tag_dynamic_observable {}; -template +template +class is_dynamic_connectable_observable +{ + struct not_void {}; + template + static typename C::dynamic_observable_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_dynamic_connectable_observable*>::value; +}; + +template +class dynamic_connectable_observable; + +template::value, + void, dynamic_connectable_observable>::type> class connectable_observable; +struct tag_connectable_observable : public tag_observable {}; +template +class is_connectable_observable +{ + template + static typename C::observable_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_connectable_observable>::value; +}; + } #endif diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 5a0fd2b..9739646 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -16,8 +16,28 @@ namespace rxt=rxcpp::test; SCENARIO("publish range", "[range][subject][publish][operators]"){ GIVEN("a range"){ WHEN("published"){ - auto published = rxs::range(0, 1000).publish().connect_now(); + auto published = rxs::range(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(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_now is used"){ + auto published = rxs::range(0, 10).publish().connect_now(); + std::cout << "subscribe to connect_now" << std::endl; published.subscribe( // on_next [](int v){std::cout << v << ", ";}, @@ -26,3 +46,126 @@ SCENARIO("publish range", "[range][subject][publish][operators]"){ } } } + +SCENARIO("publish", "[publish][multicast][operators]"){ + GIVEN("a test hot observable of longs"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + record messages[] = { + 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 xs = sc.make_hot_observable(messages); + + auto res = sc.make_subscriber(); + + rx::connectable_observable ys; + + WHEN("subscribed and then connected"){ + + sc.schedule_absolute(rxsc::test::created_time, + [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ + ys = xs.publish().as_dynamic(); + //ys = xs.publish_last().as_dynamic(); + }); + + sc.schedule_absolute(rxsc::test::subscribed_time, + [&ys, &res](const rxsc::schedulable& scbl){ + ys.subscribe(res); + }); + + sc.schedule_absolute(rxsc::test::unsubscribed_time, + [&res](const rxsc::schedulable& scbl){ + res.unsubscribe(); + }); + + { + rx::composite_subscription connection; + + sc.schedule_absolute(300, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + sc.schedule_absolute(400, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + { + rx::composite_subscription connection; + + sc.schedule_absolute(500, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + sc.schedule_absolute(550, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + { + rx::composite_subscription connection; + + sc.schedule_absolute(650, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + sc.schedule_absolute(800, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + sc.start(); + + THEN("the output only contains items sent while subscribed"){ + record items[] = { + on_next(340, 8), + on_next(360, 5), + on_next(370, 6), + on_next(390, 7), + on_next(520, 11) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there were 3 subscription/unsubscription"){ + life items[] = { + subscribe(300, 400), + subscribe(500, 550), + subscribe(650, 800) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + -- GitLab From 24e0c50468c66846e4b3aab51931ba301261e27d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 4 Apr 2014 22:12:26 -0700 Subject: [PATCH 252/782] added take_until --- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 170 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 10 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/publish.cpp | 2 +- Rx/v2/test/operators/take.cpp | 86 ++++++++++ projects/CMake/CMakeLists.txt | 1 + 7 files changed, 270 insertions(+), 2 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-take_until.hpp create mode 100644 Rx/v2/test/operators/take.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index 28f2caa..b54deab 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -32,7 +32,7 @@ struct filter : public operator_base static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); } template - void on_subscribe(Subscriber o) { + void on_subscribe(const Subscriber& o) { source.subscribe( o, // on_next diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp new file mode 100644 index 0000000..4c6a0ee --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -0,0 +1,170 @@ +// 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_TAKE_HPP) +#define RXCPP_OPERATORS_RX_TAKE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct take_until : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type trigger_source_type; + struct values + { + values(source_type s, trigger_source_type t) + : source(std::move(s)) + , trigger(std::move(t)) + { + } + source_type source; + trigger_source_type trigger; + }; + values initial; + + take_until(source_type s, trigger_source_type t) + : initial(std::move(s), std::move(t)) + { + } + + struct mode + { + enum type { + taking, + clear, + triggered, + errored, + stopped + }; + }; + + template + void on_subscribe(const Subscriber& s) { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , public values + { + state_type(const values& i, const output_type& oarg) + : values(i) + , mode_value(mode::taking) + , busy(0) + , out(oarg) + { + } + mutable std::atomic mode_value; + mutable std::atomic busy; + mutable std::exception_ptr exception; + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::shared_ptr(new state_type(initial, s)); + + struct activity + { + const std::shared_ptr& st; + ~activity() { + if (--st->busy == 0 && st->mode_value > mode::clear) { + // need to finish + if (st->mode_value < mode::stopped && ++st->busy == 1) { + // this is the finish owner + auto fin = st->mode_value.exchange(mode::stopped); + if (fin == mode::triggered) { + st->out.on_completed(); + } else if (fin == mode::errored) { + st->out.on_error(st->exception); + } + } + } + } + explicit activity(const std::shared_ptr& st) + : st(st) + { + ++st->busy; + } + + }; + + state->trigger.subscribe( + // share subscription lifetime + state->out, + // on_next + [state](const typename trigger_source_type::value_type&) { + activity finisher(state); + state->mode_value = mode::triggered; + }, + // on_error + [state](std::exception_ptr e) { + activity finisher(state); + state->exception = e; + state->mode_value = mode::errored; + }, + // on_completed + [state]() { + activity finisher(state); + state->mode_value = mode::clear; + } + ); + + state->source.subscribe( + // share subscription lifetime + state->out, + // on_next + [state](T t) { + activity finisher(state); + if (state->mode_value < mode::triggered) { + state->out.on_next(t); + } + }, + // on_error + [state](std::exception_ptr e) { + activity finisher(state); + state->exception = e; + state->mode_value = mode::errored; + }, + // on_completed + [state]() { + activity finisher(state); + state->mode_value = mode::triggered; + } + ); + } +}; + +template +class take_until_factory +{ + typedef typename std::decay::type trigger_source_type; + trigger_source_type trigger_source; +public: + take_until_factory(trigger_source_type t) : trigger_source(std::move(t)) {} + template + auto operator()(Observable&& source) + -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>> { + return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>>( + take_until::type::value_type, Observable, trigger_source_type>(std::forward(source), std::move(trigger_source))); + } +}; + +} + +template +auto take_until(TriggerObservable&& t) + -> detail::take_until_factory { + return detail::take_until_factory(std::forward(t)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index dd471f7..79a2239 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -279,6 +279,16 @@ public: rxo::detail::publish>(*this)); } + /// take_until -> + /// + /// + template + auto take_until(TriggerSource&& t) const + -> observable> { + return observable>( + rxo::detail::take_until(*this, std::forward(t))); + } + /// /// takes any function that will take this observable and produce a result value. /// this is intended to allow externally defined operators to be connected into the expression. diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 3ada268..18a974c 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -41,5 +41,6 @@ namespace rxo=operators; #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-connect_now.hpp" +#include "operators/rx-take_until.hpp" #endif diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 9739646..8d044f0 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -13,7 +13,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -SCENARIO("publish range", "[range][subject][publish][operators]"){ +SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ GIVEN("a range"){ WHEN("published"){ auto published = rxs::range(0, 10).publish(); diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp new file mode 100644 index 0000000..eb4cd50 --- /dev/null +++ b/Rx/v2/test/operators/take.cpp @@ -0,0 +1,86 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ + GIVEN("2 sources"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto xs = sc.make_hot_observable(xmessages); + + record ymessages[] = { + on_next(150, 1), + on_next(225, 99), + on_completed(230) + }; + auto ys = sc.make_hot_observable(ymessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.start( + [xs, ys]() { + return xs + .take_until(ys) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output only contains items sent while subscribed"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_completed(225) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = ys.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 27b69b3..0c75e10 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -43,6 +43,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp + ${V2_TEST_DIR}/operators/take.cpp ${V2_TEST_DIR}/operators/publish.cpp ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp -- GitLab From d230f4cb858482012d27ff66399c63f868163b64 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 10:55:53 -0700 Subject: [PATCH 253/782] add take operator --- Rx/v2/src/rxcpp/operators/rx-take.hpp | 125 ++++++++++++++++++++ Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 6 +- Rx/v2/src/rxcpp/rx-observable.hpp | 10 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-take.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp new file mode 100644 index 0000000..b8ddc2f --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -0,0 +1,125 @@ +// 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_TAKE_HPP) +#define RXCPP_OPERATORS_RX_TAKE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct take : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type 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, + clear, + triggered, + errored, + stopped + }; + }; + + template + void on_subscribe(const Subscriber& s) { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , 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::shared_ptr(new state_type(initial, s)); + + state->source.subscribe( + // share subscription lifetime + state->out, + // on_next + [state](T t) { + if (state->mode_value < mode::triggered) { + if (--state->count > 0) { + state->out.on_next(t); + } else { + state->out.on_next(t); + state->mode_value = mode::clear; + state->out.unsubscribe(); + } + } + }, + // on_error + [state](std::exception_ptr e) { + state->mode_value = mode::errored; + state->out.on_error(e); + }, + // on_completed + [state]() { + state->mode_value = mode::triggered; + state->out.on_completed(); + } + ); + } +}; + +template +class take_factory +{ + typedef typename std::decay::type count_type; + count_type count; +public: + take_factory(count_type t) : count(std::move(t)) {} + template + auto operator()(Observable&& source) + -> observable::type::value_type, take::type::value_type, Observable, count_type>> { + return observable::type::value_type, take::type::value_type, Observable, count_type>>( + take::type::value_type, Observable, count_type>(std::forward(source), count)); + } +}; + +} + +template +auto take(T&& t) + -> detail::take_factory { + return detail::take_factory(std::forward(t)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 4c6a0ee..608cde4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -2,8 +2,8 @@ #pragma once -#if !defined(RXCPP_OPERATORS_RX_TAKE_HPP) -#define RXCPP_OPERATORS_RX_TAKE_HPP +#if !defined(RXCPP_OPERATORS_RX_TAKE_UNTIL_HPP) +#define RXCPP_OPERATORS_RX_TAKE_UNTIL_HPP #include "../rx-includes.hpp" @@ -151,7 +151,7 @@ public: auto operator()(Observable&& source) -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>> { return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>>( - take_until::type::value_type, Observable, trigger_source_type>(std::forward(source), std::move(trigger_source))); + take_until::type::value_type, Observable, trigger_source_type>(std::forward(source), trigger_source)); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 79a2239..2573353 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -279,6 +279,16 @@ public: rxo::detail::publish>(*this)); } + /// take -> + /// + /// + template + auto take(Count&& t) const + -> observable> { + return observable>( + rxo::detail::take(*this, std::forward(t))); + } + /// take_until -> /// /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 18a974c..b0fa902 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -41,6 +41,7 @@ namespace rxo=operators; #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-connect_now.hpp" +#include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" #endif -- GitLab From cca6c778873f8de810a4bd11bd263df214237538 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 10:56:15 -0700 Subject: [PATCH 254/782] remove some default constructors --- Rx/v2/src/rxcpp/rx-observer.hpp | 7 +++---- Rx/v2/src/rxcpp/rx-subscriber.hpp | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 74946e8..23b58ab 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -202,14 +202,13 @@ class observer : public observer_base typedef typename std::decay::type inner_t; inner_t inner; + + observer(); public: ~observer() { } - observer() - { - } - observer(inner_t inner) + explicit observer(inner_t inner) : inner(std::move(inner)) { } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index fbf04be..92b672f 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -40,13 +40,11 @@ class subscriber : public subscriber_base const this_type* that; }; + subscriber(); public: typedef typename composite_subscription::weak_subscription weak_subscription; typedef typename composite_subscription::shared_subscription shared_subscription; - subscriber() - { - } template subscriber(composite_subscription cs, resumption r, U&& o) : lifetime(std::move(cs)) -- GitLab From 9d8db1823e90aaa62bd33b2ff93d3b5c5e0c2891 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 10:57:02 -0700 Subject: [PATCH 255/782] check subscription before calling action --- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 2384581..4eddf52 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -225,7 +225,9 @@ public: queue::pop(); - what(recursor); + if (what.is_subscribed()) { + what(recursor); + } if (queue::empty()) { break; -- GitLab From 46017d9e4d61e89dd1f3fb44cb662b8d65697058 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 16:16:32 -0700 Subject: [PATCH 256/782] fixes and test for take --- Rx/v2/src/rxcpp/operators/rx-take.hpp | 7 ++- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 30 ++++++++--- Rx/v2/test/operators/take.cpp | 56 +++++++++++++++++++++ 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index b8ddc2f..ff903f0 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -39,7 +39,6 @@ struct take : public operator_base { enum type { taking, - clear, triggered, errored, stopped @@ -75,9 +74,9 @@ struct take : public operator_base if (--state->count > 0) { state->out.on_next(t); } else { + state->mode_value = mode::triggered; state->out.on_next(t); - state->mode_value = mode::clear; - state->out.unsubscribe(); + state->out.on_completed(); } } }, @@ -88,7 +87,7 @@ struct take : public operator_base }, // on_completed [state]() { - state->mode_value = mode::triggered; + state->mode_value = mode::stopped; state->out.on_completed(); } ); diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 608cde4..c93d568 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -63,6 +63,7 @@ struct take_until : public operator_base } mutable std::atomic mode_value; mutable std::atomic busy; + mutable std::mutex error_lock; mutable std::exception_ptr exception; output_type out; }; @@ -81,6 +82,7 @@ struct take_until : public operator_base if (fin == mode::triggered) { st->out.on_completed(); } else if (fin == mode::errored) { + std::unique_lock guard(st->error_lock); st->out.on_error(st->exception); } } @@ -100,18 +102,26 @@ struct take_until : public operator_base // on_next [state](const typename trigger_source_type::value_type&) { activity finisher(state); - state->mode_value = mode::triggered; + typename mode::type v = state->mode_value; + if (v != mode::taking) {return;} + state->mode_value.compare_exchange_strong(v, mode::triggered); }, // on_error [state](std::exception_ptr e) { activity finisher(state); - state->exception = e; - state->mode_value = mode::errored; + std::unique_lock guard(state->error_lock); + typename mode::type v = state->mode_value; + if (v != mode::taking) {return;} + if (state->mode_value.compare_exchange_strong(v, mode::errored)) { + state->exception = e; + } }, // on_completed [state]() { activity finisher(state); - state->mode_value = mode::clear; + typename mode::type v = state->mode_value; + if (v != mode::taking) {return;} + state->mode_value.compare_exchange_strong(v, mode::clear); } ); @@ -128,13 +138,19 @@ struct take_until : public operator_base // on_error [state](std::exception_ptr e) { activity finisher(state); - state->exception = e; - state->mode_value = mode::errored; + std::unique_lock guard(state->error_lock); + typename mode::type v = state->mode_value; + if (v < mode::triggered) {return;} + if (state->mode_value.compare_exchange_strong(v, mode::errored)) { + state->exception = e; + } }, // on_completed [state]() { activity finisher(state); - state->mode_value = mode::triggered; + typename mode::type v = state->mode_value; + if (v < mode::triggered) {return;} + state->mode_value.compare_exchange_strong(v, mode::triggered); } ); } diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index eb4cd50..fb318e6 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -12,6 +12,62 @@ namespace rxt=rxcpp::test; #include "catch.hpp" +SCENARIO("take 2", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("2 values are taken"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_completed(220) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 220) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ GIVEN("2 sources"){ -- GitLab From 203c098fbca73b6a52da08b34ff2f5d9835fc1d6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 21:07:38 -0700 Subject: [PATCH 257/782] add some pythagorian perf tests --- Rx/v2/test/operators/flat_map.cpp | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 1fff6a4..faf194e 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,6 +12,84 @@ namespace rxt=rxcpp::test; #include "catch.hpp" +static const int static_tripletCount = 500; + +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) + { + //result += (x + y + z); + //std::cout << x << "," << y << "," << z << std::endl; + ++ct; + if(ct == tripletCount) + goto done; + } + } + } + } + done: + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + + } + } +} + +SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + 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(); + auto triples = + rxs::range(1) + .flat_map( + [&c](int z){ return rxs::range(1, z) + .flat_map( + [&c, z](int x){ return rxs::range(x, z) + .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + .map([z, x](int y){return std::make_tuple(x, y, z);});}, + [](int x, std::tuple triplet){return triplet;});}, + [](int z, std::tuple triplet){return triplet;}); + triples + .take(tripletCount) + .subscribe( + [&ct](std::tuple triplet){++ct; + //int x,y,z; std::tie(x,y,z) = triplet; std::cout << x << "," << y << "," << z << std::endl; + }, + [](std::exception_ptr){abort();}); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << 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(); -- GitLab From 44fa1e294dbac1d5774f7a11d6a8a53a9ea230df Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Apr 2014 08:46:49 -0700 Subject: [PATCH 258/782] separate lifetime of trigger subscription --- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index c93d568..6b97cb8 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -96,9 +96,14 @@ struct take_until : public operator_base }; + composite_subscription trigger_lifetime; + state->out.add(trigger_lifetime); + state->trigger.subscribe( - // share subscription lifetime + // share parts of subscription state->out, + // new lifetime + trigger_lifetime, // on_next [state](const typename trigger_source_type::value_type&) { activity finisher(state); @@ -130,6 +135,9 @@ struct take_until : public operator_base state->out, // on_next [state](T t) { + // + // everything is crafted to minimize the overhead of this function. + // activity finisher(state); if (state->mode_value < mode::triggered) { state->out.on_next(t); -- GitLab From 0365049a3cb955789188e38ccc02d7b3bcc22acc Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Apr 2014 08:47:07 -0700 Subject: [PATCH 259/782] port many more tests for take and take_until --- Rx/v2/test/operators/take.cpp | 1465 ++++++++++++++++++++++++++++++++- 1 file changed, 1445 insertions(+), 20 deletions(-) diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index fb318e6..7926668 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -68,8 +68,1133 @@ SCENARIO("take 2", "[take][operators]"){ } } +SCENARIO("take, complete after", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("20 values are taken"){ + + auto res = sc.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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 690) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, complete same", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("17 values are taken"){ + + auto res = sc.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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 630) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, complete before", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("10 values are taken"){ + + auto res = sc.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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 415) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, error after", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + std::runtime_error ex("take on_error from source"); + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("20 values are taken"){ + + auto res = sc.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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 690) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, error same", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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")) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("17 values are taken"){ + + auto res = sc.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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 630) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, error before", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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")) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("3 values are taken"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 9), + on_next(230, 13), + on_next(270, 7), + on_completed(270) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 270) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, dispose before", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("3 values are taken"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 9), + on_next(230, 13) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + +SCENARIO("take, dispose after", "[take][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + 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) + }; + auto xs = sc.make_hot_observable(xmessages); + + WHEN("3 values are taken"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 9), + on_next(230, 13), + on_next(270, 7), + on_completed(270) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 270) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} + + + +SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ + GIVEN("2 sources"){ + auto sc = rxsc::make_test(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record xmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto xs = sc.make_hot_observable(xmessages); + + record ymessages[] = { + on_next(150, 1), + on_next(225, 99), + on_completed(230) + }; + auto ys = sc.make_hot_observable(ymessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.start( + [xs, ys]() { + return xs + .take_until(ys) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output only contains items sent while subscribed"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_completed(225) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(225, 99), + on_completed(230) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_completed(225) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + std::runtime_error ex("take_until on_error from source"); + + record lmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_error(225, ex) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_error(225, ex) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_completed(225) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { + on_next(150, 1) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(225, 2), //! + on_completed(250) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_completed(225) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + std::runtime_error ex("take_until on_error from source"); + + record lmessages[] = { + on_next(150, 1) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_error(225, ex) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_error(225, ex) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } -SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); typedef rxsc::test::messages m; @@ -80,29 +1205,147 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ auto on_completed = m::on_completed; auto subscribe = m::subscribe; - record xmessages[] = { + record lmessages[] = { + on_next(150, 1) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) + on_completed(225) }; - auto xs = sc.make_hot_observable(xmessages); + auto r = sc.make_hot_observable(rmessages); - record ymessages[] = { + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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(); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 1000 /* can't dispose prematurely, could be in flight to dispatch OnError */) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 225) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { + on_next(150, 1) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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(); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 1000) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 1000) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record lmessages[] = { on_next(150, 1), - on_next(225, 99), - on_completed(230) + on_next(230, 2), + on_completed(240) }; - auto ys = sc.make_hot_observable(ymessages); + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(210, 2), //! + on_completed(220) + }; + auto r = sc.make_hot_observable(rmessages); WHEN("one is taken until the other emits a marble"){ auto res = sc.start( - [xs, ys]() { - return xs - .take_until(ys) + [l, r]() { + return l + .take_until(r) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); } @@ -110,9 +1353,191 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ record items[] = { - on_next(210, 2), - on_next(220, 3), - on_completed(225) + on_completed(210) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the source"){ + life items[] = { + subscribe(200, 210) + }; + auto required = rxu::to_vector(items); + auto actual = l.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was 1 subscription/unsubscription to the trigger"){ + life items[] = { + subscribe(200, 210) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + bool sourceNotDisposed = false; + + record lmessages[] = { + on_next(150, 1), + on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come + on_completed(240) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(210, 2), //! + on_completed(220) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_completed(210) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + bool signalNotDisposed = false; + + record lmessages[] = { + on_next(150, 1), + on_next(230, 2), + on_completed(240) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(250, 2), + on_completed(260) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_next(230, 2), + on_completed(240) + }; + auto required = rxu::to_vector(items); + 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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + std::runtime_error ex("take_until on_error from source"); + + record lmessages[] = { + on_next(150, 1), + on_error(225, ex) + }; + auto l = sc.make_hot_observable(lmessages); + + record rmessages[] = { + on_next(150, 1), + on_next(240, 2) + }; + auto r = sc.make_hot_observable(rmessages); + + WHEN("one is taken until the other emits a marble"){ + + auto res = sc.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"){ + record items[] = { + on_error(225, ex) }; auto required = rxu::to_vector(items); auto actual = res.get_observer().messages(); @@ -124,7 +1549,7 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ subscribe(200, 225) }; auto required = rxu::to_vector(items); - auto actual = xs.subscriptions(); + auto actual = l.subscriptions(); REQUIRE(required == actual); } @@ -133,7 +1558,7 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ subscribe(200, 225) }; auto required = rxu::to_vector(items); - auto actual = ys.subscriptions(); + auto actual = r.subscriptions(); REQUIRE(required == actual); } -- GitLab From 4db682b6317b08d58755471f21eb025b4693bc9c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Apr 2014 17:23:15 -0700 Subject: [PATCH 260/782] simplified and fixed a bug in take_until --- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 71 ++++++++++----------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 6b97cb8..35c7fe6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -50,11 +50,11 @@ struct take_until : public operator_base void on_subscribe(const Subscriber& s) { typedef Subscriber output_type; - struct state_type - : public std::enable_shared_from_this + struct take_until_state_type + : public std::enable_shared_from_this , public values { - state_type(const values& i, const output_type& oarg) + take_until_state_type(const values& i, const output_type& oarg) : values(i) , mode_value(mode::taking) , busy(0) @@ -63,32 +63,33 @@ struct take_until : public operator_base } mutable std::atomic mode_value; mutable std::atomic busy; - mutable std::mutex error_lock; + mutable std::mutex finish_lock; mutable std::exception_ptr exception; output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, s)); + auto state = std::shared_ptr(new take_until_state_type(initial, s)); struct activity { - const std::shared_ptr& st; + const std::shared_ptr& st; ~activity() { if (--st->busy == 0 && st->mode_value > mode::clear) { // need to finish - if (st->mode_value < mode::stopped && ++st->busy == 1) { - // this is the finish owner - auto fin = st->mode_value.exchange(mode::stopped); - if (fin == mode::triggered) { - st->out.on_completed(); - } else if (fin == mode::errored) { - std::unique_lock guard(st->error_lock); - st->out.on_error(st->exception); - } + // this is the finish owner + std::unique_lock guard(st->finish_lock); + typename mode::type fin = st->mode_value; + auto ex = st->exception; + st->mode_value.exchange(mode::stopped); + guard.unlock(); + if (fin == mode::triggered) { + st->out.on_completed(); + } else if (fin == mode::errored) { + st->out.on_error(ex); } } } - explicit activity(const std::shared_ptr& st) + explicit activity(const std::shared_ptr& st) : st(st) { ++st->busy; @@ -107,26 +108,24 @@ struct take_until : public operator_base // on_next [state](const typename trigger_source_type::value_type&) { activity finisher(state); - typename mode::type v = state->mode_value; - if (v != mode::taking) {return;} - state->mode_value.compare_exchange_strong(v, mode::triggered); + std::unique_lock guard(state->finish_lock); + if (state->mode_value != mode::taking) {return;} + state->mode_value.exchange(mode::triggered); }, // on_error [state](std::exception_ptr e) { activity finisher(state); - std::unique_lock guard(state->error_lock); - typename mode::type v = state->mode_value; - if (v != mode::taking) {return;} - if (state->mode_value.compare_exchange_strong(v, mode::errored)) { - state->exception = e; - } + std::unique_lock guard(state->finish_lock); + if (state->mode_value != mode::taking) {return;} + state->mode_value.exchange(mode::errored); + state->exception = e; }, // on_completed [state]() { activity finisher(state); - typename mode::type v = state->mode_value; - if (v != mode::taking) {return;} - state->mode_value.compare_exchange_strong(v, mode::clear); + std::unique_lock guard(state->finish_lock); + if (state->mode_value != mode::taking) {return;} + state->mode_value.exchange(mode::clear); } ); @@ -146,19 +145,17 @@ struct take_until : public operator_base // on_error [state](std::exception_ptr e) { activity finisher(state); - std::unique_lock guard(state->error_lock); - typename mode::type v = state->mode_value; - if (v < mode::triggered) {return;} - if (state->mode_value.compare_exchange_strong(v, mode::errored)) { - state->exception = e; - } + std::unique_lock guard(state->finish_lock); + if (state->mode_value > mode::clear) {return;} + state->mode_value.exchange(mode::errored); + state->exception = e; }, // on_completed [state]() { activity finisher(state); - typename mode::type v = state->mode_value; - if (v < mode::triggered) {return;} - state->mode_value.compare_exchange_strong(v, mode::triggered); + std::unique_lock guard(state->finish_lock); + if (state->mode_value > mode::clear) {return;} + state->mode_value.exchange(mode::triggered); } ); } -- GitLab From 6d6f9660f923e7d5ce0afe41466cec85c174c0a2 Mon Sep 17 00:00:00 2001 From: Tobias Furuholm Date: Thu, 1 May 2014 21:55:55 +0200 Subject: [PATCH 261/782] action_queue and virtual_time scheduling order fix --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 58 +++++++++++++++++++ .../src/rxcpp/schedulers/rx-currentthread.hpp | 13 +---- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 14 +---- Rx/v2/test/operators/flat_map.cpp | 10 ++-- 4 files changed, 66 insertions(+), 29 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index b323449..93c6ed9 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -600,6 +600,8 @@ namespace detail { template struct time_schedulable { + typedef TimePoint time_point_type; + time_schedulable(TimePoint when, schedulable a) : when(when) , what(std::move(a)) @@ -609,6 +611,62 @@ struct time_schedulable 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 schedulable_queue { +public: + typedef time_schedulable item_type; + typedef std::pair elem_type; + typedef std::vector 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 queue; + + std::int64_t ordinal; +public: + const_reference top() const { + return queue.top().first; + } + + void pop() { + queue.pop(); + } + + bool empty() const { + return queue.empty(); + } + + void push(const item_type& value) { + queue.push(elem_type(value, ordinal++)); + } + + void push(item_type&& value) { + queue.push(elem_type(std::move(value), ordinal++)); + } +}; + } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 4eddf52..e819418 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -21,18 +21,7 @@ struct action_queue typedef time_schedulable item_type; private: - struct compare_item_time - { - bool operator()(const item_type& lhs, const item_type& rhs) const { - return lhs.when > rhs.when; - } - }; - - typedef std::priority_queue< - item_type, - std::vector, - compare_item_time - > queue_item_time; + typedef schedulable_queue queue_item_time; public: struct current_thread_queue_type { diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index c162a02..b8fe30f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -188,18 +188,8 @@ private: typedef typename base::item_type item_type; - struct compare_item_time - { - bool operator()(const item_type& lhs, const item_type& rhs) const { - return lhs.when > rhs.when; - } - }; - - typedef std::priority_queue< - item_type, - std::vector, - compare_item_time - > queue_item_time; + typedef detail::schedulable_queue< + typename item_type::time_point_type> queue_item_time; mutable queue_item_time queue; diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index faf194e..7e6401e 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -154,8 +154,8 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ son_next(600, "bar"), son_next(650, "baz"), son_next(650, "foo"), - son_next(700, "bar"), son_next(700, "qux"), + son_next(700, "bar"), son_next(750, "baz"), son_next(800, "qux"), son_completed(850) @@ -242,20 +242,20 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ son_next(400, "bar"), son_next(450, "baz"), son_next(450, "foo"), - son_next(500, "bar"), son_next(500, "qux"), + son_next(500, "bar"), son_next(550, "baz"), son_next(550, "foo"), - son_next(600, "bar"), son_next(600, "qux"), + son_next(600, "bar"), son_next(650, "baz"), son_next(650, "foo"), - son_next(700, "bar"), son_next(700, "qux"), + son_next(700, "bar"), son_next(750, "baz"), son_next(750, "foo"), - son_next(800, "bar"), son_next(800, "qux"), + son_next(800, "bar"), son_next(850, "baz"), son_next(900, "qux"), son_next(950, "foo") -- GitLab From 367987178430d53f55fe1cc318f54b486f7e584e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 23 Apr 2014 22:36:22 -0700 Subject: [PATCH 262/782] add is_subscribed checks and simplify elapsed calculation --- Rx/v2/src/rxcpp/operators/rx-map.hpp | 2 +- Rx/v2/test/subjects/subject.cpp | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 91d6673..82825ee 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -50,7 +50,7 @@ struct map } template - void on_subscribe(Subscriber o) { + void on_subscribe(const Subscriber& o) { typedef Subscriber output_type; struct state_type diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index f765f03..d98bd6b 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -34,8 +34,7 @@ SCENARIO("for loop locks mutex", "[hide][for][mutex][perf]"){ ++c; } auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "loop mutex : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } @@ -64,8 +63,7 @@ SCENARIO("for loop calls observer", "[hide][for][observer][perf]"){ } o.on_completed(); auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "loop -> observer : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -86,13 +84,12 @@ SCENARIO("for loop calls subscriber", "[hide][for][subscriber][perf]"){ auto o = rx::make_subscriber( [&c](int){++c;}, [](std::exception_ptr){abort();}); - for (int i = 0; i < onnextcalls; i++) { + 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(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "loop -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -118,8 +115,7 @@ SCENARIO("range calls subscriber", "[hide][range][subscriber][perf]"){ [](std::exception_ptr){abort();}); auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "range -> subscriber : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -175,7 +171,7 @@ SCENARIO("for loop calls subject", "[hide][for][subject][subjects][perf]"){ } auto start = clock::now(); - for (int i = 0; i < onnextcalls; i++) { + for (int i = 0; i < onnextcalls && o.is_subscribed(); i++) { #if RXCPP_DEBUG_SUBJECT_RACE if (*p != *c) abort(); (*p) += n; @@ -184,8 +180,7 @@ SCENARIO("for loop calls subject", "[hide][for][subject][subjects][perf]"){ } o.on_completed(); auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "loop -> subject : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -249,8 +244,7 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ #endif .subscribe(o); auto finish = clock::now(); - auto msElapsed = duration_cast(finish.time_since_epoch()) - - duration_cast(start.time_since_epoch()); + auto msElapsed = duration_cast(finish-start); std::cout << "range -> subject : " << n << " subscribed, " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; } } -- GitLab From 15807b31b06a4558b55356a3d69c0287f6177f7d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 28 Apr 2014 07:08:36 -0700 Subject: [PATCH 263/782] initial shift to scheduler + worker --- Rx/v2/src/rxcpp/rx-observable.hpp | 8 +- Rx/v2/src/rxcpp/rx-predef.hpp | 13 + Rx/v2/src/rxcpp/rx-regulator.hpp | 2 +- Rx/v2/src/rxcpp/rx-scheduler.hpp | 434 +++++++++++++----- Rx/v2/src/rxcpp/rx-subscription.hpp | 2 +- .../src/rxcpp/schedulers/rx-currentthread.hpp | 147 +++--- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 34 +- Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 48 +- Rx/v2/src/rxcpp/sources/rx-range.hpp | 6 +- Rx/v2/test/operators/publish.cpp | 1 - Rx/v2/test/operators/take.cpp | 1 - 11 files changed, 482 insertions(+), 214 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2573353..c6ce428 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -169,9 +169,11 @@ private: // make sure to let current_thread take ownership of the thread as early as possible. if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); - sc.schedule(o.get_subscription(), [=](const rxsc::schedulable& scbl) { - safe_subscribe(); - }); + sc.create_worker(o.get_subscription()).schedule( + o.get_subscription(), + [=](const rxsc::schedulable& scbl) { + safe_subscribe(); + }); } else { // current_thread already owns this thread. safe_subscribe(); diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 41cb223..25a75c8 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -22,6 +22,19 @@ public: static const bool value = std::is_convertible::type>(0)), tag_action*>::value; }; +struct tag_worker {}; +template +class is_worker +{ + struct not_void {}; + template + static typename C::worker_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_worker*>::value; +}; + struct tag_scheduler {}; template class is_scheduler diff --git a/Rx/v2/src/rxcpp/rx-regulator.hpp b/Rx/v2/src/rxcpp/rx-regulator.hpp index e8bcdca..8a7b998 100644 --- a/Rx/v2/src/rxcpp/rx-regulator.hpp +++ b/Rx/v2/src/rxcpp/rx-regulator.hpp @@ -88,7 +88,7 @@ public: state->isresumed = true; auto resumewith = std::move(state->resumewith); auto local = state->resumewith; - state->resumewith = rxsc::schedulable::empty(local.get_scheduler()); + state->resumewith = rxsc::schedulable::empty(local.get_worker()); local.schedule(); } inline resumption get_resumption() { diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 93c6ed9..a57851c 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -11,6 +11,7 @@ namespace rxcpp { namespace schedulers { +class worker_interface; class scheduler_interface; namespace detail { @@ -18,6 +19,9 @@ namespace detail { class action_type; typedef std::shared_ptr action_ptr; +typedef std::shared_ptr worker_interface_ptr; +typedef std::shared_ptr const_worker_interface_ptr; + typedef std::shared_ptr scheduler_interface_ptr; typedef std::shared_ptr const_scheduler_interface_ptr; @@ -29,6 +33,8 @@ typedef std::shared_ptr const_scheduler_interface_ptr // 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; @@ -37,11 +43,14 @@ public: : 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; @@ -54,20 +63,25 @@ public: , 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; @@ -83,9 +97,11 @@ public: , 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; } @@ -99,20 +115,12 @@ struct action_base class schedulable; -namespace action_duration { - enum type { - invalid, - runs_short, - runs_long - }; -} - +/// 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; static detail::action_ptr shared_empty; - friend bool operator==(const action&, const action&); public: action() { @@ -122,12 +130,12 @@ public: { } + /// return the empty action inline static action empty() { return action(shared_empty); } - inline action_duration::type get_duration() const; - + /// call the function inline void operator()(const schedulable& s, const recurse& r) const; }; @@ -137,38 +145,27 @@ struct scheduler_base typedef tag_scheduler scheduler_tag; }; -class schedulable; +struct worker_base : public subscription_base +{ + typedef tag_worker worker_tag; +}; -class scheduler_interface - : public std::enable_shared_from_this +class worker_interface + : public std::enable_shared_from_this { - typedef scheduler_interface this_type; + typedef worker_interface this_type; public: typedef scheduler_base::clock_type clock_type; - virtual ~scheduler_interface() {} + virtual ~worker_interface() {} virtual clock_type::time_point now() const = 0; virtual void schedule(const schedulable& scbl) const = 0; - virtual void schedule(clock_type::duration when, const schedulable& scbl) const = 0; virtual void schedule(clock_type::time_point when, const schedulable& scbl) const = 0; }; - -struct schedulable_base : public subscription_base, public scheduler_base, public action_base -{ - typedef tag_schedulable schedulable_tag; -}; - -inline bool operator==(const action& lhs, const action& rhs) { - return lhs.inner == rhs.inner; -} -inline bool operator!=(const action& lhs, const action& rhs) { - return !(lhs == rhs); -} - namespace detail { template @@ -185,62 +182,195 @@ struct is_action_function } -class scheduler : public scheduler_base +/// 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 scheduler this_type; - detail::scheduler_interface_ptr inner; - friend bool operator==(const scheduler&, const scheduler&); + typedef worker this_type; + detail::worker_interface_ptr inner; + composite_subscription lifetime; + friend bool operator==(const worker&, const worker&); public: typedef scheduler_base::clock_type clock_type; + typedef composite_subscription::shared_subscription shared_subscription; + typedef composite_subscription::weak_subscription weak_subscription; - scheduler() + worker() { } - explicit scheduler(detail::scheduler_interface_ptr i) - : inner(std::move(i)) + worker(composite_subscription cs, detail::const_worker_interface_ptr i) + : inner(std::const_pointer_cast(i)) + , lifetime(std::move(cs)) { } - explicit scheduler(detail::const_scheduler_interface_ptr i) - : inner(std::const_pointer_cast(i)) - { + + 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(shared_subscription s) const { + return lifetime.add(std::move(s)); + } + inline weak_subscription add(dynamic_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 { - inner->schedule(scbl); + // 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 { - inner->schedule(when, scbl); + // force rebinding scbl to this worker + schedule_rebind(now() + when, scbl); } - inline void schedule(clock_type::time_point when, const schedulable& scbl) const { - inner->schedule(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 auto schedule(Arg0&& a0, ArgN&&... an) const -> typename std::enable_if< (detail::is_action_function::value || is_subscription::value) && !is_schedulable::value>::type; + template + /// 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 - auto schedule(Arg0&& a0, ArgN&&... an) const + auto schedule(clock_type::time_point when, Arg0&& a0, ArgN&&... an) const -> typename std::enable_if< - !detail::is_action_function::value && - !is_subscription::value && - !is_scheduler::value && + (detail::is_action_function::value || + is_subscription::value) && !is_schedulable::value>::type; + /// use the supplied arguments to make a schedulable and then insert it to be run + template + 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 + 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::value || + is_subscription::value) && + !is_schedulable::value>::type; + /// use the supplied arguments to make a schedulable and then insert it to be run + template + void schedule_periodically_rebind(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl, ArgN&&... an) const; }; -inline bool operator==(const scheduler& lhs, const scheduler& rhs) { - return lhs.inner == rhs.inner; +inline bool operator==(const worker& lhs, const worker& rhs) { + return lhs.inner == rhs.inner && lhs.lifetime == rhs.lifetime; } -inline bool operator!=(const scheduler& lhs, const scheduler& rhs) { +inline bool operator!=(const worker& lhs, const worker& rhs) { return !(lhs == rhs); } +class scheduler_interface + : public std::enable_shared_from_this +{ + 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, public worker_base, public action_base +{ + typedef tag_schedulable schedulable_tag; +}; + +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(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 inline scheduler make_scheduler() { return scheduler(std::static_pointer_cast(std::make_shared())); @@ -252,8 +382,10 @@ class schedulable : public schedulable_base typedef schedulable this_type; composite_subscription lifetime; - scheduler controller; + worker controller; action activity; + bool scoped; + composite_subscription::weak_subscription action_scope; struct detacher { @@ -320,13 +452,67 @@ public: typedef composite_subscription::shared_subscription shared_subscription; typedef scheduler_base::clock_type clock_type; + ~schedulable() + { + if (scoped) { + controller.remove(action_scope); + } + } schedulable() + : scoped(false) + { + } + schedulable(const schedulable& o) + : lifetime(o.lifetime) + , controller(o.controller) + , activity(o.activity) + , scoped(o.scoped) + , action_scope(o.scoped ? controller.add(lifetime) : weak_subscription()) { } - schedulable(composite_subscription cs, scheduler q, action a) - : lifetime(std::move(cs)) - , controller(std::move(q)) + schedulable(schedulable&& o) + : lifetime(std::move(o.lifetime)) + , controller(std::move(o.controller)) + , activity(std::move(o.activity)) + , scoped(o.scoped) + , action_scope(std::move(o.action_scope)) + { + o.scoped = false; + } + schedulable& operator =(schedulable o) { + using std::swap; + swap(lifetime, o.lifetime); + swap(controller, o.controller); + swap(activity, o.activity); + swap(scoped, o.scoped); + swap(action_scope, o.action_scope); + return *this; + } + + /// 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(cs) + , controller(q) + , activity(std::move(a)) + , scoped(true) + , action_scope(q.add(cs)) + { + } + /// 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 ? q.add(scbl.get_subscription()) : weak_subscription()) { } @@ -336,10 +522,10 @@ public: inline composite_subscription& get_subscription() { return lifetime; } - inline const scheduler& get_scheduler() const { + inline const worker& get_worker() const { return controller; } - inline scheduler& get_scheduler() { + inline worker& get_worker() { return controller; } inline const action& get_action() const { @@ -349,7 +535,7 @@ public: return activity; } - inline static schedulable empty(scheduler sc) { + inline static schedulable empty(worker sc) { return schedulable(composite_subscription::empty(), sc, action::empty()); } @@ -403,25 +589,26 @@ public: } /// put this on the queue of the stored scheduler to run asap inline void schedule() const { - controller.schedule(*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 { - controller.schedule(when, *this); + if (is_subscribed()) { + controller.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 { - controller.schedule(when, *this); + if (is_subscribed()) { + controller.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()) { + controller.schedule(when, *this); + } } // action // - /// some schedulers care about how long an action will run - /// this is how an action declares its behavior - inline action_duration::type get_duration() const { - return activity.get_duration(); - } - /// + /// invokes the action inline void operator()(const recurse& r) const { if (!is_subscribed()) { abort(); @@ -432,15 +619,6 @@ public: } }; -inline bool operator==(const schedulable& lhs, const schedulable& rhs) { - return lhs.get_action() == rhs.get_action() && - lhs.get_scheduler() == rhs.get_scheduler() && - lhs.get_subscription() == rhs.get_subscription(); -} -inline bool operator!=(const schedulable& lhs, const schedulable& rhs) { - return !(lhs == rhs); -} - struct current_thread; namespace detail { @@ -454,7 +632,6 @@ public: typedef std::function function_type; private: - action_duration::type d; function_type f; public: @@ -462,16 +639,11 @@ public: { } - action_type(action_duration::type d, function_type f) - : d(d) - , f(std::move(f)) + action_type(function_type f) + : f(std::move(f)) { } - inline action_duration::type get_duration() const { - return d; - } - inline void operator()(const schedulable& s, const recurse& r) { if (!f) { abort(); @@ -482,11 +654,6 @@ public: } - -inline action_duration::type action::get_duration() const { - return inner->get_duration(); -} - inline void action::operator()(const schedulable& s, const recurse& r) const { (*inner)(s, r); } @@ -500,11 +667,10 @@ inline action make_action_empty() { } template -inline action make_action(F&& f, action_duration::type d = action_duration::runs_short) { +inline action make_action(F&& f) { static_assert(detail::is_action_function::value, "action function must be void(schedulable)"); auto fn = std::forward(f); return action(std::make_shared( - d, // tail-recurse inside of the virtual function call // until a new action, lifetime or scheduler is returned [fn](const schedulable& s, const recurse& r) { @@ -535,64 +701,96 @@ inline auto make_schedulable( return schedulable(std::move(scbl)); } -// action -// - template -auto make_schedulable(scheduler sc, F&& f, action_duration::type d = action_duration::runs_short) +auto make_schedulable(worker sc, F&& f) -> typename std::enable_if::value, schedulable>::type { - return schedulable(composite_subscription(), sc, make_action(std::forward(f), d)); + return schedulable(sc, make_action(std::forward(f))); } template -auto make_schedulable(scheduler sc, composite_subscription cs, F&& f, action_duration::type d = action_duration::runs_short) +auto make_schedulable(worker sc, composite_subscription cs, F&& f) -> typename std::enable_if::value, schedulable>::type { - return schedulable(cs, sc, make_action(std::forward(f), d)); + return schedulable(cs, sc, make_action(std::forward(f))); } template -auto make_schedulable(schedulable scbl, composite_subscription cs, F&& f, action_duration::type d = action_duration::runs_short) +auto make_schedulable(schedulable scbl, composite_subscription cs, F&& f) -> typename std::enable_if::value, schedulable>::type { - return schedulable(cs, scbl.get_scheduler(), make_action(std::forward(f), d)); + return schedulable(cs, scbl.get_worker(), make_action(std::forward(f))); } template -auto make_schedulable(schedulable scbl, scheduler sc, F&& f, action_duration::type d = action_duration::runs_short) +auto make_schedulable(schedulable scbl, worker sc, F&& f) -> typename std::enable_if::value, schedulable>::type { - return schedulable(scbl.get_subscription(), sc, make_action(std::forward(f), d)); + return schedulable(scbl, sc, make_action(std::forward(f))); } template -auto make_schedulable(schedulable scbl, F&& f, action_duration::type d = action_duration::runs_short) +auto make_schedulable(schedulable scbl, F&& f) -> typename std::enable_if::value, schedulable>::type { - return schedulable(scbl.get_subscription(), scbl.get_scheduler(), make_action(std::forward(f), d)); + return schedulable(scbl, scbl.get_worker(), make_action(std::forward(f))); } inline auto make_schedulable(schedulable scbl, composite_subscription cs) -> schedulable { - return schedulable(cs, scbl.get_scheduler(), scbl.get_action()); + return schedulable(cs, scbl.get_worker(), scbl.get_action()); } -inline auto make_schedulable(schedulable scbl, scheduler sc, composite_subscription cs) +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, scheduler sc) +inline auto make_schedulable(schedulable scbl, worker sc) -> schedulable { - return schedulable(composite_subscription(), sc, scbl.get_action()); + return schedulable(scbl, sc, scbl.get_action()); } template -auto scheduler::schedule(Arg0&& a0, ArgN&&... an) const +auto worker::schedule(Arg0&& a0, ArgN&&... an) const -> typename std::enable_if< (detail::is_action_function::value || is_subscription::value) && !is_schedulable::value>::type { - return this->schedule(make_schedulable(*this, std::forward(a0), std::forward(an)...)); + inner->schedule(make_schedulable(*this, std::forward(a0), std::forward(an)...)); +} +template +void worker::schedule_rebind(const schedulable& scbl, ArgN&&... an) const { + inner->schedule(make_schedulable(scbl, *this, std::forward(an)...)); } + template -auto scheduler::schedule(Arg0&& a0, ArgN&&... an) const +auto worker::schedule(clock_type::time_point when, Arg0&& a0, ArgN&&... an) const -> typename std::enable_if< - !detail::is_action_function::value && - !is_subscription::value && - !is_scheduler::value && + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + inner->schedule(when, make_schedulable(*this, std::forward(a0), std::forward(an)...)); +} +template +void worker::schedule_rebind(clock_type::time_point when, const schedulable& scbl, ArgN&&... an) const { + inner->schedule(when, make_schedulable(scbl, *this, std::forward(an)...)); +} + +template +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::value || + is_subscription::value) && !is_schedulable::value>::type { - return this->schedule(std::forward(a0), make_schedulable(*this, std::forward(an)...)); + schedule_periodically_rebind(initial, period, make_schedulable(*this, std::forward(a0), std::forward(an)...)); +} +template +void worker::schedule_periodically_rebind(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl, ArgN&&... an) const { + std::shared_ptr target(new clock_type::time_point(initial)); + auto activity = make_schedulable(scbl, *this, std::forward(an)...); + auto periodic = make_schedulable( + activity, + [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); + }); + inner->schedule(*target, periodic); } namespace detail { diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 8d11f4d..40700e8 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -183,7 +183,7 @@ private: inline void remove(weak_subscription w) { std::unique_lock guard(lock); - if (issubscribed) { + if (issubscribed && !w.expired()) { auto s = w.lock(); if (s) { diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index e819418..1f915f6 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -25,7 +25,7 @@ private: public: struct current_thread_queue_type { - scheduler sc; + std::shared_ptr w; recursion r; queue_item_time queue; }; @@ -38,8 +38,8 @@ private: public: - static scheduler get_scheduler() { - return !!current_thread_queue() ? current_thread_queue()->sc : scheduler(); + static std::shared_ptr get_worker_interface() { + return !!current_thread_queue() ? current_thread_queue()->w : std::shared_ptr(); } static recursion& get_recursion() { return current_thread_queue()->r; @@ -79,18 +79,18 @@ public: // disallow recursion state->r.reset(false); } - static scheduler ensure(scheduler sc) { + static std::shared_ptr ensure(std::shared_ptr w) { if (!!current_thread_queue()) { abort(); } // create and publish new queue current_thread_queue() = new current_thread_queue_type(); - current_thread_queue()->sc = sc; - return sc; + current_thread_queue()->w = w; + return w; } - static std::unique_ptr create(scheduler sc) { + static std::unique_ptr create(std::shared_ptr w) { std::unique_ptr result(new current_thread_queue_type()); - result->sc = std::move(sc); + result->w = std::move(w); return result; } static void set(current_thread_queue_type* queue) { @@ -123,7 +123,7 @@ private: typedef detail::action_queue queue; - struct derecurser : public scheduler_interface + struct derecurser : public worker_interface { private: typedef current_thread this_type; @@ -144,12 +144,77 @@ private: queue::push(queue::item_type(now(), scbl)); } - virtual void schedule(clock_type::duration when, const schedulable& scbl) const { - queue::push(queue::item_type(now() + when, scbl)); + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { + queue::push(queue::item_type(when, scbl)); + } + }; + + struct current_worker : public worker_interface + { + private: + typedef current_thread this_type; + composite_subscription lifetime; + current_worker(const this_type&); + public: + explicit current_worker(composite_subscription cs) + : lifetime(std::move(cs)) + { + } + 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; + } + + { + auto wi = queue::get_worker_interface(); + // check ownership + if (!!wi) { + // already has an owner - delegate + return worker(lifetime, wi).schedule(when, scbl); + } + + // take ownership + queue::ensure(std::make_shared()); + } + // release ownership + RXCPP_UNWIND_AUTO([]{ + queue::destroy(); + }); + queue::push(queue::item_type(when, scbl)); + + const auto& recursor = queue::get_recursion().get_recurse(); + + // loop until queue is empty + for ( + auto when = queue::top().when; + (std::this_thread::sleep_until(when), true); + when = queue::top().when + ) { + auto what = queue::top().what; + + queue::pop(); + + if (what.is_subscribed()) { + what(recursor); + } + + if (queue::empty()) { + break; + } + } } }; @@ -161,67 +226,19 @@ public: { } - static bool is_schedule_required() { return queue::get_scheduler() == scheduler(); } - - virtual clock_type::time_point now() const { - return clock_type::now(); - } + static bool is_schedule_required() { return !queue::get_worker_interface(); } inline bool is_tail_recursion_allowed() const { return queue::empty(); } - virtual void schedule(const schedulable& scbl) const { - schedule(now(), scbl); - } - - virtual void schedule(clock_type::duration when, const schedulable& scbl) const { - schedule(now() + when, scbl); + virtual clock_type::time_point now() const { + return clock_type::now(); } - virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { - if (!scbl.is_subscribed()) { - return; - } - - auto sc = queue::get_scheduler(); - // check ownership - if (sc != scheduler()) - { - // already has an owner - delegate - return sc.schedule(when, scbl); - } - - // take ownership - - sc = queue::ensure(make_scheduler()); - RXCPP_UNWIND_AUTO([]{ - queue::destroy(); - }); - - queue::push(queue::item_type(when, scbl)); - - const auto& recursor = queue::get_recursion().get_recurse(); - - // loop until queue is empty - for ( - auto when = queue::top().when; - std::this_thread::sleep_until(when), true; - when = queue::top().when - ) - { - auto what = queue::top().what; - - queue::pop(); - - if (what.is_subscribed()) { - what(recursor); - } - - if (queue::empty()) { - break; - } - } + virtual worker create_worker(composite_subscription cs) const { + std::shared_ptr wi(new current_worker(cs)); + return worker(cs, wi); } }; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 443f7e8..d3308d5 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -23,6 +23,11 @@ public: using base::schedule_absolute; using base::schedule_relative; + virtual worker get_worker() const + { + return base::get_worker(); + } + virtual void schedule_absolute(long when, const schedulable& a) const { if (when <= base::clock_now) @@ -143,11 +148,12 @@ public: virtual void on_subscribe(subscriber o) const { sv.push_back(rxn::subscription(sc->clock())); auto index = sv.size() - 1; + auto controller = sc->create_worker(composite_subscription()); for (auto& message : mv) { auto n = message.value(); sc->schedule_relative(message.time(), make_schedulable( - scheduler(std::static_pointer_cast(sc)), + controller, [n, o](const schedulable& scbl) { if (o.is_subscribed()) { n->accept(o); @@ -195,10 +201,11 @@ public: : sc(sc) , mv(mv) { + auto controller = sc->create_worker(composite_subscription()); for (auto& message : mv) { auto n = message.value(); sc->schedule_absolute(message.time(), make_schedulable( - scheduler(std::static_pointer_cast(sc)), + controller, [this, n](const schedulable& scbl) { auto local = this->observers; for (auto& o : local) { @@ -306,17 +313,22 @@ public: tester->schedule_relative(when, a); } - template - typename std::enable_if::type, schedulable>::value, void>::type - schedule_absolute(long when, F f) const { - tester->schedule_absolute(when, make_schedulable(*this, f)); + template + auto schedule_absolute(long when, Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + tester->schedule_absolute(when, make_schedulable(tester->get_worker(), std::forward(a0), std::forward(an)...)); } - - template - typename std::enable_if::type, schedulable>::value, void>::type - schedule_relative(long when, F f) const { - tester->schedule_relative(when, make_schedulable(*this, f)); + template + auto schedule_relative(long when, Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + tester->schedule_relative(when, make_schedulable(tester->get_worker(), std::forward(a0), std::forward(an)...)); } template diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index b8fe30f..34fc8a3 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -22,6 +22,30 @@ private: mutable bool isenabled; + struct virtual_worker : public worker_interface + { + std::shared_ptr controller; + + virtual_worker(std::shared_ptr vb) + : controller(std::move(vb)) + { + } + + virtual clock_type::time_point now() const { + return controller->to_time_point(controller->clock_now); + } + + virtual void schedule(const schedulable& scbl) const { + controller->schedule_absolute(controller->clock_now, scbl); + } + + virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { + controller->schedule_absolute(controller->to_relative(when - now()), scbl); + } + }; + + std::shared_ptr<> + public: typedef Absolute absolute; typedef Relative relative; @@ -161,16 +185,11 @@ public: return to_time_point(clock_now); } - virtual void schedule(const schedulable& scbl) const { - schedule_absolute(clock_now, scbl); - } - - virtual void schedule(clock_type::duration when, const schedulable& scbl) const { - schedule_absolute(to_relative(when), scbl); - } - - virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { - schedule_absolute(to_relative(when - now()), scbl); + virtual worker create_worker(composite_subscription cs) const { + std::shared_ptr wi(new virtual_worker( + std::static_pointer_cast( + std::const_pointer_cast(shared_from_this())))); + return worker(cs, wi); } }; @@ -193,6 +212,8 @@ private: mutable queue_item_time queue; + worker controller; + public: virtual ~virtual_time() { @@ -201,12 +222,16 @@ public: protected: virtual_time() { + controller = base::create_worker(composite_subscription()); } explicit virtual_time(typename base::absolute initialClock) : base(initialClock) { + controller = base::create_worker(composite_subscription()); } + virtual worker get_worker() const {return controller;} + virtual item_type top() const { return queue.top(); } @@ -224,7 +249,8 @@ protected: { // use a separate subscription here so that a's subscription is not affected auto run = make_schedulable( - scheduler(this->shared_from_this()), + get_worker(), + composite_subscription(), [a](const schedulable& scbl) { rxsc::recursion r; r.reset(false); diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 69d5984..4f2ff35 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -22,6 +22,7 @@ struct range : public source_base size_t remaining; ptrdiff_t step; rxsc::scheduler sc; + rxsc::worker w; }; state_type init; range(T b, size_t c, ptrdiff_t s, rxsc::scheduler sc) @@ -34,8 +35,9 @@ struct range : public source_base template void on_subscribe(Subscriber o) { auto state = std::make_shared(init); - state->sc.schedule( - o.get_subscription(), + // creates a worker whose lifetime is the same as this subscription + state->w = state->sc.create_worker(o.get_subscription()); + state->w.schedule( [=](const rxsc::schedulable& self){ if (state->remaining == 0) { o.on_completed(); diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 8d044f0..f043d18 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -54,7 +54,6 @@ SCENARIO("publish", "[publish][multicast][operators]"){ typedef rxn::subscription life; typedef m::recorded_type record; auto on_next = m::on_next; - auto on_error = m::on_error; auto on_completed = m::on_completed; auto subscribe = m::subscribe; diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 7926668..6e8ed00 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -75,7 +75,6 @@ SCENARIO("take, complete after", "[take][operators]"){ typedef rxn::subscription life; typedef m::recorded_type record; auto on_next = m::on_next; - auto on_error = m::on_error; auto on_completed = m::on_completed; auto subscribe = m::subscribe; -- GitLab From 09b16daca270ed0ade1f41f76c0910d6442e95de Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Apr 2014 23:46:04 -0700 Subject: [PATCH 264/782] fix virtual_time and test scheduler --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 26 -- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 332 ++++++++++++------ Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp | 57 +-- Rx/v2/test/operators/filter.cpp | 23 +- Rx/v2/test/operators/flat_map.cpp | 25 +- Rx/v2/test/operators/map.cpp | 3 +- Rx/v2/test/operators/publish.cpp | 23 +- Rx/v2/test/operators/take.cpp | 66 ++-- Rx/v2/test/subjects/subject.cpp | 87 ++--- 9 files changed, 363 insertions(+), 279 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index a57851c..4b01c36 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -462,32 +462,6 @@ public: : scoped(false) { } - schedulable(const schedulable& o) - : lifetime(o.lifetime) - , controller(o.controller) - , activity(o.activity) - , scoped(o.scoped) - , action_scope(o.scoped ? controller.add(lifetime) : weak_subscription()) - { - } - schedulable(schedulable&& o) - : lifetime(std::move(o.lifetime)) - , controller(std::move(o.controller)) - , activity(std::move(o.activity)) - , scoped(o.scoped) - , action_scope(std::move(o.action_scope)) - { - o.scoped = false; - } - schedulable& operator =(schedulable o) { - using std::swap; - swap(lifetime, o.lifetime); - swap(controller, o.controller); - swap(activity, o.activity); - swap(scoped, o.scoped); - swap(action_scope, o.action_scope); - return *this; - } /// action and worker share lifetime schedulable(worker q, action a) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index d3308d5..411bd43 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -13,54 +13,141 @@ namespace schedulers { namespace detail { -class test_type : public virtual_time +class test_type : public scheduler_interface { public: - typedef virtual_time base; - typedef base::clock_type clock_type; - typedef std::shared_ptr shared; - using base::schedule_absolute; - using base::schedule_relative; + typedef scheduler_interface::clock_type clock_type; - virtual worker get_worker() const + struct test_type_state : public virtual_time { - return base::get_worker(); - } + typedef virtual_time 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; - virtual void schedule_absolute(long when, const schedulable& a) const + 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(clock_type::duration(absolute)); + } + + virtual long to_relative(clock_type::duration d) const + { + return static_cast(d.count()); + } + }; + +private: + mutable std::shared_ptr state; + +public: + struct test_type_worker : public worker_interface { - if (when <= base::clock_now) - when = base::clock_now + 1; + mutable std::shared_ptr state; - return base::schedule_absolute(when, a); - } + typedef test_type_state::absolute absolute; + typedef test_type_state::relative relative; + + test_type_worker(std::shared_ptr 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_absolute(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); + } - virtual long add(long absolute, long relative) const + void advance_by(relative time) const + { + state->advance_by(time); + } + + void sleep(relative time) const + { + state->sleep(time); + } + + template + subscriber> make_subscriber() const; + }; + +public: + test_type() + : state(new test_type_state()) { - return absolute + relative; } - virtual clock_type::time_point to_time_point(long absolute) const - { - return clock_type::time_point(clock_type::duration(absolute)); + virtual clock_type::time_point now() const { + return state->now(); } - virtual long to_relative(clock_type::duration d) const - { - return static_cast(d.count()); + virtual worker create_worker(composite_subscription cs) const { + std::shared_ptr wi(new test_type_worker(state)); + return worker(cs, wi); } - using base::start; + std::shared_ptr create_test_type_worker_interface() const { + std::shared_ptr wi(new test_type_worker(state)); + return wi; + } template rxt::testable_observable make_hot_observable(std::vector>>> messages) const; template rxt::testable_observable make_cold_observable(std::vector>>> messages) const; - - template - subscriber> make_subscriber() const; }; template @@ -71,12 +158,12 @@ class mock_observer typedef rxn::recorded recorded_type; public: - mock_observer(typename test_type::shared sc) + explicit mock_observer(std::shared_ptr sc) : sc(sc) { } - typename test_type::shared sc; + std::shared_ptr sc; std::vector m; virtual void on_subscribe(subscriber) const { @@ -92,12 +179,12 @@ public: }; template -subscriber> test_type::make_subscriber() const +subscriber> test_type::test_type_worker::make_subscriber() const { typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - std::shared_ptr> ts(new mock_observer(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())))); + std::shared_ptr> ts(new mock_observer(state)); return rxcpp::make_subscriber(rxt::testable_observer(ts, make_observer_dynamic( // on_next @@ -125,30 +212,32 @@ class cold_observable : public rxt::detail::test_subject_base { typedef cold_observable this_type; - typename test_type::shared sc; + std::shared_ptr sc; typedef rxn::recorded::type> recorded_type; mutable std::vector mv; mutable std::vector sv; + mutable worker controller; public: - cold_observable(typename test_type::shared sc, std::vector mv) + cold_observable(std::shared_ptr sc, worker w, std::vector mv) : sc(sc) , mv(std::move(mv)) + , controller(w) { } template - cold_observable(typename test_type::shared sc, Iterator begin, Iterator end) + cold_observable(std::shared_ptr sc, worker w, Iterator begin, Iterator end) : sc(sc) , mv(begin, end) + , controller(w) { } virtual void on_subscribe(subscriber o) const { sv.push_back(rxn::subscription(sc->clock())); auto index = sv.size() - 1; - auto controller = sc->create_worker(composite_subscription()); for (auto& message : mv) { auto n = message.value(); @@ -179,7 +268,7 @@ public: template rxt::testable_observable test_type::make_cold_observable(std::vector>>> messages) const { - auto co = std::shared_ptr>(new cold_observable(std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); + auto co = std::shared_ptr>(new cold_observable(state, create_worker(composite_subscription()), std::move(messages))); return rxt::testable_observable(co); } @@ -188,20 +277,21 @@ class hot_observable : public rxt::detail::test_subject_base { typedef hot_observable this_type; - typename test_type::shared sc; + std::shared_ptr sc; typedef rxn::recorded::type> recorded_type; typedef subscriber observer_type; mutable std::vector mv; mutable std::vector sv; mutable std::vector observers; + mutable worker controller; public: - hot_observable(typename test_type::shared sc, std::vector mv) + hot_observable(std::shared_ptr sc, worker w, std::vector mv) : sc(sc) , mv(mv) + , controller(w) { - auto controller = sc->create_worker(composite_subscription()); for (auto& message : mv) { auto n = message.value(); sc->schedule_absolute(message.time(), make_schedulable( @@ -240,18 +330,18 @@ public: template rxt::testable_observable test_type::make_hot_observable(std::vector>>> messages) const { - return rxt::testable_observable(std::make_shared>( - std::const_pointer_cast(std::static_pointer_cast(shared_from_this())), std::move(messages))); + return rxt::testable_observable( + std::make_shared>(state, create_worker(composite_subscription()), std::move(messages))); } } class test : public scheduler { - detail::test_type::shared tester; + std::shared_ptr tester; public: - explicit test(detail::test_type::shared t) + explicit test(std::shared_ptr t) : scheduler(std::static_pointer_cast(t)) , tester(t) { @@ -305,85 +395,110 @@ public: ~messages(); }; - void schedule_absolute(long when, const schedulable& a) const { - tester->schedule_absolute(when, a); - } + class test_worker : public worker + { + std::shared_ptr tester; + public: - void schedule_relative(long when, const schedulable& a) const { - tester->schedule_relative(when, a); - } + explicit test_worker(composite_subscription cs, std::shared_ptr t) + : worker(cs, std::static_pointer_cast(t)) + , tester(t) + { + } - template - auto schedule_absolute(long when, Arg0&& a0, ArgN&&... an) const - -> typename std::enable_if< - (detail::is_action_function::value || - is_subscription::value) && - !is_schedulable::value>::type { - tester->schedule_absolute(when, make_schedulable(tester->get_worker(), std::forward(a0), std::forward(an)...)); - } + void schedule_absolute(long when, const schedulable& a) const { + tester->schedule_absolute(when, a); + } - template - auto schedule_relative(long when, Arg0&& a0, ArgN&&... an) const - -> typename std::enable_if< - (detail::is_action_function::value || - is_subscription::value) && - !is_schedulable::value>::type { - tester->schedule_relative(when, make_schedulable(tester->get_worker(), std::forward(a0), std::forward(an)...)); - } + void schedule_relative(long when, const schedulable& a) const { + tester->schedule_relative(when, a); + } - template - auto start(F&& createSource, long created, long subscribed, long unsubscribed) const - -> subscriber> - { - typename std::decay::type createSrc = std::forward(createSource); + template + auto schedule_absolute(long when, Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + tester->schedule_absolute(when, make_schedulable(*this, std::forward(a0), std::forward(an)...)); + } - struct state_type - : public std::enable_shared_from_this - { - typedef decltype(std::forward(createSrc)()) source_type; + template + auto schedule_relative(long when, Arg0&& a0, ArgN&&... an) const + -> typename std::enable_if< + (detail::is_action_function::value || + is_subscription::value) && + !is_schedulable::value>::type { + tester->schedule_relative(when, make_schedulable(*this, std::forward(a0), std::forward(an)...)); + } - std::unique_ptr source; - subscriber> o; + template + auto start(F&& createSource, long created, long subscribed, long unsubscribed) const + -> subscriber> + { + typename std::decay::type createSrc = std::forward(createSource); - explicit state_type(subscriber> o) - : source() - , o(o) + struct state_type + : public std::enable_shared_from_this { - } - }; - std::shared_ptr state(new state_type(this->make_subscriber())); + typedef decltype(std::forward(createSrc)()) source_type; + + std::unique_ptr source; + subscriber> o; + + explicit state_type(subscriber> o) + : source() + , o(o) + { + } + }; + std::shared_ptr state(new state_type(this->make_subscriber())); + + schedule_absolute(created, [createSrc, state](const schedulable& scbl) { + state->source.reset(new typename state_type::source_type(createSrc())); + }); + schedule_absolute(subscribed, [state](const schedulable& scbl) { + state->source->subscribe(state->o); + }); + schedule_absolute(unsubscribed, [state](const schedulable& scbl) { + state->o.unsubscribe(); + }); + + tester->start(); + + return state->o; + } - schedule_absolute(created, [createSrc, state](const schedulable& scbl) { - state->source.reset(new typename state_type::source_type(createSrc())); - }); - schedule_absolute(subscribed, [state](const schedulable& scbl) { - state->source->subscribe(state->o); - }); - schedule_absolute(unsubscribed, [state](const schedulable& scbl) { - state->o.unsubscribe(); - }); + template + auto start(F&& createSource, long unsubscribed) const + -> subscriber> + { + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); + } - tester->start(); + template + auto start(F&& createSource) const + -> subscriber> + { + return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); + } - return state->o; - } + void start() const { + tester->start(); + } - template - auto start(F&& createSource, long unsubscribed) const - -> subscriber> - { - return start(std::forward(createSource), created_time, subscribed_time, unsubscribed); - } + template + subscriber> make_subscriber() const { + return tester->make_subscriber(); + } + }; - template - auto start(F&& createSource) const - -> subscriber> - { - return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); + clock_type::time_point now() const { + return tester->now(); } - void start() const { - tester->start(); + test_worker create_worker(composite_subscription cs = composite_subscription()) const { + return test_worker(cs, tester->create_test_type_worker_interface()); } template @@ -407,11 +522,6 @@ public: -> decltype(tester->make_cold_observable(std::vector())) { return tester->make_cold_observable(rxu::to_vector(arr)); } - - template - subscriber> make_subscriber() const { - return tester->make_subscriber(); - } }; template diff --git a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp index 34fc8a3..bc42e5c 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-virtualtime.hpp @@ -14,7 +14,7 @@ namespace schedulers { namespace detail { template -struct virtual_time_base : public scheduler_interface +struct virtual_time_base : std::enable_shared_from_this> { private: typedef virtual_time_base this_type; @@ -22,30 +22,6 @@ private: mutable bool isenabled; - struct virtual_worker : public worker_interface - { - std::shared_ptr controller; - - virtual_worker(std::shared_ptr vb) - : controller(std::move(vb)) - { - } - - virtual clock_type::time_point now() const { - return controller->to_time_point(controller->clock_now); - } - - virtual void schedule(const schedulable& scbl) const { - controller->schedule_absolute(controller->clock_now, scbl); - } - - virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { - controller->schedule_absolute(controller->to_relative(when - now()), scbl); - } - }; - - std::shared_ptr<> - public: typedef Absolute absolute; typedef Relative relative; @@ -80,6 +56,7 @@ protected: 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 { @@ -129,6 +106,7 @@ public: if (!isenabled) { isenabled = true; + rxsc::recursion r; while (!empty() && isenabled) { auto next = top(); pop(); @@ -136,7 +114,7 @@ public: if (next.when > clock_now) { clock_now = next.when; } - next.what.get_action()(next.what); + next.what(r.get_recurse()); } else { isenabled = false; @@ -181,28 +159,13 @@ public: clock_now = dt; } - virtual clock_type::time_point now() const { - return to_time_point(clock_now); - } - - virtual worker create_worker(composite_subscription cs) const { - std::shared_ptr wi(new virtual_worker( - std::static_pointer_cast( - std::const_pointer_cast(shared_from_this())))); - return worker(cs, wi); - } - }; } template -class virtual_time : public detail::virtual_time_base +struct virtual_time : public detail::virtual_time_base { -private: - typedef virtual_time this_type; - virtual_time(const this_type&); - typedef detail::virtual_time_base base; typedef typename base::item_type item_type; @@ -212,8 +175,6 @@ private: mutable queue_item_time queue; - worker controller; - public: virtual ~virtual_time() { @@ -222,16 +183,12 @@ public: protected: virtual_time() { - controller = base::create_worker(composite_subscription()); } explicit virtual_time(typename base::absolute initialClock) : base(initialClock) { - controller = base::create_worker(composite_subscription()); } - virtual worker get_worker() const {return controller;} - virtual item_type top() const { return queue.top(); } @@ -249,7 +206,7 @@ protected: { // use a separate subscription here so that a's subscription is not affected auto run = make_schedulable( - get_worker(), + a.get_worker(), composite_subscription(), [a](const schedulable& scbl) { rxsc::recursion r; @@ -261,10 +218,10 @@ protected: }); queue.push(item_type(when, run)); } - }; + } } diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index ac101ef..3e9e61d 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -31,6 +31,7 @@ bool IsPrime(int x) SCENARIO("filter stops on completion", "[filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -61,7 +62,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ auto xs = sc.make_hot_observable(messages); WHEN("filtered to ints that are primes"){ - auto res = sc.start( + auto res = w.start( [&xs, &invoked]() { #if 0 && RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -119,6 +120,7 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -146,7 +148,7 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ WHEN("filtered to ints that are primes"){ - auto res = sc.start( + auto res = w.start( [&xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -199,6 +201,7 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -232,7 +235,7 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ WHEN("filtered to ints that are primes"){ - auto res = sc.start( + auto res = w.start( [xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -286,6 +289,7 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -319,7 +323,7 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ WHEN("filtered to ints that are primes"){ - auto res = sc.start( + auto res = w.start( [ex, xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -377,6 +381,7 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -406,13 +411,13 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") }; auto xs = sc.make_hot_observable(rxu::to_vector(messages)); - auto res = sc.make_subscriber(); + auto res = w.make_subscriber(); rx::observable> ys; WHEN("filtered to ints that are primes"){ - sc.schedule_absolute(rxsc::test::created_time, + w.schedule_absolute(rxsc::test::created_time, [&invoked, &res, &ys, &xs](const rxsc::schedulable& scbl) { #if RXCPP_USE_OBSERVABLE_MEMBERS ys = xs @@ -433,15 +438,15 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") #endif }); - sc.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { + w.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { ys.subscribe(res); }); - sc.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl) { + w.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl) { res.unsubscribe(); }); - sc.start(); + w.start(); THEN("the output only contains primes"){ record items[] = { diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 7e6401e..ead0b0e 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 500; +static const int static_tripletCount = 2; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -32,6 +32,7 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ for(int y = x; y <= z; ++y) { ++c; + std::cout << z << "," << y << "," << x << std::endl; if(x*x + y*y == z*z) { //result += (x + y + z); @@ -60,6 +61,7 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ using namespace std::chrono; typedef steady_clock clock; + std::vector> tried; int c = 0; int ct = 0; int n = 1; @@ -67,10 +69,12 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ auto triples = rxs::range(1) .flat_map( - [&c](int z){ return rxs::range(1, z) + [&c, &tried](int z){ return rxs::range(1, z) .flat_map( - [&c, z](int x){ return rxs::range(x, z) - .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + [&c, &tried, z](int x){ return rxs::range(x, z) + .filter([&c, &tried, z, x](int y){++c; + tried.push_back(std::make_tuple(z, y, x)); + return x*x + y*y == z*z;}) .map([z, x](int y){return std::make_tuple(x, y, z);});}, [](int x, std::tuple triplet){return triplet;});}, [](int z, std::tuple triplet){return triplet;}); @@ -81,6 +85,10 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ //int x,y,z; std::tie(x,y,z) = triplet; std::cout << x << "," << y << "," << z << std::endl; }, [](std::exception_ptr){abort();}); + std::sort(tried.begin(), tried.end()); + for (auto& t : tried) { + int x,y,z; std::tie(z,y,x) = t; std::cout << z << "," << y << "," << x << std::endl; + } auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); @@ -93,6 +101,7 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ 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(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; typedef rxn::subscription life; @@ -127,7 +136,7 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ WHEN("each int is mapped to the strings"){ - auto res = sc.start( + auto res = w.start( [&]() { return xs .flat_map( @@ -193,6 +202,7 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; typedef rxn::subscription life; @@ -227,7 +237,7 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ WHEN("each int is mapped to the strings"){ - auto res = sc.start( + auto res = w.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) @@ -294,6 +304,7 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxsc::test::messages ms; typedef rxn::subscription life; @@ -330,7 +341,7 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ WHEN("each int is mapped to the strings"){ - auto res = sc.start( + auto res = w.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp index 354fd24..db53387 100644 --- a/Rx/v2/test/operators/map.cpp +++ b/Rx/v2/test/operators/map.cpp @@ -16,6 +16,7 @@ namespace rxt=rxcpp::test; SCENARIO("map stops on completion", "[map][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -41,7 +42,7 @@ SCENARIO("map stops on completion", "[map][operators]"){ WHEN("mapped to ints that are one larger"){ - auto res = sc.start( + auto res = w.start( [xs, &invoked]() { return xs .map([&invoked](int x) { diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index f043d18..02d799b 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -50,6 +50,7 @@ SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ SCENARIO("publish", "[publish][multicast][operators]"){ GIVEN("a test hot observable of longs"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -77,24 +78,24 @@ SCENARIO("publish", "[publish][multicast][operators]"){ }; auto xs = sc.make_hot_observable(messages); - auto res = sc.make_subscriber(); + auto res = w.make_subscriber(); rx::connectable_observable ys; WHEN("subscribed and then connected"){ - sc.schedule_absolute(rxsc::test::created_time, + w.schedule_absolute(rxsc::test::created_time, [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ ys = xs.publish().as_dynamic(); //ys = xs.publish_last().as_dynamic(); }); - sc.schedule_absolute(rxsc::test::subscribed_time, + w.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl){ ys.subscribe(res); }); - sc.schedule_absolute(rxsc::test::unsubscribed_time, + w.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable& scbl){ res.unsubscribe(); }); @@ -102,11 +103,11 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(300, + w.schedule_absolute(300, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(400, + w.schedule_absolute(400, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); @@ -115,11 +116,11 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(500, + w.schedule_absolute(500, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(550, + w.schedule_absolute(550, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); @@ -128,17 +129,17 @@ SCENARIO("publish", "[publish][multicast][operators]"){ { rx::composite_subscription connection; - sc.schedule_absolute(650, + w.schedule_absolute(650, [connection, &ys](const rxsc::schedulable& scbl){ ys.connect(connection); }); - sc.schedule_absolute(800, + w.schedule_absolute(800, [connection](const rxsc::schedulable& scbl){ connection.unsubscribe(); }); } - sc.start(); + w.start(); THEN("the output only contains items sent while subscribed"){ record items[] = { diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 6e8ed00..e44bd5b 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -15,6 +15,7 @@ namespace rxt=rxcpp::test; SCENARIO("take 2", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -35,7 +36,7 @@ SCENARIO("take 2", "[take][operators]"){ WHEN("2 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(2) @@ -71,6 +72,7 @@ SCENARIO("take 2", "[take][operators]"){ SCENARIO("take, complete after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -104,7 +106,7 @@ SCENARIO("take, complete after", "[take][operators]"){ WHEN("20 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(20) @@ -155,6 +157,7 @@ SCENARIO("take, complete after", "[take][operators]"){ SCENARIO("take, complete same", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -189,7 +192,7 @@ SCENARIO("take, complete same", "[take][operators]"){ WHEN("17 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(17) @@ -240,6 +243,7 @@ SCENARIO("take, complete same", "[take][operators]"){ SCENARIO("take, complete before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -274,7 +278,7 @@ SCENARIO("take, complete before", "[take][operators]"){ WHEN("10 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(10) @@ -318,6 +322,7 @@ SCENARIO("take, complete before", "[take][operators]"){ SCENARIO("take, error after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -354,7 +359,7 @@ SCENARIO("take, error after", "[take][operators]"){ WHEN("20 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(20) @@ -405,6 +410,7 @@ SCENARIO("take, error after", "[take][operators]"){ SCENARIO("take, error same", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -439,7 +445,7 @@ SCENARIO("take, error same", "[take][operators]"){ WHEN("17 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(17) @@ -490,6 +496,7 @@ SCENARIO("take, error same", "[take][operators]"){ SCENARIO("take, error before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -524,7 +531,7 @@ SCENARIO("take, error before", "[take][operators]"){ WHEN("3 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -561,6 +568,7 @@ SCENARIO("take, error before", "[take][operators]"){ SCENARIO("take, dispose before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -594,7 +602,7 @@ SCENARIO("take, dispose before", "[take][operators]"){ WHEN("3 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -630,6 +638,7 @@ SCENARIO("take, dispose before", "[take][operators]"){ SCENARIO("take, dispose after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -663,7 +672,7 @@ SCENARIO("take, dispose after", "[take][operators]"){ WHEN("3 values are taken"){ - auto res = sc.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -703,6 +712,7 @@ SCENARIO("take, dispose after", "[take][operators]"){ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -730,7 +740,7 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [xs, ys]() { return xs .take_until(ys) @@ -775,6 +785,7 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -802,7 +813,7 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -847,6 +858,7 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -875,7 +887,7 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -920,6 +932,7 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -946,7 +959,7 @@ SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -993,6 +1006,7 @@ SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1018,7 +1032,7 @@ SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1065,6 +1079,7 @@ SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1087,7 +1102,7 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1130,6 +1145,7 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1153,7 +1169,7 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1196,6 +1212,7 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1217,7 +1234,7 @@ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1257,6 +1274,7 @@ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1277,7 +1295,7 @@ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1317,6 +1335,7 @@ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ SCENARIO("take_until, preempt before first produced", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1341,7 +1360,7 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1384,6 +1403,7 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1410,7 +1430,7 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r, &sourceNotDisposed]() { return l .map([&sourceNotDisposed](int v){sourceNotDisposed = true; return v;}) @@ -1442,6 +1462,7 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1468,7 +1489,7 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r, &signalNotDisposed]() { return l .take_until(r @@ -1501,6 +1522,7 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" SCENARIO("take_until, error some", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -1525,7 +1547,7 @@ SCENARIO("take_until, error some", "[take_until][take][operators]"){ WHEN("one is taken until the other emits a marble"){ - auto res = sc.start( + auto res = w.start( [l, r]() { return l .take_until(r) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index d98bd6b..ca75e59 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -256,6 +256,7 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -279,40 +280,40 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc.make_subscriber(); + auto results1 = w.make_subscriber(); - auto results2 = sc.make_subscriber(); + auto results2 = w.make_subscriber(); - auto results3 = sc.make_subscriber(); + auto results3 = w.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc.start(); + w.start(); THEN("result1 contains expected messages"){ record items[] = { @@ -353,6 +354,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ GIVEN("a subject and an finite source"){ auto sc = rxsc::make_test(); + auto w = sc.create_worker(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -377,40 +379,40 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc.make_subscriber(); + auto results1 = w.make_subscriber(); - auto results2 = sc.make_subscriber(); + auto results2 = w.make_subscriber(); - auto results3 = sc.make_subscriber(); + auto results3 = w.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc.start(); + w.start(); THEN("result1 contains expected messages"){ record items[] = { @@ -452,6 +454,7 @@ 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(); typedef rxsc::test::messages m; typedef rxn::subscription life; typedef m::recorded_type record; @@ -478,40 +481,40 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ rxsub::subject s; - auto results1 = sc.make_subscriber(); + auto results1 = w.make_subscriber(); - auto results2 = sc.make_subscriber(); + auto results2 = w.make_subscriber(); - auto results3 = sc.make_subscriber(); + auto results3 = w.make_subscriber(); WHEN("multicasting an infinite source"){ auto o = s.get_subscriber(); - sc.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ s = rxsub::subject(); o = s.get_subscriber();}); - sc.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ xs.subscribe(o);}); - sc.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ o.unsubscribe();}); - sc.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results1);}); - sc.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results2);}); - sc.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ s.get_observable().subscribe(results3);}); - sc.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ results2.unsubscribe();}); - sc.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ results1.unsubscribe();}); - sc.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ results3.unsubscribe();}); - sc.start(); + w.start(); THEN("result1 contains expected messages"){ record items[] = { -- GitLab From 4246c348b0f0e883eaef7d97a1e8ffa8bd24f5ed Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Apr 2014 01:11:08 -0700 Subject: [PATCH 265/782] adding immediate scheduler --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 1 + Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 83 +++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 4b01c36..a59532d 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -847,6 +847,7 @@ namespace rxsc=schedulers; } #include "schedulers/rx-currentthread.hpp" +#include "schedulers/rx-immediate.hpp" #include "schedulers/rx-virtualtime.hpp" #endif diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp new file mode 100644 index 0000000..c93a6c3 --- /dev/null +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -0,0 +1,83 @@ +// 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 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 wi; + +public: + immediate() + : wi(new 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(cs, wi); + } +}; + +inline scheduler make_immediate() { + return make_scheduler(); +} + +} + +} + +#endif -- GitLab From 90a17668d25a7857dc552a9108bdf4f3425124b4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Apr 2014 01:12:47 -0700 Subject: [PATCH 266/782] fix range to go from first to last --- Rx/v2/src/rxcpp/rx-observable.hpp | 4 ++-- Rx/v2/src/rxcpp/sources/rx-range.hpp | 31 ++++++++++++++++++---------- Rx/v2/test/subjects/subject.cpp | 4 ++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index c6ce428..26fd032 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -322,10 +322,10 @@ class observable ~observable(); public: template - static auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) + static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable> { return observable>( - rxs::detail::range(start, count, step, sc)); + rxs::detail::range(first, last, step, sc)); } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 4f2ff35..9edc451 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -19,16 +19,16 @@ struct range : public source_base struct state_type { T next; - size_t remaining; + T last; ptrdiff_t step; rxsc::scheduler sc; rxsc::worker w; }; state_type init; - range(T b, size_t c, ptrdiff_t s, rxsc::scheduler sc) + range(T f, T l, ptrdiff_t s, rxsc::scheduler sc) { - init.next = b; - init.remaining = c; + init.next = f; + init.last = l; init.step = s; init.sc = sc; } @@ -39,18 +39,21 @@ struct range : public source_base state->w = state->sc.create_worker(o.get_subscription()); state->w.schedule( [=](const rxsc::schedulable& self){ - if (state->remaining == 0) { - o.on_completed(); - // o is unsubscribed - } if (!o.is_subscribed()) { // terminate loop return; } // send next value - --state->remaining; o.on_next(state->next); + if (std::abs(state->last - state->next) < std::abs(state->step)) { + if (state->last != state->next) { + o.on_next(state->last); + } + o.on_completed(); + // o is unsubscribed + return; + } state->next = static_cast(state->step + state->next); // tail recurse this same action to continue loop @@ -62,10 +65,16 @@ struct range : public source_base } template -auto range(T start = 0, size_t count = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) +auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable> { + return observable>( + detail::range(first, last, step, sc)); +} +template +auto range(T first = 0, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable> { return observable>( - detail::range(start, count, step, sc)); + detail::range(first, std::numeric_limits::max(), 1, sc)); } } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index ca75e59..9dc1b7e 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -108,7 +108,7 @@ SCENARIO("range calls subscriber", "[hide][range][subscriber][perf]"){ c = 0; auto start = clock::now(); - rxs::range(0, onnextcalls).subscribe( + rxs::range(1, onnextcalls).subscribe( [&c](int){ ++c; }, @@ -234,7 +234,7 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ } auto start = clock::now(); - rxs::range(0, onnextcalls) + rxs::range(1, onnextcalls) #if RXCPP_DEBUG_SUBJECT_RACE .filter([c, p, n](int){ if (*p != *c) abort(); -- GitLab From 47d93700bc4634325006736d93af8656f1f41b1c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Apr 2014 01:14:37 -0700 Subject: [PATCH 267/782] use immediate scheduler for pythagorian tests --- Rx/v2/test/operators/flat_map.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index ead0b0e..b5b9053 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 2; +static const int static_tripletCount = 500; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -32,11 +32,8 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ for(int y = x; y <= z; ++y) { ++c; - std::cout << z << "," << y << "," << x << std::endl; if(x*x + y*y == z*z) { - //result += (x + y + z); - //std::cout << x << "," << y << "," << z << std::endl; ++ct; if(ct == tripletCount) goto done; @@ -48,7 +45,7 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -61,38 +58,32 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::vector> tried; + auto sc = rxsc::make_immediate(); + //auto sc = rxsc::make_current_thread(); + int c = 0; int ct = 0; int n = 1; auto start = clock::now(); auto triples = - rxs::range(1) + rxs::range(1, sc) .flat_map( - [&c, &tried](int z){ return rxs::range(1, z) + [&c, sc](int z){ return rxs::range(1, z, 1, sc) .flat_map( - [&c, &tried, z](int x){ return rxs::range(x, z) - .filter([&c, &tried, z, x](int y){++c; - tried.push_back(std::make_tuple(z, y, x)); - return x*x + y*y == z*z;}) + [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) + .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) .map([z, x](int y){return std::make_tuple(x, y, z);});}, [](int x, std::tuple triplet){return triplet;});}, [](int z, std::tuple triplet){return triplet;}); triples .take(tripletCount) .subscribe( - [&ct](std::tuple triplet){++ct; - //int x,y,z; std::tie(x,y,z) = triplet; std::cout << x << "," << y << "," << z << std::endl; - }, + [&ct](std::tuple triplet){++ct;}, [](std::exception_ptr){abort();}); - std::sort(tried.begin(), tried.end()); - for (auto& t : tried) { - int x,y,z; std::tie(z,y,x) = t; std::cout << z << "," << y << "," << x << std::endl; - } auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; } } -- GitLab From a4b50ef61711c952f3e230cf6593d8857c67b3a1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Apr 2014 23:11:58 -0700 Subject: [PATCH 268/782] adding perf comparison for async observer options --- Rx/v2/test/subjects/subject.cpp | 154 +++++++++++++++++++++++++++++++- 1 file changed, 153 insertions(+), 1 deletion(-) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 9dc1b7e..21bdf25 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -15,8 +15,11 @@ namespace rxt=rxcpp::test; #include "catch.hpp" +#include + const int static_onnextcalls = 100000000; +int aliased = 0; SCENARIO("for loop locks mutex", "[hide][for][mutex][perf]"){ const int& onnextcalls = static_onnextcalls; @@ -41,7 +44,156 @@ SCENARIO("for loop locks mutex", "[hide][for][mutex][perf]"){ } } -int aliased = 0; +namespace syncwithvoid { +template +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 scbr(onnext); + for (int i = 0; i < onnextcalls && scbr.is_subscribed(); i++) { + scbr.on_next(i); + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + std::cout << "loop void : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + + } + } +} + +namespace asyncwithready { +class ready +{ +public: + typedef std::function onthen_type; + std::function setthen; + bool is_ready() {return !setthen;} + void then(onthen_type ot) { + if (is_ready()) { + abort(); + } + setthen(ot); + } +}; +template +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;} + ready on_next(T v) { + onnext(v); return ready();} +}; +} +SCENARIO("for loop calls ready on_next(int)", "[hide][for][asyncobserver][ready][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;}; + asyncwithready::async_subscriber scbr(onnext); + for (int i = 0; i < onnextcalls && scbr.is_subscribed(); i++) { + auto controller = scbr.on_next(i); + if (!controller.is_ready()) { + controller.then([](){ + // todo continue + }); + } + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + std::cout << "loop ready : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + + } + } +} + +namespace asyncwithfuture { +class unit {}; +template +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 on_next(T v) { + std::promise ready; + ready.set_value(unit()); + onnext(v); return ready.get_future();} +}; +} +SCENARIO("for loop calls std::future on_next(int)", "[hide][for][asyncobserver][future][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 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(finish-start); + std::cout << "loop future : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; + + } + } +} SCENARIO("for loop calls observer", "[hide][for][observer][perf]"){ const int& onnextcalls = static_onnextcalls; -- GitLab From b88f5992ba41cd2701772d09d7a3d2986d0e0fc4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 1 May 2014 13:05:18 -0700 Subject: [PATCH 269/782] add schedule_periodically perf test --- Rx/v2/test/subjects/subject.cpp | 114 +++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 8 deletions(-) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 21bdf25..045d630 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -88,11 +88,16 @@ SCENARIO("for loop calls void on_next(int)", "[hide][for][asyncobserver][baselin } namespace asyncwithready { +// ready is an immutable class. class ready { public: typedef std::function onthen_type; +private: std::function setthen; +public: + ready() {} + ready(std::function st) : setthen(st) {} bool is_ready() {return !setthen;} void then(onthen_type ot) { if (is_ready()) { @@ -107,15 +112,40 @@ 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) { - onnext(v); return ready();} + // 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]"){ @@ -131,14 +161,17 @@ SCENARIO("for loop calls ready on_next(int)", "[hide][for][asyncobserver][ready] auto start = clock::now(); auto onnext = [&c](int){++*c;}; asyncwithready::async_subscriber scbr(onnext); - for (int i = 0; i < onnextcalls && scbr.is_subscribed(); i++) { - auto controller = scbr.on_next(i); - if (!controller.is_ready()) { - controller.then([](){ - // todo continue - }); + 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); + } } - } + }; + chunk(); auto finish = clock::now(); auto msElapsed = duration_cast(finish-start); std::cout << "loop ready : " << n << " subscribed, " << *c << " on_next calls, " << msElapsed.count() << "ms elapsed " << std::endl; @@ -403,7 +436,72 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ } } +SCENARIO("schedule_periodically", "[hide][periodically][scheduler][perf]"){ + const int& onnextcalls = static_onnextcalls; + GIVEN("schedule_periodically"){ + 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 start = w.now() + seconds(2); + auto period = seconds(1); + w.schedule_periodically(start, period, + [=, &c](rxsc::schedulable scbl){ + auto nsDelta = duration_cast(scbl.now() - (start + (period * c))); + ++c; + std::cout << "schedule_periodically : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl; + if (c == 9) {scbl.unsubscribe();} + }); + } + } +} + +SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][perf]"){ + const int& onnextcalls = static_onnextcalls; + 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(scbl.now() - (start + (period * c))); + ++c; + std::cout << "schedule_periodically_duration : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl; + if (c == 9) {scbl.unsubscribe();} + })); + } + } +} SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ -- GitLab From 26034318f56828e155ffb6493c4e672f56a5ec7c Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 1 May 2014 15:56:00 -0700 Subject: [PATCH 270/782] changes for windows --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 31 +++++++++++++++++-------------- Rx/v2/test/operators/flat_map.cpp | 8 ++++++-- Rx/v2/test/subjects/subject.cpp | 2 +- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index a59532d..f1e1058 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -332,7 +332,10 @@ public: }; -struct schedulable_base : public subscription_base, public worker_base, public action_base +struct schedulable_base : + // public subscription_base, <- already in worker base + public worker_base, + public action_base { typedef tag_schedulable schedulable_tag; }; @@ -773,7 +776,7 @@ template struct time_schedulable { typedef TimePoint time_point_type; - + time_schedulable(TimePoint when, schedulable a) : when(when) , what(std::move(a)) @@ -783,7 +786,7 @@ struct time_schedulable 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. @@ -791,10 +794,10 @@ template class schedulable_queue { public: typedef time_schedulable item_type; - typedef std::pair elem_type; + typedef std::pair elem_type; typedef std::vector container_type; typedef const item_type& const_reference; - + private: struct compare_elem { @@ -807,38 +810,38 @@ private: } } }; - + typedef std::priority_queue< elem_type, container_type, compare_elem > queue_type; - + queue_type queue; - - std::int64_t ordinal; + + int64_t ordinal; public: const_reference top() const { return queue.top().first; } - + void pop() { queue.pop(); } - + bool empty() const { return queue.empty(); } - + void push(const item_type& value) { queue.push(elem_type(value, ordinal++)); } - + void push(item_type&& value) { queue.push(elem_type(std::move(value), ordinal++)); } }; - + } } diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index b5b9053..2d5b0f9 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -72,8 +72,12 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ .flat_map( [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) - .map([z, x](int y){return std::make_tuple(x, y, z);});}, - [](int x, std::tuple triplet){return triplet;});}, + .map([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 triplet){return triplet;}) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}); triples .take(tripletCount) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 045d630..3b89e95 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -163,7 +163,7 @@ SCENARIO("for loop calls ready on_next(int)", "[hide][for][asyncobserver][ready] asyncwithready::async_subscriber scbr(onnext); asyncwithready::ready::onthen_type chunk; int i = 0; - chunk = [&chunk, scbr, i]() mutable { + chunk = [&chunk, scbr, i, onnextcalls]() mutable { for (; i < onnextcalls && scbr.is_subscribed(); i++) { auto controller = scbr.on_next(i); if (!controller.is_ready()) { -- GitLab From 116de8cc00d2cb09b5e4a5a95b236dcd168e4504 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 1 May 2014 16:30:58 -0700 Subject: [PATCH 271/782] missing return in test --- Rx/v2/test/subjects/subject.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 3b89e95..3a17a36 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -168,6 +168,7 @@ SCENARIO("for loop calls ready on_next(int)", "[hide][for][asyncobserver][ready] auto controller = scbr.on_next(i); if (!controller.is_ready()) { controller.then(chunk); + return; } } }; -- GitLab From 133de119976d14e223c370f688a6db2f9f52932f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 3 May 2014 23:56:44 -0700 Subject: [PATCH 272/782] add new_thread scheduler --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 7 +- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 140 ++++++++++++++++++++ 3 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index f1e1058..54cbe8a 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -374,9 +374,9 @@ public: } }; -template -inline scheduler make_scheduler() { - return scheduler(std::static_pointer_cast(std::make_shared())); +template +inline scheduler make_scheduler(ArgN&&... an) { + return scheduler(std::static_pointer_cast(std::make_shared(std::forward(an)...))); } @@ -850,6 +850,7 @@ namespace rxsc=schedulers; } #include "schedulers/rx-currentthread.hpp" +#include "schedulers/rx-newthread.hpp" #include "schedulers/rx-immediate.hpp" #include "schedulers/rx-virtualtime.hpp" diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index c93a6c3..8209e68 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -20,7 +20,7 @@ private: struct immediate_worker : public worker_interface { private: - typedef immediate this_type; + typedef immediate_worker this_type; immediate_worker(const this_type&); public: virtual ~immediate_worker() diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp new file mode 100644 index 0000000..ddc4444 --- /dev/null +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -0,0 +1,140 @@ +// 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)> 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; + new_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; + mutable std::mutex lock; + mutable std::condition_variable wake; + mutable queue_item_time queue; + std::thread worker; + recursion r; + + public: + virtual ~new_worker() + { + { + std::unique_lock guard(lock); + lifetime.unsubscribe(); + } + worker.join(); + } + new_worker(composite_subscription cs, thread_factory& tf) + : lifetime(cs) + { + lifetime.add(make_subscription([this](){ + wake.notify_one(); + })); + + worker = tf([this](){ + for(;;) { + std::unique_lock guard(lock); + if (queue.empty()) { + wake.wait(guard, [this](){ + return !lifetime.is_subscribed() || !queue.empty(); + }); + } + if (!lifetime.is_subscribed()) { + break; + } + auto& peek = queue.top(); + if (!peek.what.is_subscribed()) { + queue.pop(); + continue; + } + if (clock_type::now() < peek.when) { + wake.wait_until(guard, peek.when); + continue; + } + auto what = peek.what; + queue.pop(); + r.reset(queue.empty()); + guard.unlock(); + what(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 guard(lock); + queue.push(item_type(when, scbl)); + r.reset(false); + } + wake.notify_one(); + } + }; + + mutable thread_factory factory; + +public: + new_thread() + : factory([](std::function 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::shared_ptr(new new_worker(cs, factory))); + } +}; + +inline scheduler make_new_thread() { + return make_scheduler(); +} +inline scheduler make_new_thread(thread_factory tf) { + return make_scheduler(tf); +} + +} + +} + +#endif -- GitLab From 10ba193b06f9b7ff306f30c30ce3bbded8ac4780 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 4 May 2014 01:12:48 -0700 Subject: [PATCH 273/782] add event_loop scheduler --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 8 ++ Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp | 110 ++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 54cbe8a..754a7b0 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -678,6 +678,13 @@ inline auto make_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 auto make_schedulable(worker sc, F&& f) -> typename std::enable_if::value, schedulable>::type { @@ -851,6 +858,7 @@ namespace rxsc=schedulers; #include "schedulers/rx-currentthread.hpp" #include "schedulers/rx-newthread.hpp" +#include "schedulers/rx-eventloop.hpp" #include "schedulers/rx-immediate.hpp" #include "schedulers/rx-virtualtime.hpp" diff --git a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp new file mode 100644 index 0000000..fc8deb7 --- /dev/null +++ b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp @@ -0,0 +1,110 @@ +// 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; + + public: + virtual ~loop_worker() + { + } + loop_worker(composite_subscription cs, worker w) + : lifetime(cs) + , controller(w) + { + } + + 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 count; + std::vector loops; + +public: + event_loop() + : factory([](std::function 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()); + } + } + 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()); + } + } + virtual ~event_loop() + { + } + + virtual clock_type::time_point now() const { + return clock_type::now(); + } + + virtual worker create_worker(composite_subscription cs) const { + return worker(cs, std::shared_ptr(new loop_worker(cs, loops[++count % loops.size()]))); + } +}; + +inline scheduler make_event_loop() { + static auto loop = make_scheduler(); + return loop; +} +inline scheduler make_event_loop(thread_factory tf) { + return make_scheduler(tf); +} + +} + +} + +#endif -- GitLab From 59d9d055fe64e4f9b56e0ed125b985e319004bb0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 4 May 2014 01:13:29 -0700 Subject: [PATCH 274/782] use static schedulers --- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 3 ++- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 3 ++- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 1f915f6..6c87bdd 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -243,7 +243,8 @@ public: }; inline scheduler make_current_thread() { - return make_scheduler(); + static auto ct = make_scheduler(); + return ct; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index 8209e68..1710fb7 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -73,7 +73,8 @@ public: }; inline scheduler make_immediate() { - return make_scheduler(); + static auto i = make_scheduler(); + return i; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index ddc4444..6dcfb9f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -127,7 +127,8 @@ public: }; inline scheduler make_new_thread() { - return make_scheduler(); + static auto nt = make_scheduler(); + return nt; } inline scheduler make_new_thread(thread_factory tf) { return make_scheduler(tf); -- GitLab From a691721dd4fb201c4b1799ad562bd3ee07adf611 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 8 May 2014 08:18:07 -0700 Subject: [PATCH 275/782] rename connect_now to connect_forever --- ...connect_now.hpp => rx-connect_forever.hpp} | 24 +++++++++---------- Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 10 ++++---- Rx/v2/src/rxcpp/rx-operators.hpp | 2 +- Rx/v2/test/operators/publish.cpp | 6 ++--- 4 files changed, 21 insertions(+), 21 deletions(-) rename Rx/v2/src/rxcpp/operators/{rx-connect_now.hpp => rx-connect_forever.hpp} (56%) diff --git a/Rx/v2/src/rxcpp/operators/rx-connect_now.hpp b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp similarity index 56% rename from Rx/v2/src/rxcpp/operators/rx-connect_now.hpp rename to Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp index ff998f0..35e000f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-connect_now.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp @@ -2,8 +2,8 @@ #pragma once -#if !defined(RXCPP_OPERATORS_RX_CONNECT_NOW_HPP) -#define RXCPP_OPERATORS_RX_CONNECT_NOW_HPP +#if !defined(RXCPP_OPERATORS_RX_CONNECT_FOREVER_HPP) +#define RXCPP_OPERATORS_RX_CONNECT_FOREVER_HPP #include "../rx-includes.hpp" @@ -14,13 +14,13 @@ namespace operators { namespace detail { template -struct connect_now : public operator_base +struct connect_forever : public operator_base { typedef typename std::decay::type source_type; source_type source; - explicit connect_now(source_type o) + explicit connect_forever(source_type o) : source(std::move(o)) { source.connect(); @@ -32,23 +32,23 @@ struct connect_now : public operator_base } }; -class connect_now_factory +class connect_forever_factory { public: - connect_now_factory() {} + connect_forever_factory() {} template auto operator()(Observable&& source) - -> observable::type::value_type, connect_now::type::value_type, Observable>> { - return observable::type::value_type, connect_now::type::value_type, Observable>>( - connect_now::type::value_type, Observable>(std::forward(source))); + -> observable::type::value_type, connect_forever::type::value_type, Observable>> { + return observable::type::value_type, connect_forever::type::value_type, Observable>>( + connect_forever::type::value_type, Observable>(std::forward(source))); } }; } -inline auto connect_now() - -> detail::connect_now_factory { - return detail::connect_now_factory(); +inline auto connect_forever() + -> detail::connect_forever_factory { + return detail::connect_forever_factory(); } } diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index bf63dd0..5fa2d59 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -184,16 +184,16 @@ public: rxo::detail::ref_count(*this)); } - /// connect_now -> + /// connect_forever -> /// 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. /// - auto connect_now() const - -> observable> { - return observable>( - rxo::detail::connect_now(*this)); + auto connect_forever() const + -> observable> { + return observable>( + rxo::detail::connect_forever(*this)); } }; diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index b0fa902..67bb79f 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -40,7 +40,7 @@ namespace rxo=operators; #include "operators/rx-flat_map.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" -#include "operators/rx-connect_now.hpp" +#include "operators/rx-connect_forever.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 02d799b..729464d 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -35,9 +35,9 @@ SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ // on_completed [](){std::cout << " done." << std::endl;}); } - WHEN("connect_now is used"){ - auto published = rxs::range(0, 10).publish().connect_now(); - std::cout << "subscribe to connect_now" << std::endl; + WHEN("connect_forever is used"){ + auto published = rxs::range(0, 10).publish().connect_forever(); + std::cout << "subscribe to connect_forever" << std::endl; published.subscribe( // on_next [](int v){std::cout << v << ", ";}, -- GitLab From a8404ed7079e2aeeb415129f352d5c8ffe80bef5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 13 May 2014 16:31:39 -0600 Subject: [PATCH 276/782] remove move call --- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index b54deab..b220615 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -45,7 +45,7 @@ struct filter : public operator_base return; } if (!filtered) { - o.on_next(std::move(t)); + o.on_next(t); } }, // on_error -- GitLab From 429aea3ef5fbc0bd6caab7505a44f8a395aaac76 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 13 May 2014 22:40:22 -0600 Subject: [PATCH 277/782] add lift cannot use it easily until C++14 deduced return type for auto functions is available. --- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 76 ++++++ Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 20 ++ Rx/v2/src/rxcpp/rx-observable.hpp | 98 ++++--- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-test.hpp | 8 +- Rx/v2/test/operators/lift.cpp | 241 ++++++++++++++++++ projects/CMake/CMakeLists.txt | 3 +- 7 files changed, 412 insertions(+), 35 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-lift.hpp create mode 100644 Rx/v2/test/operators/lift.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp new file mode 100644 index 0000000..ae0a581 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -0,0 +1,76 @@ +// 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_LIFT_HPP) +#define RXCPP_OPERATORS_RX_LIFT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace detail { + +template +struct is_lift_function_for { + + struct tag_not_valid {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)(*(CS*)nullptr)); + template + static tag_not_valid check(...); + + typedef typename std::decay::type for_type; + typedef typename std::decay::type func_type; + typedef decltype(check(0)) detail_result; + static const bool value = is_subscriber::value && is_subscriber::value; +}; + +} + +namespace operators { + +namespace detail { + +template +struct lift_traits +{ + typedef typename std::decay::type source_operator_type; + typedef typename std::decay::type operator_type; + + typedef typename source_operator_type::value_type source_value_type; + + static_assert(rxcpp::detail::is_lift_function_for, operator_type>::value, "lift Operator must be a function with the signature subscriber<...>(subscriber)"); + + typedef decltype((*(operator_type*)nullptr)(*(subscriber*)nullptr)) result_for_dynamic_source_subscriber_type; + + typedef typename result_for_dynamic_source_subscriber_type::value_type result_value_type; +}; + +template +struct lift : public operator_base::result_value_type> +{ + typedef lift_traits 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(source_operator_type s, operator_type op) + : source(std::move(s)) + , chain(std::move(op)) + { + } + template + void on_subscribe(const Subscriber& o) const { + source.on_subscribe(chain(o)); + } +}; + +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 5fa2d59..445e261 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -200,4 +200,24 @@ public: } +// +// support range() >> filter() >> subscribe() syntax +// '>>' is spelled 'stream' +// +template +auto operator >> (const rxcpp::connectable_observable& source, OperatorFactory&& of) + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); +} + +// +// support range() | filter() | subscribe() syntax +// '|' is spelled 'pipe' +// +template +auto operator | (const rxcpp::connectable_observable& source, OperatorFactory&& of) + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); +} + #endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 26fd032..30a20c3 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -20,8 +20,11 @@ struct is_operator_factory_for template static not_void check(...); - typedef decltype(check::type, typename std::decay::type>(0)) detail_result; - static const bool value = !std::is_same::value; + typedef typename std::decay::type source_type; + typedef typename std::decay::type function_type; + + typedef decltype(check(0)) detail_result; + static const bool value = !std::is_same::value && is_observable::value; }; template @@ -37,6 +40,38 @@ struct has_on_subscribe_for static const bool value = std::is_same::value; }; +struct lift_function { +template +static auto chain(const SourceObservable& source, OperatorFactory&& of) + -> decltype(source.lift(std::forward(of))) { + return source.lift(std::forward(of)); +} +}; +struct operator_factory { +template +static auto chain(const SourceObservable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} +}; +struct not_chainable { +}; + +template +struct select_chain +{ + typedef + typename std::conditional< + rxcpp::detail::is_lift_function_for, OperatorFactory>::value, + lift_function, + typename std::conditional< + rxcpp::detail::is_operator_factory_for::value, + operator_factory, + not_chainable + >::type + >::type type; +}; + } template @@ -52,16 +87,6 @@ class dynamic_observable }; std::shared_ptr state; - template - void construct(const dynamic_observable& o, tag_dynamic_observable&&) { - state = o.state; - } - - template - void construct(dynamic_observable&& o, tag_dynamic_observable&&) { - state = std::move(o.state); - } - template void construct(SO&& source, rxs::tag_source&&) { typename std::decay::type so = std::forward(source); @@ -85,11 +110,11 @@ public: } template - explicit dynamic_observable(SOF&& sof) + explicit dynamic_observable(SOF&& sof, typename std::enable_if::value, void**>::type = 0) : state(std::make_shared()) { construct(std::forward(sof), - typename std::conditional::value, tag_dynamic_observable, typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type>::type()); + typename std::conditional::value || rxo::is_operator::value, rxs::tag_source, tag_function>::type()); } void on_subscribe(subscriber o) const { @@ -225,6 +250,31 @@ public: return *this; } + /// + /// 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 + auto op(OperatorFactory&& of) const + -> decltype(of(*(const this_type*)nullptr)) { + return of(*this); + static_assert(detail::is_operator_factory_for::value, "Function passed for op() must have the signature Result(SourceObservable)"); + } + + /// + /// 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 + auto lift(Operator&& op) const + -> observable::value_type, rxo::detail::lift> { + return observable::value_type, rxo::detail::lift>( + rxo::detail::lift(source_operator, std::forward(op))); + static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); + } + /// /// subscribe will cause this observable to emit values to the provided subscriber. /// callers must provide enough arguments to make a subscriber. @@ -300,18 +350,6 @@ public: return observable>( rxo::detail::take_until(*this, std::forward(t))); } - - /// - /// takes any function that will take this observable and produce a result value. - /// this is intended to allow externally defined operators to be connected into the expression. - /// - template - auto op(OperatorFactory&& of) const - -> decltype(of(*(const this_type*)nullptr)) { - static_assert(detail::is_operator_factory_for::value, "Function passed for op() must have the signature Result(SourceObservable)"); - return of(*this); - } - }; // observable<> has static methods to construct observable sources and adaptors. @@ -337,8 +375,8 @@ public: // template auto operator >> (const rxcpp::observable& source, OperatorFactory&& of) - -> decltype(source.op(std::forward(of))) { - return source.op(std::forward(of)); + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); } // @@ -347,8 +385,8 @@ auto operator >> (const rxcpp::observable& source, OperatorFa // template auto operator | (const rxcpp::observable& source, OperatorFactory&& of) - -> decltype(source.op(std::forward(of))) { - return source.op(std::forward(of)); + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); } #endif diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 67bb79f..34c44bf 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -34,6 +34,7 @@ namespace rxo=operators; } +#include "operators/rx-lift.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index 4038eb7..9edbe44 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -127,8 +127,8 @@ namespace rxt=test; // template auto operator >> (const rxcpp::test::testable_observable& source, OperatorFactory&& of) - -> decltype(source.op(std::forward(of))) { - return source.op(std::forward(of)); + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); } // @@ -137,8 +137,8 @@ auto operator >> (const rxcpp::test::testable_observable& source, OperatorFac // template auto operator | (const rxcpp::test::testable_observable& source, OperatorFactory&& of) - -> decltype(source.op(std::forward(of))) { - return source.op(std::forward(of)); + -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { + return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); } #include "schedulers/rx-test.hpp" diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp new file mode 100644 index 0000000..2ff144a --- /dev/null +++ b/Rx/v2/test/operators/lift.cpp @@ -0,0 +1,241 @@ + +#define RXCPP_USE_OBSERVABLE_MEMBERS 1 + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +namespace detail { + +template +struct liftfilter +{ + typedef typename std::decay::type test_type; + test_type test; + + liftfilter(test_type t) + : test(t) + { + } + + template + struct filter_observer : public rx::observer_base::type::value_type> + { + typedef filter_observer this_type; + typedef rx::observer_base::type::value_type> base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef rx::observer 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; + try { + filtered = !test(v); + } catch(...) { + dest.on_error(std::current_exception()); + return; + } + if (!filtered) { + dest.on_next(v); + } + } + void on_error(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static rx::subscriber make(const dest_type& d, const test_type& t) { + return rx::make_subscriber(d, this_type(d, t)); + } + }; + + template + auto operator()(const Subscriber& dest) const + -> decltype(filter_observer::make(dest, test)) { + return filter_observer::make(dest, test); + } +}; + +} + +namespace { + +template +auto liftfilter(Predicate&& p) + -> detail::liftfilter::type> { + return detail::liftfilter::type>(std::forward(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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + record messages[] = { + 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) + }; + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + + WHEN("filtered to ints that are primes"){ + + auto res = w.start( + [&xs, &invoked]() { + return xs + .lift(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"){ + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + life items[] = { + subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + 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][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + record messages[] = { + 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) + }; + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + + WHEN("filtered to ints that are primes"){ + + auto res = w.start( + [&xs, &invoked]() { + return xs + >> 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"){ + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + life items[] = { + subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(5 == invoked); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 0c75e10..b09e5be 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,13 +42,14 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/operators/lift.cpp + ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp ${V2_TEST_DIR}/operators/take.cpp ${V2_TEST_DIR}/operators/publish.cpp ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp ${V2_TEST_DIR}/operators/flat_map.cpp - ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/operators/map.cpp ) add_executable(rxcppv2_test ${V2_TEST_SOURCES}) -- GitLab From 8623c0df3a01cddb9eb8cfa3d8a54364846ab167 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 15 May 2014 08:22:59 -0600 Subject: [PATCH 278/782] add test for lifting a lambda impl of filter --- Rx/v2/test/operators/lift.cpp | 85 ++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp index 2ff144a..a4c596d 100644 --- a/Rx/v2/test/operators/lift.cpp +++ b/Rx/v2/test/operators/lift.cpp @@ -169,7 +169,7 @@ SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]" } } -SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][operators]"){ +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(); @@ -239,3 +239,86 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][oper } } } + +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(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + record messages[] = { + 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) + }; + auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + + WHEN("filtered to ints that are primes"){ + + auto res = w.start( + [&xs, &invoked]() { + auto predicate = [&](int x){ + invoked++; + return IsPrime(x); + }; + return xs + .lift([=](rx::subscriber dest){ + return rx::make_subscriber( + dest, + [=](int n){ + bool pass = false; + try{pass = predicate(n);} catch(...){dest.on_error(std::current_exception());}; + if (pass) {dest.on_next(n);} + }, + [=](std::exception_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"){ + record items[] = { + on_next(230, 3), + on_next(340, 5), + on_next(390, 7) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + life items[] = { + subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("where was called until disposed"){ + REQUIRE(5 == invoked); + } + } + } +} + -- GitLab From bb2b3a00606e19d88546a4db654dc30111e1da5a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 15 May 2014 08:24:12 -0600 Subject: [PATCH 279/782] changes to the lifetime of subject --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index 85412e2..0398c42 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -74,9 +74,10 @@ class multicast_observer struct binder_type : public std::enable_shared_from_this { - binder_type() + explicit binder_type(composite_subscription cs) : state(std::make_shared()) , current_generation(0) + , lifetime(cs) { } @@ -88,6 +89,8 @@ class multicast_observer // must only be accessed under state->lock mutable std::shared_ptr completer; + + composite_subscription lifetime; }; std::shared_ptr b; @@ -95,13 +98,8 @@ class multicast_observer public: - multicast_observer() - : b(std::make_shared()) - { - } - multicast_observer(composite_subscription cs) - : observer_base(std::move(cs)) - , b(std::make_shared()) + explicit multicast_observer(composite_subscription cs) + : b(std::make_shared(cs)) { } bool has_observers() const { @@ -170,6 +168,7 @@ public: } } } + b->lifetime.unsubscribe(); } } void on_completed() const { @@ -185,6 +184,7 @@ public: } } } + b->lifetime.unsubscribe(); } } }; @@ -195,14 +195,13 @@ public: template class subject { + composite_subscription lifetime; detail::multicast_observer s; public: - subject() - { - } - subject(composite_subscription cs) - : s(std::move(cs)) + explicit subject(composite_subscription cs = composite_subscription()) + : lifetime(cs) + , s(cs) { } @@ -211,8 +210,12 @@ public: } subscriber>> get_subscriber(composite_subscription cs = composite_subscription()) const { + auto lt = lifetime; + auto token = lt.add(cs); + cs.add(make_subscription([token, lt](){lt.remove(token);})); return make_subscriber(cs, observer>(s)); } + observable get_observable() const { return make_dynamic_observable([this](subscriber o){ this->s.add(std::move(o)); -- GitLab From f1e239323c3e18b935ba67e8ce15992d23e5107a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 15 May 2014 13:59:34 -0600 Subject: [PATCH 280/782] add publish test --- Rx/v2/test/operators/publish.cpp | 114 ++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 729464d..464f7d2 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -47,7 +47,7 @@ SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ } } -SCENARIO("publish", "[publish][multicast][operators]"){ +SCENARIO("publish basic", "[publish][multicast][operators]"){ GIVEN("a test hot observable of longs"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); @@ -169,3 +169,115 @@ SCENARIO("publish", "[publish][multicast][operators]"){ } } + +SCENARIO("publish error", "[publish][error][multicast][operators]"){ + GIVEN("a test hot observable of longs"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + std::runtime_error ex("publish on_error"); + + record messages[] = { + 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 xs = sc.make_hot_observable(messages); + + auto res = w.make_subscriber(); + + rx::connectable_observable ys; + + WHEN("subscribed and then connected"){ + + w.schedule_absolute(rxsc::test::created_time, + [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ + ys = xs.publish().as_dynamic(); + }); + + w.schedule_absolute(rxsc::test::subscribed_time, + [&ys, &res](const rxsc::schedulable& scbl){ + ys.subscribe(res); + }); + + w.schedule_absolute(rxsc::test::unsubscribed_time, + [&res](const rxsc::schedulable& scbl){ + res.unsubscribe(); + }); + + { + rx::composite_subscription connection; + + w.schedule_absolute(300, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + w.schedule_absolute(400, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + { + rx::composite_subscription connection; + + w.schedule_absolute(500, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + w.schedule_absolute(800, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + w.start(); + + THEN("the output only contains items sent while subscribed"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there were 3 subscription/unsubscription"){ + life items[] = { + subscribe(300, 400), + subscribe(500, 600) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} -- GitLab From 93a29a50f219e8353e73ff02e55c1256dbbb8a37 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 15 May 2014 23:43:03 -0600 Subject: [PATCH 281/782] move lifetime storage in subject --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index 0398c42..2bbd546 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -36,14 +36,16 @@ class multicast_observer struct state_type : public std::enable_shared_from_this { - state_type() + explicit state_type(composite_subscription cs) : current(mode::Casting) + , lifetime(cs) { } std::atomic generation; std::mutex lock; typename mode::type current; std::exception_ptr error; + composite_subscription lifetime; }; struct completer_type @@ -75,9 +77,8 @@ class multicast_observer : public std::enable_shared_from_this { explicit binder_type(composite_subscription cs) - : state(std::make_shared()) + : state(std::make_shared(cs)) , current_generation(0) - , lifetime(cs) { } @@ -89,8 +90,6 @@ class multicast_observer // must only be accessed under state->lock mutable std::shared_ptr completer; - - composite_subscription lifetime; }; std::shared_ptr b; @@ -159,6 +158,7 @@ public: 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); guard.unlock(); if (c) { @@ -168,13 +168,14 @@ public: } } } - b->lifetime.unsubscribe(); + s.unsubscribe(); } } void on_completed() const { std::unique_lock 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); guard.unlock(); if (c) { @@ -184,7 +185,7 @@ public: } } } - b->lifetime.unsubscribe(); + s.unsubscribe(); } } }; -- GitLab From 9fffd233c7c4393bd91589aa1ff793a246e1c752 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 15 May 2014 23:44:33 -0600 Subject: [PATCH 282/782] improve dynamic_observer begin improvements based on new understanding of template arg deduction. --- Rx/v2/src/rxcpp/rx-observable.hpp | 21 +--- Rx/v2/src/rxcpp/rx-observer.hpp | 195 ++++++++++++++++-------------- Rx/v2/src/rxcpp/rx-test.hpp | 22 +--- 3 files changed, 110 insertions(+), 128 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 30a20c3..2f04ed9 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -122,24 +122,9 @@ public: } template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Subscriber&& o) const { - auto so = std::make_shared::type>(std::forward(o)); - state->on_subscribe(make_subscriber( - *so, - make_observer_dynamic( - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - }))); + typename std::enable_if>::value, void>::type + on_subscribe(Subscriber o) const { + state->on_subscribe(make_subscriber(o, make_observer_dynamic(o.get_observer()))); } }; diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 23b58ab..acdf056 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -71,70 +71,6 @@ struct is_on_completed } -template -class dynamic_observer -{ -public: - typedef tag_dynamic_observer dynamic_observer_tag; - - typedef std::function on_next_t; - typedef std::function on_error_t; - typedef std::function on_completed_t; -private: - typedef observer_base base_type; - - on_next_t onnext; - on_error_t onerror; - on_completed_t oncompleted; - -public: - dynamic_observer() - { - } - - template - dynamic_observer(OnNext&& n, OnError&& e, OnCompleted&& c) - : onnext(std::forward(n)) - , onerror(std::forward(e)) - , oncompleted(std::forward(c)) - { - static_assert(detail::is_on_next_of::value || std::is_same::value, - "Function supplied for on_next must be a function with the signature void(T);"); - static_assert(detail::is_on_error::value || std::is_same::value, - "Function supplied for on_error must be a function with the signature void(std::exception_ptr);"); - static_assert(detail::is_on_completed::value || std::is_same::value, - "Function supplied for on_completed must be a function with the signature void();"); - } - - dynamic_observer& operator=(dynamic_observer o) { - swap(o); - return *this; - } - void swap(dynamic_observer& o) { - using std::swap; - swap(onnext, o.onnext); - swap(onerror, o.onerror); - swap(oncompleted, o.oncompleted); - } - - template - void on_next(V&& v) const { - if (onnext) { - onnext(std::forward(v)); - } - } - void on_error(std::exception_ptr e) const { - if (onerror) { - onerror(e); - } - } - void on_completed() const { - if (oncompleted) { - oncompleted(); - } - } -}; - template class static_observer { @@ -183,9 +119,10 @@ public: swap(oncompleted, o.oncompleted); } + // use V so that std::move can be used safely template - void on_next(V&& v) const { - onnext(std::forward(v)); + void on_next(V v) const { + onnext(std::move(v)); } void on_error(std::exception_ptr e) const { onerror(e); @@ -240,23 +177,103 @@ public: } }; +template +class dynamic_observer +{ +public: + typedef tag_dynamic_observer dynamic_observer_tag; + +private: + typedef observer_base base_type; + + struct virtual_observer : public std::enable_shared_from_this + { + virtual void on_next(T) const =0; + virtual void on_error(std::exception_ptr e) const =0; + virtual void on_completed() const =0; + }; + + template + struct specific_observer : public virtual_observer + { + explicit specific_observer(Observer o) + : destination(std::move(o)) + { + } + + Observer destination; + virtual void on_next(T t) const { + destination.on_next(std::move(t)); + } + virtual void on_error(std::exception_ptr e) const { + destination.on_error(e); + } + virtual void on_completed() const { + destination.on_completed(); + } + }; + + std::shared_ptr destination; + + template + static auto make_destination(Observer o) + -> typename std::enable_if::value, std::shared_ptr>::type { + return std::make_shared>(std::move(o)); + } + +public: + dynamic_observer() + { + } + dynamic_observer(const dynamic_observer& o) + : destination(o.destination) + { + } + dynamic_observer(dynamic_observer&& o) + : destination(std::move(o.destination)) + { + } + + template + explicit dynamic_observer(Observer o) + : destination(make_destination(std::move(o))) + { + } + + dynamic_observer& operator=(dynamic_observer o) { + destination = std::move(o.destination); + return *this; + } + + // perfect forwarding delays the copy of the value. + template + void on_next(V&& v) const { + if (destination) { + destination->on_next(std::forward(v)); + } + } + void on_error(std::exception_ptr e) const { + if (destination) { + destination->on_error(e); + } + } + void on_completed() const { + if (destination) { + destination->on_completed(); + } + } +}; + template auto make_observer() -> observer { return observer(); } -template -auto make_observer(const observer& o) - -> observer { - return observer( - I(o)); -} -template -auto make_observer(observer&& o) +template +auto make_observer(observer o) -> observer { - return observer( - I(std::move(o))); + return observer(std::move(o)); } template auto make_observer(const OnNext& on) @@ -295,17 +312,13 @@ auto make_observer(const OnNext& on, const OnError& oe, const OnCompleted& oc) static_observer(on, oe, oc)); } -template -auto make_observer_dynamic(const observer& o) - -> observer { - return observer( - dynamic_observer(o)); -} -template -auto make_observer_dynamic(observer&& o) - -> observer { - return observer( - dynamic_observer(std::move(o))); + +template +auto make_observer_dynamic(Observer o) + -> typename std::enable_if< + is_observer::value, + observer>::type { + return observer(dynamic_observer(std::move(o))); } template auto make_observer_dynamic(OnNext&& on) @@ -313,7 +326,7 @@ auto make_observer_dynamic(OnNext&& on) detail::is_on_next_of::value, observer>>::type { return observer>( - dynamic_observer(std::forward(on), nullptr, nullptr)); + dynamic_observer(make_observer(std::forward(on)))); } template auto make_observer_dynamic(OnNext&& on, OnError&& oe) @@ -322,7 +335,7 @@ auto make_observer_dynamic(OnNext&& on, OnError&& oe) detail::is_on_error::value, observer>>::type { return observer>( - dynamic_observer(std::forward(on), std::forward(oe), nullptr)); + dynamic_observer(make_observer(std::forward(on), std::forward(oe)))); } template auto make_observer_dynamic(OnNext&& on, OnCompleted&& oc) @@ -331,7 +344,7 @@ auto make_observer_dynamic(OnNext&& on, OnCompleted&& oc) detail::is_on_completed::value, observer>>::type { return observer>( - dynamic_observer(std::forward(on), nullptr, std::forward(oc))); + dynamic_observer(make_observer(std::forward(on), std::forward(oc)))); } template auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc) @@ -341,7 +354,7 @@ auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc) detail::is_on_completed::value, observer>>::type { return observer>( - dynamic_observer(std::forward(on), std::forward(oe), std::forward(oc))); + dynamic_observer(make_observer(std::forward(on), std::forward(oe), std::forward(oc)))); } } diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index 9edbe44..cf4841b 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -37,28 +37,12 @@ struct test_source ts->on_subscribe(std::move(o)); } template - typename std::enable_if::type, subscriber>::value, void>::type - on_subscribe(Subscriber&& o) const { + typename std::enable_if>::value, void>::type + on_subscribe(Subscriber o) const { static_assert(is_subscriber::value, "on_subscribe must be passed a subscriber."); - auto so = std::make_shared::type>(std::forward(o)); - ts->on_subscribe( - make_subscriber( - *so, - make_observer_dynamic( - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - }))); + ts->on_subscribe(make_subscriber(o, make_observer_dynamic(o.get_observer()))); } }; -- GitLab From 890cb9bd2736a42f79b9a033665c4ce9d638cf68 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 16 May 2014 00:00:01 -0600 Subject: [PATCH 283/782] observer deduction cleanup --- Rx/v2/src/rxcpp/rx-observer.hpp | 47 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index acdf056..6b573ae 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -108,16 +108,12 @@ public: , oncompleted(std::move(o.oncompleted)) { } - static_observer& operator=(this_type o) { - swap(o); + this_type& operator=(this_type o) { + onnext = std::move(o.onnext); + onerror = std::move(o.onerror); + oncompleted = std::move(o.oncompleted); return *this; } - void swap(this_type& o) { - using std::swap; - swap(onnext, o.onnext); - swap(onerror, o.onerror); - swap(oncompleted, o.oncompleted); - } // use V so that std::move can be used safely template @@ -145,10 +141,22 @@ public: ~observer() { } + observer(const this_type& o) + : inner(o.inner) + { + } + observer(this_type&& o) + : inner(std::move(o.inner)) + { + } explicit observer(inner_t inner) : inner(std::move(inner)) { } + this_type& operator=(this_type o) { + inner = std::move(o.inner); + return *this; + } template void on_next(V&& v) const { inner.on_next(std::forward(v)); @@ -184,6 +192,7 @@ public: typedef tag_dynamic_observer dynamic_observer_tag; private: + typedef dynamic_observer this_type; typedef observer_base base_type; struct virtual_observer : public std::enable_shared_from_this @@ -225,11 +234,11 @@ public: dynamic_observer() { } - dynamic_observer(const dynamic_observer& o) + dynamic_observer(const this_type& o) : destination(o.destination) { } - dynamic_observer(dynamic_observer&& o) + dynamic_observer(this_type&& o) : destination(std::move(o.destination)) { } @@ -240,7 +249,7 @@ public: { } - dynamic_observer& operator=(dynamic_observer o) { + this_type& operator=(this_type o) { destination = std::move(o.destination); return *this; } @@ -276,40 +285,40 @@ auto make_observer(observer o) return observer(std::move(o)); } template -auto make_observer(const OnNext& on) +auto make_observer(OnNext on) -> typename std::enable_if< detail::is_on_next_of::value, observer>>::type { return observer>( - static_observer(on)); + static_observer(std::move(on))); } template -auto make_observer(const OnNext& on, const OnError& oe) +auto make_observer(OnNext on, OnError oe) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_error::value, observer>>::type { return observer>( - static_observer(on, oe)); + static_observer(std::move(on), std::move(oe))); } template -auto make_observer(const OnNext& on, const OnCompleted& oc) +auto make_observer(OnNext on, OnCompleted oc) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_completed::value, observer>>::type { return observer>( - static_observer(on, detail::OnErrorEmpty(), oc)); + static_observer(std::move(on), detail::OnErrorEmpty(), std::move(oc))); } template -auto make_observer(const OnNext& on, const OnError& oe, const OnCompleted& oc) +auto make_observer(OnNext on, OnError oe, OnCompleted oc) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_error::value && detail::is_on_completed::value, observer>>::type { return observer>( - static_observer(on, oe, oc)); + static_observer(std::move(on), std::move(oe), std::move(oc))); } -- GitLab From fb309ecbaa2bef060eb5fe0a9edaeecaddbea8d6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 16 May 2014 13:21:23 -0600 Subject: [PATCH 284/782] subscriber template deduction cleanup --- Rx/v2/src/rxcpp/rx-subscriber.hpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 92b672f..7c3207d 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -45,6 +45,19 @@ public: typedef typename composite_subscription::weak_subscription weak_subscription; typedef typename composite_subscription::shared_subscription shared_subscription; + subscriber(const this_type& o) + : lifetime(o.lifetime) + , controller(o.controller) + , destination(o.destination) + { + } + subscriber(this_type&& o) + : lifetime(std::move(o.lifetime)) + , controller(std::move(o.controller)) + , destination(std::move(o.destination)) + { + } + template subscriber(composite_subscription cs, resumption r, U&& o) : lifetime(std::move(cs)) @@ -53,6 +66,13 @@ public: { } + this_type& operator=(this_type o) { + lifetime = std::move(o.lifetime); + controller = std::move(o.controller); + destination = std::move(o.destination); + return *this; + } + const observer_type& get_observer() const { return destination; } @@ -130,17 +150,9 @@ public: }; -// copy -template -auto make_subscriber( - const subscriber& o) - -> subscriber { - return subscriber(o); -} -// move template auto make_subscriber( - subscriber&& o) + subscriber o) -> subscriber { return subscriber(std::move(o)); } -- GitLab From 6349b598029df9c4121e379fc48240c6f61c1d3b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 16 May 2014 13:22:02 -0600 Subject: [PATCH 285/782] add apply and apply_to used to expand tuples to function arguments --- Rx/v2/src/rxcpp/rx-util.hpp | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index eb25e67..6b37ca3 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -37,6 +37,82 @@ std::vector to_vector(const T (&arr) [size]) { return std::vector(std::begin(arr), std::end(arr)); } +template +struct values {}; + +template +struct values_from; + +template +struct values_from +{ + typedef values type; +}; + +template +struct values_from +{ + typedef typename values_from::type type; +}; + +namespace detail { + +template +auto apply(std::tuple p, values, F& f) + -> decltype(f(std::forward(std::get(p))...)) { + return f(std::forward(std::get(p))...); +} +template +auto apply(std::tuple p, values, const F& f) + -> decltype(f(std::forward(std::get(p))...)) { + return f(std::forward(std::get(p))...); +} + +} + +template +auto apply(std::tuple p, F& f) + -> decltype(detail::apply(std::move(p), typename values_from::type(), f)) { + return detail::apply(std::move(p), typename values_from::type(), f); +} +template +auto apply(std::tuple p, const F& f) + -> decltype(detail::apply(std::move(p), typename values_from::type(), f)) { + return detail::apply(std::move(p), typename values_from::type(), f); +} + +namespace detail { + +template +struct apply_to +{ + F to; + + explicit apply_to(F f) + : to(std::move(f)) + { + } + + template + auto operator()(std::tuple p) + -> decltype(rxcpp::util::apply(std::move(p), to)) { + return rxcpp::util::apply(std::move(p), to); + } + template + auto operator()(std::tuple p) const + -> decltype(rxcpp::util::apply(std::move(p), to)) { + return rxcpp::util::apply(std::move(p), to); + } +}; + +} + +template +auto apply_to(F f) + -> detail::apply_to { + return detail::apply_to(std::move(f)); +} + namespace detail { template -- GitLab From 1f67a383c47b24ffdf4e97771cebbb89f9c167dd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 16 May 2014 13:54:52 -0600 Subject: [PATCH 286/782] rename make_dynamic_observable --- Rx/v2/src/rxcpp/rx-observable.hpp | 2 +- Rx/v2/src/rxcpp/rx-predef.hpp | 2 +- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2f04ed9..016bba3 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -129,7 +129,7 @@ public: }; template -observable make_dynamic_observable(Source&& s) { +observable make_observable_dynamic(Source&& s) { return observable(dynamic_observable(std::forward(s))); } diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 25a75c8..688c8ea 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -129,7 +129,7 @@ template< class observable; template -observable make_dynamic_observable(Source&&); +observable make_observable_dynamic(Source&&); struct tag_observable {}; template diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index 2bbd546..dffa37c 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -218,7 +218,7 @@ public: } observable get_observable() const { - return make_dynamic_observable([this](subscriber o){ + return make_observable_dynamic([this](subscriber o){ this->s.add(std::move(o)); }); } -- GitLab From fba0f2d04f8d6ac53994a994353f6ae3cb6a2219 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 20 May 2014 08:35:26 -0700 Subject: [PATCH 287/782] add synchronize subject and fix lifetime issues This finally forced a rewrite of subscription. pretty happy with the result. flat map removed all sync and takes a new parameter that is applied to every source and can be used to synchronize them also added multicast --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 92 ++-- Rx/v2/src/rxcpp/operators/rx-multicast.hpp | 97 +++++ Rx/v2/src/rxcpp/operators/rx-publish.hpp | 45 +- Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 4 +- Rx/v2/src/rxcpp/rx-includes.hpp | 2 + Rx/v2/src/rxcpp/rx-notification.hpp | 22 +- Rx/v2/src/rxcpp/rx-observable.hpp | 62 ++- Rx/v2/src/rxcpp/rx-observer.hpp | 25 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-scheduler.hpp | 15 +- Rx/v2/src/rxcpp/rx-subjects.hpp | 3 +- Rx/v2/src/rxcpp/rx-subscriber.hpp | 9 +- Rx/v2/src/rxcpp/rx-subscription.hpp | 442 ++++++++++++-------- Rx/v2/src/rxcpp/rx-util.hpp | 4 +- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 8 +- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 17 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 214 ++++++++++ Rx/v2/test/operators/flat_map.cpp | 85 +++- Rx/v2/test/subscriptions/observer.cpp | 4 - Rx/v2/test/subscriptions/subscription.cpp | 47 +-- 20 files changed, 838 insertions(+), 360 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-multicast.hpp create mode 100644 Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 38dd15f..96e7ea6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -13,11 +13,12 @@ namespace operators { namespace detail { -template +template struct flat_map_traits { typedef typename std::decay::type source_type; typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type source_filter_type; typedef typename source_type::value_type source_value_type; @@ -47,12 +48,12 @@ struct flat_map_traits { typedef decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; }; -template +template struct flat_map - : public operator_base::value_type> + : public operator_base::value_type> { - typedef flat_map this_type; - typedef flat_map_traits traits; + typedef flat_map this_type; + typedef flat_map_traits traits; typedef typename traits::source_type source_type; typedef typename traits::collection_selector_type collection_selector_type; @@ -62,22 +63,26 @@ struct flat_map typedef typename traits::collection_type collection_type; typedef typename traits::collection_value_type collection_value_type; + typedef typename traits::source_filter_type source_filter_type; + struct values { - values(source_type o, collection_selector_type s, result_selector_type rs) + values(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) : source(std::move(o)) , selectCollection(std::move(s)) , selectResult(std::move(rs)) + , sourceFilter(std::move(sf)) { } source_type source; collection_selector_type selectCollection; result_selector_type selectResult; + source_filter_type sourceFilter; }; values initial; - flat_map(source_type o, collection_selector_type s, result_selector_type rs) - : initial(std::move(o), std::move(s), std::move(rs)) + flat_map(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) + : initial(std::move(o), std::move(s), std::move(rs), std::move(sf)) { } @@ -99,12 +104,7 @@ struct flat_map } // on_completed on the output must wait until all the // subscriptions have received on_completed - std::atomic pendingCompletions; - // because multiple sources are subscribed to by flat_map, - // calls to the output must be serialized by lock. - // the on_error/on_complete and unsubscribe calls can - // cause lock recursion. - std::recursive_mutex lock; + int pendingCompletions; output_type out; }; // take a copy of the values for each subscription @@ -116,21 +116,26 @@ struct flat_map // inner subscriptions are unsubscribed as well state->out.add(outercs); + auto source = on_exception( + [&](){return state->sourceFilter(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 - state->source.subscribe( + source->subscribe( state->out, outercs, // on_next [state](source_value_type st) { - util::detail::maybe selectedCollection; - try { - selectedCollection.reset(state->selectCollection(st)); - } catch(...) { - std::unique_lock guard(state->lock); - state->out.on_error(std::current_exception()); + auto selectedCollection = on_exception( + [&](){return state->selectCollection(st);}, + state->out); + if (selectedCollection.empty()) { return; } @@ -144,34 +149,36 @@ struct flat_map state->out.remove(innercstoken); })); + auto selectedSource = on_exception( + [&](){return state->sourceFilter(selectedCollection.get());}, + state->out); + if (selectedSource.empty()) { + return; + } + ++state->pendingCompletions; // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue - selectedCollection->subscribe( + selectedSource->subscribe( state->out, innercs, // on_next [state, st](collection_value_type ct) { - util::detail::maybe selectedResult; - try { - selectedResult.reset(state->selectResult(st, std::move(ct))); - } catch(...) { - std::unique_lock guard(state->lock); - state->out.on_error(std::current_exception()); + auto selectedResult = on_exception( + [&](){return state->selectResult(st, std::move(ct));}, + state->out); + if (selectedResult.empty()) { return; } - std::unique_lock guard(state->lock); state->out.on_next(std::move(*selectedResult)); }, // on_error [state](std::exception_ptr e) { - std::unique_lock guard(state->lock); state->out.on_error(e); }, //on_completed [state](){ if (--state->pendingCompletions == 0) { - std::unique_lock guard(state->lock); state->out.on_completed(); } } @@ -179,13 +186,11 @@ struct flat_map }, // on_error [state](std::exception_ptr e) { - std::unique_lock guard(state->lock); state->out.on_error(e); }, // on_completed [state]() { if (--state->pendingCompletions == 0) { - std::unique_lock guard(state->lock); state->out.on_completed(); } } @@ -193,35 +198,38 @@ struct flat_map } }; -template +template class flat_map_factory { typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type source_filter_type; collection_selector_type selectorCollection; result_selector_type selectorResult; + source_filter_type sourceFilter; public: - flat_map_factory(collection_selector_type s, result_selector_type rs) + flat_map_factory(collection_selector_type s, result_selector_type rs, source_filter_type sf) : selectorCollection(std::move(rs)) , selectorResult(std::move(s)) + , sourceFilter(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::value_type, flat_map> { - return observable::value_type, flat_map>( - flat_map(std::forward(source), std::move(selectorCollection), std::move(selectorResult))); + -> observable::value_type, flat_map> { + return observable::value_type, flat_map>( + flat_map(std::forward(source), std::move(selectorCollection), std::move(selectorResult), std::move(sourceFilter))); } }; } -template -auto flat_map(CollectionSelector&& s, ResultSelector&& rs) - -> detail::flat_map_factory { - return detail::flat_map_factory(std::forward(s), std::forward(rs)); +template +auto flat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) + -> detail::flat_map_factory { + return detail::flat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp new file mode 100644 index 0000000..7f25071 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp @@ -0,0 +1,97 @@ +// 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_MULTICAST_HPP) +#define RXCPP_OPERATORS_RX_MULTICAST_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct multicast : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type subject_type; + + struct multicast_state : public std::enable_shared_from_this + { + 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 connection; + }; + + std::shared_ptr state; + + multicast(source_type o, subject_type sub) + : state(std::make_shared(std::move(o), std::move(sub))) + { + } + template + void on_subscribe(Subscriber&& o) { + state->subject_value.get_observable().subscribe(std::forward(o)); + } + void on_connect(composite_subscription cs) { + 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); + } + } +}; + +template +class multicast_factory +{ + Subject caster; +public: + multicast_factory(Subject sub) + : caster(std::move(sub)) + { + } + template + auto operator()(Observable&& source) + -> connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject>> { + return connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject>>( + multicast::type::value_type, Observable, Subject>(std::forward(source), caster)); + } +}; + +} + +template +inline auto multicast(Subject sub) + -> detail::multicast_factory { + return detail::multicast_factory(std::move(sub)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/operators/rx-publish.hpp b/Rx/v2/src/rxcpp/operators/rx-publish.hpp index fcb89f3..34de51a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-publish.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-publish.hpp @@ -13,44 +13,6 @@ namespace operators { namespace detail { -template -struct publish : public operator_base -{ - typedef typename std::decay::type source_type; - typedef typename std::decay::type subject_type; - source_type source; - subject_type subject_value; - rxu::detail::maybe connection; - - explicit publish(source_type o) - : source(std::move(o)) - { - } - template - void on_subscribe(Subscriber&& o) { - subject_value.get_observable().subscribe(std::forward(o)); - } - void on_connect(composite_subscription cs) { - if (connection.empty()) { - // the lifetime of each connect is independent - auto destination = subject_value.get_subscriber(); - - // when the paramter is unsubscribed it should - // unsubscribe the most recent connection - connection.reset(cs.add(destination.get_subscription())); - - // when the connection is finished it should shutdown the connection - destination.add(make_subscription( - [cs, this](){ - cs.remove(this->connection.get()); - this->connection.reset(); - })); - - source.subscribe(destination); - } - } -}; - template class Subject> class publish_factory { @@ -58,9 +20,10 @@ public: publish_factory() {} template auto operator()(Observable&& source) - -> connectable_observable::type::value_type, publish::type::value_type, Observable, Subject::type::value_type>>> { - return connectable_observable::type::value_type, publish::type::value_type, Observable, Subject::type::value_type>>>( - publish::type::value_type, Observable, Subject::type::value_type>>(std::forward(source))); + -> connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject::type::value_type>>> { + return connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject::type::value_type>>>( + multicast::type::value_type, Observable, Subject::type::value_type>>( + std::forward(source), Subject::type::value_type>())); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp index 8d8b1a7..52a3d30 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -31,12 +31,12 @@ struct ref_count : public operator_base template void on_subscribe(Subscriber&& o) { auto needConnect = ++subscribers == 1; - o.add(make_subscription( + o.add( [this](){ if (--this->subscribers == 0) { this->connection.unsubscribe(); } - })); + }); source.subscribe(std::forward(o)); if (needConnect) { connection = source.connect(); diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index b15a3d1..75518ab 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -85,6 +85,7 @@ #include #include #include +#include #include #include #include @@ -94,6 +95,7 @@ #include #include #include +#include #include "rx-util.hpp" #include "rx-predef.hpp" diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index dd1ff78..8e4d27a 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -56,6 +56,24 @@ struct notification_base virtual void accept(const observer_type& o) const =0; }; +template +auto to_stream(std::ostream& os, const T& t, int, int) + -> decltype(os << t) { + return os << t; +} + +template +auto to_stream(std::ostream& os, const T&, int, ...) + -> decltype(os << typeid(T).name() << "") { + return os << "< " << typeid(T).name() << " does not support ostream>"; +} + +template +auto to_stream(std::ostream& os, const T&, ...) + -> decltype(os << "") { + return os << ""; +} + } template @@ -71,7 +89,9 @@ private: on_next_notification(T value) : value(std::move(value)) { } virtual void out(std::ostream& os) const { - os << "on_next( " << value << ")"; + os << "on_next( "; + detail::to_stream(os, value, 0, 0); + os << ")"; } virtual bool equals(const typename base::type& other) const { bool result = false; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 016bba3..5c197a3 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -74,6 +74,20 @@ struct select_chain } +// +// 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 + auto operator()(Observable o) + -> Observable { + return std::move(o); + static_assert(is_observable::value, "only support observables"); + } +}; + template class dynamic_observable : public rxs::source_base @@ -150,7 +164,7 @@ private: template auto detail_subscribe(Subscriber&& scrbr) const - -> decltype(make_subscription(*(typename std::decay::type*)nullptr)) { + -> composite_subscription { typedef typename std::decay::type subscriber_type; subscriber_type o = std::forward(scrbr); @@ -160,7 +174,7 @@ private: static_assert(detail::has_on_subscribe_for::value, "inner must have on_subscribe method that accepts this subscriber "); if (!o.is_subscribed()) { - return make_subscription(o); + return o.get_subscription(); } auto safe_subscribe = [=]() { @@ -189,7 +203,7 @@ private: safe_subscribe(); } - return make_subscription(o); + return o.get_subscription(); } public: @@ -302,18 +316,46 @@ public: /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs))); + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_observable())); + } + + /// flat_map (AKA SelectMany) -> + /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. + /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. + /// + template + auto flat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) const + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + } + + /// multicast -> + /// allows connections to the source to be independent of subscriptions + /// + template + auto multicast(Subject sub) const + -> connectable_observable> { + return connectable_observable>( + rxo::detail::multicast(*this, std::move(sub))); + } + + /// synchronize -> + /// turns a cold observable hot and allows connections to the source to be independent of subscriptions + /// + auto synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) const + -> decltype(multicast(rxsub::synchronize(w, cs))) { + return multicast(rxsub::synchronize(w, cs)); } /// publish -> /// turns a cold observable hot and allows connections to the source to be independent of subscriptions /// - auto publish() const - -> connectable_observable>> { - return connectable_observable>>( - rxo::detail::publish>(*this)); + auto publish(composite_subscription cs = composite_subscription()) const + -> decltype(multicast(rxsub::subject(cs))) { + return multicast(rxsub::subject(cs)); } /// take -> diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 6b573ae..b6bad50 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -366,6 +366,31 @@ auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc) dynamic_observer(make_observer(std::forward(on), std::forward(oe), std::forward(oc)))); } + +template +auto on_exception(const F& f, const OnError& c) + -> typename std::enable_if::value, rxu::detail::maybe>::type { + rxu::detail::maybe r; + try { + r.reset(f()); + } catch (...) { + c(std::current_exception()); + } + return r; +} + +template +auto on_exception(const F& f, const Subscriber& s) + -> typename std::enable_if::value, rxu::detail::maybe>::type { + rxu::detail::maybe r; + try { + r.reset(f()); + } catch (...) { + s.on_error(std::current_exception()); + } + return r; +} + } #endif diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 34c44bf..48c84d5 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -39,6 +39,7 @@ namespace rxo=operators; #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" #include "operators/rx-flat_map.hpp" +#include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-connect_forever.hpp" diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 754a7b0..5713b58 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -193,7 +193,6 @@ class worker : public worker_base friend bool operator==(const worker&, const worker&); public: typedef scheduler_base::clock_type clock_type; - typedef composite_subscription::shared_subscription shared_subscription; typedef composite_subscription::weak_subscription weak_subscription; worker() @@ -217,10 +216,7 @@ public: inline bool is_subscribed() const { return lifetime.is_subscribed(); } - inline weak_subscription add(shared_subscription s) const { - return lifetime.add(std::move(s)); - } - inline weak_subscription add(dynamic_subscription s) const { + inline weak_subscription add(subscription s) const { return lifetime.add(std::move(s)); } inline void remove(weak_subscription w) const { @@ -452,7 +448,6 @@ class schedulable : public schedulable_base public: typedef composite_subscription::weak_subscription weak_subscription; - typedef composite_subscription::shared_subscription shared_subscription; typedef scheduler_base::clock_type clock_type; ~schedulable() @@ -543,11 +538,13 @@ public: inline bool is_subscribed() const { return lifetime.is_subscribed(); } - inline weak_subscription add(shared_subscription s) const { + inline weak_subscription add(subscription s) const { return lifetime.add(std::move(s)); } - inline weak_subscription add(dynamic_subscription s) const { - return lifetime.add(std::move(s)); + template + auto add(F f) const + -> typename std::enable_if::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)); diff --git a/Rx/v2/src/rxcpp/rx-subjects.hpp b/Rx/v2/src/rxcpp/rx-subjects.hpp index 1289835..3c3fb32 100644 --- a/Rx/v2/src/rxcpp/rx-subjects.hpp +++ b/Rx/v2/src/rxcpp/rx-subjects.hpp @@ -17,5 +17,6 @@ namespace rxsub=subjects; } #include "subjects/rx-subject.hpp" +#include "subjects/rx-synchronize.hpp" -#endif \ No newline at end of file +#endif diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 7c3207d..939d76c 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -43,7 +43,6 @@ class subscriber : public subscriber_base subscriber(); public: typedef typename composite_subscription::weak_subscription weak_subscription; - typedef typename composite_subscription::shared_subscription shared_subscription; subscriber(const this_type& o) : lifetime(o.lifetime) @@ -132,11 +131,13 @@ public: bool is_subscribed() const { return lifetime.is_subscribed(); } - weak_subscription add(shared_subscription s) const { + weak_subscription add(subscription s) const { return lifetime.add(std::move(s)); } - weak_subscription add(dynamic_subscription s) const { - return lifetime.add(std::move(s)); + template + auto add(F f) const + -> typename std::enable_if::value, weak_subscription>::type { + return lifetime.add(make_subscription(std::move(f))); } void remove(weak_subscription w) const { return lifetime.remove(std::move(w)); diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 40700e8..527d52b 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -9,6 +9,21 @@ namespace rxcpp { +namespace detail { + +template +struct is_unsubscribe_function +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)()); + template + static not_void check(...); + + static const bool value = std::is_same::type>(0)), void>::value; +}; + +} struct tag_subscription {}; struct subscription_base {typedef tag_subscription subscription_tag;}; @@ -23,39 +38,8 @@ public: static const bool value = std::is_convertible::type>(0)), tag_subscription*>::value; }; -class dynamic_subscription : public subscription_base -{ - typedef std::function unsubscribe_call_type; - unsubscribe_call_type unsubscribe_call; - dynamic_subscription() - { - } -public: - dynamic_subscription(const dynamic_subscription& o) - : unsubscribe_call(o.unsubscribe_call) - { - } - dynamic_subscription(dynamic_subscription&& o) - : unsubscribe_call(std::move(o.unsubscribe_call)) - { - } - template - dynamic_subscription(I i, typename std::enable_if::value && !std::is_same::value, void**>::type selector = nullptr) - : unsubscribe_call([i](){ - i.unsubscribe();}) - { - } - dynamic_subscription(unsubscribe_call_type s) - : unsubscribe_call(std::move(s)) - { - } - void unsubscribe() const { - unsubscribe_call(); - } -}; - template -class static_subscription : public subscription_base +class static_subscription { typedef typename std::decay::type unsubscribe_call_type; unsubscribe_call_type unsubscribe_call; @@ -80,178 +64,243 @@ public: } }; -template class subscription : public subscription_base { - typedef typename std::decay::type inner_t; - inner_t inner; - mutable bool issubscribed; + class base_subscription_state : public std::enable_shared_from_this + { + base_subscription_state(); + public: + + explicit base_subscription_state(bool initial) + : issubscribed(initial) + { + } + virtual void unsubscribe() { + issubscribed = false; + } + std::atomic issubscribed; + }; public: - subscription(inner_t inner) - : inner(std::move(inner)) - , issubscribed(true) + typedef std::weak_ptr weak_state_type; + +private: + template + struct subscription_state : public base_subscription_state { - } - bool is_subscribed() const { - return issubscribed; - } - void unsubscribe() const { - if (issubscribed) { - inner.unsubscribe(); + typedef typename std::decay::type inner_t; + subscription_state(inner_t i) + : base_subscription_state(true) + , inner(std::move(i)) + { + } + virtual void unsubscribe() { + if (issubscribed.exchange(false)) { + inner.unsubscribe(); + } + } + inner_t inner; + }; + std::shared_ptr state; + + friend bool operator<(const subscription&, const subscription&); + friend bool operator==(const subscription&, const subscription&); + + subscription(weak_state_type w) + : state(w.lock()) + { + if (!state) { + abort(); } - issubscribed = false; } -}; -template<> -class subscription : public subscription_base -{ public: + subscription() + : state(std::make_shared(false)) + { + if (!state) { + abort(); + } + } + template + explicit subscription(U u, typename std::enable_if::value, void**>::type = nullptr) + : state(std::make_shared>(std::move(u))) + { + if (!state) { + abort(); + } + } + template + explicit subscription(U u, typename std::enable_if::value && is_subscription::value, void**>::type = nullptr) + // intentionally slice + : state(std::move(static_cast(u).state)) + { + if (!state) { + abort(); + } + } + subscription(const subscription& o) + : state(o.state) + { + if (!state) { + abort(); + } + } + subscription(subscription&& o) + : state(std::move(o.state)) { + if (!state) { + abort(); + } + } + subscription& operator=(subscription o) { + state = std::move(o.state); + return *this; } bool is_subscribed() const { - return false; + if (!state) { + abort(); + } + return state->issubscribed; } void unsubscribe() const { + if (!state) { + abort(); + } + auto keepAlive = state; + state->unsubscribe(); + } + + weak_state_type get_weak() { + return state; + } + static subscription lock(weak_state_type w) { + return subscription(w); } }; + +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(); + -> subscription { + return subscription(); } template auto make_subscription(I&& i) - -> typename std::enable_if::value, - subscription>::type { - return subscription(std::forward(i)); + -> typename std::enable_if::value && !detail::is_unsubscribe_function::value, + subscription>::type { + return subscription(std::forward(i)); } template auto make_subscription(Unsubscribe&& u) - -> typename std::enable_if::value, - subscription< static_subscription>>::type { - return subscription< static_subscription>( - static_subscription(std::forward(u))); + -> typename std::enable_if::value, + subscription>::type { + return subscription(static_subscription(std::forward(u))); } -class composite_subscription : public subscription_base +namespace detail { + +struct tag_composite_subscription_empty {}; + +class composite_subscription_inner { -public: - typedef std::shared_ptr shared_subscription; - typedef std::weak_ptr weak_subscription; private: - struct tag_empty {}; - struct state_t : public std::enable_shared_from_this + typedef subscription::weak_state_type weak_subscription; + struct composite_subscription_state : public std::enable_shared_from_this { - std::vector subscriptions; - std::recursive_mutex lock; - bool issubscribed; + std::set subscriptions; + std::mutex lock; + std::atomic issubscribed; - state_t() - : issubscribed(true) + ~composite_subscription_state() { + std::unique_lock guard(lock); + subscriptions.clear(); } - state_t(tag_empty&&) - : issubscribed(false) + composite_subscription_state() + : issubscribed(true) { } - - inline bool is_subscribed() { - return issubscribed; - } - - inline weak_subscription add(dynamic_subscription s) { - return add(std::make_shared(std::move(s))); + composite_subscription_state(tag_composite_subscription_empty) + : issubscribed(false) + { } - inline weak_subscription add(shared_subscription s) { - std::unique_lock guard(lock); - + inline weak_subscription add(subscription s) { if (!issubscribed) { - s->unsubscribe(); - } else { - auto end = std::end(subscriptions); - auto it = std::find(std::begin(subscriptions), end, s); - if (it == end) - { - subscriptions.emplace_back(s); - } + s.unsubscribe(); + } else if (s.is_subscribed()) { + std::unique_lock guard(lock); + subscriptions.insert(s); } - return s; + return s.get_weak(); } inline void remove(weak_subscription w) { - std::unique_lock guard(lock); - if (issubscribed && !w.expired()) { - auto s = w.lock(); - if (s) - { - auto end = std::end(subscriptions); - auto it = std::find(std::begin(subscriptions), end, s); - if (it != end) - { - subscriptions.erase(it); - } - } + std::unique_lock guard(lock); + subscriptions.erase(subscription::lock(w)); } } inline void clear() { - std::unique_lock guard(lock); - if (issubscribed) { - std::vector v(std::move(subscriptions)); + std::unique_lock guard(lock); + + std::set v(std::move(subscriptions)); + guard.unlock(); std::for_each(v.begin(), v.end(), - [](shared_subscription& s) { - s->unsubscribe(); }); + [](const subscription& s) { + s.unsubscribe(); }); } } inline void unsubscribe() { - std::unique_lock guard(lock); + if (issubscribed.exchange(false)) { + std::unique_lock guard(lock); - if (issubscribed) { - issubscribed = false; - std::vector v(std::move(subscriptions)); + std::set v(std::move(subscriptions)); + guard.unlock(); std::for_each(v.begin(), v.end(), - [](shared_subscription& s) { - s->unsubscribe(); }); + [](const subscription& s) { + s.unsubscribe(); }); } } }; - mutable std::shared_ptr state; +public: + typedef std::shared_ptr shared_state_type; - static std::shared_ptr shared_empty; +protected: + mutable shared_state_type state; - composite_subscription(std::shared_ptr s) - : state(std::move(s)) +public: + composite_subscription_inner() + : state(std::make_shared()) { - if (!state) { - abort(); - } } - - friend bool operator==(const composite_subscription&, const composite_subscription&); - -public: - - composite_subscription() - : state(std::make_shared()) + composite_subscription_inner(tag_composite_subscription_empty et) + : state(std::make_shared(et)) { - if (!state) { - abort(); - } } - composite_subscription(const composite_subscription& o) + + composite_subscription_inner(const composite_subscription_inner& o) : state(o.state) { if (!state) { abort(); } } - composite_subscription(composite_subscription&& o) + composite_subscription_inner(composite_subscription_inner&& o) : state(std::move(o.state)) { if (!state) { @@ -259,75 +308,120 @@ public: } } - composite_subscription& operator=(const composite_subscription& o) + composite_subscription_inner& operator=(composite_subscription_inner o) { - state = o.state; + state = std::move(o.state); if (!state) { abort(); } return *this; } - composite_subscription& operator=(composite_subscription&& o) - { - state = std::move(o.state); + + inline weak_subscription add(subscription s) const { if (!state) { abort(); } - return *this; - } - - static inline composite_subscription empty() { - return composite_subscription(shared_empty); - } - - inline bool is_subscribed() const { - return state->is_subscribed(); - } - inline weak_subscription add(shared_subscription s) const { - return state->add(std::move(s)); - } - inline weak_subscription add(dynamic_subscription s) const { + if (s == static_cast(*this)) { + // do not nest the same subscription + abort(); + //return s.get_weak(); + } return state->add(std::move(s)); } inline void remove(weak_subscription w) const { + if (!state) { + abort(); + } state->remove(std::move(w)); } inline void clear() const { + if (!state) { + abort(); + } state->clear(); } - inline void unsubscribe() const { + inline void unsubscribe() { + if (!state) { + abort(); + } state->unsubscribe(); } }; -inline bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) { - return lhs.state == rhs.state; -} -inline bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) { - return !(lhs == rhs); } -//static -RXCPP_SELECT_ANY std::shared_ptr composite_subscription::shared_empty = std::make_shared(composite_subscription::tag_empty()); +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; + static composite_subscription shared_empty; -namespace detail { + composite_subscription(detail::tag_composite_subscription_empty et) + : inner_type(et) + , subscription() // use empty base + { + } -struct tag_subscription_resolution -{ - template - struct predicate +public: + + composite_subscription() + : inner_type() + , subscription(static_cast(*this)) { - static const bool value = !is_subscriber::value && !is_observer::value && is_subscription::value; - }; - struct default_type { - inline operator composite_subscription() const { - return composite_subscription(); - } - }; + } + + composite_subscription(const composite_subscription& o) + : inner_type(o) + , subscription(static_cast(o)) + { + } + composite_subscription(composite_subscription&& o) + : inner_type(std::move(o)) + , subscription(std::move(static_cast(o))) + { + } + + composite_subscription& operator=(composite_subscription o) + { + inner_type::operator=(std::move(o)); + subscription::operator=(std::move(static_cast(o))); + return *this; + } + + static inline composite_subscription empty() { + return shared_empty; + } + + using subscription::is_subscribed; + using subscription::unsubscribe; + + using inner_type::add; + using inner_type::remove; + using inner_type::clear; + + template + auto add(F f) const + -> typename std::enable_if::value, weak_subscription>::type { + return inner_type::add(make_subscription(std::move(f))); + } }; +inline bool operator<(const composite_subscription& lhs, const composite_subscription& rhs) { + return static_cast(lhs) < static_cast(rhs); } +inline bool operator==(const composite_subscription& lhs, const composite_subscription& rhs) { + return static_cast(lhs) == static_cast(rhs); +} +inline bool operator!=(const composite_subscription& lhs, const composite_subscription& rhs) { + return !(lhs == rhs); +} + +//static +RXCPP_SELECT_ANY composite_subscription composite_subscription::shared_empty = composite_subscription(detail::tag_composite_subscription_empty()); } diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 6b37ca3..76b7f9e 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -227,12 +227,12 @@ public: } maybe& operator=(const T& other) { - set(other); + reset(other); return *this; } maybe& operator=(const maybe& other) { if (const T* pother = other.get()) { - set(*pother); + reset(*pother); } else { reset(); } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 411bd43..6d3cf6f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -251,9 +251,9 @@ public: } auto sharedThis = std::static_pointer_cast(this->shared_from_this()); - o.add(dynamic_subscription([sharedThis, index]() { + o.add([sharedThis, index]() { sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock()); - })); + }); } virtual std::vector subscriptions() const { @@ -313,9 +313,9 @@ public: auto index = sv.size() - 1; auto sharedThis = std::static_pointer_cast(this->shared_from_this()); - o.add(dynamic_subscription([sharedThis, index]() { + o.add([sharedThis, index]() { sharedThis->sv[index] = rxn::subscription(sharedThis->sv[index].subscribe(), sharedThis->sc->clock()); - })); + }); } virtual std::vector subscriptions() const { diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index dffa37c..e892828 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -2,8 +2,8 @@ #pragma once -#if !defined(RXCPP_RX_SCHEDULER_SUBJECT_HPP) -#define RXCPP_RX_SCHEDULER_SUBJECT_HPP +#if !defined(RXCPP_RX_SUBJECT_HPP) +#define RXCPP_RX_SUBJECT_HPP #include "../rx-includes.hpp" @@ -200,7 +200,11 @@ class subject detail::multicast_observer s; public: - explicit subject(composite_subscription cs = composite_subscription()) + subject() + : s(lifetime) + { + } + explicit subject(composite_subscription cs) : lifetime(cs) , s(cs) { @@ -210,11 +214,8 @@ public: return s.has_observers(); } - subscriber>> get_subscriber(composite_subscription cs = composite_subscription()) const { - auto lt = lifetime; - auto token = lt.add(cs); - cs.add(make_subscription([token, lt](){lt.remove(token);})); - return make_subscriber(cs, observer>(s)); + subscriber>> get_subscriber() const { + return make_subscriber(lifetime, observer>(s)); } observable get_observable() const { diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp new file mode 100644 index 0000000..60ce46a --- /dev/null +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -0,0 +1,214 @@ +// 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 synchronize_observer : public detail::multicast_observer +{ + typedef synchronize_observer this_type; + typedef detail::multicast_observer base_type; + + struct synchronize_observer_state : public std::enable_shared_from_this + { + typedef rxn::notification notification_type; + typedef typename notification_type::type base_notification_type; + typedef std::deque queue_type; + + struct mode + { + enum type { + Invalid = 0, + Processing, + Empty, + Disposed + }; + }; + + mutable std::mutex lock; + mutable std::condition_variable wake; + mutable queue_type queue; + composite_subscription lifetime; + rxsc::worker processor; + mutable typename mode::type current; + subscriber destination; + + void ensure_processing(std::unique_lock& guard) const { + if (!guard.owns_lock()) { + abort(); + } + if (current == mode::Empty) { + current = mode::Processing; + auto keepAlive = this->shared_from_this(); + processor.schedule(lifetime, [keepAlive, this](const rxsc::schedulable& self){ + try { + std::unique_lock guard(lock); + if (!lifetime.is_subscribed() || !destination.is_subscribed()) { + current = mode::Disposed; + queue.clear(); + guard.unlock(); + lifetime.unsubscribe(); + destination.unsubscribe(); + return; + } + if (queue.empty()) { + current = mode::Empty; + return; + } + auto notification = std::move(queue.front()); + queue.pop_front(); + guard.unlock(); + notification->accept(destination); + self(); + } catch(...) { + destination.on_error(std::current_exception()); + std::unique_lock guard(lock); + current = mode::Empty; + } + }); + } + } + + synchronize_observer_state(rxsc::worker w, composite_subscription cs, subscriber scbr) + : lifetime(cs) + , processor(w) + , current(mode::Empty) + , destination(scbr) + { + } + + template + void on_next(V v) const { + if (lifetime.is_subscribed()) { + std::unique_lock guard(lock); + queue.push_back(notification_type::on_next(std::move(v))); + wake.notify_one(); + ensure_processing(guard); + } + } + void on_error(std::exception_ptr e) const { + if (lifetime.is_subscribed()) { + std::unique_lock guard(lock); + queue.push_back(notification_type::on_error(e)); + wake.notify_one(); + ensure_processing(guard); + } + } + void on_completed() const { + if (lifetime.is_subscribed()) { + std::unique_lock guard(lock); + queue.push_back(notification_type::on_completed()); + wake.notify_one(); + ensure_processing(guard); + } + } + }; + + std::shared_ptr state; + +public: + synchronize_observer(rxsc::worker w, composite_subscription cs) + : base_type(cs) + , state(std::make_shared( + w, cs, make_subscriber(cs, make_observer_dynamic( *static_cast(this) )))) + {} + + template + void on_next(V v) const { + state->on_next(std::move(v)); + } + void on_error(std::exception_ptr e) const { + state->on_error(e); + } + void on_completed() const { + state->on_completed(); + } +}; + +} + +template +class synchronize +{ + rxsc::worker controller; + composite_subscription lifetime; + detail::synchronize_observer s; + +public: + explicit synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) + : controller(w) + , lifetime(cs) + , s(w, cs) + { + } + + bool has_observers() const { + return s.has_observers(); + } + + subscriber get_subscriber() const { + return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); + } + + observable get_observable() const { + return make_observable_dynamic([this](subscriber o){ + this->s.add(std::move(o)); + }); + } +}; + +// +// this type is used by operators that subscribe to +// multiple sources to ensure that the notifications are serialized +// +class synchronize_observable +{ + rxsc::scheduler factory; + rxsc::worker controller; +public: + synchronize_observable(rxsc::scheduler sc) + : factory(sc) + , controller(sc.create_worker()) + { + } + synchronize_observable(const synchronize_observable& o) + : factory(o.factory) + // new worker for each copy. this spreads work across threads + // but keeps each use serialized + , controller(factory.create_worker()) + { + } + synchronize_observable(synchronize_observable&& o) + : factory(std::move(o.factory)) + , controller(std::move(o.controller)) + { + } + synchronize_observable& operator=(synchronize_observable o) + { + factory = std::move(o.factory); + controller = std::move(o.controller); + return *this; + } + template + auto operator()(Observable o) + -> decltype(o.synchronize(controller).ref_count()) { + return o.synchronize(controller).ref_count(); + static_assert(is_observable::value, "can only synchronize observables"); + } +}; + +} + +} + +#endif diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 2d5b0f9..38f43ed 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 500; +static const int static_tripletCount = 50; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -51,7 +51,7 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ } } -SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ +SCENARIO("pythagorian ranges", "[hide][range][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ WHEN("generating pythagorian triplets"){ @@ -68,21 +68,23 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ auto triples = rxs::range(1, sc) .flat_map( - [&c, sc](int z){ return rxs::range(1, z, 1, sc) - .flat_map( - [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) - .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) - .map([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 triplet){return triplet;}) - // forget type to workaround lambda deduction bug on msvc 2013 - .as_dynamic();}, + [&c, sc](int z){ + return rxs::range(1, z, 1, sc) + .flat_map( + [&c, sc, z](int x){ + return rxs::range(x, z, 1, sc) + .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + .map([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 triplet){return triplet;}) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}); triples .take(tripletCount) .subscribe( - [&ct](std::tuple triplet){++ct;}, + rxu::apply_to([&ct](int x,int y,int z){++ct;}), [](std::exception_ptr){abort();}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -93,6 +95,63 @@ SCENARIO("pythagorian ranges", "[hide][for][pythagorian][perf]"){ } } +SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + rx::composite_subscription lifetime; + + auto sc = rxsc::make_event_loop(); + auto so = rxsub::synchronize_observable(sc); + + int c = 0; + int ct = 0; + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, sc) + .flat_map( + [&c, sc, so](int z){ + return rxs::range(1, z, 1, sc) + .flat_map( + [&c, sc, z](int x){ + return rxs::range(x, z, 1, sc) + .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + .map([z, x](int y){return std::make_tuple(x, y, z);});}, + [](int x, std::tuple triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + triples + .take(tripletCount) + .subscribe( + lifetime, + rxu::apply_to([&ct](int x,int y,int z){++ct;}), + [](std::exception_ptr){abort();}, + [&](){ + lifetime.unsubscribe(); + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return !lifetime.is_subscribed();}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << 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(); diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 2ea1999..83f90e7 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -84,14 +84,10 @@ SCENARIO("observer traits", "[observer][traits]"){ SCENARIO("non-observer traits", "[observer][traits]"){ GIVEN("given some subscription types"){ auto empty = [](){}; - rx::dynamic_subscription ds(empty); rx::static_subscription ss(empty); auto es = rx::make_subscription(); rx::composite_subscription cs; WHEN("tested"){ - THEN("is_observer value is false for dynamic_subscription"){ - REQUIRE(!rx::is_observer::value); - } THEN("is_observer value is false for static_subscription"){ REQUIRE(!rx::is_observer::value); } diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 3244946..f2959f7 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -6,18 +6,10 @@ namespace rx=rxcpp; SCENARIO("subscription traits", "[subscription][traits]"){ GIVEN("given some subscription types"){ auto empty = [](){}; - rx::dynamic_subscription ds(empty); - rx::static_subscription ss(empty); auto es = rx::make_subscription(); rx::composite_subscription cs; WHEN("tested"){ - THEN("is_subscription value is true for dynamic_subscription"){ - REQUIRE(rx::is_subscription::value); - } - THEN("is_subscription value is true for static_subscription"){ - REQUIRE(rx::is_subscription::value); - } - THEN("is_subscription value is true for subscription"){ + THEN("is_subscription value is true for empty subscription"){ REQUIRE(rx::is_subscription::value); } THEN("is_subscription value is true for composite_subscription"){ @@ -84,41 +76,6 @@ SCENARIO("subscription static", "[subscription]"){ } } -SCENARIO("subscription dynamic", "[subscription]"){ - GIVEN("given a subscription"){ - int i=0; - auto s = rx::make_subscription(rx::dynamic_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(); @@ -147,7 +104,7 @@ SCENARIO("subscription composite", "[subscription]"){ rx::composite_subscription s; s.add(rx::make_subscription()); s.add(rx::make_subscription([&i](){++i;})); - s.add(rx::make_subscription(rx::dynamic_subscription([&i](){++i;}))); + s.add([&i](){++i;}); WHEN("not used"){ THEN("is subscribed"){ REQUIRE(s.is_subscribed()); -- GitLab From ce504177a24794d13b9f9832f5b972ba9ba94436 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 22 May 2014 07:08:20 -0700 Subject: [PATCH 288/782] add long tags to long tests --- Rx/v2/test/subjects/subject.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 3a17a36..7b8a769 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -202,7 +202,7 @@ public: onnext(v); return ready.get_future();} }; } -SCENARIO("for loop calls std::future on_next(int)", "[hide][for][asyncobserver][future][perf]"){ +SCENARIO("for loop calls std::future 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"){ @@ -307,7 +307,7 @@ SCENARIO("range calls subscriber", "[hide][range][subscriber][perf]"){ } } -SCENARIO("for loop calls subject", "[hide][for][subject][subjects][perf]"){ +SCENARIO("for loop calls subject", "[hide][for][subject][subjects][long][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("a for loop and a subject"){ WHEN("multicasting a million ints"){ @@ -373,7 +373,7 @@ SCENARIO("for loop calls subject", "[hide][for][subject][subjects][perf]"){ } } -SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ +SCENARIO("range calls subject", "[hide][range][subject][subjects][long][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("a range and a subject"){ WHEN("multicasting a million ints"){ @@ -437,7 +437,7 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][perf]"){ } } -SCENARIO("schedule_periodically", "[hide][periodically][scheduler][perf]"){ +SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("schedule_periodically"){ WHEN("the period is 1sec and the initial is 2sec"){ @@ -460,7 +460,7 @@ SCENARIO("schedule_periodically", "[hide][periodically][scheduler][perf]"){ } } -SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][perf]"){ +SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][long][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("schedule_periodically_duration"){ WHEN("the period is 1sec and the initial is 2sec"){ @@ -503,6 +503,7 @@ SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][p } } } + SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ -- GitLab From 09d7c3f63530aec3b6cbaac32a166152092e62e5 Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS Open Tech)" Date: Thu, 22 May 2014 08:28:41 -0700 Subject: [PATCH 289/782] compiles and runs on windows --- Rx/v2/src/rxcpp/rx-observable.hpp | 1 - Rx/v2/src/rxcpp/rx-subscription.hpp | 23 +++++++++++++---------- Rx/v2/test/operators/flat_map.cpp | 4 +++- Rx/v2/test/operators/lift.cpp | 16 +++++++++------- Rx/v2/test/subjects/subject.cpp | 2 +- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 5c197a3..c84a55a 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -194,7 +194,6 @@ private: if (rxsc::current_thread::is_schedule_required()) { auto sc = rxsc::make_current_thread(); sc.create_worker(o.get_subscription()).schedule( - o.get_subscription(), [=](const rxsc::schedulable& scbl) { safe_subscribe(); }); diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 527d52b..60f445c 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -132,7 +132,7 @@ public: template explicit subscription(U u, typename std::enable_if::value && is_subscription::value, void**>::type = nullptr) // intentionally slice - : state(std::move(static_cast(u).state)) + : state(std::move((*static_cast(&u)).state)) { if (!state) { abort(); @@ -321,11 +321,6 @@ public: if (!state) { abort(); } - if (s == static_cast(*this)) { - // do not nest the same subscription - abort(); - //return s.get_weak(); - } return state->add(std::move(s)); } inline void remove(weak_subscription w) const { @@ -370,7 +365,7 @@ public: composite_subscription() : inner_type() - , subscription(static_cast(*this)) + , subscription(*static_cast(this)) { } @@ -388,7 +383,7 @@ public: composite_subscription& operator=(composite_subscription o) { inner_type::operator=(std::move(o)); - subscription::operator=(std::move(static_cast(o))); + subscription::operator=(std::move(*static_cast(&o))); return *this; } @@ -399,14 +394,22 @@ public: using subscription::is_subscribed; using subscription::unsubscribe; - using inner_type::add; using inner_type::remove; using inner_type::clear; + inline weak_subscription add(subscription s) const { + if (s == static_cast(*this)) { + // do not nest the same subscription + abort(); + //return s.get_weak(); + } + return inner_type::add(std::move(s)); + } + template auto add(F f) const -> typename std::enable_if::value, weak_subscription>::type { - return inner_type::add(make_subscription(std::move(f))); + return add(make_subscription(std::move(f))); } }; diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 38f43ed..258171d 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -123,7 +123,9 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) - .map([z, x](int y){return std::make_tuple(x, y, z);});}, + .map([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 triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp index a4c596d..6952d44 100644 --- a/Rx/v2/test/operators/lift.cpp +++ b/Rx/v2/test/operators/lift.cpp @@ -279,15 +279,17 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ }; return xs .lift([=](rx::subscriber dest){ + // VS2013 deduction issue requires dynamic (type-forgetting) return rx::make_subscriber( dest, - [=](int n){ - bool pass = false; - try{pass = predicate(n);} catch(...){dest.on_error(std::current_exception());}; - if (pass) {dest.on_next(n);} - }, - [=](std::exception_ptr e){dest.on_error(e);}, - [=](){dest.on_completed();}); + rx::make_observer_dynamic( + [=](int n){ + bool pass = false; + try{pass = predicate(n);} catch(...){dest.on_error(std::current_exception());}; + if (pass) {dest.on_next(n);} + }, + [=](std::exception_ptr e){dest.on_error(e);}, + [=](){dest.on_completed();})); }) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 7b8a769..ea475a6 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -21,7 +21,7 @@ namespace rxt=rxcpp::test; const int static_onnextcalls = 100000000; int aliased = 0; -SCENARIO("for loop locks mutex", "[hide][for][mutex][perf]"){ +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"){ -- GitLab From 18260f866b08179891eb1202fbe9b4441e58f1b6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 28 May 2014 16:14:41 -0700 Subject: [PATCH 290/782] lifetime and thread fixes --- Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 37 ++++++--- Rx/v2/src/rxcpp/operators/rx-take.hpp | 12 ++- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 15 ++-- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 89 +++++++++++++-------- 4 files changed, 99 insertions(+), 54 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp index 52a3d30..c289790 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -18,28 +18,43 @@ struct ref_count : public operator_base { typedef typename std::decay::type source_type; - source_type source; - long subscribers; - composite_subscription connection; + struct ref_count_state : public std::enable_shared_from_this + { + explicit ref_count_state(source_type o) + : source(std::move(o)) + , subscribers(0) + { + } + + source_type source; + std::mutex lock; + long subscribers; + composite_subscription connection; + }; + std::shared_ptr state; explicit ref_count(source_type o) - : source(std::move(o)) - , subscribers(0) + : state(std::make_shared(std::move(o))) { } template void on_subscribe(Subscriber&& o) { - auto needConnect = ++subscribers == 1; + std::unique_lock guard(state->lock); + auto needConnect = ++state->subscribers == 1; + auto keepAlive = state; + guard.unlock(); o.add( - [this](){ - if (--this->subscribers == 0) { - this->connection.unsubscribe(); + [keepAlive](){ + std::unique_lock guard(keepAlive->lock); + if (--keepAlive->subscribers == 0) { + keepAlive->connection.unsubscribe(); + keepAlive->connection = composite_subscription(); } }); - source.subscribe(std::forward(o)); + keepAlive->source.subscribe(std::forward(o)); if (needConnect) { - connection = source.connect(); + keepAlive->source.connect(keepAlive->connection); } } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index ff903f0..2b2f5b7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -65,17 +65,23 @@ struct take : public operator_base // take a copy of the values for each subscription auto state = std::shared_ptr(new state_type(initial, s)); + composite_subscription source_lifetime; + + s.add(source_lifetime); + state->source.subscribe( - // share subscription lifetime - state->out, + // split subscription lifetime + source_lifetime, // on_next - [state](T t) { + [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(); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 35c7fe6..6c7389e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -60,11 +60,15 @@ struct take_until : public operator_base , busy(0) , out(oarg) { + out.add(trigger_lifetime); + out.add(source_lifetime); } mutable std::atomic mode_value; mutable std::atomic busy; mutable std::mutex finish_lock; mutable std::exception_ptr exception; + composite_subscription trigger_lifetime; + composite_subscription source_lifetime; output_type out; }; // take a copy of the values for each subscription @@ -83,6 +87,8 @@ struct take_until : public operator_base st->mode_value.exchange(mode::stopped); guard.unlock(); if (fin == mode::triggered) { + st->trigger_lifetime.unsubscribe(); + st->source_lifetime.unsubscribe(); st->out.on_completed(); } else if (fin == mode::errored) { st->out.on_error(ex); @@ -97,14 +103,11 @@ struct take_until : public operator_base }; - composite_subscription trigger_lifetime; - state->out.add(trigger_lifetime); - state->trigger.subscribe( // share parts of subscription state->out, // new lifetime - trigger_lifetime, + state->trigger_lifetime, // on_next [state](const typename trigger_source_type::value_type&) { activity finisher(state); @@ -130,8 +133,8 @@ struct take_until : public operator_base ); state->source.subscribe( - // share subscription lifetime - state->out, + // split subscription lifetime + state->source_lifetime, // on_next [state](T t) { // diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index 6dcfb9f..89a0a12 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -25,59 +25,80 @@ private: typedef new_worker this_type; new_worker(const this_type&); - typedef detail::schedulable_queue< - typename clock_type::time_point> queue_item_time; + struct new_worker_state : public std::enable_shared_from_this + { + typedef detail::schedulable_queue< + typename clock_type::time_point> queue_item_time; + + typedef queue_item_time::item_type item_type; + + virtual ~new_worker_state() + { + std::unique_lock guard(lock); + if (worker.joinable() && worker.get_id() != std::this_thread::get_id()) { + lifetime.unsubscribe(); + guard.unlock(); + worker.join(); + } + else { + lifetime.unsubscribe(); + worker.detach(); + } + } - typedef queue_item_time::item_type item_type; + 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 queue; + std::thread worker; + recursion r; + }; - composite_subscription lifetime; - mutable std::mutex lock; - mutable std::condition_variable wake; - mutable queue_item_time queue; - std::thread worker; - recursion r; + std::shared_ptr state; public: virtual ~new_worker() { - { - std::unique_lock guard(lock); - lifetime.unsubscribe(); - } - worker.join(); } new_worker(composite_subscription cs, thread_factory& tf) - : lifetime(cs) + : state(std::make_shared(cs)) { - lifetime.add(make_subscription([this](){ - wake.notify_one(); - })); + auto keepAlive = state; + + state->lifetime.add([keepAlive](){ + keepAlive->wake.notify_one(); + }); - worker = tf([this](){ + state->worker = tf([keepAlive](){ for(;;) { - std::unique_lock guard(lock); - if (queue.empty()) { - wake.wait(guard, [this](){ - return !lifetime.is_subscribed() || !queue.empty(); + std::unique_lock guard(keepAlive->lock); + if (keepAlive->queue.empty()) { + keepAlive->wake.wait(guard, [keepAlive](){ + return !keepAlive->lifetime.is_subscribed() || !keepAlive->queue.empty(); }); } - if (!lifetime.is_subscribed()) { + if (!keepAlive->lifetime.is_subscribed()) { break; } - auto& peek = queue.top(); + auto& peek = keepAlive->queue.top(); if (!peek.what.is_subscribed()) { - queue.pop(); + keepAlive->queue.pop(); continue; } if (clock_type::now() < peek.when) { - wake.wait_until(guard, peek.when); + keepAlive->wake.wait_until(guard, peek.when); continue; } auto what = peek.what; - queue.pop(); - r.reset(queue.empty()); + keepAlive->queue.pop(); + keepAlive->r.reset(keepAlive->queue.empty()); guard.unlock(); - what(r.get_recurse()); + what(keepAlive->r.get_recurse()); } }); } @@ -92,11 +113,11 @@ private: virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { if (scbl.is_subscribed()) { - std::unique_lock guard(lock); - queue.push(item_type(when, scbl)); - r.reset(false); + std::unique_lock guard(state->lock); + state->queue.push(new_worker_state::item_type(when, scbl)); + state->r.reset(false); } - wake.notify_one(); + state->wake.notify_one(); } }; -- GitLab From 9b522717641458eaa74f1da44f4a26eb0e3be178 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 28 May 2014 16:15:15 -0700 Subject: [PATCH 291/782] remove aborts triggered by thread interleaves --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 2 +- Rx/v2/src/rxcpp/rx-subscriber.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 5713b58..d945e17 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -585,7 +585,7 @@ public: /// invokes the action inline void operator()(const recurse& r) const { if (!is_subscribed()) { - abort(); + return; } detacher protect(this); activity(*this, r); diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 939d76c..da432eb 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -105,7 +105,7 @@ public: template void on_next(V&& v) const { if (!is_subscribed()) { - abort(); + return; } detacher protect(this); destination.on_next(std::forward(v)); @@ -113,14 +113,14 @@ public: } void on_error(std::exception_ptr e) const { if (!is_subscribed()) { - abort(); + return; } detacher protect(this); destination.on_error(e); } void on_completed() const { if (!is_subscribed()) { - abort(); + return; } detacher protect(this); destination.on_completed(); -- GitLab From 51ba3ea83550edcf23b14229274709a0184dd4ae Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 28 May 2014 16:15:37 -0700 Subject: [PATCH 292/782] small test changes --- Rx/v2/test/operators/flat_map.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 258171d..921df08 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -105,9 +105,8 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori std::mutex lock; std::condition_variable wake; - rx::composite_subscription lifetime; - auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); auto so = rxsub::synchronize_observable(sc); int c = 0; @@ -122,7 +121,12 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori .flat_map( [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) - .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + .filter([&c, z, x](int y){ + ++c; + if (x*x + y*y == z*z) { + return true;} + else { + return false;}}) .map([z, x](int y){return std::make_tuple(x, y, z);}) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, @@ -135,21 +139,19 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori triples .take(tripletCount) .subscribe( - lifetime, - rxu::apply_to([&ct](int x,int y,int z){++ct;}), + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), [](std::exception_ptr){abort();}, [&](){ - lifetime.unsubscribe(); wake.notify_one();}); std::unique_lock guard(lock); - wake.wait(guard, [&](){return !lifetime.is_subscribed();}); + wake.wait(guard); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); std::cout << "pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; - } } } -- GitLab From 0a8aa7827debc4118464be3416edddd27e9803ba Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 28 May 2014 23:22:35 -0700 Subject: [PATCH 293/782] add merge --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 174 ++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 69 +++++++++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/merge.cpp | 144 ++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 6 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-merge.hpp create mode 100644 Rx/v2/test/operators/merge.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 96e7ea6..f120bf7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -220,7 +220,7 @@ public: auto operator()(Observable&& source) -> observable::value_type, flat_map> { return observable::value_type, flat_map>( - flat_map(std::forward(source), std::move(selectorCollection), std::move(selectorResult), std::move(sourceFilter))); + flat_map(std::forward(source), selectorCollection, selectorResult, sourceFilter)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp new file mode 100644 index 0000000..b719bcd --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -0,0 +1,174 @@ +// 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_MERGE_HPP) +#define RXCPP_OPERATORS_RX_MERGE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct merge : public operator_base::type::value_type::value_type> +{ + typedef merge this_type; + + typedef typename std::decay::type source_type; + typedef typename source_type::value_type source_value_type; + typedef typename std::decay::type source_filter_type; + + struct values + { + values(source_type o, source_filter_type sf) + : source(std::move(o)) + , sourceFilter(std::move(sf)) + { + } + source_type source; + source_filter_type sourceFilter; + }; + values initial; + + merge(source_type o, source_filter_type sf) + : initial(std::move(o), std::move(sf)) + { + } + + template + void on_subscribe(Subscriber&& scbr) { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename std::decay::type output_type; + + struct merge_state_type + : public std::enable_shared_from_this + , public values + { + merge_state_type(values i, output_type oarg) + : values(std::move(i)) + , pendingCompletions(0) + , out(std::move(oarg)) + { + } + // on_completed on the output must wait until all the + // subscriptions have received on_completed + int pendingCompletions; + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::shared_ptr(new merge_state_type(initial, std::forward(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->sourceFilter(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 + source->subscribe( + 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 = on_exception( + [&](){return state->sourceFilter(st);}, + state->out); + if (selectedSource.empty()) { + return; + } + + ++state->pendingCompletions; + // this subscribe does not share the source subscription + // so that when it is unsubscribed the source will continue + selectedSource->subscribe( + state->out, + innercs, + // on_next + [state, st](value_type ct) { + state->out.on_next(std::move(ct)); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + //on_completed + [state](){ + if (--state->pendingCompletions == 0) { + state->out.on_completed(); + } + } + ); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + if (--state->pendingCompletions == 0) { + state->out.on_completed(); + } + } + ); + } +}; + +template +class merge_factory +{ + typedef typename std::decay::type source_filter_type; + + source_filter_type sourceFilter; +public: + merge_factory(source_filter_type sf) + : sourceFilter(std::move(sf)) + { + } + + template + auto operator()(Observable&& source) + -> observable::value_type, merge> { + return observable::value_type, merge>( + merge(std::forward(source), sourceFilter)); + } +}; + +} + +template +auto merge(SourceFilter&& sf) + -> detail::merge_factory { + return detail::merge_factory(std::forward(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index c84a55a..a842f18 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -101,6 +101,9 @@ class dynamic_observable }; std::shared_ptr state; + template + friend bool operator==(const dynamic_observable&, const dynamic_observable&); + template void construct(SO&& source, rxs::tag_source&&) { typename std::decay::type so = std::forward(source); @@ -142,6 +145,15 @@ public: } }; +template +inline bool operator==(const dynamic_observable& lhs, const dynamic_observable& rhs) { + return lhs.state == rhs.state; +} +template +inline bool operator!=(const dynamic_observable& lhs, const dynamic_observable& rhs) { + return !(lhs == rhs); +} + template observable make_observable_dynamic(Source&& s) { return observable(dynamic_observable(std::forward(s))); @@ -162,6 +174,9 @@ private: template friend class observable; + template + friend bool operator==(const observable&, const observable&); + template auto detail_subscribe(Subscriber&& scrbr) const -> composite_subscription { @@ -309,6 +324,51 @@ public: rxo::detail::map(*this, std::forward(s))); } + template::value> + struct merge_result; + + template + struct merge_result + { + typedef + observable< + typename this_type::value_type::value_type, + rxo::detail::merge, SourceFilter>> + type; + static type make(const this_type* that, SourceFilter sf) { + return type(rxo::detail::merge, SourceFilter>(*that, sf)); + } + }; + template + struct merge_result + { + typedef this_type type; + static type make(const this_type* that, SourceFilter) { + return *that; + } + }; + + /// merge -> + /// for each item from this observable subscribe. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + auto merge() const + -> typename merge_result::type { + return merge_result::make(this, identity_observable()); + } + + /// merge -> + /// for each item from this observable subscribe. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto merge(SourceFilter&& sf) const + -> typename std::enable_if::value, + observable::value_type, rxo::detail::merge>>::type { + return observable::value_type, rxo::detail::merge>( + rxo::detail::merge(*this, std::forward(sf))); + } + /// flat_map (AKA SelectMany) -> /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. @@ -378,6 +438,15 @@ public: } }; +template +inline bool operator==(const observable& lhs, const observable& rhs) { + return lhs.source_operator == rhs.source_operator; +} +template +inline bool operator!=(const observable& lhs, const observable& rhs) { + return !(lhs == rhs); +} + // observable<> has static methods to construct observable sources and adaptors. // observable<> is not constructable template<> diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 48c84d5..7e1439c 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -38,6 +38,7 @@ namespace rxo=operators; #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" +#include "operators/rx-merge.hpp" #include "operators/rx-flat_map.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp new file mode 100644 index 0000000..1b43592 --- /dev/null +++ b/Rx/v2/test/operators/merge.cpp @@ -0,0 +1,144 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +SCENARIO("merge completes", "[flat_map][map][operators]"){ + GIVEN("1 hot observable with 3 cold observables of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages> mo; + typedef rxn::subscription life; + + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + typedef mo::recorded_type orecord; + auto oon_next = mo::on_next; + auto oon_completed = mo::on_completed; + auto osubscribe = mo::subscribe; + + record messages1[] = { + 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 ys1 = sc.make_cold_observable(messages1); + + record messages2[] = { + on_next(10, 201), + on_next(20, 202), + on_next(30, 203), + on_next(40, 204), + on_completed(50) + }; + auto ys2 = sc.make_cold_observable(messages2); + + record messages3[] = { + on_next(10, 301), + on_next(20, 302), + on_next(30, 303), + on_next(40, 304), + on_next(120, 305), + on_completed(150) + }; + auto ys3 = sc.make_cold_observable(messages3); + + orecord omessages[] = { + oon_next(300, ys1), + oon_next(400, ys2), + oon_next(500, ys3), + oon_completed(600) + }; + auto xs = sc.make_hot_observable(omessages); + + WHEN("each int is merged"){ + + auto res = w.start( + [&]() { + return xs + .merge() + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output contains merged ints"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + life items[] = { + subscribe(200, 600) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys1"){ + life items[] = { + subscribe(300, 530) + }; + auto required = rxu::to_vector(items); + auto actual = ys1.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys2"){ + life items[] = { + subscribe(400, 450) + }; + auto required = rxu::to_vector(items); + auto actual = ys2.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys3"){ + life items[] = { + subscribe(500, 650) + }; + auto required = rxu::to_vector(items); + auto actual = ys3.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b09e5be..52f554a 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/operators/merge.cpp ${V2_TEST_DIR}/operators/lift.cpp ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp -- GitLab From 53f772f5252f1c6cb834460726a7ca82fcccc6d8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 28 May 2014 23:34:36 -0700 Subject: [PATCH 294/782] clang compiles --- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index b719bcd..382e17a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -20,6 +20,7 @@ struct merge : public operator_base::type::value typedef typename std::decay::type source_type; typedef typename source_type::value_type source_value_type; + typedef typename source_value_type::value_type value_type; typedef typename std::decay::type source_filter_type; struct values -- GitLab From aef88fd9c233609af14ba00deba68140cbfc6393 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 29 May 2014 14:59:07 -0700 Subject: [PATCH 295/782] add concat_map --- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 253 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 30 ++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/concat_map.cpp | 148 ++++++++++++ Rx/v2/test/operators/flat_map.cpp | 8 +- projects/CMake/CMakeLists.txt | 1 + 6 files changed, 433 insertions(+), 8 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-concat_map.hpp create mode 100644 Rx/v2/test/operators/concat_map.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp new file mode 100644 index 0000000..9b21368 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -0,0 +1,253 @@ +// 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_CONCATMAP_HPP) +#define RXCPP_OPERATORS_RX_CONCATMAP_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct concat_traits { + typedef typename std::decay::type source_type; + typedef typename std::decay::type collection_selector_type; + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type source_filter_type; + + typedef typename source_type::value_type source_value_type; + + struct tag_not_valid {}; + template + static auto collection_check(int) -> decltype((*(CCS*)nullptr)(*(CV*)nullptr)); + template + static tag_not_valid collection_check(...); + + static_assert(!std::is_same(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::value, "concat_map CollectionSelector must return an observable"); +//#endif + + typedef typename collection_type::value_type collection_value_type; + + template + static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CV*)nullptr, *(CCV*)nullptr)); + template + static tag_not_valid result_check(...); + + static_assert(!std::is_same(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 decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; +}; + +template +struct concat_map + : public operator_base::value_type> +{ + typedef concat_map this_type; + typedef concat_traits 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::source_filter_type source_filter_type; + + struct values + { + values(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) + : source(std::move(o)) + , selectCollection(std::move(s)) + , selectResult(std::move(rs)) + , sourceFilter(std::move(sf)) + { + } + source_type source; + collection_selector_type selectCollection; + result_selector_type selectResult; + source_filter_type sourceFilter; + }; + values initial; + + concat_map(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) + : initial(std::move(o), std::move(s), std::move(rs), std::move(sf)) + { + } + + template + void on_subscribe(Subscriber&& scbr) { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename std::decay::type output_type; + + struct state_type + : public std::enable_shared_from_this + , public values + { + state_type(values i, output_type oarg) + : values(std::move(i)) + , sourceLifetime(composite_subscription::empty()) + , collectionLifetime(composite_subscription::empty()) + , 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->sourceFilter(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 + selectedSource->subscribe( + state->out, + collectionLifetime, + // on_next + [state, st](collection_value_type ct) { + auto selectedResult = on_exception( + [&](){return state->selectResult(st, std::move(ct));}, + state->out); + if (selectedResult.empty()) { + return; + } + state->out.on_next(std::move(*selectedResult)); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + //on_completed + [state](){ + if (!state->selectedCollections.empty()) { + auto value = state->selectedCollections.front(); + state->selectedCollections.pop_front(); + state->subscribe_to(value); + } else if (!state->sourceLifetime.is_subscribed()) { + state->out.on_completed(); + } + } + ); + } + composite_subscription sourceLifetime; + composite_subscription collectionLifetime; + std::deque selectedCollections; + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::shared_ptr(new state_type(initial, std::forward(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->sourceFilter(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 + source->subscribe( + state->out, + state->sourceLifetime, + // on_next + [state](source_value_type st) { + if (state->collectionLifetime.is_subscribed()) { + state->selectedCollections.push_back(st); + } else { + state->subscribe_to(st); + } + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + if (!state->collectionLifetime.is_subscribed() && state->selectedCollections.empty()) { + state->out.on_completed(); + } + } + ); + } +}; + +template +class concat_map_factory +{ + typedef typename std::decay::type collection_selector_type; + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type source_filter_type; + + collection_selector_type selectorCollection; + result_selector_type selectorResult; + source_filter_type sourceFilter; +public: + concat_map_factory(collection_selector_type s, result_selector_type rs, source_filter_type sf) + : selectorCollection(std::move(rs)) + , selectorResult(std::move(s)) + , sourceFilter(std::move(sf)) + { + } + + template + auto operator()(Observable&& source) + -> observable::value_type, concat_map> { + return observable::value_type, concat_map>( + concat_map(std::forward(source), selectorCollection, selectorResult, sourceFilter)); + } +}; + +} + +template +auto concat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) + -> detail::concat_map_factory { + return detail::concat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a842f18..0bd9a34 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -330,10 +330,10 @@ public: template struct merge_result { - typedef + typedef observable< - typename this_type::value_type::value_type, - rxo::detail::merge, SourceFilter>> + typename this_type::value_type::value_type, + rxo::detail::merge, SourceFilter>> type; static type make(const this_type* that, SourceFilter sf) { return type(rxo::detail::merge, SourceFilter>(*that, sf)); @@ -363,7 +363,7 @@ public: /// template auto merge(SourceFilter&& sf) const - -> typename std::enable_if::value, + -> typename std::enable_if::value, observable::value_type, rxo::detail::merge>>::type { return observable::value_type, rxo::detail::merge>( rxo::detail::merge(*this, std::forward(sf))); @@ -391,6 +391,28 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } + /// concat_map -> + /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. + /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. + /// + template + auto concat_map(CollectionSelector&& s, ResultSelector&& rs) const + -> observable::value_type, rxo::detail::concat_map> { + return observable::value_type, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_observable())); + } + + /// concat_map -> + /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. + /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. + /// + template + auto concat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) const + -> observable::value_type, rxo::detail::concat_map> { + return observable::value_type, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + } + /// multicast -> /// allows connections to the source to be independent of subscriptions /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 7e1439c..e5a5209 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -40,6 +40,7 @@ namespace rxo=operators; #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" #include "operators/rx-flat_map.hpp" +#include "operators/rx-concat_map.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp new file mode 100644 index 0000000..b3c0a95 --- /dev/null +++ b/Rx/v2/test/operators/concat_map.cpp @@ -0,0 +1,148 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +static const int static_tripletCount = 20; + +SCENARIO("concat pythagorian ranges", "[hide][range][concat][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(); + + int c = 0; + int ct = 0; + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, sc) + .concat_map( + [&c, sc](int z){ + return rxs::range(1, z, 1, sc) + .concat_map( + [&c, sc, z](int x){ + return rxs::range(x, z, 1, sc) + .filter([&c, z, x](int y){++c; return x*x + y*y == z*z;}) + .map([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 triplet){return triplet;}) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}); + triples + .take(tripletCount) + .subscribe( + rxu::apply_to([&ct](int x,int y,int z){++ct;}), + [](std::exception_ptr){abort();}); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "concat pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + + } + } +} + +SCENARIO("concat_map completes", "[concat_map][map][operators]"){ + GIVEN("two cold observables. one of ints. one of strings."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages ms; + typedef rxn::subscription life; + + typedef m::recorded_type irecord; + auto ion_next = m::on_next; + auto ion_completed = m::on_completed; + auto isubscribe = m::subscribe; + + typedef ms::recorded_type srecord; + auto son_next = ms::on_next; + auto son_completed = ms::on_completed; + auto ssubscribe = ms::subscribe; + + irecord int_messages[] = { + ion_next(100, 4), + ion_next(200, 2), + ion_completed(500) + }; + auto xs = sc.make_cold_observable(int_messages); + + srecord string_messages[] = { + son_next(50, "foo"), + son_next(100, "bar"), + son_next(150, "baz"), + son_next(200, "qux"), + son_completed(250) + }; + auto ys = sc.make_cold_observable(string_messages); + + WHEN("each int is mapped to the strings"){ + + auto res = w.start( + [&]() { + return xs + .concat_map( + [&](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"){ + srecord items[] = { + son_next(350, "foo"), + son_next(400, "bar"), + son_next(450, "baz"), + son_next(500, "qux"), + son_next(600, "foo"), + son_next(650, "bar"), + son_next(700, "baz"), + son_next(750, "qux"), + son_completed(800) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + life items[] = { + isubscribe(200, 700) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there were 2 subscription and unsubscription to the strings"){ + life items[] = { + ssubscribe(300, 550), + ssubscribe(550, 800) + }; + auto required = rxu::to_vector(items); + auto actual = ys.subscriptions(); + REQUIRE(required == actual); + } + } + } +} + diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 921df08..92ab2f2 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 50; +static const int static_tripletCount = 20; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -89,7 +89,7 @@ SCENARIO("pythagorian ranges", "[hide][range][pythagorian][perf]"){ auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "merge pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; } } @@ -122,7 +122,7 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori [&c, sc, z](int x){ return rxs::range(x, z, 1, sc) .filter([&c, z, x](int y){ - ++c; + ++c; if (x*x + y*y == z*z) { return true;} else { @@ -151,7 +151,7 @@ SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagori auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "merge sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; } } } diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 52f554a..b4dfa23 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -51,6 +51,7 @@ set(V2_TEST_SOURCES ${V2_TEST_DIR}/subjects/subject.cpp ${V2_TEST_DIR}/subscriptions/subscription.cpp ${V2_TEST_DIR}/operators/flat_map.cpp + ${V2_TEST_DIR}/operators/concat_map.cpp ${V2_TEST_DIR}/operators/map.cpp ) add_executable(rxcppv2_test ${V2_TEST_SOURCES}) -- GitLab From 48e0116b2f249123c17fa27ed6ec236c474735ca Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 30 May 2014 08:29:06 -0700 Subject: [PATCH 296/782] add concat --- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 191 ++++++++++++++++++++ Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 11 +- Rx/v2/src/rxcpp/rx-observable.hpp | 53 ++++++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/concat.cpp | 144 +++++++++++++++ Rx/v2/test/operators/merge.cpp | 2 +- projects/CMake/CMakeLists.txt | 1 + 7 files changed, 397 insertions(+), 6 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-concat.hpp create mode 100644 Rx/v2/test/operators/concat.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp new file mode 100644 index 0000000..c96514a --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -0,0 +1,191 @@ +// 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_CONCAT_HPP) +#define RXCPP_OPERATORS_RX_CONCAT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct concat + : public operator_base::type::value_type::value_type> +{ + typedef concat this_type; + + typedef typename std::decay::type source_type; + typedef typename std::decay::type source_filter_type; + + typedef typename source_type::value_type collection_type; + typedef typename collection_type::value_type value_type; + + struct values + { + values(source_type o, source_filter_type sf) + : source(std::move(o)) + , sourceFilter(std::move(sf)) + { + } + source_type source; + source_filter_type sourceFilter; + }; + values initial; + + concat(source_type o, source_filter_type sf) + : initial(std::move(o), std::move(sf)) + { + } + + template + void on_subscribe(Subscriber&& scbr) { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename std::decay::type output_type; + + struct concat_state_type + : public std::enable_shared_from_this + , public values + { + concat_state_type(values i, output_type oarg) + : values(std::move(i)) + , sourceLifetime(composite_subscription::empty()) + , collectionLifetime(composite_subscription::empty()) + , 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->sourceFilter(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 + selectedSource->subscribe( + state->out, + collectionLifetime, + // on_next + [state, st](value_type ct) { + state->out.on_next(ct); + }, + // on_error + [state](std::exception_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(); + } + } + ); + } + composite_subscription sourceLifetime; + composite_subscription collectionLifetime; + std::deque selectedCollections; + output_type out; + }; + // take a copy of the values for each subscription + auto state = std::shared_ptr(new concat_state_type(initial, std::forward(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->sourceFilter(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 + source->subscribe( + 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](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + if (!state->collectionLifetime.is_subscribed() && state->selectedCollections.empty()) { + state->out.on_completed(); + } + } + ); + } +}; + +template +class concat_factory +{ + typedef typename std::decay::type source_filter_type; + + source_filter_type sourceFilter; +public: + concat_factory(source_filter_type sf) + : sourceFilter(std::move(sf)) + { + } + + template + auto operator()(Observable&& source) + -> observable::value_type, concat> { + return observable::value_type, concat>( + concat(std::forward(source), sourceFilter)); + } +}; + +} + +template +auto concat(SourceFilter&& sf) + -> detail::concat_factory { + return detail::concat_factory(std::forward(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 9b21368..3ca8f70 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -92,11 +92,11 @@ struct concat_map typedef typename std::decay::type output_type; - struct state_type - : public std::enable_shared_from_this + struct concat_map_state_type + : public std::enable_shared_from_this , public values { - state_type(values i, output_type oarg) + concat_map_state_type(values i, output_type oarg) : values(std::move(i)) , sourceLifetime(composite_subscription::empty()) , collectionLifetime(composite_subscription::empty()) @@ -156,6 +156,7 @@ struct concat_map 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(); @@ -169,7 +170,7 @@ struct concat_map output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::forward(scbr))); + auto state = std::shared_ptr(new concat_map_state_type(initial, std::forward(scbr))); state->sourceLifetime = composite_subscription(); @@ -194,7 +195,7 @@ struct concat_map [state](source_value_type st) { if (state->collectionLifetime.is_subscribed()) { state->selectedCollections.push_back(st); - } else { + } else if (state->selectedCollections.empty()) { state->subscribe_to(st); } }, diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 0bd9a34..2134255 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -349,6 +349,7 @@ public: }; /// merge -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// @@ -358,6 +359,7 @@ public: } /// merge -> + /// The source filter can be used to syncronize sources from different contexts. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// @@ -370,6 +372,7 @@ public: } /// flat_map (AKA SelectMany) -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// @@ -381,6 +384,7 @@ public: } /// flat_map (AKA SelectMany) -> + /// The source filter can be used to syncronize sources from different contexts. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// @@ -391,7 +395,55 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } + template::value> + struct concat_result; + + template + struct concat_result + { + typedef + observable< + typename this_type::value_type::value_type, + rxo::detail::concat, SourceFilter>> + type; + static type make(const this_type* that, SourceFilter sf) { + return type(rxo::detail::concat, SourceFilter>(*that, sf)); + } + }; + template + struct concat_result + { + typedef this_type type; + static type make(const this_type* that, SourceFilter) { + return *that; + } + }; + + /// concat -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable subscribe to one at a time. in the order received. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + auto concat() const + -> typename concat_result::type { + return concat_result::make(this, identity_observable()); + } + + /// concat -> + /// The source filter can be used to syncronize sources from different contexts. + /// for each item from this observable subscribe to one at a time. in the order received. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto concat(SourceFilter&& sf) const + -> typename std::enable_if::value, + observable::value_type, rxo::detail::concat>>::type { + return observable::value_type, rxo::detail::concat>( + rxo::detail::concat(*this, std::forward(sf))); + } + /// concat_map -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// @@ -403,6 +455,7 @@ public: } /// concat_map -> + /// The source filter can be used to syncronize sources from different contexts. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index e5a5209..28c26ec 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -40,6 +40,7 @@ namespace rxo=operators; #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" #include "operators/rx-flat_map.hpp" +#include "operators/rx-concat.hpp" #include "operators/rx-concat_map.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp new file mode 100644 index 0000000..0df5e12 --- /dev/null +++ b/Rx/v2/test/operators/concat.cpp @@ -0,0 +1,144 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +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(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages> mo; + typedef rxn::subscription life; + + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + typedef mo::recorded_type orecord; + auto oon_next = mo::on_next; + auto oon_completed = mo::on_completed; + auto osubscribe = mo::subscribe; + + record messages1[] = { + 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 ys1 = sc.make_cold_observable(messages1); + + record messages2[] = { + on_next(10, 201), + on_next(20, 202), + on_next(30, 203), + on_next(40, 204), + on_completed(50) + }; + auto ys2 = sc.make_cold_observable(messages2); + + record messages3[] = { + on_next(10, 301), + on_next(20, 302), + on_next(30, 303), + on_next(40, 304), + on_next(120, 305), + on_completed(150) + }; + auto ys3 = sc.make_cold_observable(messages3); + + orecord omessages[] = { + oon_next(300, ys1), + oon_next(400, ys2), + oon_next(500, ys3), + oon_completed(600) + }; + auto xs = sc.make_hot_observable(omessages); + + WHEN("each int is merged"){ + + auto res = w.start( + [&]() { + return xs + .concat() + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output contains merged ints"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ints"){ + life items[] = { + subscribe(200, 600) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys1"){ + life items[] = { + subscribe(300, 530) + }; + auto required = rxu::to_vector(items); + auto actual = ys1.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys2"){ + life items[] = { + subscribe(530, 580) + }; + auto required = rxu::to_vector(items); + auto actual = ys2.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys3"){ + life items[] = { + subscribe(580, 730) + }; + auto required = rxu::to_vector(items); + auto actual = ys3.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 1b43592..0ab4486 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -13,7 +13,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -SCENARIO("merge completes", "[flat_map][map][operators]"){ +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(); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b4dfa23..1c85d4f 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/operators/concat.cpp ${V2_TEST_DIR}/operators/merge.cpp ${V2_TEST_DIR}/operators/lift.cpp ${V2_TEST_DIR}/operators/filter.cpp -- GitLab From 890f68ed57b623b10e2f1df4058ced6695599462 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 30 May 2014 16:26:50 -0700 Subject: [PATCH 297/782] add source filter to take_until extracted thread safety out of the take_until operator. --- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 112 ++++++++------------ Rx/v2/src/rxcpp/rx-observable.hpp | 18 +++- 2 files changed, 62 insertions(+), 68 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 6c7389e..3800804 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -13,25 +13,28 @@ namespace operators { namespace detail { -template +template struct take_until : public operator_base { typedef typename std::decay::type source_type; typedef typename std::decay::type trigger_source_type; + typedef typename std::decay::type source_filter_type; struct values { - values(source_type s, trigger_source_type t) + values(source_type s, trigger_source_type t, source_filter_type sf) : source(std::move(s)) , trigger(std::move(t)) + , sourceFilter(std::move(sf)) { } source_type source; trigger_source_type trigger; + source_filter_type sourceFilter; }; values initial; - take_until(source_type s, trigger_source_type t) - : initial(std::move(s), std::move(t)) + take_until(source_type s, trigger_source_type t, source_filter_type sf) + : initial(std::move(s), std::move(t), std::move(sf)) { } @@ -57,16 +60,12 @@ struct take_until : public operator_base take_until_state_type(const values& i, const output_type& oarg) : values(i) , mode_value(mode::taking) - , busy(0) , out(oarg) { out.add(trigger_lifetime); out.add(source_lifetime); } - mutable std::atomic mode_value; - mutable std::atomic busy; - mutable std::mutex finish_lock; - mutable std::exception_ptr exception; + typename mode::type mode_value; composite_subscription trigger_lifetime; composite_subscription source_lifetime; output_type out; @@ -74,65 +73,45 @@ struct take_until : public operator_base // take a copy of the values for each subscription auto state = std::shared_ptr(new take_until_state_type(initial, s)); - struct activity - { - const std::shared_ptr& st; - ~activity() { - if (--st->busy == 0 && st->mode_value > mode::clear) { - // need to finish - // this is the finish owner - std::unique_lock guard(st->finish_lock); - typename mode::type fin = st->mode_value; - auto ex = st->exception; - st->mode_value.exchange(mode::stopped); - guard.unlock(); - if (fin == mode::triggered) { - st->trigger_lifetime.unsubscribe(); - st->source_lifetime.unsubscribe(); - st->out.on_completed(); - } else if (fin == mode::errored) { - st->out.on_error(ex); - } - } - } - explicit activity(const std::shared_ptr& st) - : st(st) - { - ++st->busy; - } + auto trigger = on_exception( + [&](){return state->sourceFilter(state->trigger);}, + state->out); + if (trigger.empty()) { + return; + } - }; + auto source = on_exception( + [&](){return state->sourceFilter(state->source);}, + state->out); + if (source.empty()) { + return; + } - state->trigger.subscribe( + trigger.get().subscribe( // share parts of subscription state->out, // new lifetime state->trigger_lifetime, // on_next [state](const typename trigger_source_type::value_type&) { - activity finisher(state); - std::unique_lock guard(state->finish_lock); if (state->mode_value != mode::taking) {return;} - state->mode_value.exchange(mode::triggered); + state->mode_value = mode::triggered; + state->out.on_completed(); }, // on_error [state](std::exception_ptr e) { - activity finisher(state); - std::unique_lock guard(state->finish_lock); if (state->mode_value != mode::taking) {return;} - state->mode_value.exchange(mode::errored); - state->exception = e; + state->mode_value = mode::errored; + state->out.on_error(e); }, // on_completed [state]() { - activity finisher(state); - std::unique_lock guard(state->finish_lock); if (state->mode_value != mode::taking) {return;} - state->mode_value.exchange(mode::clear); + state->mode_value = mode::clear; } ); - state->source.subscribe( + source.get().subscribe( // split subscription lifetime state->source_lifetime, // on_next @@ -140,51 +119,54 @@ struct take_until : public operator_base // // everything is crafted to minimize the overhead of this function. // - activity finisher(state); if (state->mode_value < mode::triggered) { state->out.on_next(t); } }, // on_error [state](std::exception_ptr e) { - activity finisher(state); - std::unique_lock guard(state->finish_lock); if (state->mode_value > mode::clear) {return;} - state->mode_value.exchange(mode::errored); - state->exception = e; + state->mode_value = mode::errored; + state->out.on_error(e); }, // on_completed [state]() { - activity finisher(state); - std::unique_lock guard(state->finish_lock); if (state->mode_value > mode::clear) {return;} - state->mode_value.exchange(mode::triggered); + state->mode_value = mode::triggered; + state->out.on_completed(); } ); } }; -template +template class take_until_factory { typedef typename std::decay::type trigger_source_type; + typedef typename std::decay::type source_filter_type; + trigger_source_type trigger_source; + source_filter_type source_filter; public: - take_until_factory(trigger_source_type t) : trigger_source(std::move(t)) {} + take_until_factory(trigger_source_type t, source_filter_type sf) + : trigger_source(std::move(t)) + , source_filter(std::move(sf)) + { + } template auto operator()(Observable&& source) - -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>> { - return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type>>( - take_until::type::value_type, Observable, trigger_source_type>(std::forward(source), trigger_source)); + -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, SourceFilter>> { + return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, SourceFilter>>( + take_until::type::value_type, Observable, trigger_source_type, SourceFilter>(std::forward(source), trigger_source, source_filter)); } }; } -template -auto take_until(TriggerObservable&& t) - -> detail::take_until_factory { - return detail::take_until_factory(std::forward(t)); +template +auto take_until(TriggerObservable&& t, SourceFilter&& sf) + -> detail::take_until_factory { + return detail::take_until_factory(std::forward(t), std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2134255..5af27df 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -503,13 +503,25 @@ public: } /// take_until -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// /// template auto take_until(TriggerSource&& t) const - -> observable> { - return observable>( - rxo::detail::take_until(*this, std::forward(t))); + -> observable> { + return observable>( + rxo::detail::take_until(*this, std::forward(t), identity_observable())); + } + + /// take_until -> + /// The source filter can be used to syncronize sources from different contexts. + /// + /// + template + auto take_until(TriggerSource&& t, SourceFilter&& sf) const + -> observable> { + return observable>( + rxo::detail::take_until(*this, std::forward(t), std::forward(sf))); } }; -- GitLab From ebf03a59277557b14bd82d1bde513498a883e763 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 30 May 2014 22:27:05 -0700 Subject: [PATCH 298/782] Add scan --- Rx/v2/src/rxcpp/operators/rx-scan.hpp | 122 ++++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 10 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/scan.cpp | 76 ++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 5 files changed, 210 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-scan.hpp create mode 100644 Rx/v2/test/operators/scan.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp new file mode 100644 index 0000000..3776832 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -0,0 +1,122 @@ +// 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_SCAN_HPP) +#define RXCPP_OPERATORS_RX_SCAN_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct scan : public operator_base::type> +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type accumulator_type; + typedef typename std::decay::type 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; + + template + static auto check(int) -> decltype((*(CP*)nullptr)(*(CS*)nullptr, *(CT*)nullptr)); + template + static void check(...); + + scan(source_type o, accumulator_type a, T s) + : initial(std::move(o), a, s) + { + static_assert(std::is_convertible(0)), seed_type>::value, "scan Accumulator must be a function with the signature Seed(Seed, T)"); + } + template + void on_subscribe(Subscriber o) { + struct scan_state_type + : public scan_initial_type + , public std::enable_shared_from_this + { + 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(initial, std::move(o)); + state->source.subscribe( + state->out, + // on_next + [state](T t) { + auto result = on_exception( + [&](){return state->accumulator(state->result, t);}, + state->out); + if (result.empty()) { + return; + } + state->result = result.get(); + state->out.on_next(state->result); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + state->out.on_completed(); + } + ); + } +}; + +template +class scan_factory +{ + typedef typename std::decay::type accumulator_type; + typedef typename std::decay::type seed_type; + + accumulator_type accumulator; + seed_type seed; +public: + scan_factory(accumulator_type a, Seed s) + : accumulator(std::move(a)) + , seed(s) + { + } + template + auto operator()(Observable&& source) + -> observable::type, scan::type::value_type, Observable, Accumulator, Seed>> { + return observable::type, scan::type::value_type, Observable, Accumulator, Seed>>( + scan::type::value_type, Observable, Accumulator, Seed>(std::forward(source), accumulator, seed)); + } +}; + +} + +template +auto scan(Seed s, Accumulator&& a) + -> detail::scan_factory { + return detail::scan_factory(std::forward(a), s); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 5af27df..94b6dd0 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -492,6 +492,16 @@ public: return multicast(rxsub::subject(cs)); } + /// scan -> + /// for each item from this observable use Predicate to combine items into a final value that will be emitted from the new observable that is returned. + /// + template + auto scan(Seed seed, Accumulator&& a) const + -> observable> { + return observable>( + rxo::detail::scan(*this, std::forward(a), seed)); + } + /// take -> /// /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 28c26ec..08bb9dd 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -46,6 +46,7 @@ namespace rxo=operators; #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-connect_forever.hpp" +#include "operators/rx-scan.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp new file mode 100644 index 0000000..27ab1c5 --- /dev/null +++ b/Rx/v2/test/operators/scan.cpp @@ -0,0 +1,76 @@ + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +SCENARIO("scan some data with seed", "[scan][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + int seed = 1; + + record messages[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto xs = sc.make_hot_observable(messages); + + 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"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 1c85d4f..ac9099d 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -47,6 +47,7 @@ set(V2_TEST_SOURCES ${V2_TEST_DIR}/operators/lift.cpp ${V2_TEST_DIR}/operators/filter.cpp ${V2_TEST_DIR}/subscriptions/observer.cpp + ${V2_TEST_DIR}/operators/scan.cpp ${V2_TEST_DIR}/operators/take.cpp ${V2_TEST_DIR}/operators/publish.cpp ${V2_TEST_DIR}/subjects/subject.cpp -- GitLab From ece4743c138fd110d5acc018aca7dc93ad56cff3 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 31 May 2014 09:37:00 -0700 Subject: [PATCH 299/782] add iterate and variadic merge --- Rx/v2/src/rxcpp/rx-includes.hpp | 1 + Rx/v2/src/rxcpp/rx-observable.hpp | 76 +++++++++++++---- Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 109 ++++++++++++++++++++++++ Rx/v2/test/operators/merge.cpp | 113 ++++++++++++++++++++++++- 5 files changed, 283 insertions(+), 17 deletions(-) create mode 100644 Rx/v2/src/rxcpp/sources/rx-iterate.hpp diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 75518ab..e26206a 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 94b6dd0..9ecb1b3 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -159,6 +159,42 @@ observable make_observable_dynamic(Source&& s) { return observable(dynamic_observable(std::forward(s))); } +// observable<> has static methods to construct observable sources and adaptors. +// observable<> is not constructable +template<> +class observable +{ + ~observable(); +public: + template + static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable> { + return observable>( + rxs::detail::range(first, last, step, sc)); + } + template + static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable::value_type, rxs::detail::iterate> { + return observable::value_type, rxs::detail::iterate>( + rxs::detail::iterate(std::move(c), sc)); + } + template + static auto iterate(Value0 v0, ValueN... vn) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); + } + template + static auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), sc)); + } +}; + + template class observable : public observable_base @@ -259,7 +295,7 @@ public: /// /// performs type-forgetting conversion to a new observable /// - observable as_dynamic() { + observable as_dynamic() const { return *this; } @@ -371,6 +407,29 @@ public: rxo::detail::merge(*this, std::forward(sf))); } + /// merge -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable subscribe. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto merge(ValueN... vn) const + -> observable { + return observable<>::iterate(this->as_dynamic(), vn.as_dynamic()...).merge(); + } + + /// merge -> + /// The source filter can be used to syncronize sources from different contexts. + /// for each item from this observable subscribe. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto merge(ValueN... vn, SourceFilter&& sf) const + -> observable { + return observable<>::iterate(this->as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + } + + /// flat_map (AKA SelectMany) -> /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. @@ -544,21 +603,6 @@ inline bool operator!=(const observable& lhs, const observabl return !(lhs == rhs); } -// observable<> has static methods to construct observable sources and adaptors. -// observable<> is not constructable -template<> -class observable -{ - ~observable(); -public: - template - static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - rxs::detail::range(first, last, step, sc)); - } -}; - } // diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index c504372..a21278c 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -36,5 +36,6 @@ namespace rxs=sources; } #include "sources/rx-range.hpp" +#include "sources/rx-iterate.hpp" #endif diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp new file mode 100644 index 0000000..1156053 --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -0,0 +1,109 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct iterate_traits +{ + typedef typename std::decay::type collection_type; + typedef decltype(std::begin(*(collection_type*)nullptr)) iterator_type; + typedef typename std::iterator_traits::value_type value_type; +}; + +template +struct iterate : public source_base::value_type> +{ + typedef iterate this_type; + typedef iterate_traits traits; + + typedef typename traits::collection_type collection_type; + typedef typename traits::iterator_type iterator_type; + + struct iterate_initial_type + { + iterate_initial_type(collection_type c, rxsc::scheduler sc) + : collection(std::move(c)) + , factory(sc) + { + } + collection_type collection; + rxsc::scheduler factory; + }; + iterate_initial_type initial; + + iterate(collection_type c, rxsc::scheduler sc) + : initial(std::move(c), sc) + { + } + template + void on_subscribe(Subscriber o) { + struct iterate_state_type + : public iterate_initial_type + , public std::enable_shared_from_this + { + iterate_state_type(iterate_initial_type i, Subscriber o) + : iterate_initial_type(i) + // creates a worker whose lifetime is the same as this subscription + , controller(iterate_initial_type::factory.create_worker(o.get_subscription())) + , cursor(std::begin(iterate_initial_type::collection)) + , end(std::end(iterate_initial_type::collection)) + , out(o) + { + } + rxsc::worker controller; + iterator_type cursor; + iterator_type end; + Subscriber out; + }; + auto state = std::make_shared(initial, o); + + state->controller.schedule( + [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(); + }); + } +}; + +} + +template +auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable::value_type, detail::iterate> { + return observable::value_type, detail::iterate>( + detail::iterate(std::move(c), sc)); +} + +} + +} + +#endif diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 0ab4486..4354559 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -104,7 +104,7 @@ SCENARIO("merge completes", "[merge][join][operators]"){ REQUIRE(required == actual); } - THEN("there was one subscription and one unsubscription to the ints"){ + THEN("there was one subscription and one unsubscription to the xs"){ life items[] = { subscribe(200, 600) }; @@ -142,3 +142,114 @@ SCENARIO("merge completes", "[merge][join][operators]"){ } } } + +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(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages> mo; + typedef rxn::subscription life; + + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + typedef mo::recorded_type orecord; + auto oon_next = mo::on_next; + auto oon_completed = mo::on_completed; + auto osubscribe = mo::subscribe; + + record messages1[] = { + 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 ys1 = sc.make_cold_observable(messages1); + + record messages2[] = { + on_next(10, 201), + on_next(20, 202), + on_next(30, 203), + on_next(40, 204), + on_completed(50) + }; + auto ys2 = sc.make_cold_observable(messages2); + + record messages3[] = { + on_next(10, 301), + on_next(20, 302), + on_next(30, 303), + on_next(40, 304), + on_next(120, 305), + on_completed(150) + }; + auto ys3 = sc.make_cold_observable(messages3); + + WHEN("each int is merged"){ + + auto res = w.start( + [&]() { + return ys1 + .merge(ys2, ys3); + } + ); + + THEN("the output contains merged ints"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys1"){ + life items[] = { + subscribe(200, 430) + }; + auto required = rxu::to_vector(items); + auto actual = ys1.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys2"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = ys2.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the ys3"){ + life items[] = { + subscribe(200, 350) + }; + auto required = rxu::to_vector(items); + auto actual = ys3.subscriptions(); + REQUIRE(required == actual); + } + } + } +} -- GitLab From e5e867e52d34a9a2c82daae794aa578c21905f33 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 13:00:59 -0700 Subject: [PATCH 300/782] filter available overloads --- Rx/v2/src/rxcpp/rx-observable.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 9ecb1b3..a1b1fa0 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -401,7 +401,7 @@ public: /// template auto merge(SourceFilter&& sf) const - -> typename std::enable_if::value, + -> typename std::enable_if::value && !is_observable::value, observable::value_type, rxo::detail::merge>>::type { return observable::value_type, rxo::detail::merge>( rxo::detail::merge(*this, std::forward(sf))); @@ -412,10 +412,10 @@ public: /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto merge(ValueN... vn) const - -> observable { - return observable<>::iterate(this->as_dynamic(), vn.as_dynamic()...).merge(); + template + auto merge(Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { + return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); } /// merge -> @@ -423,10 +423,10 @@ public: /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto merge(ValueN... vn, SourceFilter&& sf) const - -> observable { - return observable<>::iterate(this->as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + template + auto merge(SourceFilter&& sf, Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { + return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); } -- GitLab From d016bf32a047eb30edbade665b86bcd6def39def Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 13:01:08 -0700 Subject: [PATCH 301/782] add all_true --- Rx/v2/src/rxcpp/rx-util.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 76b7f9e..e5bdb81 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -55,6 +55,20 @@ struct values_from typedef typename values_from::type type; }; +template +struct all_true; + +template +struct all_true +{ + static const bool value = B0; +}; +template +struct all_true +{ + static const bool value = B0 && all_true::value; +}; + namespace detail { template -- GitLab From be73a796f383181549f7df67a85a30b7eba540a8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 13:01:40 -0700 Subject: [PATCH 302/782] split input and output lifetimes --- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 60ce46a..8d1c1bb 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -53,12 +53,11 @@ class synchronize_observer : public detail::multicast_observer processor.schedule(lifetime, [keepAlive, this](const rxsc::schedulable& self){ try { std::unique_lock guard(lock); - if (!lifetime.is_subscribed() || !destination.is_subscribed()) { + if (!destination.is_subscribed()) { current = mode::Disposed; queue.clear(); guard.unlock(); lifetime.unsubscribe(); - destination.unsubscribe(); return; } if (queue.empty()) { @@ -92,35 +91,35 @@ class synchronize_observer : public detail::multicast_observer if (lifetime.is_subscribed()) { std::unique_lock guard(lock); queue.push_back(notification_type::on_next(std::move(v))); - wake.notify_one(); ensure_processing(guard); } + wake.notify_one(); } void on_error(std::exception_ptr e) const { if (lifetime.is_subscribed()) { std::unique_lock guard(lock); queue.push_back(notification_type::on_error(e)); - wake.notify_one(); ensure_processing(guard); } + wake.notify_one(); } void on_completed() const { if (lifetime.is_subscribed()) { std::unique_lock guard(lock); queue.push_back(notification_type::on_completed()); - wake.notify_one(); ensure_processing(guard); } + wake.notify_one(); } }; std::shared_ptr state; public: - synchronize_observer(rxsc::worker w, composite_subscription cs) - : base_type(cs) + synchronize_observer(rxsc::worker w, composite_subscription dl, composite_subscription il) + : base_type(dl) , state(std::make_shared( - w, cs, make_subscriber(cs, make_observer_dynamic( *static_cast(this) )))) + w, il, make_subscriber(dl, make_observer_dynamic( *static_cast(this) )))) {} template @@ -147,8 +146,8 @@ class synchronize public: explicit synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) : controller(w) - , lifetime(cs) - , s(w, cs) + , lifetime(composite_subscription()) + , s(w, cs, lifetime) { } -- GitLab From 509f94c2aefd3838db6ec107c2181fd61ea8ecf3 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 13:02:23 -0700 Subject: [PATCH 303/782] add more perf tests --- Rx/v2/test/operators/concat_map.cpp | 65 ++++++++++++++++++++++++++++- Rx/v2/test/operators/flat_map.cpp | 6 +-- Rx/v2/test/operators/merge.cpp | 43 +++++++++++++++++++ 3 files changed, 109 insertions(+), 5 deletions(-) diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index b3c0a95..322d92d 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -12,9 +12,9 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 20; +static const int static_tripletCount = 50; -SCENARIO("concat pythagorian ranges", "[hide][range][concat][pythagorian][perf]"){ +SCENARIO("concat_map pythagorian ranges", "[hide][range][concat_map][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ WHEN("generating pythagorian triplets"){ @@ -58,6 +58,67 @@ SCENARIO("concat pythagorian ranges", "[hide][range][concat][pythagorian][perf]" } } +SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map][synchronize][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rxsub::synchronize_observable(sc); + + int c = 0; + int ct = 0; + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, sc) + .concat_map( + [&c, sc, so](int z){ + return rxs::range(1, z, 1, sc) + .concat_map( + [&c, sc, z](int x){ + return rxs::range(x, z, 1, sc) + .filter([&c, z, x](int y){ + ++c; + if (x*x + y*y == z*z) { + return true;} + else { + return false;}}) + .map([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 triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + triples + .take(tripletCount) + .subscribe( + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "concat sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + } + } +} + SCENARIO("concat_map completes", "[concat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 92ab2f2..7b63664 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 20; +static const int static_tripletCount = 50; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -51,7 +51,7 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ } } -SCENARIO("pythagorian ranges", "[hide][range][pythagorian][perf]"){ +SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ WHEN("generating pythagorian triplets"){ @@ -95,7 +95,7 @@ SCENARIO("pythagorian ranges", "[hide][range][pythagorian][perf]"){ } } -SCENARIO("synchronize pythagorian ranges", "[hide][range][synchronize][pythagorian][perf]"){ +SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][synchronize][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ WHEN("generating pythagorian triplets"){ diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 4354559..77f2033 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -12,6 +12,49 @@ namespace rxt=rxcpp::test; #include "catch.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; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rxsub::synchronize_observable(sc); + + int c = 0; + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + rxs::range(0, sectionCount - 1, 1, sc) + .merge( + so, + rxs::range(sectionCount, sectionCount * 2 - 1, 1, sc), + rxs::range(sectionCount * 2, onnextcalls - 1, 1, sc)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "merge sync 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."){ -- GitLab From 6592da5dc3b4ad1136b79a3d39795bc9bd5b2dd4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 13:15:54 -0700 Subject: [PATCH 304/782] add concat overloads --- Rx/v2/src/rxcpp/rx-observable.hpp | 23 +++++++++++++++- Rx/v2/test/operators/concat.cpp | 44 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a1b1fa0..ff35040 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -495,12 +495,33 @@ public: /// template auto concat(SourceFilter&& sf) const - -> typename std::enable_if::value, + -> typename std::enable_if::value && !is_observable::value, observable::value_type, rxo::detail::concat>>::type { return observable::value_type, rxo::detail::concat>( rxo::detail::concat(*this, std::forward(sf))); } + /// concat -> + /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable subscribe to one at a time. in the order received. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto concat(Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { + return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); + } + + /// concat -> + /// The source filter can be used to syncronize sources from different contexts. + /// for each item from this observable subscribe to one at a time. in the order received. + /// for each item from all of the nested observables deliver from the new observable that is returned. + /// + template + auto concat(SourceFilter&& sf, Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { + return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); + } /// concat_map -> /// All sources must be syncronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 0df5e12..ddd6145 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -12,6 +12,50 @@ namespace rxt=rxcpp::test; #include "catch.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; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rxsub::synchronize_observable(sc); + + int c = 0; + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + rxs::range(0, sectionCount - 1, 1, sc) + .concat( + so, + rxs::range(sectionCount, sectionCount * 2 - 1, 1, sc), + rxs::range(sectionCount * 2, onnextcalls - 1, 1, sc)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(start.time_since_epoch()); + std::cout << "concat sync 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."){ -- GitLab From 8634897531a9d984e4ba62ce1b4f799ba5291436 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 17:02:30 -0700 Subject: [PATCH 305/782] add interval --- Rx/v2/src/rxcpp/rx-observable.hpp | 82 ++++++++++++++----------- Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/sources/rx-interval.hpp | 65 ++++++++++++++++++++ Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 15 +++++ Rx/v2/test/subjects/subject.cpp | 27 +++++++- 5 files changed, 151 insertions(+), 39 deletions(-) create mode 100644 Rx/v2/src/rxcpp/sources/rx-interval.hpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index ff35040..ed3a8ef 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -159,40 +159,8 @@ observable make_observable_dynamic(Source&& s) { return observable(dynamic_observable(std::forward(s))); } -// observable<> has static methods to construct observable sources and adaptors. -// observable<> is not constructable template<> -class observable -{ - ~observable(); -public: - template - static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - rxs::detail::range(first, last, step, sc)); - } - template - static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable::value_type, rxs::detail::iterate> { - return observable::value_type, rxs::detail::iterate>( - rxs::detail::iterate(std::move(c), sc)); - } - template - static auto iterate(Value0 v0, ValueN... vn) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); - } - template - static auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), sc)); - } -}; +class observable; template @@ -415,7 +383,7 @@ public: template auto merge(Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); + return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); } /// merge -> @@ -426,7 +394,7 @@ public: template auto merge(SourceFilter&& sf, Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); } @@ -509,7 +477,7 @@ public: template auto concat(Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); + return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); } /// concat -> @@ -520,7 +488,7 @@ public: template auto concat(SourceFilter&& sf, Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return observable<>::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); + return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); } /// concat_map -> /// All sources must be syncronized! This means that calls across all the subscribers must be serial. @@ -624,6 +592,46 @@ inline bool operator!=(const observable& lhs, const observabl return !(lhs == rhs); } +// observable<> has static methods to construct observable sources and adaptors. +// observable<> is not constructable +template<> +class observable +{ + ~observable(); +public: + template + static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable> { + return observable>( + rxs::detail::range(first, last, step, sc)); + } + static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable { + return observable(rxs::detail::interval(initial, period, sc)); + } + template + static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable::value_type, rxs::detail::iterate> { + return observable::value_type, rxs::detail::iterate>( + rxs::detail::iterate(std::move(c), sc)); + } + template + static auto iterate(Value0 v0, ValueN... vn) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); + } + template + static auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), sc)); + } +}; + + } // diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index a21278c..6c1f019 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -37,5 +37,6 @@ namespace rxs=sources; #include "sources/rx-range.hpp" #include "sources/rx-iterate.hpp" +#include "sources/rx-interval.hpp" #endif diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp new file mode 100644 index 0000000..235014b --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -0,0 +1,65 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +struct interval : public source_base +{ + typedef interval this_type; + + struct interval_initial_type + { + interval_initial_type(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, rxsc::scheduler sc) + : initial(i) + , period(p) + , factory(sc) + { + } + rxsc::scheduler::clock_type::time_point initial; + rxsc::scheduler::clock_type::duration period; + rxsc::scheduler factory; + }; + interval_initial_type initial; + + interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, rxsc::scheduler sc) + : initial(i, p, sc) + { + } + template + void on_subscribe(Subscriber o) { + + auto controller = initial.factory.create_worker(o.get_subscription()); + auto counter = std::make_shared(0); + + controller.schedule_periodically( + initial.initial, + initial.period, + [o, counter](const rxsc::schedulable&) { + // send next value + o.on_next(++(*counter)); + }); + } +}; + +} +/* +auto interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable { + return observable(detail::interval(i, p, sc)); +} +*/ +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 1156053..984d217 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -102,6 +102,21 @@ auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) detail::iterate(std::move(c), sc)); } +template +auto iterate(Value0 v0, ValueN... vn) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); +} +template +auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) + -> observable>> { + std::array c = {v0, vn...}; + return observable>>( + rxs::detail::iterate>(std::move(c), sc)); +} + } } diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index ea475a6..4894578 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -438,7 +438,6 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][long][perf]"){ } SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]"){ - const int& onnextcalls = static_onnextcalls; GIVEN("schedule_periodically"){ WHEN("the period is 1sec and the initial is 2sec"){ using namespace std::chrono; @@ -461,7 +460,6 @@ SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]") } SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][long][perf]"){ - const int& onnextcalls = static_onnextcalls; GIVEN("schedule_periodically_duration"){ WHEN("the period is 1sec and the initial is 2sec"){ using namespace std::chrono; @@ -504,6 +502,31 @@ SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][l } } +SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf]"){ + GIVEN("10 intervals of 1 seconds"){ + 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 start = sc.now() + seconds(2); + auto period = seconds(1); + rx::composite_subscription cs; + rx::observable<>::interval(start, period, sc) + .subscribe( + cs, + [=, &c](long counter){ + auto nsDelta = duration_cast(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 == 10) {cs.unsubscribe();} + }, + [](std::exception_ptr){abort();}); + } + } +} + SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ -- GitLab From da337adc55a7f27ef18bb9cff78317adbe4cd7a6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 17:18:15 -0700 Subject: [PATCH 306/782] move interval tests --- Rx/v2/test/sources/interval.cpp | 107 ++++++++++++++++++++++++++++++++ Rx/v2/test/subjects/subject.cpp | 89 -------------------------- projects/CMake/CMakeLists.txt | 1 + 3 files changed, 108 insertions(+), 89 deletions(-) create mode 100644 Rx/v2/test/sources/interval.cpp diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp new file mode 100644 index 0000000..dcfda47 --- /dev/null +++ b/Rx/v2/test/sources/interval.cpp @@ -0,0 +1,107 @@ + +#define RXCPP_SUBJECT_TEST_ASYNC 1 + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + + +SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]"){ + GIVEN("schedule_periodically"){ + 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 start = w.now() + seconds(2); + auto period = seconds(1); + w.schedule_periodically(start, period, + [=, &c](rxsc::schedulable scbl){ + auto nsDelta = duration_cast(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]"){ + 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(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]"){ + GIVEN("10 intervals of 1 seconds"){ + 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 start = sc.now() + seconds(2); + auto period = seconds(1); + rx::composite_subscription cs; + rx::observable<>::interval(start, period, sc) + .subscribe( + cs, + [=, &c](long counter){ + auto nsDelta = duration_cast(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();} + }, + [](std::exception_ptr){abort();}); + } + } +} diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 4894578..9664173 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -437,95 +437,6 @@ SCENARIO("range calls subject", "[hide][range][subject][subjects][long][perf]"){ } } -SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]"){ - GIVEN("schedule_periodically"){ - 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 start = w.now() + seconds(2); - auto period = seconds(1); - w.schedule_periodically(start, period, - [=, &c](rxsc::schedulable scbl){ - auto nsDelta = duration_cast(scbl.now() - (start + (period * c))); - ++c; - std::cout << "schedule_periodically : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl; - if (c == 9) {scbl.unsubscribe();} - }); - } - } -} - -SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][long][perf]"){ - 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(scbl.now() - (start + (period * c))); - ++c; - std::cout << "schedule_periodically_duration : period " << c << ", " << nsDelta.count() << "ms delta from target time" << std::endl; - if (c == 9) {scbl.unsubscribe();} - })); - } - } -} - -SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf]"){ - GIVEN("10 intervals of 1 seconds"){ - 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 start = sc.now() + seconds(2); - auto period = seconds(1); - rx::composite_subscription cs; - rx::observable<>::interval(start, period, sc) - .subscribe( - cs, - [=, &c](long counter){ - auto nsDelta = duration_cast(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 == 10) {cs.unsubscribe();} - }, - [](std::exception_ptr){abort();}); - } - } -} SCENARIO("subject - infinite source", "[subject][subjects]"){ GIVEN("a subject and an infinite source"){ diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index ac9099d..b90d170 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/sources/interval.cpp ${V2_TEST_DIR}/operators/concat.cpp ${V2_TEST_DIR}/operators/merge.cpp ${V2_TEST_DIR}/operators/lift.cpp -- GitLab From d505f3977daa97ebfad95b6364340a81a1546c26 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 18:32:58 -0700 Subject: [PATCH 307/782] add defer --- Rx/v2/src/rxcpp/rx-observable.hpp | 6 +++ Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 12 ++++- Rx/v2/src/rxcpp/sources/rx-defer.hpp | 66 +++++++++++++++++++++++ Rx/v2/test/sources/defer.cpp | 75 ++++++++++++++++++++++++++ Rx/v2/test/sources/interval.cpp | 2 - projects/CMake/CMakeLists.txt | 1 + 7 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 Rx/v2/src/rxcpp/sources/rx-defer.hpp create mode 100644 Rx/v2/test/sources/defer.cpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index ed3a8ef..2dbcfc1 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -605,6 +605,12 @@ public: return observable>( rxs::detail::range(first, last, step, sc)); } + template + static auto defer(ObservableFactory of) + -> observable::value_type, rxs::detail::defer> { + return observable::value_type, rxs::detail::defer>( + rxs::detail::defer(std::move(of))); + } static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable { return observable(rxs::detail::interval(initial, period, sc)); diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index 6c1f019..8831bf8 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -38,5 +38,6 @@ namespace rxs=sources; #include "sources/rx-range.hpp" #include "sources/rx-iterate.hpp" #include "sources/rx-interval.hpp" +#include "sources/rx-defer.hpp" #endif diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 6d3cf6f..9f01ab7 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -82,7 +82,6 @@ public: state->schedule_absolute(state->to_relative(when - now()), scbl); } - void schedule_absolute(absolute when, const schedulable& scbl) const { state->schedule_absolute(when, scbl); } @@ -138,6 +137,11 @@ public: return worker(cs, wi); } + bool is_enabled() const {return state->is_enabled();} + long clock() { + return state->clock(); + } + std::shared_ptr create_test_type_worker_interface() const { std::shared_ptr wi(new test_type_worker(state)); return wi; @@ -406,6 +410,9 @@ public: { } + 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); } @@ -501,6 +508,9 @@ public: return test_worker(cs, tester->create_test_type_worker_interface()); } + bool is_enabled() const {return tester->is_enabled();} + long clock() const {return tester->clock();} + template rxt::testable_observable make_hot_observable(std::vector>>> messages) const{ return tester->make_hot_observable(std::move(messages)); diff --git a/Rx/v2/src/rxcpp/sources/rx-defer.hpp b/Rx/v2/src/rxcpp/sources/rx-defer.hpp new file mode 100644 index 0000000..cfeaf4a --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-defer.hpp @@ -0,0 +1,66 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct defer_traits +{ + typedef typename std::decay::type observable_factory_type; + typedef decltype((*(observable_factory_type*)nullptr)()) collection_type; + typedef typename collection_type::value_type value_type; +}; + +template +struct defer : public source_base::value_type> +{ + typedef defer this_type; + typedef defer_traits 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 + void on_subscribe(Subscriber o) { + + auto selectedCollection = on_exception( + [this](){return this->observable_factory();}, + o); + if (selectedCollection.empty()) { + return; + } + + selectedCollection->subscribe(o); + } +}; + +} + +template +auto defer(ObservableFactory of) + -> observable::value_type, detail::defer> { + return observable::value_type, detail::defer>( + detail::defer(std::move(of))); +} + +} + +} + +#endif diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp new file mode 100644 index 0000000..290849b --- /dev/null +++ b/Rx/v2/test/sources/defer.cpp @@ -0,0 +1,75 @@ + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +SCENARIO("defer stops on completion", "[defer][operators]"){ + GIVEN("a test cold observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxn::subscription life; + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_error = m::on_error; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + long invoked = 0; + + rxu::detail::maybe> xs; + + WHEN("deferred"){ + + auto res = w.start( + [&]() { + return rx::observable<>::defer( + [&](){ + invoked++; + record messages[] = { + on_next(100, sc.clock()), + on_completed(200) + }; + xs.reset(sc.make_cold_observable(messages)); + return xs.get(); + }) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output stops on completion"){ + record items[] = { + on_next(300, 200L), + on_completed(400) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription"){ + life items[] = { + subscribe(200, 400) + }; + auto required = rxu::to_vector(items); + auto actual = xs.get().subscriptions(); + REQUIRE(required == actual); + } + + THEN("defer was called until completed"){ + REQUIRE(1 == invoked); + } + } + } +} diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index dcfda47..73ce4c8 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -1,6 +1,4 @@ -#define RXCPP_SUBJECT_TEST_ASYNC 1 - #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b90d170..0e5dbf5 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/sources/defer.cpp ${V2_TEST_DIR}/sources/interval.cpp ${V2_TEST_DIR}/operators/concat.cpp ${V2_TEST_DIR}/operators/merge.cpp -- GitLab From 3207f0caf1fa8314d3ef93bace7a7b9aec35807f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 18:53:50 -0700 Subject: [PATCH 308/782] add never --- Rx/v2/src/rxcpp/rx-observable.hpp | 5 ++++ Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/sources/rx-never.hpp | 36 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 Rx/v2/src/rxcpp/sources/rx-never.hpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 2dbcfc1..7785fd8 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -605,6 +605,11 @@ public: return observable>( rxs::detail::range(first, last, step, sc)); } + template + static auto never() + -> observable> { + return observable>(rxs::detail::never()); + } template static auto defer(ObservableFactory of) -> observable::value_type, rxs::detail::defer> { diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index 8831bf8..967b05d 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -39,5 +39,6 @@ namespace rxs=sources; #include "sources/rx-iterate.hpp" #include "sources/rx-interval.hpp" #include "sources/rx-defer.hpp" +#include "sources/rx-never.hpp" #endif diff --git a/Rx/v2/src/rxcpp/sources/rx-never.hpp b/Rx/v2/src/rxcpp/sources/rx-never.hpp new file mode 100644 index 0000000..2dae656 --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-never.hpp @@ -0,0 +1,36 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct never : public source_base +{ + template + void on_subscribe(Subscriber o) { + } +}; + +} + +template +auto never() + -> observable> { + return observable>(detail::never()); +} + +} + +} + +#endif -- GitLab From 7dabdfeefc046a6af638a435525571dccd6d1b4e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 19:23:13 -0700 Subject: [PATCH 309/782] add empty, just and from --- Rx/v2/src/rxcpp/rx-observable.hpp | 26 +++++++++++++++++++------- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 18 ++++++++++++++++-- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 7785fd8..36a470d 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -383,7 +383,7 @@ public: template auto merge(Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); } /// merge -> @@ -394,7 +394,7 @@ public: template auto merge(SourceFilter&& sf, Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); } @@ -477,7 +477,7 @@ public: template auto concat(Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); } /// concat -> @@ -488,7 +488,7 @@ public: template auto concat(SourceFilter&& sf, Value0 v0, ValueN... vn) const -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::iterate(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); } /// concat_map -> /// All sources must be syncronized! This means that calls across all the subscribers must be serial. @@ -622,24 +622,36 @@ public: } template static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable::value_type, rxs::detail::iterate> { + -> typename std::enable_if::value, + observable::value_type, rxs::detail::iterate>>::type { return observable::value_type, rxs::detail::iterate>( rxs::detail::iterate(std::move(c), sc)); } template - static auto iterate(Value0 v0, ValueN... vn) + static auto from(Value0 v0, ValueN... vn) -> observable>> { std::array c = {v0, vn...}; return observable>>( rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); } template - static auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) + static auto from(Value0 v0, ValueN... vn, rxsc::scheduler sc) -> observable>> { std::array c = {v0, vn...}; return observable>>( rxs::detail::iterate>(std::move(c), sc)); } + template + static auto empty(rxsc::scheduler sc = rxsc::make_current_thread()) + -> observable>> { + std::array c; + return observable>>(rxs::detail::iterate>(std::move(c), sc)); + } + template + static auto just(T v, rxsc::scheduler sc = rxsc::make_current_thread()) + -> decltype(from(v)) { + return from(v); + } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 984d217..bedfe5a 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -13,6 +13,20 @@ namespace sources { namespace detail { +template +struct is_iterable +{ + typedef typename std::decay::type collection_type; + + struct not_void {}; + template + static auto check(int) -> decltype(std::begin(*(CC*)nullptr)); + template + static not_void check(...); + + static const bool value = !std::is_same(0)), not_void>::value; +}; + template struct iterate_traits { @@ -103,14 +117,14 @@ auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) } template -auto iterate(Value0 v0, ValueN... vn) +auto from(Value0 v0, ValueN... vn) -> observable>> { std::array c = {v0, vn...}; return observable>>( rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); } template -auto iterate(Value0 v0, ValueN... vn, rxsc::scheduler sc) +auto from(Value0 v0, ValueN... vn, rxsc::scheduler sc) -> observable>> { std::array c = {v0, vn...}; return observable>>( -- GitLab From 9aeba68fd4b8c6f4a2d2b6df71c56bdb9907f3f7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 1 Jun 2014 20:18:48 -0700 Subject: [PATCH 310/782] add error --- Rx/v2/src/rxcpp/rx-observable.hpp | 45 ++++++------- Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/sources/rx-error.hpp | 87 +++++++++++++++++++++++++ Rx/v2/src/rxcpp/sources/rx-interval.hpp | 1 + 4 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 Rx/v2/src/rxcpp/sources/rx-error.hpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 36a470d..86e3f02 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -601,20 +601,18 @@ class observable public: template static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - rxs::detail::range(first, last, step, sc)); + -> decltype(rxs::range(first, last, step, sc)) { + return rxs::range(first, last, step, sc); } template static auto never() - -> observable> { - return observable>(rxs::detail::never()); + -> decltype(rxs::never()) { + return rxs::never(); } template static auto defer(ObservableFactory of) - -> observable::value_type, rxs::detail::defer> { - return observable::value_type, rxs::detail::defer>( - rxs::detail::defer(std::move(of))); + -> decltype(rxs::defer(std::move(of))) { + return rxs::defer(std::move(of)); } static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, rxsc::scheduler sc = rxsc::make_current_thread()) -> observable { @@ -622,35 +620,34 @@ public: } template static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) - -> typename std::enable_if::value, - observable::value_type, rxs::detail::iterate>>::type { - return observable::value_type, rxs::detail::iterate>( - rxs::detail::iterate(std::move(c), sc)); + -> decltype(rxs::iterate(std::move(c), sc)) { + return rxs::iterate(std::move(c), sc); } template static auto from(Value0 v0, ValueN... vn) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); + -> decltype(rxs::from(v0, vn...)) { + return rxs::from(v0, vn...); } template static auto from(Value0 v0, ValueN... vn, rxsc::scheduler sc) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), sc)); + -> decltype(rxs::from(v0, vn..., sc)) { + return rxs::from(v0, vn..., sc); } template - static auto empty(rxsc::scheduler sc = rxsc::make_current_thread()) + static auto empty(rxsc::scheduler sc = rxsc::make_immediate()) -> observable>> { std::array c; return observable>>(rxs::detail::iterate>(std::move(c), sc)); } template - static auto just(T v, rxsc::scheduler sc = rxsc::make_current_thread()) - -> decltype(from(v)) { - return from(v); + static auto just(T v, rxsc::scheduler sc = rxsc::make_immediate()) + -> decltype(rxs::from(v, sc)) { + return rxs::from(v, sc); + } + template + static auto error(Exception&& e, rxsc::scheduler sc = rxsc::make_immediate()) + -> observable> { + return rxs::error(std::forward(e), sc); } }; diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index 967b05d..b4205ff 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -40,5 +40,6 @@ namespace rxs=sources; #include "sources/rx-interval.hpp" #include "sources/rx-defer.hpp" #include "sources/rx-never.hpp" +#include "sources/rx-error.hpp" #endif diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp new file mode 100644 index 0000000..1e5e19f --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -0,0 +1,87 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct error : public source_base +{ + typedef error this_type; + + struct error_initial_type + { + error_initial_type(std::exception_ptr e, rxsc::scheduler sc) + : exception(e) + , factory(sc) + { + } + std::exception_ptr exception; + rxsc::scheduler factory; + }; + error_initial_type initial; + + error(std::exception_ptr e, rxsc::scheduler sc) + : initial(e, sc) + { + } + + template + void on_subscribe(Subscriber o) { + + // creates a worker whose lifetime is the same as this subscription + auto controller = initial.factory.create_worker(o.get_subscription()); + auto exception = initial.exception; + + controller.schedule( + [=](const rxsc::schedulable&){ + if (!o.is_subscribed()) { + // terminate loop + return; + } + + o.on_error(exception); + // o is unsubscribed + }); + } +}; + +struct throw_ptr_tag{}; +struct throw_instance_tag{}; + +template +auto make_error(throw_ptr_tag&&, std::exception_ptr exception, rxsc::scheduler scheduler) + -> observable> { + return observable>(error(std::move(exception), std::move(scheduler))); +} + +template +auto make_error(throw_instance_tag&&, E e, rxsc::scheduler scheduler) + -> observable> { + std::exception_ptr exception; + try {throw e;} catch(...) {exception = std::current_exception();} + return observable>(error(std::move(exception), std::move(scheduler))); +} + +} + +template +auto error(E e, rxsc::scheduler sc = rxsc::make_current_thread()) + -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(sc))) { + return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(sc)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 235014b..8a50256 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -38,6 +38,7 @@ struct interval : public source_base template void on_subscribe(Subscriber o) { + // creates a worker whose lifetime is the same as this subscription auto controller = initial.factory.create_worker(o.get_subscription()); auto counter = std::make_shared(0); -- GitLab From 051c265bd754739d4ddfff4573ffa466e9422fde Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Jun 2014 23:35:03 -0700 Subject: [PATCH 311/782] fix lifetime issue --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index e892828..fbcc331 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -37,7 +37,8 @@ class multicast_observer : public std::enable_shared_from_this { explicit state_type(composite_subscription cs) - : current(mode::Casting) + : generation(0) + , current(mode::Casting) , lifetime(cs) { } @@ -102,6 +103,7 @@ public: { } bool has_observers() const { + std::unique_lock guard(b->state->lock); return b->current_completer && !b->current_completer->observers.empty(); } void add(observer_type o) const { @@ -160,6 +162,7 @@ public: b->state->current = mode::Errored; auto s = b->state->lifetime; auto c = std::move(b->completer); + ++b->state->generation; guard.unlock(); if (c) { for (auto& o : c->observers) { @@ -177,6 +180,7 @@ public: b->state->current = mode::Completed; auto s = b->state->lifetime; auto c = std::move(b->completer); + ++b->state->generation; guard.unlock(); if (c) { for (auto& o : c->observers) { @@ -219,8 +223,9 @@ public: } observable get_observable() const { - return make_observable_dynamic([this](subscriber o){ - this->s.add(std::move(o)); + auto keepAlive = s; + return make_observable_dynamic([=](subscriber o){ + keepAlive.add(std::move(o)); }); } }; -- GitLab From 13c4044274c875a251d86a691e14ef52e648a694 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 7 Jun 2014 23:35:45 -0700 Subject: [PATCH 312/782] perf improvements --- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 2 +- .../rxcpp/operators/rx-connect_forever.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 88 +++++----- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-map.hpp | 119 ++++++-------- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-multicast.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 2 +- Rx/v2/src/rxcpp/rx-observable.hpp | 25 ++- Rx/v2/src/rxcpp/rx-scheduler.hpp | 12 +- .../src/rxcpp/schedulers/rx-currentthread.hpp | 36 ++-- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 4 +- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 17 ++ Rx/v2/src/rxcpp/sources/rx-defer.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-error.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 42 +++-- Rx/v2/src/rxcpp/sources/rx-never.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-range.hpp | 2 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 14 +- Rx/v2/test/operators/concat.cpp | 4 +- Rx/v2/test/operators/concat_map.cpp | 4 +- Rx/v2/test/operators/flat_map.cpp | 4 +- Rx/v2/test/operators/merge.cpp | 9 +- Rx/v2/test/subscriptions/subscription.cpp | 154 ++++++++++++++++++ 29 files changed, 368 insertions(+), 198 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index c96514a..fb896e7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -43,7 +43,7 @@ struct concat } template - void on_subscribe(Subscriber&& scbr) { + void on_subscribe(Subscriber&& scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); typedef typename std::decay::type output_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 3ca8f70..7bb0b6d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -87,7 +87,7 @@ struct concat_map } template - void on_subscribe(Subscriber&& scbr) { + void on_subscribe(Subscriber&& scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); typedef typename std::decay::type output_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp index 35e000f..b38aa08 100644 --- a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp @@ -27,7 +27,7 @@ struct connect_forever : public operator_base } template - void on_subscribe(Subscriber&& o) { + void on_subscribe(Subscriber&& o) const { source.subscribe(std::forward(o)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index b220615..ae768c7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -13,50 +13,61 @@ namespace operators { namespace detail { -template -struct filter : public operator_base +template +struct filter { - typedef typename std::decay::type source_type; + typedef typename std::decay::type source_value_type; typedef typename std::decay::type test_type; - source_type source; test_type test; - template - static auto check(int) -> decltype((*(CP*)nullptr)(*(CT*)nullptr)); - template - static void check(...); - filter(source_type o, test_type p) - : source(std::move(o)) - , test(std::move(p)) + filter(test_type t) + : test(std::move(t)) { - static_assert(std::is_convertible(0)), bool>::value, "filter Predicate must be a function with the signature bool(T)"); } + template - void on_subscribe(const Subscriber& o) { - source.subscribe( - o, - // on_next - [this, o](T t) { - bool filtered = false; - try { - filtered = !this->test(t); - } catch(...) { - o.on_error(std::current_exception()); - return; - } - if (!filtered) { - o.on_next(t); - } - }, - // on_error - [o](std::exception_ptr e) { - o.on_error(e); - }, - // on_completed - [o]() { - o.on_completed(); + struct filter_observer : public observer_base + { + typedef filter_observer this_type; + typedef observer_base base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + test_type test; + + filter_observer(dest_type d, test_type t) + : dest(d) + , test(t) + { + } + void on_next(source_value_type v) const { + auto filtered = on_exception([&](){ + return !this->test(v);}, + dest); + if (filtered.empty()) { + return; + } + if (!filtered.get()) { + dest.on_next(v); } - ); + } + void on_error(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static subscriber make(dest_type d, test_type t) { + return make_subscriber(d, this_type(d, std::move(t))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(filter_observer::make(std::move(dest), test)) { + return filter_observer::make(std::move(dest), test); } }; @@ -69,9 +80,8 @@ public: filter_factory(test_type p) : predicate(std::move(p)) {} template auto operator()(Observable&& source) - -> observable::type::value_type, filter::type::value_type, Observable, Predicate>> { - return observable::type::value_type, filter::type::value_type, Observable, Predicate>>( - filter::type::value_type, Observable, Predicate>(std::forward(source), std::move(predicate))); + -> decltype(source.lift(filter::type::value_type, test_type>(predicate))) { + return source.lift(filter::type::value_type, test_type>(predicate)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index f120bf7..8943011 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -87,7 +87,7 @@ struct flat_map } template - void on_subscribe(Subscriber&& scbr) { + void on_subscribe(Subscriber&& scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); typedef typename std::decay::type output_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index ae0a581..80748b3 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -62,8 +62,8 @@ struct lift : public operator_base - void on_subscribe(const Subscriber& o) const { - source.on_subscribe(chain(o)); + void on_subscribe(Subscriber o) const { + source.on_subscribe(chain(std::move(o))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 82825ee..eda923a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -13,82 +13,62 @@ namespace operators { namespace detail { -template + +template struct map - : public operator_base { - typedef map this_type; - - typedef typename std::decay::type source_type; + typedef typename std::decay::type source_value_type; typedef typename std::decay::type select_type; + select_type selector; - struct values - { - values(source_type o, select_type s) - : source(std::move(o)) - , select(std::move(s)) - { - } - source_type source; - select_type select; - }; - values initial; - - typedef typename Observable::value_type source_value_type; - - struct tag_not_valid {}; - template - static auto check(int) -> decltype((*(CP*)nullptr)(*(CF*)nullptr)); - template - static tag_not_valid check(...); - - static_assert(!std::is_same(0)), tag_not_valid>::value, "map Selector must be a function with the signature map::value_type(map::source_value_type)"); - - map(source_type o, select_type s) - : initial(std::move(o), std::move(s)) + map(select_type s) + : selector(std::move(s)) { } template - void on_subscribe(const Subscriber& o) { - - typedef Subscriber output_type; - struct state_type - : public std::enable_shared_from_this - , public values + struct map_observer : public observer_base + { + typedef map_observer this_type; + typedef observer_base base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + select_type selector; + + map_observer(dest_type d, select_type s) + : dest(std::move(d)) + , selector(std::move(s)) { - state_type(values i, output_type oarg) - : values(std::move(i)) - , out(std::move(oarg)) - { - } - output_type out; - }; - // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::move(o))); - - state->source.subscribe( - state->out, - // on_next - [state](typename this_type::source_value_type st) { - util::detail::maybe selected; - try { - selected.reset(state->select(st)); - } catch(...) { - state->out.on_error(std::current_exception()); - return; - } - state->out.on_next(std::move(*selected)); - }, - // on_error - [state](std::exception_ptr e) { - state->out.on_error(e); - }, - // on_completed - [state]() { - state->out.on_completed(); + } + void on_next(source_value_type v) const { + auto selected = on_exception( + [&](){ + return this->selector(std::move(v));}, + dest); + if (selected.empty()) { + return; } - ); + dest.on_next(std::move(selected.get())); + } + void on_error(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static subscriber make(dest_type d, select_type s) { + auto cs = d.get_subscription(); + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(s))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(map_observer::make(std::move(dest), selector)) { + return map_observer::make(std::move(dest), selector); } }; @@ -98,12 +78,11 @@ class map_factory typedef typename std::decay::type select_type; select_type selector; public: - map_factory(select_type p) : selector(std::move(p)) {} + map_factory(select_type s) : selector(std::move(s)) {} template auto operator()(Observable&& source) - -> observable::value_type, map> { - return observable::value_type, map>( - map(std::forward(source), std::move(selector))); + -> decltype(source.lift(map::type::value_type, select_type>(selector))) { + return source.lift(map::type::value_type, select_type>(selector)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 382e17a..40443b7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -41,7 +41,7 @@ struct merge : public operator_base::type::value } template - void on_subscribe(Subscriber&& scbr) { + void on_subscribe(Subscriber&& scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); typedef typename std::decay::type output_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp index 7f25071..966bfa3 100644 --- a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp @@ -38,10 +38,10 @@ struct multicast : public operator_base { } template - void on_subscribe(Subscriber&& o) { + void on_subscribe(Subscriber&& o) const { state->subject_value.get_observable().subscribe(std::forward(o)); } - void on_connect(composite_subscription cs) { + void on_connect(composite_subscription cs) const { if (state->connection.empty()) { auto destination = state->subject_value.get_subscriber(); diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp index c289790..9cc3354 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -39,7 +39,7 @@ struct ref_count : public operator_base } template - void on_subscribe(Subscriber&& o) { + void on_subscribe(Subscriber&& o) const { std::unique_lock guard(state->lock); auto needConnect = ++state->subscribers == 1; auto keepAlive = state; diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index 2b2f5b7..46bca55 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -46,7 +46,7 @@ struct take : public operator_base }; template - void on_subscribe(const Subscriber& s) { + void on_subscribe(const Subscriber& s) const { typedef Subscriber output_type; struct state_type diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 3800804..963855e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -50,7 +50,7 @@ struct take_until : public operator_base }; template - void on_subscribe(const Subscriber& s) { + void on_subscribe(const Subscriber& s) const { typedef Subscriber output_type; struct take_until_state_type diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 86e3f02..f4a211b 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -182,11 +182,10 @@ private: friend bool operator==(const observable&, const observable&); template - auto detail_subscribe(Subscriber&& scrbr) const + auto detail_subscribe(Subscriber o) const -> composite_subscription { typedef typename std::decay::type subscriber_type; - subscriber_type o = std::forward(scrbr); static_assert(is_observer::value, "subscribe must be passed an observer"); static_assert(std::is_same::value && std::is_convertible::value, "the value types in the sequence must match or be convertible"); @@ -196,7 +195,7 @@ private: return o.get_subscription(); } - auto safe_subscribe = [=]() { + auto safe_subscribe = [&]() { try { source_operator.on_subscribe(o); } @@ -211,9 +210,9 @@ private: // make sure to let current_thread take ownership of the thread as early as possible. if (rxsc::current_thread::is_schedule_required()) { - auto sc = rxsc::make_current_thread(); + const auto& sc = rxsc::make_current_thread(); sc.create_worker(o.get_subscription()).schedule( - [=](const rxsc::schedulable& scbl) { + [&](const rxsc::schedulable& scbl) { safe_subscribe(); }); } else { @@ -304,18 +303,17 @@ public: /// template auto subscribe(Arg0&& a0, ArgN&&... an) const - -> decltype(detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...))) { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); + -> composite_subscription { + return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); } /// filter (AKA Where) -> /// for each item from this observable use Predicate to select which items to emit from the new observable that is returned. /// template - auto filter(Predicate&& p) const - -> observable> { - return observable>( - rxo::detail::filter(*this, std::forward(p))); + auto filter(Predicate p) const + -> decltype(lift(rxo::detail::filter(std::move(p)))) { + return lift(rxo::detail::filter(std::move(p))); } /// map (AKA Select) -> @@ -323,9 +321,8 @@ public: /// template auto map(Selector&& s) const - -> observable::value_type, rxo::detail::map> { - return observable::value_type, rxo::detail::map>( - rxo::detail::map(*this, std::forward(s))); + -> decltype(lift(rxo::detail::map(std::move(s)))) { + return lift(rxo::detail::map(std::move(s))); } template::value> diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index d945e17..5205907 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -464,27 +464,27 @@ public: /// action and worker share lifetime schedulable(worker q, action a) : lifetime(q.get_subscription()) - , controller(q) + , controller(std::move(q)) , activity(std::move(a)) , scoped(false) { } /// action and worker have independent lifetimes schedulable(composite_subscription cs, worker q, action a) - : lifetime(cs) - , controller(q) + : lifetime(std::move(cs)) + , controller(std::move(q)) , activity(std::move(a)) , scoped(true) - , action_scope(q.add(cs)) + , action_scope(controller.add(lifetime)) { } /// inherit lifetimes schedulable(schedulable scbl, worker q, action a) : lifetime(scbl.get_subscription()) - , controller(q) + , controller(std::move(q)) , activity(std::move(a)) , scoped(scbl.scoped) - , action_scope(scbl.scoped ? q.add(scbl.get_subscription()) : weak_subscription()) + , action_scope(scbl.scoped ? controller.add(lifetime) : weak_subscription()) { } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 6c87bdd..06e81ed 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -38,8 +38,11 @@ private: public: - static std::shared_ptr get_worker_interface() { - return !!current_thread_queue() ? current_thread_queue()->w : std::shared_ptr(); + static bool owned() { + return !!current_thread_queue(); + } + static const std::shared_ptr& get_worker_interface() { + return current_thread_queue()->w; } static recursion& get_recursion() { return current_thread_queue()->r; @@ -153,11 +156,9 @@ private: { private: typedef current_thread this_type; - composite_subscription lifetime; current_worker(const this_type&); public: - explicit current_worker(composite_subscription cs) - : lifetime(std::move(cs)) + current_worker() { } virtual ~current_worker() @@ -178,11 +179,11 @@ private: } { - auto wi = queue::get_worker_interface(); // check ownership - if (!!wi) { + if (queue::owned()) { // already has an owner - delegate - return worker(lifetime, wi).schedule(when, scbl); + queue::get_worker_interface()->schedule(when, scbl); + return; } // take ownership @@ -193,9 +194,14 @@ private: queue::destroy(); }); - queue::push(queue::item_type(when, scbl)); - const auto& recursor = queue::get_recursion().get_recurse(); + std::this_thread::sleep_until(when); + if (scbl.is_subscribed()) { + scbl(recursor); + } + if (queue::empty()) { + return; + } // loop until queue is empty for ( @@ -218,15 +224,18 @@ private: } }; + std::shared_ptr wi; + public: current_thread() + : wi(new current_worker()) { } virtual ~current_thread() { } - static bool is_schedule_required() { return !queue::get_worker_interface(); } + static bool is_schedule_required() { return !queue::owned(); } inline bool is_tail_recursion_allowed() const { return queue::empty(); @@ -237,12 +246,11 @@ public: } virtual worker create_worker(composite_subscription cs) const { - std::shared_ptr wi(new current_worker(cs)); - return worker(cs, wi); + return worker(std::move(cs), wi); } }; -inline scheduler make_current_thread() { +inline const scheduler& make_current_thread() { static auto ct = make_scheduler(); return ct; } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index 1710fb7..73592ec 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -68,11 +68,11 @@ public: } virtual worker create_worker(composite_subscription cs) const { - return worker(cs, wi); + return worker(std::move(cs), wi); } }; -inline scheduler make_immediate() { +inline const scheduler& make_immediate() { static auto i = make_scheduler(); return i; } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index 89a0a12..4144053 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -23,6 +23,9 @@ private: { private: typedef new_worker this_type; + + typedef detail::action_queue queue; + new_worker(const this_type&); struct new_worker_state : public std::enable_shared_from_this @@ -65,6 +68,12 @@ private: virtual ~new_worker() { } + + explicit new_worker(std::shared_ptr ws) + : state(ws) + { + } + new_worker(composite_subscription cs, thread_factory& tf) : state(std::make_shared(cs)) { @@ -75,6 +84,14 @@ private: }); state->worker = tf([keepAlive](){ + + // take ownership + queue::ensure(std::make_shared(keepAlive)); + // release ownership + RXCPP_UNWIND_AUTO([]{ + queue::destroy(); + }); + for(;;) { std::unique_lock guard(keepAlive->lock); if (keepAlive->queue.empty()) { diff --git a/Rx/v2/src/rxcpp/sources/rx-defer.hpp b/Rx/v2/src/rxcpp/sources/rx-defer.hpp index cfeaf4a..5aef7ef 100644 --- a/Rx/v2/src/rxcpp/sources/rx-defer.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-defer.hpp @@ -37,7 +37,7 @@ struct defer : public source_base::valu { } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { auto selectedCollection = on_exception( [this](){return this->observable_factory();}, diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index 1e5e19f..aa8d89c 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -36,7 +36,7 @@ struct error : public source_base } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { // creates a worker whose lifetime is the same as this subscription auto controller = initial.factory.create_worker(o.get_subscription()); diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 8a50256..5b77e90 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -36,7 +36,7 @@ struct interval : public source_base { } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { // creates a worker whose lifetime is the same as this subscription auto controller = initial.factory.create_worker(o.get_subscription()); diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index bedfe5a..dc5be36 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -57,46 +57,52 @@ struct iterate : public source_base::value_t iterate_initial_type initial; iterate(collection_type c, rxsc::scheduler sc) - : initial(std::move(c), sc) + : initial(std::move(c), std::move(sc)) { } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { struct iterate_state_type : public iterate_initial_type - , public std::enable_shared_from_this { - iterate_state_type(iterate_initial_type i, Subscriber o) + iterate_state_type(const iterate_initial_type& i, Subscriber o) : iterate_initial_type(i) - // creates a worker whose lifetime is the same as this subscription - , controller(iterate_initial_type::factory.create_worker(o.get_subscription())) , cursor(std::begin(iterate_initial_type::collection)) , end(std::end(iterate_initial_type::collection)) - , out(o) + , out(std::move(o)) { } - rxsc::worker controller; - iterator_type cursor; + 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; - Subscriber out; + mutable Subscriber out; }; - auto state = std::make_shared(initial, o); + iterate_state_type state(initial, std::move(o)); + + // creates a worker whose lifetime is the same as this subscription + auto controller = state.factory.create_worker(state.out.get_subscription()); - state->controller.schedule( + controller.schedule( [state](const rxsc::schedulable& self){ - if (!state->out.is_subscribed()) { + if (!state.out.is_subscribed()) { // terminate loop return; } - if (state->cursor != state->end) { + if (state.cursor != state.end) { // send next value - state->out.on_next(*state->cursor); - ++state->cursor; + state.out.on_next(*state.cursor); + ++state.cursor; } - if (state->cursor == state->end) { - state->out.on_completed(); + if (state.cursor == state.end) { + state.out.on_completed(); // o is unsubscribed return; } diff --git a/Rx/v2/src/rxcpp/sources/rx-never.hpp b/Rx/v2/src/rxcpp/sources/rx-never.hpp index 2dae656..22b6c24 100644 --- a/Rx/v2/src/rxcpp/sources/rx-never.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-never.hpp @@ -17,7 +17,7 @@ template struct never : public source_base { template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 9edc451..c8c4ae0 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -33,7 +33,7 @@ struct range : public source_base init.sc = sc; } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { auto state = std::make_shared(init); // creates a worker whose lifetime is the same as this subscription state->w = state->sc.create_worker(o.get_subscription()); diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 8d1c1bb..f7f9b78 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -79,10 +79,10 @@ class synchronize_observer : public detail::multicast_observer } synchronize_observer_state(rxsc::worker w, composite_subscription cs, subscriber scbr) - : lifetime(cs) - , processor(w) + : lifetime(std::move(cs)) + , processor(std::move(w)) , current(mode::Empty) - , destination(scbr) + , destination(std::move(scbr)) { } @@ -119,7 +119,7 @@ public: synchronize_observer(rxsc::worker w, composite_subscription dl, composite_subscription il) : base_type(dl) , state(std::make_shared( - w, il, make_subscriber(dl, make_observer_dynamic( *static_cast(this) )))) + std::move(w), std::move(il), make_subscriber(dl, make_observer_dynamic( *static_cast(this) )))) {} template @@ -139,15 +139,13 @@ public: template class synchronize { - rxsc::worker controller; composite_subscription lifetime; detail::synchronize_observer s; public: explicit synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) - : controller(w) - , lifetime(composite_subscription()) - , s(w, cs, lifetime) + : lifetime(composite_subscription()) + , s(std::move(w), std::move(cs), lifetime) { } diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index ddd6145..864166c 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -29,7 +29,7 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" //auto sc = rxsc::make_new_thread(); auto so = rxsub::synchronize_observable(sc); - int c = 0; + std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); @@ -46,7 +46,7 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" wake.notify_one();}); std::unique_lock guard(lock); - wake.wait(guard); + wake.wait(guard, [&](){return c == onnextcalls;}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 322d92d..058a645 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -73,7 +73,7 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] auto so = rxsub::synchronize_observable(sc); int c = 0; - int ct = 0; + std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -109,7 +109,7 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] wake.notify_one();}); std::unique_lock guard(lock); - wake.wait(guard); + wake.wait(guard, [&](){return ct == tripletCount;}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 7b63664..cb9b2a0 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -110,7 +110,7 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn auto so = rxsub::synchronize_observable(sc); int c = 0; - int ct = 0; + std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -146,7 +146,7 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn wake.notify_one();}); std::unique_lock guard(lock); - wake.wait(guard); + wake.wait(guard, [&](){return ct == tripletCount;}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 77f2033..931d26f 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -29,24 +29,25 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ //auto sc = rxsc::make_new_thread(); auto so = rxsub::synchronize_observable(sc); - int c = 0; + std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); rxs::range(0, sectionCount - 1, 1, sc) .merge( so, - rxs::range(sectionCount, sectionCount * 2 - 1, 1, sc), + rxs::range(sectionCount, (sectionCount * 2) - 1, 1, sc), rxs::range(sectionCount * 2, onnextcalls - 1, 1, sc)) .subscribe( [&c](int x){ ++c;}, [](std::exception_ptr){abort();}, [&](){ - wake.notify_one();}); + wake.notify_one(); + }); std::unique_lock guard(lock); - wake.wait(guard); + wake.wait(guard, [&](){return c == onnextcalls;}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index f2959f7..1c040ba 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -1,8 +1,162 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; +namespace rxs=rx::rxs; +namespace rxsc=rx::rxsc; #include "catch.hpp" +static const int static_subscriptions = 500000; + +SCENARIO("for loop subscribes", "[hide][for][just][subscribe][long][perf]"){ + const int& subscriptions = static_subscriptions; + GIVEN("a for loop"){ + WHEN("subscribe 10 million 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) { + return (std::stringstream() << i).str(); + //return std::string("1"); + }) + .map([](const std::string& s) { + int i; + std::stringstream(s) >> i; + return i; + //return 1; + }) + .subscribe([&](int i){ + ++c; + }); + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + std::cout << "loop subscribe : " << 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", "[hide][subscribe][range][synchronize][long][perf]"){ + GIVEN("range"){ + WHEN("syncronized"){ + using namespace std::chrono; + typedef steady_clock clock; + + auto sc = rxsc::make_current_thread(); + auto w = sc.create_worker(); + + auto el = rxsc::make_event_loop(); + + int runs = 10; + + auto loop = [&](const rxsc::schedulable& self) { + std::atomic c(0); + int n = 1; + auto liftrequirecompletion = [&](rx::subscriber dest){ + auto completionstate = std::make_shared>>(0, std::move(dest)); + completionstate->second.add([=](){ + if (completionstate->first != 500) { + abort(); + } + }); + // VS2013 deduction issue requires dynamic (type-forgetting) + return rx::make_subscriber( + completionstate->second, + rx::make_observer_dynamic( + [=](int n){ + ++completionstate->first; + completionstate->second.on_next(n); + }, + [=](std::exception_ptr e){ + abort(); + completionstate->second.on_error(e); + }, + [=](){ + if (completionstate->first != 500) { + abort(); + } + completionstate->second.on_completed(); + })); + }; + auto start = clock::now(); + auto ew = el.create_worker(); + std::atomic v(0); + auto s0 = rxs::range(0, 499, 1, el) + .lift(liftrequirecompletion) + .as_dynamic() + .synchronize(ew) + .ref_count() + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + auto s1 = rxs::range(500, 999, 1, el) + .lift(liftrequirecompletion) + .as_dynamic() + .synchronize(ew) + .ref_count() + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + auto s2 = rxs::range(1000, 1499, 1, el) + .lift(liftrequirecompletion) + .as_dynamic() + .synchronize(ew) + .ref_count() + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + while(v != 1500 || c != 3); + s0.unsubscribe(); + s1.unsubscribe(); + s2.unsubscribe(); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + std::cout << "range syncronize : " << 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 empty = [](){}; -- GitLab From ad9bfc24a045559e521d6d2eafde22813e449466 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 4 Jun 2014 16:43:41 -0700 Subject: [PATCH 313/782] remove regulator, add coordination --- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 63 +++--- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 70 ++++--- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 70 ++++--- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 62 +++--- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 58 +++--- Rx/v2/src/rxcpp/rx-coordination.hpp | 158 +++++++++++++++ Rx/v2/src/rxcpp/rx-includes.hpp | 2 +- Rx/v2/src/rxcpp/rx-observable.hpp | 171 ++++++++-------- Rx/v2/src/rxcpp/rx-regulator.hpp | 101 ---------- Rx/v2/src/rxcpp/rx-scheduler.hpp | 6 + Rx/v2/src/rxcpp/rx-subscriber.hpp | 196 +++---------------- Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp | 53 +++++ Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 93 +++++---- Rx/v2/test/operators/concat.cpp | 2 +- Rx/v2/test/operators/concat_map.cpp | 4 +- Rx/v2/test/operators/flat_map.cpp | 4 +- Rx/v2/test/operators/merge.cpp | 2 +- Rx/v2/test/sources/defer.cpp | 6 + Rx/v2/test/subscriptions/observer.cpp | 6 +- 19 files changed, 598 insertions(+), 529 deletions(-) create mode 100644 Rx/v2/src/rxcpp/rx-coordination.hpp delete mode 100644 Rx/v2/src/rxcpp/rx-regulator.hpp create mode 100644 Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index fb896e7..9280fb4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -13,49 +13,52 @@ namespace operators { namespace detail { -template +template struct concat : public operator_base::type::value_type::value_type> { - typedef concat this_type; + typedef concat this_type; typedef typename std::decay::type source_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; + + typedef typename coordination_type::coordinator_type coordinator_type; typedef typename source_type::value_type collection_type; typedef typename collection_type::value_type value_type; struct values { - values(source_type o, source_filter_type sf) + values(source_type o, coordination_type sf) : source(std::move(o)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } source_type source; - source_filter_type sourceFilter; + coordination_type coordination; }; values initial; - concat(source_type o, source_filter_type sf) + concat(source_type o, coordination_type sf) : initial(std::move(o), std::move(sf)) { } template - void on_subscribe(Subscriber&& scbr) const { + void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename std::decay::type output_type; + typedef typename coordinator_type::template get::type output_type; struct concat_state_type : public std::enable_shared_from_this , public values { - concat_state_type(values i, output_type oarg) + concat_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)) { } @@ -75,7 +78,7 @@ struct concat })); auto selectedSource = on_exception( - [&](){return state->sourceFilter(st);}, + [&](){return state->coordinator(std::move(st));}, state->out); if (selectedSource.empty()) { return; @@ -110,10 +113,20 @@ struct concat composite_subscription sourceLifetime; composite_subscription collectionLifetime; std::deque selectedCollections; + coordinator_type coordinator; output_type out; }; + + auto coordinator = initial.coordination.create_coordinator(); + auto selectedDest = on_exception( + [&](){return coordinator(scbr);}, + scbr); + if (selectedDest.empty()) { + return; + } + // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_state_type(initial, std::forward(scbr))); + auto state = std::shared_ptr(new concat_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); state->sourceLifetime = composite_subscription(); @@ -122,7 +135,7 @@ struct concat state->out.add(state->sourceLifetime); auto source = on_exception( - [&](){return state->sourceFilter(state->source);}, + [&](){return state->coordinator(state->source);}, state->out); if (source.empty()) { return; @@ -156,32 +169,32 @@ struct concat } }; -template +template class concat_factory { - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; - source_filter_type sourceFilter; + coordination_type coordination; public: - concat_factory(source_filter_type sf) - : sourceFilter(std::move(sf)) + concat_factory(coordination_type sf) + : coordination(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::value_type, concat> { - return observable::value_type, concat>( - concat(std::forward(source), sourceFilter)); + -> observable::value_type, concat> { + return observable::value_type, concat>( + concat(std::forward(source), coordination)); } }; } -template -auto concat(SourceFilter&& sf) - -> detail::concat_factory { - return detail::concat_factory(std::forward(sf)); +template +auto concat(Coordination&& sf) + -> detail::concat_factory { + return detail::concat_factory(std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 7bb0b6d..9f15d80 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -13,12 +13,12 @@ namespace operators { namespace detail { -template +template struct concat_traits { typedef typename std::decay::type source_type; typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; typedef typename source_type::value_type source_value_type; @@ -48,12 +48,12 @@ struct concat_traits { typedef decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; }; -template +template struct concat_map - : public operator_base::value_type> + : public operator_base::value_type> { - typedef concat_map this_type; - typedef concat_traits traits; + typedef concat_map this_type; + typedef concat_traits traits; typedef typename traits::source_type source_type; typedef typename traits::collection_selector_type collection_selector_type; @@ -63,43 +63,45 @@ struct concat_map typedef typename traits::collection_type collection_type; typedef typename traits::collection_value_type collection_value_type; - typedef typename traits::source_filter_type source_filter_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, source_filter_type sf) + 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)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } source_type source; collection_selector_type selectCollection; result_selector_type selectResult; - source_filter_type sourceFilter; + coordination_type coordination; }; values initial; - concat_map(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) + 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 - void on_subscribe(Subscriber&& scbr) const { + void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename std::decay::type output_type; + typedef typename coordinator_type::template get::type output_type; struct concat_map_state_type : public std::enable_shared_from_this , public values { - concat_map_state_type(values i, output_type oarg) + 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)) { } @@ -126,7 +128,7 @@ struct concat_map })); auto selectedSource = on_exception( - [&](){return state->sourceFilter(selectedCollection.get());}, + [&](){return state->coordinator(selectedCollection.get());}, state->out); if (selectedSource.empty()) { return; @@ -167,10 +169,20 @@ struct concat_map composite_subscription sourceLifetime; composite_subscription collectionLifetime; std::deque selectedCollections; + coordinator_type coordinator; output_type out; }; + + auto coordinator = initial.coordination.create_coordinator(); + auto selectedDest = on_exception( + [&](){return coordinator(scbr);}, + scbr); + if (selectedDest.empty()) { + return; + } + // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_map_state_type(initial, std::forward(scbr))); + auto state = std::shared_ptr(new concat_map_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); state->sourceLifetime = composite_subscription(); @@ -179,7 +191,7 @@ struct concat_map state->out.add(state->sourceLifetime); auto source = on_exception( - [&](){return state->sourceFilter(state->source);}, + [&](){return state->coordinator(state->source);}, state->out); if (source.empty()) { return; @@ -213,38 +225,38 @@ struct concat_map } }; -template +template class concat_map_factory { typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; collection_selector_type selectorCollection; result_selector_type selectorResult; - source_filter_type sourceFilter; + coordination_type coordination; public: - concat_map_factory(collection_selector_type s, result_selector_type rs, source_filter_type sf) + concat_map_factory(collection_selector_type s, result_selector_type rs, coordination_type sf) : selectorCollection(std::move(rs)) , selectorResult(std::move(s)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::value_type, concat_map> { - return observable::value_type, concat_map>( - concat_map(std::forward(source), selectorCollection, selectorResult, sourceFilter)); + -> observable::value_type, concat_map> { + return observable::value_type, concat_map>( + concat_map(std::forward(source), selectorCollection, selectorResult, coordination)); } }; } -template -auto concat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) - -> detail::concat_map_factory { - return detail::concat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); +template +auto concat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) + -> detail::concat_map_factory { + return detail::concat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 8943011..e664399 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -13,12 +13,12 @@ namespace operators { namespace detail { -template +template struct flat_map_traits { typedef typename std::decay::type source_type; typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; typedef typename source_type::value_type source_value_type; @@ -48,12 +48,12 @@ struct flat_map_traits { typedef decltype((*(result_selector_type*)nullptr)(*(source_value_type*)nullptr, *(collection_value_type*)nullptr)) value_type; }; -template +template struct flat_map - : public operator_base::value_type> + : public operator_base::value_type> { - typedef flat_map this_type; - typedef flat_map_traits traits; + typedef flat_map this_type; + typedef flat_map_traits traits; typedef typename traits::source_type source_type; typedef typename traits::collection_selector_type collection_selector_type; @@ -63,52 +63,64 @@ struct flat_map typedef typename traits::collection_type collection_type; typedef typename traits::collection_value_type collection_value_type; - typedef typename traits::source_filter_type source_filter_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, source_filter_type sf) + 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)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } source_type source; collection_selector_type selectCollection; result_selector_type selectResult; - source_filter_type sourceFilter; + coordination_type coordination; }; values initial; - flat_map(source_type o, collection_selector_type s, result_selector_type rs, source_filter_type sf) + 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 - void on_subscribe(Subscriber&& scbr) const { + void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename std::decay::type output_type; + typedef typename coordinator_type::template get::type output_type; struct state_type : public std::enable_shared_from_this , public values { - state_type(values i, output_type oarg) + 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(); + auto selectedDest = on_exception( + [&](){return coordinator(scbr);}, + scbr); + if (selectedDest.empty()) { + return; + } + // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::forward(scbr))); + auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); composite_subscription outercs; @@ -117,7 +129,7 @@ struct flat_map state->out.add(outercs); auto source = on_exception( - [&](){return state->sourceFilter(state->source);}, + [&](){return state->coordinator(state->source);}, state->out); if (source.empty()) { return; @@ -150,7 +162,7 @@ struct flat_map })); auto selectedSource = on_exception( - [&](){return state->sourceFilter(selectedCollection.get());}, + [&](){return state->coordinator(selectedCollection.get());}, state->out); if (selectedSource.empty()) { return; @@ -198,38 +210,38 @@ struct flat_map } }; -template +template class flat_map_factory { typedef typename std::decay::type collection_selector_type; typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; collection_selector_type selectorCollection; result_selector_type selectorResult; - source_filter_type sourceFilter; + coordination_type coordination; public: - flat_map_factory(collection_selector_type s, result_selector_type rs, source_filter_type sf) + flat_map_factory(collection_selector_type s, result_selector_type rs, coordination_type sf) : selectorCollection(std::move(rs)) , selectorResult(std::move(s)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::value_type, flat_map> { - return observable::value_type, flat_map>( - flat_map(std::forward(source), selectorCollection, selectorResult, sourceFilter)); + -> observable::value_type, flat_map> { + return observable::value_type, flat_map>( + flat_map(std::forward(source), selectorCollection, selectorResult, coordination)); } }; } -template -auto flat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) - -> detail::flat_map_factory { - return detail::flat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); +template +auto flat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) + -> detail::flat_map_factory { + return detail::flat_map_factory(std::forward(s), std::forward(rs), std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 40443b7..e577777 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -13,56 +13,68 @@ namespace operators { namespace detail { -template +template struct merge : public operator_base::type::value_type::value_type> { - typedef merge this_type; + typedef merge this_type; typedef typename std::decay::type source_type; typedef typename source_type::value_type source_value_type; typedef typename source_value_type::value_type value_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; struct values { - values(source_type o, source_filter_type sf) + values(source_type o, coordination_type sf) : source(std::move(o)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } source_type source; - source_filter_type sourceFilter; + coordination_type coordination; }; values initial; - merge(source_type o, source_filter_type sf) + merge(source_type o, coordination_type sf) : initial(std::move(o), std::move(sf)) { } template - void on_subscribe(Subscriber&& scbr) const { + void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename std::decay::type output_type; + typedef typename coordinator_type::template get::type output_type; struct merge_state_type : public std::enable_shared_from_this , public values { - merge_state_type(values i, output_type oarg) + merge_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(); + auto selectedDest = on_exception( + [&](){return coordinator(scbr);}, + scbr); + if (selectedDest.empty()) { + return; + } + // take a copy of the values for each subscription - auto state = std::shared_ptr(new merge_state_type(initial, std::forward(scbr))); + auto state = std::shared_ptr(new merge_state_type(initial, std::move(coordinator), std::forward(selectedDest.get()))); composite_subscription outercs; @@ -71,7 +83,7 @@ struct merge : public operator_base::type::value state->out.add(outercs); auto source = on_exception( - [&](){return state->sourceFilter(state->source);}, + [&](){return state->coordinator(state->source);}, state->out); if (source.empty()) { return; @@ -98,7 +110,7 @@ struct merge : public operator_base::type::value })); auto selectedSource = on_exception( - [&](){return state->sourceFilter(st);}, + [&](){return state->coordinator(st);}, state->out); if (selectedSource.empty()) { return; @@ -140,32 +152,32 @@ struct merge : public operator_base::type::value } }; -template +template class merge_factory { - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; - source_filter_type sourceFilter; + coordination_type coordination; public: - merge_factory(source_filter_type sf) - : sourceFilter(std::move(sf)) + merge_factory(coordination_type sf) + : coordination(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::value_type, merge> { - return observable::value_type, merge>( - merge(std::forward(source), sourceFilter)); + -> observable::value_type, merge> { + return observable::value_type, merge>( + merge(std::forward(source), coordination)); } }; } -template -auto merge(SourceFilter&& sf) - -> detail::merge_factory { - return detail::merge_factory(std::forward(sf)); +template +auto merge(Coordination&& sf) + -> detail::merge_factory { + return detail::merge_factory(std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 963855e..17b2383 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -13,27 +13,28 @@ namespace operators { namespace detail { -template +template struct take_until : public operator_base { typedef typename std::decay::type source_type; typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; struct values { - values(source_type s, trigger_source_type t, source_filter_type sf) + values(source_type s, trigger_source_type t, coordination_type sf) : source(std::move(s)) , trigger(std::move(t)) - , sourceFilter(std::move(sf)) + , coordination(std::move(sf)) { } source_type source; trigger_source_type trigger; - source_filter_type sourceFilter; + coordination_type coordination; }; values initial; - take_until(source_type s, trigger_source_type t, source_filter_type sf) + take_until(source_type s, trigger_source_type t, coordination_type sf) : initial(std::move(s), std::move(t), std::move(sf)) { } @@ -50,16 +51,17 @@ struct take_until : public operator_base }; template - void on_subscribe(const Subscriber& s) const { + void on_subscribe(Subscriber s) const { typedef Subscriber output_type; struct take_until_state_type : public std::enable_shared_from_this , public values { - take_until_state_type(const values& i, const output_type& oarg) + 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); @@ -68,20 +70,30 @@ struct take_until : public operator_base 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(); + auto selectedDest = on_exception( + [&](){return coordinator(s);}, + s); + if (selectedDest.empty()) { + return; + } + // take a copy of the values for each subscription - auto state = std::shared_ptr(new take_until_state_type(initial, s)); + auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); auto trigger = on_exception( - [&](){return state->sourceFilter(state->trigger);}, + [&](){return state->coordinator(state->trigger);}, state->out); if (trigger.empty()) { return; } auto source = on_exception( - [&](){return state->sourceFilter(state->source);}, + [&](){return state->coordinator(state->source);}, state->out); if (source.empty()) { return; @@ -139,34 +151,34 @@ struct take_until : public operator_base } }; -template +template class take_until_factory { typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type source_filter_type; + typedef typename std::decay::type coordination_type; trigger_source_type trigger_source; - source_filter_type source_filter; + coordination_type coordination; public: - take_until_factory(trigger_source_type t, source_filter_type sf) + take_until_factory(trigger_source_type t, coordination_type sf) : trigger_source(std::move(t)) - , source_filter(std::move(sf)) + , coordination(std::move(sf)) { } template auto operator()(Observable&& source) - -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, SourceFilter>> { - return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, SourceFilter>>( - take_until::type::value_type, Observable, trigger_source_type, SourceFilter>(std::forward(source), trigger_source, source_filter)); + -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, Coordination>> { + return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, Coordination>>( + take_until::type::value_type, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); } }; } -template -auto take_until(TriggerObservable&& t, SourceFilter&& sf) - -> detail::take_until_factory { - return detail::take_until_factory(std::forward(t), std::forward(sf)); +template +auto take_until(TriggerObservable&& t, Coordination&& sf) + -> detail::take_until_factory { + return detail::take_until_factory(std::forward(t), std::forward(sf)); } } diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp new file mode 100644 index 0000000..ca513a6 --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -0,0 +1,158 @@ +// 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 is_coordinator +{ + template + static typename C::coordinator_tag* check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_coordinator*>::value; +}; + +struct tag_coordination {}; +struct coordination_base {typedef tag_coordination coordination_tag;}; +template +class is_coordination +{ + template + static typename C::coordination_tag* check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_coordination*>::value; +}; + +template +class coordinator : public coordinator_base +{ + struct not_supported {typedef not_supported type;}; +public: + typedef Input input_type; + typedef Output output_type; + + input_type input; + output_type output; + + template + struct get_observable + { + typedef decltype((*(input_type*)nullptr)((*(Observable*)nullptr))) type; + }; + + template + struct get_subscriber + { + typedef decltype((*(output_type*)nullptr)((*(Subscriber*)nullptr))) type; + }; + + template + struct get + { + typedef typename std::conditional< + is_observable::value, get_observable, typename std::conditional< + is_subscriber::value, get_subscriber, not_supported>::type>::type::type type; + }; + + coordinator(Input i, Output o) : input(i), output(o) {} + + const Input& get_input() const { + return input; + } + + const Output& get_output() const { + return output; + } + + template + auto operator()(Observable o) const + -> typename std::enable_if::value, get_observable>::type::type { + return input(std::move(o)); + static_assert(is_observable::value, "can only synchronize observables"); + } + + template + auto operator()(Subscriber s) const + -> typename std::enable_if::value, get_subscriber>::type::type { + return output(std::move(s)); + static_assert(is_subscriber::value, "can only synchronize subscribers"); + } +}; + +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)) + { + } + rxsc::worker get_worker() const { + return controller; + } + rxsc::scheduler get_scheduler() const { + return factory; + } + template + Observable operator()(Observable o) const { + return std::move(o); + static_assert(is_observable::value, "can only synchronize observables"); + } + }; + + class output_type + { + rxsc::worker controller; + rxsc::scheduler factory; + public: + explicit output_type(rxsc::worker w) + : controller(w) + , factory(rxsc::make_same_worker(w)) + { + } + rxsc::worker get_worker() const { + return controller; + } + rxsc::scheduler get_scheduler() const { + return factory; + } + template + Subscriber operator()(Subscriber s) const { + return std::move(s); + static_assert(is_subscriber::value, "can only synchronize subscribers"); + } + }; + +public: + + explicit identity_one_worker(rxsc::scheduler sc) : factory(sc) {} + + typedef coordinator coordinator_type; + + coordinator_type create_coordinator() const { + auto w = factory.create_worker(); + return coordinator_type(input_type(w), output_type(w)); + } +}; + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index e26206a..6f9d903 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -103,9 +103,9 @@ #include "rx-subscription.hpp" #include "rx-observer.hpp" #include "rx-scheduler.hpp" -#include "rx-regulator.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" diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index f4a211b..17bbdd7 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -325,55 +325,55 @@ public: return lift(rxo::detail::map(std::move(s))); } - template::value> + template::value> struct merge_result; - template - struct merge_result + template + struct merge_result { typedef observable< typename this_type::value_type::value_type, - rxo::detail::merge, SourceFilter>> + rxo::detail::merge, Coordination>> type; - static type make(const this_type* that, SourceFilter sf) { - return type(rxo::detail::merge, SourceFilter>(*that, sf)); + static type make(const this_type* that, Coordination sf) { + return type(rxo::detail::merge, Coordination>(*that, sf)); } }; - template - struct merge_result + template + struct merge_result { typedef this_type type; - static type make(const this_type* that, SourceFilter) { + static type make(const this_type* that, Coordination) { return *that; } }; /// merge -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// auto merge() const - -> typename merge_result::type { - return merge_result::make(this, identity_observable()); + -> typename merge_result::type { + return merge_result::make(this, identity_one_worker(rxsc::make_current_thread())); } /// merge -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto merge(SourceFilter&& sf) const - -> typename std::enable_if::value && !is_observable::value, - observable::value_type, rxo::detail::merge>>::type { - return observable::value_type, rxo::detail::merge>( - rxo::detail::merge(*this, std::forward(sf))); + template + auto merge(Coordination&& sf) const + -> typename std::enable_if::value && !is_observable::value, + observable::value_type, rxo::detail::merge>>::type { + return observable::value_type, rxo::detail::merge>( + rxo::detail::merge(*this, std::forward(sf))); } /// merge -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// @@ -384,90 +384,90 @@ public: } /// merge -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. /// for each item from this observable subscribe. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto merge(SourceFilter&& sf, Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + template + auto merge(Coordination&& sf, Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); } /// flat_map (AKA SelectMany) -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_observable())); + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_one_worker(rxsc::make_current_thread()))); } /// flat_map (AKA SelectMany) -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coodination is used to synchronize sources from different contexts. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// - template - auto flat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + template + auto flat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) const + -> observable::value_type, rxo::detail::flat_map> { + return observable::value_type, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } - template::value> + template::value> struct concat_result; - template - struct concat_result + template + struct concat_result { typedef observable< typename this_type::value_type::value_type, - rxo::detail::concat, SourceFilter>> + rxo::detail::concat, Coordination>> type; - static type make(const this_type* that, SourceFilter sf) { - return type(rxo::detail::concat, SourceFilter>(*that, sf)); + static type make(const this_type* that, Coordination sf) { + return type(rxo::detail::concat, Coordination>(*that, sf)); } }; - template - struct concat_result + template + struct concat_result { typedef this_type type; - static type make(const this_type* that, SourceFilter) { + static type make(const this_type* that, Coordination) { return *that; } }; /// concat -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe to one at a time. in the order received. /// for each item from all of the nested observables deliver from the new observable that is returned. /// auto concat() const - -> typename concat_result::type { - return concat_result::make(this, identity_observable()); + -> typename concat_result::type { + return concat_result::make(this, identity_one_worker(rxsc::make_current_thread())); } /// concat -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. /// for each item from this observable subscribe to one at a time. in the order received. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto concat(SourceFilter&& sf) const - -> typename std::enable_if::value && !is_observable::value, - observable::value_type, rxo::detail::concat>>::type { - return observable::value_type, rxo::detail::concat>( - rxo::detail::concat(*this, std::forward(sf))); + template + auto concat(Coordination&& sf) const + -> typename std::enable_if::value && !is_observable::value, + observable::value_type, rxo::detail::concat>>::type { + return observable::value_type, rxo::detail::concat>( + rxo::detail::concat(*this, std::forward(sf))); } /// concat -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe to one at a time. in the order received. /// for each item from all of the nested observables deliver from the new observable that is returned. /// @@ -478,37 +478,37 @@ public: } /// concat -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. /// for each item from this observable subscribe to one at a time. in the order received. /// for each item from all of the nested observables deliver from the new observable that is returned. /// - template - auto concat(SourceFilter&& sf, Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); + template + auto concat(Coordination&& sf, Value0 v0, ValueN... vn) const + -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { + return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); } /// concat_map -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// template auto concat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::concat_map> { - return observable::value_type, rxo::detail::concat_map>( - rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_observable())); + -> observable::value_type, rxo::detail::concat_map> { + return observable::value_type, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_one_worker(rxsc::make_current_thread()))); } /// concat_map -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. /// for each item from all of the selected observables use the ResultSelector to select a value to emit from the new observable that is returned. /// - template - auto concat_map(CollectionSelector&& s, ResultSelector&& rs, SourceFilter&& sf) const - -> observable::value_type, rxo::detail::concat_map> { - return observable::value_type, rxo::detail::concat_map>( - rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + template + auto concat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) const + -> observable::value_type, rxo::detail::concat_map> { + return observable::value_type, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } /// multicast -> @@ -538,7 +538,7 @@ public: } /// scan -> - /// for each item from this observable use Predicate to combine items into a final value that will be emitted from the new observable that is returned. + /// 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. /// template auto scan(Seed seed, Accumulator&& a) const @@ -548,35 +548,40 @@ public: } /// take -> + /// for the first count items from this observable emit them from the new observable that is returned. /// /// template - auto take(Count&& t) const + auto take(Count t) const -> observable> { return observable>( - rxo::detail::take(*this, std::forward(t))); + rxo::detail::take(*this, t)); } /// take_until -> - /// All sources must be syncronized! This means that calls across all the subscribers must be serial. + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. /// /// template auto take_until(TriggerSource&& t) const - -> observable> { - return observable>( - rxo::detail::take_until(*this, std::forward(t), identity_observable())); + -> typename std::enable_if::value, + observable>>::type { + return observable>( + rxo::detail::take_until(*this, std::forward(t), identity_one_worker(rxsc::make_current_thread()))); } /// take_until -> - /// The source filter can be used to syncronize sources from different contexts. + /// The coordination is used to synchronize sources from different contexts. + /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. /// /// - template - auto take_until(TriggerSource&& t, SourceFilter&& sf) const - -> observable> { - return observable>( - rxo::detail::take_until(*this, std::forward(t), std::forward(sf))); + template + auto take_until(TriggerSource&& t, Coordination&& sf) const + -> typename std::enable_if::value && is_coordination::value, + observable>>::type { + return observable>( + rxo::detail::take_until(*this, std::forward(t), std::forward(sf))); } }; diff --git a/Rx/v2/src/rxcpp/rx-regulator.hpp b/Rx/v2/src/rxcpp/rx-regulator.hpp deleted file mode 100644 index 8a7b998..0000000 --- a/Rx/v2/src/rxcpp/rx-regulator.hpp +++ /dev/null @@ -1,101 +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_REGULATOR_HPP) -#define RXCPP_RX_REGULATOR_HPP - -#include "rx-includes.hpp" - -namespace rxcpp { - -struct tag_resumption {}; -struct resumption_base -{ - typedef tag_resumption resumption_tag; -}; -template -class is_resumption -{ - template - static typename C::resumption_tag* check(int); - template - static void check(...); -public: - static const bool value = std::is_convertible(0)), tag_resumption*>::value; -}; - -namespace detail { - -struct regulator_state_type - : public std::enable_shared_from_this -{ - regulator_state_type() - : isresumed(true) - { - } - rxsc::schedulable resumewith; - bool isresumed; -}; -typedef std::shared_ptr regulator_state; - -} - -// -// passed to subscribe to control the source -// the source must call is_resumed before each onnext -// the source must call resume_with when is_resumed returns false -// the schedulable passed to resume_with must implement a resumption policy; -// forward(undoes drop), unblock(undoes block), subscribe(undoes unsubscribe), -// drain(undoes buffer) -// -class resumption : public resumption_base -{ - detail::regulator_state state; -public: - resumption(){} - explicit resumption(detail::regulator_state st) - : state(st) - { - } - inline bool is_resumed() const { - return state ? state->isresumed : true; - } - inline void resume_with(rxsc::schedulable rw) { - // invalid to call when state is null. - state->resumewith = rw; - } -}; - -// -// owned by observer. the -// observer calls pause to stop the source. The -// observer calls resume when ready for the -// source to send more data. -// -class regulator -{ - detail::regulator_state state; -public: - regulator() - : state(new detail::regulator_state_type()) - { - } - inline void pause() { - state->isresumed = false; - } - inline void resume() { - state->isresumed = true; - auto resumewith = std::move(state->resumewith); - auto local = state->resumewith; - state->resumewith = rxsc::schedulable::empty(local.get_worker()); - local.schedule(); - } - inline resumption get_resumption() { - return resumption(state); - } -}; - -} - -#endif diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 5205907..e0a2a16 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -203,6 +203,11 @@ public: , 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; @@ -858,5 +863,6 @@ namespace rxsc=schedulers; #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-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index da432eb..cea6337 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -10,7 +10,7 @@ namespace rxcpp { template -struct subscriber_base : public observer_base, public subscription_base, public resumption_base +struct subscriber_base : public observer_base, public subscription_base { typedef tag_subscriber subscriber_tag; }; @@ -22,7 +22,6 @@ class subscriber : public subscriber_base typedef typename std::decay::type observer_type; composite_subscription lifetime; - resumption controller; observer_type destination; struct detacher @@ -46,28 +45,24 @@ public: subscriber(const this_type& o) : lifetime(o.lifetime) - , controller(o.controller) , destination(o.destination) { } subscriber(this_type&& o) : lifetime(std::move(o.lifetime)) - , controller(std::move(o.controller)) , destination(std::move(o.destination)) { } template - subscriber(composite_subscription cs, resumption r, U&& o) + subscriber(composite_subscription cs, U&& o) : lifetime(std::move(cs)) - , controller(std::move(r)) , destination(std::forward(o)) { } this_type& operator=(this_type o) { lifetime = std::move(o.lifetime); - controller = std::move(o.controller); destination = std::move(o.destination); return *this; } @@ -78,12 +73,6 @@ public: observer_type& get_observer() { return destination; } - const resumption& get_resumption() const { - return controller; - } - resumption& get_resumption() { - return controller; - } const composite_subscription& get_subscription() const { return lifetime; } @@ -91,15 +80,6 @@ public: return lifetime; } - // resumption - // - bool is_resumed() const { - return controller.is_resumed(); - } - void resume_with(rxsc::schedulable rw) { - controller.resume_with(std::move(rw)); - } - // observer // template @@ -165,21 +145,21 @@ template auto make_subscriber( const observer& o) -> subscriber> { - return subscriber>(composite_subscription(), resumption(), o); + return subscriber>(composite_subscription(), o); } template auto make_subscriber(const Observer& o) -> typename std::enable_if< is_observer::value, subscriber>::type { - return subscriber(composite_subscription(), resumption(), o); + return subscriber(composite_subscription(), o); } template auto make_subscriber(const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), resumption(), + return subscriber>>(composite_subscription(), observer>( static_observer(on))); } @@ -189,7 +169,7 @@ auto make_subscriber(const OnNext& on, const OnError& oe) detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), resumption(), + return subscriber>>(composite_subscription(), observer>( static_observer(on, oe))); } @@ -199,7 +179,7 @@ auto make_subscriber(const OnNext& on, const OnCompleted& oc) detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), resumption(), + return subscriber>>(composite_subscription(), observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -210,7 +190,7 @@ auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc) detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), resumption(), + return subscriber>>(composite_subscription(), observer>( static_observer(on, oe, oc))); } @@ -221,21 +201,21 @@ template auto make_subscriber(const composite_subscription& cs, const observer& o) -> subscriber> { - return subscriber>(cs, resumption(), o); + return subscriber>(cs, o); } template auto make_subscriber(const composite_subscription& cs, const Observer& o) -> typename std::enable_if< is_observer::value, subscriber>::type { - return subscriber(cs, resumption(), o); + return subscriber(cs, o); } template auto make_subscriber(const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(cs, resumption(), + return subscriber>>(cs, observer>( static_observer(on))); } @@ -245,7 +225,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(cs, resumption(), + return subscriber>>(cs, observer>( static_observer(on, oe))); } @@ -255,7 +235,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, resumption(), + return subscriber>>(cs, observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -266,61 +246,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, resumption(), - observer>( - static_observer(on, oe, oc))); -} - -template -auto make_subscriber(const resumption& r, - const observer& o) - -> subscriber> { - return subscriber>(composite_subscription(), r, o); -} -template -auto make_subscriber(const resumption& r, const Observer& o) - -> typename std::enable_if< - is_observer::value, - subscriber>::type { - return subscriber(composite_subscription(), r, o); -} -template -auto make_subscriber(const resumption& r, const OnNext& on) - -> typename std::enable_if< - detail::is_on_next_of::value, - subscriber>>>::type { - return subscriber>>(composite_subscription(), r, - observer>( - static_observer(on))); -} -template -auto make_subscriber(const resumption& r, const OnNext& on, const OnError& oe) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_error::value, - subscriber>>>::type { - return subscriber>>(composite_subscription(), r, - observer>( - static_observer(on, oe))); -} -template -auto make_subscriber(const resumption& r, const OnNext& on, const OnCompleted& oc) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(composite_subscription(), r, - observer>( - static_observer(on, detail::OnErrorEmpty(), oc))); -} -template -auto make_subscriber(const resumption& r, const OnNext& on, const OnError& oe, const OnCompleted& oc) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_error::value && - detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(composite_subscription(), r, + return subscriber>>(cs, observer>( static_observer(on, oe, oc))); } @@ -331,21 +257,21 @@ template auto make_subscriber(const subscriber& scbr, const observer& o) -> subscriber> { - return subscriber>(scbr.get_subscription(), scbr.get_resumption(), o); + return subscriber>(scbr.get_subscription(), o); } template auto make_subscriber(const subscriber& scbr, const Observer& o) -> typename std::enable_if< is_observer::value, subscriber>::type { - return subscriber(scbr.get_subscription(), scbr.get_resumption(), o); + return subscriber(scbr.get_subscription(), o); } template auto make_subscriber(const subscriber& scbr, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + return subscriber>>(scbr.get_subscription(), observer>( static_observer(on))); } @@ -355,7 +281,7 @@ auto make_subscriber(const subscriber& scbr, const OnNext detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + return subscriber>>(scbr.get_subscription(), observer>( static_observer(on, oe))); } @@ -365,7 +291,7 @@ auto make_subscriber(const subscriber& scbr, const OnNext detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + return subscriber>>(scbr.get_subscription(), observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -376,7 +302,7 @@ auto make_subscriber(const subscriber& scbr, const OnNext detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), scbr.get_resumption(), + return subscriber>>(scbr.get_subscription(), observer>( static_observer(on, oe, oc))); } @@ -385,21 +311,21 @@ template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const observer& o) -> subscriber> { - return subscriber>(cs, scbr.get_resumption(), o); + return subscriber>(cs, o); } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const Observer& o) -> typename std::enable_if< is_observer::value, subscriber>::type { - return subscriber(cs, scbr.get_resumption(), o); + return subscriber(cs, o); } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(cs, scbr.get_resumption(), + return subscriber>>(cs, observer>( static_observer(on))); } @@ -409,7 +335,7 @@ auto make_subscriber(const subscriber& scbr, const compos detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(cs, scbr.get_resumption(), + return subscriber>>(cs, observer>( static_observer(on, oe))); } @@ -419,7 +345,7 @@ auto make_subscriber(const subscriber& scbr, const compos detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, scbr.get_resumption(), + return subscriber>>(cs, observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -430,61 +356,7 @@ auto make_subscriber(const subscriber& scbr, const compos detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, scbr.get_resumption(), - observer>( - static_observer(on, oe, oc))); -} - -template -auto make_subscriber(const subscriber& scbr, const resumption& r, - const observer& o) - -> subscriber> { - return subscriber>(scbr.get_subscription(), r, o); -} -template -auto make_subscriber(const subscriber& scbr, const resumption& r, const Observer& o) - -> typename std::enable_if< - is_observer::value, - subscriber>::type { - return subscriber(scbr.get_subscription(), r, o); -} -template -auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on) - -> typename std::enable_if< - detail::is_on_next_of::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), r, - observer>( - static_observer(on))); -} -template -auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnError& oe) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_error::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), r, - observer>( - static_observer(on, oe))); -} -template -auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnCompleted& oc) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), r, - observer>( - static_observer(on, detail::OnErrorEmpty(), oc))); -} -template -auto make_subscriber(const subscriber& scbr, const resumption& r, const OnNext& on, const OnError& oe, const OnCompleted& oc) - -> typename std::enable_if< - detail::is_on_next_of::value && - detail::is_on_error::value && - detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), r, + return subscriber>>(cs, observer>( static_observer(on, oe, oc))); } @@ -494,21 +366,7 @@ auto make_subscriber(const subscriber& scbr, const resump template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs) -> subscriber { - return subscriber(cs, scbr.get_resumption(), scbr.get_observer()); -} -// override back-pressure -// -template -auto make_subscriber(const subscriber& scbr, const resumption& r) - -> subscriber { - return subscriber(scbr.get_subscription(), r, scbr.get_observer()); -} -// only keep observer -// -template -auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const resumption& r) - -> subscriber { - return subscriber(cs, r, scbr.get_observer()); + return subscriber(cs, scbr.get_observer()); } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp new file mode 100644 index 0000000..1059930 --- /dev/null +++ b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp @@ -0,0 +1,53 @@ +// 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(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) { + auto i = make_scheduler(w); + return i; +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index f7f9b78..b07d356 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -164,48 +164,71 @@ public: } }; -// -// this type is used by operators that subscribe to -// multiple sources to ensure that the notifications are serialized -// -class synchronize_observable +} + +class syncronize_in_one_worker : public coordination_base { rxsc::scheduler factory; - rxsc::worker controller; -public: - synchronize_observable(rxsc::scheduler sc) - : factory(sc) - , controller(sc.create_worker()) - { - } - synchronize_observable(const synchronize_observable& o) - : factory(o.factory) - // new worker for each copy. this spreads work across threads - // but keeps each use serialized - , controller(factory.create_worker()) - { - } - synchronize_observable(synchronize_observable&& o) - : factory(std::move(o.factory)) - , controller(std::move(o.controller)) + + class input_type { - } - synchronize_observable& operator=(synchronize_observable o) + rxsc::worker controller; + rxsc::scheduler factory; + public: + explicit input_type(rxsc::worker w) + : controller(w) + , factory(rxsc::make_same_worker(w)) + { + } + rxsc::worker get_worker() const { + return controller; + } + rxsc::scheduler get_scheduler() const { + return factory; + } + template + auto operator()(Observable o) const + -> decltype(o.synchronize(controller).ref_count()) { + return o.synchronize(controller).ref_count(); + static_assert(is_observable::value, "can only synchronize observables"); + } + }; + + class output_type { - factory = std::move(o.factory); - controller = std::move(o.controller); - return *this; - } - template - auto operator()(Observable o) - -> decltype(o.synchronize(controller).ref_count()) { - return o.synchronize(controller).ref_count(); - static_assert(is_observable::value, "can only synchronize observables"); + rxsc::worker controller; + rxsc::scheduler factory; + public: + explicit output_type(rxsc::worker w) + : controller(w) + , factory(rxsc::make_same_worker(w)) + { + } + rxsc::worker get_worker() const { + return controller; + } + rxsc::scheduler get_scheduler() const { + return factory; + } + template + Subscriber operator()(Subscriber s) const { + return std::move(s); + static_assert(is_subscriber::value, "can only synchronize subscribers"); + } + }; + +public: + + explicit syncronize_in_one_worker(rxsc::scheduler sc) : factory(sc) {} + + typedef coordinator coordinator_type; + + coordinator_type create_coordinator() const { + auto w = factory.create_worker(); + return coordinator_type(input_type(w), output_type(w)); } }; } -} - #endif diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 864166c..9e2888b 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -27,7 +27,7 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rxsub::synchronize_observable(sc); + auto so = rx::syncronize_in_one_worker(sc); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 058a645..08cfe71 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 50; +static const int static_tripletCount = 100; SCENARIO("concat_map pythagorian ranges", "[hide][range][concat_map][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -70,7 +70,7 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rxsub::synchronize_observable(sc); + auto so = rx::syncronize_in_one_worker(sc); int c = 0; std::atomic ct(0); diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index cb9b2a0..18ab1b0 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -12,7 +12,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -static const int static_tripletCount = 50; +static const int static_tripletCount = 100; SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; @@ -107,7 +107,7 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rxsub::synchronize_observable(sc); + auto so = rx::syncronize_in_one_worker(sc); int c = 0; std::atomic ct(0); diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 931d26f..50f1cad 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -27,7 +27,7 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rxsub::synchronize_observable(sc); + auto so = rx::syncronize_in_one_worker(sc); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp index 290849b..18d4e42 100644 --- a/Rx/v2/test/sources/defer.cpp +++ b/Rx/v2/test/sources/defer.cpp @@ -31,6 +31,12 @@ SCENARIO("defer stops on completion", "[defer][operators]"){ WHEN("deferred"){ + auto empty = rx::observable<>::empty(); + auto just = rx::observable<>::just(42); + auto one = rx::observable<>::from(42); + auto error = rx::observable<>::error(std::exception_ptr()); + auto runtimeerror = rx::observable<>::error(std::runtime_error("runtime")); + auto res = w.start( [&]() { return rx::observable<>::defer( diff --git a/Rx/v2/test/subscriptions/observer.cpp b/Rx/v2/test/subscriptions/observer.cpp index 83f90e7..259fe0b 100644 --- a/Rx/v2/test/subscriptions/observer.cpp +++ b/Rx/v2/test/subscriptions/observer.cpp @@ -19,14 +19,14 @@ SCENARIO("subscriber traits", "[observer][traits]"){ // static_assert(std::tuple_element<1, decltype(argset)>::type::is_arg, "resumption is a required parameter"); // auto scrbResult = rx::detail::make_subscriber_resolved(rx::rxu::detail::resolve_arg_set(rx::detail::tag_subscriber_set(), rx::resumption(), next, error, completed)); // auto scrbResult = rx::detail::make_subscriber_resolved(argset); - auto scrbResult = rx::make_subscriber(rx::resumption(), next, error, completed); + auto scrbResult = rx::make_subscriber(next, error, completed); auto scrbdup = rx::make_subscriber(scrbResult); auto scrbop = rx::make_subscriber(scrbResult, next, error, completed); - auto scrbsharelifetime = rx::make_subscriber(scrbResult, scrbop.get_resumption(), scrbop.get_observer()); + auto scrbsharelifetime = rx::make_subscriber(scrbResult, scrbop.get_observer()); auto scrbuniquelifetime = rx::make_subscriber(scrbResult, rx::composite_subscription()); auto emptyNext = [](int){}; - auto scrb = rx::make_subscriber(rx::resumption(), emptyNext); + auto scrb = rx::make_subscriber(emptyNext); WHEN("tested"){ THEN("is_observer value is true for subscriber"){ REQUIRE(rx::is_observer::value); -- GitLab From 392fe195291ffd30571c5a31709ff15528703524 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Jun 2014 08:03:20 -0700 Subject: [PATCH 314/782] windows fixes, replace scheduler with coordination --- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 6 +- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 6 +- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 6 +- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 6 +- Rx/v2/src/rxcpp/rx-coordination.hpp | 12 +-- Rx/v2/src/rxcpp/rx-observable.hpp | 109 +++++++++++++++----- Rx/v2/src/rxcpp/sources/rx-error.hpp | 60 +++++++---- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 53 +++++++--- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 83 ++++++++++----- Rx/v2/src/rxcpp/sources/rx-range.hpp | 100 ++++++++++++------ Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 55 ++++++---- Rx/v2/test/operators/concat.cpp | 6 +- Rx/v2/test/operators/concat_map.cpp | 21 ++-- Rx/v2/test/operators/flat_map.cpp | 23 +++-- Rx/v2/test/operators/merge.cpp | 6 +- Rx/v2/test/sources/interval.cpp | 3 +- Rx/v2/test/subscriptions/subscription.cpp | 19 ++-- 18 files changed, 386 insertions(+), 196 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 9280fb4..57f7143 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -78,7 +78,7 @@ struct concat })); auto selectedSource = on_exception( - [&](){return state->coordinator(std::move(st));}, + [&](){return state->coordinator.in(std::move(st));}, state->out); if (selectedSource.empty()) { return; @@ -117,9 +117,9 @@ struct concat output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); auto selectedDest = on_exception( - [&](){return coordinator(scbr);}, + [&](){return coordinator.out(scbr);}, scbr); if (selectedDest.empty()) { return; @@ -135,7 +135,7 @@ struct concat state->out.add(state->sourceLifetime); auto source = on_exception( - [&](){return state->coordinator(state->source);}, + [&](){return state->coordinator.in(state->source);}, state->out); if (source.empty()) { return; diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 9f15d80..922d5a2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -128,7 +128,7 @@ struct concat_map })); auto selectedSource = on_exception( - [&](){return state->coordinator(selectedCollection.get());}, + [&](){return state->coordinator.in(selectedCollection.get());}, state->out); if (selectedSource.empty()) { return; @@ -175,7 +175,7 @@ struct concat_map auto coordinator = initial.coordination.create_coordinator(); auto selectedDest = on_exception( - [&](){return coordinator(scbr);}, + [&](){return coordinator.out(scbr);}, scbr); if (selectedDest.empty()) { return; @@ -191,7 +191,7 @@ struct concat_map state->out.add(state->sourceLifetime); auto source = on_exception( - [&](){return state->coordinator(state->source);}, + [&](){return state->coordinator.in(state->source);}, state->out); if (source.empty()) { return; diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index e664399..d09caf9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -113,7 +113,7 @@ struct flat_map auto coordinator = initial.coordination.create_coordinator(); auto selectedDest = on_exception( - [&](){return coordinator(scbr);}, + [&](){return coordinator.out(scbr);}, scbr); if (selectedDest.empty()) { return; @@ -129,7 +129,7 @@ struct flat_map state->out.add(outercs); auto source = on_exception( - [&](){return state->coordinator(state->source);}, + [&](){return state->coordinator.in(state->source);}, state->out); if (source.empty()) { return; @@ -162,7 +162,7 @@ struct flat_map })); auto selectedSource = on_exception( - [&](){return state->coordinator(selectedCollection.get());}, + [&](){return state->coordinator.in(selectedCollection.get());}, state->out); if (selectedSource.empty()) { return; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index e577777..e2b5d14 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -67,7 +67,7 @@ struct merge : public operator_base::type::value auto coordinator = initial.coordination.create_coordinator(); auto selectedDest = on_exception( - [&](){return coordinator(scbr);}, + [&](){return coordinator.out(scbr);}, scbr); if (selectedDest.empty()) { return; @@ -83,7 +83,7 @@ struct merge : public operator_base::type::value state->out.add(outercs); auto source = on_exception( - [&](){return state->coordinator(state->source);}, + [&](){return state->coordinator.in(state->source);}, state->out); if (source.empty()) { return; @@ -110,7 +110,7 @@ struct merge : public operator_base::type::value })); auto selectedSource = on_exception( - [&](){return state->coordinator(st);}, + [&](){return state->coordinator.in(st);}, state->out); if (selectedSource.empty()) { return; diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 17b2383..c5f2576 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -76,7 +76,7 @@ struct take_until : public operator_base auto coordinator = initial.coordination.create_coordinator(); auto selectedDest = on_exception( - [&](){return coordinator(s);}, + [&](){return coordinator.out(s);}, s); if (selectedDest.empty()) { return; @@ -86,14 +86,14 @@ struct take_until : public operator_base auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); auto trigger = on_exception( - [&](){return state->coordinator(state->trigger);}, + [&](){return state->coordinator.in(state->trigger);}, state->out); if (trigger.empty()) { return; } auto source = on_exception( - [&](){return state->coordinator(state->source);}, + [&](){return state->coordinator.in(state->source);}, state->out); if (source.empty()) { return; diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index ca513a6..880fc5c 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -77,15 +77,15 @@ public: } template - auto operator()(Observable o) const - -> typename std::enable_if::value, get_observable>::type::type { + auto in(Observable o) const + -> typename get_observable::type { return input(std::move(o)); static_assert(is_observable::value, "can only synchronize observables"); } template - auto operator()(Subscriber s) const - -> typename std::enable_if::value, get_subscriber>::type::type { + auto out(Subscriber s) const + -> typename get_subscriber::type { return output(std::move(s)); static_assert(is_subscriber::value, "can only synchronize subscribers"); } @@ -147,8 +147,8 @@ public: typedef coordinator coordinator_type; - coordinator_type create_coordinator() const { - auto w = factory.create_worker(); + coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { + auto w = factory.create_worker(std::move(cs)); return coordinator_type(input_type(w), output_type(w)); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 17bbdd7..a2adb21 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -524,9 +524,10 @@ public: /// synchronize -> /// turns a cold observable hot and allows connections to the source to be independent of subscriptions /// - auto synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) const - -> decltype(multicast(rxsub::synchronize(w, cs))) { - return multicast(rxsub::synchronize(w, cs)); + template + auto synchronize(Coordination cn, composite_subscription cs = composite_subscription()) const + -> decltype(multicast(rxsub::synchronize(std::move(cn), cs))) { + return multicast(rxsub::synchronize(std::move(cn), cs)); } /// publish -> @@ -602,9 +603,24 @@ class observable ~observable(); public: template - static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> decltype(rxs::range(first, last, step, sc)) { - return rxs::range(first, last, step, sc); + static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1) + -> decltype(rxs::range(first, last, step, identity_one_worker(rxsc::make_current_thread()))) { + return rxs::range(first, last, step, identity_one_worker(rxsc::make_current_thread())); + } + template + static auto range(T first, T last, ptrdiff_t step, Coordination cn) + -> decltype(rxs::range(first, last, step, std::move(cn))) { + return rxs::range(first, last, step, std::move(cn)); + } + template + static auto range(T first, T last, Coordination cn) + -> decltype(rxs::range(first, last, std::move(cn))) { + return rxs::range(first, last, std::move(cn)); + } + template + static auto range(T first, Coordination cn) + -> decltype(rxs::range(first, std::move(cn))) { + return rxs::range(first, std::move(cn)); } template static auto never() @@ -616,40 +632,77 @@ public: -> decltype(rxs::defer(std::move(of))) { return rxs::defer(std::move(of)); } - static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable { - return observable(rxs::detail::interval(initial, period, sc)); + static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period) + -> decltype(rxs::interval(initial, period)) { + return rxs::interval(initial, period); + } + template + 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)); } template - static auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) - -> decltype(rxs::iterate(std::move(c), sc)) { - return rxs::iterate(std::move(c), sc); + static auto iterate(Collection c) + -> decltype(rxs::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread()))) { + return rxs::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread())); + } + template + 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)); + } + template + static auto from() + -> decltype( rxs::from()) { + return rxs::from(); + } + template + static auto from(Coordination cn) + -> typename std::enable_if::value, + decltype( rxs::from(std::move(cn)))>::type { + return rxs::from(std::move(cn)); } template static auto from(Value0 v0, ValueN... vn) - -> decltype(rxs::from(v0, vn...)) { - return rxs::from(v0, vn...); + -> typename std::enable_if::value, + decltype( rxs::from(v0, vn...))>::type { + return rxs::from(v0, vn...); } - template - static auto from(Value0 v0, ValueN... vn, rxsc::scheduler sc) - -> decltype(rxs::from(v0, vn..., sc)) { - return rxs::from(v0, vn..., sc); + template + static auto from(Coordination cn, Value0 v0, ValueN... vn) + -> typename std::enable_if::value, + decltype( rxs::from(std::move(cn), v0, vn...))>::type { + return rxs::from(std::move(cn), v0, vn...); } template - static auto empty(rxsc::scheduler sc = rxsc::make_immediate()) - -> observable>> { - std::array c; - return observable>>(rxs::detail::iterate>(std::move(c), sc)); + static auto empty() + -> decltype(from()) { + return from(); + } + template + static auto empty(Coordination cn) + -> decltype(from(std::move(cn), std::array())) { + return from(std::move(cn), std::array()); } template - static auto just(T v, rxsc::scheduler sc = rxsc::make_immediate()) - -> decltype(rxs::from(v, sc)) { - return rxs::from(v, sc); + static auto just(T v) + -> decltype(from(std::move(v))) { + return from(std::move(v)); + } + template + static auto just(T v, Coordination cn) + -> decltype(from(std::move(cn), std::move(v))) { + return from(std::move(cn), std::move(v)); } template - static auto error(Exception&& e, rxsc::scheduler sc = rxsc::make_immediate()) - -> observable> { - return rxs::error(std::forward(e), sc); + static auto error(Exception&& e) + -> decltype(rxs::error(std::forward(e))) { + return rxs::error(std::forward(e)); + } + template + static auto error(Exception&& e, Coordination cn) + -> decltype(rxs::error(std::forward(e), std::move(cn))) { + return rxs::error(std::forward(e), std::move(cn)); } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index aa8d89c..f8352c9 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -13,25 +13,29 @@ namespace sources { namespace detail { -template +template struct error : public source_base { - typedef error this_type; + typedef error this_type; + + typedef typename std::decay::type coordination_type; + + typedef typename coordination_type::coordinator_type coordinator_type; struct error_initial_type { - error_initial_type(std::exception_ptr e, rxsc::scheduler sc) + error_initial_type(std::exception_ptr e, coordination_type cn) : exception(e) - , factory(sc) + , coordination(std::move(cn)) { } std::exception_ptr exception; - rxsc::scheduler factory; + coordination_type coordination; }; error_initial_type initial; - error(std::exception_ptr e, rxsc::scheduler sc) - : initial(e, sc) + error(std::exception_ptr e, coordination_type cn) + : initial(e, std::move(cn)) { } @@ -39,17 +43,26 @@ struct error : public source_base void on_subscribe(Subscriber o) const { // creates a worker whose lifetime is the same as this subscription - auto controller = initial.factory.create_worker(o.get_subscription()); + auto coordinator = initial.coordination.create_coordinator(o.get_subscription()) + auto controller = coordinator.get_output().get_worker(); auto exception = initial.exception; + auto selectedDest = on_exception( + [&](){return coordinator.out(o);}, + o); + if (selectedDest.empty()) { + return; + } + controller.schedule( [=](const rxsc::schedulable&){ - if (!o.is_subscribed()) { + auto& dest = selectedDest.get(); + if (!dest.is_subscribed()) { // terminate loop return; } - o.on_error(exception); + dest.on_error(exception); // o is unsubscribed }); } @@ -58,26 +71,31 @@ struct error : public source_base struct throw_ptr_tag{}; struct throw_instance_tag{}; -template -auto make_error(throw_ptr_tag&&, std::exception_ptr exception, rxsc::scheduler scheduler) - -> observable> { - return observable>(error(std::move(exception), std::move(scheduler))); +template +auto make_error(throw_ptr_tag&&, std::exception_ptr exception, Coordination cn) + -> observable> { + return observable>(error(std::move(exception), std::move(cn))); } -template -auto make_error(throw_instance_tag&&, E e, rxsc::scheduler scheduler) - -> observable> { +template +auto make_error(throw_instance_tag&&, E e, Coordination cn) + -> observable> { std::exception_ptr exception; try {throw e;} catch(...) {exception = std::current_exception();} - return observable>(error(std::move(exception), std::move(scheduler))); + return observable>(error(std::move(exception), std::move(cn))); } } template -auto error(E e, rxsc::scheduler sc = rxsc::make_current_thread()) - -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(sc))) { - return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(sc)); +auto error(E e) + -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_one_worker(rxsc::make_immediate()))) { + return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_one_worker(rxsc::make_immediate())); +} +template +auto error(E e, Coordination cn) + -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn))) { + return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn)); } } diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 5b77e90..d0b2558 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -13,52 +13,75 @@ namespace sources { namespace detail { +template struct interval : public source_base { - typedef interval this_type; + typedef interval this_type; + + typedef typename std::decay::type 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, rxsc::scheduler sc) + interval_initial_type(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, coordination_type cn) : initial(i) , period(p) - , factory(sc) + , coordination(std::move(cn)) { } rxsc::scheduler::clock_type::time_point initial; rxsc::scheduler::clock_type::duration period; - rxsc::scheduler factory; + coordination_type coordination; }; interval_initial_type initial; - interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, rxsc::scheduler sc) - : initial(i, p, sc) + interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, coordination_type cn) + : initial(i, p, std::move(cn)) { } template void on_subscribe(Subscriber o) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename coordinator_type::template get::type output_type; // creates a worker whose lifetime is the same as this subscription - auto controller = initial.factory.create_worker(o.get_subscription()); + auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); + + auto selectedDest = on_exception( + [&](){return coordinator.out(o);}, + o); + if (selectedDest.empty()) { + return; + } + auto counter = std::make_shared(0); - controller.schedule_periodically( + coordinator.get_output().get_worker().schedule_periodically( initial.initial, initial.period, - [o, counter](const rxsc::schedulable&) { + [selectedDest, counter](const rxsc::schedulable&) { // send next value - o.on_next(++(*counter)); + selectedDest.get().on_next(++(*counter)); }); } }; } -/* -auto interval(rxsc::scheduler::clock_type::time_point i, rxsc::scheduler::clock_type::duration p, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable { - return observable(detail::interval(i, p, sc)); +template +static auto interval(rxsc::scheduler::clock_type::time_point initial, Duration period) + -> observable> { + return observable>( + rxs::detail::interval(initial, period, identity_one_worker(rxsc::make_current_thread()))); + static_assert(std::is_same::value, "duration must be rxsc::scheduler::clock_type::duration"); +} +template +static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, Coordination cn) + -> observable> { + return observable>( + rxs::detail::interval(initial, period, std::move(cn))); } -*/ + } } diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index dc5be36..0b04c44 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -35,37 +35,44 @@ struct iterate_traits typedef typename std::iterator_traits::value_type value_type; }; -template +template struct iterate : public source_base::value_type> { - typedef iterate this_type; + typedef iterate this_type; typedef iterate_traits traits; + typedef typename std::decay::type 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, rxsc::scheduler sc) + iterate_initial_type(collection_type c, coordination_type cn) : collection(std::move(c)) - , factory(sc) + , coordination(std::move(cn)) { } collection_type collection; - rxsc::scheduler factory; + coordination_type coordination; }; iterate_initial_type initial; - iterate(collection_type c, rxsc::scheduler sc) - : initial(std::move(c), std::move(sc)) + iterate(collection_type c, coordination_type cn) + : initial(std::move(c), std::move(cn)) { } template void on_subscribe(Subscriber o) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename coordinator_type::template get::type output_type; + struct iterate_state_type : public iterate_initial_type { - iterate_state_type(const iterate_initial_type& i, Subscriber o) + 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)) @@ -81,12 +88,21 @@ struct iterate : public source_base::value_t } mutable iterator_type cursor; iterator_type end; - mutable Subscriber out; + mutable output_type out; }; - iterate_state_type state(initial, std::move(o)); // creates a worker whose lifetime is the same as this subscription - auto controller = state.factory.create_worker(state.out.get_subscription()); + auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); + auto selectedDest = on_exception( + [&](){return coordinator.out(o);}, + o); + if (selectedDest.empty()) { + return; + } + + iterate_state_type state(initial, std::move(selectedDest.get())); + + auto controller = coordinator.get_output().get_worker(); controller.schedule( [state](const rxsc::schedulable& self){ @@ -116,25 +132,42 @@ struct iterate : public source_base::value_t } template -auto iterate(Collection c, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable::value_type, detail::iterate> { - return observable::value_type, detail::iterate>( - detail::iterate(std::move(c), sc)); +auto iterate(Collection c) + -> observable::value_type, detail::iterate> { + return observable::value_type, detail::iterate>( + detail::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread()))); +} +template +auto iterate(Collection c, Coordination cn) + -> observable::value_type, detail::iterate> { + return observable::value_type, detail::iterate>( + detail::iterate(std::move(c), std::move(cn))); } +template +auto from() + -> decltype(iterate(std::array(), identity_one_worker(rxsc::make_immediate()))) { + return iterate(std::array(), identity_one_worker(rxsc::make_immediate())); +} +template +auto from(Coordination cn) + -> typename std::enable_if::value, + decltype( iterate(std::array(), std::move(cn)))>::type { + return iterate(std::array(), std::move(cn)); +} template auto from(Value0 v0, ValueN... vn) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), rxsc::make_current_thread())); + -> typename std::enable_if::value, + decltype(iterate(std::array(), identity_one_worker()))>::type { + std::array c = {v0, vn...}; + return iterate(std::move(c), identity_one_worker(rxsc::make_immediate())); } -template -auto from(Value0 v0, ValueN... vn, rxsc::scheduler sc) - -> observable>> { - std::array c = {v0, vn...}; - return observable>>( - rxs::detail::iterate>(std::move(c), sc)); +template +auto from(Coordination cn, Value0 v0, ValueN... vn) + -> typename std::enable_if::value, + decltype(iterate(std::array(), std::move(cn)))>::type { + std::array c = {v0, vn...}; + return iterate(std::move(c), std::move(cn)); } } diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index c8c4ae0..cf82950 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -13,48 +13,74 @@ namespace sources { namespace detail { -template +template struct range : public source_base { - struct state_type + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + + struct range_state_type { - T next; + range_state_type(T f, T l, ptrdiff_t s, coordination_type cn) + : next(f) + , last(l) + , step(s) + , coordination(std::move(cn)) + { + } + mutable T next; T last; ptrdiff_t step; - rxsc::scheduler sc; - rxsc::worker w; + coordination_type coordination; }; - state_type init; - range(T f, T l, ptrdiff_t s, rxsc::scheduler sc) + range_state_type initial; + range(T f, T l, ptrdiff_t s, coordination_type cn) + : initial(f, l, s, std::move(cn)) { - init.next = f; - init.last = l; - init.step = s; - init.sc = sc; } template void on_subscribe(Subscriber o) const { - auto state = std::make_shared(init); + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename coordinator_type::template get::type output_type; + // creates a worker whose lifetime is the same as this subscription - state->w = state->sc.create_worker(o.get_subscription()); - state->w.schedule( + auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); + auto selectedDest = on_exception( + [&](){return coordinator.out(o);}, + o); + if (selectedDest.empty()) { + return; + } + + auto controller = coordinator.get_output().get_worker(); + + auto state = initial; + + controller.schedule( [=](const rxsc::schedulable& self){ - if (!o.is_subscribed()) { + auto& dest = selectedDest.get(); + if (!dest.is_subscribed()) { // terminate loop return; } // send next value - o.on_next(state->next); - if (std::abs(state->last - state->next) < std::abs(state->step)) { - if (state->last != state->next) { - o.on_next(state->last); + dest.on_next(state.next); + if (!dest.is_subscribed()) { + // terminate loop + return; + } + + if (std::abs(state.last - state.next) < std::abs(state.step)) { + if (state.last != state.next) { + dest.on_next(state.last); } - o.on_completed(); + dest.on_completed(); // o is unsubscribed return; } - state->next = static_cast(state->step + state->next); + state.next = static_cast(state.step + state.next); // tail recurse this same action to continue loop self(); @@ -65,16 +91,30 @@ struct range : public source_base } template -auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - detail::range(first, last, step, sc)); +auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1) + -> observable> { + return observable>( + detail::range(first, last, step, identity_one_worker(rxsc::make_current_thread()))); } -template -auto range(T first = 0, rxsc::scheduler sc = rxsc::make_current_thread()) - -> observable> { - return observable>( - detail::range(first, std::numeric_limits::max(), 1, sc)); +template +auto range(T first, T last, ptrdiff_t step, Coordination cn) + -> observable> { + return observable>( + detail::range(first, last, step, std::move(cn))); +} +template +auto range(T first, T last, Coordination cn) + -> typename std::enable_if::value, + observable>>::type { + return observable>( + detail::range(first, last, 1, std::move(cn))); +} +template +auto range(T first, Coordination cn) + -> typename std::enable_if::value, + observable>>::type { + return observable>( + detail::range(first, std::numeric_limits::max(), 1, std::move(cn))); } } diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index b07d356..7b72cf7 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -13,12 +13,16 @@ namespace subjects { namespace detail { -template +template class synchronize_observer : public detail::multicast_observer { - typedef synchronize_observer this_type; + typedef synchronize_observer this_type; typedef detail::multicast_observer base_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + typedef typename coordinator_type::template get>::type output_type; + struct synchronize_observer_state : public std::enable_shared_from_this { typedef rxn::notification notification_type; @@ -41,7 +45,8 @@ class synchronize_observer : public detail::multicast_observer composite_subscription lifetime; rxsc::worker processor; mutable typename mode::type current; - subscriber destination; + coordinator_type coordinator; + output_type destination; void ensure_processing(std::unique_lock& guard) const { if (!guard.owns_lock()) { @@ -50,6 +55,7 @@ class synchronize_observer : public detail::multicast_observer if (current == mode::Empty) { current = mode::Processing; auto keepAlive = this->shared_from_this(); + auto processor = coordinator.get_output().get_worker(); processor.schedule(lifetime, [keepAlive, this](const rxsc::schedulable& self){ try { std::unique_lock guard(lock); @@ -78,9 +84,9 @@ class synchronize_observer : public detail::multicast_observer } } - synchronize_observer_state(rxsc::worker w, composite_subscription cs, subscriber scbr) + synchronize_observer_state(coordinator_type coor, composite_subscription cs, output_type scbr) : lifetime(std::move(cs)) - , processor(std::move(w)) + , coordinator(std::move(coor)) , current(mode::Empty) , destination(std::move(scbr)) { @@ -116,11 +122,22 @@ class synchronize_observer : public detail::multicast_observer std::shared_ptr state; public: - synchronize_observer(rxsc::worker w, composite_subscription dl, composite_subscription il) + synchronize_observer(coordination_type cn, composite_subscription dl, composite_subscription il) : base_type(dl) - , state(std::make_shared( - std::move(w), std::move(il), make_subscriber(dl, make_observer_dynamic( *static_cast(this) )))) - {} + { + auto o = make_subscriber(dl, make_observer_dynamic( *static_cast(this) )); + + // creates a worker whose lifetime is the same as the destination subscription + auto coordinator = cn.create_coordinator(dl); + auto selectedDest = on_exception( + [&](){return coordinator.out(o);}, + o); + if (selectedDest.empty()) { + return; + } + + state = std::make_shared(std::move(coordinator), std::move(il), std::move(selectedDest.get())); + } template void on_next(V v) const { @@ -136,16 +153,16 @@ public: } -template +template class synchronize { composite_subscription lifetime; - detail::synchronize_observer s; + detail::synchronize_observer s; public: - explicit synchronize(rxsc::worker w, composite_subscription cs = composite_subscription()) + explicit synchronize(Coordination cn, composite_subscription cs = composite_subscription()) : lifetime(composite_subscription()) - , s(std::move(w), std::move(cs), lifetime) + , s(std::move(cn), std::move(cs), lifetime) { } @@ -154,7 +171,7 @@ public: } subscriber get_subscriber() const { - return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); + return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); } observable get_observable() const { @@ -174,10 +191,12 @@ class syncronize_in_one_worker : public coordination_base { 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) { } rxsc::worker get_worker() const { @@ -188,8 +207,8 @@ class syncronize_in_one_worker : public coordination_base } template auto operator()(Observable o) const - -> decltype(o.synchronize(controller).ref_count()) { - return o.synchronize(controller).ref_count(); + -> decltype(o.synchronize(coordination).ref_count()) { + return o.synchronize(coordination).ref_count(); static_assert(is_observable::value, "can only synchronize observables"); } }; @@ -223,8 +242,8 @@ public: typedef coordinator coordinator_type; - coordinator_type create_coordinator() const { - auto w = factory.create_worker(); + coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { + auto w = factory.create_worker(std::move(cs)); return coordinator_type(input_type(w), output_type(w)); } }; diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 9e2888b..aadc1fb 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -33,11 +33,11 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, sc) + rxs::range(0, sectionCount - 1, 1, so) .concat( so, - rxs::range(sectionCount, sectionCount * 2 - 1, 1, sc), - rxs::range(sectionCount * 2, onnextcalls - 1, 1, sc)) + rxs::range(sectionCount, sectionCount * 2 - 1, 1, so), + rxs::range(sectionCount * 2, onnextcalls - 1, 1, so)) .subscribe( [&c](int x){ ++c;}, diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 08cfe71..ffe8e85 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -23,19 +23,20 @@ SCENARIO("concat_map pythagorian ranges", "[hide][range][concat_map][pythagorian 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, sc) + rxs::range(1, so) .concat_map( - [&c, sc](int z){ - return rxs::range(1, z, 1, sc) + [&c, so](int z){ + return rxs::range(1, z, 1, so) .concat_map( - [&c, sc, z](int x){ - return rxs::range(x, z, 1, sc) + [&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;}) .map([z, x](int y){return std::make_tuple(x, y, z);}) // forget type to workaround lambda deduction bug on msvc 2013 @@ -77,13 +78,13 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] int n = 1; auto start = clock::now(); auto triples = - rxs::range(1, sc) + rxs::range(1, so) .concat_map( - [&c, sc, so](int z){ - return rxs::range(1, z, 1, sc) + [&c, so](int z){ + return rxs::range(1, z, 1, so) .concat_map( - [&c, sc, z](int x){ - return rxs::range(x, z, 1, sc) + [&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) { diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 18ab1b0..f3ada84 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -60,19 +60,20 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe auto sc = rxsc::make_immediate(); //auto sc = rxsc::make_current_thread(); + auto so = rx::syncronize_in_one_worker(sc); int c = 0; int ct = 0; int n = 1; auto start = clock::now(); auto triples = - rxs::range(1, sc) + rxs::range(1, so) .flat_map( - [&c, sc](int z){ - return rxs::range(1, z, 1, sc) + [&c, so](int z){ + return rxs::range(1, z, 1, so) .flat_map( - [&c, sc, z](int x){ - return rxs::range(x, z, 1, sc) + [&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;}) .map([z, x](int y){return std::make_tuple(x, y, z);}) // forget type to workaround lambda deduction bug on msvc 2013 @@ -107,20 +108,20 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::identity_one_worker(sc); int c = 0; std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = - rxs::range(1, sc) + rxs::range(1, so) .flat_map( - [&c, sc, so](int z){ - return rxs::range(1, z, 1, sc) + [&c, so](int z){ + return rxs::range(1, z, 1, so) .flat_map( - [&c, sc, z](int x){ - return rxs::range(x, z, 1, sc) + [&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) { diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 50f1cad..21f722e 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -33,11 +33,11 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, sc) + rxs::range(0, sectionCount - 1, 1, so) .merge( so, - rxs::range(sectionCount, (sectionCount * 2) - 1, 1, sc), - rxs::range(sectionCount * 2, onnextcalls - 1, 1, sc)) + rxs::range(sectionCount, (sectionCount * 2) - 1, 1, so), + rxs::range(sectionCount * 2, onnextcalls - 1, 1, so)) .subscribe( [&c](int x){ ++c;}, diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index 73ce4c8..7aa621f 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -87,10 +87,11 @@ SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf]"){ int c = 0; auto sc = rxsc::make_current_thread(); + auto so = rx::syncronize_in_one_worker(sc); auto start = sc.now() + seconds(2); auto period = seconds(1); rx::composite_subscription cs; - rx::observable<>::interval(start, period, sc) + rx::observable<>::interval(start, period, so) .subscribe( cs, [=, &c](long counter){ diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 1c040ba..29761ce 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -25,14 +25,14 @@ SCENARIO("for loop subscribes", "[hide][for][just][subscribe][long][perf]"){ for (int i = 0; i < subscriptions; i++) { rx::observable<>::just(1) .map([](int i) { - return (std::stringstream() << i).str(); - //return std::string("1"); + std::stringstream serializer; + serializer << i; + return serializer.str(); }) .map([](const std::string& s) { int i; std::stringstream(s) >> i; return i; - //return 1; }) .subscribe([&](int i){ ++c; @@ -62,6 +62,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto w = sc.create_worker(); auto el = rxsc::make_event_loop(); + auto es = rx::syncronize_in_one_worker(el); int runs = 10; @@ -97,10 +98,10 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto start = clock::now(); auto ew = el.create_worker(); std::atomic v(0); - auto s0 = rxs::range(0, 499, 1, el) + auto s0 = rxs::range(0, 499, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(ew) + .synchronize(es) .ref_count() .lift(liftrequirecompletion) .subscribe( @@ -111,10 +112,10 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf [&](){ ++c; })); - auto s1 = rxs::range(500, 999, 1, el) + auto s1 = rxs::range(500, 999, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(ew) + .synchronize(es) .ref_count() .lift(liftrequirecompletion) .subscribe( @@ -125,10 +126,10 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf [&](){ ++c; })); - auto s2 = rxs::range(1000, 1499, 1, el) + auto s2 = rxs::range(1000, 1499, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(ew) + .synchronize(es) .ref_count() .lift(liftrequirecompletion) .subscribe( -- GitLab From a88a47bb3237d2095af9be17ffc412c0a44bd427 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Jun 2014 08:24:53 -0700 Subject: [PATCH 315/782] osx fixes, abort on unhandled error --- Rx/v2/src/rxcpp/rx-observer.hpp | 5 ++++- Rx/v2/src/rxcpp/sources/rx-error.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 8 +++++++- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 12 ++++++------ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index b6bad50..d9f20a0 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -25,7 +25,10 @@ struct OnNextEmpty }; struct OnErrorEmpty { - void operator()(std::exception_ptr) const {} + void operator()(std::exception_ptr) const { + // error implicitly ignored, abort + abort(); + } }; struct OnCompletedEmpty { diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index f8352c9..0c2f67c 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -43,7 +43,7 @@ struct error : public source_base 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 coordinator = initial.coordination.create_coordinator(o.get_subscription()); auto controller = coordinator.get_output().get_worker(); auto exception = initial.exception; diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index d0b2558..35b8ed6 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -67,10 +67,16 @@ struct interval : public source_base } }; +template +struct delay_resolution +{ + typedef observable> type; +}; + } template static auto interval(rxsc::scheduler::clock_type::time_point initial, Duration period) - -> observable> { + -> typename detail::delay_resolution::type { return observable>( rxs::detail::interval(initial, period, identity_one_worker(rxsc::make_current_thread()))); static_assert(std::is_same::value, "duration must be rxsc::scheduler::clock_type::duration"); diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 0b04c44..d3c97b5 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -151,22 +151,22 @@ auto from() } template auto from(Coordination cn) - -> typename std::enable_if::value, + -> typename std::enable_if::value, decltype( iterate(std::array(), std::move(cn)))>::type { return iterate(std::array(), std::move(cn)); } template auto from(Value0 v0, ValueN... vn) - -> typename std::enable_if::value, - decltype(iterate(std::array(), identity_one_worker()))>::type { - std::array c = {v0, vn...}; + -> typename std::enable_if::value, + decltype(iterate(std::array(), identity_one_worker(rxsc::make_immediate())))>::type { + std::array c = {v0, vn...}; return iterate(std::move(c), identity_one_worker(rxsc::make_immediate())); } template auto from(Coordination cn, Value0 v0, ValueN... vn) - -> typename std::enable_if::value, + -> typename std::enable_if::value, decltype(iterate(std::array(), std::move(cn)))>::type { - std::array c = {v0, vn...}; + std::array c = {v0, vn...}; return iterate(std::move(c), std::move(cn)); } -- GitLab From aad3c9f8ba35dd90af0252083a1b3cf749083835 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Jun 2014 22:15:45 -0700 Subject: [PATCH 316/782] add combine_latest --- .../src/rxcpp/operators/rx-combine_latest.hpp | 225 ++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 60 ++++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-util.hpp | 23 ++ Rx/v2/test/operators/combine_latest.cpp | 88 +++++++ projects/CMake/CMakeLists.txt | 1 + 6 files changed, 395 insertions(+), 3 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp create mode 100644 Rx/v2/test/operators/combine_latest.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp new file mode 100644 index 0000000..1c9281a --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -0,0 +1,225 @@ +// 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_COMBINE_LATEST_HPP) +#define RXCPP_OPERATORS_RX_COMBINE_LATEST_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct combine_latest_traits { + static_assert(rxu::all_true::value...>::value, "combine_latest requires observables"); + + typedef std::tuple tuple_source_type; + typedef std::tuple...> tuple_source_value_type; + + typedef typename std::decay::type selector_type; + typedef typename std::decay::type coordination_type; + + struct tag_not_valid {}; + template + static auto check(int) -> decltype((*(CS*)nullptr)((*(CVN*)nullptr)...)); + template + static tag_not_valid check(...); + + static_assert(!std::is_same(0)), tag_not_valid>::value, "combine_latest Selector must be a function with the signature value_type(Observable::value_type...)"); + + typedef decltype(check(0)) value_type; +}; + +template +struct combine_latest : public operator_base::value_type> +{ + typedef combine_latest this_type; + + typedef combine_latest_traits 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 + void subscribe(std::shared_ptr state, rxu::values) const { + bool subscribed[] = {(subscribe(state), true)...}; + } + template + void subscribe(std::shared_ptr state) const { + + typedef typename std::tuple_element::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(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 + source->subscribe( + state->out, + innercs, + // on_next + [state](source_value_type st) { + + auto& value = std::get(state->latest); + + if (value.empty()) { + ++state->valuesSet; + } + + value.reset(st); + + if (state->valuesSet == sizeof... (ObservableN)) { + auto selectedResult = on_exception( + [&](){ + return rxu::apply(state->latest, [state](const rxu::detail::maybe&... mon){ + return state->selector(mon.get()...); + }); + }, + state->out); + if (selectedResult.empty()) { + return; + } + state->out.on_next(selectedResult.get()); + } + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + if (--state->pendingCompletions == 0) { + state->out.on_completed(); + } + } + ); + } + + template + void on_subscribe(Subscriber scbr) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef typename coordinator_type::template get::type output_type; + + struct combine_latest_state_type + : public std::enable_shared_from_this + , public values + { + combine_latest_state_type(values i, coordinator_type coor, output_type oarg) + : values(std::move(i)) + , pendingCompletions(0) + , 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(); + auto selectedDest = on_exception( + [&](){return coordinator.out(scbr);}, + scbr); + if (selectedDest.empty()) { + return; + } + + // take a copy of the values for each subscription + auto state = std::shared_ptr(new combine_latest_state_type(initial, std::move(coordinator), std::forward(selectedDest.get()))); + + subscribe(state, typename rxu::values_from::type()); + } +}; + +template +class combine_latest_factory +{ + typedef typename std::decay::type coordination_type; + typedef typename std::decay::type selector_type; + typedef std::tuple tuple_source_type; + + coordination_type coordination; + selector_type selector; + tuple_source_type sourcen; + + template + auto make(std::tuple source) + -> observable::value_type, combine_latest> { + return observable::value_type, combine_latest>( + combine_latest(coordination, selector, std::move(source))); + } +public: + combine_latest_factory(coordination_type sf, selector_type s, ObservableN... on) + : coordination(std::move(sf)) + , selector(std::move(s)) + , sourcen(std::make_tuple(std::move(on)...)) + { + } + + template + auto operator()(Observable source) + -> decltype(make(std::tuple_cat(std::make_tuple(source), *(tuple_source_type*)nullptr))) { + return make(std::tuple_cat(std::make_tuple(source), sourcen)); + } +}; + +} + +template +auto combine_latest(Coordination sf, Selector s, ObservableN... on) + -> detail::combine_latest_factory { + return detail::combine_latest_factory(std::move(sf), std::move(s), std::move(on)...); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a2adb21..3f42da5 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -511,6 +511,60 @@ public: rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } + template + struct delayed_combine_latest + { + typedef observable::value_type, rxo::detail::combine_latest> type; + }; + + /// combine_latest -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. + /// + template + auto combine_latest(Selector&& s, ObservableN... on) const + -> typename std::enable_if::value && !is_observable::value && rxu::all_true::value...>::value, + delayed_combine_latest>::type::type { + return observable::value_type, rxo::detail::combine_latest>( + rxo::detail::combine_latest(identity_one_worker(rxsc::make_current_thread()), std::forward(s), std::make_tuple(*this, on...))); + } + + /// combine_latest -> + /// The coordination is used to synchronize sources from different contexts. + /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. + /// + template + auto combine_latest(Coordination cn, Selector&& s, ObservableN... on) const + -> typename std::enable_if::value && !is_observable::value && rxu::all_true::value...>::value, + delayed_combine_latest>::type::type { + return observable::value_type, rxo::detail::combine_latest>( + rxo::detail::combine_latest(std::move(cn), std::forward(s), std::make_tuple(*this, on...))); + } + + /// combine_latest -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. + /// + template + auto combine_latest(ObservableN... on) const + -> typename std::enable_if::value...>::value, + delayed_combine_latest>::type::type { + return observable::value_type, rxo::detail::combine_latest>( + rxo::detail::combine_latest(identity_one_worker(rxsc::make_current_thread()), rxu::pack(), std::make_tuple(*this, on...))); + } + + /// combine_latest -> + /// The coordination is used to synchronize sources from different contexts. + /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. + /// + template + auto combine_latest(Coordination cn, ObservableN... on) const + -> typename std::enable_if::value && rxu::all_true::value...>::value, + delayed_combine_latest>::type::type { + return observable::value_type, rxo::detail::combine_latest>( + rxo::detail::combine_latest(std::move(cn), rxu::pack(), std::make_tuple(*this, on...))); + } + /// multicast -> /// allows connections to the source to be independent of subscriptions /// @@ -658,19 +712,19 @@ public: } template static auto from(Coordination cn) - -> typename std::enable_if::value, + -> typename std::enable_if::value, decltype( rxs::from(std::move(cn)))>::type { return rxs::from(std::move(cn)); } template static auto from(Value0 v0, ValueN... vn) - -> typename std::enable_if::value, + -> typename std::enable_if::value, decltype( rxs::from(v0, vn...))>::type { return rxs::from(v0, vn...); } template static auto from(Coordination cn, Value0 v0, ValueN... vn) - -> typename std::enable_if::value, + -> typename std::enable_if::value, decltype( rxs::from(std::move(cn), v0, vn...))>::type { return rxs::from(std::move(cn), v0, vn...); } diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 08bb9dd..8893abe 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -42,6 +42,7 @@ namespace rxo=operators; #include "operators/rx-flat_map.hpp" #include "operators/rx-concat.hpp" #include "operators/rx-concat_map.hpp" +#include "operators/rx-combine_latest.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index e5bdb81..3a3ca30 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -129,6 +129,29 @@ auto apply_to(F f) namespace detail { +struct pack +{ + template + auto operator()(ParamN... pn) + -> decltype(std::make_tuple(std::move(pn)...)) { + return std::make_tuple(std::move(pn)...); + } + template + auto operator()(ParamN... pn) + -> decltype(std::make_tuple(std::move(pn)...)) const { + return std::make_tuple(std::move(pn)...); + } +}; + +} + +inline auto pack() + -> detail::pack { + return detail::pack(); +} + +namespace detail { + template class maybe { diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.cpp new file mode 100644 index 0000000..b5181d1 --- /dev/null +++ b/Rx/v2/test/operators/combine_latest.cpp @@ -0,0 +1,88 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.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(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages> mo; + typedef rxn::subscription life; + + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + record messages1[] = { + on_next(150, 1), + on_next(215, 2), + on_next(225, 4), + on_completed(230) + }; + auto o1 = sc.make_hot_observable(messages1); + + record messages2[] = { + on_next(150, 1), + on_next(220, 3), + on_next(230, 5), + on_next(235, 6), + on_next(240, 7), + on_completed(250) + }; + auto o2 = sc.make_hot_observable(messages2); + + 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); + } + ); + + THEN("the output contains combined ints"){ + record items[] = { + 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 required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the o1"){ + life items[] = { + subscribe(200, 230) + }; + auto required = rxu::to_vector(items); + auto actual = o1.subscriptions(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the o2"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = o2.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 0e5dbf5..4a54645 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -43,6 +43,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp ${V2_TEST_DIR}/sources/defer.cpp + ${V2_TEST_DIR}/operators/combine_latest.cpp ${V2_TEST_DIR}/sources/interval.cpp ${V2_TEST_DIR}/operators/concat.cpp ${V2_TEST_DIR}/operators/merge.cpp -- GitLab From 5e0e2bfde5dcf56bafd3d6a37d0c0680ca039a38 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Jun 2014 23:06:11 -0700 Subject: [PATCH 317/782] fix compilation on windows --- .../src/rxcpp/operators/rx-combine_latest.hpp | 16 ++++++------ Rx/v2/src/rxcpp/rx-util.hpp | 25 +++++++++++++++++-- Rx/v2/test/operators/combine_latest.cpp | 4 ++- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 1c9281a..b8c270e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -68,12 +68,8 @@ struct combine_latest : public operator_base - void subscribe(std::shared_ptr state, rxu::values) const { - bool subscribed[] = {(subscribe(state), true)...}; - } template - void subscribe(std::shared_ptr state) const { + void subscribe_one(std::shared_ptr state) const { typedef typename std::tuple_element::type::value_type source_value_type; @@ -111,9 +107,7 @@ struct combine_latest : public operator_basevaluesSet == sizeof... (ObservableN)) { auto selectedResult = on_exception( [&](){ - return rxu::apply(state->latest, [state](const rxu::detail::maybe&... mon){ - return state->selector(mon.get()...); - }); + return rxu::apply(rxu::surely(state->latest), state->selector); }, state->out); if (selectedResult.empty()) { @@ -134,6 +128,10 @@ struct combine_latest : public operator_base + void subscribe_all(std::shared_ptr state, rxu::values) const { + bool subscribed[] = {(subscribe_one(state), true)...}; + } template void on_subscribe(Subscriber scbr) const { @@ -174,7 +172,7 @@ struct combine_latest : public operator_base(new combine_latest_state_type(initial, std::move(coordinator), std::forward(selectedDest.get()))); - subscribe(state, typename rxu::values_from::type()); + subscribe_all(state, typename rxu::values_from::type()); } }; diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 3a3ca30..bb2730a 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -137,8 +137,8 @@ struct pack return std::make_tuple(std::move(pn)...); } template - auto operator()(ParamN... pn) - -> decltype(std::make_tuple(std::move(pn)...)) const { + auto operator()(ParamN... pn) const + -> decltype(std::make_tuple(std::move(pn)...)) { return std::make_tuple(std::move(pn)...); } }; @@ -277,6 +277,27 @@ public: } }; +} + +namespace detail { + struct surely + { + template + auto operator()(T... t) + -> decltype(std::make_tuple(t.get()...)) { + return std::make_tuple(t.get()...); + } + }; +} + +template +inline auto surely(std::tuple tpl) + -> decltype(apply(tpl, detail::surely())) { + return apply(tpl, detail::surely()); +} + +namespace detail { + template class unwinder { diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.cpp index b5181d1..8f40d22 100644 --- a/Rx/v2/test/operators/combine_latest.cpp +++ b/Rx/v2/test/operators/combine_latest.cpp @@ -48,7 +48,9 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato auto res = w.start( [&]() { return o2 - .combine_latest([](int v2, int v1){return v2 + v1;}, o1); + .combine_latest([](int v2, int v1){return v2 + v1;}, o1) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); } ); -- GitLab From 44251fbe8b122dbcfd9b92e2edf85514e208884c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 10 Jun 2014 23:14:09 -0700 Subject: [PATCH 318/782] osx compilation fix --- Rx/v2/src/rxcpp/rx-util.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index bb2730a..3151fce 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -283,7 +283,12 @@ namespace detail { struct surely { template - auto operator()(T... t) + auto operator()(T... t) + -> decltype(std::make_tuple(t.get()...)) { + return std::make_tuple(t.get()...); + } + template + auto operator()(T... t) const -> decltype(std::make_tuple(t.get()...)) { return std::make_tuple(t.get()...); } @@ -291,7 +296,7 @@ namespace detail { } template -inline auto surely(std::tuple tpl) +inline auto surely(const std::tuple& tpl) -> decltype(apply(tpl, detail::surely())) { return apply(tpl, detail::surely()); } -- GitLab From 6440adb4218f46778f51380f408c6e9ac50f108d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 11 Jun 2014 08:41:09 -0700 Subject: [PATCH 319/782] fix for when sources use the immediate scheduler --- .../src/rxcpp/operators/rx-combine_latest.hpp | 3 +- Rx/v2/test/subscriptions/subscription.cpp | 46 +++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index b8c270e..f990dc7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -86,7 +86,6 @@ struct combine_latest : public operator_basependingCompletions; // 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 @@ -145,7 +144,7 @@ struct combine_latest : public operator_base(finish-start); - std::cout << "loop subscribe : " << n << " subscribed, " << c << " on_next calls, " << msElapsed.count() << "ms elapsed, " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl; + 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][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 i){ + ++c; + }); + } + auto finish = clock::now(); + auto msElapsed = duration_cast(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(); -- GitLab From ccea4b8b01cb990ee53eb46b0a3654e941108531 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 11 Jun 2014 10:19:27 -0700 Subject: [PATCH 320/782] fix lifetime bug in subject --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index fbcc331..eff91c9 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -31,8 +31,6 @@ class multicast_observer }; }; - struct completer_type; - struct state_type : public std::enable_shared_from_this { @@ -140,9 +138,6 @@ public: void on_next(V&& v) const { if (b->current_generation != b->state->generation) { std::unique_lock guard(b->state->lock); - if (!b->completer) { - return; - } b->current_generation = b->state->generation; b->current_completer = b->completer; } @@ -162,6 +157,7 @@ public: b->state->current = mode::Errored; auto s = b->state->lifetime; auto c = std::move(b->completer); + b->current_completer.reset(); ++b->state->generation; guard.unlock(); if (c) { @@ -180,6 +176,7 @@ public: b->state->current = mode::Completed; auto s = b->state->lifetime; auto c = std::move(b->completer); + b->current_completer.reset(); ++b->state->generation; guard.unlock(); if (c) { -- GitLab From 10d351b2daded687478a0a8e3e8b7f710b1a548b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS OPEN TECH)" Date: Wed, 11 Jun 2014 17:53:18 -0700 Subject: [PATCH 321/782] fix name hiding warnings --- Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 2 +- Rx/v2/src/rxcpp/rx-notification.hpp | 4 ++-- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp index 9cc3354..41e4bd9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -46,7 +46,7 @@ struct ref_count : public operator_base guard.unlock(); o.add( [keepAlive](){ - std::unique_lock guard(keepAlive->lock); + std::unique_lock guard_unsubscribe(keepAlive->lock); if (--keepAlive->subscribers == 0) { keepAlive->connection.unsubscribe(); keepAlive->connection = composite_subscription(); diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index 8e4d27a..bd7f861 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -95,8 +95,8 @@ private: } virtual bool equals(const typename base::type& other) const { bool result = false; - other->accept(make_subscriber(make_observer_dynamic([this, &result](T value) { - result = this->value == value; + other->accept(make_subscriber(make_observer_dynamic([this, &result](T v) { + result = this->value == v; }))); return result; } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 06e81ed..7578272 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -205,9 +205,9 @@ private: // loop until queue is empty for ( - auto when = queue::top().when; - (std::this_thread::sleep_until(when), true); - when = queue::top().when + auto next = queue::top().when; + (std::this_thread::sleep_until(next), true); + next = queue::top().when ) { auto what = queue::top().what; -- GitLab From 06ea43bbc04b4a1a743d3c129a5ba8a9e1254e20 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 11 Jun 2014 23:23:57 -0700 Subject: [PATCH 322/782] add buffer --- Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp | 129 ++++++++++++++++++ Rx/v2/src/rxcpp/rx-notification.hpp | 20 +++ Rx/v2/src/rxcpp/rx-observable.hpp | 16 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-util.hpp | 6 + Rx/v2/test/operators/buffer.cpp | 78 +++++++++++ projects/CMake/CMakeLists.txt | 1 + 7 files changed, 251 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp create mode 100644 Rx/v2/test/operators/buffer.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp new file mode 100644 index 0000000..5bd0ee4 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -0,0 +1,129 @@ +// 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_BUFFER_COUNT_HPP) +#define RXCPP_OPERATORS_RX_BUFFER_COUNT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + + +template +struct buffer_count +{ + typedef typename std::decay::type source_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 + struct buffer_count_observer : public buffer_count_values, public observer_base> + { + typedef buffer_count_observer this_type; + typedef observer_base> base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + mutable int cursor; + mutable std::deque> 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() && chunks.front().size() == this->count) { + dest.on_next(std::move(chunks.front())); + chunks.pop_front(); + } + } + void on_error(std::exception_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 make(dest_type d, buffer_count_values v) { + auto cs = d.get_subscription(); + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(buffer_count_observer::make(std::move(dest), initial)) { + return buffer_count_observer::make(std::move(dest), initial); + } +}; + +class buffer_count_factory +{ + int count; + int skip; +public: + buffer_count_factory(int c, int s) : count(c), skip(s) {} + template + auto operator()(Observable&& source) + -> decltype(source.lift(buffer_count::type::value_type>(count, skip))) { + return source.lift(buffer_count::type::value_type>(count, skip)); + } +}; + +} + +inline auto buffer(int count) + -> detail::buffer_count_factory { + return detail::buffer_count_factory(count, count); +} +inline auto buffer(int count, int skip) + -> detail::buffer_count_factory { + return detail::buffer_count_factory(count, skip); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index bd7f861..cc4c721 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -56,6 +56,9 @@ struct notification_base virtual void accept(const observer_type& o) const =0; }; +template +std::ostream& operator<< (std::ostream& out, const std::vector& v); + template auto to_stream(std::ostream& os, const T& t, int, int) -> decltype(os << t) { @@ -74,6 +77,23 @@ auto to_stream(std::ostream& os, const T&, ...) return os << ""; } +template +inline std::ostream& operator<< (std::ostream& os, const std::vector& v) { + os << "["; + bool emit = false; + for(auto& i : v) { + if (emit) { + os << ", "; + } else { + emit = true; + } + to_stream(os, i, 0, 0); + } + os << "]"; + return os; +} + + } template diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 3f42da5..f14c0ac 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -325,6 +325,22 @@ public: return lift(rxo::detail::map(std::move(s))); } + /// buffer -> + /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. + /// + auto buffer(int count) const + -> decltype(lift(rxo::detail::buffer_count(count, count))) { + return lift(rxo::detail::buffer_count(count, count)); + } + + /// buffer -> + /// start a new vector every skip items and collect count items from this observable into each vector to emit from the new observable that is returned. + /// + auto buffer(int count, int skip) const + -> decltype(lift(rxo::detail::buffer_count(count, skip))) { + return lift(rxo::detail::buffer_count(count, skip)); + } + template::value> struct merge_result; diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 8893abe..4928940 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -35,6 +35,7 @@ namespace rxo=operators; } #include "operators/rx-lift.hpp" +#include "operators/rx-buffer_count.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" #include "operators/rx-map.hpp" diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 3151fce..31ec1e3 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -37,6 +37,12 @@ std::vector to_vector(const T (&arr) [size]) { return std::vector(std::begin(arr), std::end(arr)); } +template +typename std::enable_if::value, std::vector>::type to_vector(T0 t0, TN... tn) { + T0 arr[] = {t0, tn...}; + return to_vector(arr); +} + template struct values {}; diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp new file mode 100644 index 0000000..a98e03e --- /dev/null +++ b/Rx/v2/test/operators/buffer.cpp @@ -0,0 +1,78 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +SCENARIO("buffer count skip less", "[buffer][operators]"){ + GIVEN("1 hot observable of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + typedef rxsc::test::messages m; + typedef rxsc::test::messages> mv; + typedef rxn::subscription life; + + typedef m::recorded_type record; + auto on_next = m::on_next; + auto on_completed = m::on_completed; + auto subscribe = m::subscribe; + + typedef mv::recorded_type vrecord; + auto von_next = mv::on_next; + auto von_completed = mv::on_completed; + auto vsubscribe = mv::subscribe; + + record messages1[] = { + on_next(150, 1), + on_next(210, 2), + on_next(220, 3), + on_next(230, 4), + on_next(240, 5), + on_completed(250) + }; + auto xs = sc.make_hot_observable(messages1); + + 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"){ + vrecord items[] = { + von_next(230, rxu::to_vector(2, 3, 4)), + von_next(240, rxu::to_vector(3, 4, 5)), + von_next(250, rxu::to_vector(4, 5)), + von_next(250, rxu::to_vector(5)), + von_completed(250) + }; + auto required = rxu::to_vector(items); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + + THEN("there was one subscription and one unsubscription to the xs"){ + life items[] = { + subscribe(200, 250) + }; + auto required = rxu::to_vector(items); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 4a54645..87676b6 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_executable(testbench ${TESTBENCH_SOURCES}) # define the sources of the self test set(V2_TEST_SOURCES ${V2_TEST_DIR}/test.cpp + ${V2_TEST_DIR}/operators/buffer.cpp ${V2_TEST_DIR}/sources/defer.cpp ${V2_TEST_DIR}/operators/combine_latest.cpp ${V2_TEST_DIR}/sources/interval.cpp -- GitLab From 9c9d3fb77cb242a862d1da978a8cc101dcaf663c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 12 Jun 2014 08:51:57 -0700 Subject: [PATCH 323/782] remove v1 from master and update readme also adds one example --- AUTHORS.txt | 9 +- README.md | 106 +- Rx/CPP/.gitattributes | 22 - Rx/CPP/.gitignore | 165 --- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp | 200 ---- Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h | 91 -- .../MfcTimeFliesLikeAnArrow.cpp | 153 --- .../MfcTimeFliesLikeAnArrow.h | 37 - .../MfcTimeFliesLikeAnArrow.rc | 276 ----- .../MfcTimeFliesLikeAnArrow.vcxproj | 137 --- .../MfcTimeFliesLikeAnArrow.vcxproj.filters | 63 - Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt | 95 -- Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h | 20 - .../res/MfcTimeFliesLikeAnArrow.ico | Bin 67777 -> 0 bytes .../res/MfcTimeFliesLikeAnArrow.rc2 | Bin 830 -> 0 bytes Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp | 9 - Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h | 64 - Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h | 10 - Rx/CPP/RxCpp.sln | 26 - Rx/CPP/license.txt | 15 - Rx/CPP/src/RxCpp.vcxproj | 61 - Rx/CPP/src/RxCpp.vcxproj.filters | 43 - Rx/CPP/src/cpprx/operators/CombineLatest.hpp | 168 --- Rx/CPP/src/cpprx/operators/Concat.hpp | 161 --- Rx/CPP/src/cpprx/operators/ConnectForever.hpp | 22 - Rx/CPP/src/cpprx/operators/Delay.hpp | 79 -- Rx/CPP/src/cpprx/operators/Dematerialize.hpp | 93 -- .../cpprx/operators/DistinctUntilChanged.hpp | 55 - Rx/CPP/src/cpprx/operators/Empty.hpp | 74 -- Rx/CPP/src/cpprx/operators/ForEach.hpp | 49 - Rx/CPP/src/cpprx/operators/GroupBy.hpp | 102 -- Rx/CPP/src/cpprx/operators/Interval.hpp | 62 - Rx/CPP/src/cpprx/operators/Iterate.hpp | 86 -- Rx/CPP/src/cpprx/operators/Materialize.hpp | 87 -- Rx/CPP/src/cpprx/operators/Merge.hpp | 121 -- Rx/CPP/src/cpprx/operators/Multicast.hpp | 20 - Rx/CPP/src/cpprx/operators/Never.hpp | 22 - .../src/cpprx/operators/ObserveOnObserver.hpp | 53 - Rx/CPP/src/cpprx/operators/Publish.hpp | 34 - Rx/CPP/src/cpprx/operators/Random.hpp | 70 -- Rx/CPP/src/cpprx/operators/Range.hpp | 65 -- Rx/CPP/src/cpprx/operators/RefCount.hpp | 102 -- Rx/CPP/src/cpprx/operators/Return.hpp | 78 -- Rx/CPP/src/cpprx/operators/Scan.hpp | 127 -- Rx/CPP/src/cpprx/operators/Select.hpp | 89 -- Rx/CPP/src/cpprx/operators/SelectMany.hpp | 118 -- Rx/CPP/src/cpprx/operators/Skip.hpp | 132 --- Rx/CPP/src/cpprx/operators/Subscribe.hpp | 27 - .../cpprx/operators/SubscribeOnObservable.hpp | 35 - Rx/CPP/src/cpprx/operators/Take.hpp | 173 --- Rx/CPP/src/cpprx/operators/Throttle.hpp | 97 -- Rx/CPP/src/cpprx/operators/Throw.hpp | 104 -- Rx/CPP/src/cpprx/operators/ToAsync.hpp | 48 - .../src/cpprx/operators/ToStdCollection.hpp | 44 - Rx/CPP/src/cpprx/operators/Using.hpp | 112 -- Rx/CPP/src/cpprx/operators/Where.hpp | 86 -- Rx/CPP/src/cpprx/operators/Zip.hpp | 223 ---- Rx/CPP/src/cpprx/rx-base.hpp | 1029 ----------------- Rx/CPP/src/cpprx/rx-includes.hpp | 100 -- Rx/CPP/src/cpprx/rx-operators.hpp | 1018 ---------------- Rx/CPP/src/cpprx/rx-scheduler.hpp | 947 --------------- Rx/CPP/src/cpprx/rx-util.hpp | 509 -------- Rx/CPP/src/cpprx/rx-windows.hpp | 282 ----- Rx/CPP/src/cpprx/rx-winrt.hpp | 667 ----------- Rx/CPP/src/cpprx/rx.hpp | 587 ---------- Rx/CPP/test/operators/Merge.cpp | 60 - Rx/CPP/test/operators/Publish.cpp | 111 -- Rx/CPP/test/operators/Return.cpp | 119 -- Rx/CPP/test/operators/Select.cpp | 181 --- Rx/CPP/test/operators/SelectMany.cpp | 279 ----- Rx/CPP/test/operators/Where.cpp | 389 ------- Rx/CPP/test/test.cpp | 2 - Rx/CPP/testbench/data.txt | 655 ----------- Rx/CPP/testbench/testbench.cpp | 652 ----------- Rx/CPP/testbench/testbench.vcxproj | 93 -- Rx/CPP/testbench/testbench.vcxproj.filters | 22 - Rx/v2/examples/pythagorian/main.cpp | 50 + Rx/v2/test/operators/flat_map.cpp | 2 +- projects/CMake/CMakeLists.txt | 76 +- projects/nuget/rxcpp.autoconfig | 4 +- 80 files changed, 190 insertions(+), 12264 deletions(-) delete mode 100644 Rx/CPP/.gitattributes delete mode 100644 Rx/CPP/.gitignore delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.rc2 delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h delete mode 100644 Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h delete mode 100644 Rx/CPP/RxCpp.sln delete mode 100644 Rx/CPP/license.txt delete mode 100644 Rx/CPP/src/RxCpp.vcxproj delete mode 100644 Rx/CPP/src/RxCpp.vcxproj.filters delete mode 100644 Rx/CPP/src/cpprx/operators/CombineLatest.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Concat.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/ConnectForever.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Delay.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Dematerialize.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Empty.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/ForEach.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/GroupBy.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Interval.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Iterate.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Materialize.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Merge.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Multicast.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Never.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Publish.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Random.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Range.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/RefCount.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Return.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Scan.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Select.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/SelectMany.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Skip.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Subscribe.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Take.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Throttle.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Throw.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/ToAsync.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/ToStdCollection.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Using.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Where.hpp delete mode 100644 Rx/CPP/src/cpprx/operators/Zip.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-base.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-includes.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-operators.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-scheduler.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-util.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-windows.hpp delete mode 100644 Rx/CPP/src/cpprx/rx-winrt.hpp delete mode 100644 Rx/CPP/src/cpprx/rx.hpp delete mode 100644 Rx/CPP/test/operators/Merge.cpp delete mode 100644 Rx/CPP/test/operators/Publish.cpp delete mode 100644 Rx/CPP/test/operators/Return.cpp delete mode 100644 Rx/CPP/test/operators/Select.cpp delete mode 100644 Rx/CPP/test/operators/SelectMany.cpp delete mode 100644 Rx/CPP/test/operators/Where.cpp delete mode 100644 Rx/CPP/test/test.cpp delete mode 100644 Rx/CPP/testbench/data.txt delete mode 100644 Rx/CPP/testbench/testbench.cpp delete mode 100644 Rx/CPP/testbench/testbench.vcxproj delete mode 100644 Rx/CPP/testbench/testbench.vcxproj.filters create mode 100644 Rx/v2/examples/pythagorian/main.cpp diff --git a/AUTHORS.txt b/AUTHORS.txt index 160efcc..7da61e0 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -2,9 +2,9 @@ List of contributors to the Rx libraries Rx and Ix.NET: Wes Dyer -Jeffrey van Gogh -Matthew Podwysocki -Bart de Smet +Jeffrey van Gogh +Matthew Podwysocki +Bart de Smet Danny van Velzen Erik Meijer Brian Beckman @@ -24,7 +24,7 @@ Erik Meijer Tx: Georgi Chkodrov -Bart de Smet +Bart de Smet Aaron Lahman Erik Meijer Brian Grunkemeyer @@ -38,3 +38,4 @@ Zach Kramer Rx++ and Ix++: Aaron Lahman +Kirk Shoop diff --git a/README.md b/README.md index 122be88..9140c1d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/Rx * Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. * RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. -* Rx++: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. +* RxCpp: The Reactive Extensions for Native (RxC) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++. # Interactive Extensions * Ix: The Interactive Extensions (Ix) is a .NET library which extends LINQ to Objects to provide many of the operators available in Rx but targeted for IEnumerable. @@ -15,8 +15,110 @@ Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/Rx * Tx: a set of code samples showing how to use LINQ to events, such as real-time standing queries and queries on past history from trace and log files, which targets ETW, Windows Event Logs and SQL Server Extended Events. * LINQ2Charts: an example for Rx bindings. Similar to existing APIs like LINQ to XML, it allows developers to use LINQ to create/change/update charts in an easy way and avoid having to deal with XML or other underneath data structures. We would love to see more Rx bindings like this one. +#Building RxCpp + +RxCpp is regularly tested on OSX and Windows. +RxCpp is regularly built with Clang and VC +RxCpp depends on the latest compiler releases. +RxCpp does not compile with gcc at this time. Contributions are welcome. + +RxCpp uses CMake to create build files for several platforms and IDE's + +```cmake projects\CMake``` + +This will create the default build for the platform. + +##Ide builds +###XCode +```cmake -G"Xcode" projects\CMake``` + +###Visual Studio 13 +```cmake -G"Visual Studio 12" projects\CMake``` +Then open in VC2013 and upgrade to the 2013 toolset + +##makefile builds + +##OSX +``` +cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo projects\CMake +make +``` + +##Windows +``` +cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo projects\CMake +nmake +``` + +The build only produces a test binary. + +#Running tests + +You can use the CMake test runner ```ctest``` +You can run the test binary directly ```rxcppv2_test``` +Tests can be selected by name or tag +Example of by-tag + +```rxcppv2_test [perf]``` + +#Using RxCpp +Add ```Rx/v2/src``` to the include paths + +``` +#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; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; + +// 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(int argc, wchar_t** argv) +#else +int main(int argc, char** argv) +#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 triplet){return triplet;}) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple 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; + + return 0; +} +``` + #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. -You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Download the Contributor License Agreement (CLA). Please fill in, sign, scan and email it to msopentech-cla@microsoft.com. +You will need to submit a Contributor License Agreement form before submitting your pull request. This needs to only be done once for any Microsoft OSS project. Fill in the [Contributor License Agreement](https://cla.msopentech.com/) (CLA). diff --git a/Rx/CPP/.gitattributes b/Rx/CPP/.gitattributes deleted file mode 100644 index 412eeda..0000000 --- a/Rx/CPP/.gitattributes +++ /dev/null @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/Rx/CPP/.gitignore b/Rx/CPP/.gitignore deleted file mode 100644 index 4822a56..0000000 --- a/Rx/CPP/.gitignore +++ /dev/null @@ -1,165 +0,0 @@ -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## 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/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# 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 - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.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 - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store - -a.out diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp deleted file mode 100644 index 4fc260d..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - - -// MainFrm.cpp : implementation of the CMainFrame class -// - -#include "stdafx.h" -#include "MfcTimeFliesLikeAnArrow.h" - -#include "MainFrm.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -// CMainFrame - -IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd) - -BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) - ON_WM_CREATE() -// ON_WM_SETFOCUS() - ON_WM_CLOSE() - ON_WM_MOUSEMOVE() - ON_WM_PAINT() -END_MESSAGE_MAP() - -static UINT indicators[] = -{ - ID_SEPARATOR, // status line indicator - ID_INDICATOR_CAPS, - ID_INDICATOR_NUM, - ID_INDICATOR_SCRL, -}; - -// CMainFrame construction/destruction - -CMainFrame::CMainFrame() -{ - // TODO: add member initialization code here -} - -CMainFrame::~CMainFrame() -{ -} - - -// inspired by: http://minirx.codeplex.com/ -void CMainFrame::UserInit() -{ - auto worker = std::make_shared(); - auto mainFormScheduler = std::make_shared(); - auto mouseMove = BindEventToObservable(mouseMoveEvent); - - // set up labels and query - auto msg = L"Time flies like an arrow"; - -#if LABEL_EXPRESSION_TRACING - auto start = worker->Now(); - auto ms = std::chrono::milliseconds(1); -#endif - - for (int i = 0; msg[i]; ++i) - { - auto label = CreateLabelFromLetter(msg[i], this); - - // note: distinct_until_changed is necessary; while - // Winforms filters duplicate mouse moves, - // user32 doesn't filter this for you: http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx - - auto s = rxcpp::from(mouseMove) - .select([=](MouseMoveEventValue e) { - auto now = worker->Now(); -#if LABEL_EXPRESSION_TRACING - {std::wstringstream out; - out << L"input index: " << i << L", ms: " << ((now - start) / ms) - << L", x: " << e.point.x << L", y: " << e.point.y - << L", x: " << e.point.x+20*i << L", y: " << e.point.y-20 << std::endl; - OutputDebugString(out.str().c_str());} -#endif - return std::make_tuple(now, e.point); }) - .distinct_until_changed() - .delay(std::chrono::milliseconds(i * 100 + 1), worker) -#if LABEL_EXPRESSION_TRACING - .select(rxcpp::MakeTupleDispatch([=](rxcpp::Scheduler::clock::time_point time, CPoint point) { - {std::wstringstream out; - out << L"delayed index: " << i << L", ms: " << ((time - start) / ms) - << L", x: " << point.x << L", y: " << point.y - << L", x: " << point.x+20*i << L", y: " << point.y-20 << std::endl; - OutputDebugString(out.str().c_str());} - return std::make_tuple(time, point);;})) -#endif - .observe_on(mainFormScheduler) - .subscribe(rxcpp::MakeTupleDispatch([=](rxcpp::Scheduler::clock::time_point time, CPoint point) - { -#if LABEL_EXPRESSION_TRACING - {std::wstringstream out; - out << L"observed index: " << i << L", ms: " << ((time - start) / ms) - << L", x: " << point.x << L", y: " << point.y - << L", x: " << point.x+20*i << L", y: " << point.y-20 << std::endl; - OutputDebugString(out.str().c_str());} -#endif - label->SetWindowPos(nullptr, point.x+20*i, point.y-20, 20, 30, SWP_NOOWNERZORDER); - label->Invalidate(); - - // repaint early, for fluid animation - //label->UpdateWindow(); - this->UpdateWindow(); - })); - - composableDisposable.Add(std::move(s)); - } -} - -void CMainFrame::OnClose() -{ - // shutdown subscription. - composableDisposable.Dispose(); - - CFrameWnd::OnClose(); -} - - -int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - if (CFrameWnd::OnCreate(lpCreateStruct) == -1) - return -1; - - if (!m_wndStatusBar.Create(this)) - { - TRACE0("Failed to create status bar\n"); - return -1; // fail to create - } - m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); - - UserInit(); - - return 0; -} - -BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) -{ - if( !CFrameWnd::PreCreateWindow(cs) ) - return FALSE; - - cs.dwExStyle &= ~WS_EX_CLIENTEDGE; - cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW)); - return TRUE; -} - -// CMainFrame diagnostics - -#ifdef _DEBUG -void CMainFrame::AssertValid() const -{ - CFrameWnd::AssertValid(); -} - -void CMainFrame::Dump(CDumpContext& dc) const -{ - CFrameWnd::Dump(dc); -} -#endif //_DEBUG - - -// CMainFrame message handlers - -void CMainFrame::OnSetFocus(CWnd* /*pOldWnd*/) -{ - // forward focus to the view window - //m_wndView.SetFocus(); -} - -BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) -{ - // let the view have first crack at the command - //if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) - // return TRUE; - - // otherwise, do default handling - return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); -} - -void CMainFrame::OnMouseMove(UINT nFlags, CPoint point) -{ - MouseMoveEventValue v = {nFlags, point}; - this->mouseMoveEvent(v); -} - -void CMainFrame::OnPaint( ) -{ - CPaintDC dc(this); // device context for painting - - RECT rc; - this->GetClientRect(&rc); - CBrush brush; - brush.CreateSolidBrush(RGB(240,240,240)); - dc.FillRect(&rc, &brush); -} - diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h deleted file mode 100644 index 040bc7d..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MainFrm.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - - -// MainFrm.h : interface of the CMainFrame class -// - -#pragma once - - -template -static std::shared_ptr> - BindEventToObservable(std::function& event) -{ - auto eSubject = rxcpp::CreateSubject(); - event = [=](const T& eventValue) { - eSubject->OnNext(eventValue); - }; - return eSubject; -} - -inline CStatic* CreateLabelFromLetter(wchar_t c, CWnd* parent) -{ - CStatic* label; - label = new CStatic(); - - RECT r = { 0, 0, }; - r.right = r.left+20; - r.bottom = r.top + 30; - - auto message = new std::wstring(&c, &c+1); - label->Create( - message->c_str(), - WS_CHILD | WS_VISIBLE, - r, - parent); - return label; -} - -class CMainFrame : public CFrameWnd -{ - -public: - CMainFrame(); -protected: - DECLARE_DYNAMIC(CMainFrame) - -// Attributes -public: - -// Operations -public: - -// Overrides -public: - virtual BOOL PreCreateWindow(CREATESTRUCT& cs); - virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo); - -// Implementation -public: - virtual ~CMainFrame(); -#ifdef _DEBUG - virtual void AssertValid() const; - virtual void Dump(CDumpContext& dc) const; -#endif - -protected: // control bar embedded members - CStatusBar m_wndStatusBar; - - struct MouseMoveEventValue - { - UINT nFlags; - CPoint point; - }; - - std::function mouseMoveEvent; - -// Generated message map functions -protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSetFocus(CWnd *pOldWnd); - afx_msg void OnClose(); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnPaint( ); - - DECLARE_MESSAGE_MAP() - - void UserInit(); - rxcpp::ComposableDisposable composableDisposable; -}; - - diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp deleted file mode 100644 index 59c726a..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.cpp +++ /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. - -// MfcTimeFliesLikeAnArrow.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "afxwinappex.h" -#include "afxdialogex.h" -#include "MfcTimeFliesLikeAnArrow.h" -#include "MainFrm.h" - - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CMfcTimeFliesLikeAnArrowApp - -BEGIN_MESSAGE_MAP(CMfcTimeFliesLikeAnArrowApp, CWinApp) - ON_COMMAND(ID_APP_ABOUT, &CMfcTimeFliesLikeAnArrowApp::OnAppAbout) -END_MESSAGE_MAP() - - -// CMfcTimeFliesLikeAnArrowApp construction - -CMfcTimeFliesLikeAnArrowApp::CMfcTimeFliesLikeAnArrowApp() -{ - // support Restart Manager - m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART; -#ifdef _MANAGED - // If the application is built using Common Language Runtime support (/clr): - // 1) This additional setting is needed for Restart Manager support to work properly. - // 2) In your project, you must add a reference to System.Windows.Forms in order to build. - System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException); -#endif - - // TODO: replace application ID string below with unique ID string; recommended - // format for string is CompanyName.ProductName.SubProduct.VersionInformation - SetAppID(_T("MfcTimeFliesLikeAnArrow.AppID.NoVersion")); - - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -// The one and only CMfcTimeFliesLikeAnArrowApp object - -CMfcTimeFliesLikeAnArrowApp theApp; - - -// CMfcTimeFliesLikeAnArrowApp initialization - -BOOL CMfcTimeFliesLikeAnArrowApp::InitInstance() -{ - // InitCommonControlsEx() is required on Windows XP if an application - // manifest specifies use of ComCtl32.dll version 6 or later to enable - // visual styles. Otherwise, any window creation will fail. - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // Set this to include all the common control classes you want to use - // in your application. - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - - EnableTaskbarInteraction(FALSE); - - // AfxInitRichEdit2() is required to use RichEdit control - // AfxInitRichEdit2(); - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need - // Change the registry key under which our settings are stored - // TODO: You should modify this string to be something appropriate - // such as the name of your company or organization - SetRegistryKey(_T("Local AppWizard-Generated Applications")); - - - // To create the main window, this code creates a new frame window - // object and then sets it as the application's main window object - CMainFrame* pFrame = new CMainFrame; - if (!pFrame) - return FALSE; - m_pMainWnd = pFrame; - // create and load the frame with its resources - pFrame->LoadFrame(IDR_MAINFRAME, - WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, - NULL); - - - - - - // The one and only window has been initialized, so show and update it - pFrame->ShowWindow(SW_SHOW); - pFrame->UpdateWindow(); - return TRUE; -} - -int CMfcTimeFliesLikeAnArrowApp::ExitInstance() -{ - //TODO: handle additional resources you may have added - return CWinApp::ExitInstance(); -} - -// CMfcTimeFliesLikeAnArrowApp message handlers - - -// CAboutDlg dialog used for App About - -class CAboutDlg : public CDialogEx -{ -public: - CAboutDlg(); - -// Dialog Data - enum { IDD = IDD_ABOUTBOX }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - -// Implementation -protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD) -{ -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialogEx::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) -END_MESSAGE_MAP() - -// App command to run the dialog -void CMfcTimeFliesLikeAnArrowApp::OnAppAbout() -{ - CAboutDlg aboutDlg; - aboutDlg.DoModal(); -} - -// CMfcTimeFliesLikeAnArrowApp message handlers - - - diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h deleted file mode 100644 index b13b068..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.h +++ /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. - - -// MfcTimeFliesLikeAnArrow.h : main header file for the MfcTimeFliesLikeAnArrow application -// -#pragma once - -#ifndef __AFXWIN_H__ - #error "include 'stdafx.h' before including this file for PCH" -#endif - -#include "resource.h" // main symbols - - -// CMfcTimeFliesLikeAnArrowApp: -// See MfcTimeFliesLikeAnArrow.cpp for the implementation of this class -// - -class CMfcTimeFliesLikeAnArrowApp : public CWinApp -{ -public: - CMfcTimeFliesLikeAnArrowApp(); - - -// Overrides -public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - -// Implementation - -public: - afx_msg void OnAppAbout(); - DECLARE_MESSAGE_MAP() -}; - -extern CMfcTimeFliesLikeAnArrowApp theApp; diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc deleted file mode 100644 index 928bb2f..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.rc +++ /dev/null @@ -1,276 +0,0 @@ -//Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" -#include "verrsrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -#ifdef APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "#include ""verrsrc.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#include ""res\\MfcTimeFliesLikeAnArrow.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -IDR_MAINFRAME ICON "res\\MfcTimeFliesLikeAnArrow.ico" -#endif -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&Edit" - BEGIN - MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO - MENUITEM SEPARATOR - MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE - END - POPUP "&View" - BEGIN - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - END - POPUP "&Help" - BEGIN - MENUITEM "&About MfcTimeFliesLikeAnArrow...", ID_APP_ABOUT - END -END - - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS -BEGIN - "C", ID_EDIT_COPY, VIRTKEY,CONTROL,NOINVERT - "V", ID_EDIT_PASTE, VIRTKEY,CONTROL,NOINVERT - VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT,NOINVERT - VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT,NOINVERT - VK_F6, ID_NEXT_PANE, VIRTKEY ,NOINVERT - VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT,NOINVERT - VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL,NOINVERT - VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT,NOINVERT - "X", ID_EDIT_CUT, VIRTKEY,CONTROL,NOINVERT - "Z", ID_EDIT_UNDO, VIRTKEY,CONTROL,NOINVERT -END - - - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About MfcTimeFliesLikeAnArrow" -FONT 8, "MS Shell Dlg" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 - LTEXT "MfcTimeFliesLikeAnArrow, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) 2012",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP -END - - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "TODO: " - VALUE "FileDescription", "MfcTimeFliesLikeAnArrow" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "MfcTimeFliesLikeAnArrow.exe" - VALUE "LegalCopyright", "TODO: (c) . All rights reserved." - VALUE "OriginalFilename","MfcTimeFliesLikeAnArrow.exe" - VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1200 - END -END - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END -END -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN -// Non-mac-targeting apps remove the two extra substrings - IDR_MAINFRAME "MfcTimeFliesLikeAnArrow" -END -STRINGTABLE -BEGIN - AFX_IDS_APP_TITLE "MfcTimeFliesLikeAnArrow" - AFX_IDS_IDLEMESSAGE "Ready" -END -STRINGTABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "CAP" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "SCRL" - ID_INDICATOR_OVR "OVR" - ID_INDICATOR_REC "REC" -END -STRINGTABLE -BEGIN - ID_APP_ABOUT "Display program information, version number and copyright\nAbout" - ID_APP_EXIT "Quit the application; prompts to save documents\nExit" - ID_NEXT_PANE "Switch to the next window pane\nNext Pane" - ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" - ID_WINDOW_SPLIT "Split the active window into panes\nSplit" - ID_EDIT_CLEAR "Erase the selection\nErase" - ID_EDIT_CLEAR_ALL "Erase everything\nErase All" - ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" - ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" - ID_EDIT_FIND "Find the specified text\nFind" - ID_EDIT_PASTE "Insert Clipboard contents\nPaste" - ID_EDIT_REPEAT "Repeat the last action\nRepeat" - ID_EDIT_REPLACE "Replace specific text with different text\nReplace" - ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" - ID_EDIT_UNDO "Undo the last action\nUndo" - ID_EDIT_REDO "Redo the previously undone action\nRedo" - ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle Status Bar" -END - -STRINGTABLE -BEGIN - AFX_IDS_SCSIZE "Change the window size" - AFX_IDS_SCMOVE "Change the window position" - AFX_IDS_SCMINIMIZE "Reduce the window to an icon" - AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" - AFX_IDS_SCNEXTWINDOW "Switch to the next document window" - AFX_IDS_SCPREVWINDOW "Switch to the previous document window" - AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" - AFX_IDS_SCRESTORE "Restore the window to normal size" - AFX_IDS_SCTASKLIST "Activate Task List" -END - - -#endif - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#include "res\\MfcTimeFliesLikeAnArrow.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif -#endif // not APSTUDIO_INVOKED diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj deleted file mode 100644 index 01bf711..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - $(VCTargetsPath11) - - - {E773817F-F3E5-4E78-ADD3-B70E11F611B6} - MfcTimeFliesLikeAnArrow - MFCProj - - - - Application - true - v110 - Unicode - Static - - - Application - false - v110 - true - Unicode - Static - - - - - - - - - - - - - true - $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - $(SolutionDir)\bin\$(Configuration)\ - obj\$(Configuration)\ - - - false - $(VCInstallDir)include;..\src;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - $(SolutionDir)\bin\$(Configuration)\ - obj\$(Configuration)\ - - - - Use - Level3 - Disabled - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - - - Windows - true - - - false - true - _DEBUG;%(PreprocessorDefinitions) - - - 0x0409 - _DEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - - - Windows - true - true - true - - - false - true - NDEBUG;%(PreprocessorDefinitions) - - - 0x0409 - NDEBUG;%(PreprocessorDefinitions) - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters b/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters deleted file mode 100644 index 0b65204..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/MfcTimeFliesLikeAnArrow.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt b/Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt deleted file mode 100644 index 75971ad..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/ReadMe.txt +++ /dev/null @@ -1,95 +0,0 @@ -================================================================================ - MICROSOFT FOUNDATION CLASS LIBRARY : MfcTimeFliesLikeAnArrow Project Overview -=============================================================================== - -The application wizard has created this MfcTimeFliesLikeAnArrow application for -you. This application not only demonstrates the basics of using the Microsoft -Foundation Classes but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your MfcTimeFliesLikeAnArrow application. - -MfcTimeFliesLikeAnArrow.vcxproj - This is the main project file for VC++ projects generated using an application wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - application wizard. - -MfcTimeFliesLikeAnArrow.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -MfcTimeFliesLikeAnArrow.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CMfcTimeFliesLikeAnArrowApp application class. - -MfcTimeFliesLikeAnArrow.cpp - This is the main application source file that contains the application - class CMfcTimeFliesLikeAnArrowApp. - -MfcTimeFliesLikeAnArrow.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. Your project resources are in 1033. - -res\MfcTimeFliesLikeAnArrow.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file MfcTimeFliesLikeAnArrow.rc. - -res\MfcTimeFliesLikeAnArrow.rc2 - This file contains resources that are not edited by Microsoft - Visual C++. You should place all resources not editable by - the resource editor in this file. - -///////////////////////////////////////////////////////////////////////////// - -For the main frame window: - The project includes a standard MFC interface. - -MainFrm.h, MainFrm.cpp - These files contain the frame class CMainFrame, which is derived from - CFrameWnd and controls all SDI frame features. - -///////////////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////////////// - -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named MfcTimeFliesLikeAnArrow.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -MfcTimeFliesLikeAnArrow.manifest - Application manifest files are used by Windows XP to describe an applications - dependency on specific versions of Side-by-Side assemblies. The loader uses this - information to load the appropriate assembly from the assembly cache or private - from the application. The Application manifest maybe included for redistribution - as an external .manifest file that is installed in the same folder as the application - executable or it may be included in the executable in the form of a resource. -///////////////////////////////////////////////////////////////////////////// - -Other notes: - -The application wizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, you will need -to redistribute the MFC DLLs. If your application is in a language -other than the operating system's locale, you will also have to -redistribute the corresponding localized resources mfc110XXX.DLL. -For more information on both of these topics, please see the section on -redistributing Visual C++ applications in MSDN documentation. - -///////////////////////////////////////////////////////////////////////////// diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h deleted file mode 100644 index f5a491a..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/Resource.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MfcTimeFliesLikeAnArrow.rc -// -#define IDD_ABOUTBOX 100 -#define IDR_MAINFRAME 128 -#define IDR_MfcTimeFliesLikTYPE 130 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 310 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 310 -#define _APS_NEXT_COMMAND_VALUE 32771 -#endif -#endif diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico b/Rx/CPP/MfcTimeFliesLikeAnArrow/res/MfcTimeFliesLikeAnArrow.ico deleted file mode 100644 index d56fbcdfdf6eac0f4727c34770c26689271d96af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67777 zcmZQzU}WHBFfb5cU}Run$Y5h&xW>T1pr8QZzhGiuuw!RnkdT1#85tPVxEL4&1R#73 zMg|5x9tH*j1CTi!3@i8;7|eJ<`k{Od28MgmApH>j2{s0XHWiS52tR|Bfx%Ck0Sp)! z6c|oVW?G;u;o_;LN%>kr=-B>w6 zS)GCX`J4X!{vUX$w3C}$Lsok^tF}c)TD(aFqoSgCz~53sw*?q z^;P_6OFwq3EUhFZfuVZ2`8K0sBXi|sj`H_E@{XscA3t_1C4s@bx}&*RIXT(H$gaKP z`|+}zva+(W;|>hf%l~&3gVd{P)b;;({-!PG`LXo01cvhM{msS8)y>t7^1Ix|{$1|50qNZk(*q@x1^4kLTsjGtzSk7~0$ax0^3FE>1SHc+v5^BBSm^c~05! z1cvUe{~g0Y+6oxDJG$GuD=f?>Po6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q)asRV^gNppqG9SMdiPo>o~f`S<_-|Nj4Xi@F1j6C=B0|C0*tg4Z!hsPFpEBfAz} zN28hm;k9k}|Nq(BKmRQwAN&tWz5n0V^V0vS)@T3q9nSxk(>wHERCOy}{auIt{*Rmb z@qcp9oBvbSfBD}!|NZ~&h423-72Nx8>T>$OqTvC&`u9Hm_jC8{KmV5>|M5Sm@7;g@ zvX}oIlb-&s?0)^fb;7g%Zo%hTATGsCc5eMPDR0Jy|KYW-!0Srvq8|OX3ViV1Ch)_%ft1Br}9CWHRJ3q%ycM7%?a?=rSlU6oFOdGn6tEF(iZ8AoDUAlEJEr8S)v@7)lrv z7{VAb8HyQ784?+C7!(+s8MGO+859^&81kWd@)+{L>QWg}7&5^u5DhXtnW2OshoKVg zUXZ&%SeYS{A&nu0A(bJGL4m=MA%G#6A%r26!G*z-!Ji?X!IQy{A&kMF!JEOA!3C^a znIRSGiy{UEh7yJhu$vSZ(ik!sau`w>6rg-`w{u(h0&K^@9_`Tn7sI6owQA1%_OPM20+Q41?lJfdLkmAR2p0$pFVlDuW&vg3JWr M!Rcd=t3a*;0Hl#_rT_o{ diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp deleted file mode 100644 index 4f165ae..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -// stdafx.cpp : source file that includes just the standard includes -// MfcTimeFliesLikeAnArrow.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h deleted file mode 100644 index 32ab5ac..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/stdafx.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit - -// turns off MFC's hiding of some common and often safely ignored warning messages -#define _AFX_ALL_WARNINGS - -#include // MFC core and standard components -#include // MFC extensions - - - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC support for Internet Explorer 4 Common Controls -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include // MFC support for ribbons and control bars - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - -// STL includes -#include -#include -#include -#include -#include -#include - -#include "cpprx/rx.hpp" - diff --git a/Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h b/Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h deleted file mode 100644 index b447c86..0000000 --- a/Rx/CPP/MfcTimeFliesLikeAnArrow/targetver.h +++ /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 - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Rx/CPP/RxCpp.sln b/Rx/CPP/RxCpp.sln deleted file mode 100644 index 76d33c8..0000000 --- a/Rx/CPP/RxCpp.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testbench", "testbench\testbench.vcxproj", "{6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MfcTimeFliesLikeAnArrow", "MfcTimeFliesLikeAnArrow\MfcTimeFliesLikeAnArrow.vcxproj", "{E773817F-F3E5-4E78-ADD3-B70E11F611B6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Debug|Win32.ActiveCfg = Debug|Win32 - {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Debug|Win32.Build.0 = Debug|Win32 - {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Release|Win32.ActiveCfg = Release|Win32 - {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB}.Release|Win32.Build.0 = Release|Win32 - {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Debug|Win32.ActiveCfg = Debug|Win32 - {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Debug|Win32.Build.0 = Debug|Win32 - {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Release|Win32.ActiveCfg = Release|Win32 - {E773817F-F3E5-4E78-ADD3-B70E11F611B6}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Rx/CPP/license.txt b/Rx/CPP/license.txt deleted file mode 100644 index 5b47fbd..0000000 --- a/Rx/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/Rx/CPP/src/RxCpp.vcxproj b/Rx/CPP/src/RxCpp.vcxproj deleted file mode 100644 index 7a7398f..0000000 --- a/Rx/CPP/src/RxCpp.vcxproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {A912FB36-33A7-4DDA-A7D6-D17F9495A623} - MakeFileProj - - - - Makefile - true - v110 - - - Makefile - false - v110 - - - - - - - - - - - - - WIN32;_DEBUG;$(NMakePreprocessorDefinitions) - - - WIN32;NDEBUG;$(NMakePreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Rx/CPP/src/RxCpp.vcxproj.filters b/Rx/CPP/src/RxCpp.vcxproj.filters deleted file mode 100644 index 2ce3d34..0000000 --- a/Rx/CPP/src/RxCpp.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp b/Rx/CPP/src/cpprx/operators/CombineLatest.hpp deleted file mode 100644 index d847f9b..0000000 --- a/Rx/CPP/src/cpprx/operators/CombineLatest.hpp +++ /dev/null @@ -1,168 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_COMBINELATEST_HPP) -#define CPPRX_RX_OPERATORS_COMBINELATEST_HPP - -namespace rxcpp -{ - - namespace detail{ - template - struct CombineLatestSubscriber { - typedef typename SubscribeState::Latest Latest; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const typename std::tuple_element::type& element) - { - std::unique_lock guard(state->lock); - if (state->done) {return;} - std::get(state->latest) = element; - if (!std::get(state->latestValid)) { - std::get(state->latestValid) = true; - --state->pendingFirst; - } - if (state->pendingFirst == 0) { - auto args = state->latest; - typedef decltype(util::tuple_dispatch(state->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(state->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - }, - // on completed - [=] - { - std::unique_lock guard(state->lock); - if (state->done) {return;} - state->done = true; - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - std::unique_lock guard(state->lock); - if (state->done) {return;} - state->done = true; - observer->OnError(error); - cd.Dispose(); - })); - CombineLatestSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct CombineLatestSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } - -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto CombineLatest( - S selector, - const std::shared_ptr>&... source - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>...> Sources; - typedef std::tuple Latest; - typedef decltype(std::make_tuple((source, true)...)) LatestValid; - struct State { - typedef Latest Latest; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : latestValid() - , pendingFirst(SourcesSize::value) - , done(false) - , selector(std::move(selector)) - {} - std::mutex lock; - LatestValid latestValid; - size_t pendingFirst; - bool done; - S selector; - Latest latest; - }; - Sources sources(source...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(selector)); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - cd.Add(Disposable([state](){state->done = true;})); - detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - auto CombineLatest( - S selector, - const std::shared_ptr>& source1, - const std::shared_ptr>& source2 - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>, std::shared_ptr>> Sources; - typedef std::tuple Latest; - typedef std::tuple LatestValid; - struct State { - typedef Latest Latest; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : latestValid() - , pendingFirst(SourcesSize::value) - , done(false) - , selector(std::move(selector)) - {} - std::mutex lock; - LatestValid latestValid; - size_t pendingFirst; - bool done; - S selector; - Latest latest; - }; - Sources sources(source1, source2); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - cd.Add(Disposable([state](){state->done = true;})); - detail::CombineLatestSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif - -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Concat.hpp b/Rx/CPP/src/cpprx/operators/Concat.hpp deleted file mode 100644 index e173732..0000000 --- a/Rx/CPP/src/cpprx/operators/Concat.hpp +++ /dev/null @@ -1,161 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_CONCAT_HPP) -#define CPPRX_RX_OPERATORS_CONCAT_HPP - -namespace rxcpp -{ - - template - ObservableT Concat( - const std::shared_ptr>& source) - { - typedef typename observable_item::type T; - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - bool completed; - bool subscribed; - bool cancel; - std::queue queue; - Scheduler::shared scheduler; - std::mutex lock; - }; - auto state = std::make_shared(); - state->cancel = false; - state->subscribed = 0; - state->scheduler = std::make_shared(); - - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(Disposable([=]{ - std::unique_lock guard(state->lock); - state->cancel = true; }) - ); - - cd.Add(Subscribe( - source, - // on next - [=](const ObservableT& sourceElement) - { - bool cancel = false; - bool subscribed = false; - Scheduler::shared sched; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - sched = state->scheduler; - if (!cancel) { - subscribed = state->subscribed; - state->queue.push(sourceElement); - state->subscribed = true; - sched = state->scheduler; - } - } - if (!cancel && !subscribed) { - sd.Set(sched->Schedule( - fix0([state, cd, sd, observer](Scheduler::shared s, std::function self) -> Disposable - { - bool cancel = false; - bool finished = false; - ObservableT next; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty(); - cancel = state->cancel; - if (!cancel && !finished) {next = state->queue.front(); state->queue.pop();} - } - if (!cancel && !finished) { - sd.Set(Subscribe( - next, - // on next - [=](const T& t) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnNext(std::move(t)); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - bool subscribe = false; - { - std::unique_lock guard(state->lock); - finished = state->queue.empty() && state->completed; - subscribe = !state->queue.empty(); - state->subscribed = subscribe; - cancel = state->cancel; - } - if (!cancel) { - if (subscribe) {sd.Set(s->Schedule(std::move(self)));} - else if (finished) {observer->OnCompleted(); cd.Dispose();} - } - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - })); - } - return Disposable::Empty(); - }))); - } - }, - // on completed - [=] - { - bool cancel = false; - bool finished = false; - { - std::unique_lock guard(state->lock); - state->completed = true; - finished = state->queue.empty() && !state->subscribed; - cancel = state->cancel; - } - if (!cancel && finished) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - bool cancel = false; - { - std::unique_lock guard(state->lock); - cancel = state->cancel; - } - if (!cancel) { - observer->OnError(std::current_exception()); - } - cd.Dispose(); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/ConnectForever.hpp b/Rx/CPP/src/cpprx/operators/ConnectForever.hpp deleted file mode 100644 index 1c873ee..0000000 --- a/Rx/CPP/src/cpprx/operators/ConnectForever.hpp +++ /dev/null @@ -1,22 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_CONNECTFOREVER_HPP) -#define CPPRX_RX_OPERATORS_CONNECTFOREVER_HPP - -namespace rxcpp -{ - - template - const std::shared_ptr> ConnectForever( - const std::shared_ptr>& source - ) - { - source->Connect(); - return observable(source); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Delay.hpp b/Rx/CPP/src/cpprx/operators/Delay.hpp deleted file mode 100644 index fe55f70..0000000 --- a/Rx/CPP/src/cpprx/operators/Delay.hpp +++ /dev/null @@ -1,79 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_DELAY_HPP) -#define CPPRX_RX_OPERATORS_DELAY_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> Delay( - const std::shared_ptr>& source, - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - *cancel = true; })); - - SerialDisposable sd; - auto wsd = cd.Add(sd); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - auto sched_disposable = scheduler->Schedule( - due, - [=] (Scheduler::shared) -> Disposable { - if (!*cancel) - observer->OnNext(element); - return Disposable::Empty(); - } - ); - auto ssd = wsd.lock(); - if (ssd) - { - *ssd.get() = std::move(sched_disposable); - } - }, - // on completed - [=] - { - auto sched_disposable = scheduler->Schedule( - due, - [=](Scheduler::shared) -> Disposable { - if (!*cancel) - observer->OnCompleted(); - return Disposable::Empty(); - } - ); - auto ssd = wsd.lock(); - if (ssd) - { - *ssd.get() = std::move(sched_disposable); - } - }, - // on error - [=](const std::exception_ptr& error) - { - if (!*cancel) - observer->OnError(error); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Dematerialize.hpp b/Rx/CPP/src/cpprx/operators/Dematerialize.hpp deleted file mode 100644 index 796a133..0000000 --- a/Rx/CPP/src/cpprx/operators/Dematerialize.hpp +++ /dev/null @@ -1,93 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_DEMATERIALIZE_HPP) -#define CPPRX_RX_OPERATORS_DEMATERIALIZE_HPP - -namespace rxcpp -{ - -namespace detail -{ - -template -class DematerializeObservable : public Producer, T> -{ - typedef DematerializeObservable This; - typedef std::shared_ptr Parent; - typedef std::shared_ptr>>> Source; - typedef std::shared_ptr> Destination; - -private: - - Source source; - - class _ : public Sink<_, T>, public Observer>> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, Destination observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const std::shared_ptr>& n) - { - n->Accept([this](const T& t){ - this->SinkBase::observer->OnNext(t); - }, [this](){ - this->SinkBase::observer->OnCompleted(); - this->SinkBase::Dispose(); - }, [this](const std::exception_ptr& e){ - this->SinkBase::observer->OnError(e); - this->SinkBase::Dispose(); - }); - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; -public: - - DematerializeObservable(Source source) : - ProducerBase([this](Parent parent, Destination observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(std::move(source)) - { - } -}; - -} - -template -std::shared_ptr> Dematerialize( - const std::shared_ptr>>>& source -) -{ - return std::make_shared>( - std::move(source) - ); -} - -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp b/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp deleted file mode 100644 index 1796ed9..0000000 --- a/Rx/CPP/src/cpprx/operators/DistinctUntilChanged.hpp +++ /dev/null @@ -1,55 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_DISTINCTUNTILCHANGED_HPP) -#define CPPRX_RX_OPERATORS_DISTINCTUNTILCHANGED_HPP - -namespace rxcpp -{ - - // removes duplicate-sequenced values. e.g. 1,2,2,3,1 ==> 1,2,3,1 - template - std::shared_ptr> DistinctUntilChanged( - const std::shared_ptr>& source) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - State() : last(), hasValue(false) {} - T last; bool hasValue; - }; - - auto state = std::make_shared(); - state->hasValue = false; - - return Subscribe( - source, - // on next - [=](const T& element) - { - if (!state->hasValue || !(state->last == element)) - { - observer->OnNext(element); - state->last = element; - state->hasValue = true; - } - }, - // on completed - [=] - { - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Empty.hpp b/Rx/CPP/src/cpprx/operators/Empty.hpp deleted file mode 100644 index 09466ca..0000000 --- a/Rx/CPP/src/cpprx/operators/Empty.hpp +++ /dev/null @@ -1,74 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_EMPTY_HPP) -#define CPPRX_RX_OPERATORS_EMPTY_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class EmptyObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnCompleted(); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer, T> ProducerBase; - public: - - EmptyObservable(Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - } - template - std::shared_ptr> Empty( - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(scheduler)); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/ForEach.hpp b/Rx/CPP/src/cpprx/operators/ForEach.hpp deleted file mode 100644 index e2c815e..0000000 --- a/Rx/CPP/src/cpprx/operators/ForEach.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 -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_FOREACH_HPP) -#define CPPRX_RX_OPERATORS_FOREACH_HPP - -namespace rxcpp -{ - - template - void ForEach( - const std::shared_ptr>& source, - typename util::identity>::type onNext - ) - { - std::mutex lock; - std::condition_variable wake; - bool done = false; - std::exception_ptr error; - auto observer = CreateObserver(std::move(onNext), - //on completed - [&]{ - std::unique_lock guard(lock); - done = true; - wake.notify_one(); - }, - //on error - [&](const std::exception_ptr& e){ - std::unique_lock guard(lock); - done = true; - error = std::move(e); - wake.notify_one(); - }); - - source->Subscribe(observer); - - { - std::unique_lock guard(lock); - wake.wait(guard, [&]{return done;}); - } - - if (error != std::exception_ptr()) { - std::rethrow_exception(error);} - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/GroupBy.hpp b/Rx/CPP/src/cpprx/operators/GroupBy.hpp deleted file mode 100644 index e9e7923..0000000 --- a/Rx/CPP/src/cpprx/operators/GroupBy.hpp +++ /dev/null @@ -1,102 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_GROUPBY_HPP) -#define CPPRX_RX_OPERATORS_GRUOPBY_HPP - -namespace rxcpp -{ - - template - auto GroupBy( - const std::shared_ptr>& source, - KS keySelector, - VS valueSelector, - L less) - -> std::shared_ptr::type, - typename std::decay::type>>>> - { - typedef typename std::decay::type Key; - typedef typename std::decay::type Value; - - typedef std::shared_ptr> LocalGroupObservable; - - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - typedef std::map>, L> Groups; - - struct State - { - explicit State(L less) : groups(std::move(less)) {} - std::mutex lock; - Groups groups; - }; - auto state = std::make_shared(std::move(less)); - - return Subscribe( - source, - // on next - [=](const T& element) - { - util::maybe key; - try { - key.set(keySelector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - - if (!!key) { - auto keySubject = CreateGroupedSubject(*key.get()); - - typename Groups::iterator groupIt; - bool newGroup = false; - - { - std::unique_lock guard(state->lock); - std::tie(groupIt, newGroup) = state->groups.insert( - std::make_pair(*key.get(), keySubject) - ); - } - - if (newGroup) - { - LocalGroupObservable nextGroup(std::move(keySubject)); - observer->OnNext(nextGroup); - } - - util::maybe result; - try { - result.set(valueSelector(element)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - groupIt->second->OnNext(std::move(*result.get())); - } - } - }, - // on completed - [=] - { - for(auto& group : state->groups) { - group.second->OnCompleted(); - } - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - for(auto& group : state->groups) { - group.second->OnError(error); - } - observer->OnError(error); - }); - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Interval.hpp b/Rx/CPP/src/cpprx/operators/Interval.hpp deleted file mode 100644 index cd5a3e9..0000000 --- a/Rx/CPP/src/cpprx/operators/Interval.hpp +++ /dev/null @@ -1,62 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_INTERVAL_HPP) -#define CPPRX_RX_OPERATORS_INTERVAL_HPP - -namespace rxcpp -{ - - inline std::shared_ptr> Interval( - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State : public std::enable_shared_from_this { - State(Scheduler::clock::duration due, - Scheduler::clock::time_point last, - std::shared_ptr> observer) : due(due), last(last), cursor(0), observer(observer) { - cd.Add(sd);} - - Scheduler::clock::duration due; - Scheduler::clock::time_point last; - size_t cursor; - std::shared_ptr> observer; - ComposableDisposable cd; - SerialDisposable sd; - - void Tick(Scheduler::shared s){ - observer->OnNext(cursor); - last += due; - ++cursor; - auto keepAlive = this->shared_from_this(); - sd.Set(s->Schedule( - last, - [this, keepAlive] (Scheduler::shared s) -> Disposable { - Tick(s); - return Disposable::Empty(); - } - )); - } - }; - auto state = std::make_shared(due, scheduler->Now(), observer); - - state->last += state->due; - state->sd.Set(scheduler->Schedule( - state->last, - [=] (Scheduler::shared s) -> Disposable { - state->Tick(s); - return Disposable::Empty(); - } - )); - return state->cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Iterate.hpp b/Rx/CPP/src/cpprx/operators/Iterate.hpp deleted file mode 100644 index 8478de1..0000000 --- a/Rx/CPP/src/cpprx/operators/Iterate.hpp +++ /dev/null @@ -1,86 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_ITERATE_HPP) -#define CPPRX_RX_OPERATORS_ITERATE_HPP - -namespace rxcpp -{ - - using std::begin; - using std::end; - template - auto Iterate( - Range r, - Scheduler::shared scheduler = nullptr) - -> std::shared_ptr::type>> - { - typedef decltype(begin(r)) It; - typedef typename std::decay::type T; - - if (!scheduler) {scheduler = std::make_shared();} - auto range = std::make_shared(std::move(r)); - - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - explicit State(std::shared_ptr rangeArg) { - // finally tracked down issue caused by clang compiler bug. - // initializing in the init list only works sometimes. - // a breakpoint here would eventually show that - // cancel was true instead of false. - // initializing in the body instead works every time. - // or using new instead of std::make_shared to create - // State will cause the init list to work every time - this->cancel = false; - this->range = std::move(rangeArg); - this->r_cursor = begin(*this->range); - this->r_end = end(*this->range); - } - bool cancel; - std::shared_ptr range; - It r_cursor; - It r_end; - }; - auto state = std::make_shared(range); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - SerialDisposable sd; - - cd.Add(sd); - - sd.Set(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); - - if (state->r_cursor == state->r_end) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(*state->r_cursor); - ++state->r_cursor; - sd.Set(s->Schedule(std::move(self))); - return cd; - } - return Disposable::Empty(); - }))); - - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Materialize.hpp b/Rx/CPP/src/cpprx/operators/Materialize.hpp deleted file mode 100644 index ede4d6e..0000000 --- a/Rx/CPP/src/cpprx/operators/Materialize.hpp +++ /dev/null @@ -1,87 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_MATERIALIZE_HPP) -#define CPPRX_RX_OPERATORS_MATERIALIZE_HPP - -namespace rxcpp -{ - -namespace detail -{ - -template -class MaterializeObservable : public Producer, std::shared_ptr>> -{ - typedef MaterializeObservable This; - typedef std::shared_ptr Parent; - typedef std::shared_ptr> Source; - typedef std::shared_ptr>>> Destination; - -private: - - Source source; - - class _ : public Sink<_, std::shared_ptr>>, public Observer - { - Parent parent; - - public: - typedef Sink<_, std::shared_ptr>> SinkBase; - - _(Parent parent, Destination observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const T& t) - { - SinkBase::observer->OnNext(Notification::CreateOnNext(t)); - } - virtual void OnCompleted() - { - SinkBase::observer->OnNext(Notification::CreateOnCompleted()); - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnNext(Notification::CreateOnError(e)); - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - }; - - typedef Producer>> ProducerBase; -public: - - MaterializeObservable(Source source) : - ProducerBase([this](Parent parent, Destination observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(std::move(source)) - { - } -}; - -} - -template -std::shared_ptr>>> Materialize( - const std::shared_ptr>& source -) -{ - return std::make_shared>( - std::move(source) - ); -} - -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Merge.hpp b/Rx/CPP/src/cpprx/operators/Merge.hpp deleted file mode 100644 index 4a724ca..0000000 --- a/Rx/CPP/src/cpprx/operators/Merge.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 -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_MERGE_HPP) -#define CPPRX_RX_OPERATORS_MERGE_HPP - -namespace rxcpp -{ - - namespace detail{ - template - struct MergeSubscriber { - typedef typename SubscribeState::result_type Item; - typedef std::shared_ptr> ResultObserver; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const Item& element) - { - observer->OnNext(element); - }, - // on completed - [=] - { - if (--state->pendingComplete == 0) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - MergeSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct MergeSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - std::shared_ptr> Merge( - const std::shared_ptr>& firstSource, - const std::shared_ptr>&... otherSource - ) - { - typedef MergeSource result_type; - typedef decltype(std::make_tuple(firstSource, otherSource...)) Sources; - struct State - : std::enable_shared_from_this - { - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - State() - : pendingComplete(SourcesSize::value) - {} - std::atomic pendingComplete; - }; - Sources sources(firstSource, otherSource...); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); - ComposableDisposable cd; - detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - std::shared_ptr> Merge( - const std::shared_ptr>& firstSource, - const std::shared_ptr>& otherSource - ) - { - typedef MergeSource result_type; - typedef decltype(std::make_tuple(firstSource, otherSource)) Sources; - struct State - : std::enable_shared_from_this - { - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - State() - : pendingComplete(SourcesSize::value) - {} - std::atomic pendingComplete; - }; - Sources sources(firstSource, otherSource); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - // bug on osx prevents using make_shared - std::shared_ptr state(new State()); - ComposableDisposable cd; - detail::MergeSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Multicast.hpp b/Rx/CPP/src/cpprx/operators/Multicast.hpp deleted file mode 100644 index e3d9c75..0000000 --- a/Rx/CPP/src/cpprx/operators/Multicast.hpp +++ /dev/null @@ -1,20 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_MULTICAST_HPP) -#define CPPRX_RX_OPERATORS_MULTICAST_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> Multicast(const std::shared_ptr < Observable < T >> &source, const std::shared_ptr& multicastSubject) - { - return std::static_pointer_cast>( - std::make_shared < ConnectableSubject < std::shared_ptr < Observable < T >> , std::shared_ptr >> (source, multicastSubject)); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Never.hpp b/Rx/CPP/src/cpprx/operators/Never.hpp deleted file mode 100644 index ffdd831..0000000 --- a/Rx/CPP/src/cpprx/operators/Never.hpp +++ /dev/null @@ -1,22 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_NEVER_HPP) -#define CPPRX_RX_OPERATORS_NEVER_HPP - -namespace rxcpp -{ - template - std::shared_ptr> Never() - { - return CreateObservable( - [=](std::shared_ptr>) -> Disposable - { - return Disposable::Empty(); - }); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp b/Rx/CPP/src/cpprx/operators/ObserveOnObserver.hpp deleted file mode 100644 index 4ff79f7..0000000 --- a/Rx/CPP/src/cpprx/operators/ObserveOnObserver.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 -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_OBSERVEONOBSERVER_HPP) -#define CPPRX_RX_OPERATORS_OBSERVEONOBSERVER_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> ObserveOnObserver( - const std::shared_ptr>& source, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observerArg) - -> Disposable - { - std::shared_ptr> observer( - new ScheduledObserver(scheduler, std::move(observerArg))); - - ComposableDisposable cd; - - cd.Add(*observer.get()); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - observer->OnNext(std::move(element)); - observer->EnsureActive(); - }, - // on completed - [=] - { - observer->OnCompleted(); - observer->EnsureActive(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(std::move(error)); - observer->EnsureActive(); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Publish.hpp b/Rx/CPP/src/cpprx/operators/Publish.hpp deleted file mode 100644 index fe2fb15..0000000 --- a/Rx/CPP/src/cpprx/operators/Publish.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 -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_PUBLISH_HPP) -#define CPPRX_RX_OPERATORS_PUBLISH_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source) - { - auto multicastSubject = std::make_shared>(); - return Multicast(source, multicastSubject); - } - - template - std::shared_ptr> Publish(const std::shared_ptr < Observable < T >> &source, V value) - { - auto multicastSubject = std::make_shared>(value); - return Multicast(source, multicastSubject); - } - - template - std::shared_ptr> PublishLast(const std::shared_ptr < Observable < T >> &source) - { - auto multicastSubject = std::make_shared>(); - return Multicast(source, multicastSubject); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Random.hpp b/Rx/CPP/src/cpprx/operators/Random.hpp deleted file mode 100644 index 741acb8..0000000 --- a/Rx/CPP/src/cpprx/operators/Random.hpp +++ /dev/null @@ -1,70 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_RANDOM_HPP) -#define CPPRX_RX_OPERATORS_RANDOM_HPP - -namespace rxcpp -{ - - // - // std::mt19937 twister; - // std::uniform_int_distribution xDistribution(0, xExtent - 1); - // auto xSource = Random(twister, xDistribution, [](std::mt19937& e){ - // e.seed(std::random_device()()); - // }); - // - template - std::shared_ptr> Random( - Engine e, - Distribution d, - Seeder s, - Scheduler::shared scheduler = nullptr) - { - typedef typename Distribution::result_type T; - if (!scheduler) {scheduler = std::make_shared();} - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Engine e; - Distribution d; - T step() - { - return d(e); - } - }; - auto state = std::make_shared(); - state->cancel = false; - state->e = e; - state->d = d; - - // allow the seed to be set - s(state->e); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); - - observer->OnNext(state->step()); - return s->Schedule(std::move(self)); - }))); - - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Range.hpp b/Rx/CPP/src/cpprx/operators/Range.hpp deleted file mode 100644 index 2e346cc..0000000 --- a/Rx/CPP/src/cpprx/operators/Range.hpp +++ /dev/null @@ -1,65 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_RANGE_HPP) -#define CPPRX_RX_OPERATORS_RANGE_HPP - -namespace rxcpp -{ - - - template - auto Range( - Integral start, Integral end = std::numeric_limits::max(), Integral step = 1, - Scheduler::shared scheduler = nullptr) - -> std::shared_ptr> - { - if (!scheduler) {scheduler = std::make_shared();} - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - struct State - { - bool cancel; - Integral i; - Integral rem; - }; - auto state = std::make_shared(); - state->cancel = false; - state->i = start; - state->rem = ((end - start) + step) / step; - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - fix0([=](Scheduler::shared s, std::function self) -> Disposable - { - if (state->cancel) - return Disposable::Empty(); - - if (!state->rem) - { - observer->OnCompleted(); - } - else - { - observer->OnNext(state->i); - --state->rem; - state->i += step; - return s->Schedule(std::move(self)); - } - return Disposable::Empty(); - }))); - - return cd; - }); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/RefCount.hpp b/Rx/CPP/src/cpprx/operators/RefCount.hpp deleted file mode 100644 index 9638ca1..0000000 --- a/Rx/CPP/src/cpprx/operators/RefCount.hpp +++ /dev/null @@ -1,102 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_REFCOUNT_HPP) -#define CPPRX_RX_OPERATORS_REFCOUNT_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class RefCountObservable : public Producer, T> - { - std::shared_ptr> source; - std::mutex lock; - size_t refcount; - util::maybe subscription; - - class _ : public Sink<_, T>, public Observer - { - std::shared_ptr> parent; - - public: - typedef Sink<_, T> SinkBase; - - _(std::shared_ptr> parent, std::shared_ptr> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - SerialDisposable subscription; - subscription.Set(parent->source->Subscribe(this->shared_from_this())); - - std::unique_lock guard(parent->lock); - if (++parent->refcount == 1) - { - parent->subscription.set(parent->source->Connect()); - } - - auto local = parent; - - return Disposable([subscription, local]() - { - subscription.Dispose(); - std::unique_lock guard(local->lock); - if (--local->refcount == 0) - { - local->subscription->Dispose(); - local->subscription.reset(); - } - }); - } - - virtual void OnNext(const T& t) - { - SinkBase::observer->OnNext(t); - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer, T> ProducerBase; - public: - - RefCountObservable(std::shared_ptr> source) : - ProducerBase([](std::shared_ptr> that, std::shared_ptr> observer, Disposable&& cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new RefCountObservable::_(that, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - source(std::move(source)), - refcount(0) - { - subscription.set(Disposable::Empty()); - } - }; - } - template - const std::shared_ptr> RefCount( - const std::shared_ptr>& source - ) - { - return std::make_shared>(source); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/Return.hpp b/Rx/CPP/src/cpprx/operators/Return.hpp deleted file mode 100644 index da3b49b..0000000 --- a/Rx/CPP/src/cpprx/operators/Return.hpp +++ /dev/null @@ -1,78 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_RETURN_HPP) -#define CPPRX_RX_OPERATORS_RETURN_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class ReturnObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - T value; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnNext(local->value); - that->SinkBase::observer->OnCompleted(); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer, T> ProducerBase; - public: - - ReturnObservable(T value, Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new ReturnObservable::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - value(value), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - } - template - std::shared_ptr> Return( - T value, - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(value), std::move(scheduler)); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Scan.hpp b/Rx/CPP/src/cpprx/operators/Scan.hpp deleted file mode 100644 index fa3b00c..0000000 --- a/Rx/CPP/src/cpprx/operators/Scan.hpp +++ /dev/null @@ -1,127 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SCAN_HPP) -#define CPPRX_RX_OPERATORS_SCAN_HPP - -namespace rxcpp -{ - namespace detail - { - template - class ScanObservable : public Producer, A> - { - typedef ScanObservable This; - typedef std::shared_ptr Parent; - typedef std::shared_ptr> Source; - typedef std::shared_ptr> Destination; - - public: - typedef std::function Accumulator; - typedef std::function(T)> Seeder; - - private: - - Source source; - util::maybe seed; - Accumulator accumulator; - Seeder seeder; - - class _ : public Sink<_, A>, public Observer - { - Parent parent; - util::maybe accumulation; - - public: - typedef Sink<_, A> SinkBase; - - _(Parent parent, Destination observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const T& t) - { - try - { - if (accumulation) - { - accumulation.set(parent->accumulator(*accumulation.get(), t)); - } - else - { - accumulation.set(!!parent->seed ? parent->accumulator(*parent->seed.get(), t) : *parent->seeder(t).get()); - } - } - catch (...) - { - SinkBase::observer->OnError(std::current_exception()); - SinkBase::Dispose(); - return; - } - SinkBase::observer->OnNext(*accumulation.get()); - } - virtual void OnCompleted() - { - if (!accumulation && !!parent->seed) { - SinkBase::observer->OnNext(*parent->seed.get()); - } - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; - public: - - ScanObservable(Source source, util::maybe seed, Accumulator accumulator, Seeder seeder) : - ProducerBase([this](Parent parent, std::shared_ptr < Observer < A >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new ScanObservable::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(std::move(source)), - seed(std::move(seed)), - accumulator(std::move(accumulator)), - seeder(std::move(seeder)) - { - } - }; - } - template - std::shared_ptr> Scan( - const std::shared_ptr>& source, - A seed, - typename detail::ScanObservable::Accumulator accumulator - ) - { - return std::make_shared>( - std::move(source), - util::maybe(std::move(seed)), - std::move(accumulator), - [](T) -> util::maybe {abort(); return util::maybe();}); - } - template - std::shared_ptr> Scan( - const std::shared_ptr>& source, - typename detail::ScanObservable::Accumulator accumulator - ) - { - return std::make_shared>( - std::move(source), - util::maybe(), - std::move(accumulator), - [](T t) -> util::maybe {return util::maybe(t);}); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Select.hpp b/Rx/CPP/src/cpprx/operators/Select.hpp deleted file mode 100644 index 608d911..0000000 --- a/Rx/CPP/src/cpprx/operators/Select.hpp +++ /dev/null @@ -1,89 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SELECT_HPP) -#define CPPRX_RX_OPERATORS_SELECT_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class SelectObservable : public Producer, Tout> - { - typedef SelectObservable Self; - typedef std::shared_ptr Parent; - typedef std::function Selector; - - std::shared_ptr> source; - Selector selector; - - class _ : public Sink<_, Tout>, public Observer - { - Parent parent; - - public: - typedef Sink<_, Tout> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < Tout >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const Tin& t) - { - util::maybe result; - try { - result.set(parent->selector(t)); - } catch (...) { - SinkBase::observer->OnError(std::current_exception()); - SinkBase::Dispose(); - } - if (!!result) { - SinkBase::observer->OnNext(*result.get()); - } - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; - public: - - SelectObservable(const std::shared_ptr>& source, Selector selector) : - ProducerBase([this](Parent parent, std::shared_ptr < Observer < Tout >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new Self::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(source), - selector(std::move(selector)) - { - } - }; - } - template - auto Select( - const std::shared_ptr>& source, - S selector - ) -> const std::shared_ptr::type>> - { - typedef typename std::result_of::type Tout; - return std::make_shared>(source, std::move(selector)); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/SelectMany.hpp b/Rx/CPP/src/cpprx/operators/SelectMany.hpp deleted file mode 100644 index e282ced..0000000 --- a/Rx/CPP/src/cpprx/operators/SelectMany.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 -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SELECTMANY_HPP) -#define CPPRX_RX_OPERATORS_SELECTMANY_HPP - -namespace rxcpp -{ - - template - auto SelectMany( - const std::shared_ptr>& source, - CS collectionSelector, - RS resultSelector) - -> const std::shared_ptr::type>::type&)>::type>> - { - typedef typename std::decay::type>::type C; - typedef typename observable_item::type CI; - typedef typename std::result_of::type U; - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - std::atomic count; - std::mutex lock; - ComposableDisposable group; - }; - auto state = std::make_shared(); - state->count = 0; - - SerialDisposable sourceDisposable; - state->group.Add(sourceDisposable); - - ++state->count; - sourceDisposable.Set(Subscribe( - source, - // on next - [=](const T& sourceElement) - { - util::maybe collection; - try { - collection.set(collectionSelector(sourceElement)); - } catch(...) { - std::unique_lock guard(state->lock); - observer->OnError(std::current_exception()); - state->group.Dispose(); - return; - } - - SerialDisposable inner; - state->group.Add(inner); - - ++state->count; - inner.Set(Subscribe( - *collection.get(), - // on next - [=](const CI& collectionElement) - { - util::maybe result; - try { - result.set(resultSelector(sourceElement, collectionElement)); - } catch(...) { - std::unique_lock guard(state->lock); - observer->OnError(std::current_exception()); - state->group.Dispose(); - } - std::unique_lock guard(state->lock); - observer->OnNext(std::move(*result.get())); - }, - // on completed - [=] - { - inner.Dispose(); - if (0 == --state->count) { - std::unique_lock guard(state->lock); - observer->OnCompleted(); - state->group.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - std::unique_lock guard(state->lock); - observer->OnError(error); - state->group.Dispose(); - })); - }, - // on completed - [=] - { - if (0 == --state->count) { - std::unique_lock guard(state->lock); - observer->OnCompleted(); - state->group.Dispose(); - } else { - sourceDisposable.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - std::unique_lock guard(state->lock); - observer->OnError(error); - state->group.Dispose(); - })); - return state->group; - }); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/Skip.hpp b/Rx/CPP/src/cpprx/operators/Skip.hpp deleted file mode 100644 index e635b71..0000000 --- a/Rx/CPP/src/cpprx/operators/Skip.hpp +++ /dev/null @@ -1,132 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SKIP_HPP) -#define CPPRX_RX_OPERATORS_SKIP_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> Skip( - const std::shared_ptr>& source, - Integral n - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - enum type { - Skipping, - Forwarding - }; - }; - // keep count of remaining OnNext calls to skip and state. - auto remaining = std::make_shared, std::atomic>>(n, State::Skipping); - - ComposableDisposable cd; - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (std::get<1>(*remaining) == State::Forwarding) { - observer->OnNext(element); - } else { - auto local = --std::get<0>(*remaining); - - if (local == 0) { - std::get<1>(*remaining) = State::Forwarding; - } - } - }, - // on completed - [=] - { - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } - - template - std::shared_ptr> SkipUntil( - const std::shared_ptr>& source, - const std::shared_ptr>& terminus - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct SkipState { - enum type { - Skipping, - Taking - }; - }; - struct State { - State() : skipState(SkipState::Skipping) {} - std::atomic skipState; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - cd.Add(Subscribe( - terminus, - // on next - [=](const U& element) - { - state->skipState = SkipState::Taking; - }, - // on completed - [=] - { - state->skipState = SkipState::Taking; - }, - // on error - [=](const std::exception_ptr& error) - { - state->skipState = SkipState::Taking; - })); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (state->skipState == SkipState::Taking) { - observer->OnNext(element); - } - }, - // on completed - [=] - { - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Subscribe.hpp b/Rx/CPP/src/cpprx/operators/Subscribe.hpp deleted file mode 100644 index 5717720..0000000 --- a/Rx/CPP/src/cpprx/operators/Subscribe.hpp +++ /dev/null @@ -1,27 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SUBSCRIBE_HPP) -#define CPPRX_RX_OPERATORS_SUBSCRIBE_HPP - -namespace rxcpp -{ - - template - Disposable Subscribe( - const S& source, - typename util::identity::type&)>>::type onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) - { - auto observer = CreateObserver::type>( - std::move(onNext), std::move(onCompleted), std::move(onError)); - - return source->Subscribe(observer); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp b/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp deleted file mode 100644 index 29a4c6b..0000000 --- a/Rx/CPP/src/cpprx/operators/SubscribeOnObservable.hpp +++ /dev/null @@ -1,35 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_SUBSCRIBEONOBSERVABLE_HPP) -#define CPPRX_RX_OPERATORS_SUBSCRIBEONOBSERVABLE_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> SubscribeOnObservable( - const std::shared_ptr>& source, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(scheduler->Schedule([=](Scheduler::shared) -> Disposable { - sd.Set(ScheduledDisposable(scheduler, source->Subscribe(observer))); - return Disposable::Empty(); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Take.hpp b/Rx/CPP/src/cpprx/operators/Take.hpp deleted file mode 100644 index 20187d4..0000000 --- a/Rx/CPP/src/cpprx/operators/Take.hpp +++ /dev/null @@ -1,173 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_TAKE_HPP) -#define CPPRX_RX_OPERATORS_TAKE_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class TakeObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - - std::shared_ptr> source; - Integral count; - - class _ : public Sink<_, T>, public Observer - { - Parent parent; - Integral remaining; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent), - remaining(parent->count) - { - } - - virtual void OnNext(const T& t) - { - if (remaining > 0) - { - --remaining; - SinkBase::observer->OnNext(t); - - if (remaining == 0) - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - } - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer, T> ProducerBase; - public: - - TakeObservable(const std::shared_ptr>& source, Integral count) : - ProducerBase([this](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr<_>(new _(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(source), - count(count) - { - } - }; - } - template - std::shared_ptr> Take( - const std::shared_ptr>& source, - Integral n - ) - { - return std::make_shared>(source, n); - } - - - template - std::shared_ptr> TakeUntil( - const std::shared_ptr>& source, - const std::shared_ptr>& terminus - ) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - - struct TerminusState { - enum type { - Live, - Terminated - }; - }; - struct TakeState { - enum type { - Taking, - Completed - }; - }; - struct State { - State() : terminusState(TerminusState::Live), takeState(TakeState::Taking) {} - std::atomic terminusState; - std::atomic takeState; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - cd.Add(Subscribe( - terminus, - // on next - [=](const U& ) - { - state->terminusState = TerminusState::Terminated; - }, - // on completed - [=] - { - state->terminusState = TerminusState::Terminated; - }, - // on error - [=](const std::exception_ptr& ) - { - state->terminusState = TerminusState::Terminated; - })); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - if (state->terminusState == TerminusState::Live) { - observer->OnNext(element); - } else if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on completed - [=] - { - if (state->takeState.exchange(TakeState::Completed) == TakeState::Taking) { - state->terminusState = TerminusState::Terminated; - observer->OnCompleted(); - cd.Dispose(); - } - }, - // on error - [=](const std::exception_ptr& error) - { - state->takeState = TakeState::Completed; - state->terminusState = TerminusState::Terminated; - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/Throttle.hpp b/Rx/CPP/src/cpprx/operators/Throttle.hpp deleted file mode 100644 index 89abdd1..0000000 --- a/Rx/CPP/src/cpprx/operators/Throttle.hpp +++ /dev/null @@ -1,97 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_THROTTLE_HPP) -#define CPPRX_RX_OPERATORS_THROTTLE_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> Throttle( - const std::shared_ptr>& source, - Scheduler::clock::duration due, - Scheduler::shared scheduler) - { - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - struct State { - State() : hasValue(false), id(0) {} - std::mutex lock; - T value; - bool hasValue; - size_t id; - }; - auto state = std::make_shared(); - - ComposableDisposable cd; - - SerialDisposable sd; - cd.Add(sd); - - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - size_t current = 0; - { - std::unique_lock guard(state->lock); - state->hasValue = true; - state->value = std::move(element); - current = ++state->id; - } - sd.Set(scheduler->Schedule( - due, - [=] (Scheduler::shared) -> Disposable { - { - std::unique_lock guard(state->lock); - if (state->hasValue && state->id == current) { - observer->OnNext(std::move(state->value)); - } - state->hasValue = false; - } - - return Disposable::Empty(); - } - )); - }, - // on completed - [=] - { - bool sendValue = false; - T value; - { - std::unique_lock guard(state->lock); - sendValue = state->hasValue; - if (sendValue) { - value = std::move(state->value);} - state->hasValue = false; - ++state->id; - } - if (sendValue) { - observer->OnNext(std::move(value));} - observer->OnCompleted(); - cd.Dispose(); - }, - // on error - [=](const std::exception_ptr& error) - { - { - std::unique_lock guard(state->lock); - state->hasValue = false; - ++state->id; - } - observer->OnError(error); - cd.Dispose(); - })); - return cd; - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Throw.hpp b/Rx/CPP/src/cpprx/operators/Throw.hpp deleted file mode 100644 index 425f5eb..0000000 --- a/Rx/CPP/src/cpprx/operators/Throw.hpp +++ /dev/null @@ -1,104 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_THROW_HPP) -#define CPPRX_RX_OPERATORS_THROW_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class ThrowObservable : public Producer, T> - { - typedef ThrowObservable This; - typedef std::shared_ptr Parent; - - std::exception_ptr exception; - Scheduler::shared scheduler; - - class _ : public Sink<_, T> - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - auto local = parent; - auto that = this->shared_from_this(); - return parent->scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - that->SinkBase::observer->OnError(local->exception); - that->SinkBase::Dispose(); - return Disposable::Empty(); - }); - } - }; - - typedef Producer ProducerBase; - public: - - ThrowObservable(std::exception_ptr exception, Scheduler::shared scheduler) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new ThrowObservable::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - exception(exception), - scheduler(scheduler) - { - if (!scheduler) - { - this->scheduler = std::make_shared(); - } - } - }; - - struct throw_ptr_tag{}; - struct throw_instance_tag{}; - - template - std::shared_ptr> make_throw( - throw_ptr_tag&&, - std::exception_ptr exception, - Scheduler::shared scheduler = nullptr - ) - { - return std::make_shared>(std::move(exception), std::move(scheduler)); - } - - template - std::shared_ptr> make_throw( - throw_instance_tag&&, - E e, - Scheduler::shared scheduler = nullptr - ) - { - std::exception_ptr exception; - try {throw e;} catch(...) {exception = std::current_exception();} - return std::make_shared>(std::move(exception), std::move(scheduler)); - } - } - template - std::shared_ptr> Throw( - E e, - Scheduler::shared scheduler = nullptr - ) - { - return detail::make_throw(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::forward(e), std::move(scheduler)); - } -} - -#endif diff --git a/Rx/CPP/src/cpprx/operators/ToAsync.hpp b/Rx/CPP/src/cpprx/operators/ToAsync.hpp deleted file mode 100644 index 33bffcb..0000000 --- a/Rx/CPP/src/cpprx/operators/ToAsync.hpp +++ /dev/null @@ -1,48 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_TOASYNC_HPP) -#define CPPRX_RX_OPERATORS_TOASYNC_HPP - -namespace rxcpp -{ - -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto ToAsync(F f, Scheduler::shared scheduler = nullptr) - ->std::function < std::shared_ptr < Observable< decltype(f((*(A*)nullptr)...)) >> (const A&...)> - { - typedef decltype(f((*(A*) nullptr)...)) R; - if (!scheduler) - { - scheduler = std::make_shared(); - } - return [=](const A&... a) -> std::shared_ptr < Observable> - { - auto args = std::make_tuple(a...); - auto result = CreateAsyncSubject(); - scheduler->Schedule([=](Scheduler::shared) -> Disposable - { - util::maybe value; - try - { - value.set(util::tuple_dispatch(f, args)); - } - catch (...) - { - result->OnError(std::current_exception()); - return Disposable::Empty(); - } - result->OnNext(*value.get()); - result->OnCompleted(); - return Disposable::Empty(); - }); - return result; - }; - } -#endif -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp b/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp deleted file mode 100644 index 25813b1..0000000 --- a/Rx/CPP/src/cpprx/operators/ToStdCollection.hpp +++ /dev/null @@ -1,44 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_TOSTDCOLLECTION_HPP) -#define CPPRX_RX_OPERATORS_TOSTDCOLLECTION_HPP - -namespace rxcpp -{ - - template - std::shared_ptr> ToStdCollection( - const std::shared_ptr>& source - ) - { - typedef typename StdCollection::value_type Value; - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - auto stdCollection = std::make_shared(); - return Subscribe( - source, - // on next - [=](const Value& element) - { - stdCollection->insert(stdCollection->end(), element); - }, - // on completed - [=] - { - observer->OnNext(std::move(*stdCollection.get())); - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - observer->OnError(error); - }); - }); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Using.hpp b/Rx/CPP/src/cpprx/operators/Using.hpp deleted file mode 100644 index d435d75..0000000 --- a/Rx/CPP/src/cpprx/operators/Using.hpp +++ /dev/null @@ -1,112 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_USING_HPP) -#define CPPRX_RX_OPERATORS_USING_HPP - -namespace rxcpp -{ - - namespace detail - { - template - class UsingObservable : public Producer, T> - { - typedef UsingObservable This; - typedef std::shared_ptr Parent; - typedef typename std::decay::type Source; - - public: - typedef std::function ResourceFactory; - typedef std::function ObservableFactory; - - private: - ResourceFactory resourceFactory; - ObservableFactory observableFactory; - - class _ : public Sink<_, T>, public Observer - { - Parent parent; - Source source; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - Disposable Run() - { - ComposableDisposable cd; - auto disposable = Disposable::Empty(); - - try - { - auto resource = parent->resourceFactory(); - disposable = resource; - source = parent->observableFactory(resource); - } - catch (...) - { - cd.Add(Throw(std::current_exception())->Subscribe(this->shared_from_this())); - cd.Add(std::move(disposable)); - return cd; - } - - cd.Add(source->Subscribe(this->shared_from_this())); - cd.Add(std::move(disposable)); - return cd; - } - - virtual void OnNext(const T& t) - { - SinkBase::observer->OnNext(t); - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer ProducerBase; - public: - - UsingObservable(ResourceFactory resourceFactory, ObservableFactory observableFactory) : - ProducerBase([](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new UsingObservable::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return sink->Run(); - }), - resourceFactory(resourceFactory), - observableFactory(observableFactory) - { - } - }; - } - template - auto Using( - RF resourceFactory, - OF observableFactory - ) - -> decltype(observableFactory(resourceFactory())) - { - typedef decltype(observableFactory(resourceFactory())) ScopedObservable; - typedef typename observable_item::type T; - typedef decltype(resourceFactory()) R; - return std::make_shared>(std::move(resourceFactory), std::move(observableFactory)); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Where.hpp b/Rx/CPP/src/cpprx/operators/Where.hpp deleted file mode 100644 index d0089bd..0000000 --- a/Rx/CPP/src/cpprx/operators/Where.hpp +++ /dev/null @@ -1,86 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_WHERE_HPP) -#define CPPRX_RX_OPERATORS_WHERE_HPP - -namespace rxcpp -{ - namespace detail - { - template - class WhereObservable : public Producer, T> - { - typedef std::shared_ptr> Parent; - typedef std::function Predicate; - - std::shared_ptr> source; - Predicate predicate; - - class _ : public Sink<_, T>, public Observer - { - Parent parent; - - public: - typedef Sink<_, T> SinkBase; - - _(Parent parent, std::shared_ptr < Observer < T >> observer, Disposable cancel) : - SinkBase(std::move(observer), std::move(cancel)), - parent(parent) - { - } - - virtual void OnNext(const T& t) - { - util::maybe shouldRun; - try { - shouldRun.set(parent->predicate(t)); - } catch (...) { - SinkBase::observer->OnError(std::current_exception()); - SinkBase::Dispose(); - } - if (!!shouldRun && *shouldRun.get()) { - SinkBase::observer->OnNext(t); - } - } - virtual void OnCompleted() - { - SinkBase::observer->OnCompleted(); - SinkBase::Dispose(); - } - virtual void OnError(const std::exception_ptr& e) - { - SinkBase::observer->OnError(e); - SinkBase::Dispose(); - } - }; - - typedef Producer, T> ProducerBase; - public: - - WhereObservable(const std::shared_ptr>& source, Predicate predicate) : - ProducerBase([this](Parent parent, std::shared_ptr < Observer < T >> observer, Disposable && cancel, typename ProducerBase::SetSink setSink) -> Disposable - { - auto sink = std::shared_ptr(new WhereObservable::_(parent, observer, std::move(cancel))); - setSink(sink->GetDisposable()); - return this->source->Subscribe(sink); - }), - source(source), - predicate(std::move(predicate)) - { - } - }; - } - template - std::shared_ptr> Where( - const std::shared_ptr>& source, - P predicate - ) - { - return std::make_shared>(source, std::move(predicate)); - } -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/operators/Zip.hpp b/Rx/CPP/src/cpprx/operators/Zip.hpp deleted file mode 100644 index 8788bbc..0000000 --- a/Rx/CPP/src/cpprx/operators/Zip.hpp +++ /dev/null @@ -1,223 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "../rx-operators.hpp" - -#if !defined(CPPRX_RX_OPERATORS_ZIP_HPP) -#define CPPRX_RX_OPERATORS_ZIP_HPP - -namespace rxcpp -{ - - namespace detail{ - template - struct ZipSubscriber { - typedef typename std::tuple_element::type::second_type::value_type Item; - typedef std::shared_ptr> ResultObserver; - struct Next - { - std::shared_ptr state; - const ResultObserver& observer; - const ComposableDisposable& cd; - explicit Next( - std::shared_ptr state, - const ResultObserver& observer, - const ComposableDisposable& cd) - : state(std::move(state)) - , observer(observer) - , cd(cd) { - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - void operator()(ZipQueue&... queue) { - // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue.second.empty()...}; - if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { - // all queues have an item. - // - // copy front of each queue - auto args = std::make_tuple(queue.second.front()...); - - // cause side-effect of pop on each queue - std::make_tuple((queue.second.pop(), true)...); - - typedef decltype(util::tuple_dispatch(state->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(state->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - // build new array to check for any empty queue - bool post_empties[] = {queue.first && queue.second.empty()...}; - if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { - // at least one queue is empty and at least one of the sources has completed. - // it is time to stop. - observer->OnCompleted(); - cd.Dispose(); - } - } -#else - template - void operator()(ZipQueue1& queue1, ZipQueue2& queue2) { - // build array of bool that we can iterate to detect empty queues - bool empties[] = {queue1.second.empty(), queue2.second.empty()}; - if (std::find(std::begin(empties), std::end(empties), true) == std::end(empties)) { - // all queues have an item. - // - // copy front of each queue - auto args = std::make_tuple(queue1.second.front(), queue2.second.front()); - - queue1.second.pop(); - queue2.second.pop(); - - typedef decltype(util::tuple_dispatch(state->selector, args)) U; - util::maybe result; - try { - result.set(util::tuple_dispatch(state->selector, args)); - } catch(...) { - observer->OnError(std::current_exception()); - } - if (!!result) { - observer->OnNext(std::move(*result.get())); - } - } - // build new array to check for any empty queue - bool post_empties[] = {queue1.first && queue1.second.empty(), queue2.first && queue2.second.empty()}; - if (std::find(std::begin(post_empties), std::end(post_empties), true) != std::end(post_empties)) { - // at least one queue is empty and at least one of the sources has completed. - // it is time to stop. - observer->OnCompleted(); - cd.Dispose(); - } - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - }; - static void subscribe( - ComposableDisposable& cd, - const std::shared_ptr>& observer, - const std::shared_ptr& state, - const typename SubscribeState::Sources& sources) { - cd.Add(Subscribe( - std::get(sources), - // on next - [=](const Item& element) - { - std::unique_lock guard(state->lock); - if (state->isStopped) {return;} - std::get(state->queues).second.push(element); - Next next(state, observer, cd); - util::tuple_dispatch(next, state->queues); - }, - // on completed - [=] - { - std::unique_lock guard(state->lock); - if (state->isStopped) {return;} - std::get(state->queues).first = true; - Next next(state, observer, cd); - util::tuple_dispatch(next, state->queues); - }, - // on error - [=](const std::exception_ptr& error) - { - std::unique_lock guard(state->lock); - if (state->isStopped) {return;} - observer->OnError(error); - cd.Dispose(); - })); - ZipSubscriber:: - subscribe(cd, observer, state, sources); - } - }; - template - struct ZipSubscriber { - static void subscribe( - ComposableDisposable& , - const std::shared_ptr>& , - const std::shared_ptr& , - const typename SubscribeState::Sources& ) {} - }; - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto Zip( - S selector, - const std::shared_ptr>&... source - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>...> Sources; - typedef std::tuple>...> Queues; - struct State { - typedef Queues Queues; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : selector(std::move(selector)) - , isStopped(false) - {} - std::mutex lock; - S selector; - Queues queues; - bool isStopped; - }; - Sources sources(source...); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - cd.Add(Disposable([state](){state->isStopped = true;})); - detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#else - template - auto Zip( - S selector, - const std::shared_ptr>& source1, - const std::shared_ptr>& source2 - ) - -> std::shared_ptr::type>> - { - typedef typename std::result_of::type result_type; - typedef std::tuple>, std::shared_ptr>> Sources; - typedef std::tuple>, std::pair>> Queues; - struct State { - typedef Queues Queues; - typedef Sources Sources; - typedef result_type result_type; - typedef std::tuple_size SourcesSize; - explicit State(S selector) - : selector(std::move(selector)) - , isStopped(false) - {} - std::mutex lock; - S selector; - Queues queues; - bool isStopped; - }; - Sources sources(source1, source2); - // bug on osx prevents using make_shared - std::shared_ptr state(new State(std::move(selector))); - return CreateObservable( - [=](std::shared_ptr> observer) -> Disposable - { - ComposableDisposable cd; - detail::ZipSubscriber<0, State::SourcesSize::value, State>::subscribe(cd, observer, state, sources); - return cd; - }); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES -} - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-base.hpp b/Rx/CPP/src/cpprx/rx-base.hpp deleted file mode 100644 index 43acb56..0000000 --- a/Rx/CPP/src/cpprx/rx-base.hpp +++ /dev/null @@ -1,1029 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_BASE_HPP) -#define CPPRX_RX_BASE_HPP - -namespace rxcpp -{ - ////////////////////////////////////////////////////////////////////// - // - // Abstract interfaces - - template - struct Observer - { - virtual void OnNext(const T&) {} - virtual void OnCompleted() {} - virtual void OnError(const std::exception_ptr&) {} - - virtual ~Observer() {} - }; - - class Disposable - { - Disposable(); - Disposable(const Disposable&); - typedef std::function dispose_type; - dispose_type dispose; - public: - explicit Disposable(dispose_type disposearg) - : dispose(std::move(disposearg)) { - disposearg = nullptr;} - Disposable(Disposable&& other) - : dispose(std::move(other.dispose)) { - other.dispose = nullptr; } - Disposable& operator=(Disposable other) { - swap(other); - return *this; - } - void Dispose() - { - if (dispose) { - dispose(); - dispose = nullptr; - } - } - void swap(Disposable& rhs) {{using std::swap; swap(dispose, rhs.dispose);}} - static Disposable Empty() { return Disposable(nullptr); } - }; - inline void swap(Disposable& lhs, Disposable& rhs) {lhs.swap(rhs);} - - template - struct Observable - { - virtual Disposable Subscribe(std::shared_ptr> observer) = 0; - virtual ~Observable() {} - }; - - template - struct GroupedObservable : Observable - { - virtual K Key() = 0; - virtual ~GroupedObservable() {} - }; - - template - struct ConnectableObservable : Observable - { - virtual Disposable Connect() = 0; - virtual ~ConnectableObservable() {} - }; - - struct Scheduler : public std::enable_shared_from_this - { - typedef std::chrono::steady_clock clock; - typedef std::shared_ptr shared; - - class Work { - struct bool_r{}; - static bool_r bool_true(){return bool_r();} - typedef decltype(&bool_true) bool_type; - - struct State - { - typedef std::function F; - F work; - bool disposed; - inline void Dispose() { - disposed = true; - } - }; - std::shared_ptr state; - - template - struct assign - { - void operator()(std::shared_ptr& state, State::F fn) { - if (!state) { - state = std::make_shared(); - } - state->work = std::move(fn); - } - void operator()(std::shared_ptr& state, std::nullptr_t) { - if (state) { - state->work = nullptr; - } - } - }; - - template - struct assign - { - void operator()(std::shared_ptr& state, const Work& o) { - state = o.state; - } - void operator()(std::shared_ptr& state, Work&& o) { - state = std::move(o.state); - } - }; - public: - Work() - : state(std::make_shared()) - { - state->disposed = false; - } - template - Work(Fn&& fn) - : state(std::make_shared()) - { - assign<1, std::is_same::type>::value>()(state, std::forward(fn)); - state->disposed = false; - } - template - Work& operator=(Fn&& fn) - { - assign<1, std::is_same::type>::value>()(state, std::forward(fn)); - return *this; - } - inline Disposable operator()(shared s) { - if (!state->disposed) { - return state->work(s); - } - return Disposable::Empty(); - } - inline operator bool_type() const {return (!state->disposed && !!state->work) ? &bool_true : nullptr;} - inline void Dispose() const { - state->Dispose(); - } - inline operator Disposable() const - { - // make sure to capture state and not 'this'. - auto local = state; - return Disposable([local]{ - local->Dispose(); - }); - } - }; - - shared get() {return shared_from_this();} - - virtual ~Scheduler() {} - - virtual clock::time_point Now() =0; - virtual Disposable Schedule(Work work) = 0; - virtual Disposable Schedule(clock::duration due, Work work) = 0; - virtual Disposable Schedule(clock::time_point due, Work work) = 0; - }; - - ////////////////////////////////////////////////////////////////////// - // - // disposables - - - // reference handle type for a container for composing disposables - class ComposableDisposable - { - typedef std::shared_ptr shared_disposable; - typedef std::weak_ptr weak_disposable; - struct State - { - std::vector disposables; - std::mutex lock; - bool isDisposed; - - State() : isDisposed(false) - { - } - weak_disposable Add(Disposable&& d) - { - return Add(std::make_shared(std::move(d))); - } - weak_disposable Add(shared_disposable s) - { - std::unique_lock guard(lock); - if (isDisposed) { - guard.unlock(); - s->Dispose(); - } else { - auto end = std::end(disposables); - auto it = std::find(std::begin(disposables), end, s); - if (it == end) - { - disposables.emplace_back(s); - } - } - return s; - } - void Remove(weak_disposable w) - { - std::unique_lock guard(lock); - auto s = w.lock(); - if (s) - { - auto end = std::end(disposables); - auto it = std::find(std::begin(disposables), end, s); - if (it != end) - { - disposables.erase(it); - } - } - } - void Dispose() - { - std::unique_lock guard(lock); - - if (!isDisposed) - { - isDisposed = true; - auto v = std::move(disposables); - guard.unlock(); - - std::for_each(v.begin(), v.end(), - [](shared_disposable& d) { - d->Dispose(); }); - } - } - }; - - mutable std::shared_ptr state; - - public: - - ComposableDisposable() - : state(std::make_shared()) - { - } - weak_disposable Add(shared_disposable s) const - { - return state->Add(std::move(s)); - } - weak_disposable Add(Disposable d) const - { - return state->Add(std::move(d)); - } - void Remove(weak_disposable w) const - { - state->Remove(w); - } - void Dispose() const - { - state->Dispose(); - } - operator Disposable() const - { - // make sure to capture state and not 'this'. - // usage means that 'this' will usualy be destructed - // immediately - auto local = state; - return Disposable([local]{ - local->Dispose(); - }); - } - }; - - class ScheduledDisposable - { - struct State : public std::enable_shared_from_this - { - Scheduler::shared scheduler; - Disposable disposable; - - State(Scheduler::shared scheduler, Disposable disposable) - : scheduler(std::move(scheduler)) - , disposable(std::move(disposable)) - { - } - void Dispose() - { - auto local = std::move(scheduler); - if (local) { - auto keepAlive = shared_from_this(); - local->Schedule([keepAlive] (Scheduler::shared) -> Disposable { - keepAlive->disposable.Dispose(); - return Disposable::Empty(); - }); - } - } - }; - - std::shared_ptr state; - - ScheduledDisposable(); - public: - - ScheduledDisposable(Scheduler::shared scheduler, Disposable disposable) - : state(new State(std::move(scheduler), std::move(disposable))) - { - } - ScheduledDisposable(const ScheduledDisposable& o) - : state(o.state) - { - } - ScheduledDisposable(ScheduledDisposable&& o) - : state(std::move(o.state)) - { - o.state = nullptr; - } - ScheduledDisposable& operator=(ScheduledDisposable o) { - using std::swap; - swap(o.state, state); - return *this; - } - void Dispose() const - { - state->Dispose(); - } - operator Disposable() const - { - // make sure to capture state and not 'this'. - // usage means that 'this' will usualy be destructed - // immediately - auto local = state; - return Disposable([local]{ - local->Dispose(); - }); - } - }; - - class SerialDisposable - { - struct State - { - mutable Disposable disposable; - mutable bool disposed; - mutable std::mutex lock; - - State() : disposable(Disposable::Empty()), disposed(false) {} - - void Set(Disposable disposeArg) const - { - std::unique_lock guard(lock); - if (!disposed) { - using std::swap; - swap(disposable, disposeArg); - } - guard.unlock(); - disposeArg.Dispose(); - } - void Dispose() - { - std::unique_lock guard(lock); - if (!disposed) { - disposed = true; - auto local = std::move(disposable); - guard.unlock(); - local.Dispose(); - } - } - }; - - mutable std::shared_ptr state; - - public: - - SerialDisposable() - : state(std::make_shared()) - { - } - void Dispose() const - { - state->Dispose(); - } - void Set(Disposable disposeArg) const - { - state->Set(std::move(disposeArg)); - } - operator Disposable() const - { - // make sure to capture state and not 'this'. - // usage means that 'this' will usualy be destructed - // immediately - auto local = state; - return Disposable([local]{ - local->Dispose(); - }); - } - }; - - template - class ScheduledItem { - public: - ScheduledItem(Absolute due, Scheduler::Work work) - : due(due) - , work(std::move(work)) - {} - - static Disposable Do(Scheduler::Work& work, Scheduler::shared scheduler) - { - if (work) - { - return work(std::move(scheduler)); - } - return Disposable::Empty(); - } - - Absolute due; - Scheduler::Work work; - }; - - struct LocalScheduler : public Scheduler - { - private: - LocalScheduler(const LocalScheduler&); - - public: - typedef ScheduledItem QueueItem; - static Disposable Do(Work& work, const Scheduler::shared& scheduler) - { - return QueueItem::Do(work, scheduler); - } - - public: - LocalScheduler() - { - } - virtual ~LocalScheduler() - { - } - - virtual clock::time_point Now() {return clock::now();} - - using Scheduler::Schedule; - virtual Disposable Schedule(Work work) - { - clock::time_point dueTime = clock::now(); - return Schedule(dueTime, std::move(work)); - } - - virtual Disposable Schedule(clock::duration due, Work work) - { - clock::time_point dueTime = clock::now() + due; - return Schedule(dueTime, std::move(work)); - } - }; - - template - struct VirtualTimeSchedulerBase : public Scheduler - { - private: - VirtualTimeSchedulerBase(const VirtualTimeSchedulerBase&); - - bool is_enabled; - - public: - virtual ~VirtualTimeSchedulerBase() - { - } - - protected: - VirtualTimeSchedulerBase() - : is_enabled(false) - , clock_now(0) - { - } - explicit VirtualTimeSchedulerBase(Absolute initialClock) - : is_enabled(false) - , clock_now(initialClock) - { - } - - typedef Scheduler::clock clock; - typedef Scheduler::Work Work; - typedef ScheduledItem QueueItem; - - Absolute clock_now; - - virtual Absolute Add(Absolute, Relative) =0; - - virtual clock::time_point ToTimePoint(Absolute) =0; - virtual Relative ToRelative(clock::duration) =0; - - virtual util::maybe GetNext() =0; - - public: - static Disposable Do(Work& work, const Scheduler::shared& scheduler) - { - return QueueItem::Do(work, scheduler); - } - - virtual Disposable ScheduleAbsolute(Absolute, Work) =0; - - virtual Disposable ScheduleRelative(Relative dueTime, Work work) { - auto at = Add(clock_now, dueTime); - return ScheduleAbsolute(at, std::move(work)); - } - - virtual clock::time_point Now() {return ToTimePoint(clock_now);} - - bool IsEnabled() {return is_enabled;} - Absolute Clock() {return clock_now;} - - using Scheduler::Schedule; - virtual Disposable Schedule(Work work) - { - return ScheduleAbsolute(clock_now, std::move(work)); - } - - virtual Disposable Schedule(clock::duration due, Work work) - { - return ScheduleRelative(ToRelative(due), std::move(work)); - } - - virtual Disposable Schedule(clock::time_point due, Work work) - { - return ScheduleRelative(ToRelative(due - Now()), std::move(work)); - } - - void Start() - { - if (!is_enabled) { - is_enabled = true; - do { - auto next = GetNext(); - if (!!next && !!next->work) { - if (next->due > clock_now) { - clock_now = next->due; - } - Do(next->work, shared_from_this()); - } - else { - is_enabled = false; - } - } while (is_enabled); - } - } - - void Stop() - { - is_enabled = false; - } - - void AdvanceTo(Absolute time) - { - if (time < clock_now) { - abort(); - } - - if (time == clock_now) { - return; - } - - if (!is_enabled) { - is_enabled = true; - do { - auto next = GetNext(); - if (!!next && !!next->work && next->due <= time) { - if (next->due > clock_now) { - clock_now = next->due; - } - Do(next->work, shared_from_this()); - } - else { - is_enabled = false; - } - } while (is_enabled); - - clock_now = time; - } - else { - abort(); - } - } - - void AdvanceBy(Relative time) - { - auto dt = Add(clock_now, time); - - if (dt < clock_now) { - abort(); - } - - if (dt == clock_now) { - return; - } - - if (!is_enabled) { - AdvanceTo(dt); - } - else { - abort(); - } - } - - void Sleep(Relative time) - { - auto dt = Add(clock_now, time); - - if (dt < clock_now) { - abort(); - } - - clock_now = dt; - } - - }; - - template - class Recorded - { - long time; - T value; - public: - Recorded(long time, T value) : time(time), value(value) { - } - long Time() const {return time;} - const T& Value() const {return value;} - }; - - template - bool operator == (Recorded lhs, Recorded rhs) { - return lhs.Time() == rhs.Time() && lhs.Value() == rhs.Value(); - } - - template - std::ostream& operator<< (std::ostream& out, const Recorded& r) { - out << "@" << r.Time() << "-" << r.Value(); - return out; - } - - class Subscription - { - long subscribe; - long unsubscribe; - - public: - explicit inline Subscription(long subscribe) : subscribe(subscribe), unsubscribe(std::numeric_limits::max()) { - } - inline Subscription(long subscribe, long unsubscribe) : subscribe(subscribe), unsubscribe(unsubscribe) { - } - inline long Subscribe() const {return subscribe;} - inline long Unsubscribe() const {return unsubscribe;} - }; - - 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; - } - - template - struct Notification - { - typedef std::function OnNext; - typedef std::function OnCompleted; - typedef std::function OnError; - - virtual ~Notification() {} - - virtual void Out(std::ostream& out) =0; - virtual bool Equals(std::shared_ptr> other) = 0; - virtual void Accept(std::shared_ptr>) =0; - virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) =0; - - private: - struct OnNextNotification : public Notification { - OnNextNotification(T value) : value(std::move(value)) { - } - virtual void Out(std::ostream& out) { - out << "OnNext( " << value << ")"; - } - virtual bool Equals(std::shared_ptr> other) { - bool result = false; - other->Accept([this, &result](T value) { result = this->value == value;}, [](){}, [](std::exception_ptr){}); - return result; - } - virtual void Accept(std::shared_ptr> o) { - if (!o) { - abort(); - } - o->OnNext(value); - } - virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { - if (!onnext || !oncompleted || !onerror) { - abort(); - } - onnext(value); - } - const T value; - }; - - struct OnCompletedNotification : public Notification { - OnCompletedNotification() { - } - virtual void Out(std::ostream& out) { - out << "OnCompleted()"; - } - virtual bool Equals(std::shared_ptr> other) { - bool result = false; - other->Accept([](T) {}, [&result](){result = true;}, [](std::exception_ptr){}); - return result; - } - virtual void Accept(std::shared_ptr> o) { - if (!o) { - abort(); - } - o->OnCompleted(); - } - virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { - if (!onnext || !oncompleted || !onerror) { - abort(); - } - oncompleted(); - } - }; - - struct OnErrorNotification : public Notification { - OnErrorNotification(std::exception_ptr ep) : ep(ep) { - } - virtual void Out(std::ostream& out) { - out << "OnError()"; - } - virtual bool Equals(std::shared_ptr> other) { - bool result = false; - // not trying to compare exceptions - other->Accept([](T) {}, [](){}, [&result](std::exception_ptr){result = true;}); - return result; - } - virtual void Accept(std::shared_ptr> o) { - if (!o) { - abort(); - } - o->OnError(ep); - } - virtual void Accept(OnNext onnext, OnCompleted oncompleted, OnError onerror) { - if (!onnext || !oncompleted || !onerror) { - abort(); - } - onerror(ep); - } - const std::exception_ptr ep; - }; - - public: - static - std::shared_ptr CreateOnNext(T value) { - return std::make_shared(std::move(value)); - } - static - std::shared_ptr CreateOnCompleted() { - return std::make_shared(); - } - template - static - std::shared_ptr CreateOnError(Exception&& e) { - std::exception_ptr ep; - try {throw std::forward(e);} - catch (...) {ep = std::current_exception();} - return std::make_shared(ep); - } - static - std::shared_ptr CreateOnError(std::exception_ptr ep) { - return std::make_shared(ep); - } - }; - - template - bool operator == (std::shared_ptr> lhs, std::shared_ptr> rhs) { - if (!lhs && !rhs) {return true;} - if (!lhs || !rhs) {return false;} - return lhs->Equals(rhs); - } - - template - std::ostream& operator<< (std::ostream& out, const std::shared_ptr>& n) { - n->Out(out); - return out; - } - - template - struct TestableObserver : public Observer - { - virtual std::vector>>> Messages() =0; - }; - - template - struct TestableObservable : public Observable - { - virtual std::vector Subscriptions() =0; - - virtual std::vector>>> Messages() =0; - }; - - template - class TupleDispatch { - Target target; - public: - TupleDispatch(Target target) : target(std::move(target)) { - } - template - auto operator()(const Tuple& tuple) - -> decltype(util::tuple_dispatch(target, tuple)) { - return util::tuple_dispatch(target, tuple);} - template - auto operator()(const Tuple& tuple) const - -> decltype(util::tuple_dispatch(target, tuple)) { - return util::tuple_dispatch(target, tuple);} - }; - - template - TupleDispatch MakeTupleDispatch(Target&& target) { - return TupleDispatch(std::forward(target));} - - template - auto DispatchTuple(Tuple&& tuple, Target&& target) -> - decltype(util::tuple_dispatch(std::forward(target), std::forward(tuple))) { - return util::tuple_dispatch(std::forward(target), std::forward(tuple));} - -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto TieTuple(T&& t) -> - decltype(util::tuple_tie(std::forward(t))) { - return util::tuple_tie(std::forward(t));} -#endif //RXCPP_USE_VARIADIC_TEMPLATES - - template - class Subject; - - template - class BehaviorSubject; - - template - class AsyncSubject; - - template - class ConnectableSubject; - - template - class GroupedSubject; - - template - T item(const std::shared_ptr>&); - - template - T item(const std::shared_ptr>&); - - template - struct is_observable {static const bool value = false;}; - - template - struct is_observable>> {static const bool value = true;}; - - template - struct is_observable>> {static const bool value = true;}; - - template - struct is_observable>> {static const bool value = true;}; - - template - struct is_observable < std::shared_ptr < AsyncSubject> > {static const bool value = true; }; - - template - struct is_observable < std::shared_ptr < ConnectableSubject> > {static const bool value = true; }; - - template - struct is_observable>> {static const bool value = true;}; - - template - struct is_observable>> {static const bool value = true;}; - -namespace detail { - template - struct observable_item; - - template - struct observable_item>> {typedef T type;}; - - template - struct observable_item>> {typedef T type;}; - - template - struct observable_item < std::shared_ptr < ConnectableObservable> > {typedef T type; }; - - template - struct observable_item>> {typedef T type;}; -} - template - struct observable_item - { - typedef typename detail::observable_item::type>::type type; - }; - - template - struct observable_observer; - - template - struct observable_observer>> {typedef std::shared_ptr> type;}; - - template - struct observable_observer < std::shared_ptr < ConnectableObservable> > {typedef std::shared_ptr < Observer < T >> type; }; - - template - struct observable_observer>> {typedef std::shared_ptr> type;}; - - template - struct observer_item; - - template - struct observer_item>> {typedef T type;}; - - template - struct observer_item>> {typedef T type;}; - - template - struct subject_item; - - template - struct subject_item>> {typedef T type;}; - - template - struct subject_item>> {typedef T type;}; - - template - struct subject_item < std::shared_ptr < AsyncSubject> > {typedef T type; }; - - template - struct subject_item < std::shared_ptr < ConnectableSubject> > : subject_item {}; - - template - struct subject_item>> {typedef T type;}; - - template - struct subject_observer; - - template - struct subject_observer>> {typedef std::shared_ptr> type;}; - - template - struct subject_observer>> {typedef std::shared_ptr> type;}; - - template - struct subject_observer < std::shared_ptr < AsyncSubject> > {typedef std::shared_ptr < Observer < T >> type; }; - - template - struct subject_observer < std::shared_ptr < ConnectableSubject> > : subject_observer {}; - - template - struct subject_observable; - - template - struct subject_observable>> {typedef std::shared_ptr> type;}; - - template - struct subject_observable>> {typedef std::shared_ptr> type;}; - - template - struct subject_observable < std::shared_ptr < AsyncSubject> > {typedef std::shared_ptr < Observable < T >> type; }; - - template - struct subject_observable < std::shared_ptr < ConnectableSubject> > : subject_observable {}; - - template - std::shared_ptr> observable(const std::shared_ptr < Observable < T >> &o){ return o; } - - template - std::shared_ptr> observable(const std::shared_ptr < GroupedObservable < K, T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } - - template - std::shared_ptr> observable(const std::shared_ptr < TestableObservable < T >> &o){ return std::static_pointer_cast < Observable < T >> (o); } - - template - std::shared_ptr< Observable < T >> observable(const std::shared_ptr < ConnectableObservable < T >> &o){ - return std::static_pointer_cast < Observable < T >> (o); } - - template - std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observable(const std::shared_ptr < AsyncSubject < T >> &s){ return std::static_pointer_cast < Observable < T >> (s); } - - template - typename subject_observable::type observable(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s){ - return std::static_pointer_cast < Observable < typename subject_item::type >> (s); } - - template - std::shared_ptr> observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observer(const std::shared_ptr < Observer < T >> &o){ return o; } - - template - std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observer(const std::shared_ptr < AsyncSubject < T >> &s){ return std::static_pointer_cast < Observer < T >> (s); } - - template - void observer(const std::shared_ptr < ConnectableSubject < Source, Subject >> &s); // no observer - - template - std::shared_ptr> observer(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} - - template - std::shared_ptr> observer(const std::shared_ptr>& o){return std::static_pointer_cast>(o);} - - template - std::shared_ptr> grouped_observable(const std::shared_ptr>& s){return std::static_pointer_cast>(s);} -} -#endif diff --git a/Rx/CPP/src/cpprx/rx-includes.hpp b/Rx/CPP/src/cpprx/rx-includes.hpp deleted file mode 100644 index 4ef0221..0000000 --- a/Rx/CPP/src/cpprx/rx-includes.hpp +++ /dev/null @@ -1,100 +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(CPPRX_RX_INCLUDES_HPP) -#define CPPRX_RX_INCLUDES_HPP - -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// some configuration macros -#if defined(_MSC_VER) - -#if _MSC_VER > 1600 -#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 - -#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 - -#endif - -#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -#define RXCPP_USE_WINRT 0 -#else -#define RXCPP_USE_WINRT 1 -#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_WINRT) -#undef RXCPP_USE_WINRT -#define RXCPP_USE_WINRT RXCPP_FORCE_USE_WINRT -#endif - -#include "rx-util.hpp" -#include "rx-base.hpp" -#include "rx-scheduler.hpp" -#include "rx-windows.hpp" -#include "rx-operators.hpp" -#include "rx-winrt.hpp" - -#pragma pop_macro("min") -#pragma pop_macro("max") - -#endif diff --git a/Rx/CPP/src/cpprx/rx-operators.hpp b/Rx/CPP/src/cpprx/rx-operators.hpp deleted file mode 100644 index cbef605..0000000 --- a/Rx/CPP/src/cpprx/rx-operators.hpp +++ /dev/null @@ -1,1018 +0,0 @@ - // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_OPERATORS_HPP) -#define CPPRX_RX_OPERATORS_HPP - -namespace rxcpp -{ - - ////////////////////////////////////////////////////////////////////// - // - // constructors - template - struct CreatedAutoDetachObserver : public Observer, public std::enable_shared_from_this> - { - std::shared_ptr> observer; - mutable std::atomic isStopped; - mutable SerialDisposable disposable; - - virtual ~CreatedAutoDetachObserver() { - if (!isStopped) { - abort(); - } - } - - CreatedAutoDetachObserver() - : isStopped(false) - { - } - - virtual void OnNext(const T& element) - { - if (!isStopped) { - auto keepAlive = this->shared_from_this(); - RXCPP_UNWIND(disposer, [&](){ - this->isStopped = true; - this->disposable.Dispose(); - }); - observer->OnNext(element); - disposer.dismiss(); - } - } - virtual void OnCompleted() - { - if (!isStopped.exchange(true)) { - auto keepAlive = this->shared_from_this(); - RXCPP_UNWIND(disposer, [&](){ - this->disposable.Dispose(); - }); - observer->OnCompleted(); - } - } - virtual void OnError(const std::exception_ptr& error) - { - if (!isStopped.exchange(true)) { - auto keepAlive = this->shared_from_this(); - RXCPP_UNWIND(disposer, [&](){ - this->disposable.Dispose(); - }); - observer->OnError(error); - } - } - - void Dispose() const { - isStopped = true; - disposable.Dispose(); - } - operator Disposable() const - { - // make sure to capture state and not 'this'. - auto local = this->shared_from_this(); - return Disposable([local]{ - local->Dispose(); - }); - } - - bool Fail(const std::exception_ptr& error) - { - if (!isStopped.exchange(true)) { - auto keepAlive = this->shared_from_this(); - RXCPP_UNWIND(disposer, [&](){ - this->disposable.Dispose(); - }); - observer->OnError(error); - return true; - } - return false; - } - }; - - template - std::shared_ptr> CreateAutoDetachObserver( - std::shared_ptr> observer - ) - { - auto p = std::make_shared>(); - p->observer = std::move(observer); - - return p; - } - - template - class CreatedObservable : public Observable - { - S subscribe; - - public: - CreatedObservable(S subscribe) - : subscribe(std::move(subscribe)) - { - } - virtual Disposable Subscribe(std::shared_ptr> observer) - { - auto autoDetachObserver = CreateAutoDetachObserver(std::move(observer)); - - if (CurrentThreadScheduler::IsScheduleRequired()) { - auto scheduler = std::make_shared(); - scheduler->Schedule( - [=](Scheduler::shared) -> Disposable { - try { - autoDetachObserver->disposable.Set(this->subscribe(autoDetachObserver)); - } catch (...) { - if (!autoDetachObserver->Fail(std::current_exception())) { - throw; - } - } - return Disposable::Empty(); - } - ); - return *autoDetachObserver; - } - try { - autoDetachObserver->disposable.Set(subscribe(autoDetachObserver)); - return *autoDetachObserver; - } catch (...) { - if (!autoDetachObserver->Fail(std::current_exception())) { - throw; - } - } - return *autoDetachObserver; - } - }; - - template - std::shared_ptr> CreateObservable(S subscribe) - { - return std::make_shared>(std::move(subscribe)); - } - - template - struct CreatedObserver : public Observer - { - std::function onNext; - std::function onCompleted; - std::function onError; - - virtual ~CreatedObserver() { - } - - virtual void OnNext(const T& element) - { - if(onNext) - { - onNext(element); - } - } - virtual void OnCompleted() - { - if(onCompleted) - { - onCompleted(); - } - } - virtual void OnError(const std::exception_ptr& error) - { - if(onError) - { - onError(error); - } - } - }; - - template - std::shared_ptr> CreateObserver( - std::function onNext, - std::function onCompleted = nullptr, - std::function onError = nullptr - ) - { - auto p = std::make_shared>(); - p->onNext = std::move(onNext); - p->onCompleted = std::move(onCompleted); - p->onError = std::move(onError); - - return p; - } - - - namespace detail - { - template - class Sink : public std::enable_shared_from_this - { - typedef std::shared_ptr> SinkObserver; - mutable util::maybe cancel; - - // need to prevent disposed observer from being - // deleted since it may still be in use on the stack - mutable SinkObserver expired; - protected: - mutable SinkObserver observer; - - public: - Sink(SinkObserver observerArg, Disposable cancelArg) : - observer(std::move(observerArg)) - { - cancel.set(std::move(cancelArg)); - if (!observer) - { - observer = std::make_shared>(); - } - } - - void Dispose() const - { - expired = std::make_shared>(); - using std::swap; - swap(observer, expired); - - if (cancel) - { - cancel->Dispose(); - cancel.reset(); - } - } - - Disposable GetDisposable() const - { - // make sure to capture state and not 'this'. - // usage means that 'this' will usualy be destructed - // immediately - auto local = this->shared_from_this(); - return Disposable([local]{ - local->Dispose(); - }); - } - }; - - template - class Producer : public std::enable_shared_from_this, public Observable - { - public: - typedef std::function SetSink; - typedef std::function, std::shared_ptr>, Disposable, SetSink)> Run; - private: - Run run; - struct State - { - SerialDisposable sink; - SerialDisposable subscription; - }; - public: - Producer(Run run) : - run(std::move(run)) - { - } - - virtual Disposable Subscribe(std::shared_ptr> observer) - { - auto state = std::make_shared(); - auto that = this->shared_from_this(); - if (CurrentThreadScheduler::IsScheduleRequired()) { - auto scheduler = std::make_shared(); - scheduler->Schedule([=](Scheduler::shared) -> Disposable - { - state->subscription.Set( - this->run(that, observer, state->subscription, [=](Disposable d) - { - state->sink.Set(std::move(d)); - })); - return Disposable::Empty(); - }); - } - else - { - state->subscription.Set( - run(that, observer, state->subscription, [=](Disposable d) - { - state->sink.Set(std::move(d)); - })); - } - return Disposable([=]() - { - state->sink.Dispose(); - state->subscription.Dispose(); - }); - } - }; - - } - - - struct SubjectState { - enum type { - Invalid, - Forwarding, - Completed, - Error - }; - }; - - template - class ObservableSubject : - public Base, - public std::enable_shared_from_this - { - protected: - std::mutex lock; - SubjectState::type state; - std::exception_ptr error; - std::vector>> observers; - - virtual ~ObservableSubject() { - // putting this first means that the observers - // will be destructed outside the lock - std::vector>> empty; - - std::unique_lock guard(lock); - using std::swap; - swap(observers, empty); - } - - ObservableSubject() : state(SubjectState::Forwarding) { - } - - void RemoveObserver(std::shared_ptr> toRemove) - { - std::unique_lock guard(lock); - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - *it = nullptr; - } - public: - - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - { - std::unique_lock guard(lock); - if (state == SubjectState::Completed) { - observer->OnCompleted(); - return Disposable::Empty(); - } else if (state == SubjectState::Error) { - observer->OnError(error); - return Disposable::Empty(); - } else { - for(auto& o : observers) - { - if (!o){ - o = std::move(observer); - return d; - } - } - observers.push_back(std::move(observer)); - return d; - } - } - } - }; - - template - class ObserverSubject : - public Observer, - public Base - { - public: - ObserverSubject() {} - - template - explicit ObserverSubject(A&& a) : Base(std::forward(a)) {} - - virtual void OnNext(const T& element) - { - std::unique_lock guard(Base::lock); - auto local = Base::observers; - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnNext(element); - } - } - } - virtual void OnCompleted() - { - std::unique_lock guard(Base::lock); - Base::state = SubjectState::Completed; - auto local = std::move(Base::observers); - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnCompleted(); - } - } - } - virtual void OnError(const std::exception_ptr& error) - { - std::unique_lock guard(Base::lock); - Base::state = SubjectState::Error; - Base::error = error; - auto local = std::move(Base::observers); - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnError(error); - } - } - } - }; - - template - class Subject : - public ObserverSubject, Subject>> - { - }; - - template - std::shared_ptr> CreateSubject() - { - return std::make_shared>(); - } - - template - class GroupedObservableSubject : - public Base - { - K key; - public: - GroupedObservableSubject(K key) : key(std::move(key)) {} - - virtual K Key() {return key;} - }; - - template - class GroupedSubject : - public ObserverSubject, GroupedSubject>>> - { - typedef ObserverSubject, GroupedSubject>>> base; - public: - GroupedSubject(K key) : base(std::move(key)) {} - }; - - template - std::shared_ptr> CreateGroupedSubject(K key) - { - return std::make_shared>(std::move(key)); - } - - template - class BehaviorSubject : - public std::enable_shared_from_this>, - public Observable, - public Observer - { - std::mutex lock; - size_t slotCount; - T value; - SubjectState::type state; - util::maybe error; - std::vector>> observers; - - void RemoveObserver(std::shared_ptr> toRemove) - { - std::unique_lock guard(lock); - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - { - *it = nullptr; - ++slotCount; - } - } - - BehaviorSubject(); - public: - - typedef std::shared_ptr> shared; - - explicit BehaviorSubject(T t) : slotCount(0), value(std::move(t)), state(SubjectState::Forwarding) {} - - virtual ~BehaviorSubject() { - // putting this first means that the observers - // will be destructed outside the lock - std::vector>> empty; - - std::unique_lock guard(lock); - using std::swap; - swap(observers, empty); - } - - virtual Disposable Subscribe(std::shared_ptr> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - SubjectState::type localState = SubjectState::Invalid; - util::maybe localValue; - util::maybe localError; - { - std::unique_lock guard(lock); - - localState = state; - - if (state == SubjectState::Forwarding || localState == SubjectState::Completed) - { - localValue.set(value); - } - else if (localState == SubjectState::Error) - { - localError = error; - } - - if (state == SubjectState::Forwarding) - { - if (slotCount > 0) - { - for(auto& o : observers) - { - if (!o) - { - o = observer; - --slotCount; - break; - } - } - } - else - { - observers.push_back(observer); - } - } - } - - if (localState == SubjectState::Completed) { - observer->OnNext(*localValue.get()); - observer->OnCompleted(); - return Disposable::Empty(); - } - else if (localState == SubjectState::Error) { - observer->OnError(*localError.get()); - return Disposable::Empty(); - } - else if (localState == SubjectState::Forwarding) { - observer->OnNext(*localValue.get()); - } - - return d; - } - - virtual void OnNext(const T& element) - { - std::unique_lock guard(lock); - auto local = observers; - value = element; - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnNext(element); - } - } - } - virtual void OnCompleted() - { - std::unique_lock guard(lock); - state = SubjectState::Completed; - auto local = std::move(observers); - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnCompleted(); - } - } - } - virtual void OnError(const std::exception_ptr& errorArg) - { - std::unique_lock guard(lock); - state = SubjectState::Error; - error.set(errorArg); - auto local = std::move(observers); - guard.unlock(); - for(auto& o : local) - { - if (o) { - o->OnError(errorArg); - } - } - } - }; - - template - std::shared_ptr> CreateBehaviorSubject(Arg a) - { - return std::make_shared>(std::move(a)); - } - - template - class AsyncSubject : - public std::enable_shared_from_this>, - public Observable, - public Observer - { - std::mutex lock; - size_t slotCount; - util::maybe value; - SubjectState::type state; - util::maybe error; - std::vector < std::shared_ptr < Observer> > observers; - - void RemoveObserver(std::shared_ptr < Observer < T >> toRemove) - { - std::unique_lock guard(lock); - auto it = std::find(begin(observers), end(observers), toRemove); - if (it != end(observers)) - { - *it = nullptr; - ++slotCount; - } - } - - public: - - typedef std::shared_ptr> shared; - - AsyncSubject() : slotCount(0), value(), state(SubjectState::Forwarding) {} - - virtual ~AsyncSubject() { - // putting this first means that the observers - // will be destructed outside the lock - std::vector < std::shared_ptr < Observer> > empty; - - std::unique_lock guard(lock); - using std::swap; - swap(observers, empty); - } - - virtual Disposable Subscribe(std::shared_ptr < Observer < T >> observer) - { - std::weak_ptr> wptr = observer; - std::weak_ptr wself = this->shared_from_this(); - - Disposable d([wptr, wself]{ - if (auto self = wself.lock()) - { - self->RemoveObserver(wptr.lock()); - } - }); - - SubjectState::type localState = SubjectState::Invalid; - util::maybe localValue; - util::maybe localError; - { - std::unique_lock guard(lock); - - localState = state; - - if (localState == SubjectState::Completed) - { - localValue = value; - } - else if (localState == SubjectState::Error) - { - localError = error; - } - else if (state == SubjectState::Forwarding) - { - if (slotCount > 0) - { - for (auto& o : observers) - { - if (!o) - { - o = observer; - --slotCount; - break; - } - } - } - else - { - observers.push_back(observer); - } - } - } - - if (localState == SubjectState::Completed) { - if (localValue) { - observer->OnNext(*localValue.get()); - } - observer->OnCompleted(); - return Disposable::Empty(); - } - else if (localState == SubjectState::Error) { - observer->OnError(*localError.get()); - return Disposable::Empty(); - } - - return d; - } - - virtual void OnNext(const T& element) - { - std::unique_lock guard(lock); - if (state == SubjectState::Forwarding) { - value = element; - } - } - virtual void OnCompleted() - { - std::unique_lock guard(lock); - state = SubjectState::Completed; - auto local = std::move(observers); - auto localValue = value; - guard.unlock(); - for (auto& o : local) - { - if (o) { - if (localValue) { - o->OnNext(*localValue.get()); - } - o->OnCompleted(); - } - } - } - virtual void OnError(const std::exception_ptr& errorArg) - { - std::unique_lock guard(lock); - state = SubjectState::Error; - error.set(errorArg); - auto local = std::move(observers); - guard.unlock(); - for (auto& o : local) - { - if (o) { - o->OnError(errorArg); - } - } - } - }; - - template - std::shared_ptr> CreateAsyncSubject() - { - return std::make_shared>(); - } - - template - class ConnectableSubject : - public std::enable_shared_from_this>, - public ConnectableObservable::type> - { - private: - ConnectableSubject(); - - Source source; - Subject subject; - util::maybe subscription; - std::mutex lock; - - public: - virtual ~ConnectableSubject() {} - - ConnectableSubject(Source source, Subject subject) : source(source), subject(subject) - { - } - - virtual Disposable Connect() - { - std::unique_lock guard(lock); - if (!subscription) - { - subscription.set(source->Subscribe(observer(subject))); - } - auto that = this->shared_from_this(); - return Disposable([that]() - { - std::unique_lock guard(that->lock); - if (!!that->subscription) - { - that->subscription->Dispose(); - that->subscription.reset(); - } - }); - } - - virtual Disposable Subscribe(std::shared_ptr < Observer < typename subject_item::type >> observer) - { - return subject->Subscribe(observer); - } - }; - - template - struct fix0_thunk { - F f; - fix0_thunk(F&& f) : f(std::move(f)) - { - } - Disposable operator()(Scheduler::shared s) const - { - return f(s, *this); - } - }; - template - fix0_thunk fix0(F f) - { - return fix0_thunk(std::move(f)); - } -} - -////////////////////////////////////////////////////////////////////// -// -// imperative functions - -#include "operators/Subscribe.hpp" -#include "operators/ForEach.hpp" -#include "operators/Empty.hpp" -#include "operators/Never.hpp" -#include "operators/Return.hpp" -#include "operators/Throw.hpp" -#include "operators/Range.hpp" -#include "operators/Random.hpp" -#include "operators/Interval.hpp" -#include "operators/Iterate.hpp" -#include "operators/Using.hpp" - -////////////////////////////////////////////////////////////////////// -// -// standard query operators - -#include "operators/Select.hpp" -#include "operators/SelectMany.hpp" -#include "operators/Concat.hpp" -#include "operators/CombineLatest.hpp" -#include "operators/Zip.hpp" -#include "operators/Merge.hpp" -#include "operators/Where.hpp" -#include "operators/GroupBy.hpp" -#include "operators/Multicast.hpp" -#include "operators/Publish.hpp" -#include "operators/RefCount.hpp" -#include "operators/ConnectForever.hpp" -#include "operators/Scan.hpp" -#include "operators/Take.hpp" -#include "operators/Skip.hpp" -#include "operators/DistinctUntilChanged.hpp" -#include "operators/ToStdCollection.hpp" -#include "operators/ToAsync.hpp" -#include "operators/Materialize.hpp" -#include "operators/Dematerialize.hpp" - - -////////////////////////////////////////////////////////////////////// -// -// shift to Scheduler - -#include "operators/SubscribeOnObservable.hpp" -#include "operators/ObserveOnObserver.hpp" - - -////////////////////////////////////////////////////////////////////// -// -// time - -#include "operators/Delay.hpp" -#include "operators/Throttle.hpp" - -namespace rxcpp -{ - class StdQueueDispatcher - { - mutable std::queue> pending; - mutable std::condition_variable wake; - mutable std::mutex pendingLock; - - std::function get() const - { - std::function fn; - fn = std::move(pending.front()); - pending.pop(); - return std::move(fn); - } - - void dispatch(std::function fn) const - { - if (fn) - { - try { - fn(); - } - catch(...) { - std::unexpected(); - } - } - } - - public: - template - void post(Fn fn) const - { - { - std::unique_lock guard(pendingLock); - pending.push(std::move(fn)); - } - wake.notify_one(); - } - - void try_dispatch() const - { - std::function fn; - { - std::unique_lock guard(pendingLock); - if (!pending.empty()) - { - fn = get(); - } - } - dispatch(std::move(fn)); - } - - bool dispatch_one() const - { - std::function fn; - { - std::unique_lock guard(pendingLock); - wake.wait(guard, [this]{ return !pending.empty();}); - fn = get(); - } - bool result = !!fn; - dispatch(std::move(fn)); - return result; - } - }; -#if defined(OBSERVE_ON_DISPATCHER_OP) - typedef OBSERVE_ON_DISPATCHER_OP ObserveOnDispatcherOp; -#else - typedef StdQueueDispatcher ObserveOnDispatcherOp; -#endif - - template - std::shared_ptr> ObserveOnDispatcher( - const std::shared_ptr>& source) - { - auto dispatcher = std::make_shared(); - - return CreateObservable( - [=](std::shared_ptr> observer) - -> Disposable - { - auto cancel = std::make_shared(false); - - ComposableDisposable cd; - - cd.Add(Disposable([=]{ - *cancel = true; - })); - cd.Add(Subscribe( - source, - // on next - [=](const T& element) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnNext(element); - }); - }, - // on completed - [=] - { - dispatcher->post([=]{ - if(!*cancel) - observer->OnCompleted(); - }); - }, - // on error - [=](const std::exception_ptr& error) - { - dispatcher->post([=]{ - if (!*cancel) - observer->OnError(error); - }); - })); - return cd; - }); - } - -} - -#endif diff --git a/Rx/CPP/src/cpprx/rx-scheduler.hpp b/Rx/CPP/src/cpprx/rx-scheduler.hpp deleted file mode 100644 index ed69bf4..0000000 --- a/Rx/CPP/src/cpprx/rx-scheduler.hpp +++ /dev/null @@ -1,947 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_SCHEDULERS_HPP) -#define CPPRX_RX_SCHEDULERS_HPP - -namespace rxcpp -{ - - ////////////////////////////////////////////////////////////////////// - // - // schedulers - - struct CurrentThreadQueue - { - typedef Scheduler::clock clock; - typedef Scheduler::Work Work; - typedef ScheduledItem QueueItem; - - private: - ~CurrentThreadQueue(); - - struct compare_work - { - bool operator()(const QueueItem& work1, const QueueItem& work2) const { - return work1.due > work2.due; - } - }; - - typedef std::priority_queue< - QueueItem, - std::vector, - compare_work - > ScheduledWork; - - public: - struct ThreadLocalQueue { - Scheduler::shared scheduler; - ScheduledWork queue; - }; - - private: - static ThreadLocalQueue*& threadLocalQueue() { - RXCPP_THREAD_LOCAL static ThreadLocalQueue* queue; - return queue; - } - - public: - - static Scheduler::shared GetScheduler() { - return !!threadLocalQueue() ? threadLocalQueue()->scheduler : Scheduler::shared(); - } - static bool empty() { - if (!threadLocalQueue()) { - abort(); - } - return threadLocalQueue()->queue.empty(); - } - static ScheduledWork::const_reference top() { - if (!threadLocalQueue()) { - abort(); - } - return threadLocalQueue()->queue.top(); - } - static void pop() { - if (!threadLocalQueue()) { - abort(); - } - threadLocalQueue()->queue.pop(); - } - static void push(QueueItem item) { - if (!threadLocalQueue()) { - abort(); - } - threadLocalQueue()->queue.push(std::move(item)); - } - static void EnsureQueue(Scheduler::shared scheduler) { - if (!!threadLocalQueue()) { - abort(); - } - // create and publish new queue - threadLocalQueue() = new ThreadLocalQueue(); - threadLocalQueue()->scheduler = scheduler; - } - static std::unique_ptr CreateQueue(Scheduler::shared scheduler) { - std::unique_ptr result(new ThreadLocalQueue()); - result->scheduler = std::move(scheduler); - return result; - } - static void SetQueue(ThreadLocalQueue* queue) { - if (!!threadLocalQueue()) { - abort(); - } - // publish new queue - threadLocalQueue() = queue; - } - static void DestroyQueue(ThreadLocalQueue* queue) { - delete queue; - } - static void DestroyQueue() { - if (!threadLocalQueue()) { - abort(); - } - DestroyQueue(threadLocalQueue()); - threadLocalQueue() = nullptr; - } - }; - - struct CurrentThreadScheduler : public LocalScheduler - { - private: - CurrentThreadScheduler(const CurrentThreadScheduler&); - - struct Derecurser : public LocalScheduler - { - private: - Derecurser(const Derecurser&); - public: - Derecurser() - { - } - virtual ~Derecurser() - { - } - - static bool IsScheduleRequired() { return false; } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, work)); - - // work is disposable - return work; - } - }; - - public: - CurrentThreadScheduler() - { - } - virtual ~CurrentThreadScheduler() - { - } - - static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto localScheduler = CurrentThreadQueue::GetScheduler(); - // check ownership - if (!!localScheduler) - { - // already has an owner - delegate - return localScheduler->Schedule(dueTime, std::move(work)); - } - - // take ownership - - CurrentThreadQueue::EnsureQueue(std::make_shared()); - RXCPP_UNWIND_AUTO([]{ - CurrentThreadQueue::DestroyQueue(); - }); - - CurrentThreadQueue::push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); - - // loop until queue is empty - for ( - auto dueTime = CurrentThreadQueue::top().due; - std::this_thread::sleep_until(dueTime), true; - dueTime = CurrentThreadQueue::top().due - ) - { - // dispatch work - auto work = CurrentThreadQueue::top().work; - - CurrentThreadQueue::pop(); - - Do(work, get()); - - if (CurrentThreadQueue::empty()) {break;} - } - - return Disposable::Empty(); - } - }; - - struct ImmediateScheduler : public LocalScheduler - { - private: - ImmediateScheduler(const ImmediateScheduler&); - - mutable std::mutex lock; - mutable bool hasFaulted; - mutable bool isAquired; - mutable CurrentThreadQueue::ThreadLocalQueue* queue; - public: - ImmediateScheduler() - : hasFaulted(false) - , isAquired(false) - , queue(nullptr) - { - } - virtual ~ImmediateScheduler() - { - } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto item = CurrentThreadQueue::QueueItem(dueTime, std::move(work)); - bool isOwner = false; - - { - std::unique_lock guard(lock); - if (!hasFaulted && !queue && !isAquired) - { - queue = CurrentThreadQueue::CreateQueue(this->shared_from_this()).release(); - isOwner = !isAquired; - isAquired = true; - } - } - - if (isOwner) - { - RXCPP_UNWIND_AUTO([&](){ - std::unique_lock guard(lock); - CurrentThreadQueue::DestroyQueue(queue); - queue = nullptr; - isAquired = false; - }); - - for(;;) - { - std::this_thread::sleep_until(item.due); - try - { - Do(item.work, queue->scheduler); - } - catch (...) - { - std::unique_lock guard(lock); - while (!queue->queue.empty()) {queue->queue.pop();} - hasFaulted = true; - throw; - } - - { - std::unique_lock guard(lock); - if (queue->queue.empty()) - { - break; - } - item = std::move(queue->queue.top()); - queue->queue.pop(); - } - } - return Disposable::Empty(); - } - else - { - std::unique_lock guard(lock); - queue->queue.push(item); - return item.work; - } - } - }; - - template - class ScheduledObserver : - public Observer, - public std::enable_shared_from_this> - { - typedef std::function Action; - - Scheduler::shared scheduler; - mutable std::shared_ptr> observer; - mutable SerialDisposable sd; - mutable std::queue queue; - mutable std::mutex lock; - mutable bool hasFaulted; - mutable bool isAquired; - - public: - ScheduledObserver(Scheduler::shared scheduler, std::shared_ptr> observer) - : scheduler(std::move(scheduler)) - , observer(std::move(observer)) - , hasFaulted(false) - , isAquired(false) - { - } - - void Dispose() const - { - sd.Dispose(); - } - operator Disposable() const - { - auto local = this->shared_from_this(); - return Disposable([local]{ - local->Dispose(); - }); - } - - virtual void OnNext(const T& element) - { - std::unique_lock guard(lock); - queue.push(Action([=](){ - this->observer->OnNext(std::move(element)); - })); - } - virtual void OnCompleted() - { - std::unique_lock guard(lock); - queue.push(Action([=](){ - this->observer->OnCompleted(); - })); - } - virtual void OnError(const std::exception_ptr& error) - { - std::unique_lock guard(lock); - queue.push(Action([=](){ - this->observer->OnError(std::move(error)); - })); - } - - void EnsureActive() - { - bool isOwner = false; - - { - std::unique_lock guard(lock); - if (!hasFaulted && !queue.empty()) - { - isOwner = !isAquired; - isAquired = true; - } - } - - if (isOwner) - { - auto keepAlive = this->shared_from_this(); - sd.Set(scheduler->Schedule( - [keepAlive](Scheduler::shared sched){ - return keepAlive->Run(sched);})); - } - } - - private: - Disposable Run(Scheduler::shared sched) - { - auto keepAlive = this->shared_from_this(); - - Action action; - { - std::unique_lock guard(lock); - if(!queue.empty()) - { - action = std::move(queue.front()); - queue.pop(); - } - else - { - isAquired = false; - return Disposable::Empty(); - } - } - - try - { - action(); - } - catch (...) - { - std::unique_lock guard(lock); - while (!queue.empty()) {queue.pop();} - hasFaulted = true; - throw; - } - - sd.Set(sched->Schedule( - [keepAlive](Scheduler::shared sched){ - return keepAlive->Run(sched);})); - return sd; - } - }; - - struct EventLoopScheduler : public LocalScheduler - { - private: - EventLoopScheduler(const EventLoopScheduler&); - - struct Derecurser : public std::enable_shared_from_this - { - private: - Derecurser(const Derecurser&); - - mutable bool isAquired; - mutable std::mutex lock; - mutable std::condition_variable wake; - CurrentThreadQueue::ThreadLocalQueue* queue; - - public: - Derecurser() - : isAquired(false) - { - } - virtual ~Derecurser() - { - } - - typedef std::function RunLoop; - typedef std::function Factory; - - static bool IsScheduleRequired() { return false; } - - typedef std::tuple, Disposable> EnsureThreadResult; - EnsureThreadResult EnsureThread(Factory& factory, Scheduler::shared owner, clock::time_point dueTime, Work work) - { - bool isOwner = false; - EnsureThreadResult result(util::maybe(), Disposable::Empty()); - - // work is disposable - std::get<1>(result) = work; - - std::unique_lock guard(lock); - - if (!isAquired) - { - RXCPP_UNWIND(unwindQueue, [&](){ - CurrentThreadQueue::DestroyQueue(queue); queue = nullptr;}); - queue = CurrentThreadQueue::CreateQueue(owner).release(); - - queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); - - auto local = std::static_pointer_cast(shared_from_this()); - auto localQueue = queue; - std::get<0>(result).set(factory([local, localQueue] { - local->Run(localQueue);})); - - isOwner = !isAquired; - isAquired = true; - - // queue lifetime is now owned by the thread - unwindQueue.dismiss(); - } - - if (!isOwner) - { - queue->queue.push(CurrentThreadQueue::QueueItem(dueTime, std::move(work))); - wake.notify_one(); - } - - return std::move(result); - } - - private: - void Run(CurrentThreadQueue::ThreadLocalQueue* queue) throw() { - auto keepAlive = shared_from_this(); - { - std::unique_lock guard(lock); - - RXCPP_UNWIND_AUTO([&]{ - isAquired = false;}); - - RXCPP_UNWIND(unwindQueue, [&](){ - CurrentThreadQueue::DestroyQueue(); - queue = nullptr;}); - - CurrentThreadQueue::SetQueue(queue); - - while(!CurrentThreadQueue::empty()) - { - auto now = queue->scheduler->Now(); - if (CurrentThreadQueue::empty()) { - wake.wait(guard, [&](){ - return !CurrentThreadQueue::empty();}); - continue; - } - - auto item = &CurrentThreadQueue::top(); - if (!item->work) { - CurrentThreadQueue::pop(); continue;} - - // wait until the work is due - if (now < item->due) - { - wake.wait_until(guard, item->due); - continue; - } - // dispatch work - auto work = item->work; - - CurrentThreadQueue::pop(); - - RXCPP_UNWIND_AUTO([&]{ - guard.lock();}); - guard.unlock(); - LocalScheduler::Do(work, queue->scheduler); - } - } - } - }; - - std::thread worker; - Derecurser::Factory factory; - std::shared_ptr derecurser; - - public: - EventLoopScheduler() - : derecurser(std::make_shared()) - { - auto local = derecurser; - factory = [local] (Derecurser::RunLoop rl) -> std::thread { - return std::thread([local, rl]{rl();}); - }; - } - template - EventLoopScheduler(Factory factoryarg) - : factory(std::move(factoryarg)) - , derecurser(std::make_shared()) - { - } - virtual ~EventLoopScheduler() - { - if (worker.joinable()) { - worker.detach(); - } - } - - static bool IsScheduleRequired() { return !CurrentThreadQueue::GetScheduler(); } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto maybeThread = derecurser->EnsureThread(factory, this->shared_from_this(), dueTime, std::move(work)); - if (std::get<0>(maybeThread)) - { - if (worker.joinable()) - { - worker.join(); - } - worker = std::move(*std::get<0>(maybeThread).get()); - } - return std::move(std::get<1>(maybeThread)); - } - }; - - struct NewThreadScheduler : public LocalScheduler - { - public: - typedef std::function)> Factory; - private: - NewThreadScheduler(const NewThreadScheduler&); - - Factory factory; - public: - - - NewThreadScheduler() : factory([](std::function start){return std::thread(std::move(start));}) - { - } - NewThreadScheduler(Factory factory) : factory(factory) - { - } - virtual ~NewThreadScheduler() - { - } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto scheduler = std::make_shared(factory); - return scheduler->Schedule(dueTime, work); - } - }; - - template - class VirtualTimeScheduler : public VirtualTimeSchedulerBase - { - private: - VirtualTimeScheduler(const VirtualTimeScheduler&); - - typedef VirtualTimeSchedulerBase Base; - - typedef typename Base::QueueItem QueueItem; - - struct compare_work - { - bool operator()(const QueueItem& work1, const QueueItem& work2) const { - return work1.due > work2.due; - } - }; - - typedef std::priority_queue< - QueueItem, - std::vector, - compare_work - > ScheduledWork; - - ScheduledWork queue; - - public: - typedef typename Base::clock clock; - typedef typename Base::Work Work; - - virtual ~VirtualTimeScheduler() - { - } - - protected: - VirtualTimeScheduler() - { - } - explicit VirtualTimeScheduler(Absolute initialClock) - : Base(initialClock) - { - } - - virtual util::maybe GetNext() { - util::maybe next; - while (!queue.empty()) { - next.set(queue.top()); - if (!next->work) { - queue.pop(); - } - else { - return next; - } - } - return next; - } - - Disposable ScheduleAbsolute(Absolute dueTime, Work work) - { - Work cancelable; - - auto run = [cancelable, work](Scheduler::shared scheduler) -> Disposable { - auto local = work; - cancelable.Dispose(); - return Base::Do(local, std::move(scheduler)); - }; - - cancelable = run; - - auto si = QueueItem(dueTime, cancelable); - queue.push(si); - - return cancelable; - } - - }; - - class TestScheduler : public VirtualTimeScheduler - { - public: - typedef VirtualTimeScheduler Base; - typedef Base::clock clock; - typedef Base::Work Work; - typedef std::shared_ptr shared; - - static const long Created = 100; - static const long Subscribed = 200; - static const long Disposed = 1000; - - template - struct Messages - { - typedef Recorded>> RecordedT; - - static - RecordedT OnNext(long ticks, T value) - { - return RecordedT(ticks, Notification::CreateOnNext(value)); - } - - static - RecordedT OnCompleted(long ticks) - { - return RecordedT(ticks, Notification::CreateOnCompleted()); - } - - static - RecordedT OnError(long ticks, std::exception_ptr ep) - { - return RecordedT(ticks, Notification::CreateOnError(ep)); - } - - template - static - RecordedT OnError(long ticks, Exception e) - { - return RecordedT(ticks, Notification::CreateOnError(e)); - } - - static - Subscription Subscribe(long subscribe, long unsubscribe) - { - return Subscription(subscribe, unsubscribe); - } - - template - static - auto ToVector(const Item (&arr) [size]) -> std::vector { - return std::vector(std::begin(arr), std::end(arr)); - } - - private: - ~Messages(); - }; - - virtual Disposable ScheduleAbsolute(long dueTime, Work work) - { - if (dueTime <= Base::clock_now) - dueTime = Base::clock_now + 1; - - return Base::ScheduleAbsolute(dueTime, std::move(work)); - } - - virtual long Add(long absolute, long relative) - { - return absolute + relative; - } - - virtual clock::time_point ToTimePoint(long absolute) - { - return clock::time_point(clock::duration(absolute)); - } - - virtual long ToRelative(clock::duration d) - { - return static_cast(d.count()); - } - - using Base::Start; - - template - std::shared_ptr> Start(std::function>()> create, long created, long subscribed, long disposed) - { - auto observer = CreateObserver(); - - struct State - { - std::shared_ptr> source; - SerialDisposable subscription; - std::shared_ptr> observer; - }; - auto state = std::make_shared(); - - state->observer = observer; - - ScheduleAbsolute(created, [create, state](Scheduler::shared scheduler) -> Disposable { - state->source = create(); return Disposable::Empty(); }); - ScheduleAbsolute(subscribed, [state](Scheduler::shared scheduler) -> Disposable { - state->subscription.Set(state->source->Subscribe(state->observer)); return Disposable::Empty(); }); - ScheduleAbsolute(disposed, [state](Scheduler::shared scheduler) -> Disposable { - state->subscription.Dispose(); return Disposable::Empty(); }); - - Start(); - - return observer; - } - - template - std::shared_ptr> Start(std::function>()> create, long disposed) - { - return Start(create, Created, Subscribed, disposed); - } - - template - std::shared_ptr> Start(std::function>()> create) - { - return Start(create, Created, Subscribed, Disposed); - } - - template - std::shared_ptr> CreateHotObservable(std::vector>>> messages); - - template - std::shared_ptr> CreateColdObservable(std::vector>>> messages); - - template - std::shared_ptr> CreateObserver(); - }; - - template - class MockObserver : public TestableObserver - { - typedef Notification NotificationT; - typedef Recorded>> RecordedT; - - TestScheduler::shared scheduler; - std::vector messages; - - public: - MockObserver(TestScheduler::shared scheduler) - : scheduler(scheduler) - { - } - - virtual void OnNext(const T& value) - { - messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnNext(value))); - } - - virtual void OnError(const std::exception_ptr& exception) - { - messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnError(exception))); - } - - virtual void OnCompleted() - { - messages.push_back(RecordedT(scheduler->Clock(), NotificationT::CreateOnCompleted())); - } - - std::vector Messages() - { - return messages; - } - }; - - template - std::shared_ptr> TestScheduler::CreateObserver() - { - return std::make_shared>(std::static_pointer_cast(shared_from_this())); - } - - template - class ColdObservable : public TestableObservable, public std::enable_shared_from_this> - { - TestScheduler::shared scheduler; - typedef Recorded>> RecordedT; - std::vector messages; - std::vector subscriptions; - - public: - - ColdObservable(TestScheduler::shared scheduler, std::vector messages) - : scheduler(scheduler) - , messages(std::move(messages)) - { - } - - template - ColdObservable(TestScheduler::shared scheduler, Iterator begin, Iterator end) - : scheduler(scheduler) - , messages(begin, end) - { - } - - virtual Disposable Subscribe(std::shared_ptr> observer) - { - subscriptions.push_back(Subscription(scheduler->Clock())); - auto index = subscriptions.size() - 1; - - ComposableDisposable d; - - for (auto& message : messages) { - auto notification = message.Value(); - d.Add(scheduler->ScheduleRelative(message.Time(), [notification, observer](Scheduler::shared) -> Disposable { - notification->Accept(observer); return Disposable::Empty(); - })); - } - - auto sharedThis = this->shared_from_this(); - return Disposable([sharedThis, index, d]() { - sharedThis->subscriptions[index] = Subscription(sharedThis->subscriptions[index].Subscribe(), sharedThis->scheduler->Clock()); - d.Dispose(); - }); - } - - virtual std::vector Subscriptions() { - return subscriptions; - } - - virtual std::vector>>> Messages() { - return messages; - } - }; - - template - std::shared_ptr> TestScheduler::CreateColdObservable(std::vector>>> messages) - { - return std::make_shared>(std::static_pointer_cast(shared_from_this()), std::move(messages)); - } - - template - class HotObservable : public TestableObservable, public std::enable_shared_from_this> - { - TestScheduler::shared scheduler; - typedef Recorded>> RecordedT; - std::vector messages; - std::vector subscriptions; - std::vector>> observers; - - public: - - HotObservable(TestScheduler::shared scheduler, std::vector messages) - : scheduler(scheduler) - , messages(messages) - { - for (auto& message : messages) { - auto notification = message.Value(); - scheduler->ScheduleAbsolute(message.Time(), [this, notification](Scheduler::shared) -> Disposable { - auto local = this->observers; - for (auto& observer : local) { - notification->Accept(observer); - } - return Disposable::Empty(); - }); - } - } - - virtual Disposable Subscribe(std::shared_ptr> observer) - { - observers.push_back(observer); - subscriptions.push_back(Subscription(scheduler->Clock())); - auto index = subscriptions.size() - 1; - - auto sharedThis = this->shared_from_this(); - return Disposable([sharedThis, index, observer]() { - sharedThis->observers.erase(std::find(sharedThis->observers.begin(), sharedThis->observers.end(), observer)); - sharedThis->subscriptions[index] = Subscription(sharedThis->subscriptions[index].Subscribe(), sharedThis->scheduler->Clock()); - }); - } - - virtual std::vector Subscriptions() { - return subscriptions; - } - - virtual std::vector>>> Messages() { - return messages; - } - }; - - template - std::shared_ptr> TestScheduler::CreateHotObservable(std::vector>>> messages) - { - return std::make_shared>(std::static_pointer_cast(shared_from_this()), std::move(messages)); - } - -} - -#endif diff --git a/Rx/CPP/src/cpprx/rx-util.hpp b/Rx/CPP/src/cpprx/rx-util.hpp deleted file mode 100644 index 92ef223..0000000 --- a/Rx/CPP/src/cpprx/rx-util.hpp +++ /dev/null @@ -1,509 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_UTIL_HPP) -#define CPPRX_RX_UTIL_HPP - -#if !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_SELECT_ANY) -#if defined(_MSC_VER) -#define RXCPP_SELECT_ANY __declspec(selectany) -#else -#define RXCPP_SELECT_ANY -#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__) - -namespace rxcpp { namespace util { - - template - struct identity - { - typedef Type type; - Type operator()(const Type& left) const {return left;} - }; - - template - class maybe - { - bool is_set; - typename std::aligned_storage::value>::type - storage; - public: - maybe() - : is_set(false) - { - } - - maybe(T value) - : is_set(false) - { - new (reinterpret_cast(&storage)) T(value); - is_set = true; - } - - maybe(const maybe& other) - : is_set(false) - { - if (other.is_set) { - new (reinterpret_cast(&storage)) T(*other.get()); - is_set = true; - } - } - maybe(maybe&& other) - : is_set(false) - { - if (other.is_set) { - new (reinterpret_cast(&storage)) T(std::move(*other.get())); - is_set = true; - other.reset(); - } - } - - ~maybe() - { - reset(); - } - - void reset() - { - if (is_set) { - is_set = false; - reinterpret_cast(&storage)->~T(); - } - } - - T* get() { - return is_set ? reinterpret_cast(&storage) : 0; - } - - const T* get() const { - return is_set ? reinterpret_cast(&storage) : 0; - } - - void set(T value) { - if (is_set) { - *reinterpret_cast(&storage) = std::move(value); - } else { - new (reinterpret_cast(&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); - return *this; - } - 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: - - }; - - template - struct reveal_type {private: reveal_type();}; - -#if RXCPP_USE_VARIADIC_TEMPLATES - template - struct tuple_indices; - template <> - struct tuple_indices<-1> { // for an empty std::tuple<> there is no entry - typedef tuple_indices<> type; - }; - template - struct tuple_indices<0, Indices...> { // stop the recursion when 0 is reached - typedef tuple_indices<0, Indices...> type; - }; - template - struct tuple_indices { // recursively build a sequence of indices - typedef typename tuple_indices::type type; - }; - - template - struct make_tuple_indices { - typedef typename tuple_indices::value - 1>::type type; - }; - - namespace detail { - template - struct tuple_dispatch; - template - struct tuple_dispatch> { - template - static - auto call(F&& f, T&& t) - -> decltype (std::forward(f)(std::get(std::forward(t))...)) { - return std::forward(f)(std::get(std::forward(t))...); - } - };} - - template - auto tuple_dispatch(F&& f, T&& t) - -> decltype(detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t))) { - return detail::tuple_dispatch::type>::type>::call(std::forward(f), std::forward(t)); - } - - namespace detail { - template - struct tuple_tie; - template - struct tuple_tie> { - template - static - auto tie(T&& t) - -> decltype (std::tie(std::get(std::forward(t))...)) { - return std::tie(std::get(std::forward(t))...); - } - };} - - template - auto tuple_tie(T&& t) - -> decltype(detail::tuple_tie::type>::type>::tie(std::forward(t))) { - return detail::tuple_tie::type>::type>::tie(std::forward(t)); - } - - struct as_tuple { - template - auto operator()(AsTupleNext... x) - -> decltype(std::make_tuple(std::move(x)...)) { - return std::make_tuple(std::move(x)...);} - template - auto operator()(AsTupleNext... x) const - -> decltype(std::make_tuple(std::move(x)...)) { - return std::make_tuple(std::move(x)...);} - }; -#else - namespace detail { - template - struct tuple_dispatch; - template<> - struct tuple_dispatch<0> { - template - static auto call(F&& f, T&& ) - -> decltype (std::forward(f)()) { - return std::forward(f)();} - }; - template<> - struct tuple_dispatch<1> { - template - static auto call(F&& f, T&& t) - -> decltype (std::forward(f)(std::get<0>(std::forward(t)))) { - return std::forward(f)(std::get<0>(std::forward(t)));} - }; - template<> - struct tuple_dispatch<2> { - template - static auto call(F&& f, T&& t) - -> decltype (std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)))) { - return std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)));} - }; - template<> - struct tuple_dispatch<3> { - template - static auto call(F&& f, T&& t) - -> decltype (std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)))) { - return std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)));} - }; - template<> - struct tuple_dispatch<4> { - template - static auto call(F&& f, T&& t) - -> decltype (std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)), - std::get<3>(std::forward(t)))) { - return std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)), - std::get<3>(std::forward(t)));} - }; - template<> - struct tuple_dispatch<5> { - template - static auto call(F&& f, T&& t) - -> decltype (std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)), - std::get<3>(std::forward(t)), - std::get<4>(std::forward(t)))) { - return std::forward(f)( - std::get<0>(std::forward(t)), - std::get<1>(std::forward(t)), - std::get<2>(std::forward(t)), - std::get<3>(std::forward(t)), - std::get<4>(std::forward(t)));} - }; - } - - template - auto tuple_dispatch(F&& f, T&& t) - -> decltype(detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t))) { - return detail::tuple_dispatch::type>::value>::call(std::forward(f), std::forward(t)); - } - - struct as_tuple { - auto operator()() - -> decltype(std::make_tuple()) { - return std::make_tuple();} - template - auto operator()(AsTupleNext x) - -> decltype(std::make_tuple(std::move(x))) { - return std::make_tuple(std::move(x));} - template< - class AsTupleNext1, - class AsTupleNext2> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2) - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2))) { - return std::make_tuple( - std::move(x1), - std::move(x2));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3) - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3, - class AsTupleNext4> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3, - AsTupleNext4 x4) - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3, - class AsTupleNext4, - class AsTupleNext5> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3, - AsTupleNext4 x4, - AsTupleNext5 x5) - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4), - std::move(x5))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4), - std::move(x5));} - - auto operator()() const - -> decltype(std::make_tuple()) { - return std::make_tuple();} - template - auto operator()(AsTupleNext x) const - -> decltype(std::make_tuple(std::move(x))) { - return std::make_tuple(std::move(x));} - template< - class AsTupleNext1, - class AsTupleNext2> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2) const - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2))) { - return std::make_tuple( - std::move(x1), - std::move(x2));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3) const - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3, - class AsTupleNext4> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3, - AsTupleNext4 x4) const - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4));} - template< - class AsTupleNext1, - class AsTupleNext2, - class AsTupleNext3, - class AsTupleNext4, - class AsTupleNext5> - auto operator()( - AsTupleNext1 x1, - AsTupleNext2 x2, - AsTupleNext3 x3, - AsTupleNext4 x4, - AsTupleNext5 x5) const - -> decltype(std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4), - std::move(x5))) { - return std::make_tuple( - std::move(x1), - std::move(x2), - std::move(x3), - std::move(x4), - std::move(x5));} - }; -#endif //RXCPP_USE_VARIADIC_TEMPLATES - - struct pass_through { - template - typename std::decay::type operator()(X&& x) {return std::forward(x);} - template - typename std::decay::type operator()(X&& x) const {return std::forward(x);} - }; - - struct pass_through_second { - template - typename std::decay::type operator()(X&& , Y&& y) {return std::forward(y);} - template - typename std::decay::type operator()(X&& , Y&& y) const {return std::forward(y);} - }; - - template - class unwinder - { - public: - ~unwinder() - { - if (!!function) - { - try { - (*function)(); - } catch (...) { - std::unexpected(); - } - } - } - - explicit unwinder(Function* functionArg) - : function(functionArg) - { - } - - void dismiss() - { - function = nullptr; - } - - private: - unwinder(); - unwinder(const unwinder&); - unwinder& operator=(const unwinder&); - - Function* function; - }; - -}} - -#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::unwinder UnwinderName(std::addressof(FunctionName)) - -#endif \ No newline at end of file diff --git a/Rx/CPP/src/cpprx/rx-windows.hpp b/Rx/CPP/src/cpprx/rx-windows.hpp deleted file mode 100644 index 06b2fb9..0000000 --- a/Rx/CPP/src/cpprx/rx-windows.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 -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_WINDOWS_HPP) -#define CPPRX_RX_WINDOWS_HPP -#pragma once - -#if (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) && (defined(WINDOWS) || defined(WIN32) || defined(_WIN32)) - -#pragma comment(lib, "user32.lib") - -#define NOMINMAX -#include - -namespace rxcpp { namespace win32 { - - -#if !defined(OBSERVE_ON_DISPATCHER_OP) -#define OBSERVE_ON_DISPATCHER_OP rxcpp::win32::ObserveOnDispatcherOp -#endif - - struct ObserveOnDispatcherOp - { - HWND hwnd; - - ObserveOnDispatcherOp(): hwnd(WindowClass::Instance().CreateWindow_()) - { - if (!hwnd) - throw std::exception("error"); - } - ~ObserveOnDispatcherOp() - { - // send one last message to ourselves to shutdown. - post([=]{ CloseWindow(hwnd); }); - } - - struct WindowClass - { - static const wchar_t* const className(){ return L"ObserveOnDispatcherOp::WindowClass"; } - WindowClass() - { - WNDCLASS wndclass = {}; - wndclass.style = 0; - wndclass.lpfnWndProc = &WndProc; - wndclass.cbClsExtra; - wndclass.cbWndExtra = 0; - wndclass.hInstance = NULL; - wndclass.lpszClassName = className(); - - if (!RegisterClass(&wndclass)) - throw std::exception("error"); - - } - HWND CreateWindow_() - { - return CreateWindowEx(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, 0); - } - static const int WM_USER_DISPATCH = WM_USER + 1; - - static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) - { - switch (message) - { - // TODO: shatter attack surface. should validate the message, e.g. using a handle table. - case WM_USER_DISPATCH: - ((void(*)(void*))wParam)((void*)lParam); - return 0; - default: - return DefWindowProc(hwnd, message, wParam, lParam); - } - } - static WindowClass& Instance() { - static WindowClass instance; - return instance; - } - }; - - template - void post(Fn fn) const - { - std::unique_ptr f(new Fn(fn)); - ::PostMessage(hwnd, WindowClass::WM_USER_DISPATCH, (WPARAM)(void(*)(void*))&run_proc, (LPARAM)(void*)f.release()); - } - template - static void run_proc( - void* pvfn - ) - { - std::unique_ptr f((Fn*)(void*) pvfn); - (*f.get())(); - } - }; - - class WindowScheduler : public rxcpp::LocalScheduler - { - - struct compare_work - { - template - bool operator()(const T& work1, const T& work2) const { - return work1.first > work2.first; - } - }; - - struct Queue; - - typedef std::pair Item; - typedef std::pair> PriorityItem; - - typedef std::priority_queue< - PriorityItem, - std::vector, - compare_work - > ScheduledWork; - - struct Queue - { - Queue() : exit(false), window(NULL) {} - bool exit; - HWND window; - ScheduledWork scheduledWork; - mutable std::mutex lock; - }; - - struct WindowClass - { - std::shared_ptr queue; - - static const wchar_t* const className(){ return L"rxcpp::win32::WindowScheduler::WindowClass"; } - WindowClass() - { - } - - static void Create(const std::shared_ptr& queue) - { - WNDCLASSW wndclass = {}; - wndclass.style = 0; - wndclass.lpfnWndProc = &WndProc; - wndclass.cbWndExtra = 0; - wndclass.hInstance = NULL; - wndclass.lpszClassName = className(); - - RegisterClassW(&wndclass); - - std::unique_ptr that(new WindowClass); - that->queue = queue; - - queue->window = CreateWindowExW(0, WindowClass::className(), L"MessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, 0, reinterpret_cast(that.get())); - if (!queue->window) - throw std::exception("create window failed"); - - that.release(); - } - - static const int WM_USER_DISPATCH = WM_USER + 1; - - static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) throw() - { - WindowClass* windowClass = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); - switch (message) - { - case WM_NCCREATE: - { - windowClass = reinterpret_cast(reinterpret_cast(lParam)->lpCreateParams); - SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(reinterpret_cast(windowClass))); - } - break; - case WM_NCDESTROY: - { - delete windowClass; - SetWindowLongPtr(hwnd, GWLP_USERDATA, 0L); - } - break; - case WM_TIMER: - case WM_USER_DISPATCH: - { - bool destroy = false; - HWND window = NULL; - std::vector> expired; - { - std::unique_lock guard(windowClass->queue->lock); - - while (!windowClass->queue->scheduledWork.empty() && !windowClass->queue->scheduledWork.top().second.get()->second) - { - // discard the disposed items - expired.push_back(windowClass->queue->scheduledWork.top().second); - windowClass->queue->scheduledWork.pop(); - } - - if (!windowClass->queue->scheduledWork.empty()) - { - auto& item = windowClass->queue->scheduledWork.top(); - auto now = item.second.get()->first->Now(); - - // wait until the work is due - if(now < item.first) - { - auto remaining = std::chrono::duration_cast(item.first - now).count(); - if (remaining >= USER_TIMER_MINIMUM) - { - return SetTimer(hwnd, 0, static_cast(remaining), nullptr); - } - std::this_thread::sleep_until(item.first); - } - - // dispatch work - auto work = std::move(item.second.get()->second); - auto scheduler = std::move(item.second.get()->first); - windowClass->queue->scheduledWork.pop(); - - { - RXCPP_UNWIND_AUTO([&]{guard.lock();}); - guard.unlock(); - LocalScheduler::Do(work, scheduler); - work = nullptr; - scheduler = nullptr; - } - - if (!windowClass->queue->scheduledWork.empty()) - { - ::PostMessageW(windowClass->queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); - } - } - - destroy = windowClass->queue->exit && windowClass->queue->scheduledWork.empty(); - window = windowClass->queue->window; - } - - if (destroy) - { - DestroyWindow(window); - } - } - return 0; - default: - break; - } - return DefWindowProcW(hwnd, message, wParam, lParam); - } - }; - std::shared_ptr queue; - - public: - WindowScheduler() - : queue(std::make_shared()) - { - WindowClass::Create(queue); - } - ~WindowScheduler() - { - // send one last message to ourselves to shutdown. - { - std::unique_lock guard(queue->lock); - queue->exit = true; - } - ::PostMessageW(queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); - } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto cancelable = std::make_shared(std::make_pair(get(), std::move(work))); - { - std::unique_lock guard(queue->lock); - queue->scheduledWork.push(std::make_pair(dueTime, cancelable)); - } - ::PostMessageW(queue->window, WindowClass::WM_USER_DISPATCH, 0, 0); - auto local = queue; - return Disposable([local, cancelable]{ - std::unique_lock guard(local->lock); - cancelable.get()->second = nullptr; - ::PostMessageW(local->window, WindowClass::WM_USER_DISPATCH, 0, 0); - }); - } - }; -} } - -#endif - -#endif diff --git a/Rx/CPP/src/cpprx/rx-winrt.hpp b/Rx/CPP/src/cpprx/rx-winrt.hpp deleted file mode 100644 index 061e351..0000000 --- a/Rx/CPP/src/cpprx/rx-winrt.hpp +++ /dev/null @@ -1,667 +0,0 @@ -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_WINRT_HPP) -#define CPPRX_RX_WINRT_HPP -#pragma once - -#if RXCPP_USE_WINRT - -#define NOMINMAX -#include - -namespace rxcpp { namespace winrt { - namespace wf = Windows::Foundation; - namespace wuicore = Windows::UI::Core; - namespace wuixaml = Windows::UI::Xaml; - namespace wuictrls = Windows::UI::Xaml::Controls; - - template - struct EventPattern - { - EventPattern(TSender sender, TEventArgs eventargs) : - sender(sender), - eventargs(eventargs) - {} - - TSender Sender() const { - return sender;}; - TEventArgs EventArgs() const { - return eventargs;}; - - private: - TSender sender; - TEventArgs eventargs; - }; - - namespace detail - { - template - struct is_typed_event_handler : public std::false_type {}; - - template - struct is_typed_event_handler> : public std::true_type {}; - - template - struct get_sender; - template - struct get_sender> - { - typedef Sender type; - }; - - template - struct get_eventargs; - template - struct get_eventargs> - { - typedef EventArgs type; - }; - - template - struct get_eventpattern; - template - struct get_eventpattern> - { - typedef EventPattern type; - }; - - template - struct remove_ref { typedef T type; }; - template - struct remove_ref { typedef T type; }; - template - struct remove_ref { typedef T type; }; - template - struct remove_ref { typedef T type; }; - - template - wf::IAsyncOperation^ operation_interface(wf::IAsyncOperation^ i) { return i; } - - template - wf::IAsyncOperationWithProgress^ operation_interface(wf::IAsyncOperationWithProgress^ i) { return i; } - } - - template - auto FromEventPattern( - std::function addHandler, - std::function removeHandler) - -> typename std::enable_if < !detail::is_typed_event_handler::value, std::shared_ptr < Observable < EventPattern < Platform::Object^, EventArgs^ >> >> ::type - { - typedef EventPattern EP; - return CreateObservable( - [=](std::shared_ptr> observer) - { - auto h = ref new EventHandler( - [=](Platform::Object^ sender, EventArgs^ args) -> void - { - observer->OnNext(EP(sender, args)); - }); - - auto token = addHandler(h); - - return Disposable( - [removeHandler, token]() - { - removeHandler(token); - }); - }); - } - - template - auto FromEventPattern( - std::function addHandler, - std::function removeHandler) - -> typename std::enable_if < !detail::is_typed_event_handler::value, std::shared_ptr < Observable < EventPattern < Sender^, EventArgs^ >> >> ::type - { - typedef EventPattern EP; - return CreateObservable( - [=](std::shared_ptr> observer) - { - auto h = ref new EventHandler( - [=](Platform::Object^ sender, EventArgs^ args) -> void - { - observer->OnNext(EP(dynamic_cast(sender), args)); - }); - - auto token = addHandler(h); - - return Disposable( - [removeHandler, token]() - { - removeHandler(token); - }); - }); - } - - template - auto FromEventPattern( - std::function addHandler, - std::function removeHandler) - -> typename std::enable_if < detail::is_typed_event_handler::value, std::shared_ptr < Observable < typename detail::get_eventpattern::type> >> ::type - { - typedef typename detail::get_eventpattern::type EP; - return CreateObservable( - [=](std::shared_ptr < Observer < EP >> observer) - { - auto h = ref new SpecificTypedEventHandler( - [=](typename detail::get_sender::type sender, typename detail::get_eventargs::type args) -> void - { - observer->OnNext(EP(sender, args)); - }); - - auto token = addHandler(h); - - return Disposable( - [removeHandler, token]() - { - removeHandler(token); - }); - }); - } - - template - auto FromAsyncPattern(F&& start) - -> std::function < std::shared_ptr < Observable< decltype(start((*(T*)nullptr)...)->GetResults()) >> (const T&...)> - { - typedef decltype(start((*(T*)nullptr)...)->GetResults()) Result; - - return [=](const T&... t) - { - auto subject = CreateAsyncSubject(); - auto o = start(t...); - typedef typename detail::remove_ref< decltype(o->Completed)>::type Handler; - typedef decltype(detail::operation_interface(o)) Interface; - o->Completed = ref new Handler([=](Interface io, wf::AsyncStatus) - { - util::maybe value; - try - { - value.set(io->GetResults()); - } - catch (...) - { - subject->OnError(std::current_exception()); - return; - } - subject->OnNext(*value.get()); - subject->OnCompleted(); - }); - return observable(subject); - }; - } - - std::shared_ptr < Observable < size_t> > - inline DispatcherInterval( - Scheduler::clock::duration interval) - { - return CreateObservable( - [=](std::shared_ptr < Observer < size_t >> observer) - -> Disposable - { - size_t cursor = 0; - ComposableDisposable cd; - - wf::TimeSpan timeSpan; - // convert to 100ns ticks - timeSpan.Duration = static_cast(std::chrono::duration_cast(interval).count() / 100); - - auto dispatcherTimer = ref new wuixaml::DispatcherTimer(); - dispatcherTimer->Interval = timeSpan; - - cd.Add(Subscribe(FromEventPattern, Platform::Object>( - [dispatcherTimer](wf::EventHandler^ h) { - return dispatcherTimer->Tick += h; }, - [dispatcherTimer](wf::EventRegistrationToken t) { - dispatcherTimer->Tick -= t; - }), - [observer, cursor](EventPattern) mutable { - observer->OnNext(cursor); - ++cursor; - }, - [observer]() { - observer->OnCompleted(); - }, - [observer](std::exception_ptr e) { - observer->OnError(e); - })); - - cd.Add(Disposable( - [observer, dispatcherTimer](){ - dispatcherTimer->Stop(); - observer->OnCompleted(); - })); - - dispatcherTimer->Start(); - - return cd; - }); - } - - struct CoreDispatcherScheduler : public LocalScheduler - { - private: - CoreDispatcherScheduler(const CoreDispatcherScheduler&); - - public: - CoreDispatcherScheduler(wuicore::CoreDispatcher^ dispatcher, wuicore::CoreDispatcherPriority priority = wuicore::CoreDispatcherPriority::Normal) - : dispatcher(dispatcher) - , priority(priority) - { - } - virtual ~CoreDispatcherScheduler() - { - } - - typedef std::shared_ptr shared; - - static shared Current() - { - auto window = wuixaml::Window::Current; - if (window == nullptr) - { - throw std::logic_error("No window current"); - } - auto d = window->Dispatcher; - if (d == nullptr) - { - throw std::logic_error("No dispatcher on current window"); - } - return std::make_shared(d); - } - - wuicore::CoreDispatcher^ Dispatcher() - { - return dispatcher; - } - - wuicore::CoreDispatcherPriority Priority() - { - return priority; - } - - using LocalScheduler::Schedule; - virtual Disposable Schedule(clock::time_point dueTime, Work work) - { - auto that = shared_from_this(); - auto dispatchAsync = [this, that, work](Scheduler::shared sched) mutable -> Disposable - { - dispatcher->RunAsync( - priority, - ref new wuicore::DispatchedHandler( - [that, this, work]() mutable - { - this->Do(work, that); - }, - Platform::CallbackContext::Any - )); - return Disposable::Empty(); - }; - - auto now = Now(); - auto interval = dueTime - now; - if (now > dueTime || interval < std::chrono::milliseconds(10)) - { - return dispatchAsync(nullptr); - } - - wf::TimeSpan timeSpan; - // convert to 100ns ticks - timeSpan.Duration = static_cast(std::chrono::duration_cast(interval).count() / 100); - - auto dispatcherTimer = ref new wuixaml::DispatcherTimer(); - // convert to 100ns ticks - dispatcherTimer->Interval = timeSpan; - - auto result = Subscribe(FromEventPattern, Platform::Object>( - [dispatcherTimer](wf::EventHandler^ h) { - return dispatcherTimer->Tick += h; }, - [dispatcherTimer](wf::EventRegistrationToken t) { - dispatcherTimer->Tick -= t; - }), - [dispatchAsync, dispatcherTimer](EventPattern) mutable { - dispatcherTimer->Stop(); - dispatchAsync(nullptr); - }); - - dispatcherTimer->Start(); - - return result; - } - - private: - wuicore::CoreDispatcher^ dispatcher; - wuicore::CoreDispatcherPriority priority; - }; - - template - class ReactiveCommand : public Observable - { - typedef ReactiveCommand This; - - std::mutex flight_lock; - std::shared_ptr < Subject> inflight; - std::shared_ptr < Subject> exceptions; - std::shared_ptr> executed; - Scheduler::shared defaultScheduler; - bool allowsConcurrentExecution; - std::shared_ptr < Observable < bool >> isExecuting; - std::shared_ptr < Observable < bool >> canExecuteObservable; - - public: - typedef std::shared_ptr shared; - - ReactiveCommand(std::shared_ptr < Observable < bool >> canExecute = nullptr, bool allowsConcurrentExecution = false, Scheduler::shared scheduler = nullptr, bool initialCondition = true) : - inflight(std::make_shared < Subject < bool >> ()), - exceptions(std::make_shared < Subject >()), - executed(std::make_shared < Subject < T >> ()), - defaultScheduler(scheduler), - allowsConcurrentExecution(allowsConcurrentExecution) - { - if (!canExecute) - { - canExecute = Return(true); - } - - if (!defaultScheduler) - { - defaultScheduler = std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()); - } - - isExecuting = observable(from(inflight) - .observe_on(defaultScheduler) - .scan(0, [](int balanced, bool in) { - return in ? balanced + 1 : balanced - 1; }) - .select([](int balanced) { - return balanced > 0; }) - .publish(false) - .connect_forever() - .distinct_until_changed()); - - auto isBusy = allowsConcurrentExecution ? Return(false) : isExecuting; - auto canExecuteAndNotBusy = from(isBusy) - .combine_latest([](bool b, bool ce) - { - return ce && !b; - }, canExecute); - - auto canExecuteObs = from(canExecuteAndNotBusy) - .publish(initialCondition) - .ref_count(); - - canExecuteObservable = observable(from(canExecuteObs) - .distinct_until_changed() - .observe_on(defaultScheduler)); - } - - template - auto RegisterAsync(F f) - -> decltype(f(*(T*) nullptr)) - { - return observable(from(executed) - .select_many( - // select collection - [=](T t) - { - std::unique_lock guard(this->flight_lock); - this->inflight->OnNext(true); - return Using( - // resource factory - [=]() -> SerialDisposable - { - SerialDisposable flight; - flight.Set(ScheduledDisposable( - this->defaultScheduler, - Disposable([=]() - { - std::unique_lock guard(this->flight_lock); - this->inflight->OnNext(false); - }))); - return flight; - }, - // observable factory - [=](SerialDisposable) - { - return f(t); - }); - }) - .observe_on(defaultScheduler) - .publish() - .connect_forever()); - } - - template - auto RegisterAsyncFunction(F f, Scheduler::shared scheduler = nullptr) - -> std::shared_ptr> - { - auto asyncFunc = ToAsync(f, scheduler); - return RegisterAsync(asyncFunc); - } - - bool AllowsConcurrentExecution() - { - return allowsConcurrentExecution; - } - - std::shared_ptr> ThrownExceptions() - { - return from(exceptions).observe_on(defaultScheduler); - } - - std::shared_ptr> IsExecuting() - { - return isExecuting; - } - - std::shared_ptr> CanExecuteObservable() - { - return canExecuteObservable; - } - - Disposable Subscribe(std::shared_ptr < Observer < T >> observer) - { - return from(executed) - .subscribe( - //on next - [=](const T& t){ - try - { - observer->OnNext(t); - } - catch (...) - { - this->exceptions->OnError(std::current_exception()); - } - }, - //on completed - [=](){ - try - { - observer->OnCompleted(); - } - catch (...) - { - this->exceptions->OnError(std::current_exception()); - } - }, - //on error - [=](std::exception_ptr e){ - try - { - observer->OnError(e); - } - catch (...) - { - this->exceptions->OnError(std::current_exception()); - } - }); - } - - void Execute(T value) - { - { - std::unique_lock guard(flight_lock); - inflight->OnNext(true); - } - executed->OnNext(value); - { - std::unique_lock guard(flight_lock); - inflight->OnNext(false); - } - } - }; - - template - std::shared_ptr> observable(std::shared_ptr < ReactiveCommand < T >> s){ return std::static_pointer_cast < Observable < T >> (s); } - - template - Disposable BindCommand(wuictrls::Button^ button, std::shared_ptr> command) - { - typedef rxrt::EventPattern RoutedEventPattern; - - ComposableDisposable cd; - - cd.Add(from(command->CanExecuteObservable()) - .subscribe( - [=](bool b) - { - button->IsEnabled = b; - })); - - auto click = rxrt::FromEventPattern( - [=](wuixaml::RoutedEventHandler^ h) - { - return button->Click += h; - }, - [=](wf::EventRegistrationToken t) - { - button->Click -= t; - }); - - cd.Add(from(click) - .subscribe([=](RoutedEventPattern ep) - { - command->Execute(ep); - })); - - return cd; - } - - template - struct OperationPattern - { - typedef decltype(((O)nullptr)->GetDeferral()) D; - - OperationPattern(O operation) : - operation(operation), - deferral(operation->GetDeferral()) - { - } - - O Operation() const { - return operation; - }; - D Deferral() const { - return deferral; - }; - - void Dispose() - { - deferral->Complete(); - } - - operator Disposable() const - { - // make sure to capture state and not 'this'. - // usage means that 'this' will usualy be destructed - // immediately - auto local = deferral; - return Disposable([local]{ - local->Complete(); - }); - } - - private: - O operation; - D deferral; - }; - - template - OperationPattern make_operation_pattern(O o) - { - return OperationPattern(std::move(o)); - } - - - namespace detail - { - - template - auto DeferOperation(const std::shared_ptr < Observable < T >> &source, SOp sop, SOb sob, Scheduler::shared scheduler = nullptr) - -> decltype(sob(*(OperationPattern*)nullptr, *(T*) nullptr)) - { - typedef decltype(sob(*(OperationPattern*)nullptr, *(T*) nullptr)) ResultObservable; - typedef typename observable_item::type Result; - if (!scheduler) - { - scheduler = std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()); - } - return rx::CreateObservable( - [=](const std::shared_ptr < Observer < Result >> &observer) - { - return from(source) - .select_many( - //select observable - [=](T t) -> ResultObservable - { - // must take the deferral early while the event is still on the stack. - auto op = make_operation_pattern(sop(t)); - typedef decltype(op) OP; - - return Using( - // resource factory - [=]() - { - return op; - }, - // observable factory - [sob, t](OP op) - { - return sob(op, t); - }); - }) - .observe_on(scheduler) - .subscribe( - //on next - [=](Result r) - { - observer->OnNext(r); - }, - //on completed - [=]() - { - observer->OnCompleted(); - }, - //on error - [=](std::exception_ptr e) - { - observer->OnError(e); - } - ); - }); - } - } - - struct defer_operation {}; - template - auto rxcpp_chain(defer_operation && , const std::shared_ptr < Observable < T >> &source, SOp sop, SOb sob, Scheduler::shared scheduler = nullptr) - -> decltype(detail::DeferOperation(source, sop, sob, scheduler)) - { - return detail::DeferOperation(source, sop, sob, scheduler); - } - -} } - -#endif - -#endif diff --git a/Rx/CPP/src/cpprx/rx.hpp b/Rx/CPP/src/cpprx/rx.hpp deleted file mode 100644 index 16bfcc1..0000000 --- a/Rx/CPP/src/cpprx/rx.hpp +++ /dev/null @@ -1,587 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -#pragma once -#include "rx-includes.hpp" - -#if !defined(CPPRX_RX_HPP) -#define CPPRX_RX_HPP - -namespace rxcpp -{ - template - class Binder; - - template - class Binder>; - -namespace detail { - template - struct observable_item> {typedef typename rxcpp::observable_item::type type;}; -} - - template - struct is_observable < Binder > {static const bool value = true; }; - - template - class BinderBase - { - protected: - Obj obj; - template - friend V observable(const BinderBase& b); - - public: - typedef T item_type; - typedef Obj observable_type; - - BinderBase(Obj obj) : obj(std::move(obj)) - { - } - - Observable* operator->() const { - return obj.get(); - } - }; - - template - Obj observable(const BinderBase& b) { - return b.obj; - } - - template - class BinderNested; - - template - class BinderNested : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - static const bool is_item_observable = false; - BinderNested(Obj obj) : Base(std::move(obj)) - { - } - - void select_many(); - void concat(); - }; - - template - class BinderNested : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - static const bool is_item_observable = true; - - BinderNested(Obj obj) : Base(std::move(obj)) - { - } - - auto select_many() - -> decltype(from(SelectMany(obj, util::pass_through(), util::pass_through_second()))) { - return from(SelectMany(obj, util::pass_through(), util::pass_through_second())); - } - auto concat() - -> decltype(from(Concat(*(Obj*)nullptr))) { - return from(Concat(obj)); - } - }; - - template - class BinderConnectable : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - BinderConnectable(Obj obj) : Base(std::move(obj)) - { - } - }; - - template - class BinderConnectable>> : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - BinderConnectable(std::shared_ptr> obj) : Base(std::move(obj)) - { - } - - auto ref_count() - -> decltype(from(RefCount(obj))) { - return from(RefCount(obj)); - } - auto connect_forever() - -> decltype(from(ConnectForever(obj))) { - return from(ConnectForever(obj)); - } - }; - - template - class BinderMaterialized : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - BinderMaterialized(Obj obj) : Base(std::move(obj)) - { - } - }; - - template - class BinderMaterialized>>>> : public Base - { - protected: - typedef typename Base::item_type item_type; - using Base::obj; - public: - BinderMaterialized(std::shared_ptr>>> obj) : Base(std::move(obj)) - { - } - - auto dematerialize() - -> decltype(from(Dematerialize(observable(obj)))) { - return from(Dematerialize(observable(obj))); - } - }; - - template - class Binder : public BinderNested< - BinderConnectable< - BinderMaterialized< - BinderBase::type, Obj>, - typename observable_item::type, - Obj - >, - typename observable_item::type, - Obj - >, - typename observable_item::type, - Obj, - is_observable::type>::value> - { - typedef BinderNested< - BinderConnectable< - BinderMaterialized< - BinderBase::type, Obj>, - typename observable_item::type, - Obj - >, - typename observable_item::type, - Obj - >, - typename observable_item::type, - Obj, - is_observable::type>::value> base; - typedef typename base::item_type item_type; - using base::obj; - public: - - Binder(Obj obj) : base(std::move(obj)) - { - } - - template - auto select(S selector) -> decltype(from(Select(obj, selector))) { - return from(Select(obj, selector)); - } - using base::select_many; - template - auto select_many(CS collectionSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second()))) { - return from(SelectMany(obj, std::move(collectionSelector), util::pass_through_second())); - } - template - auto select_many(CS collectionSelector, RS resultSelector) - -> decltype(from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector)))) { - return from(SelectMany(obj, std::move(collectionSelector), std::move(resultSelector))); - } -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto merge(const MergeSource&... source) - -> decltype(from(Merge(obj, observable(source)...))) { - return from(Merge(obj, observable(source)...)); - } -#else - template - auto merge(const MergeSource& source) - -> decltype(from(Merge(obj, observable(source)))) { - return from(Merge(obj, observable(source))); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto zip(S selector, const ZipSource&... source) - -> decltype(from(Zip(selector, obj, observable(source)...))) { - return from(Zip(selector, obj, observable(source)...)); - } - template - auto zip(const Zip1Source&... source) - -> decltype(from(Zip(util::as_tuple(), obj, observable(source)...))) { - return from(Zip(util::as_tuple(), obj, observable(source)...)); - } -#else - template - auto zip(S selector, const ZipSource& source) - -> decltype(from(Zip(selector, obj, observable(source)))) { - return from(Zip(selector, obj, observable(source))); - } - template - auto zip(const Zip1Source& source) - -> decltype(from(Zip(util::as_tuple(), obj, observable(source)))) { - return from(Zip(util::as_tuple(), obj, observable(source))); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES -#if RXCPP_USE_VARIADIC_TEMPLATES - private: - struct selector_tag{}; - struct source_tag{}; - template - auto combine_latest_detail(selector_tag&&, CombineSelector&& selector, const CombineSelectorSources&... sources) - -> decltype(from(CombineLatest(std::forward(selector), obj, observable(sources)...))) { - return from(CombineLatest(std::forward(selector), obj, observable(sources)...)); - } - template - auto combine_latest_detail(source_tag&&, const CombineSourceSources&... sources) - -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(sources)...))) { - return from(CombineLatest(util::as_tuple(), obj, observable(sources)...)); - } - public: - template - auto combine_latest(CombineSourceOrSelector&& sourceOrSelector, const CombineSourceN&... sourcen) - -> decltype(from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), sourcen...))) { - return from(combine_latest_detail(typename std::conditional::type>::value, source_tag, selector_tag>::type(), std::forward(sourceOrSelector), sourcen...)); - } -#else - template - auto combine_latest(S selector, const CombineLSource& source) - -> decltype(from(CombineLatest(selector, obj, observable(source)))) { - return from(CombineLatest(selector, obj, observable(source))); - } - template - auto combine_latest(const CombineLSource& source) - -> decltype(from(CombineLatest(util::as_tuple(), obj, observable(source)))) { - return from(CombineLatest(util::as_tuple(), obj, observable(source))); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - - using base::concat; -#if RXCPP_USE_VARIADIC_TEMPLATES - template - auto concat(const ConcatSource&... source) - -> decltype(from(Concat(Iterate(std::vector())))) { - std::vector sources; - sources.push_back(obj); - std::make_tuple((sources.push_back(observable(source)), true)...); - return from(Concat(Iterate(std::move(sources)))); - } -#else - template - auto concat(const ConcatSource& source) - -> decltype(from(Concat(Iterate(std::vector())))) { - std::vector sources; - sources.push_back(obj); - sources.push_back(observable(source)); - return from(Concat(Iterate(std::move(sources)))); - } -#endif //RXCPP_USE_VARIADIC_TEMPLATES - template - auto concat(Range range) - -> decltype(from(Concat(Iterate(range.insert(range.begin(), range.front()), range)))) { - range.insert(range.begin(), obj); - return from(Concat(Iterate(std::move(range)))); - } - template - auto where(P predicate) -> decltype(from(Where(obj, predicate))) { - return from(Where(obj, predicate)); - } - template - auto group_by( - KS keySelector) - -> decltype(from(GroupBy(obj, keySelector, util::pass_through(), std::less()))) { - return from(GroupBy(obj, keySelector, util::pass_through(), std::less())); - } - template - auto group_by( - KS keySelector, - VS valueSelector) - -> decltype(from(GroupBy(obj, keySelector, valueSelector, std::less()))) { - return from(GroupBy(obj, keySelector, valueSelector, std::less())); - } - template - auto group_by( - KS keySelector, - VS valueSelector, - L less) - -> decltype(from(GroupBy(obj, keySelector, valueSelector, less))) { - return from(GroupBy(obj, keySelector, valueSelector, less)); - } - template - auto scan(Seed seed, A accumulator) - -> decltype(from(Scan(obj, seed, accumulator))) { - return from(Scan(obj, seed, accumulator)); - } - template - auto scan(A accumulator) - -> decltype(from(Scan(obj, accumulator))) { - return from(Scan(obj, accumulator)); - } - template - auto take(Integral n) - -> decltype(from(Take(obj, n))) { - return from(Take(obj, n)); - } - template - auto take_until(const TakeUntilTerminus& terminus) - -> decltype(from(TakeUntil(obj, observable(terminus)))) { - return from(TakeUntil(obj, observable(terminus))); - } - template - auto skip(Integral n) - -> decltype(from(Skip(obj, n))) { - return from(Skip(obj, n)); - } - template - auto skip_until(const SkipUntilTerminus& terminus) - -> decltype(from(SkipUntil(obj, observable(terminus)))) { - return from(SkipUntil(obj, observable(terminus))); - } - template - auto multicast(MulticastSubject subject) - -> decltype(from(Multicast(observable(obj), subject))) { - return from(Multicast(observable(obj), subject)); - } - auto publish() - -> decltype(from(Publish(observable(obj)))) { - return from(Publish(observable(obj))); - } - auto publish(item_type value) - -> decltype(from(Publish(observable(obj), value))) { - return from(Publish(observable(obj), value)); - } - auto publish_last() - -> decltype(from(PublishLast(observable(obj)))) { - return from(PublishLast(observable(obj))); - } - templateclass Allocator> - auto to_vector() - -> decltype(from(ToStdCollection>>(obj))) { - return from(ToStdCollection>>(obj)); - } - auto to_vector() - -> decltype(from(ToStdCollection>(obj))) { - return from(ToStdCollection>(obj)); - } - templateclass Allocator> - auto to_list() - -> decltype(from(ToStdCollection>>(obj))) { - return from(ToStdCollection>>(obj)); - } - auto to_list() - -> decltype(from(ToStdCollection>(obj))) { - return from(ToStdCollection>(obj)); - } - auto materialize() - -> decltype(from(Materialize(observable(obj)))) { - return from(Materialize(observable(obj))); - } - auto delay(Scheduler::clock::duration due, Scheduler::shared scheduler) -> decltype(from(Delay(obj, due, scheduler))) { - return from(Delay(obj, due, scheduler)); - } - auto throttle(Scheduler::clock::duration due, Scheduler::shared scheduler) - -> decltype(from(Throttle(obj, due, scheduler))) { - return from(Throttle(obj, due, scheduler)); - } - auto distinct_until_changed() -> decltype(from(DistinctUntilChanged(obj))) { - return from(DistinctUntilChanged(obj)); - } - auto subscribe_on(Scheduler::shared scheduler) - -> decltype(from(SubscribeOnObservable(obj, std::move(scheduler)))) - { - return from(SubscribeOnObservable(obj, std::move(scheduler))); - } - auto observe_on(Scheduler::shared scheduler) - -> decltype(from(ObserveOnObserver(obj, std::move(scheduler)))) - { - return from(ObserveOnObserver(obj, std::move(scheduler))); - } -#if RXCPP_USE_WINRT - auto observe_on_dispatcher() - -> decltype(from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current())))) - { - return from(ObserveOnObserver(obj, std::static_pointer_cast(winrt::CoreDispatcherScheduler::Current()))); - } -#else - auto on_dispatcher() - -> decltype(from(ObserveOnDispatcher(obj))) - { - return from(ObserveOnDispatcher(obj)); - } -#endif - template - void for_each(OnNext onNext) { - ForEach(obj, onNext); - } - auto subscribe(std::shared_ptr> observer) -> decltype(obj->Subscribe(observer)) { - return obj->Subscribe(observer); - } - template - auto subscribe(OnNext onNext) -> decltype(Subscribe(obj, onNext)) { - auto result = Subscribe(obj, onNext); - return result; - } - template - auto subscribe(OnNext onNext, OnComplete onComplete) - -> decltype(Subscribe(obj, onNext, onComplete)) { - auto result = Subscribe(obj, onNext, onComplete); - return result; - } - template - auto subscribe(OnNext onNext, OnComplete onComplete, OnError onError) - -> decltype(Subscribe(obj, onNext, onComplete, onError)) { - auto result = Subscribe(obj, onNext, onComplete, onError); - return result; - } -#if RXCPP_USE_VARIADIC_TEMPLATE - template - auto chain(ChainArg&&... arg) - -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)...))) { - return from(rxcpp_chain(Tag(), obj, std::forward(arg)...)); - } -#else - template - auto chain() - -> decltype(from(rxcpp_chain(Tag(), obj))) { - return from(rxcpp_chain(Tag(), obj)); - } - template - auto chain(ChainArg&& arg) - -> decltype(from(rxcpp_chain(Tag(), obj, std::forward(arg)))) { - return from(rxcpp_chain(Tag(), obj, std::forward(arg))); - } - template - auto chain( - ChainArg1&& arg1, - ChainArg2&& arg2) - -> decltype(from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2)))) { - return from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2))); - } - template - auto chain( - ChainArg1&& arg1, - ChainArg2&& arg2, - ChainArg3&& arg3) - -> decltype(from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3)))) { - return from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3))); - } - template - auto chain( - ChainArg1&& arg1, - ChainArg2&& arg2, - ChainArg3&& arg3, - ChainArg4&& arg4) - -> decltype(from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3), - std::forward(arg4)))) { - return from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3), - std::forward(arg4))); - } - template - auto chain( - ChainArg1&& arg1, - ChainArg2&& arg2, - ChainArg3&& arg3, - ChainArg4&& arg4, - ChainArg5&& arg5) - -> decltype(from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3), - std::forward(arg4), - std::forward(arg5)))) { - return from(rxcpp_chain(Tag(), obj, - std::forward(arg1), - std::forward(arg2), - std::forward(arg3), - std::forward(arg4), - std::forward(arg5))); - } -#endif - }; - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } - - template - Binder < std::shared_ptr < ConnectableObservable> > from(std::shared_ptr < ConnectableObservable < T >> obj) { - return Binder < std::shared_ptr < ConnectableObservable> >(std::move(obj)); } - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(observable(obj)); } - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(observable(obj)); } - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } - - template - Binder>> from(std::shared_ptr> obj) { - return Binder>>(std::move(obj)); } - - template - Binder from(Binder binder) { - return std::move(binder); } - - template - T item(const Binder>>&); - - template - T item(const Binder>>&); -} - -#endif diff --git a/Rx/CPP/test/operators/Merge.cpp b/Rx/CPP/test/operators/Merge.cpp deleted file mode 100644 index 7e26d8f..0000000 --- a/Rx/CPP/test/operators/Merge.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -SCENARIO("merge issue 5", "[merge][issue][operators]"){ - GIVEN("Empty and Never"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - WHEN("merged 4 times"){ - - std::vector empty; - auto o = rx::observable(rx::from(rx::Iterate(empty)) - .merge(rx::Never())); - - auto res1 = scheduler->Start( - [o]() { - return o; - } - ); - auto res2 = scheduler->Start( - [o]() { - return o; - } - ); - auto res3 = scheduler->Start( - [o]() { - return o; - } - ); - auto res4 = scheduler->Start( - [o]() { - return o; - } - ); - - THEN("1 - the output is empty and subscribed"){ - std::vector required; - auto actual = res1->Messages(); - REQUIRE(required == actual); - } - THEN("2 - the output is empty and subscribed"){ - std::vector required; - auto actual = res2->Messages(); - REQUIRE(required == actual); - } - THEN("3 - the output is empty and subscribed"){ - std::vector required; - auto actual = res3->Messages(); - REQUIRE(required == actual); - } - THEN("4 - the output is empty and subscribed"){ - std::vector required; - auto actual = res4->Messages(); - REQUIRE(required == actual); - } - } - } -} diff --git a/Rx/CPP/test/operators/Publish.cpp b/Rx/CPP/test/operators/Publish.cpp deleted file mode 100644 index 26e6e5b..0000000 --- a/Rx/CPP/test/operators/Publish.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -SCENARIO("publish_last", "[publish_last][publish][multicast][operators]"){ - GIVEN("a test hot observable of longs"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(110, 7), - m::OnNext(220, 3), - m::OnNext(280, 4), - m::OnNext(290, 1), - m::OnNext(340, 8), - m::OnNext(360, 5), - m::OnNext(370, 6), - m::OnNext(390, 7), - m::OnNext(410, 13), - m::OnNext(430, 2), - m::OnNext(450, 9), - m::OnNext(520, 11), - m::OnNext(560, 20), - m::OnCompleted(600) - }; - return m::ToVector(messages); - }() - ); - - auto res = scheduler->CreateObserver(); - - rx::SerialDisposable subscription; - std::shared_ptr> ys; - - WHEN("subscribed and then connected"){ - - scheduler->ScheduleAbsolute(rx::TestScheduler::Created, - [&invoked, &ys, &xs](rx::Scheduler::shared) { - ys = rx::observable(rx::from(xs) - .publish_last()); - return rx::Disposable::Empty(); - }); - - scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&subscription, &ys, &res](rx::Scheduler::shared) { - subscription.Set(ys->Subscribe(res)); - return rx::Disposable::Empty(); - }); - - scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&subscription](rx::Scheduler::shared) { - subscription.Dispose(); - return rx::Disposable::Empty(); - }); - - auto connection = std::make_shared(); - scheduler->ScheduleAbsolute(300, [connection, &ys](rx::Scheduler::shared) { - connection->Set(ys->Connect()); - return rx::Disposable::Empty(); - }); - scheduler->ScheduleAbsolute(400, [connection](rx::Scheduler::shared) { - connection->Dispose(); - return rx::Disposable::Empty(); - }); - - connection = std::make_shared(); - scheduler->ScheduleAbsolute(500, [connection, &ys](rx::Scheduler::shared) { - connection->Set(ys->Connect()); - return rx::Disposable::Empty(); - }); - scheduler->ScheduleAbsolute(550, [connection](rx::Scheduler::shared) { - connection->Dispose(); - return rx::Disposable::Empty(); - }); - - connection = std::make_shared(); - scheduler->ScheduleAbsolute(650, [connection, &ys](rx::Scheduler::shared) { - connection->Set(ys->Connect()); - return rx::Disposable::Empty(); - }); - scheduler->ScheduleAbsolute(800, [connection](rx::Scheduler::shared) { - connection->Dispose(); - return rx::Disposable::Empty(); - }); - - scheduler->Start(); - - THEN("the output is empty"){ - std::vector required; - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there were 3 subscription/unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(300, 400), - m::Subscribe(500, 550), - m::Subscribe(650, 800) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - } - } -} - diff --git a/Rx/CPP/test/operators/Return.cpp b/Rx/CPP/test/operators/Return.cpp deleted file mode 100644 index 44c38cf..0000000 --- a/Rx/CPP/test/operators/Return.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -SCENARIO("return basic", "[return][operators]"){ - GIVEN("return 42"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - auto res = scheduler->Start( - [=]() { - return rx::Return(42, scheduler); - } - ); - - WHEN("started"){ - - THEN("the output is 42"){ - m::RecordedT items[] = { - m::OnNext(201, 42), - m::OnCompleted(201) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - } - } -} - -SCENARIO("return disposed", "[return][operators]"){ - GIVEN("test scheduler"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - WHEN("return 42 after disposed"){ - auto res = scheduler->Start( - [&]() { - return rx::Return(42, scheduler); - }, - 200 - ); - - THEN("the output is empty"){ - std::vector required; - auto actual = res->Messages(); - REQUIRE(required == actual); - } - } - } -} - -SCENARIO("return disposed after next", "[return][operators]"){ - GIVEN("return 42 after disposal"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - rx::SerialDisposable d; - - auto xs = rx::Return(42, scheduler); - - auto res = scheduler->CreateObserver(); - - scheduler->ScheduleAbsolute( - 100, - [&](rx::Scheduler::shared) { - d.Set(from(xs).subscribe( - [&](int x){ - d.Dispose(); res->OnNext(x);}, - [&](){ - res->OnCompleted();}, - [&](std::exception_ptr ex){ - res->OnError(ex);})); - return d; - } - ); - - WHEN("started"){ - - scheduler->Start(); - - THEN("the output is 42"){ - m::RecordedT items[] = { - m::OnNext(101, 42) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - } - } -} - -SCENARIO("return observer throws", "[return][operators]"){ - GIVEN("return 42"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - auto xs = rx::Return(42, scheduler); - - WHEN("subscribed to onnext that throws"){ - from(xs).subscribe([](int){ throw std::runtime_error("onnext throws"); }); - - THEN("the exception is not supressed"){ - REQUIRE_THROWS(scheduler->Start()); - } - } - - WHEN("subscribed to oncompleted that throws"){ - from(xs).subscribe([](int){},[](){ throw std::runtime_error("oncompleted throws"); }); - - THEN("the exception is not supressed"){ - REQUIRE_THROWS(scheduler->Start()); - } - } - } -} - diff --git a/Rx/CPP/test/operators/Select.cpp b/Rx/CPP/test/operators/Select.cpp deleted file mode 100644 index 2de7f21..0000000 --- a/Rx/CPP/test/operators/Select.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -SCENARIO("select throws", "[select][map][operators]"){ - GIVEN("select"){ - WHEN("subscribed to onnext that throws"){ - THEN("the exception is not supressed"){ - auto next_throws = [](int){ - throw std::runtime_error("onnext throws"); }; - REQUIRE_THROWS(from(rx::Return(1)) - .select([](int v){return v;}) - .subscribe(next_throws)); - } - } - - WHEN("subscribed to throw operator"){ - THEN("the exception is not supressed"){ - REQUIRE_THROWS(from(rx::Throw(std::runtime_error("throw operator"))) - .select([](int v){return v;}) - .subscribe([](int){}, [](){}, [](std::exception_ptr){ throw std::runtime_error("onerror throws"); })); - } - } - - WHEN("subscribed to oncompleted that throws"){ - THEN("the exception is not supressed"){ - REQUIRE_THROWS(from(rx::Empty()) - .select([](int v){return v;}) - .subscribe([](int){}, [](){ throw std::runtime_error("oncompleted throws"); }, [](std::exception_ptr){})); - } - } - } -} - -SCENARIO("select should throw", "[select][map][operators][hide]"){ - GIVEN("select"){ - WHEN("subscribe throws"){ - THEN("the exception is not supressed"){ - // not yet sure why this fails - auto subscribe_throws = [](std::shared_ptr> observer) -> rxcpp::Disposable { - throw std::runtime_error("subscribe throws"); }; - REQUIRE_THROWS(from(rx::CreateObservable(subscribe_throws)) - .select([](int v){return v;}) - .subscribe([](int){})); - } - } - } -} - -SCENARIO("select stops on completion", "[select][map][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(180, 1), - m::OnNext(210, 2), - m::OnNext(240, 3), - m::OnNext(290, 4), - m::OnNext(350, 5), - m::OnCompleted(400), - m::OnNext(410, -1), - m::OnCompleted(420), - m::OnError(430, std::exception()) - }; - return m::ToVector(messages); - }() - ); - - WHEN("mapped to ints that are one larger"){ - - auto res = scheduler->Start( - [xs, &invoked]() { - return rx::observable(rx::from(xs) - .select([&invoked](int x) { - invoked++; - return x + 1; - })); - } - ); - - THEN("the output only contains primes"){ - m::RecordedT items[] = { - m::OnNext(210, 3), - m::OnNext(240, 4), - m::OnNext(290, 5), - m::OnNext(350, 6), - m::OnCompleted(400), - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 400) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until completed"){ - REQUIRE(4 == invoked); - } - } - } -} - -SCENARIO("select stops on disposal", "[select][map][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(100, 1), - m::OnNext(200, 2), - m::OnNext(500, 3), - m::OnNext(600, 4) - }; - return m::ToVector(messages); - }() - ); - - auto res = scheduler->CreateObserver(); - - WHEN("the ints are identity mapped"){ - - rx::SerialDisposable d; - - d.Set(observable(from(xs) - .select([&](int x) { - invoked++; - if (scheduler->Clock() > 400) { - d.Dispose(); - } - return x; - })) - ->Subscribe(observer(res)) - ); - - scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&](rx::Scheduler::shared) { - d.Dispose(); return rx::Disposable::Empty();}); - - scheduler->Start(); - - THEN("the output only contains values that arrived before disposal"){ - m::RecordedT items[] = { - m::OnNext(100, 1), - m::OnNext(200, 2) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(0, 500) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("select was called until disposed"){ - REQUIRE(3 == invoked); - } - } - } -} diff --git a/Rx/CPP/test/operators/SelectMany.cpp b/Rx/CPP/test/operators/SelectMany.cpp deleted file mode 100644 index 9daef6c..0000000 --- a/Rx/CPP/test/operators/SelectMany.cpp +++ /dev/null @@ -1,279 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -SCENARIO("select_many completes", "[select_many][map][operators]"){ - GIVEN("two cold observables. one of ints. one of strings."){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - typedef rx::TestScheduler::Messages ms; - - long invoked = 0; - - auto xs = scheduler->CreateColdObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(100, 4), - m::OnNext(200, 2), - m::OnNext(300, 3), - m::OnNext(400, 1), - m::OnCompleted(500) - }; - return m::ToVector(messages); - }() - ); - - auto ys = scheduler->CreateColdObservable( - []() { - ms::RecordedT messages[] = { - ms::OnNext(50, "foo"), - ms::OnNext(100, "bar"), - ms::OnNext(150, "baz"), - ms::OnNext(200, "qux"), - ms::OnCompleted(250) - }; - return ms::ToVector(messages); - }() - ); - - WHEN("each int is mapped to the strings"){ - - auto res = scheduler->Start( - [&]() { - return observable(from(xs) - .select_many([&](int){return ys;})); - } - ); - - THEN("the output contains strings repeated for each int"){ - ms::RecordedT items[] = { - ms::OnNext(350, "foo"), - ms::OnNext(400, "bar"), - ms::OnNext(450, "foo"), - ms::OnNext(450, "baz"), - ms::OnNext(500, "bar"), - ms::OnNext(500, "qux"), - ms::OnNext(550, "baz"), - ms::OnNext(550, "foo"), - ms::OnNext(600, "bar"), - ms::OnNext(600, "qux"), - ms::OnNext(650, "baz"), - ms::OnNext(650, "foo"), - ms::OnNext(700, "qux"), - ms::OnNext(700, "bar"), - ms::OnNext(750, "baz"), - ms::OnNext(800, "qux"), - ms::OnCompleted(850) - }; - auto required = ms::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription to the ints"){ - rx::Subscription items[] = { - m::Subscribe(200, 700) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("there were four subscription and unsubscription to the strings"){ - rx::Subscription items[] = { - ms::Subscribe(300, 550), - ms::Subscribe(400, 650), - ms::Subscribe(500, 750), - ms::Subscribe(600, 850) - }; - auto required = m::ToVector(items); - auto actual = ys->Subscriptions(); - REQUIRE(required == actual); - } - } - } -} - -SCENARIO("select_many source never ends", "[select_many][map][operators]"){ - GIVEN("two cold observables. one of ints. one of strings."){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - typedef rx::TestScheduler::Messages ms; - - long invoked = 0; - - auto xs = scheduler->CreateColdObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(100, 4), - m::OnNext(200, 2), - m::OnNext(300, 3), - m::OnNext(400, 1), - m::OnNext(500, 5), - m::OnNext(700, 0) - }; - return m::ToVector(messages); - }() - ); - - auto ys = scheduler->CreateColdObservable( - []() { - ms::RecordedT messages[] = { - ms::OnNext(55, "foo"), - ms::OnNext(104, "bar"), - ms::OnNext(153, "baz"), - ms::OnNext(202, "qux"), - ms::OnCompleted(251) - }; - return ms::ToVector(messages); - }() - ); - - WHEN("each int is mapped to the strings"){ - - auto res = scheduler->Start( - [&]() { - return observable(from(xs) - .select_many([&](int){return ys;})); - } - ); - - THEN("the output contains strings repeated for each int"){ - ms::RecordedT items[] = { - ms::OnNext(355, "foo"), - ms::OnNext(404, "bar"), - ms::OnNext(453, "baz"), - ms::OnNext(455, "foo"), - ms::OnNext(502, "qux"), - ms::OnNext(504, "bar"), - ms::OnNext(553, "baz"), - ms::OnNext(555, "foo"), - ms::OnNext(602, "qux"), - ms::OnNext(604, "bar"), - ms::OnNext(653, "baz"), - ms::OnNext(655, "foo"), - ms::OnNext(702, "qux"), - ms::OnNext(704, "bar"), - ms::OnNext(753, "baz"), - ms::OnNext(755, "foo"), - ms::OnNext(802, "qux"), - ms::OnNext(804, "bar"), - ms::OnNext(853, "baz"), - ms::OnNext(902, "qux"), - ms::OnNext(955, "foo") - }; - auto required = ms::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription to the ints"){ - rx::Subscription items[] = { - m::Subscribe(200, 1000) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("there were four subscription and unsubscription to the strings"){ - rx::Subscription items[] = { - ms::Subscribe(300, 551), - ms::Subscribe(400, 651), - ms::Subscribe(500, 751), - ms::Subscribe(600, 851), - ms::Subscribe(700, 951), - ms::Subscribe(900, 1000) - }; - auto required = m::ToVector(items); - auto actual = ys->Subscriptions(); - REQUIRE(required == actual); - } - } - } -} - -SCENARIO("select_many inner error", "[select_many][map][operators]"){ - GIVEN("two cold observables. one of ints. one of strings."){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - typedef rx::TestScheduler::Messages ms; - - long invoked = 0; - - auto xs = scheduler->CreateColdObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(100, 4), - m::OnNext(200, 2), - m::OnNext(300, 3), - m::OnNext(400, 1), - m::OnCompleted(500) - }; - return m::ToVector(messages); - }() - ); - - auto ys = scheduler->CreateColdObservable( - []() { - ms::RecordedT messages[] = { - ms::OnNext(55, "foo"), - ms::OnNext(104, "bar"), - ms::OnNext(153, "baz"), - ms::OnNext(202, "qux"), - ms::OnError(301, std::exception()) - }; - return ms::ToVector(messages); - }() - ); - - WHEN("each int is mapped to the strings"){ - - auto res = scheduler->Start( - [&]() { - return observable(from(xs) - .select_many([&](int){return ys;})); - } - ); - - THEN("the output contains strings repeated for each int"){ - ms::RecordedT items[] = { - ms::OnNext(355, "foo"), - ms::OnNext(404, "bar"), - ms::OnNext(453, "baz"), - ms::OnNext(455, "foo"), - ms::OnNext(502, "qux"), - ms::OnNext(504, "bar"), - ms::OnNext(553, "baz"), - ms::OnNext(555, "foo"), - ms::OnError(601, std::exception()) - }; - auto required = ms::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription to the ints"){ - rx::Subscription items[] = { - m::Subscribe(200, 601) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("there were four subscription and unsubscription to the strings"){ - rx::Subscription items[] = { - ms::Subscribe(300, 601), - ms::Subscribe(400, 601), - ms::Subscribe(500, 601), - ms::Subscribe(600, 601) - }; - auto required = ms::ToVector(items); - auto actual = ys->Subscriptions(); - REQUIRE(required == actual); - } - } - } -} diff --git a/Rx/CPP/test/operators/Where.cpp b/Rx/CPP/test/operators/Where.cpp deleted file mode 100644 index ddfbb3a..0000000 --- a/Rx/CPP/test/operators/Where.cpp +++ /dev/null @@ -1,389 +0,0 @@ -#include "cpprx/rx.hpp" -namespace rx=rxcpp; - -#include "catch.hpp" - -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("where stops on completion", "[where][filter][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(110, 1), - m::OnNext(180, 2), - m::OnNext(230, 3), - m::OnNext(270, 4), - m::OnNext(340, 5), - m::OnNext(380, 6), - m::OnNext(390, 7), - m::OnNext(450, 8), - m::OnNext(470, 9), - m::OnNext(560, 10), - m::OnNext(580, 11), - m::OnCompleted(600), - m::OnNext(610, 12), - m::OnError(620, std::exception()), - m::OnCompleted(630) - }; - return m::ToVector(messages); - }() - ); - - WHEN("filtered to ints that are primes"){ - - auto res = scheduler->Start( - [xs, &invoked]() { - return rx::observable(rx::from(xs) - .where([&invoked](int x) { - invoked++; - return IsPrime(x); - })); - } - ); - - THEN("the output only contains primes"){ - m::RecordedT items[] = { - m::OnNext(230, 3), - m::OnNext(340, 5), - m::OnNext(390, 7), - m::OnNext(580, 11), - m::OnCompleted(600) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 600) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until completed"){ - REQUIRE(9 == invoked); - } - } - } -} - -SCENARIO("where stops on disposal", "[where][filter][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(110, 1), - m::OnNext(180, 2), - m::OnNext(230, 3), - m::OnNext(270, 4), - m::OnNext(340, 5), - m::OnNext(380, 6), - m::OnNext(390, 7), - m::OnNext(450, 8), - m::OnNext(470, 9), - m::OnNext(560, 10), - m::OnNext(580, 11), - m::OnCompleted(600) - }; - return m::ToVector(messages); - }() - ); - - WHEN("filtered to ints that are primes"){ - - auto res = scheduler->Start( - [xs, &invoked]() { - return rx::observable(rx::from(xs) - .where([&invoked](int x) { - invoked++; - return IsPrime(x); - })); - }, - 400 - ); - - THEN("the output only contains primes that arrived before disposal"){ - m::RecordedT items[] = { - m::OnNext(230, 3), - m::OnNext(340, 5), - m::OnNext(390, 7) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 400) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until disposed"){ - REQUIRE(5 == invoked); - } - } - } -} - -SCENARIO("where stops on error", "[where][filter][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - std::exception ex; - - auto xs = scheduler->CreateHotObservable( - [ex]() { - m::RecordedT messages[] = { - m::OnNext(110, 1), - m::OnNext(180, 2), - m::OnNext(230, 3), - m::OnNext(270, 4), - m::OnNext(340, 5), - m::OnNext(380, 6), - m::OnNext(390, 7), - m::OnNext(450, 8), - m::OnNext(470, 9), - m::OnNext(560, 10), - m::OnNext(580, 11), - m::OnError(600, ex), - m::OnNext(610, 12), - m::OnError(620, std::exception()), - m::OnCompleted(630) - }; - return m::ToVector(messages); - }() - ); - - WHEN("filtered to ints that are primes"){ - - auto res = scheduler->Start( - [xs, &invoked]() { - return rx::observable(rx::from(xs) - .where([&invoked](int x) { - invoked++; - return IsPrime(x); - })); - } - ); - - THEN("the output only contains primes"){ - m::RecordedT items[] = { - m::OnNext(230, 3), - m::OnNext(340, 5), - m::OnNext(390, 7), - m::OnNext(580, 11), - m::OnError(600, ex), - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 600) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until error"){ - REQUIRE(9 == invoked); - } - } - } -} - -SCENARIO("where stops on throw from predicate", "[where][filter][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - std::exception ex; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(110, 1), - m::OnNext(180, 2), - m::OnNext(230, 3), - m::OnNext(270, 4), - m::OnNext(340, 5), - m::OnNext(380, 6), - m::OnNext(390, 7), - m::OnNext(450, 8), - m::OnNext(470, 9), - m::OnNext(560, 10), - m::OnNext(580, 11), - m::OnCompleted(600), - m::OnNext(610, 12), - m::OnError(620, std::exception()), - m::OnCompleted(630) - }; - return m::ToVector(messages); - }() - ); - - WHEN("filtered to ints that are primes"){ - - auto res = scheduler->Start( - [ex, xs, &invoked]() { - return rx::observable(rx::from(xs) - .where([ex, &invoked](int x) { - invoked++; - if (x > 5) { - throw ex; - } - return IsPrime(x); - })); - } - ); - - THEN("the output only contains primes"){ - m::RecordedT items[] = { - m::OnNext(230, 3), - m::OnNext(340, 5), - m::OnError(380, ex) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 380) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until error"){ - REQUIRE(4 == invoked); - } - } - } -} - -SCENARIO("where stops on dispose from predicate", "[where][filter][operators]"){ - GIVEN("a test hot observable of ints"){ - auto scheduler = std::make_shared(); - typedef rx::TestScheduler::Messages m; - - long invoked = 0; - - auto xs = scheduler->CreateHotObservable( - []() { - m::RecordedT messages[] = { - m::OnNext(110, 1), - m::OnNext(180, 2), - m::OnNext(230, 3), - m::OnNext(270, 4), - m::OnNext(340, 5), - m::OnNext(380, 6), - m::OnNext(390, 7), - m::OnNext(450, 8), - m::OnNext(470, 9), - m::OnNext(560, 10), - m::OnNext(580, 11), - m::OnCompleted(600), - m::OnNext(610, 12), - m::OnError(620, std::exception()), - m::OnCompleted(630) - }; - return m::ToVector(messages); - }() - ); - - auto res = scheduler->CreateObserver(); - - rx::SerialDisposable d; - std::shared_ptr> ys; - - WHEN("filtered to ints that are primes"){ - - scheduler->ScheduleAbsolute(rx::TestScheduler::Created, - [&invoked, &d, &ys, &xs](rx::Scheduler::shared) { - ys = rx::observable(rx::from(xs) - .where([&invoked, &d](int x) { - invoked++; - if (x == 8) - d.Dispose(); - return IsPrime(x); - })); - return rx::Disposable::Empty(); - }); - - scheduler->ScheduleAbsolute(rx::TestScheduler::Subscribed, [&d, &ys, &res](rx::Scheduler::shared) { - d.Set(ys->Subscribe(res)); - return rx::Disposable::Empty(); - }); - - scheduler->ScheduleAbsolute(rx::TestScheduler::Disposed, [&d](rx::Scheduler::shared) { - d.Dispose(); - return rx::Disposable::Empty(); - }); - - scheduler->Start(); - - THEN("the output only contains primes"){ - m::RecordedT items[] = { - m::OnNext(230, 3), - m::OnNext(340, 5), - m::OnNext(390, 7) - }; - auto required = m::ToVector(items); - auto actual = res->Messages(); - REQUIRE(required == actual); - } - - THEN("there was one subscription and one unsubscription"){ - rx::Subscription items[] = { - m::Subscribe(200, 450) - }; - auto required = m::ToVector(items); - auto actual = xs->Subscriptions(); - REQUIRE(required == actual); - } - - THEN("where was called until disposed"){ - REQUIRE(6 == invoked); - } - } - } -} - diff --git a/Rx/CPP/test/test.cpp b/Rx/CPP/test/test.cpp deleted file mode 100644 index 0c7c351..0000000 --- a/Rx/CPP/test/test.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include "catch.hpp" diff --git a/Rx/CPP/testbench/data.txt b/Rx/CPP/testbench/data.txt deleted file mode 100644 index b16aea6..0000000 --- a/Rx/CPP/testbench/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/Rx/CPP/testbench/testbench.cpp b/Rx/CPP/testbench/testbench.cpp deleted file mode 100644 index 4fd5e8c..0000000 --- a/Rx/CPP/testbench/testbench.cpp +++ /dev/null @@ -1,652 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. - -// testbench.cpp : Defines the entry point for the console application. -// - -#include "cpprx/rx.hpp" -#include "cpplinq/linq.hpp" - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -bool IsPrime(int x); - -struct Count { - Count() : subscriptions(0), nexts(0), completions(0), errors(0), disposals(0) {} - std::atomic subscriptions; - std::atomic nexts; - std::atomic completions; - std::atomic errors; - std::atomic disposals; -}; -template -std::shared_ptr> Record( - const std::shared_ptr>& source, - Count* count -) -{ - return rxcpp::CreateObservable( - [=](std::shared_ptr> observer) -> rxcpp::Disposable - { - ++count->subscriptions; - rxcpp::ComposableDisposable cd; - cd.Add(rxcpp::Disposable([=](){ - ++count->disposals;})); - cd.Add(rxcpp::Subscribe( - source, - // on next - [=](T element) - { - ++count->nexts; - observer->OnNext(std::move(element)); - }, - // on completed - [=] - { - ++count->completions; - observer->OnCompleted(); - }, - // on error - [=](const std::exception_ptr& error) - { - ++count->errors; - observer->OnError(error); - })); - return cd; - }); -} -struct record {}; -template -rxcpp::Binder>> rxcpp_chain(record&&, const std::shared_ptr>& source, Count* count) { - return rxcpp::from(Record(source, count)); -} - -vector vector_range(int start, int end) -{ - vector v; - for (int i = start; i < end; ++i) - v.push_back(i); - return v; -} - -void IxToRx(int n) { - Count sourcecount, takencount, observedcount; - - std::cout << "IxToRx: first " << n << " primes squared" << endl; - auto values = vector_range(2, n * 10); - - auto primes = cpplinq::from(values) - .where(IsPrime) - .select([](int x) { return std::make_pair(x, x*x); }); - - auto output = std::make_shared(); - rxcpp::from(rxcpp::Iterate(primes)) - .template chain(&sourcecount) - .take(n) - .template chain(&takencount) - .observe_on(output) - .template chain(&observedcount) - .for_each(rxcpp::MakeTupleDispatch( - [](int p, int s) { - cout << p << " =square=> " << s << endl; - })); - - cout << "location: subscriptions, nexts, completions, errors, disposals" << endl; - cout << "sourcecount: " << sourcecount.subscriptions << ", " << sourcecount.nexts << ", " << sourcecount.completions << ", " << sourcecount.errors << ", " << sourcecount.disposals << endl; - cout << "takencount: " << takencount.subscriptions << ", " << takencount.nexts << ", " << takencount.completions << ", " << takencount.errors << ", " << takencount.disposals << endl; - cout << "observedcount: " << observedcount.subscriptions << ", " << observedcount.nexts << ", " << observedcount.completions << ", " << observedcount.errors << ", " << observedcount.disposals << endl; -} - -void PrintPrimes(int n) -{ - std::cout << "Rx: first " << n << " primes squared" << endl; - auto values = rxcpp::Range(2); // infinite (until overflow) stream of integers - rxcpp::from(values) - .where(IsPrime) - .materialize() - .dematerialize() - .select([](int x) { return std::make_pair(x, x*x); }) - .take(n) - .for_each(rxcpp::MakeTupleDispatch( - [](int p, int s) { - cout << p << " =square=> " << s << endl; - })); -} - -void Scan() -{ - int test = 0; - auto next = [&](int i) { - cout << "next " << test << ":" << i << endl; - }; - auto complete = [&]() { - cout << "completed " << test << endl; - }; - auto error = [&](std::exception_ptr e) { - try { - std::rethrow_exception(e); - } - catch(std::exception ex) { - cout << ex.what() << endl; - } - }; - - auto input = std::make_shared(); - - auto add = [](int x, int y){return x + y;}; - - // Usage - auto obs1 = rxcpp::from(rxcpp::Empty(input)).scan(add); - auto obs2 = rxcpp::from(rxcpp::Empty(input)).scan(0, add); - - auto obs3 = rxcpp::from(rxcpp::Range(1, 3, 1, input)).scan(add); - auto obs4 = rxcpp::from(rxcpp::Range(1, 3, 1, input)).scan(0, add); - - test = 1; - obs1.subscribe(next, complete, error); - // => completed 1 - - test = 2; - obs2.subscribe(next, complete, error); - // => next 2:0 - // => completed 2 - - test = 3; - obs3.subscribe(next, complete, error); - // => next 3:1 - // => next 3:3 - // => next 3:6 - // => completed 3 - - test = 4; - obs4.subscribe(next, complete, error); - // => next 4:1 - // => next 4:3 - // => next 4:6 - // => completed 4 -} - -void Concat(int n) -{ - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .where(IsPrime) - .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("1:", prime);}) - .take(n/2); - - auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers - auto s2 = rxcpp::from(values2) - .subscribe_on(input2) - .where(IsPrime) - .select([](int prime) -> std::tuple {this_thread::yield(); return std::make_tuple("2:", prime);}) - .take(n/2); - - rxcpp::from(s2) - .concat(s1) - .take(n) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout << s << " =concat=> " << p << endl; - })); -} - -void Combine(int n) -{ - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .where(IsPrime) - .select([](int prime) -> int {this_thread::yield(); return prime;}); - - auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers - rxcpp::from(values2) - .subscribe_on(input2) - .where(IsPrime) - .select([](int prime) -> int {this_thread::yield(); return prime;}) - .combine_latest(s1) - .take(n) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](int p2, int p1) { - cout << p2 << " =combined=> " << p1 << endl; - })); -} - - - -template -void Zip(int n) -{ - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - Count s1count, s2count, zipcount, takecount, outputcount; - - auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .where(IsPrime) - .template chain(&s1count) - .select([](int prime) -> int {this_thread::yield(); return prime;}); - - auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers - rxcpp::from(values2) - .subscribe_on(input2) - .where(IsPrime) - .template chain(&s2count) - .select([](int prime) -> int {this_thread::yield(); return prime;}) - .zip(s1) - .template chain(&zipcount) - .take(n) - .template chain(&takecount) - .observe_on(output) - .template chain(&outputcount) - .for_each(rxcpp::MakeTupleDispatch( - [](int p2, int p1) { - cout << p2 << " =zipped=> " << p1 << endl; - })); - - cout << "location: subscriptions, nexts, completions, errors, disposals" << endl; - cout << "s1count: " << s1count.subscriptions << ", " << s1count.nexts << ", " << s1count.completions << ", " << s1count.errors << ", " << s1count.disposals << endl; - cout << "s2count: " << s2count.subscriptions << ", " << s2count.nexts << ", " << s2count.completions << ", " << s2count.errors << ", " << s2count.disposals << endl; - cout << "zipcount: " << zipcount.subscriptions << ", " << zipcount.nexts << ", " << zipcount.completions << ", " << zipcount.errors << ", " << zipcount.disposals << endl; - cout << "takecount: " << takecount.subscriptions << ", " << takecount.nexts << ", " << takecount.completions << ", " << takecount.errors << ", " << takecount.disposals << endl; - cout << "outputcount: " << outputcount.subscriptions << ", " << outputcount.nexts << ", " << outputcount.completions << ", " << outputcount.errors << ", " << outputcount.disposals << endl; -} - -void Merge(int n) -{ - auto input1 = std::make_shared(); - auto input2 = std::make_shared(); - auto output = std::make_shared(); - - cout << "merge==> : " << endl; - - auto values1 = rxcpp::Range(100); // infinite (until overflow) stream of integers - auto s1 = rxcpp::from(values1) - .subscribe_on(input1) - .where(IsPrime) - .select([](int prime1) -> std::tuple {this_thread::yield(); return std::make_tuple("1: ", prime1);}); - - auto values2 = rxcpp::Range(2); // infinite (until overflow) stream of integers - rxcpp::from(values2) - .subscribe_on(input2) - .where(IsPrime) - .select([](int prime2) -> std::tuple {this_thread::yield(); return std::make_tuple("2: ", prime2);}) - .merge(s1) - .take(n) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout << s << p << endl; - })); -} - -void RefCount(int n) -{ - auto loop = std::make_shared(); - - auto values1 = rxcpp::from(rxcpp::Range(1)) - .where(IsPrime) - .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) - .publish() - .ref_count(); // infinite (until overflow) stream of prime integers - - auto v1 = rxcpp::from(values1) - .select([](int prime1) -> std::tuple {return std::make_tuple("1: ", prime1);}); - - auto v2 = rxcpp::from(values1) - .select([](int prime1) -> std::tuple {return std::make_tuple("2: ", prime1);}); - - cout << "Merge 2 subscriptions to published primes:"; - rxcpp::from(v1) - .merge(v2) - .subscribe_on(loop) - .take(n) - .for_each(rxcpp::MakeTupleDispatch( - [](const char* s, int p) { - cout << s << p << ", "; - })); - - auto values2 = rxcpp::from(rxcpp::Range(100)) - .where(IsPrime) - .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) - .publish(1000) - .ref_count(); // infinite (until overflow) stream of prime integers - - cout << endl << "Subscription 1 - published primes:" << endl; - rxcpp::from(values2) - .subscribe_on(loop) - .take(n/2) - .for_each( - [](int p) { - cout << p << ", "; - }); - - cout << endl << "Subscription 2 - published primes:" << endl; - rxcpp::from(values2) - .subscribe_on(loop) - .take(n/2) - .for_each( - [](int p) { - cout << p << ", "; - }); - - auto values3 = rxcpp::from(rxcpp::Range(200)) - .where(IsPrime) - .select([](int p) -> int {cout << endl << "producing: " << p << "-> "; return p;}) - .take(n/2) - .publish_last() - .ref_count(); // last of n/2 prime integers - - cout << endl << "Subscription 1 - last published prime:"; - rxcpp::from(values3) - .subscribe_on(loop) - .for_each( - [](int p) { - cout << p << ", "; - }); - - cout << endl << "Subscription 2 - last published prime:" << endl; - rxcpp::from(values3) - .subscribe_on(loop) - .for_each( - [](int p) { - cout << p << ", "; - }); - cout << endl; -} - - -void PrintIntervals(int n) { - using namespace std::chrono; - typedef steady_clock clock; - struct Tick { - Tick(size_t c, clock::time_point at) : cursor(c), at(at) {} - size_t cursor; - clock::time_point at; - }; - auto source = std::make_shared(); - auto subject = rxcpp::CreateSubject(); - - cout << n << " Intervals of .5 second: " << endl; - rxcpp::from(subject) - .zip(rxcpp::from(subject).skip(1)) - .select(rxcpp::MakeTupleDispatch( - [=](Tick a, Tick b){ - return duration_cast(b.at.time_since_epoch()) - - duration_cast(a.at.time_since_epoch());})) - .to_vector() - .subscribe( - // on next - [=](std::vector d) - { - cout << endl; - auto l = std::max_element(d.begin(), d.end()); - auto s = std::min_element(d.begin(), d.end()); - cout << "range: " << s->count() << "ms-" << l->count() << "ms" << endl; - }); - - rxcpp::from(rxcpp::Interval(std::chrono::milliseconds(500), source)) - .select([](size_t interval){return Tick(interval, clock::now());}) - .take(n) - .for_each( - // on next - [=](Tick t) - { - cout << "." << flush; - subject->OnNext(std::move(t)); - }); - subject->OnCompleted(); -} - -std::shared_ptr> Data( - string filename, - rxcpp::Scheduler::shared scheduler = std::make_shared() -); -string extract_value(const string& input, const string& key); - -void run() -{ - using namespace cpplinq; - - struct item { - string args; - int concurrency; - double time; - - item(const item& other) : args(other.args), concurrency(other.concurrency), time(other.time) { - } - item(item&& other) : args(std::move(other.args)), concurrency(std::move(other.concurrency)), time(std::move(other.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() ); - } - item& operator=(item other){ - using std::swap; - swap(args, other.args); - swap(concurrency, other.concurrency); - swap(time, other.time); - return *this; - } - }; - - auto input = std::make_shared(); - auto output = std::make_shared(); - - auto dataLines = Data("data.txt"); - - rxcpp::from(dataLines) - .subscribe_on(input) - // parse input into items - .select([](const string& line) { - return item(line);} - ) - // group items by args field - .group_by([](const item& i) { - return i.args;} - ) - // flatten concurrencies in the same args - .select_many( - [](const std::shared_ptr> & argsGroup){ - return rxcpp::from(argsGroup) - // group items by concurrency field - .group_by([](const item& i){ - return i.concurrency;} - ) - // flatten times in the same concurrency - .select_many( - [](const std::shared_ptr> & concurrencyGroup){ - return rxcpp::from(concurrencyGroup) - .select([](const item& i){ - return i.time;}) - .to_vector();}, - [](const std::shared_ptr> & concurrencyGroup, - const std::vector & times){ - return std::make_tuple(concurrencyGroup->Key(), times);} - ) - .to_vector();}, - [](const std::shared_ptr> & argsGroup, - const std::vector>> & ouputGroup){ - return std::make_tuple(argsGroup->Key(), ouputGroup);} - ) - .observe_on(output) - .for_each(rxcpp::MakeTupleDispatch( - [](const std::string& args, const std::vector>>& concurrencyGroup){ - cout<<"arguments: "<< args << endl; - cout << "concurrency, mean, |, raw_data," << endl; - for(auto& concurrencyItem : concurrencyGroup) { - rxcpp::MakeTupleDispatch( - [](int concurrency, const std::vector& rawtimes){ - cout << concurrency << ", "; - - auto n = from(rawtimes).count(); - auto sum = std::accumulate(rawtimes.begin(), rawtimes.end(), 0.0); - - cout << (sum / n) << ", |"; - - for (auto timeIter = rawtimes.begin(), end = rawtimes.end(); - timeIter != end; - ++timeIter) - { - cout << ", " << *timeIter; - } - cout << endl;})(concurrencyItem);}}) - ); -} - -template -void innerScheduler() { - auto outer = std::make_shared(); - rxcpp::Scheduler::shared inner; - std::mutex lock; - std::condition_variable wake; - outer->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { - std::lock_guard guard(lock); - inner = s; wake.notify_one(); - return rxcpp::Disposable::Empty();}); - { - std::unique_lock guard(lock); - wake.wait(guard, [&]{return !!inner;}); - } - inner->Schedule([&](rxcpp::Scheduler::shared s) -> rxcpp::Disposable { - std::lock_guard guard(lock); - inner = nullptr; wake.notify_one(); - return rxcpp::Disposable::Empty();}); - { - std::unique_lock guard(lock); - wake.wait(guard, [&]{return !inner;}); - } - cout << "innerScheduler test succeeded" << endl; -} - -int main(int argc, char* argv[]) -{ - try { - RefCount(20); - PrintIntervals(10); - IxToRx(20); - PrintPrimes(20); - cout << "Zip Immediate" << endl; - Zip(20); - cout << "Zip Current" << endl; - Zip(20); - cout << "Zip EventLoop" << endl; - Zip(20); - Combine(20); - Merge(20); - Concat(20); - - innerScheduler(); - innerScheduler(); - innerScheduler(); - - Scan(); - - run(); - } catch (exception& e) { - cerr << "exception: " << e.what() << endl; - } -} - -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; -} - -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"); -} - -std::shared_ptr> Data( - string filename, - rxcpp::Scheduler::shared scheduler -) -{ - return rxcpp::CreateObservable( - [=](std::shared_ptr> observer) - -> rxcpp::Disposable - { - struct State - { - State(string filename) - : cancel(false), data(filename) { - if (data.fail()) { - throw logic_error("could not find file"); - } - } - bool cancel; - ifstream data; - }; - auto state = std::make_shared(std::move(filename)); - - rxcpp::ComposableDisposable cd; - - cd.Add(rxcpp::Disposable([=]{ - state->cancel = true; - })); - - cd.Add(scheduler->Schedule( - rxcpp::fix0([=](rxcpp::Scheduler::shared s, std::function self) -> rxcpp::Disposable - { - if (state->cancel) - return rxcpp::Disposable::Empty(); - - string line; - if (!!getline(state->data, line)) - { - observer->OnNext(std::move(line)); - return s->Schedule(std::move(self)); - } - else - { - observer->OnCompleted(); - } - return rxcpp::Disposable::Empty(); - }) - )); - - return cd; - } - ); -} - diff --git a/Rx/CPP/testbench/testbench.vcxproj b/Rx/CPP/testbench/testbench.vcxproj deleted file mode 100644 index 3f0ae00..0000000 --- a/Rx/CPP/testbench/testbench.vcxproj +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - $(VCTargetsPath11) - - - {6FC6DE04-1645-457E-9728-0E8E6FCDC9EB} - Win32Proj - testbench - - - - Application - true - v110 - Unicode - - - Application - false - v110 - true - Unicode - - - - - - - - - - - - - true - $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); - $(SolutionDir)\bin\$(Configuration)\ - obj\$(Configuration)\ - - - false - $(VCInstallDir)include;..\..\..\Ix\CPP\src;..\src;$(WindowsSDK_IncludePath); - $(SolutionDir)\bin\$(Configuration)\ - obj\$(Configuration)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/Rx/CPP/testbench/testbench.vcxproj.filters b/Rx/CPP/testbench/testbench.vcxproj.filters deleted file mode 100644 index 8afd620..0000000 --- a/Rx/CPP/testbench/testbench.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/Rx/v2/examples/pythagorian/main.cpp b/Rx/v2/examples/pythagorian/main.cpp new file mode 100644 index 0000000..d6aa6f0 --- /dev/null +++ b/Rx/v2/examples/pythagorian/main.cpp @@ -0,0 +1,50 @@ +#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; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; + +// 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(int argc, wchar_t** argv) +#else +int main(int argc, char** argv) +#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 triplet){return triplet;}) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple 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; + + return 0; +} diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index f3ada84..9c6d51d 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -60,7 +60,7 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe auto sc = rxsc::make_immediate(); //auto sc = rxsc::make_current_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::identity_one_worker(sc); int c = 0; int ct = 0; diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 87676b6..34ab78d 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -15,68 +15,48 @@ endif() # define some folders get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) -set(TEST_DIR ${RXCPP_DIR}/Rx/CPP/test) -set(V2_TEST_DIR ${RXCPP_DIR}/Rx/v2/test) +set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) +set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples) -include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/CPP/src ${RXCPP_DIR}/Rx/v2/src) +include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) # define the sources of the self test set(TEST_SOURCES ${TEST_DIR}/test.cpp - ${TEST_DIR}/operators/Merge.cpp - ${TEST_DIR}/operators/Return.cpp - ${TEST_DIR}/operators/Select.cpp - ${TEST_DIR}/operators/SelectMany.cpp - ${TEST_DIR}/operators/Where.cpp - ${TEST_DIR}/operators/Publish.cpp + ${TEST_DIR}/subscriptions/observer.cpp + ${TEST_DIR}/subscriptions/subscription.cpp + ${TEST_DIR}/subjects/subject.cpp + ${TEST_DIR}/sources/defer.cpp + ${TEST_DIR}/sources/interval.cpp + ${TEST_DIR}/operators/buffer.cpp + ${TEST_DIR}/operators/combine_latest.cpp + ${TEST_DIR}/operators/concat.cpp + ${TEST_DIR}/operators/merge.cpp + ${TEST_DIR}/operators/lift.cpp + ${TEST_DIR}/operators/filter.cpp + ${TEST_DIR}/operators/scan.cpp + ${TEST_DIR}/operators/take.cpp + ${TEST_DIR}/operators/publish.cpp + ${TEST_DIR}/operators/flat_map.cpp + ${TEST_DIR}/operators/concat_map.cpp + ${TEST_DIR}/operators/map.cpp ) -add_executable(rxcpp_test ${TEST_SOURCES}) +add_executable(rxcppv2_test ${TEST_SOURCES}) -# define the sources of testbench -set(TESTBENCH_SOURCES - ${RXCPP_DIR}/Rx/CPP/testbench/testbench.cpp +# define the sources of the pythagorian example +set(PYTHAGORIAN_SOURCES + ${EXAMPLES_DIR}/pythagorian/main.cpp ) -add_executable(testbench ${TESTBENCH_SOURCES}) - -# define the sources of the self test -set(V2_TEST_SOURCES - ${V2_TEST_DIR}/test.cpp - ${V2_TEST_DIR}/operators/buffer.cpp - ${V2_TEST_DIR}/sources/defer.cpp - ${V2_TEST_DIR}/operators/combine_latest.cpp - ${V2_TEST_DIR}/sources/interval.cpp - ${V2_TEST_DIR}/operators/concat.cpp - ${V2_TEST_DIR}/operators/merge.cpp - ${V2_TEST_DIR}/operators/lift.cpp - ${V2_TEST_DIR}/operators/filter.cpp - ${V2_TEST_DIR}/subscriptions/observer.cpp - ${V2_TEST_DIR}/operators/scan.cpp - ${V2_TEST_DIR}/operators/take.cpp - ${V2_TEST_DIR}/operators/publish.cpp - ${V2_TEST_DIR}/subjects/subject.cpp - ${V2_TEST_DIR}/subscriptions/subscription.cpp - ${V2_TEST_DIR}/operators/flat_map.cpp - ${V2_TEST_DIR}/operators/concat_map.cpp - ${V2_TEST_DIR}/operators/map.cpp -) -add_executable(rxcppv2_test ${V2_TEST_SOURCES}) +add_executable(pythagorian ${PYTHAGORIAN_SOURCES}) # configure unit tests via CTest enable_testing() -add_test(NAME RunTests COMMAND rxcpp_test) +add_test(NAME RunTests COMMAND rxcppv2_test) -add_test(NAME ListTests COMMAND rxcpp_test --list-tests) +add_test(NAME ListTests COMMAND rxcppv2_test --list-tests) set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") -add_test(NAME ListTags COMMAND rxcpp_test --list-tags) +add_test(NAME ListTags COMMAND rxcppv2_test --list-tags) set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") - -add_test(NAME RunTestsV2 COMMAND rxcppv2_test) - -add_test(NAME ListTestsV2 COMMAND rxcppv2_test --list-tests) -set_tests_properties(ListTestsV2 PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") - -add_test(NAME ListTagsV2 COMMAND rxcppv2_test --list-tags) -set_tests_properties(ListTagsV2 PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index 7c002d0..bb3b63e 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -21,8 +21,8 @@ nuget { #defines { SDK_RX = ..\..\; } - include: { "${SDK_RX}Rx\CPP\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; - docs: { ${SDK_RX}Readme.html, ${SDK_RX}AUTHORS.txt, ${SDK_RX}Rx\CPP\license.txt }; + include: { "${SDK_RX}Rx\v2\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; + docs: { ${SDK_RX}Readme.html, ${SDK_RX}AUTHORS.txt, ${SDK_RX}v2\license.txt }; } targets { -- GitLab From 07113b9f2b3ba10d15be42919a28b7eca862e397 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 14:02:50 -0700 Subject: [PATCH 324/782] fix some reported issues --- README.md | 16 ++++++++-------- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 2 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 4 ++-- Rx/v2/test/operators/concat.cpp | 2 +- Rx/v2/test/operators/concat_map.cpp | 2 +- Rx/v2/test/operators/merge.cpp | 2 +- Rx/v2/test/sources/interval.cpp | 2 +- Rx/v2/test/subscriptions/subscription.cpp | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9140c1d..c04513e 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/Rx #Building RxCpp -RxCpp is regularly tested on OSX and Windows. -RxCpp is regularly built with Clang and VC -RxCpp depends on the latest compiler releases. -RxCpp does not compile with gcc at this time. Contributions are welcome. +* RxCpp is regularly tested on OSX and Windows. +* RxCpp is regularly built with Clang and VC +* RxCpp depends on the latest compiler releases. +* RxCpp does not compile with gcc at this time. Contributions are welcome. RxCpp uses CMake to create build files for several platforms and IDE's @@ -34,7 +34,7 @@ This will create the default build for the platform. ###Visual Studio 13 ```cmake -G"Visual Studio 12" projects\CMake``` -Then open in VC2013 and upgrade to the 2013 toolset +* Note: open in VC2013 and upgrade to the 2013 toolset ##makefile builds @@ -54,9 +54,9 @@ The build only produces a test binary. #Running tests -You can use the CMake test runner ```ctest``` -You can run the test binary directly ```rxcppv2_test``` -Tests can be selected by name or tag +* You can use the CMake test runner ```ctest``` +* You can run the test binary directly ```rxcppv2_test``` +* Tests can be selected by name or tag Example of by-tag ```rxcppv2_test [perf]``` diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 35b8ed6..1cc72d2 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -79,7 +79,7 @@ static auto interval(rxsc::scheduler::clock_type::time_point initial, Duration p -> typename detail::delay_resolution::type { return observable>( rxs::detail::interval(initial, period, identity_one_worker(rxsc::make_current_thread()))); - static_assert(std::is_same::value, "duration must be rxsc::scheduler::clock_type::duration"); + static_assert(std::is_convertible::value, "duration must be convertible to rxsc::scheduler::clock_type::duration"); } template static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, Coordination cn) diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 7b72cf7..ef3d0b4 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -183,7 +183,7 @@ public: } -class syncronize_in_one_worker : public coordination_base +class synchronize_in_one_worker : public coordination_base { rxsc::scheduler factory; @@ -238,7 +238,7 @@ class syncronize_in_one_worker : public coordination_base public: - explicit syncronize_in_one_worker(rxsc::scheduler sc) : factory(sc) {} + explicit synchronize_in_one_worker(rxsc::scheduler sc) : factory(sc) {} typedef coordinator coordinator_type; diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index aadc1fb..7611430 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -27,7 +27,7 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::synchronize_in_one_worker(sc); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index ffe8e85..5bc1411 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -71,7 +71,7 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::synchronize_in_one_worker(sc); int c = 0; std::atomic ct(0); diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 21f722e..926a347 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -27,7 +27,7 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::synchronize_in_one_worker(sc); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index 7aa621f..63c6503 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -87,7 +87,7 @@ SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf]"){ int c = 0; auto sc = rxsc::make_current_thread(); - auto so = rx::syncronize_in_one_worker(sc); + auto so = rx::synchronize_in_one_worker(sc); auto start = sc.now() + seconds(2); auto period = seconds(1); rx::composite_subscription cs; diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 24bf747..18d66b5 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -92,7 +92,7 @@ SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][subscribe][ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf]"){ GIVEN("range"){ - WHEN("syncronized"){ + WHEN("synchronized"){ using namespace std::chrono; typedef steady_clock clock; @@ -100,7 +100,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto w = sc.create_worker(); auto el = rxsc::make_event_loop(); - auto es = rx::syncronize_in_one_worker(el); + auto es = rx::synchronize_in_one_worker(el); int runs = 10; @@ -184,7 +184,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf s2.unsubscribe(); auto finish = clock::now(); auto msElapsed = duration_cast(finish-start); - std::cout << "range syncronize : " << n << " subscribed, " << v << " on_next calls, " << msElapsed.count() << "ms elapsed, " << v / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl; + std::cout << "range synchronize : " << n << " subscribed, " << v << " on_next calls, " << msElapsed.count() << "ms elapsed, " << v / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl; if (--runs > 0) { self(); -- GitLab From c044f49400561ec2c18006b9dcb5d1ee031af8bc Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 14:03:30 -0700 Subject: [PATCH 325/782] introducing initializer_list --- Rx/v2/src/rxcpp/rx-includes.hpp | 1 + Rx/v2/src/rxcpp/rx-util.hpp | 10 ++-- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 69 ++++++++++++++++++++++---- Rx/v2/test/operators/take.cpp | 45 +++++++---------- 4 files changed, 86 insertions(+), 39 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 6f9d903..28ed62c 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -96,6 +96,7 @@ #include #include #include +#include #include #include "rx-util.hpp" diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 31ec1e3..dd307b2 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -37,10 +37,14 @@ std::vector to_vector(const T (&arr) [size]) { return std::vector(std::begin(arr), std::end(arr)); } +template +std::vector to_vector(std::initializer_list il) { + return std::vector(il); +} + template -typename std::enable_if::value, std::vector>::type to_vector(T0 t0, TN... tn) { - T0 arr[] = {t0, tn...}; - return to_vector(arr); +typename std::enable_if::value && std::is_pod::value, std::vector>::type to_vector(T0 t0, TN... tn) { + return to_vector({t0, tn...}); } template diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 9f01ab7..336cf1b 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -338,6 +338,18 @@ rxt::testable_observable test_type::make_hot_observable(std::vector>(state, create_worker(composite_subscription()), std::move(messages))); } +template +struct is_create_source_function +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CF*)nullptr)()); + template + static not_void check(...); + + static const bool value = is_observable::type>(0))>::value; +}; + } class test : public scheduler @@ -362,6 +374,9 @@ public: { typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; + typedef rxn::subscription subscription_type; + + messages() {} struct on_next_factory { @@ -394,9 +409,6 @@ public: } }; static const subscribe_factory subscribe; - - private: - ~messages(); }; class test_worker : public worker @@ -440,15 +452,13 @@ public: } template - auto start(F&& createSource, long created, long subscribed, long unsubscribed) const + auto start(F createSource, long created, long subscribed, long unsubscribed) const -> subscriber> { - typename std::decay::type createSrc = std::forward(createSource); - struct state_type : public std::enable_shared_from_this { - typedef decltype(std::forward(createSrc)()) source_type; + typedef decltype(createSource()) source_type; std::unique_ptr source; subscriber> o; @@ -461,8 +471,8 @@ public: }; std::shared_ptr state(new state_type(this->make_subscriber())); - schedule_absolute(created, [createSrc, state](const schedulable& scbl) { - state->source.reset(new typename state_type::source_type(createSrc())); + schedule_absolute(created, [createSource, state](const schedulable& scbl) { + state->source.reset(new typename state_type::source_type(createSource())); }); schedule_absolute(subscribed, [state](const schedulable& scbl) { state->source->subscribe(state->o); @@ -490,6 +500,35 @@ public: return start(std::forward(createSource), created_time, subscribed_time, unsubscribed_time); } + template + struct start_traits + { + typedef decltype((*(F*)nullptr)()) source_type; + typedef typename source_type::value_type value_type; + typedef subscriber> subscriber_type; + }; + + template + auto start(F createSource, long created, long subscribed, long unsubscribed) const + -> typename std::enable_if::value, start_traits>::type::subscriber_type + { + return start::value_type>(std::move(createSource), created, subscribed, unsubscribed); + } + + template + auto start(F createSource, long unsubscribed) const + -> typename std::enable_if::value, start_traits>::type::subscriber_type + { + return start::value_type>(std::move(createSource), created_time, subscribed_time, unsubscribed); + } + + template + auto start(F createSource) const + -> typename std::enable_if::value, start_traits>::type::subscriber_type + { + return start::value_type>(std::move(createSource), created_time, subscribed_time, unsubscribed_time); + } + void start() const { tester->start(); } @@ -522,6 +561,12 @@ public: return tester->make_hot_observable(rxu::to_vector(arr)); } + template + auto make_hot_observable(std::initializer_list il) const + -> decltype(tester->make_hot_observable(std::vector())) { + return tester->make_hot_observable(std::vector(il)); + } + template rxt::testable_observable make_cold_observable(std::vector>>> messages) const { return tester->make_cold_observable(std::move(messages)); @@ -532,6 +577,12 @@ public: -> decltype(tester->make_cold_observable(std::vector())) { return tester->make_cold_observable(rxu::to_vector(arr)); } + + template + auto make_cold_observable(std::initializer_list il) const + -> decltype(tester->make_cold_observable(std::vector())) { + return tester->make_cold_observable(std::vector(il)); + } }; template diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index e44bd5b..26582f1 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -16,27 +16,20 @@ SCENARIO("take 2", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; - record xmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto xs = sc.make_hot_observable(xmessages); + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); WHEN("2 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(2) @@ -46,21 +39,19 @@ SCENARIO("take 2", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_completed(220) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_completed(220) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 220) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 220) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } -- GitLab From c81d5f5053057ba971a36a3afe7f0f1e6aea1fcc Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 14:26:06 -0700 Subject: [PATCH 326/782] make travis build on osx --- .travis.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65065ce..8e04084 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ compiler: - clang env: - - BUILD_TYPE=Debug + - BUILD_TYPE=RelWithDebInfo - BUILD_TYPE=Release install: @@ -16,3 +16,16 @@ install: script: - cd Build - ctest -V + +branches: + only: + - master +notifications: + recipients: + - kirk.shoop@microsoft.com + email: + on_success: change + on_failure: always + +os: + - osx -- GitLab From c5205c6931527ed105ce9b7679c05de0816afd4c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 14:34:32 -0700 Subject: [PATCH 327/782] force libc++ for clang --- projects/CMake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 34ab78d..304c901 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -5,7 +5,7 @@ project(rxcpp) MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list( APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS}") + list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list( APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") -- GitLab From ee21e59cd2edadaf3510212d0219f571f49853e1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 14:54:57 -0700 Subject: [PATCH 328/782] ask travis to build and install libc++ --- .travis.yml | 7 +++++++ projects/CMake/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8e04084..cf189e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,13 @@ env: - BUILD_TYPE=Release install: + - if [ "$CXX" == "clang++" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk libcxx; fi + - if [ "$CXX" == "clang++" ]; then cd libcxx/lib && bash buildit; fi + - if [ "$CXX" == "clang++" ]; then sudo cp ./libc++.so.1.0 /usr/lib/; fi + - if [ "$CXX" == "clang++" ]; then sudo mkdir /usr/include/c++/v1; fi + - if [ "$CXX" == "clang++" ]; then cd .. && sudo cp -r include/* /usr/include/c++/v1/; fi + - if [ "$CXX" == "clang++" ]; then cd /usr/lib && sudo ln -sf libc++.so.1.0 libc++.so; fi + - if [ "$CXX" == "clang++" ]; then sudo ln -sf libc++.so.1.0 libc++.so.1 && cd $cwd; fi - cmake -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE - cd Build - make diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 304c901..61e9514 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -7,7 +7,7 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - list( APPEND CMAKE_CXX_FLAGS " -std=c++0x ${CMAKE_CXX_FLAGS}") + list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") list( APPEND CMAKE_CXX_FLAGS " /DUNICODE /D_UNICODE /bigobj ${CMAKE_CXX_FLAGS}") endif() -- GitLab From 3fe727d5d942646c37897247aa9ba1b442e1531d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 15:47:35 -0700 Subject: [PATCH 329/782] try Xcode build --- .travis.yml | 14 +++++--------- projects/CMake/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf189e8..7af6eb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,21 +8,17 @@ env: - BUILD_TYPE=Release install: - - if [ "$CXX" == "clang++" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk libcxx; fi - - if [ "$CXX" == "clang++" ]; then cd libcxx/lib && bash buildit; fi - - if [ "$CXX" == "clang++" ]; then sudo cp ./libc++.so.1.0 /usr/lib/; fi - - if [ "$CXX" == "clang++" ]; then sudo mkdir /usr/include/c++/v1; fi - - if [ "$CXX" == "clang++" ]; then cd .. && sudo cp -r include/* /usr/include/c++/v1/; fi - - if [ "$CXX" == "clang++" ]; then cd /usr/lib && sudo ln -sf libc++.so.1.0 libc++.so; fi - - if [ "$CXX" == "clang++" ]; then sudo ln -sf libc++.so.1.0 libc++.so.1 && cd $cwd; fi - - cmake -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - brew update + - brew install cmake + - cmake -GXcode -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE - cd Build - - make + - xcodebuild - cd .. script: - cd Build - ctest -V + - cd .. branches: only: diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 61e9514..7135acc 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -5,7 +5,7 @@ project(rxcpp) MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") + list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") -- GitLab From 82d0388aee7556b80fd1e23fac74f13d2deac593 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 18:01:18 -0700 Subject: [PATCH 330/782] try to install Xcode command line tools --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7af6eb0..97650f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,12 @@ env: install: - brew update - brew install cmake - - cmake -GXcode -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE - - cd Build - - xcodebuild - - cd .. + - xcode-select --install + - cd projects + - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - cd build + - make -j4 + - cd ../.. script: - cd Build -- GitLab From 4e7c1ea6c094395fc766d8b24a10bdc988a28447 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 18:06:09 -0700 Subject: [PATCH 331/782] brew update failed? --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97650f6..d9daf0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,12 @@ env: - BUILD_TYPE=RelWithDebInfo - BUILD_TYPE=Release -install: +before_install: + - xcode-select --install - brew update - brew install cmake - - xcode-select --install + +install: - cd projects - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE - cd build -- GitLab From 6920e384293913ac74b00142579fc3bc4e51c007 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 23:18:08 -0700 Subject: [PATCH 332/782] try clang on linux --- .travis.yml | 15 ++++++++------- projects/CMake/CMakeLists.txt | 5 +++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9daf0a..51435aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ + language: cpp +os: + - linux + - osx + compiler: - clang @@ -8,9 +13,7 @@ env: - BUILD_TYPE=Release before_install: - - xcode-select --install - - brew update - - brew install cmake + - sh projects/scripts/travis-install.sh install: - cd projects @@ -20,19 +23,17 @@ install: - cd ../.. script: - - cd Build + - cd projects/build - ctest -V - cd .. branches: only: - master + notifications: recipients: - kirk.shoop@microsoft.com email: on_success: change on_failure: always - -os: - - osx diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 7135acc..211c517 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -4,6 +4,8 @@ project(rxcpp) MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) +FIND_PACKAGE(Threads) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") @@ -12,6 +14,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") list( APPEND CMAKE_CXX_FLAGS " /DUNICODE /D_UNICODE /bigobj ${CMAKE_CXX_FLAGS}") endif() + # define some folders get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) @@ -43,12 +46,14 @@ set(TEST_SOURCES ${TEST_DIR}/operators/map.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) +TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) # define the sources of the pythagorian example set(PYTHAGORIAN_SOURCES ${EXAMPLES_DIR}/pythagorian/main.cpp ) add_executable(pythagorian ${PYTHAGORIAN_SOURCES}) +TARGET_LINK_LIBRARIES(pythagorian ${CMAKE_THREAD_LIBS_INIT}) # configure unit tests via CTest enable_testing() -- GitLab From 9ee3732d132a35d8afc1e0951ab70651f754d789 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 23:20:22 -0700 Subject: [PATCH 333/782] add missing script --- projects/scripts/travis-install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/scripts/travis-install.sh diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh new file mode 100644 index 0000000..ef5bb42 --- /dev/null +++ b/projects/scripts/travis-install.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +#if OS is linux or is not set +if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then + sudo apt-get update + sudo apt-get install -qq libc++ + sudo apt-get install cmake clang-3.5 libstdc++6 + sudo apt-get autoremove +elif [ "$TRAVIS_OS_NAME" = osx ]; then + xcode-select --install + brew update + brew install cmake +fi -- GitLab From ab4acc45d348a771956b6f11775ae1428f5c9014 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 23:27:59 -0700 Subject: [PATCH 334/782] add apt-get clean --- projects/scripts/travis-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index ef5bb42..65a8baa 100644 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -4,6 +4,7 @@ set -e #if OS is linux or is not set if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then + sudo apt-get clean sudo apt-get update sudo apt-get install -qq libc++ sudo apt-get install cmake clang-3.5 libstdc++6 -- GitLab From 90216c457e0bacb6a4b6910e4f9e68f7249dee3e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 23:33:09 -0700 Subject: [PATCH 335/782] trying a solution from the web --- projects/scripts/travis-install.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 65a8baa..cb84aa4 100644 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -4,11 +4,15 @@ set -e #if OS is linux or is not set if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then + wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - + sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' + sudo add-apt-repository -y ppa:28msec/utils # Recent cmake + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang-3.5 sudo apt-get clean sudo apt-get update - sudo apt-get install -qq libc++ - sudo apt-get install cmake clang-3.5 libstdc++6 - sudo apt-get autoremove + sudo apt-get install -q --fix-missing clang-3.5 cmake libssl-dev +#libstdc++6 + elif [ "$TRAVIS_OS_NAME" = osx ]; then xcode-select --install brew update -- GitLab From 20ec8c1cbf81acc8b3b5b949673d7ac9c8a27f05 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 13 Jun 2014 23:40:42 -0700 Subject: [PATCH 336/782] updated build steps --- README.md | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c04513e..9ab9eb2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Reactive Extensions: +[![Build Status](https://travis-ci.org/Reactive-Extensions/RxCpp.png)](https://travis-ci.org/Reactive-Extensions/RxCpp) -Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/RxCpp.png)](https://travis-ci.org/Reactive-Extensions/RxCpp) +# Reactive Extensions: * Rx.NET: The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. * RxJS: The Reactive Extensions for JavaScript (RxJS) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in JavaScript which can target both the browser and Node.js. @@ -24,29 +24,37 @@ Rxcpp Build status [![Build Status](https://travis-ci.org/Reactive-Extensions/Rx RxCpp uses CMake to create build files for several platforms and IDE's -```cmake projects\CMake``` - -This will create the default build for the platform. - -##Ide builds -###XCode -```cmake -G"Xcode" projects\CMake``` +###Ide builds +####XCode +``` +mkdir projects/build +cd projects/build +cmake -G"Xcode" ../CMake -B. +``` -###Visual Studio 13 -```cmake -G"Visual Studio 12" projects\CMake``` +####Visual Studio 13 +``` +mkdir projects\build +cd projects\build +cmake -G"Visual Studio 12" ..\CMake -B. +``` * Note: open in VC2013 and upgrade to the 2013 toolset -##makefile builds +###makefile builds -##OSX +####OSX ``` -cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo projects\CMake +mkdir projects/build +cd projects/build +cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake make ``` -##Windows +####Windows ``` -cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo projects\CMake +mkdir projects\build +cd projects\build +cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ..\CMake nmake ``` -- GitLab From 71b97f68fa64006f91ea4133a9fadb76b1daf14a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 15 Jun 2014 09:31:08 -0700 Subject: [PATCH 337/782] add distinct_until_changed --- .../operators/rx-distinct_until_changed.hpp | 82 +++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 8 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + .../test/operators/distinct_until_changed.cpp | 64 +++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 5 files changed, 156 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp create mode 100644 Rx/v2/test/operators/distinct_until_changed.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp new file mode 100644 index 0000000..52954f5 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp @@ -0,0 +1,82 @@ +// 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_DISTINCT_UNTIL_CHANGED_HPP) +#define RXCPP_OPERATORS_RX_DISTINCT_UNTIL_CHANGED_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct distinct_until_changed +{ + typedef typename std::decay::type source_value_type; + + template + struct distinct_until_changed_observer : public observer_base + { + typedef distinct_until_changed_observer this_type; + typedef observer_base base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + mutable rxu::detail::maybe remembered; + + distinct_until_changed_observer(dest_type d) + : dest(d) + { + } + void on_next(source_value_type v) const { + if (remembered.empty() || v != remembered.get()) { + remembered.reset(v); + dest.on_next(v); + } + } + void on_error(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static subscriber make(dest_type d) { + return make_subscriber(d, this_type(d)); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(distinct_until_changed_observer::make(std::move(dest))) { + return distinct_until_changed_observer::make(std::move(dest)); + } +}; + +class distinct_until_changed_factory +{ +public: + template + auto operator()(Observable&& source) + -> decltype(source.lift(distinct_until_changed::type>::value_type)) { + return source.lift(distinct_until_changed::type>::value_type); + } +}; + +} + +inline auto distinct_until_changed() + -> detail::distinct_until_changed_factory { + return detail::distinct_until_changed_factory(); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index f14c0ac..caeb876 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -325,6 +325,14 @@ public: return lift(rxo::detail::map(std::move(s))); } + /// distinct_until_changed -> + /// for each item from this observable, filter out repeated values and emit only changes from the new observable that is returned. + /// + auto distinct_until_changed() const + -> decltype(lift(rxo::detail::distinct_until_changed())) { + return lift(rxo::detail::distinct_until_changed()); + } + /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 4928940..b535e17 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -38,6 +38,7 @@ namespace rxo=operators; #include "operators/rx-buffer_count.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-filter.hpp" +#include "operators/rx-distinct_until_changed.hpp" #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" #include "operators/rx-flat_map.hpp" diff --git a/Rx/v2/test/operators/distinct_until_changed.cpp b/Rx/v2/test/operators/distinct_until_changed.cpp new file mode 100644 index 0000000..2639574 --- /dev/null +++ b/Rx/v2/test/operators/distinct_until_changed.cpp @@ -0,0 +1,64 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.hpp" + +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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), //* + on.on_next(215, 3), //* + on.on_next(220, 3), + on.on_next(225, 2), //* + on.on_next(230, 2), + on.on_next(230, 1), //* + on.on_next(240, 2), //* + on.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.on_next(210, 2), //* + on.on_next(215, 3), //* + on.on_next(225, 2), //* + on.on_next(230, 1), //* + on.on_next(240, 2), //* + on.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/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 211c517..652df5e 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -38,6 +38,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/merge.cpp ${TEST_DIR}/operators/lift.cpp ${TEST_DIR}/operators/filter.cpp + ${TEST_DIR}/operators/distinct_until_changed.cpp ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/publish.cpp -- GitLab From 91150a059f5250238ec264a888f7f9782ff4cf01 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 15 Jun 2014 23:07:40 -0700 Subject: [PATCH 338/782] coordinator refinements --- .../src/rxcpp/operators/rx-combine_latest.hpp | 19 +- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 28 +-- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 29 ++-- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 33 ++-- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 28 +-- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 17 +- Rx/v2/src/rxcpp/rx-coordination.hpp | 162 +++++++++++++++--- Rx/v2/src/rxcpp/sources/rx-error.hpp | 9 +- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 13 +- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 10 +- Rx/v2/src/rxcpp/sources/rx-range.hpp | 12 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 36 ++-- Rx/v2/test/operators/concat.cpp | 41 +++++ Rx/v2/test/operators/concat_map.cpp | 65 ++++++- Rx/v2/test/operators/flat_map.cpp | 69 +++++++- Rx/v2/test/operators/merge.cpp | 42 +++++ Rx/v2/test/subscriptions/subscription.cpp | 2 +- projects/CMake/CMakeLists.txt | 9 +- 18 files changed, 473 insertions(+), 151 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index f990dc7..61d0d47 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -89,7 +89,7 @@ struct combine_latest : public operator_basesubscribe( + auto sink = make_subscriber( state->out, innercs, // on_next @@ -126,6 +126,13 @@ struct combine_latest : public operator_basecoordinator.out(sink);}, + state->out); + if (selectedSink.empty()) { + return; + } + source->subscribe(std::move(selectedSink.get())); } template void subscribe_all(std::shared_ptr state, rxu::values) const { @@ -136,7 +143,7 @@ struct combine_latest : public operator_base::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; struct combine_latest_state_type : public std::enable_shared_from_this @@ -161,15 +168,9 @@ struct combine_latest : public operator_base(new combine_latest_state_type(initial, std::move(coordinator), std::forward(selectedDest.get()))); + auto state = std::shared_ptr(new combine_latest_state_type(initial, std::move(coordinator), std::move(scbr))); subscribe_all(state, typename rxu::values_from::type()); } diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 57f7143..68179be 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -48,7 +48,7 @@ struct concat void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; struct concat_state_type : public std::enable_shared_from_this @@ -86,7 +86,7 @@ struct concat // this subscribe does not share the out subscription // so that when it is unsubscribed the out will continue - selectedSource->subscribe( + auto sinkInner = make_subscriber( state->out, collectionLifetime, // on_next @@ -109,6 +109,13 @@ struct concat } } ); + 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; @@ -118,15 +125,9 @@ struct concat }; auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); - auto selectedDest = on_exception( - [&](){return coordinator.out(scbr);}, - scbr); - if (selectedDest.empty()) { - return; - } // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); + auto state = std::shared_ptr(new concat_state_type(initial, std::move(coordinator), std::move(scbr))); state->sourceLifetime = composite_subscription(); @@ -144,7 +145,7 @@ struct concat // 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 - source->subscribe( + auto sink = make_subscriber( state->out, state->sourceLifetime, // on_next @@ -166,6 +167,13 @@ struct concat } } ); + auto selectedSink = on_exception( + [&](){return state->coordinator.out(sink);}, + state->out); + if (selectedSink.empty()) { + return; + } + source->subscribe(std::move(selectedSink.get())); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 922d5a2..a1f9061 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -91,7 +91,7 @@ struct concat_map void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; struct concat_map_state_type : public std::enable_shared_from_this @@ -136,7 +136,7 @@ struct concat_map // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue - selectedSource->subscribe( + auto sinkInner = make_subscriber( state->out, collectionLifetime, // on_next @@ -165,6 +165,13 @@ struct concat_map } } ); + 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; @@ -174,15 +181,9 @@ struct concat_map }; auto coordinator = initial.coordination.create_coordinator(); - auto selectedDest = on_exception( - [&](){return coordinator.out(scbr);}, - scbr); - if (selectedDest.empty()) { - return; - } // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_map_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); + auto state = std::shared_ptr(new concat_map_state_type(initial, std::move(coordinator), std::move(scbr))); state->sourceLifetime = composite_subscription(); @@ -200,7 +201,7 @@ struct concat_map // 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 - source->subscribe( + auto sink = make_subscriber( state->out, state->sourceLifetime, // on_next @@ -222,6 +223,14 @@ struct concat_map } } ); + auto selectedSink = on_exception( + [&](){return state->coordinator.out(sink);}, + state->out); + if (selectedSink.empty()) { + return; + } + source->subscribe(std::move(selectedSink.get())); + } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index d09caf9..1906724 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -91,7 +91,7 @@ struct flat_map void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; struct state_type : public std::enable_shared_from_this @@ -112,15 +112,9 @@ struct flat_map }; auto coordinator = initial.coordination.create_coordinator(); - auto selectedDest = on_exception( - [&](){return coordinator.out(scbr);}, - scbr); - if (selectedDest.empty()) { - return; - } // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); + auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(scbr))); composite_subscription outercs; @@ -139,7 +133,7 @@ struct flat_map // 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 - source->subscribe( + auto sink = make_subscriber( state->out, outercs, // on_next @@ -171,7 +165,7 @@ struct flat_map ++state->pendingCompletions; // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue - selectedSource->subscribe( + auto sinkInner = make_subscriber( state->out, innercs, // on_next @@ -195,6 +189,15 @@ struct flat_map } } ); + + auto selectedSinkInner = on_exception( + [&](){return state->coordinator.out(sinkInner);}, + state->out); + if (selectedSinkInner.empty()) { + return; + } + + selectedSource->subscribe(std::move(selectedSinkInner.get())); }, // on_error [state](std::exception_ptr e) { @@ -207,6 +210,16 @@ struct flat_map } } ); + + auto selectedSink = on_exception( + [&](){return state->coordinator.out(sink);}, + state->out); + if (selectedSink.empty()) { + return; + } + + source->subscribe(std::move(selectedSink.get())); + } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index e2b5d14..5eddc15 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -45,7 +45,7 @@ struct merge : public operator_base::type::value void on_subscribe(Subscriber scbr) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; struct merge_state_type : public std::enable_shared_from_this @@ -66,15 +66,9 @@ struct merge : public operator_base::type::value }; auto coordinator = initial.coordination.create_coordinator(); - auto selectedDest = on_exception( - [&](){return coordinator.out(scbr);}, - scbr); - if (selectedDest.empty()) { - return; - } // take a copy of the values for each subscription - auto state = std::shared_ptr(new merge_state_type(initial, std::move(coordinator), std::forward(selectedDest.get()))); + auto state = std::shared_ptr(new merge_state_type(initial, std::move(coordinator), std::move(scbr))); composite_subscription outercs; @@ -93,7 +87,7 @@ struct merge : public operator_base::type::value // 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 - source->subscribe( + auto sink = make_subscriber( state->out, outercs, // on_next @@ -119,7 +113,7 @@ struct merge : public operator_base::type::value ++state->pendingCompletions; // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue - selectedSource->subscribe( + auto sinkInner = make_subscriber( state->out, innercs, // on_next @@ -137,6 +131,13 @@ struct merge : public operator_base::type::value } } ); + auto selectedSinkInner = on_exception( + [&](){return state->coordinator.out(sinkInner);}, + state->out); + if (selectedSinkInner.empty()) { + return; + } + selectedSource->subscribe(std::move(selectedSinkInner.get())); }, // on_error [state](std::exception_ptr e) { @@ -149,6 +150,13 @@ struct merge : public operator_base::type::value } } ); + auto selectedSink = on_exception( + [&](){return state->coordinator.out(sink);}, + state->out); + if (selectedSink.empty()) { + return; + } + source->subscribe(std::move(selectedSink.get())); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index c5f2576..00dc952 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -75,15 +75,9 @@ struct take_until : public operator_base }; auto coordinator = initial.coordination.create_coordinator(); - auto selectedDest = on_exception( - [&](){return coordinator.out(s);}, - s); - if (selectedDest.empty()) { - return; - } // take a copy of the values for each subscription - auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(selectedDest.get()))); + auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(s))); auto trigger = on_exception( [&](){return state->coordinator.in(state->trigger);}, @@ -99,7 +93,7 @@ struct take_until : public operator_base return; } - trigger.get().subscribe( + auto sinkTrigger = make_subscriber( // share parts of subscription state->out, // new lifetime @@ -122,6 +116,13 @@ struct take_until : public operator_base 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())); source.get().subscribe( // split subscription lifetime diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index 880fc5c..39cd134 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -35,60 +35,74 @@ public: static const bool value = std::is_convertible::type>(0)), tag_coordination*>::value; }; -template +template class coordinator : public coordinator_base { - struct not_supported {typedef not_supported type;}; public: typedef Input input_type; - typedef Output output_type; - input_type input; - output_type output; +private: + struct not_supported {typedef not_supported type;}; template struct get_observable { - typedef decltype((*(input_type*)nullptr)((*(Observable*)nullptr))) type; + typedef decltype((*(input_type*)nullptr).in((*(Observable*)nullptr))) type; }; template struct get_subscriber { - typedef decltype((*(output_type*)nullptr)((*(Subscriber*)nullptr))) type; + typedef decltype((*(input_type*)nullptr).out((*(Subscriber*)nullptr))) type; }; + template + struct get_action_function + { + typedef decltype((*(input_type*)nullptr).act((*(F*)nullptr))) type; + }; + +public: + input_type input; + template struct get { typedef typename std::conditional< + rxsc::detail::is_action_function::value, get_action_function, typename std::conditional< is_observable::value, get_observable, typename std::conditional< - is_subscriber::value, get_subscriber, not_supported>::type>::type::type type; + is_subscriber::value, get_subscriber, not_supported>::type>::type>::type::type type; }; - coordinator(Input i, Output o) : input(i), output(o) {} + coordinator(Input i) : input(i) {} - const Input& get_input() const { - return input; + rxsc::worker get_worker() const { + return input.get_worker(); } - - const Output& get_output() const { - return output; + rxsc::scheduler get_scheduler() const { + return input.get_scheduler(); } template auto in(Observable o) const -> typename get_observable::type { - return input(std::move(o)); + return input.in(std::move(o)); static_assert(is_observable::value, "can only synchronize observables"); } template auto out(Subscriber s) const -> typename get_subscriber::type { - return output(std::move(s)); + return input.out(std::move(s)); static_assert(is_subscriber::value, "can only synchronize subscribers"); } + + template + auto act(F f) const + -> typename get_action_function::type { + return input.act(std::move(f)); + static_assert(rxsc::detail::is_action_function::value, "can only synchronize action functions"); + } }; class identity_one_worker : public coordination_base @@ -112,20 +126,105 @@ class identity_one_worker : public coordination_base return factory; } template - Observable operator()(Observable o) const { + auto in(Observable o) const + -> Observable { return std::move(o); - static_assert(is_observable::value, "can only synchronize observables"); + } + template + auto out(Subscriber s) const + -> Subscriber { + return std::move(s); + } + template + auto act(F f) const + -> F { + return std::move(f); + } + }; + +public: + + explicit identity_one_worker(rxsc::scheduler sc) : factory(sc) {} + + typedef coordinator coordinator_type; + + 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))); + } +}; + +class serialize_one_worker : public coordination_base +{ + rxsc::scheduler factory; + + template + struct serialize_action + { + F dest; + std::shared_ptr lock; + serialize_action(F d, std::shared_ptr m) + : dest(std::move(d)) + , lock(std::move(m)) + { + if (!lock) { + abort(); + } + } + auto operator()(const rxsc::schedulable& scbl) const + -> decltype(dest(scbl)) { + std::unique_lock guard(*lock); + return dest(scbl); } }; - class output_type + template + struct serialize_observer : public observer_base + { + typedef serialize_observer this_type; + typedef observer_base base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + std::shared_ptr lock; + + serialize_observer(dest_type d, std::shared_ptr m) + : dest(std::move(d)) + , lock(std::move(m)) + { + if (!lock) { + abort(); + } + } + void on_next(value_type v) const { + std::unique_lock guard(*lock); + dest.on_next(v); + } + void on_error(std::exception_ptr e) const { + std::unique_lock guard(*lock); + dest.on_error(e); + } + void on_completed() const { + std::unique_lock guard(*lock); + dest.on_completed(); + } + + static subscriber make(dest_type d, std::shared_ptr m) { + return make_subscriber(d, this_type(d, std::move(m))); + } + }; + + class input_type { rxsc::worker controller; rxsc::scheduler factory; + std::shared_ptr lock; public: - explicit output_type(rxsc::worker w) + explicit input_type(rxsc::worker w, std::shared_ptr m) : controller(w) , factory(rxsc::make_same_worker(w)) + , lock(std::move(m)) { } rxsc::worker get_worker() const { @@ -134,22 +233,33 @@ class identity_one_worker : public coordination_base rxsc::scheduler get_scheduler() const { return factory; } + template + auto in(Observable o) const + -> Observable { + return std::move(o); + } template - Subscriber operator()(Subscriber s) const { - return std::move(s); - static_assert(is_subscriber::value, "can only synchronize subscribers"); + auto out(Subscriber s) const + -> serialize_observer { + return serialize_observer(std::move(s), lock); + } + template + auto act(F f) const + -> serialize_action { + return serialize_action(std::move(f), lock); } }; public: - explicit identity_one_worker(rxsc::scheduler sc) : factory(sc) {} + explicit serialize_one_worker(rxsc::scheduler sc) : factory(sc) {} - typedef coordinator coordinator_type; + typedef coordinator coordinator_type; coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { auto w = factory.create_worker(std::move(cs)); - return coordinator_type(input_type(w), output_type(w)); + std::shared_ptr lock = std::make_shared(); + return coordinator_type(input_type(std::move(w), std::move(lock))); } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index 0c2f67c..439f01a 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -47,16 +47,9 @@ struct error : public source_base auto controller = coordinator.get_output().get_worker(); auto exception = initial.exception; - auto selectedDest = on_exception( - [&](){return coordinator.out(o);}, - o); - if (selectedDest.empty()) { - return; - } - controller.schedule( [=](const rxsc::schedulable&){ - auto& dest = selectedDest.get(); + auto& dest = o; if (!dest.is_subscribed()) { // terminate loop return; diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 1cc72d2..7916359 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -48,21 +48,16 @@ struct interval : public source_base // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); - auto selectedDest = on_exception( - [&](){return coordinator.out(o);}, - o); - if (selectedDest.empty()) { - return; - } + auto controller = coordinator.get_worker(); auto counter = std::make_shared(0); - coordinator.get_output().get_worker().schedule_periodically( + controller.schedule_periodically( initial.initial, initial.period, - [selectedDest, counter](const rxsc::schedulable&) { + [o, counter](const rxsc::schedulable&) { // send next value - selectedDest.get().on_next(++(*counter)); + o.on_next(++(*counter)); }); } }; diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index d3c97b5..a013488 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -93,16 +93,10 @@ struct iterate : public source_base::value_t // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); - auto selectedDest = on_exception( - [&](){return coordinator.out(o);}, - o); - if (selectedDest.empty()) { - return; - } - iterate_state_type state(initial, std::move(selectedDest.get())); + iterate_state_type state(initial, std::move(o)); - auto controller = coordinator.get_output().get_worker(); + auto controller = coordinator.get_worker(); controller.schedule( [state](const rxsc::schedulable& self){ diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index cf82950..f304d6f 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -42,24 +42,18 @@ struct range : public source_base void on_subscribe(Subscriber o) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; + typedef Subscriber output_type; // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); - auto selectedDest = on_exception( - [&](){return coordinator.out(o);}, - o); - if (selectedDest.empty()) { - return; - } - auto controller = coordinator.get_output().get_worker(); + auto controller = coordinator.get_worker(); auto state = initial; controller.schedule( [=](const rxsc::schedulable& self){ - auto& dest = selectedDest.get(); + auto& dest = o; if (!dest.is_subscribed()) { // terminate loop return; diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index ef3d0b4..fce04ac 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -55,7 +55,7 @@ class synchronize_observer : public detail::multicast_observer if (current == mode::Empty) { current = mode::Processing; auto keepAlive = this->shared_from_this(); - auto processor = coordinator.get_output().get_worker(); + auto processor = coordinator.get_worker(); processor.schedule(lifetime, [keepAlive, this](const rxsc::schedulable& self){ try { std::unique_lock guard(lock); @@ -206,33 +206,19 @@ class synchronize_in_one_worker : public coordination_base return factory; } template - auto operator()(Observable o) const + auto in(Observable o) const -> decltype(o.synchronize(coordination).ref_count()) { return o.synchronize(coordination).ref_count(); - static_assert(is_observable::value, "can only synchronize observables"); - } - }; - - class output_type - { - rxsc::worker controller; - rxsc::scheduler factory; - public: - explicit output_type(rxsc::worker w) - : controller(w) - , factory(rxsc::make_same_worker(w)) - { - } - rxsc::worker get_worker() const { - return controller; - } - rxsc::scheduler get_scheduler() const { - return factory; } template - Subscriber operator()(Subscriber s) const { + auto out(Subscriber s) const + -> Subscriber { return std::move(s); - static_assert(is_subscriber::value, "can only synchronize subscribers"); + } + template + auto act(F f) const + -> F { + return std::move(f); } }; @@ -240,11 +226,11 @@ public: explicit synchronize_in_one_worker(rxsc::scheduler sc) : factory(sc) {} - typedef coordinator coordinator_type; + typedef coordinator coordinator_type; coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { auto w = factory.create_worker(std::move(cs)); - return coordinator_type(input_type(w), output_type(w)); + return coordinator_type(input_type(std::move(w))); } }; diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 7611430..244d681 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -56,6 +56,47 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" } } +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; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rx::serialize_one_worker(sc); + + std::atomic c(0); + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + 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)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return c == onnextcalls;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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."){ diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 5bc1411..f04e0cc 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -53,7 +53,7 @@ SCENARIO("concat_map pythagorian ranges", "[hide][range][concat_map][pythagorian auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "concat pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + 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; } } @@ -115,7 +115,68 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "concat sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + 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("serialize concat_map pythagorian ranges", "[hide][range][concat_map][serialize][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rx::serialize_one_worker(sc); + + int c = 0; + std::atomic ct(0); + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, so) + .concat_map( + [&c, so](int z){ + return rxs::range(1, z, 1, so) + .concat_map( + [&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;}}) + .map([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 triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + triples + .take(tripletCount) + .subscribe( + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return ct == tripletCount;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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; } } } diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 9c6d51d..c0a9b60 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -45,7 +45,7 @@ SCENARIO("pythagorian for loops", "[hide][for][pythagorian][perf]"){ auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + std::cout << "pythagorian for : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << c / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl; } } @@ -90,7 +90,7 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "merge pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + 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; } } @@ -108,7 +108,68 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn auto sc = rxsc::make_event_loop(); //auto sc = rxsc::make_new_thread(); - auto so = rx::identity_one_worker(sc); + auto so = rx::synchronize_in_one_worker(sc); + + int c = 0; + std::atomic ct(0); + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, so) + .flat_map( + [&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; + if (x*x + y*y == z*z) { + return true;} + else { + return false;}}) + .map([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 triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + triples + .take(tripletCount) + .subscribe( + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return ct == tripletCount;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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("serialize flat_map pythagorian ranges", "[hide][range][flat_map][serialize][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rx::serialize_one_worker(sc); int c = 0; std::atomic ct(0); @@ -152,7 +213,7 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); - std::cout << "merge sync pythagorian range : " << n << " subscribed, " << c << " filtered to, " << ct << " triplets, " << msElapsed.count() << "ms elapsed " << std::endl; + 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; } } } diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 926a347..1e96068 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -57,6 +57,48 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ } } +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; + + std::mutex lock; + std::condition_variable wake; + + auto sc = rxsc::make_event_loop(); + //auto sc = rxsc::make_new_thread(); + auto so = rx::serialize_one_worker(sc); + + std::atomic c(0); + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + 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)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one(); + }); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return c == onnextcalls;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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(); diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 18d66b5..783a774 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -52,7 +52,7 @@ SCENARIO("for loop subscribes to map", "[hide][for][just][subscribe][long][perf] } } -SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][subscribe][long][perf]"){ +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"){ diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 652df5e..abd1c7d 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -19,11 +19,14 @@ endif() get_filename_component(RXCPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) -set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) -set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples) +MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) + include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) + +set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) + # define the sources of the self test set(TEST_SOURCES ${TEST_DIR}/test.cpp @@ -49,6 +52,8 @@ set(TEST_SOURCES add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) +set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples) + # define the sources of the pythagorian example set(PYTHAGORIAN_SOURCES ${EXAMPLES_DIR}/pythagorian/main.cpp -- GitLab From 85911e69946f653d026753690bfa623b9cad44a9 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 16 Jun 2014 09:31:47 -0700 Subject: [PATCH 339/782] add behavior and publish overload --- Rx/v2/src/rxcpp/rx-observable.hpp | 10 ++ Rx/v2/src/rxcpp/rx-subjects.hpp | 1 + Rx/v2/src/rxcpp/subjects/rx-behavior.hpp | 104 +++++++++++++++++++ Rx/v2/test/operators/publish.cpp | 126 +++++++++++++++++++++-- 4 files changed, 232 insertions(+), 9 deletions(-) create mode 100644 Rx/v2/src/rxcpp/subjects/rx-behavior.hpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index caeb876..266fc32 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -610,12 +610,22 @@ public: /// publish -> /// turns a cold observable hot and allows connections to the source to be independent of subscriptions + /// NOTE: multicast of a subject /// auto publish(composite_subscription cs = composite_subscription()) const -> decltype(multicast(rxsub::subject(cs))) { return multicast(rxsub::subject(cs)); } + /// publish -> + /// turns a cold observable hot, sends the most recent value to any new subscriber and allows connections to the source to be independent of subscriptions + /// NOTE: multicast of a behavior + /// + auto publish(T first, composite_subscription cs = composite_subscription()) const + -> decltype(multicast(rxsub::behavior(first, cs))) { + return multicast(rxsub::behavior(first, cs)); + } + /// scan -> /// 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. /// diff --git a/Rx/v2/src/rxcpp/rx-subjects.hpp b/Rx/v2/src/rxcpp/rx-subjects.hpp index 3c3fb32..c7ad600 100644 --- a/Rx/v2/src/rxcpp/rx-subjects.hpp +++ b/Rx/v2/src/rxcpp/rx-subjects.hpp @@ -17,6 +17,7 @@ namespace rxsub=subjects; } #include "subjects/rx-subject.hpp" +#include "subjects/rx-behavior.hpp" #include "subjects/rx-synchronize.hpp" #endif diff --git a/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp b/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp new file mode 100644 index 0000000..539f8d6 --- /dev/null +++ b/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp @@ -0,0 +1,104 @@ +// 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 behavior_observer : public detail::multicast_observer +{ + typedef behavior_observer this_type; + typedef detail::multicast_observer base_type; + + class behavior_observer_state : public std::enable_shared_from_this + { + mutable std::mutex lock; + mutable T value; + + public: + behavior_observer_state(T first) + : value(first) + { + } + + void reset(T v) const { + std::unique_lock guard(lock); + value = std::move(v); + } + T get() const { + std::unique_lock guard(lock); + return value; + } + }; + + std::shared_ptr state; + +public: + behavior_observer(T f, composite_subscription l) + : base_type(l) + , state(std::make_shared(std::move(f))) + { + } + + T get_value() const { + return state->get(); + } + + template + void on_next(V v) const { + state->reset(v); + base_type::on_next(std::move(v)); + } +}; + +} + +template +class behavior +{ + composite_subscription lifetime; + detail::behavior_observer s; + +public: + explicit behavior(T f, composite_subscription cs = composite_subscription()) + : lifetime(std::move(cs)) + , s(std::move(f), lifetime) + { + } + + bool has_observers() const { + return s.has_observers(); + } + + T get_value() const { + return s.get_value(); + } + + subscriber get_subscriber() const { + return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); + } + + observable get_observable() const { + return make_observable_dynamic([this](subscriber o){ + if (lifetime.is_subscribed()) { + o.on_next(get_value()); + } + this->s.add(std::move(o)); + }); + } +}; + +} + +} + +#endif diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 464f7d2..7c6fd5f 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -13,7 +13,7 @@ namespace rxt=rxcpp::test; #include "catch.hpp" -SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ +SCENARIO("publish range", "[hide][range][subject][publish][subject][operators]"){ GIVEN("a range"){ WHEN("published"){ auto published = rxs::range(0, 10).publish(); @@ -47,7 +47,7 @@ SCENARIO("publish range", "[hide][range][subject][publish][operators]"){ } } -SCENARIO("publish basic", "[publish][multicast][operators]"){ +SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ GIVEN("a test hot observable of longs"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); @@ -58,8 +58,6 @@ SCENARIO("publish basic", "[publish][multicast][operators]"){ auto on_completed = m::on_completed; auto subscribe = m::subscribe; - long invoked = 0; - record messages[] = { on_next(110, 7), on_next(220, 3), @@ -85,7 +83,7 @@ SCENARIO("publish basic", "[publish][multicast][operators]"){ WHEN("subscribed and then connected"){ w.schedule_absolute(rxsc::test::created_time, - [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ + [&ys, &xs](const rxsc::schedulable& scbl){ ys = xs.publish().as_dynamic(); //ys = xs.publish_last().as_dynamic(); }); @@ -170,7 +168,7 @@ SCENARIO("publish basic", "[publish][multicast][operators]"){ } -SCENARIO("publish error", "[publish][error][multicast][operators]"){ +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(); @@ -182,8 +180,6 @@ SCENARIO("publish error", "[publish][error][multicast][operators]"){ auto on_completed = m::on_completed; auto subscribe = m::subscribe; - long invoked = 0; - std::runtime_error ex("publish on_error"); record messages[] = { @@ -211,7 +207,7 @@ SCENARIO("publish error", "[publish][error][multicast][operators]"){ WHEN("subscribed and then connected"){ w.schedule_absolute(rxsc::test::created_time, - [&invoked, &ys, &xs](const rxsc::schedulable& scbl){ + [&ys, &xs](const rxsc::schedulable& scbl){ ys = xs.publish().as_dynamic(); }); @@ -281,3 +277,115 @@ SCENARIO("publish error", "[publish][error][multicast][operators]"){ } } } + +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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(110, 7), + on.on_next(220, 3), + on.on_next(280, 4), + on.on_next(290, 1), + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.on_next(410, 13), + on.on_next(430, 2), + on.on_next(450, 9), + on.on_next(520, 11), + on.on_next(560, 20), + on.on_completed(600) + }); + + auto res = w.make_subscriber(); + + rx::connectable_observable ys; + + WHEN("subscribed and then connected"){ + + w.schedule_absolute(rxsc::test::created_time, + [&ys, &xs](const rxsc::schedulable& scbl){ + ys = xs.publish(1979).as_dynamic(); + }); + + w.schedule_absolute(rxsc::test::subscribed_time, + [&ys, &res](const rxsc::schedulable& scbl){ + ys.subscribe(res); + }); + + w.schedule_absolute(rxsc::test::unsubscribed_time, + [&res](const rxsc::schedulable& scbl){ + res.unsubscribe(); + }); + + { + rx::composite_subscription connection; + + w.schedule_absolute(300, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + w.schedule_absolute(400, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + { + rx::composite_subscription connection; + + w.schedule_absolute(500, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + w.schedule_absolute(550, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + { + rx::composite_subscription connection; + + w.schedule_absolute(650, + [connection, &ys](const rxsc::schedulable& scbl){ + ys.connect(connection); + }); + w.schedule_absolute(800, + [connection](const rxsc::schedulable& scbl){ + connection.unsubscribe(); + }); + } + + w.start(); + + THEN("the output only contains items sent while subscribed"){ + auto required = rxu::to_vector({ + on.on_next(200, 1979), + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.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); + } + + } + } +} -- GitLab From 9215a5b4d9cce3dba031d5932d63fb8cadda3d2a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 16 Jun 2014 23:09:58 -0700 Subject: [PATCH 340/782] add reduce, sum and average because sum and average fail to compile, due to observable being a partial class at that point, a hack was added for sum and average. They are spelled: o.reduce_to(rxo::sum) o.reduce_to(rxo::average) --- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 244 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 36 +-- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-predef.hpp | 22 ++ Rx/v2/src/rxcpp/rx-util.hpp | 4 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 2 +- Rx/v2/test/operators/reduce.cpp | 113 +++++++++ projects/CMake/CMakeLists.txt | 1 + 8 files changed, 406 insertions(+), 17 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-reduce.hpp create mode 100644 Rx/v2/test/operators/reduce.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp new file mode 100644 index 0000000..e12d820 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -0,0 +1,244 @@ +// 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_REDUCE_HPP) +#define RXCPP_OPERATORS_RX_REDUCE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct reduce_traits +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type accumulator_type; + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type seed_type; + + typedef T source_value_type; + + struct tag_not_valid {}; + + template + static auto accumulate_check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr, *(CV*)nullptr)); + template + static tag_not_valid accumulate_check(...); + + static_assert(std::is_same(0)), seed_type>::value, "reduce Accumulator must be a function with the signature Seed(Seed, reduce::source_value_type)"); + + template + static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr)); + template + static tag_not_valid result_check(...); + + static_assert(!std::is_same(0)), tag_not_valid>::value, "reduce ResultSelector must be a function with the signature reduce::value_type(Seed)"); + + typedef decltype(result_check(0)) value_type; +}; + +template +struct reduce : public operator_base::value_type> +{ + typedef reduce this_type; + typedef reduce_traits 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(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; + }; + reduce_initial_type initial; + + 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 + void on_subscribe(Subscriber o) { + struct reduce_state_type + : public reduce_initial_type + , public std::enable_shared_from_this + { + reduce_state_type(reduce_initial_type i, Subscriber scrbr) + : reduce_initial_type(i) + , current(reduce_initial_type::seed) + , out(std::move(scrbr)) + { + } + seed_type current; + Subscriber out; + }; + auto state = std::make_shared(initial, std::move(o)); + state->source.subscribe( + state->out, + // on_next + [state](T t) { + auto next = on_exception( + [&](){return state->accumulator(state->current, t);}, + state->out); + if (next.empty()) { + return; + } + state->current = next.get(); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + auto result = on_exception( + [&](){return state->result_selector(state->current);}, + state->out); + if (result.empty()) { + return; + } + state->out.on_next(result.get()); + state->out.on_completed(); + } + ); + } +}; + +template +class reduce_factory +{ + typedef typename std::decay::type accumulator_type; + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type seed_type; + + accumulator_type accumulator; + result_selector_type result_selector; + seed_type seed; +public: + reduce_factory(accumulator_type a, result_selector_type rs, Seed s) + : accumulator(std::move(a)) + , result_selector(std::move(rs)) + , seed(std::move(s)) + { + } + template + auto operator()(Observable&& source) + -> observable::type::value_type, Observable, Accumulator, ResultSelector, Seed>> { + return observable::type::value_type, Observable, Accumulator, ResultSelector, Seed>>( + reduce::type::value_type, Observable, Accumulator, ResultSelector, Seed>(std::forward(source), accumulator, result_selector, seed)); + } +}; + +template +struct initialize_seeder { + typedef T seed_type; + seed_type seed() { + return seed_type{}; + } +}; + +template +struct average { + struct seed_type + { + seed_type() + : value() + , count(0) + { + } + T value; + int count; + rxu::detail::maybe stage; + }; + seed_type seed() { + return seed_type{}; + } + seed_type operator()(seed_type a, T v) { + if (a.count != 0 && + (a.count == std::numeric_limits::max() || + ((v > 0) && (a.value > (std::numeric_limits::max() - v))) || + ((v < 0) && (a.value < (std::numeric_limits::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 = a.value / a.count; + a.value = v; + a.count = 1; + if (!a.stage.empty()) { + a.stage.reset((*a.stage + avg) / 2); + } else { + a.stage.reset(avg); + } + } else { + a.value += v; + ++a.count; + } + return a; + } + double operator()(seed_type a) { + if (a.count > 0) { + double avg = a.value / a.count; + if (!a.stage.empty()) { + avg = (*a.stage + avg) / 2; + } + return avg; + } + return a.value; + } +}; + +} + +template +auto reduce(Seed s, Accumulator a, ResultSelector rs) + -> detail::reduce_factory { + return detail::reduce_factory(std::move(a), std::move(rs), std::move(s)); +} + +template class Seeder, template class Accumulator, template class ResultSelector> +struct specific_reduce +{ + template + Accumulator accumulator() const { + return Accumulator{}; + } + template + ResultSelector result_selector() const { + return ResultSelector{}; + } + template + auto seed() const + -> typename Seeder::seed_type { + return Seeder().seed(); + } +}; + +static const specific_reduce sum{}; + +static const specific_reduce average{}; + + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 266fc32..d4e0ca6 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -74,20 +74,6 @@ struct select_chain } -// -// 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 - auto operator()(Observable o) - -> Observable { - return std::move(o); - static_assert(is_observable::value, "only support observables"); - } -}; - template class dynamic_observable : public rxs::source_base @@ -626,6 +612,28 @@ public: return multicast(rxsub::behavior(first, cs)); } + /// reduce -> + /// 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. + /// + template + auto reduce(Seed seed, Accumulator&& a, ResultSelector&& rs) const + -> observable::value_type, rxo::detail::reduce> { + return observable::value_type, rxo::detail::reduce>( + rxo::detail::reduce(*this, std::forward(a), std::forward(rs), seed)); + } + + /// reduce_to -> + /// for each item from this observable reduce it using the Accumulator and ResultSelector and Seed. + /// NOTE: this overload allows constants like rxo::sum and rxo::average to be passed in. Adding a + /// sum or average method here causes compile errors because they are not templated and this type + /// is a partial type at this point. + /// + template class Seeder, template class Accumulator, template class ResultSelector> + auto reduce_to(rxo::specific_reduce sr) const + -> decltype(reduce(sr.template seed(), sr.template accumulator(), sr.template result_selector())) { + return reduce(sr.template seed(), sr.template accumulator(), sr.template result_selector()); + } + /// scan -> /// 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. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index b535e17..9c75547 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -49,6 +49,7 @@ namespace rxo=operators; #include "operators/rx-publish.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-connect_forever.hpp" +#include "operators/rx-reduce.hpp" #include "operators/rx-scan.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 688c8ea..482b89e 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -182,6 +182,28 @@ public: static const bool value = std::is_convertible::type>(0)), tag_connectable_observable>::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 + auto operator()(Observable o) + -> Observable { + return std::move(o); + static_assert(is_observable::value, "only support observables"); + } +}; + +template +struct identity_for +{ + T operator()(T t) { + return std::move(t); + } +}; + } #endif diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index dd307b2..e30ff7f 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -278,8 +278,8 @@ public: return *this; } maybe& operator=(const maybe& other) { - if (const T* pother = other.get()) { - reset(*pother); + if (!other.empty()) { + reset(other.get()); } else { reset(); } diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index fce04ac..46408f8 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -86,8 +86,8 @@ class synchronize_observer : public detail::multicast_observer synchronize_observer_state(coordinator_type coor, composite_subscription cs, output_type scbr) : lifetime(std::move(cs)) - , coordinator(std::move(coor)) , current(mode::Empty) + , coordinator(std::move(coor)) , destination(std::move(scbr)) { } diff --git a/Rx/v2/test/operators/reduce.cpp b/Rx/v2/test/operators/reduce.cpp new file mode 100644 index 0000000..45aba91 --- /dev/null +++ b/Rx/v2/test/operators/reduce.cpp @@ -0,0 +1,113 @@ + +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.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 on; + + int seed = 42; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 0), + on.on_next(220, 1), + on.on_next(230, 2), + on.on_next(240, 3), + on.on_next(250, 4), + on.on_completed(260) + }); + + auto sum = xs.reduce_to(rxo::sum); + + 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.on_next(260, (seed + 0 + 1 + 2 + 3 + 4) * 5), + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 3), + on.on_next(220, 4), + on.on_next(230, 2), + on.on_completed(250) + }); + + WHEN("mapped to ints that are one larger"){ + + auto res = w.start( + [&]() { + return xs.reduce_to(rxo::average); + } + ); + + THEN("the output stops on completion"){ + auto required = rxu::to_vector({ + on.on_next(250, 3.0), + on.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); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index abd1c7d..b9e6df6 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -43,6 +43,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/filter.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp ${TEST_DIR}/operators/scan.cpp + ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/flat_map.cpp -- GitLab From c96e2a497e3876287e3ef5824f8d8164cb3ebf3a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 19 Jun 2014 08:24:37 -0700 Subject: [PATCH 341/782] added switch_on_next and replaced reduce_to observable now has sum() and average() --- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 72 +++--- .../src/rxcpp/operators/rx-switch_on_next.hpp | 210 ++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 92 +++++++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/reduce.cpp | 13 +- Rx/v2/test/operators/switch_on_next.cpp | 114 ++++++++++ projects/CMake/CMakeLists.txt | 1 + 8 files changed, 459 insertions(+), 52 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp create mode 100644 Rx/v2/test/operators/switch_on_next.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 5eddc15..684a13c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -14,13 +14,19 @@ namespace operators { namespace detail { template -struct merge : public operator_base::type::value_type::value_type> +struct merge + : public operator_base::type::value_type::value_type> { + static_assert(is_observable::value, "merge requires an observable"); + static_assert(is_observable::value, "merge an observable that contains observables"); + typedef merge this_type; typedef typename std::decay::type source_type; + typedef typename source_type::value_type source_value_type; typedef typename source_value_type::value_type value_type; + typedef typename std::decay::type coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index e12d820..7ba7015 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -13,33 +13,55 @@ namespace operators { namespace detail { -template -struct reduce_traits -{ - typedef typename std::decay::type source_type; +template +struct is_accumulate_function_for { + typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type result_selector_type; typedef typename std::decay::type seed_type; - typedef T source_value_type; struct tag_not_valid {}; - template - static auto accumulate_check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr, *(CV*)nullptr)); + static auto check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr, *(CV*)nullptr)); template - static tag_not_valid accumulate_check(...); + static tag_not_valid check(...); + + typedef decltype(check(0)) type; + static const bool value = std::is_same::value; +}; - static_assert(std::is_same(0)), seed_type>::value, "reduce Accumulator must be a function with the signature Seed(Seed, reduce::source_value_type)"); +template +struct is_result_function_for { + + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type seed_type; + + struct tag_not_valid {}; template - static auto result_check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr)); + static auto check(int) -> decltype((*(CRS*)nullptr)(*(CS*)nullptr)); template - static tag_not_valid result_check(...); + static tag_not_valid check(...); + + typedef decltype(check(0)) type; + static const bool value = !std::is_same::value; +}; + +template +struct reduce_traits +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type accumulator_type; + typedef typename std::decay::type result_selector_type; + typedef typename std::decay::type seed_type; + + typedef T source_value_type; - static_assert(!std::is_same(0)), tag_not_valid>::value, "reduce ResultSelector must be a function with the signature reduce::value_type(Seed)"); + static_assert(is_accumulate_function_for::value, "reduce Accumulator must be a function with the signature Seed(Seed, reduce::source_value_type)"); - typedef decltype(result_check(0)) value_type; + static_assert(is_result_function_for::value, "reduce ResultSelector must be a function with the signature reduce::value_type(Seed)"); + + typedef typename is_result_function_for::type value_type; }; template @@ -214,28 +236,6 @@ auto reduce(Seed s, Accumulator a, ResultSelector rs) return detail::reduce_factory(std::move(a), std::move(rs), std::move(s)); } -template class Seeder, template class Accumulator, template class ResultSelector> -struct specific_reduce -{ - template - Accumulator accumulator() const { - return Accumulator{}; - } - template - ResultSelector result_selector() const { - return ResultSelector{}; - } - template - auto seed() const - -> typename Seeder::seed_type { - return Seeder().seed(); - } -}; - -static const specific_reduce sum{}; - -static const specific_reduce average{}; - } diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp new file mode 100644 index 0000000..b47fd12 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -0,0 +1,210 @@ +// 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_SWITCH_ON_NEXT_HPP) +#define RXCPP_OPERATORS_RX_SWITCH_ON_NEXT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct switch_on_next + : public operator_base::type::value_type::value_type> +{ + static_assert(is_observable::value, "switch_on_next requires an observable"); + static_assert(is_observable::value, "switch_on_next an observable that contains observables"); + + typedef switch_on_next this_type; + + typedef typename std::decay::type source_type; + + typedef typename source_type::value_type collection_type; + typedef typename collection_type::value_type collection_value_type; + + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + + struct values + { + values(source_type o, coordination_type sf) + : source(std::move(o)) + , coordination(std::move(sf)) + { + } + source_type source; + coordination_type coordination; + }; + values initial; + + switch_on_next(source_type o, coordination_type sf) + : initial(std::move(o), std::move(sf)) + { + } + + template + void on_subscribe(Subscriber scbr) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef Subscriber output_type; + + struct switch_state_type + : public std::enable_shared_from_this + , public values + { + switch_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; + composite_subscription inner_lifetime; + output_type out; + }; + + auto coordinator = initial.coordination.create_coordinator(); + + // take a copy of the values for each subscription + auto state = std::shared_ptr(new 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( + 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 = on_exception( + [&](){return state->coordinator.in(st);}, + 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( + state->out, + state->inner_lifetime, + // on_next + [state, st](collection_value_type ct) { + state->out.on_next(std::move(ct)); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + }, + //on_completed + [state](){ + if (state->pendingCompletions == 1) { + state->out.on_completed(); + } + } + ); + + auto selectedSinkInner = on_exception( + [&](){return state->coordinator.out(sinkInner);}, + state->out); + if (selectedSinkInner.empty()) { + return; + } + + ++state->pendingCompletions; + selectedSource->subscribe(std::move(selectedSinkInner.get())); + }, + // on_error + [state](std::exception_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 switch_on_next_factory +{ + typedef typename std::decay::type coordination_type; + + coordination_type coordination; +public: + switch_on_next_factory(coordination_type sf) + : coordination(std::move(sf)) + { + } + + template + auto operator()(Observable&& source) + -> observable::value_type, switch_on_next> { + return observable::value_type, switch_on_next>( + switch_on_next(std::forward(source), coordination)); + } +}; + +} + +template +auto switch_on_next(Coordination&& sf) + -> detail::switch_on_next_factory { + return detail::switch_on_next_factory(std::forward(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index d4e0ca6..6679213 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -335,6 +335,51 @@ public: return lift(rxo::detail::buffer_count(count, skip)); } + template::value> + struct switch_on_next_result; + + template + struct switch_on_next_result + { + typedef + observable< + typename this_type::value_type::value_type, + rxo::detail::switch_on_next> + type; + static type make(const this_type* that, Coordination sf) { + return type(rxo::detail::switch_on_next(*that, std::move(sf))); + } + }; + template + struct switch_on_next_result + { + typedef this_type type; + static type make(const this_type* that, Coordination) { + return *that; + } + }; + + /// switch_on_next (AKA Switch) -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable subscribe to that observable after unsubscribing from any previous subscription. + /// + auto switch_on_next() const + -> typename switch_on_next_result::type { + return switch_on_next_result::make(this, identity_one_worker(rxsc::make_current_thread())); + } + + /// switch_on_next (AKA Switch) -> + /// The coodination is used to synchronize sources from different contexts. + /// for each item from this observable subscribe to that observable after unsubscribing from any previous subscription. + /// + template + auto switch_on_next(Coordination&& sf) const + -> typename std::enable_if::value, + observable::value_type, rxo::detail::switch_on_next>>::type { + return observable::value_type, rxo::detail::switch_on_next>( + rxo::detail::switch_on_next(*this, std::forward(sf))); + } + template::value> struct merge_result; @@ -622,16 +667,45 @@ public: rxo::detail::reduce(*this, std::forward(a), std::forward(rs), seed)); } - /// reduce_to -> - /// for each item from this observable reduce it using the Accumulator and ResultSelector and Seed. - /// NOTE: this overload allows constants like rxo::sum and rxo::average to be passed in. Adding a - /// sum or average method here causes compile errors because they are not templated and this type - /// is a partial type at this point. + template::value && + rxo::detail::is_result_function_for::value> + struct specific_reduce_result; + + template + struct specific_reduce_result + { + typedef + observable< + typename rxo::detail::is_result_function_for::type, + rxo::detail::reduce> + type; + static type make(const this_type* that, Seed seed, Accumulator a, ResultSelector rs) { + return type(rxo::detail::reduce(*that, std::move(a), std::move(rs), std::move(seed))); + } + }; + template + struct specific_reduce_result + { + typedef void type; + static void make(const this_type* that, Seed, Accumulator, ResultSelector) { + } + }; + + /// sum -> + /// for each item from this observable reduce it by adding to the previous values. + /// + auto sum() const + -> typename specific_reduce_result::seed_type, std::plus, identity_for>::type { + return specific_reduce_result::seed_type, std::plus, identity_for>::make(this, rxo::detail::initialize_seeder().seed(), std::plus(), identity_for()); + } + + /// average -> + /// 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. /// - template class Seeder, template class Accumulator, template class ResultSelector> - auto reduce_to(rxo::specific_reduce sr) const - -> decltype(reduce(sr.template seed(), sr.template accumulator(), sr.template result_selector())) { - return reduce(sr.template seed(), sr.template accumulator(), sr.template result_selector()); + auto average() const + -> typename specific_reduce_result::seed_type, rxo::detail::average, rxo::detail::average>::type { + return specific_reduce_result::seed_type, rxo::detail::average, rxo::detail::average>::make(this, rxo::detail::average().seed(), rxo::detail::average(), rxo::detail::average()); } /// scan -> diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 9c75547..fbc2c01 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -51,6 +51,7 @@ namespace rxo=operators; #include "operators/rx-connect_forever.hpp" #include "operators/rx-reduce.hpp" #include "operators/rx-scan.hpp" +#include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" diff --git a/Rx/v2/test/operators/reduce.cpp b/Rx/v2/test/operators/reduce.cpp index 45aba91..a45354b 100644 --- a/Rx/v2/test/operators/reduce.cpp +++ b/Rx/v2/test/operators/reduce.cpp @@ -31,11 +31,11 @@ SCENARIO("reduce some data with seed", "[reduce][operators]"){ on.on_completed(260) }); - auto sum = xs.reduce_to(rxo::sum); + auto sum = xs.sum(); WHEN("mapped to ints that are one larger"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .reduce(seed, @@ -75,6 +75,7 @@ SCENARIO("average some data", "[reduce][average][operators]"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); const rxsc::test::messages on; + const rxsc::test::messages d_on; auto xs = sc.make_hot_observable({ on.on_next(150, 1), @@ -86,16 +87,16 @@ SCENARIO("average some data", "[reduce][average][operators]"){ WHEN("mapped to ints that are one larger"){ - auto res = w.start( + auto res = w.start( [&]() { - return xs.reduce_to(rxo::average); + return xs.average(); } ); THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(250, 3.0), - on.on_completed(250) + d_on.on_next(250, 3.0), + d_on.on_completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/switch_on_next.cpp b/Rx/v2/test/operators/switch_on_next.cpp new file mode 100644 index 0000000..f6f70b0 --- /dev/null +++ b/Rx/v2/test/operators/switch_on_next.cpp @@ -0,0 +1,114 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxo=rxcpp::operators; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; +namespace rxn=rxcpp::notifications; + +#include "rxcpp/rx-test.hpp" +namespace rxt=rxcpp::test; + +#include "catch.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 on; + const rxsc::test::messages> o_on; + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_completed(50) + }); + + auto ys3 = sc.make_cold_observable({ + on.on_next(10, 301), + on.on_next(20, 302), + on.on_next(30, 303), + on.on_next(40, 304), + on.on_completed(150) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.on_next(400, ys2), + o_on.on_next(500, ys3), + o_on.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.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 201), + on.on_next(420, 202), + on.on_next(430, 203), + on.on_next(440, 204), + on.on_next(510, 301), + on.on_next(520, 302), + on.on_next(530, 303), + on.on_next(540, 304), + on.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({ + 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); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b9e6df6..8778802 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -43,6 +43,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/filter.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp ${TEST_DIR}/operators/scan.cpp + ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/publish.cpp -- GitLab From 83f6fdf29056f6a18e2825ef2f4c4b61dad62c30 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 19 Jun 2014 08:25:10 -0700 Subject: [PATCH 342/782] remove RelWithDebInfo --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51435aa..d777288 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ compiler: - clang env: - - BUILD_TYPE=RelWithDebInfo - BUILD_TYPE=Release before_install: @@ -25,7 +24,7 @@ install: script: - cd projects/build - ctest -V - - cd .. + - cd ../.. branches: only: @@ -35,5 +34,5 @@ notifications: recipients: - kirk.shoop@microsoft.com email: - on_success: change + on_success: always on_failure: always -- GitLab From 76bfc895a34d07c3ccb03361699df1a187025b2d Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:48:06 +0400 Subject: [PATCH 343/782] GCC forbids "__thread" before "static". --- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 7578272..3c7bb90 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -32,7 +32,7 @@ public: private: static current_thread_queue_type*& current_thread_queue() { - RXCPP_THREAD_LOCAL static current_thread_queue_type* queue; + static RXCPP_THREAD_LOCAL current_thread_queue_type* queue; return queue; } -- GitLab From 7eb61bd4dd9d82968561c9335e9379c02a34bf2d Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:49:22 +0400 Subject: [PATCH 344/782] GCC requires explicit using of "this". Visual C++ does not support this feature, so we need a macro depending on compiler. --- Rx/v2/src/rxcpp/rx-observable.hpp | 34 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 6679213..0ec1123 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -7,6 +7,12 @@ #include "rx-includes.hpp" +#ifdef __GNUG__ +#define EXPLICIT_THIS this-> +#else +#define EXPLICIT_THIS +#endif + namespace rxcpp { namespace detail { @@ -298,8 +304,8 @@ public: /// template auto filter(Predicate p) const - -> decltype(lift(rxo::detail::filter(std::move(p)))) { - return lift(rxo::detail::filter(std::move(p))); + -> decltype(EXPLICIT_THIS lift(rxo::detail::filter(std::move(p)))) { + return lift(rxo::detail::filter(std::move(p))); } /// map (AKA Select) -> @@ -307,32 +313,32 @@ public: /// template auto map(Selector&& s) const - -> decltype(lift(rxo::detail::map(std::move(s)))) { - return lift(rxo::detail::map(std::move(s))); + -> decltype(EXPLICIT_THIS lift(rxo::detail::map(std::move(s)))) { + return lift(rxo::detail::map(std::move(s))); } /// distinct_until_changed -> /// for each item from this observable, filter out repeated values and emit only changes from the new observable that is returned. /// auto distinct_until_changed() const - -> decltype(lift(rxo::detail::distinct_until_changed())) { - return lift(rxo::detail::distinct_until_changed()); + -> decltype(EXPLICIT_THIS lift(rxo::detail::distinct_until_changed())) { + return lift(rxo::detail::distinct_until_changed()); } /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// auto buffer(int count) const - -> decltype(lift(rxo::detail::buffer_count(count, count))) { - return lift(rxo::detail::buffer_count(count, count)); + -> decltype(EXPLICIT_THIS lift(rxo::detail::buffer_count(count, count))) { + return lift(rxo::detail::buffer_count(count, count)); } /// buffer -> /// start a new vector every skip items and collect count items from this observable into each vector to emit from the new observable that is returned. /// auto buffer(int count, int skip) const - -> decltype(lift(rxo::detail::buffer_count(count, skip))) { - return lift(rxo::detail::buffer_count(count, skip)); + -> decltype(EXPLICIT_THIS lift(rxo::detail::buffer_count(count, skip))) { + return lift(rxo::detail::buffer_count(count, skip)); } template::value> @@ -635,8 +641,8 @@ public: /// template auto synchronize(Coordination cn, composite_subscription cs = composite_subscription()) const - -> decltype(multicast(rxsub::synchronize(std::move(cn), cs))) { - return multicast(rxsub::synchronize(std::move(cn), cs)); + -> decltype(EXPLICIT_THIS multicast(rxsub::synchronize(std::move(cn), cs))) { + return multicast(rxsub::synchronize(std::move(cn), cs)); } /// publish -> @@ -644,8 +650,8 @@ public: /// NOTE: multicast of a subject /// auto publish(composite_subscription cs = composite_subscription()) const - -> decltype(multicast(rxsub::subject(cs))) { - return multicast(rxsub::subject(cs)); + -> decltype(EXPLICIT_THIS multicast(rxsub::subject(cs))) { + return multicast(rxsub::subject(cs)); } /// publish -> -- GitLab From 62ba9bfecbf63d60894d9c4eda20bcaec2698998 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:50:13 +0400 Subject: [PATCH 345/782] Add features support detection for GCC. --- Rx/v2/src/rxcpp/rx-includes.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 28ed62c..2568d9d 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -33,6 +33,24 @@ #define RXCPP_USE_VARIADIC_TEMPLATES 1 #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 + #endif #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) -- GitLab From 08bb829c142c261c92c94259d81f64d479458ae4 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:51:33 +0400 Subject: [PATCH 346/782] Use preprocessor control of using RTTI. GCC does not support string literals in function template signature and "typeid" into "decltype". --- Rx/v2/src/rxcpp/rx-notification.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index cc4c721..b572c27 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -65,16 +65,16 @@ auto to_stream(std::ostream& os, const T& t, int, int) return os << t; } +#if RXCPP_USE_RTTI template -auto to_stream(std::ostream& os, const T&, int, ...) - -> decltype(os << typeid(T).name() << "") { - return os << "< " << typeid(T).name() << " does not support ostream>"; +std::ostream& to_stream(std::ostream& os, const T&, int, ...) { + return os << "< " << typeid(T).name() << " does not support ostream>"; } +#endif template -auto to_stream(std::ostream& os, const T&, ...) - -> decltype(os << "") { - return os << ""; +std::ostream& to_stream(std::ostream& os, const T&, ...) { + return os << ""; } template -- GitLab From e19b1f583b440bec7f1692b181ace83ba18e374e Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:51:59 +0400 Subject: [PATCH 347/782] Add build instructions for GCC. --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ab9eb2..ffa1b1e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ * RxCpp is regularly tested on OSX and Windows. * RxCpp is regularly built with Clang and VC * RxCpp depends on the latest compiler releases. -* RxCpp does not compile with gcc at this time. Contributions are welcome. +* RxCpp has an experimental build with gcc. RxCpp uses CMake to create build files for several platforms and IDE's @@ -50,6 +50,22 @@ cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake make ``` +####Linux --- Clang +``` +mkdir projects/build +cd projects/build +cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake +make +``` + +####Linux --- GCC +``` +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 ``` mkdir projects\build -- GitLab From f36a3927cae94fb1d51b472534cee66c86a48102 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 24 Jun 2014 19:53:22 +0400 Subject: [PATCH 348/782] Configure Travis for GCC --- .travis.yml | 8 +++++++- projects/scripts/travis-install.sh | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d777288..9fda0a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,22 @@ os: compiler: - clang + - gcc env: - BUILD_TYPE=Release + +matrix: + exclude: + - compiler: gcc + os: osx before_install: - sh projects/scripts/travis-install.sh install: - cd projects - - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX - cd build - make -j4 - cd ../.. diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index cb84aa4..8fb05f2 100644 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -10,8 +10,18 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang-3.5 sudo apt-get clean sudo apt-get update - sudo apt-get install -q --fix-missing clang-3.5 cmake libssl-dev -#libstdc++6 + + sudo apt-get install -q --fix-missing cmake libssl-dev + + if [ "$CC" = clang ]; then + sudo apt-get install -q --fix-missing clang-3.5 + fi + + if [ "$CC" = gcc ]; then + sudo apt-get install -q --fix-missing gcc-4.8 g++-4.8 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + fi elif [ "$TRAVIS_OS_NAME" = osx ]; then xcode-select --install -- GitLab From ee34d63f1905d5ecc4246d83fae014579c12115a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Jun 2014 18:55:59 -0700 Subject: [PATCH 349/782] fix after rebase --- Rx/v2/src/rxcpp/rx-observable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 0ec1123..b1b59fa 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -659,7 +659,7 @@ public: /// NOTE: multicast of a behavior /// auto publish(T first, composite_subscription cs = composite_subscription()) const - -> decltype(multicast(rxsub::behavior(first, cs))) { + -> decltype(EXPLICIT_THIS multicast(rxsub::behavior(first, cs))) { return multicast(rxsub::behavior(first, cs)); } -- GitLab From 07704df69b93414b638aa5433d6418df5c69e157 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Wed, 25 Jun 2014 17:31:55 +0400 Subject: [PATCH 350/782] Switch existing tests to use a new style Remove unnecessary local vars, typedefs, namespaces, and templates specialization from tests. --- Rx/v2/test/operators/buffer.cpp | 64 +- Rx/v2/test/operators/combine_latest.cpp | 79 +- Rx/v2/test/operators/concat.cpp | 159 +- Rx/v2/test/operators/concat_map.cpp | 91 +- .../test/operators/distinct_until_changed.cpp | 7 - Rx/v2/test/operators/filter.cpp | 320 ++-- Rx/v2/test/operators/flat_map.cpp | 330 ++-- Rx/v2/test/operators/lift.cpp | 174 +- Rx/v2/test/operators/map.cpp | 64 +- Rx/v2/test/operators/merge.cpp | 291 ++-- Rx/v2/test/operators/publish.cpp | 142 +- Rx/v2/test/operators/reduce.cpp | 8 - Rx/v2/test/operators/scan.cpp | 57 +- Rx/v2/test/operators/switch_on_next.cpp | 6 - Rx/v2/test/operators/take.cpp | 1447 +++++++---------- Rx/v2/test/sources/defer.cpp | 42 +- Rx/v2/test/sources/interval.cpp | 7 - Rx/v2/test/subjects/subject.cpp | 198 +-- 18 files changed, 1440 insertions(+), 2046 deletions(-) diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index a98e03e..2153f8d 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -1,48 +1,30 @@ #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("buffer count skip less", "[buffer][operators]"){ GIVEN("1 hot observable of ints."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages> mv; - typedef rxn::subscription life; - - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - typedef mv::recorded_type vrecord; - auto von_next = mv::on_next; - auto von_completed = mv::on_completed; - auto vsubscribe = mv::subscribe; - - record messages1[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto xs = sc.make_hot_observable(messages1); + const rxsc::test::messages on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); WHEN("group each int with the next 2 ints"){ - auto res = w.start>( + auto res = w.start( [&]() { return xs .buffer(3, 1) @@ -52,23 +34,21 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ ); THEN("the output contains groups of ints"){ - vrecord items[] = { - von_next(230, rxu::to_vector(2, 3, 4)), - von_next(240, rxu::to_vector(3, 4, 5)), - von_next(250, rxu::to_vector(4, 5)), - von_next(250, rxu::to_vector(5)), - von_completed(250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + v_on.on_next(230, rxu::to_vector(2, 3, 4)), + v_on.on_next(240, rxu::to_vector(3, 4, 5)), + v_on.on_next(250, rxu::to_vector(4, 5)), + v_on.on_next(250, rxu::to_vector(5)), + v_on.on_completed(250) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the xs"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 250) + }); 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 index 8f40d22..fb13953 100644 --- a/Rx/v2/test/operators/combine_latest.cpp +++ b/Rx/v2/test/operators/combine_latest.cpp @@ -1,51 +1,35 @@ #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.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(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages> mo; - typedef rxn::subscription life; - - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; - record messages1[] = { - on_next(150, 1), - on_next(215, 2), - on_next(225, 4), - on_completed(230) - }; - auto o1 = sc.make_hot_observable(messages1); + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(230) + }); - record messages2[] = { - on_next(150, 1), - on_next(220, 3), - on_next(230, 5), - on_next(235, 6), - on_next(240, 7), - on_completed(250) - }; - auto o2 = sc.make_hot_observable(messages2); + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(220, 3), + on.on_next(230, 5), + on.on_next(235, 6), + on.on_next(240, 7), + on.on_completed(250) + }); WHEN("each int is combined with the latest from the other source"){ - auto res = w.start( + auto res = w.start( [&]() { return o2 .combine_latest([](int v2, int v1){return v2 + v1;}, o1) @@ -55,33 +39,30 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato ); THEN("the output contains combined ints"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(220, 2 + 3), + on.on_next(225, 4 + 3), + on.on_next(230, 4 + 5), + on.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.on_completed(250) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the o1"){ - life items[] = { - subscribe(200, 230) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 250) + }); auto actual = o2.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 244d681..59a1813 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -1,15 +1,10 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" const int static_onnextcalls = 1000000; @@ -102,61 +97,46 @@ 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(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages> mo; - typedef rxn::subscription life; - - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - typedef mo::recorded_type orecord; - auto oon_next = mo::on_next; - auto oon_completed = mo::on_completed; - auto osubscribe = mo::subscribe; - - record messages1[] = { - 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 ys1 = sc.make_cold_observable(messages1); - - record messages2[] = { - on_next(10, 201), - on_next(20, 202), - on_next(30, 203), - on_next(40, 204), - on_completed(50) - }; - auto ys2 = sc.make_cold_observable(messages2); - - record messages3[] = { - on_next(10, 301), - on_next(20, 302), - on_next(30, 303), - on_next(40, 304), - on_next(120, 305), - on_completed(150) - }; - auto ys3 = sc.make_cold_observable(messages3); - - orecord omessages[] = { - oon_next(300, ys1), - oon_next(400, ys2), - oon_next(500, ys3), - oon_completed(600) - }; - auto xs = sc.make_hot_observable(omessages); + const rxsc::test::messages on; + const rxsc::test::messages> o_on; + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_completed(50) + }); + + auto ys3 = sc.make_cold_observable({ + on.on_next(10, 301), + on.on_next(20, 302), + on.on_next(30, 303), + on.on_next(40, 304), + on.on_next(120, 305), + on.on_completed(150) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.on_next(400, ys2), + o_on.on_next(500, ys3), + o_on.on_completed(600) + }); WHEN("each int is merged"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .concat() @@ -166,61 +146,56 @@ SCENARIO("concat completes", "[concat][join][operators]"){ ); THEN("the output contains merged ints"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 103), + on.on_next(420, 104), + on.on_next(510, 105), + on.on_next(520, 106), + on.on_next(540, 201), + on.on_next(550, 202), + on.on_next(560, 203), + on.on_next(570, 204), + on.on_next(590, 301), + on.on_next(600, 302), + on.on_next(610, 303), + on.on_next(620, 304), + on.on_next(700, 305), + on.on_completed(730) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ints"){ - life items[] = { - subscribe(200, 600) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(300, 530) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(530, 580) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(580, 730) - }; - auto required = rxu::to_vector(items); + 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 index f04e0cc..c05fb18 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -1,15 +1,10 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" static const int static_tripletCount = 100; @@ -185,39 +180,26 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages ms; - typedef rxn::subscription life; - - typedef m::recorded_type irecord; - auto ion_next = m::on_next; - auto ion_completed = m::on_completed; - auto isubscribe = m::subscribe; - - typedef ms::recorded_type srecord; - auto son_next = ms::on_next; - auto son_completed = ms::on_completed; - auto ssubscribe = ms::subscribe; - - irecord int_messages[] = { - ion_next(100, 4), - ion_next(200, 2), - ion_completed(500) - }; - auto xs = sc.make_cold_observable(int_messages); - - srecord string_messages[] = { - son_next(50, "foo"), - son_next(100, "bar"), - son_next(150, "baz"), - son_next(200, "qux"), - son_completed(250) - }; - auto ys = sc.make_cold_observable(string_messages); + const rxsc::test::messages i_on; + const rxsc::test::messages s_on; + + auto xs = sc.make_cold_observable({ + i_on.on_next(100, 4), + i_on.on_next(200, 2), + i_on.on_completed(500) + }); + + auto ys = sc.make_cold_observable({ + s_on.on_next(50, "foo"), + s_on.on_next(100, "bar"), + s_on.on_next(150, "baz"), + s_on.on_next(200, "qux"), + s_on.on_completed(250) + }); WHEN("each int is mapped to the strings"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .concat_map( @@ -231,37 +213,34 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - srecord items[] = { - son_next(350, "foo"), - son_next(400, "bar"), - son_next(450, "baz"), - son_next(500, "qux"), - son_next(600, "foo"), - son_next(650, "bar"), - son_next(700, "baz"), - son_next(750, "qux"), - son_completed(800) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + s_on.on_next(350, "foo"), + s_on.on_next(400, "bar"), + s_on.on_next(450, "baz"), + s_on.on_next(500, "qux"), + s_on.on_next(600, "foo"), + s_on.on_next(650, "bar"), + s_on.on_next(700, "baz"), + s_on.on_next(750, "qux"), + s_on.on_completed(800) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ints"){ - life items[] = { - isubscribe(200, 700) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - ssubscribe(300, 550), - ssubscribe(550, 800) - }; - auto required = rxu::to_vector(items); + 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/distinct_until_changed.cpp b/Rx/v2/test/operators/distinct_until_changed.cpp index 2639574..7df96ee 100644 --- a/Rx/v2/test/operators/distinct_until_changed.cpp +++ b/Rx/v2/test/operators/distinct_until_changed.cpp @@ -1,15 +1,8 @@ #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("distinct_until_changed - some changes", "[distinct_until_changed][operators]"){ diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index 3e9e61d..4d56dfa 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -1,18 +1,12 @@ - #define RXCPP_USE_OBSERVABLE_MEMBERS 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" namespace { @@ -32,37 +26,30 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(messages); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600), + on.on_next(610, 12), + on.on_error(620, std::runtime_error("error in unsubscribed stream")), + on.on_completed(630) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [&xs, &invoked]() { #if 0 && RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -88,23 +75,21 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ } ); THEN("the output only contains primes"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7), - on_next(580, 11), - on_completed(600) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7), + on.on_next(580, 11), + on.on_completed(600) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 600) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 600) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -121,34 +106,28 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [&xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -172,21 +151,19 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ ); THEN("the output only contains primes that arrived before disposal"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -202,40 +179,33 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; std::runtime_error ex("filter on_error from source"); - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_error(600, ex), + on.on_next(610, 12), + on.on_error(620, std::runtime_error("error in unsubscribed stream")), + on.on_completed(630) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -258,23 +228,21 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ ); THEN("the output only contains primes"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7), - on_next(580, 11), - on_error(600, ex), - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7), + on.on_next(580, 11), + on.on_error(600, ex), + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 600) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 600) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -290,40 +258,33 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; std::runtime_error ex("filter predicate error"); - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600), + on.on_next(610, 12), + on.on_error(620, std::runtime_error("error in unsubscribed stream")), + on.on_completed(630) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [ex, xs, &invoked]() { #if RXCPP_USE_OBSERVABLE_MEMBERS return xs @@ -352,21 +313,19 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ ); THEN("the output only contains primes"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_error(380, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_error(380, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 380) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 380) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -382,34 +341,27 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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 xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600), + on.on_next(610, 12), + on.on_error(620, std::exception()), + on.on_completed(630) + }); auto res = w.make_subscriber(); @@ -449,21 +401,19 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") w.start(); THEN("the output only contains primes"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 450) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 450) + }); 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 index c0a9b60..0179909 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -1,15 +1,10 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" static const int static_tripletCount = 100; @@ -222,41 +217,28 @@ 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(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages ms; - typedef rxn::subscription life; - - typedef m::recorded_type irecord; - auto ion_next = m::on_next; - auto ion_completed = m::on_completed; - auto isubscribe = m::subscribe; - - typedef ms::recorded_type srecord; - auto son_next = ms::on_next; - auto son_completed = ms::on_completed; - auto ssubscribe = ms::subscribe; - - irecord int_messages[] = { - ion_next(100, 4), - ion_next(200, 2), - ion_next(300, 3), - ion_next(400, 1), - ion_completed(500) - }; - auto xs = sc.make_cold_observable(int_messages); - - srecord string_messages[] = { - son_next(50, "foo"), - son_next(100, "bar"), - son_next(150, "baz"), - son_next(200, "qux"), - son_completed(250) - }; - auto ys = sc.make_cold_observable(string_messages); + const rxsc::test::messages i_on; + const rxsc::test::messages s_on; + + auto xs = sc.make_cold_observable({ + i_on.on_next(100, 4), + i_on.on_next(200, 2), + i_on.on_next(300, 3), + i_on.on_next(400, 1), + i_on.on_completed(500) + }); + + auto ys = sc.make_cold_observable({ + s_on.on_next(50, "foo"), + s_on.on_next(100, "bar"), + s_on.on_next(150, "baz"), + s_on.on_next(200, "qux"), + s_on.on_completed(250) + }); WHEN("each int is mapped to the strings"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .flat_map( @@ -270,47 +252,44 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - srecord items[] = { - son_next(350, "foo"), - son_next(400, "bar"), - son_next(450, "baz"), - son_next(450, "foo"), - son_next(500, "qux"), - son_next(500, "bar"), - son_next(550, "baz"), - son_next(550, "foo"), - son_next(600, "qux"), - son_next(600, "bar"), - son_next(650, "baz"), - son_next(650, "foo"), - son_next(700, "qux"), - son_next(700, "bar"), - son_next(750, "baz"), - son_next(800, "qux"), - son_completed(850) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + s_on.on_next(350, "foo"), + s_on.on_next(400, "bar"), + s_on.on_next(450, "baz"), + s_on.on_next(450, "foo"), + s_on.on_next(500, "qux"), + s_on.on_next(500, "bar"), + s_on.on_next(550, "baz"), + s_on.on_next(550, "foo"), + s_on.on_next(600, "qux"), + s_on.on_next(600, "bar"), + s_on.on_next(650, "baz"), + s_on.on_next(650, "foo"), + s_on.on_next(700, "qux"), + s_on.on_next(700, "bar"), + s_on.on_next(750, "baz"), + s_on.on_next(800, "qux"), + s_on.on_completed(850) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ints"){ - life items[] = { - isubscribe(200, 700) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - ssubscribe(300, 550), - ssubscribe(400, 650), - ssubscribe(500, 750), - ssubscribe(600, 850) - }; - auto required = rxu::to_vector(items); + 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); } @@ -323,41 +302,29 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages ms; - typedef rxn::subscription life; - - typedef m::recorded_type irecord; - auto ion_next = m::on_next; - auto isubscribe = m::subscribe; - - typedef ms::recorded_type srecord; - auto son_next = ms::on_next; - auto son_completed = ms::on_completed; - auto ssubscribe = ms::subscribe; - - irecord int_messages[] = { - ion_next(100, 4), - ion_next(200, 2), - ion_next(300, 3), - ion_next(400, 1), - ion_next(500, 5), - ion_next(700, 0) - }; - auto xs = sc.make_cold_observable(int_messages); - - srecord string_messages[] = { - son_next(50, "foo"), - son_next(100, "bar"), - son_next(150, "baz"), - son_next(200, "qux"), - son_completed(250) - }; - auto ys = sc.make_cold_observable(string_messages); + const rxsc::test::messages i_on; + const rxsc::test::messages s_on; + + auto xs = sc.make_cold_observable({ + i_on.on_next(100, 4), + i_on.on_next(200, 2), + i_on.on_next(300, 3), + i_on.on_next(400, 1), + i_on.on_next(500, 5), + i_on.on_next(700, 0) + }); + + auto ys = sc.make_cold_observable({ + s_on.on_next(50, "foo"), + s_on.on_next(100, "bar"), + s_on.on_next(150, "baz"), + s_on.on_next(200, "qux"), + s_on.on_completed(250) + }); WHEN("each int is mapped to the strings"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) @@ -367,53 +334,50 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - srecord items[] = { - son_next(350, "foo"), - son_next(400, "bar"), - son_next(450, "baz"), - son_next(450, "foo"), - son_next(500, "qux"), - son_next(500, "bar"), - son_next(550, "baz"), - son_next(550, "foo"), - son_next(600, "qux"), - son_next(600, "bar"), - son_next(650, "baz"), - son_next(650, "foo"), - son_next(700, "qux"), - son_next(700, "bar"), - son_next(750, "baz"), - son_next(750, "foo"), - son_next(800, "qux"), - son_next(800, "bar"), - son_next(850, "baz"), - son_next(900, "qux"), - son_next(950, "foo") - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + s_on.on_next(350, "foo"), + s_on.on_next(400, "bar"), + s_on.on_next(450, "baz"), + s_on.on_next(450, "foo"), + s_on.on_next(500, "qux"), + s_on.on_next(500, "bar"), + s_on.on_next(550, "baz"), + s_on.on_next(550, "foo"), + s_on.on_next(600, "qux"), + s_on.on_next(600, "bar"), + s_on.on_next(650, "baz"), + s_on.on_next(650, "foo"), + s_on.on_next(700, "qux"), + s_on.on_next(700, "bar"), + s_on.on_next(750, "baz"), + s_on.on_next(750, "foo"), + s_on.on_next(800, "qux"), + s_on.on_next(800, "bar"), + s_on.on_next(850, "baz"), + s_on.on_next(900, "qux"), + s_on.on_next(950, "foo") + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ints"){ - life items[] = { - isubscribe(200, 1000) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - ssubscribe(300, 550), - ssubscribe(400, 650), - ssubscribe(500, 750), - ssubscribe(600, 850), - ssubscribe(700, 950), - ssubscribe(900, 1000) - }; - auto required = rxu::to_vector(items); + 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); } @@ -425,43 +389,30 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ GIVEN("two cold observables. one of ints. one of strings."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages ms; - typedef rxn::subscription life; - - typedef m::recorded_type irecord; - auto ion_next = m::on_next; - auto ion_completed = m::on_completed; - auto isubscribe = m::subscribe; - - typedef ms::recorded_type srecord; - auto son_next = ms::on_next; - auto son_error = ms::on_error; - auto ssubscribe = ms::subscribe; - - irecord int_messages[] = { - ion_next(100, 4), - ion_next(200, 2), - ion_next(300, 3), - ion_next(400, 1), - ion_completed(500) - }; - auto xs = sc.make_cold_observable(int_messages); + const rxsc::test::messages i_on; + const rxsc::test::messages s_on; + + auto xs = sc.make_cold_observable({ + i_on.on_next(100, 4), + i_on.on_next(200, 2), + i_on.on_next(300, 3), + i_on.on_next(400, 1), + i_on.on_completed(500) + }); std::runtime_error ex("filter on_error from inner source"); - srecord string_messages[] = { - son_next(55, "foo"), - son_next(104, "bar"), - son_next(153, "baz"), - son_next(202, "qux"), - son_error(301, ex) - }; - auto ys = sc.make_cold_observable(string_messages); + auto ys = sc.make_cold_observable({ + s_on.on_next(55, "foo"), + s_on.on_next(104, "bar"), + s_on.on_next(153, "baz"), + s_on.on_next(202, "qux"), + s_on.on_error(301, ex) + }); WHEN("each int is mapped to the strings"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .flat_map([&](int){return ys;}, [](int, std::string s){return s;}) @@ -471,39 +422,36 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ ); THEN("the output contains strings repeated for each int"){ - srecord items[] = { - son_next(355, "foo"), - son_next(404, "bar"), - son_next(453, "baz"), - son_next(455, "foo"), - son_next(502, "qux"), - son_next(504, "bar"), - son_next(553, "baz"), - son_next(555, "foo"), - son_error(601, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + s_on.on_next(355, "foo"), + s_on.on_next(404, "bar"), + s_on.on_next(453, "baz"), + s_on.on_next(455, "foo"), + s_on.on_next(502, "qux"), + s_on.on_next(504, "bar"), + s_on.on_next(553, "baz"), + s_on.on_next(555, "foo"), + s_on.on_error(601, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ints"){ - life items[] = { - isubscribe(200, 601) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - ssubscribe(300, 601), - ssubscribe(400, 601), - ssubscribe(500, 601), - ssubscribe(600, 601) - }; - auto required = rxu::to_vector(items); + 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); } diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp index 6952d44..7cf35b6 100644 --- a/Rx/v2/test/operators/lift.cpp +++ b/Rx/v2/test/operators/lift.cpp @@ -1,18 +1,12 @@ - #define RXCPP_USE_OBSERVABLE_MEMBERS 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" namespace detail { @@ -102,34 +96,28 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [&xs, &invoked]() { return xs .lift(liftfilter([&invoked](int x) { @@ -143,21 +131,19 @@ SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]" ); THEN("the output only contains primes that arrived before disposal"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -173,34 +159,28 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stre GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [&xs, &invoked]() { return xs >> liftfilter([&invoked](int x) { @@ -214,21 +194,19 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stre ); THEN("the output only contains primes that arrived before disposal"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -244,34 +222,28 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(rxu::to_vector(messages)); + auto xs = sc.make_hot_observable({ + on.on_next(110, 1), + on.on_next(180, 2), + on.on_next(230, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(380, 6), + on.on_next(390, 7), + on.on_next(450, 8), + on.on_next(470, 9), + on.on_next(560, 10), + on.on_next(580, 11), + on.on_completed(600) + }); WHEN("filtered to ints that are primes"){ - auto res = w.start( + auto res = w.start( [&xs, &invoked]() { auto predicate = [&](int x){ invoked++; @@ -298,21 +270,19 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ ); THEN("the output only contains primes that arrived before disposal"){ - record items[] = { - on_next(230, 3), - on_next(340, 5), - on_next(390, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 3), + on.on_next(340, 5), + on.on_next(390, 7) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp index db53387..4491511 100644 --- a/Rx/v2/test/operators/map.cpp +++ b/Rx/v2/test/operators/map.cpp @@ -1,48 +1,32 @@ - #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - + const rxsc::test::messages on; long invoked = 0; - record messages[] = { - 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 xs = sc.make_hot_observable(messages); + auto xs = sc.make_hot_observable({ + on.on_next(180, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(290, 4), + on.on_next(350, 5), + on.on_completed(400), + on.on_next(410, -1), + on.on_completed(420), + on.on_error(430, std::runtime_error("error on unsubscribed stream")) + }); WHEN("mapped to ints that are one larger"){ - auto res = w.start( + auto res = w.start( [xs, &invoked]() { return xs .map([&invoked](int x) { @@ -55,23 +39,21 @@ SCENARIO("map stops on completion", "[map][operators]"){ ); THEN("the output stops on completion"){ - record items[] = { - on_next(210, 3), - on_next(240, 4), - on_next(290, 5), - on_next(350, 6), - on_completed(400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 3), + on.on_next(240, 4), + on.on_next(290, 5), + on.on_next(350, 6), + on.on_completed(400) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 1e96068..d287fe0 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -1,15 +1,10 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" const int static_onnextcalls = 1000000; @@ -103,61 +98,46 @@ 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(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages> mo; - typedef rxn::subscription life; - - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - typedef mo::recorded_type orecord; - auto oon_next = mo::on_next; - auto oon_completed = mo::on_completed; - auto osubscribe = mo::subscribe; - - record messages1[] = { - 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 ys1 = sc.make_cold_observable(messages1); - - record messages2[] = { - on_next(10, 201), - on_next(20, 202), - on_next(30, 203), - on_next(40, 204), - on_completed(50) - }; - auto ys2 = sc.make_cold_observable(messages2); - - record messages3[] = { - on_next(10, 301), - on_next(20, 302), - on_next(30, 303), - on_next(40, 304), - on_next(120, 305), - on_completed(150) - }; - auto ys3 = sc.make_cold_observable(messages3); - - orecord omessages[] = { - oon_next(300, ys1), - oon_next(400, ys2), - oon_next(500, ys3), - oon_completed(600) - }; - auto xs = sc.make_hot_observable(omessages); + const rxsc::test::messages on; + const rxsc::test::messages> o_on; + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_completed(50) + }); + + auto ys3 = sc.make_cold_observable({ + on.on_next(10, 301), + on.on_next(20, 302), + on.on_next(30, 303), + on.on_next(40, 304), + on.on_next(120, 305), + on.on_completed(150) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.on_next(400, ys2), + o_on.on_next(500, ys3), + o_on.on_completed(600) + }); WHEN("each int is merged"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .merge() @@ -167,61 +147,56 @@ SCENARIO("merge completes", "[merge][join][operators]"){ ); THEN("the output contains merged ints"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 103), + on.on_next(410, 201), + on.on_next(420, 104), + on.on_next(420, 202), + on.on_next(430, 203), + on.on_next(440, 204), + on.on_next(510, 105), + on.on_next(510, 301), + on.on_next(520, 106), + on.on_next(520, 302), + on.on_next(530, 303), + on.on_next(540, 304), + on.on_next(620, 305), + on.on_completed(650) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the xs"){ - life items[] = { - subscribe(200, 600) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(300, 530) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(400, 450) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(500, 650) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(500, 650) + }); auto actual = ys3.subscriptions(); REQUIRE(required == actual); } @@ -233,53 +208,39 @@ 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(); - typedef rxsc::test::messages m; - typedef rxsc::test::messages> mo; - typedef rxn::subscription life; - - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - typedef mo::recorded_type orecord; - auto oon_next = mo::on_next; - auto oon_completed = mo::on_completed; - auto osubscribe = mo::subscribe; - - record messages1[] = { - 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 ys1 = sc.make_cold_observable(messages1); - - record messages2[] = { - on_next(10, 201), - on_next(20, 202), - on_next(30, 203), - on_next(40, 204), - on_completed(50) - }; - auto ys2 = sc.make_cold_observable(messages2); - - record messages3[] = { - on_next(10, 301), - on_next(20, 302), - on_next(30, 303), - on_next(40, 304), - on_next(120, 305), - on_completed(150) - }; - auto ys3 = sc.make_cold_observable(messages3); + const rxsc::test::messages on; + const rxsc::test::messages> o_on; + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_completed(50) + }); + + auto ys3 = sc.make_cold_observable({ + on.on_next(10, 301), + on.on_next(20, 302), + on.on_next(30, 303), + on.on_next(40, 304), + on.on_next(120, 305), + on.on_completed(150) + }); WHEN("each int is merged"){ - auto res = w.start( + auto res = w.start( [&]() { return ys1 .merge(ys2, ys3); @@ -287,52 +248,48 @@ SCENARIO("variadic merge completes", "[merge][join][operators]"){ ); THEN("the output contains merged ints"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 101), + on.on_next(210, 201), + on.on_next(210, 301), + on.on_next(220, 102), + on.on_next(220, 202), + on.on_next(220, 302), + on.on_next(230, 203), + on.on_next(230, 303), + on.on_next(240, 204), + on.on_next(240, 304), + on.on_next(310, 103), + on.on_next(320, 104), + on.on_next(320, 305), + on.on_next(410, 105), + on.on_next(420, 106), + on.on_completed(430) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription to the ys1"){ - life items[] = { - subscribe(200, 430) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 350) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 350) + }); auto actual = ys3.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 7c6fd5f..5972ac2 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -1,15 +1,10 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" @@ -51,30 +46,24 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ GIVEN("a test hot observable of longs"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record messages[] = { - 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 xs = sc.make_hot_observable(messages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(110, 7), + on.on_next(220, 3), + on.on_next(280, 4), + on.on_next(290, 1), + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.on_next(410, 13), + on.on_next(430, 2), + on.on_next(450, 9), + on.on_next(520, 11), + on.on_next(560, 20), + on.on_completed(600) + }); auto res = w.make_subscriber(); @@ -140,25 +129,23 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ w.start(); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(340, 8), - on_next(360, 5), - on_next(370, 6), - on_next(390, 7), - on_next(520, 11) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.on_next(520, 11) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there were 3 subscription/unsubscription"){ - life items[] = { - subscribe(300, 400), - subscribe(500, 550), - subscribe(650, 800) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(300, 400), + on.subscribe(500, 550), + on.subscribe(650, 800) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -172,33 +159,26 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; std::runtime_error ex("publish on_error"); - record messages[] = { - 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 xs = sc.make_hot_observable(messages); + auto xs = sc.make_hot_observable({ + on.on_next(110, 7), + on.on_next(220, 3), + on.on_next(280, 4), + on.on_next(290, 1), + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.on_next(410, 13), + on.on_next(430, 2), + on.on_next(450, 9), + on.on_next(520, 11), + on.on_next(560, 20), + on.on_error(600, ex) + }); auto res = w.make_subscriber(); @@ -250,26 +230,24 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ w.start(); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(340, 8), + on.on_next(360, 5), + on.on_next(370, 6), + on.on_next(390, 7), + on.on_next(520, 11), + on.on_next(560, 20), + on.on_error(600, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there were 3 subscription/unsubscription"){ - life items[] = { - subscribe(300, 400), - subscribe(500, 600) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(300, 400), + on.subscribe(500, 600) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/reduce.cpp b/Rx/v2/test/operators/reduce.cpp index a45354b..4872ca5 100644 --- a/Rx/v2/test/operators/reduce.cpp +++ b/Rx/v2/test/operators/reduce.cpp @@ -1,16 +1,8 @@ - #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("reduce some data with seed", "[reduce][operators]"){ diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp index 27ab1c5..3615ff2 100644 --- a/Rx/v2/test/operators/scan.cpp +++ b/Rx/v2/test/operators/scan.cpp @@ -1,45 +1,30 @@ - #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("scan some data with seed", "[scan][operators]"){ GIVEN("a test hot observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; int seed = 1; - record messages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto xs = sc.make_hot_observable(messages); + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); WHEN("mapped to ints that are one larger"){ - auto res = w.start( + auto res = w.start( [&]() { return xs .scan(seed, [](int sum, int x) { @@ -51,23 +36,21 @@ SCENARIO("scan some data with seed", "[scan][operators]"){ ); THEN("the output stops on completion"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, seed + 2), + on.on_next(220, seed + 2 + 3), + on.on_next(230, seed + 2 + 3 + 4), + on.on_next(240, seed + 2 + 3 + 4 + 5), + on.on_completed(250) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 250) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/switch_on_next.cpp b/Rx/v2/test/operators/switch_on_next.cpp index f6f70b0..7831d48 100644 --- a/Rx/v2/test/operators/switch_on_next.cpp +++ b/Rx/v2/test/operators/switch_on_next.cpp @@ -1,15 +1,9 @@ #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){ diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 26582f1..f87b9df 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -1,15 +1,8 @@ #include "rxcpp/rx.hpp" -namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("take 2", "[take][operators]"){ @@ -64,40 +57,34 @@ SCENARIO("take, complete after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(690) + }); WHEN("20 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(20) @@ -107,36 +94,34 @@ SCENARIO("take, complete after", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(690) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 690) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 690) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -149,41 +134,34 @@ SCENARIO("take, complete same", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(690) + }); WHEN("17 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(17) @@ -193,36 +171,34 @@ SCENARIO("take, complete same", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(630) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 630) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 630) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -235,41 +211,34 @@ SCENARIO("take, complete before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(690) + }); WHEN("10 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(10) @@ -279,29 +248,27 @@ SCENARIO("take, complete before", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_completed(415) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 415) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 415) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -314,43 +281,36 @@ SCENARIO("take, error after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; std::runtime_error ex("take on_error from source"); - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_error(690, ex) + }); WHEN("20 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(20) @@ -360,36 +320,34 @@ SCENARIO("take, error after", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_error(690, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 690) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 690) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -402,41 +360,34 @@ SCENARIO("take, error same", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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")) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_error(690, std::runtime_error("error in unsubscribed stream")) + }); WHEN("17 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(17) @@ -446,36 +397,34 @@ SCENARIO("take, error same", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - 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 required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(630) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 630) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 630) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -488,41 +437,34 @@ SCENARIO("take, error before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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")) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_error(690, std::runtime_error("error in unsubscribed stream")) + }); WHEN("3 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -532,22 +474,20 @@ SCENARIO("take, error before", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 9), - on_next(230, 13), - on_next(270, 7), - on_completed(270) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_completed(270) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 270) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 270) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -560,40 +500,33 @@ SCENARIO("take, dispose before", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10) + }); WHEN("3 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -604,20 +537,18 @@ SCENARIO("take, dispose before", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 9), - on_next(230, 13) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 250) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -630,40 +561,33 @@ SCENARIO("take, dispose after", "[take][operators]"){ GIVEN("a source"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - 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) - }; - auto xs = sc.make_hot_observable(xmessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10) + }); WHEN("3 values are taken"){ - auto res = w.start( + auto res = w.start( [xs]() { return xs .take(3) @@ -674,22 +598,20 @@ SCENARIO("take, dispose after", "[take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 9), - on_next(230, 13), - on_next(270, 7), - on_completed(270) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_completed(270) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 270) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 270) + }); auto actual = xs.subscriptions(); REQUIRE(required == actual); } @@ -704,34 +626,26 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record xmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto xs = sc.make_hot_observable(xmessages); - - record ymessages[] = { - on_next(150, 1), - on_next(225, 99), - on_completed(230) - }; - auto ys = sc.make_hot_observable(ymessages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto ys = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 99), + on.on_completed(230) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [xs, ys]() { return xs .take_until(ys) @@ -741,30 +655,27 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_completed(225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_completed(225) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = ys.subscriptions(); REQUIRE(required == actual); } @@ -777,34 +688,26 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_next(225, 99), - on_completed(230) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 99), + on.on_completed(230) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -814,30 +717,27 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_completed(225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_completed(225) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -850,35 +750,27 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; std::runtime_error ex("take_until on_error from source"); - record lmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_error(225, ex) - }; - auto r = sc.make_hot_observable(rmessages); + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(225, ex) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -888,30 +780,27 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_error(225, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_error(225, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -924,33 +813,25 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_completed(225) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(225) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -960,32 +841,29 @@ SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -998,32 +876,24 @@ 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(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1), - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1033,32 +903,29 @@ SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(210, 2), - on_next(220, 3), - on_next(230, 4), - on_next(240, 5), - on_completed(250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 250) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 250) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1071,29 +938,21 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_next(225, 2), //! - on_completed(250) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 2), //! + on.on_completed(250) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1103,28 +962,25 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_completed(225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_completed(225) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1137,30 +993,22 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; std::runtime_error ex("take_until on_error from source"); - record lmessages[] = { - on_next(150, 1) - }; - auto l = sc.make_hot_observable(lmessages); + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); - record rmessages[] = { - on_next(150, 1), - on_error(225, ex) - }; - auto r = sc.make_hot_observable(rmessages); + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(225, ex) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1170,28 +1018,25 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_error(225, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_error(225, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1204,28 +1049,20 @@ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_completed(225) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(225) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1235,25 +1072,23 @@ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - auto required = std::vector(); + auto required = std::vector::recorded_type>(); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 1000 /* can't dispose prematurely, could be in flight to dispatch OnError */) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1266,27 +1101,19 @@ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1296,25 +1123,23 @@ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - auto required = std::vector(); + auto required = std::vector::recorded_type>(); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 1000) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 1000) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 1000) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1327,31 +1152,23 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; - - record lmessages[] = { - on_next(150, 1), - on_next(230, 2), - on_completed(240) - }; - auto l = sc.make_hot_observable(lmessages); - - record rmessages[] = { - on_next(150, 1), - on_next(210, 2), //! - on_completed(220) - }; - auto r = sc.make_hot_observable(rmessages); + const rxsc::test::messages on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(230, 2), + on.on_completed(240) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), //! + on.on_completed(220) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1361,28 +1178,25 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_completed(210) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_completed(210) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 210) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 210) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 210) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } @@ -1395,33 +1209,25 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; bool sourceNotDisposed = false; - record lmessages[] = { - on_next(150, 1), - on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come - on_completed(240) - }; - auto l = sc.make_hot_observable(lmessages); + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come + on.on_completed(240) + }); - record rmessages[] = { - on_next(150, 1), - on_next(210, 2), //! - on_completed(220) - }; - auto r = sc.make_hot_observable(rmessages); + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), //! + on.on_completed(220) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r, &sourceNotDisposed]() { return l .map([&sourceNotDisposed](int v){sourceNotDisposed = true; return v;}) @@ -1432,10 +1238,9 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_completed(210) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_completed(210) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -1454,33 +1259,25 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; bool signalNotDisposed = false; - record lmessages[] = { - on_next(150, 1), - on_next(230, 2), - on_completed(240) - }; - auto l = sc.make_hot_observable(lmessages); + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(230, 2), + on.on_completed(240) + }); - record rmessages[] = { - on_next(150, 1), - on_next(250, 2), - on_completed(260) - }; - auto r = sc.make_hot_observable(rmessages); + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(250, 2), + on.on_completed(260) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r, &signalNotDisposed]() { return l .take_until(r @@ -1491,11 +1288,10 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_next(230, 2), - on_completed(240) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(230, 2), + on.on_completed(240) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -1514,31 +1310,23 @@ SCENARIO("take_until, error some", "[take_until][take][operators]"){ GIVEN("2 sources"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; std::runtime_error ex("take_until on_error from source"); - record lmessages[] = { - on_next(150, 1), - on_error(225, ex) - }; - auto l = sc.make_hot_observable(lmessages); + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(225, ex) + }); - record rmessages[] = { - on_next(150, 1), - on_next(240, 2) - }; - auto r = sc.make_hot_observable(rmessages); + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(240, 2) + }); WHEN("one is taken until the other emits a marble"){ - auto res = w.start( + auto res = w.start( [l, r]() { return l .take_until(r) @@ -1548,28 +1336,25 @@ SCENARIO("take_until, error some", "[take_until][take][operators]"){ ); THEN("the output only contains items sent while subscribed"){ - record items[] = { - on_error(225, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_error(225, ex) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was 1 subscription/unsubscription to the source"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + 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"){ - life items[] = { - subscribe(200, 225) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 225) + }); auto actual = r.subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp index 18d4e42..ea44b4d 100644 --- a/Rx/v2/test/sources/defer.cpp +++ b/Rx/v2/test/sources/defer.cpp @@ -1,29 +1,16 @@ - #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" SCENARIO("defer stops on completion", "[defer][operators]"){ GIVEN("a test cold observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - auto subscribe = m::subscribe; + const rxsc::test::messages on; long invoked = 0; @@ -37,16 +24,15 @@ SCENARIO("defer stops on completion", "[defer][operators]"){ auto error = rx::observable<>::error(std::exception_ptr()); auto runtimeerror = rx::observable<>::error(std::runtime_error("runtime")); - auto res = w.start( + auto res = w.start( [&]() { return rx::observable<>::defer( [&](){ invoked++; - record messages[] = { - on_next(100, sc.clock()), - on_completed(200) - }; - xs.reset(sc.make_cold_observable(messages)); + xs.reset(sc.make_cold_observable({ + on.on_next(100, sc.clock()), + on.on_completed(200) + })); return xs.get(); }) // forget type to workaround lambda deduction bug on msvc 2013 @@ -55,20 +41,18 @@ SCENARIO("defer stops on completion", "[defer][operators]"){ ); THEN("the output stops on completion"){ - record items[] = { - on_next(300, 200L), - on_completed(400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(300, 200L), + on.on_completed(400) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } THEN("there was one subscription and one unsubscription"){ - life items[] = { - subscribe(200, 400) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.subscribe(200, 400) + }); auto actual = xs.get().subscriptions(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index 63c6503..49d68e2 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -1,16 +1,9 @@ - #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; -namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 9664173..4d8faf7 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -1,18 +1,13 @@ - #define RXCPP_SUBJECT_TEST_ASYNC 1 #include "rxcpp/rx.hpp" namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxo=rxcpp::operators; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; namespace rxsub=rxcpp::subjects; -namespace rxn=rxcpp::notifications; #include "rxcpp/rx-test.hpp" -namespace rxt=rxcpp::test; - #include "catch.hpp" #include @@ -443,26 +438,22 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - - record messages[] = { - 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) - }; - auto xs = sc.make_hot_observable(messages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 1), + on.on_next(110, 2), + on.on_next(220, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7), + on.on_next(630, 8), + on.on_next(710, 9), + on.on_next(870, 10), + on.on_next(940, 11), + on.on_next(1020, 12) + }); rxsub::subject s; @@ -502,32 +493,29 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ w.start(); THEN("result1 contains expected messages"){ - record items[] = { - on_next(340, 5), - on_next(410, 6), - on_next(520, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7) + }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } THEN("result2 contains expected messages"){ - record items[] = { - on_next(410, 6), - on_next(520, 7), - on_next(630, 8) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(410, 6), + on.on_next(520, 7), + on.on_next(630, 8) + }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } THEN("result3 contains expected messages"){ - record items[] = { - on_next(940, 11) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(940, 11) + }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } @@ -541,27 +529,21 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; - - record messages[] = { - 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")) - }; - auto xs = sc.make_hot_observable(messages); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 1), + on.on_next(110, 2), + on.on_next(220, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7), + on.on_completed(630), + on.on_next(640, 9), + on.on_completed(650), + on.on_error(660, std::runtime_error("error on unsubscribed stream")) + }); rxsub::subject s; @@ -601,32 +583,29 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ w.start(); THEN("result1 contains expected messages"){ - record items[] = { - on_next(340, 5), - on_next(410, 6), - on_next(520, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7) + }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } THEN("result2 contains expected messages"){ - record items[] = { - on_next(410, 6), - on_next(520, 7), - on_completed(630) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(410, 6), + on.on_next(520, 7), + on.on_completed(630) + }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } THEN("result3 contains expected messages"){ - record items[] = { - on_completed(900) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_completed(900) + }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } @@ -641,29 +620,23 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); - typedef rxsc::test::messages m; - typedef rxn::subscription life; - typedef m::recorded_type record; - auto on_next = m::on_next; - auto on_error = m::on_error; - auto on_completed = m::on_completed; + const rxsc::test::messages on; std::runtime_error ex("subject on_error in stream"); - record messages[] = { - 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")) - }; - auto xs = sc.make_hot_observable(messages); + auto xs = sc.make_hot_observable({ + on.on_next(70, 1), + on.on_next(110, 2), + on.on_next(220, 3), + on.on_next(270, 4), + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7), + on.on_error(630, ex), + on.on_next(640, 9), + on.on_completed(650), + on.on_error(660, std::runtime_error("error on unsubscribed stream")) + }); rxsub::subject s; @@ -703,32 +676,29 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ w.start(); THEN("result1 contains expected messages"){ - record items[] = { - on_next(340, 5), - on_next(410, 6), - on_next(520, 7) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(340, 5), + on.on_next(410, 6), + on.on_next(520, 7) + }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); } THEN("result2 contains expected messages"){ - record items[] = { - on_next(410, 6), - on_next(520, 7), - on_error(630, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_next(410, 6), + on.on_next(520, 7), + on.on_error(630, ex) + }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); } THEN("result3 contains expected messages"){ - record items[] = { - on_error(900, ex) - }; - auto required = rxu::to_vector(items); + auto required = rxu::to_vector({ + on.on_error(900, ex) + }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); } -- GitLab From 61dc7e637140c6d9697099cdf062e4b084167036 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Wed, 25 Jun 2014 17:41:38 +0400 Subject: [PATCH 351/782] Convert tabs to spaces --- Rx/v2/test/operators/buffer.cpp | 6 ++-- Rx/v2/test/operators/combine_latest.cpp | 10 +++---- Rx/v2/test/operators/concat.cpp | 40 ++++++++++++------------- Rx/v2/test/operators/concat_map.cpp | 10 +++---- Rx/v2/test/operators/filter.cpp | 8 ++--- Rx/v2/test/operators/merge.cpp | 32 ++++++++++---------- Rx/v2/test/operators/take.cpp | 12 ++++---- Rx/v2/test/sources/defer.cpp | 2 +- 8 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index 2153f8d..c98a6e1 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -20,7 +20,7 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ on.on_next(230, 4), on.on_next(240, 5), on.on_completed(250) - }); + }); WHEN("group each int with the next 2 ints"){ @@ -40,7 +40,7 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ v_on.on_next(250, rxu::to_vector(4, 5)), v_on.on_next(250, rxu::to_vector(5)), v_on.on_completed(250) - }); + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -48,7 +48,7 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ 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); } diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.cpp index fb13953..512db72 100644 --- a/Rx/v2/test/operators/combine_latest.cpp +++ b/Rx/v2/test/operators/combine_latest.cpp @@ -16,7 +16,7 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato on.on_next(215, 2), on.on_next(225, 4), on.on_completed(230) - }); + }); auto o2 = sc.make_hot_observable({ on.on_next(150, 1), @@ -25,7 +25,7 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato on.on_next(235, 6), on.on_next(240, 7), on.on_completed(250) - }); + }); WHEN("each int is combined with the latest from the other source"){ @@ -46,7 +46,7 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato on.on_next(235, 4 + 6), on.on_next(240, 4 + 7), on.on_completed(250) - }); + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -54,7 +54,7 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato 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); } @@ -62,7 +62,7 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato 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); } diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 59a1813..619894a 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -108,7 +108,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ on.on_next(210, 105), on.on_next(220, 106), on.on_completed(230) - }); + }); auto ys2 = sc.make_cold_observable({ on.on_next(10, 201), @@ -116,7 +116,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ on.on_next(30, 203), on.on_next(40, 204), on.on_completed(50) - }); + }); auto ys3 = sc.make_cold_observable({ on.on_next(10, 301), @@ -125,14 +125,14 @@ SCENARIO("concat completes", "[concat][join][operators]"){ on.on_next(40, 304), on.on_next(120, 305), on.on_completed(150) - }); + }); auto xs = sc.make_hot_observable({ o_on.on_next(300, ys1), o_on.on_next(400, ys2), o_on.on_next(500, ys3), o_on.on_completed(600) - }); + }); WHEN("each int is merged"){ @@ -147,23 +147,23 @@ SCENARIO("concat completes", "[concat][join][operators]"){ THEN("the output contains merged ints"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 103), - on.on_next(420, 104), - on.on_next(510, 105), + on.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 103), + on.on_next(420, 104), + on.on_next(510, 105), on.on_next(520, 106), on.on_next(540, 201), on.on_next(550, 202), on.on_next(560, 203), on.on_next(570, 204), - on.on_next(590, 301), - on.on_next(600, 302), - on.on_next(610, 303), - on.on_next(620, 304), - on.on_next(700, 305), - on.on_completed(730) - }); + on.on_next(590, 301), + on.on_next(600, 302), + on.on_next(610, 303), + on.on_next(620, 304), + on.on_next(700, 305), + on.on_completed(730) + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -171,7 +171,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ 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); } @@ -179,7 +179,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ 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); } @@ -187,7 +187,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ 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); } @@ -195,7 +195,7 @@ SCENARIO("concat completes", "[concat][join][operators]"){ 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 index c05fb18..4f6b675 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -187,7 +187,7 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ i_on.on_next(100, 4), i_on.on_next(200, 2), i_on.on_completed(500) - }); + }); auto ys = sc.make_cold_observable({ s_on.on_next(50, "foo"), @@ -195,7 +195,7 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ s_on.on_next(150, "baz"), s_on.on_next(200, "qux"), s_on.on_completed(250) - }); + }); WHEN("each int is mapped to the strings"){ @@ -223,7 +223,7 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ s_on.on_next(700, "baz"), s_on.on_next(750, "qux"), s_on.on_completed(800) - }); + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -231,7 +231,7 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ 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); } @@ -240,7 +240,7 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ 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/filter.cpp b/Rx/v2/test/operators/filter.cpp index 4d56dfa..529f10a 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -123,7 +123,7 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ on.on_next(560, 10), on.on_next(580, 11), on.on_completed(600) - }); + }); WHEN("filtered to ints that are primes"){ @@ -201,7 +201,7 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ on.on_next(610, 12), on.on_error(620, std::runtime_error("error in unsubscribed stream")), on.on_completed(630) - }); + }); WHEN("filtered to ints that are primes"){ @@ -280,7 +280,7 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ on.on_next(610, 12), on.on_error(620, std::runtime_error("error in unsubscribed stream")), on.on_completed(630) - }); + }); WHEN("filtered to ints that are primes"){ @@ -361,7 +361,7 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") on.on_next(610, 12), on.on_error(620, std::exception()), on.on_completed(630) - }); + }); auto res = w.make_subscriber(); diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index d287fe0..73af651 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -148,22 +148,22 @@ SCENARIO("merge completes", "[merge][join][operators]"){ THEN("the output contains merged ints"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 103), - on.on_next(410, 201), - on.on_next(420, 104), - on.on_next(420, 202), - on.on_next(430, 203), - on.on_next(440, 204), - on.on_next(510, 105), - on.on_next(510, 301), - on.on_next(520, 106), - on.on_next(520, 302), - on.on_next(530, 303), - on.on_next(540, 304), - on.on_next(620, 305), - on.on_completed(650) + on.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 103), + on.on_next(410, 201), + on.on_next(420, 104), + on.on_next(420, 202), + on.on_next(430, 203), + on.on_next(440, 204), + on.on_next(510, 105), + on.on_next(510, 301), + on.on_next(520, 106), + on.on_next(520, 302), + on.on_next(530, 303), + on.on_next(540, 304), + on.on_next(620, 305), + on.on_completed(650) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index f87b9df..39db55f 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -80,7 +80,7 @@ SCENARIO("take, complete after", "[take][operators]"){ on.on_next(590, 5), on.on_next(630, 10), on.on_completed(690) - }); + }); WHEN("20 values are taken"){ @@ -113,7 +113,7 @@ SCENARIO("take, complete after", "[take][operators]"){ on.on_next(590, 5), on.on_next(630, 10), on.on_completed(690) - }); + }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } @@ -121,7 +121,7 @@ SCENARIO("take, complete after", "[take][operators]"){ 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); } @@ -641,7 +641,7 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ on.on_next(150, 1), on.on_next(225, 99), on.on_completed(230) - }); + }); WHEN("one is taken until the other emits a marble"){ @@ -697,13 +697,13 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ on.on_next(230, 4), on.on_next(240, 5), on.on_completed(250) - }); + }); auto r = sc.make_hot_observable({ on.on_next(150, 1), on.on_next(225, 99), on.on_completed(230) - }); + }); WHEN("one is taken until the other emits a marble"){ diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp index ea44b4d..bf4779e 100644 --- a/Rx/v2/test/sources/defer.cpp +++ b/Rx/v2/test/sources/defer.cpp @@ -32,7 +32,7 @@ SCENARIO("defer stops on completion", "[defer][operators]"){ xs.reset(sc.make_cold_observable({ on.on_next(100, sc.clock()), on.on_completed(200) - })); + })); return xs.get(); }) // forget type to workaround lambda deduction bug on msvc 2013 -- GitLab From 284476f7d0f174631643c951692b992a22612365 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 26 Jun 2014 23:52:53 -0700 Subject: [PATCH 352/782] fix bug in map --- Rx/v2/src/rxcpp/operators/rx-map.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index eda923a..6719f1c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -27,10 +27,10 @@ struct map } template - struct map_observer : public observer_base + struct map_observer : public observer_base { typedef map_observer this_type; - typedef observer_base base_type; + typedef observer_base base_type; typedef typename base_type::value_type value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; -- GitLab From 9291de7e0f4298deaa58c87edad97ea5ac91533a Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 30 Jun 2014 18:50:04 +0400 Subject: [PATCH 353/782] Implement "repeat" operator --- Rx/v2/src/rxcpp/operators/rx-repeat.hpp | 122 ++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 21 ++++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 3 files changed, 144 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-repeat.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp new file mode 100644 index 0000000..91f59b8 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp @@ -0,0 +1,122 @@ +// 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_REPEAT_HPP) +#define RXCPP_OPERATORS_RX_REPEAT_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct repeat : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type count_type; + struct values + { + values(source_type s, count_type t) + : source(std::move(s)) + , remaining(std::move(t)) + , repeat_infinitely(t == 0) + { + } + source_type source; + count_type remaining; + bool repeat_infinitely; + }; + values initial; + + repeat(source_type s, count_type t) + : initial(std::move(s), std::move(t)) + { + } + + template + void on_subscribe(const Subscriber& s) const { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , public values + { + state_type(const values& i, const output_type& oarg) + : values(i) + , source_lifetime(composite_subscription::empty()) + , out(oarg) + { + } + composite_subscription source_lifetime; + output_type out; + + void do_subscribe() { + auto state = this->shared_from_this(); + + state->source_lifetime = composite_subscription(); + 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](std::exception_ptr e) { + state->out.on_error(e); + }, + // on_completed + [state]() { + if (state->repeat_infinitely || (--state->remaining > 0)) { + state->do_subscribe(); + } else { + state->out.on_completed(); + } + } + ); + } + }; + + // take a copy of the values for each subscription + auto state = std::shared_ptr(new state_type(initial, s)); + + // start the first iteration + state->do_subscribe(); + } +}; + +template +class repeat_factory +{ + typedef typename std::decay::type count_type; + count_type count; +public: + repeat_factory(count_type t) : count(std::move(t)) {} + + template + auto operator()(Observable&& source) + -> observable::type::value_type, repeat::type::value_type, Observable, count_type>> { + return observable::type::value_type, repeat::type::value_type, Observable, count_type>>( + repeat::type::value_type, Observable, count_type>(std::forward(source), count)); + } +}; + +} + +template +auto repeat(T&& t) +-> detail::repeat_factory { + return detail::repeat_factory(std::forward(t)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index b1b59fa..cffd448 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -760,6 +760,27 @@ public: return observable>( rxo::detail::take_until(*this, std::forward(t), std::forward(sf))); } + + /// repeat -> + /// infinitely repeate this observable + /// + /// + auto repeat() const + -> observable> { + return observable>( + rxo::detail::repeat(*this, 0)); + } + + /// repeat -> + /// repeate this observable for given number of times + /// + /// + template + auto repeat(Count t) const + -> observable> { + return observable>( + rxo::detail::repeat(*this, t)); + } }; template diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index fbc2c01..01d7a94 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -54,5 +54,6 @@ namespace rxo=operators; #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" +#include "operators/rx-repeat.hpp" #endif -- GitLab From 7e7880f65b514d2dc215a0e4ff62861cb923af34 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 30 Jun 2014 18:51:03 +0400 Subject: [PATCH 354/782] Add tests for repeat --- Rx/v2/test/operators/repeat.cpp | 347 ++++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 348 insertions(+) create mode 100644 Rx/v2/test/operators/repeat.cpp diff --git a/Rx/v2/test/operators/repeat.cpp b/Rx/v2/test/operators/repeat.cpp new file mode 100644 index 0000000..10361ea --- /dev/null +++ b/Rx/v2/test/operators/repeat.cpp @@ -0,0 +1,347 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 on; + + auto xs = sc.make_cold_observable({ + on.on_next(100, 1), + on.on_next(150, 2), + on.on_next(200, 3), + on.on_completed(250) + }); + + 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 3 sets of ints"){ + auto required = rxu::to_vector({ + on.on_next(300, 1), + on.on_next(350, 2), + on.on_next(400, 3), + on.on_next(550, 1), + on.on_next(600, 2), + on.on_next(650, 3), + on.on_next(800, 1), + on.on_next(850, 2), + on.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, 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 on; + + auto xs = sc.make_cold_observable({ + on.on_next(100, 1), + on.on_next(150, 2), + on.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.on_next(300, 1), + on.on_next(350, 2), + on.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 on; + + std::runtime_error ex("repeat on_error from source"); + + auto xs = sc.make_cold_observable({ + on.on_next(100, 1), + on.on_next(150, 2), + on.on_next(200, 3), + on.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.on_next(300, 1), + on.on_next(350, 2), + on.on_next(400, 3), + on.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 on; + + auto xs = sc.make_cold_observable({ + on.on_next(5, 1), + on.on_next(10, 2), + on.on_next(15, 3), + on.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.on_next(205, 1), + on.on_next(210, 2), + on.on_next(215, 3), + on.on_next(225, 1), + on.on_next(230, 2), + on.on_next(235, 3), + on.on_next(245, 1), + on.on_next(250, 2), + on.on_next(255, 3), + on.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 on; + + auto xs = sc.make_cold_observable({ + on.on_next(5, 1), + on.on_next(10, 2), + on.on_next(15, 3), + on.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.on_next(205, 1), + on.on_next(210, 2), + on.on_next(215, 3), + on.on_next(225, 1), + on.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 on; + + auto xs = sc.make_cold_observable({ + on.on_next(100, 1), + on.on_next(150, 2), + on.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.on_next(300, 1), + on.on_next(350, 2), + on.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 on; + + std::runtime_error ex("repeat on_error from source"); + + auto xs = sc.make_cold_observable({ + on.on_next(100, 1), + on.on_next(150, 2), + on.on_next(200, 3), + on.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.on_next(300, 1), + on.on_next(350, 2), + on.on_next(400, 3), + on.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/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 8778802..e5ebf7f 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -45,6 +45,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/reduce.cpp + ${TEST_DIR}/operators/repeat.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/flat_map.cpp -- GitLab From 10dc69d10c8d52abbb3d2ef872ffb9b97dfdb1dc Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 30 Jun 2014 18:54:06 +0400 Subject: [PATCH 355/782] Sort the list of operators --- Rx/v2/src/rxcpp/rx-operators.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 01d7a94..4495c5d 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -34,26 +34,26 @@ namespace rxo=operators; } -#include "operators/rx-lift.hpp" #include "operators/rx-buffer_count.hpp" -#include "operators/rx-subscribe.hpp" -#include "operators/rx-filter.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-distinct_until_changed.hpp" +#include "operators/rx-filter.hpp" +#include "operators/rx-flat_map.hpp" +#include "operators/rx-lift.hpp" #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" -#include "operators/rx-flat_map.hpp" -#include "operators/rx-concat.hpp" -#include "operators/rx-concat_map.hpp" -#include "operators/rx-combine_latest.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-publish.hpp" -#include "operators/rx-ref_count.hpp" -#include "operators/rx-connect_forever.hpp" #include "operators/rx-reduce.hpp" +#include "operators/rx-ref_count.hpp" +#include "operators/rx-repeat.hpp" #include "operators/rx-scan.hpp" +#include "operators/rx-subscribe.hpp" #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" -#include "operators/rx-repeat.hpp" #endif -- GitLab From 93f6bfa604bacf2a645ffe9a7ef569137a754f1e Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Wed, 2 Jul 2014 19:16:41 +0400 Subject: [PATCH 356/782] Add tests for combine_latest --- Rx/v2/test/operators/combine_latest.cpp | 1583 ++++++++++++++++++++++- 1 file changed, 1582 insertions(+), 1 deletion(-) diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.cpp index 512db72..2916d20 100644 --- a/Rx/v2/test/operators/combine_latest.cpp +++ b/Rx/v2/test/operators/combine_latest.cpp @@ -32,7 +32,12 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato auto res = w.start( [&]() { return o2 - .combine_latest([](int v2, int v1){return v2 + v1;}, o1) + .combine_latest( + [](int v2, int v1){ + return v2 + v1; + }, + o1 + ) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); } @@ -69,3 +74,1579 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato } } } + +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 on; + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(230) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_error(230, ex) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(250) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.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 on; + + const size_t N = 16; + + std::vector> n; + for (int i = 0; i < N; ++i) { + n.push_back( + sc.make_hot_observable({ + on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15] + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output is empty"){ + auto required = std::vector::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 &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 on; + + const size_t N = 16; + + std::vector> e; + for (int i = 0; i < N; ++i) { + e.push_back( + sc.make_hot_observable({ + on.on_next(150, 1), + on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] + ) + // 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.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 &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 on; + + auto n = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.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::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 on; + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(210) + }); + + auto n = sc.make_hot_observable({ + on.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::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 on; + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(210) + }); + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.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.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 on; + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(220) + }); + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto n = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.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::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 on; + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(220) + }); + + auto n = sc.make_hot_observable({ + on.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::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 on; + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(230) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(220, 3), + on.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.on_next(220, 2 + 3), + on.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto emp = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(230) + }); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(220, ex) + }); + + auto emp = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_completed(230) + }); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(220, ex) + }); + + auto ret = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.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.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 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.on_next(150, 1), + on.on_error(220, ex1) + }); + + auto err2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 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.on_next(150, 1), + on.on_next(210, 2), + on.on_error(220, ex1) + }); + + auto err2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 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.on_next(150, 1), + on.on_error(230, ex1) + }); + + auto err2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto n = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(220, ex) + }); + + auto n = sc.make_hot_observable({ + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto ret = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_completed(215) + }); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto err = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(220, ex) + }); + + auto ret = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.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.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]"){ + GIVEN("2 hot observables of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(230) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(220, 3), + on.on_completed(240) + }); + + WHEN("each int is combined with the latest from the other source"){ + + auto res = w.start( + [&]() { + return o1 + .combine_latest( + [&ex](int v2, int v1) -> int { + throw 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.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]"){ + GIVEN("N hot observables of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + const int N = 16; + + std::runtime_error ex("combine_latest on_error from source"); + + std::vector> e; + for (int i = 0; i < N; ++i) { + e.push_back( + sc.make_hot_observable({ + on.on_next(210 + 10 * i, 1), + on.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 v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) -> int { + throw ex; + }, + e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output contains only error"){ + auto required = rxu::to_vector({ + on.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 &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 on; + + const int N = 16; + + std::vector> o; + for (int i = 0; i < N; ++i) { + o.push_back( + sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210 + 10 * i, i + 1), + on.on_next(410 + 10 * i, i + N + 1), + on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) { + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11], o[12], o[13], o[14], o[15] + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output contains combined ints"){ + auto required = rxu::to_vector({ + on.on_next(200 + 10 * N, N * (N + 1) / 2) + }); + for (int i = 0; i < N; ++i) { + required.push_back(on.on_next(410 + 10 * i, N * (N + 1) / 2 + N + N * i)); + } + required.push_back(on.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 &s){ + auto required = rxu::to_vector({ + on.subscribe(200, 800) + }); + auto actual = s.subscriptions(); + REQUIRE(required == actual); + }); + } + } + } +} -- GitLab From 4b3902a5d7efa3d0f22141b23578fe470a36f1c8 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 12:23:45 +0400 Subject: [PATCH 357/782] Implement skip operator --- Rx/v2/src/rxcpp/operators/rx-skip.hpp | 126 ++++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 11 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 3 files changed, 138 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-skip.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp new file mode 100644 index 0000000..f986697 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -0,0 +1,126 @@ +// 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_SKIP_HPP) +#define RXCPP_OPERATORS_RX_SKIP_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct skip : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type 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, + triggered, + errored, + stopped + }; + }; + + template + void on_subscribe(const Subscriber& s) const { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , public values + { + state_type(const values& i, const output_type& oarg) + : values(i) + , mode_value(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::shared_ptr(new 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](std::exception_ptr e) { + state->mode_value = mode::errored; + state->out.on_error(e); + }, + // on_completed + [state]() { + state->mode_value = mode::stopped; + state->out.on_completed(); + } + ); + } +}; + +template +class skip_factory +{ + typedef typename std::decay::type count_type; + count_type count; +public: + skip_factory(count_type t) : count(std::move(t)) {} + template + auto operator()(Observable&& source) + -> observable::type::value_type, skip::type::value_type, Observable, count_type>> { + return observable::type::value_type, skip::type::value_type, Observable, count_type>>( + skip::type::value_type, Observable, count_type>(std::forward(source), count)); + } +}; + +} + +template +auto skip(T&& t) + -> detail::skip_factory { + return detail::skip_factory(std::forward(t)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index cffd448..a844c8a 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -724,6 +724,17 @@ public: rxo::detail::scan(*this, std::forward(a), seed)); } + /// skip -> + /// make new observable with skipped first count items from this observable + /// + /// + template + auto skip(Count t) const + -> observable> { + return observable>( + rxo::detail::skip(*this, t)); + } + /// take -> /// for the first count items from this observable emit them from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 4495c5d..251fcb6 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -51,6 +51,7 @@ namespace rxo=operators; #include "operators/rx-ref_count.hpp" #include "operators/rx-repeat.hpp" #include "operators/rx-scan.hpp" +#include "operators/rx-skip.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" -- GitLab From f85433824dde257748bc2f47b4c16b7b4faba41a Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 12:24:24 +0400 Subject: [PATCH 358/782] Add tests for skip operator --- Rx/v2/test/operators/skip.cpp | 637 ++++++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 638 insertions(+) create mode 100644 Rx/v2/test/operators/skip.cpp diff --git a/Rx/v2/test/operators/skip.cpp b/Rx/v2/test/operators/skip.cpp new file mode 100644 index 0000000..72ede48 --- /dev/null +++ b/Rx/v2/test/operators/skip.cpp @@ -0,0 +1,637 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +SCENARIO("skip, complete after", "[skip][operators]"){ + GIVEN("a source"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.on_completed(690) + }); + + 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 complete message"){ + auto required = rxu::to_vector({ + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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 on; + + std::runtime_error ex("skip on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.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 on; + + std::runtime_error ex("skip on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.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 on; + + std::runtime_error ex("skip on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.on_next(630, 10), + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.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::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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.on_next(410, 15), + on.on_next(415, 16), + on.on_next(460, 72), + on.on_next(510, 76), + on.on_next(560, 32), + on.on_next(570, -100), + on.on_next(580, -3), + on.on_next(590, 5), + on.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.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(70, 6), + on.on_next(150, 4), + on.on_next(210, 9), + on.on_next(230, 13), + on.on_next(270, 7), + on.on_next(280, 1), + on.on_next(300, -1), + on.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.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.on_next(310, 3), + on.on_next(340, 8), + on.on_next(370, 11), + on.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/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index e5ebf7f..de1bec2 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -46,6 +46,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/repeat.cpp + ${TEST_DIR}/operators/skip.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/flat_map.cpp -- GitLab From 9a8997b00f114d7a8ed79bd1796599e083a83992 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 12:25:50 +0400 Subject: [PATCH 359/782] Sort the list of operator test files --- projects/CMake/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index de1bec2..332b3e9 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -38,20 +38,20 @@ set(TEST_SOURCES ${TEST_DIR}/operators/buffer.cpp ${TEST_DIR}/operators/combine_latest.cpp ${TEST_DIR}/operators/concat.cpp - ${TEST_DIR}/operators/merge.cpp - ${TEST_DIR}/operators/lift.cpp - ${TEST_DIR}/operators/filter.cpp + ${TEST_DIR}/operators/concat_map.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp - ${TEST_DIR}/operators/scan.cpp - ${TEST_DIR}/operators/switch_on_next.cpp + ${TEST_DIR}/operators/filter.cpp + ${TEST_DIR}/operators/flat_map.cpp + ${TEST_DIR}/operators/lift.cpp + ${TEST_DIR}/operators/map.cpp + ${TEST_DIR}/operators/merge.cpp + ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/repeat.cpp + ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/skip.cpp + ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/take.cpp - ${TEST_DIR}/operators/publish.cpp - ${TEST_DIR}/operators/flat_map.cpp - ${TEST_DIR}/operators/concat_map.cpp - ${TEST_DIR}/operators/map.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From 311ad4fc0e8600b9461fc5589651d71079661cd6 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 14:46:19 +0400 Subject: [PATCH 360/782] Move tests for take_until to separate file --- Rx/v2/test/operators/take.cpp | 743 --------------------------- Rx/v2/test/operators/take_until.cpp | 747 ++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 3 files changed, 748 insertions(+), 743 deletions(-) create mode 100644 Rx/v2/test/operators/take_until.cpp diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 39db55f..34d2a4c 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -619,746 +619,3 @@ SCENARIO("take, dispose after", "[take][operators]"){ } } } - - - -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 on; - - auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) - }); - - auto ys = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(225, 99), - on.on_completed(230) - }); - - WHEN("one is taken until the other emits a marble"){ - - auto res = w.start( - [xs, ys]() { - return xs - .take_until(ys) - // 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.on_next(210, 2), - on.on_next(220, 3), - on.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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(225, 99), - on.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.on_next(210, 2), - on.on_next(220, 3), - on.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 on; - - std::runtime_error ex("take_until on_error from source"); - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.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.on_next(210, 2), - on.on_next(220, 3), - on.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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.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.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) - }); - - auto r = sc.make_hot_observable({ - on.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.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(225, 2), //! - on.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.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 on; - - std::runtime_error ex("take_until on_error from source"); - - auto l = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.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.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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.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::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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto r = sc.make_hot_observable({ - on.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::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 on; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(230, 2), - on.on_completed(240) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), //! - on.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.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 on; - - bool sourceNotDisposed = false; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come - on.on_completed(240) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), //! - on.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.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 on; - - bool signalNotDisposed = false; - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(230, 2), - on.on_completed(240) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(250, 2), - on.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.on_next(230, 2), - on.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 on; - - std::runtime_error ex("take_until on_error from source"); - - auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(225, ex) - }); - - auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.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.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); - } - - } - } -} diff --git a/Rx/v2/test/operators/take_until.cpp b/Rx/v2/test/operators/take_until.cpp new file mode 100644 index 0000000..432b7e3 --- /dev/null +++ b/Rx/v2/test/operators/take_until.cpp @@ -0,0 +1,747 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto ys = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 99), + on.on_completed(230) + }); + + WHEN("one is taken until the other emits a marble"){ + + auto res = w.start( + [xs, ys]() { + return xs + .take_until(ys) + // 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.on_next(210, 2), + on.on_next(220, 3), + on.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 99), + on.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.on_next(210, 2), + on.on_next(220, 3), + on.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 on; + + std::runtime_error ex("take_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.on_next(210, 2), + on.on_next(220, 3), + on.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.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.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 2), //! + on.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.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 on; + + std::runtime_error ex("take_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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::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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.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::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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(230, 2), + on.on_completed(240) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), //! + on.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.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 on; + + bool sourceNotDisposed = false; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come + on.on_completed(240) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), //! + on.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.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 on; + + bool signalNotDisposed = false; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(230, 2), + on.on_completed(240) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(250, 2), + on.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.on_next(230, 2), + on.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 on; + + std::runtime_error ex("take_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_error(225, ex) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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); + } + + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 332b3e9..684fcb1 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -52,6 +52,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/skip.cpp ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/take.cpp + ${TEST_DIR}/operators/take_until.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From d501bc73bd873a0ae264974c1f4c750872d8b7f4 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 17:23:52 +0400 Subject: [PATCH 361/782] Implement skip_until operator --- Rx/v2/src/rxcpp/operators/rx-skip_until.hpp | 198 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 28 ++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 3 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-skip_until.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp new file mode 100644 index 0000000..49441e4 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp @@ -0,0 +1,198 @@ +// 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_SKIP_UNTIL_HPP) +#define RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct skip_until : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type trigger_source_type; + typedef typename std::decay::type 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 + void on_subscribe(Subscriber s) const { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , 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::shared_ptr(new 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( + // 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](std::exception_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](std::exception_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(); + } + ); + } +}; + +template +class skip_until_factory +{ + typedef typename std::decay::type trigger_source_type; + typedef typename std::decay::type coordination_type; + + trigger_source_type trigger_source; + coordination_type coordination; +public: + skip_until_factory(trigger_source_type t, coordination_type sf) + : trigger_source(std::move(t)) + , coordination(std::move(sf)) + { + } + template + auto operator()(Observable&& source) + -> observable::type::value_type, skip_until::type::value_type, Observable, trigger_source_type, Coordination>> { + return observable::type::value_type, skip_until::type::value_type, Observable, trigger_source_type, Coordination>>( + skip_until::type::value_type, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); + } +}; + +} + +template +auto skip_until(TriggerObservable&& t, Coordination&& sf) + -> detail::skip_until_factory { + return detail::skip_until_factory(std::forward(t), std::forward(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a844c8a..e0e90c2 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -735,6 +735,32 @@ public: rxo::detail::skip(*this, t)); } + /// skip_until -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// make new observable with items skipped until on_next occurs on the TriggerSource + /// + /// + template + auto skip_until(TriggerSource&& t) const + -> typename std::enable_if::value, + observable>>::type { + return observable>( + rxo::detail::skip_until(*this, std::forward(t), identity_one_worker(rxsc::make_current_thread()))); + } + + /// skip_until -> + /// The coordination is used to synchronize sources from different contexts. + /// make new observable with items skipped until on_next occurs on the TriggerSource + /// + /// + template + auto skip_until(TriggerSource&& t, Coordination&& sf) const + -> typename std::enable_if::value && is_coordination::value, + observable>>::type { + return observable>( + rxo::detail::skip_until(*this, std::forward(t), std::forward(sf))); + } + /// take -> /// for the first count items from this observable emit them from the new observable that is returned. /// @@ -773,7 +799,7 @@ public: } /// repeat -> - /// infinitely repeate this observable + /// infinitely repeat this observable /// /// auto repeat() const diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 251fcb6..cd9410f 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -52,6 +52,7 @@ namespace rxo=operators; #include "operators/rx-repeat.hpp" #include "operators/rx-scan.hpp" #include "operators/rx-skip.hpp" +#include "operators/rx-skip_until.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" -- GitLab From efad96449bcedd34babe6e4b3fe42dd518c6a5cf Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 17:24:20 +0400 Subject: [PATCH 362/782] Add tests for skip_until operator --- Rx/v2/test/operators/skip_until.cpp | 564 ++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 565 insertions(+) create mode 100644 Rx/v2/test/operators/skip_until.cpp diff --git a/Rx/v2/test/operators/skip_until.cpp b/Rx/v2/test/operators/skip_until.cpp new file mode 100644 index 0000000..51db1ba --- /dev/null +++ b/Rx/v2/test/operators/skip_until.cpp @@ -0,0 +1,564 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 99), + on.on_completed(230) + }); + + 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 items sent while subscribed"){ + auto required = rxu::to_vector({ + on.on_next(230, 4), + on.on_next(240, 5), + on.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 on; + + std::runtime_error ex("skip_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("skip_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_error(220, ex) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(230, 3), + on.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.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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::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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(225, 2), + on.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::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 on; + + std::runtime_error ex("skip_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + std::runtime_error ex("skip_until on_error from source"); + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + auto r = sc.make_hot_observable({ + on.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::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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.on_next(150, 1), + on.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::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 on; + + auto l = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto r = sc.make_hot_observable({ + on.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::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); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 684fcb1..de7e3f3 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -50,6 +50,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/repeat.cpp ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/skip.cpp + ${TEST_DIR}/operators/skip_until.cpp ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/take_until.cpp -- GitLab From c4081892d9482b1af18ed322b19344986ef46cf4 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 17:30:18 +0400 Subject: [PATCH 363/782] Fix state transition on take_until and add comments to states to facilitate reading in future --- Rx/v2/src/rxcpp/operators/rx-skip.hpp | 8 ++++---- Rx/v2/src/rxcpp/operators/rx-take.hpp | 8 ++++---- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp index f986697..9a36969 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -38,10 +38,10 @@ struct skip : public operator_base struct mode { enum type { - skipping, - triggered, - errored, - stopped + skipping, // ignore messages + triggered, // capture messages + errored, // error occured + stopped // observable completed }; }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index 46bca55..5043385 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -38,10 +38,10 @@ struct take : public operator_base struct mode { enum type { - taking, - triggered, - errored, - stopped + taking, // capture messages + triggered, // ignore messages + errored, // error occured + stopped // observable completed }; }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 00dc952..510a4ae 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -42,11 +42,11 @@ struct take_until : public operator_base struct mode { enum type { - taking, - clear, - triggered, - errored, - stopped + taking, // no messages from trigger + clear, // trigger completed + triggered, // trigger sent on_next + errored, // error either on trigger or on observable + stopped // observable completed }; }; @@ -145,7 +145,7 @@ struct take_until : public operator_base // on_completed [state]() { if (state->mode_value > mode::clear) {return;} - state->mode_value = mode::triggered; + state->mode_value = mode::stopped; state->out.on_completed(); } ); -- GitLab From c0e03e4b40e4dbec6c5fb8d64db20a3411ab9fee Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 3 Jul 2014 18:11:51 +0400 Subject: [PATCH 364/782] Repair GCC compilation --- Rx/v2/src/rxcpp/operators/rx-skip.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp index 9a36969..3fa7209 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -55,7 +55,7 @@ struct skip : public operator_base { state_type(const values& i, const output_type& oarg) : values(i) - , mode_value(count > 0 ? mode::skipping : mode::triggered) + , mode_value(i.count > 0 ? mode::skipping : mode::triggered) , out(oarg) { } -- GitLab From ffadb4fca617d10f36d2d3c1821527c00d66b07b Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 7 Jul 2014 18:10:50 +0400 Subject: [PATCH 365/782] Add tests for operators buffer, distinct_until_changed, scan, switch_on_next --- Rx/v2/test/operators/buffer.cpp | 407 +++++++++++++++++- .../test/operators/distinct_until_changed.cpp | 251 ++++++++++- Rx/v2/test/operators/scan.cpp | 239 +++++++++- Rx/v2/test/operators/switch_on_next.cpp | 283 +++++++++++- 4 files changed, 1172 insertions(+), 8 deletions(-) diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index c98a6e1..f02d8fe 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -6,6 +6,197 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.on_completed(250) + }); + + 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.on_next(250, rxu::to_vector({ 2, 3, 4, 5 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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.on_next(220, rxu::to_vector({ 2, 3 })), + v_on.on_next(240, rxu::to_vector({ 4, 5 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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.on_next(230, rxu::to_vector({ 2, 3, 4 })), + v_on.on_next(250, rxu::to_vector({ 5 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + std::runtime_error ex("buffer on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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.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(); @@ -35,10 +226,58 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(230, rxu::to_vector(2, 3, 4)), - v_on.on_next(240, rxu::to_vector(3, 4, 5)), - v_on.on_next(250, rxu::to_vector(4, 5)), - v_on.on_next(250, rxu::to_vector(5)), + v_on.on_next(230, rxu::to_vector({ 2, 3, 4 })), + v_on.on_next(240, rxu::to_vector({ 3, 4, 5 })), + v_on.on_next(250, rxu::to_vector({ 4, 5 })), + v_on.on_next(250, rxu::to_vector({ 5 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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.on_next(220, rxu::to_vector({ 2, 3 })), + v_on.on_next(250, rxu::to_vector({ 5 })), v_on.on_completed(250) }); auto actual = res.get_observer().messages(); @@ -52,7 +291,167 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ 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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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.on_next(280, rxu::to_vector({ 2, 3, 4 })), + v_on.on_next(350, rxu::to_vector({ 4, 5, 6 })), + v_on.on_next(420, rxu::to_vector({ 6, 7, 8 })), + v_on.on_next(600, rxu::to_vector({ 8, 9 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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.on_next(280, rxu::to_vector({ 2, 3, 4 })), + v_on.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 on; + const rxsc::test::messages> v_on; + + std::runtime_error ex("buffer on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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.on_next(280, rxu::to_vector({ 2, 3, 4 })), + v_on.on_next(350, rxu::to_vector({ 4, 5, 6 })), + v_on.on_next(420, rxu::to_vector({ 6, 7, 8 })), + v_on.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); + } } } } diff --git a/Rx/v2/test/operators/distinct_until_changed.cpp b/Rx/v2/test/operators/distinct_until_changed.cpp index 7df96ee..150b086 100644 --- a/Rx/v2/test/operators/distinct_until_changed.cpp +++ b/Rx/v2/test/operators/distinct_until_changed.cpp @@ -1,10 +1,257 @@ #include "rxcpp/rx.hpp" -namespace rxu=rxcpp::util; -namespace rxsc=rxcpp::schedulers; +namespace rxu = rxcpp::util; +namespace rxsc = rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + WHEN("distinct values are taken"){ + + auto res = w.start( + [xs]() { + return xs.distinct_until_changed(); + } + ); + + THEN("the output is empty"){ + auto required = std::vector::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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.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.on_next(210, 2), + on.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 on; + + std::runtime_error ex("distinct_until_changed on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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 on; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 2), + on.on_next(230, 2), + on.on_next(240, 2), + on.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.on_next(210, 2), + on.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(); diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp index 3615ff2..58ec27e 100644 --- a/Rx/v2/test/operators/scan.cpp +++ b/Rx/v2/test/operators/scan.cpp @@ -5,7 +5,188 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.hpp" -SCENARIO("scan some data with seed", "[scan][operators]"){ +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 on; + + int seed = 1; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + }); + + 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 is empty"){ + auto required = std::vector::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 on; + + int seed = 1; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + int seed = 1; + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(220, 2), + on.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.on_next(220, seed + 2), + on.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 on; + + int seed = 1; + + std::runtime_error ex("scan on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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(); @@ -57,3 +238,59 @@ SCENARIO("scan some data with seed", "[scan][operators]"){ } } } + +SCENARIO("scan: seed, accumulator throws", "[scan][operators]"){ + GIVEN("a test hot observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + int seed = 1; + + std::runtime_error ex("scan on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(210, 2), + on.on_next(220, 3), + on.on_next(230, 4), + on.on_next(240, 5), + on.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) { + throw 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.on_next(210, seed + 2), + on.on_next(220, seed + 2 + 3), + on.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/switch_on_next.cpp b/Rx/v2/test/operators/switch_on_next.cpp index 7831d48..9a06b68 100644 --- a/Rx/v2/test/operators/switch_on_next.cpp +++ b/Rx/v2/test/operators/switch_on_next.cpp @@ -2,6 +2,7 @@ namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxsc=rxcpp::schedulers; +namespace rxn=rx::notifications; #include "rxcpp/rx-test.hpp" #include "catch.hpp" @@ -74,7 +75,7 @@ SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){ THEN("there was 1 subscription/unsubscription to the source"){ auto required = rxu::to_vector({ - on.subscribe(200, 600) + o_on.subscribe(200, 600) }); auto actual = xs.subscriptions(); REQUIRE(required == actual); @@ -106,3 +107,283 @@ SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){ } } } + +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 on; + const rxsc::test::messages> o_on; + + std::runtime_error ex("switch_on_next on_error from source"); + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_error(50, ex) + }); + + auto ys3 = sc.make_cold_observable({ + on.on_next(10, 301), + on.on_next(20, 302), + on.on_next(30, 303), + on.on_next(40, 304), + on.on_completed(150) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.on_next(400, ys2), + o_on.on_next(500, ys3), + o_on.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.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 201), + on.on_next(420, 202), + on.on_next(430, 203), + on.on_next(440, 204), + on.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(); + 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 on; + const rxsc::test::messages> o_on; + + std::runtime_error ex("switch_on_next on_error from source"); + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto ys2 = sc.make_cold_observable({ + on.on_next(10, 201), + on.on_next(20, 202), + on.on_next(30, 203), + on.on_next(40, 204), + on.on_completed(50) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.on_next(400, ys2), + o_on.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.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 201), + on.on_next(420, 202), + on.on_next(430, 203), + on.on_next(440, 204), + on.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 on; + const rxsc::test::messages> o_on; + + auto xs = sc.make_hot_observable({ + o_on.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.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 on; + const rxsc::test::messages> o_on; + + auto ys1 = sc.make_cold_observable({ + on.on_next(10, 101), + on.on_next(20, 102), + on.on_next(110, 103), + on.on_next(120, 104), + on.on_next(210, 105), + on.on_next(220, 106), + on.on_completed(230) + }); + + auto xs = sc.make_hot_observable({ + o_on.on_next(300, ys1), + o_on.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.on_next(310, 101), + on.on_next(320, 102), + on.on_next(410, 103), + on.on_next(420, 104), + on.on_next(510, 105), + on.on_next(520, 106), + on.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); + } + } + } +} -- GitLab From d5f89a402a76b32665f1bb5cc394dda163a02842 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 30 Jun 2014 15:10:09 -0700 Subject: [PATCH 366/782] add as_dynamic, remove incorrect coordination of subscriber --- Rx/v2/src/rxcpp/rx-observer.hpp | 118 ++++++++++---------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 4 + Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 24 ++-- 3 files changed, 79 insertions(+), 67 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index d9f20a0..2dff1e8 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -131,63 +131,6 @@ public: } }; -template -class observer : public observer_base -{ - typedef observer this_type; - typedef typename std::decay::type inner_t; - - inner_t inner; - - observer(); -public: - ~observer() - { - } - observer(const this_type& o) - : inner(o.inner) - { - } - observer(this_type&& o) - : inner(std::move(o.inner)) - { - } - explicit observer(inner_t inner) - : inner(std::move(inner)) - { - } - this_type& operator=(this_type o) { - inner = std::move(o.inner); - return *this; - } - template - void on_next(V&& v) const { - inner.on_next(std::forward(v)); - } - void on_error(std::exception_ptr e) const { - inner.on_error(e); - } - void on_completed() const { - inner.on_completed(); - } -}; -template -class observer : public observer_base -{ - typedef observer this_type; -public: - observer() - { - } - template - void on_next(V&&) const { - } - void on_error(std::exception_ptr) const { - } - void on_completed() const { - } -}; - template class dynamic_observer { @@ -276,6 +219,67 @@ public: } }; + +template +class observer : public observer_base +{ + typedef observer this_type; + typedef typename std::decay::type inner_t; + + inner_t inner; + + observer(); +public: + ~observer() + { + } + observer(const this_type& o) + : inner(o.inner) + { + } + observer(this_type&& o) + : inner(std::move(o.inner)) + { + } + explicit observer(inner_t inner) + : inner(std::move(inner)) + { + } + this_type& operator=(this_type o) { + inner = std::move(o.inner); + return *this; + } + template + void on_next(V&& v) const { + inner.on_next(std::forward(v)); + } + void on_error(std::exception_ptr e) const { + inner.on_error(e); + } + void on_completed() const { + inner.on_completed(); + } + observer as_dynamic() const { + return observer(dynamic_observer(inner)); + } +}; +template +class observer : public observer_base +{ + typedef observer this_type; +public: + observer() + { + } + template + void on_next(V&&) const { + } + void on_error(std::exception_ptr) const { + } + void on_completed() const { + } +}; + template auto make_observer() -> observer { diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index cea6337..90cc7d4 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -80,6 +80,10 @@ public: return lifetime; } + subscriber as_dynamic() const { + return subscriber(lifetime, destination.as_dynamic()); + } + // observer // template diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 46408f8..a128016 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -55,8 +55,8 @@ class synchronize_observer : public detail::multicast_observer if (current == mode::Empty) { current = mode::Processing; auto keepAlive = this->shared_from_this(); - auto processor = coordinator.get_worker(); - processor.schedule(lifetime, [keepAlive, this](const rxsc::schedulable& self){ + + auto drain_queue = [keepAlive, this](const rxsc::schedulable& self){ try { std::unique_lock guard(lock); if (!destination.is_subscribed()) { @@ -80,7 +80,17 @@ class synchronize_observer : public detail::multicast_observer std::unique_lock 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()); } } @@ -129,14 +139,8 @@ public: // creates a worker whose lifetime is the same as the destination subscription auto coordinator = cn.create_coordinator(dl); - auto selectedDest = on_exception( - [&](){return coordinator.out(o);}, - o); - if (selectedDest.empty()) { - return; - } - state = std::make_shared(std::move(coordinator), std::move(il), std::move(selectedDest.get())); + state = std::make_shared(std::move(coordinator), std::move(il), std::move(o)); } template -- GitLab From ad7e64d00025351d9784905216ca6c8386e5800b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 1 Jul 2014 08:33:37 -0700 Subject: [PATCH 367/782] more work on coordination --- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 13 +++- Rx/v2/src/rxcpp/rx-coordination.hpp | 47 ++++++++++++-- Rx/v2/src/rxcpp/rx-observable.hpp | 68 +++++++++++++++------ Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 6 +- Rx/v2/src/rxcpp/sources/rx-error.hpp | 32 ++++++---- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 43 +++++++++---- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 63 ++++++++++--------- Rx/v2/src/rxcpp/sources/rx-range.hpp | 16 +++-- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 23 ++++++- Rx/v2/test/operators/take.cpp | 2 + 10 files changed, 225 insertions(+), 88 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 510a4ae..2f25e74 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -124,7 +124,7 @@ struct take_until : public operator_base } trigger->subscribe(std::move(selectedSinkTrigger.get())); - source.get().subscribe( + auto sinkSource = make_subscriber( // split subscription lifetime state->source_lifetime, // on_next @@ -149,6 +149,13 @@ struct take_until : public operator_base 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())); } }; @@ -177,9 +184,9 @@ public: } template -auto take_until(TriggerObservable&& t, Coordination&& sf) +auto take_until(TriggerObservable t, Coordination sf) -> detail::take_until_factory { - return detail::take_until_factory(std::forward(t), std::forward(sf)); + return detail::take_until_factory(std::move(t), std::move(sf)); } } diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index 39cd134..1a3c6f3 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -119,12 +119,15 @@ class identity_one_worker : public coordination_base , factory(rxsc::make_same_worker(w)) { } - rxsc::worker get_worker() const { + inline rxsc::worker get_worker() const { return controller; } - rxsc::scheduler get_scheduler() const { + inline rxsc::scheduler get_scheduler() const { return factory; } + inline rxsc::scheduler::clock_type::time_point now() const { + return factory.now(); + } template auto in(Observable o) const -> Observable { @@ -148,12 +151,26 @@ public: typedef coordinator coordinator_type; - coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { + 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; +} + class serialize_one_worker : public coordination_base { rxsc::scheduler factory; @@ -227,12 +244,15 @@ class serialize_one_worker : public coordination_base , lock(std::move(m)) { } - rxsc::worker get_worker() const { + inline rxsc::worker get_worker() const { return controller; } - rxsc::scheduler get_scheduler() const { + inline rxsc::scheduler get_scheduler() const { return factory; } + inline rxsc::scheduler::clock_type::time_point now() const { + return factory.now(); + } template auto in(Observable o) const -> Observable { @@ -256,13 +276,28 @@ public: typedef coordinator coordinator_type; - coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { + 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 lock = std::make_shared(); 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; +} + + } #endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index e0e90c2..1d4bc1d 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -371,7 +371,7 @@ public: /// auto switch_on_next() const -> typename switch_on_next_result::type { - return switch_on_next_result::make(this, identity_one_worker(rxsc::make_current_thread())); + return switch_on_next_result::make(this, identity_current_thread()); } /// switch_on_next (AKA Switch) -> @@ -417,7 +417,7 @@ public: /// auto merge() const -> typename merge_result::type { - return merge_result::make(this, identity_one_worker(rxsc::make_current_thread())); + return merge_result::make(this, identity_current_thread()); } /// merge -> @@ -465,7 +465,7 @@ public: auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const -> observable::value_type, rxo::detail::flat_map> { return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_one_worker(rxsc::make_current_thread()))); + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); } /// flat_map (AKA SelectMany) -> @@ -511,7 +511,7 @@ public: /// auto concat() const -> typename concat_result::type { - return concat_result::make(this, identity_one_worker(rxsc::make_current_thread())); + return concat_result::make(this, identity_current_thread()); } /// concat -> @@ -557,7 +557,7 @@ public: auto concat_map(CollectionSelector&& s, ResultSelector&& rs) const -> observable::value_type, rxo::detail::concat_map> { return observable::value_type, rxo::detail::concat_map>( - rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_one_worker(rxsc::make_current_thread()))); + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); } /// concat_map -> @@ -587,7 +587,7 @@ public: -> typename std::enable_if::value && !is_observable::value && rxu::all_true::value...>::value, delayed_combine_latest>::type::type { return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(identity_one_worker(rxsc::make_current_thread()), std::forward(s), std::make_tuple(*this, on...))); + rxo::detail::combine_latest(identity_current_thread(), std::forward(s), std::make_tuple(*this, on...))); } /// combine_latest -> @@ -611,7 +611,7 @@ public: -> typename std::enable_if::value...>::value, delayed_combine_latest>::type::type { return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(identity_one_worker(rxsc::make_current_thread()), rxu::pack(), std::make_tuple(*this, on...))); + rxo::detail::combine_latest(identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...))); } /// combine_latest -> @@ -778,11 +778,11 @@ public: /// /// template - auto take_until(TriggerSource&& t) const + auto take_until(TriggerSource t) const -> typename std::enable_if::value, observable>>::type { return observable>( - rxo::detail::take_until(*this, std::forward(t), identity_one_worker(rxsc::make_current_thread()))); + rxo::detail::take_until(*this, std::move(t), identity_current_thread())); } /// take_until -> @@ -791,15 +791,40 @@ public: /// /// template - auto take_until(TriggerSource&& t, Coordination&& sf) const + auto take_until(TriggerSource t, Coordination sf) const -> typename std::enable_if::value && is_coordination::value, observable>>::type { return observable>( - rxo::detail::take_until(*this, std::forward(t), std::forward(sf))); + rxo::detail::take_until(*this, std::move(t), std::move(sf))); + } + + /// take_until -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. + /// + /// + template + auto take_until(TimePoint when) const + -> typename std::enable_if::value, + observable>>::type { + auto cn = identity_current_thread(); + return take_until(rxs::interval(when, cn), cn); + } + + /// take_until -> + /// The coordination is used to synchronize sources from different contexts. + /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. + /// + /// + template + auto take_until(rxsc::scheduler::clock_type::time_point when, Coordination cn) const + -> typename std::enable_if::value, + observable>>::type { + return take_until(rxs::interval(when, cn), cn); } /// repeat -> - /// infinitely repeat this observable + /// infinitely repeats this observable /// /// auto repeat() const @@ -809,7 +834,7 @@ public: } /// repeat -> - /// repeate this observable for given number of times + /// repeats this observable for given number of times /// /// template @@ -838,8 +863,8 @@ class observable public: template static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1) - -> decltype(rxs::range(first, last, step, identity_one_worker(rxsc::make_current_thread()))) { - return rxs::range(first, last, step, identity_one_worker(rxsc::make_current_thread())); + -> decltype(rxs::range(first, last, step, identity_current_thread())) { + return rxs::range(first, last, step, identity_current_thread()); } template static auto range(T first, T last, ptrdiff_t step, Coordination cn) @@ -866,6 +891,15 @@ public: -> decltype(rxs::defer(std::move(of))) { return rxs::defer(std::move(of)); } + static auto interval(rxsc::scheduler::clock_type::time_point when) + -> decltype(rxs::interval(when)) { + return rxs::interval(when); + } + template + static auto interval(rxsc::scheduler::clock_type::time_point when, Coordination cn) + -> decltype(rxs::interval(when, std::move(cn))) { + return rxs::interval(when, std::move(cn)); + } static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period) -> decltype(rxs::interval(initial, period)) { return rxs::interval(initial, period); @@ -877,8 +911,8 @@ public: } template static auto iterate(Collection c) - -> decltype(rxs::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread()))) { - return rxs::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread())); + -> decltype(rxs::iterate(std::move(c), identity_current_thread())) { + return rxs::iterate(std::move(c), identity_current_thread()); } template static auto iterate(Collection c, Coordination cn) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 336cf1b..068125a 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -45,12 +45,12 @@ public: virtual clock_type::time_point to_time_point(long absolute) const { - return clock_type::time_point(clock_type::duration(absolute)); + return clock_type::time_point(std::chrono::milliseconds(absolute)); } virtual long to_relative(clock_type::duration d) const { - return static_cast(d.count()); + return static_cast(std::chrono::duration_cast(d).count()); } }; @@ -79,7 +79,7 @@ public: } virtual void schedule(clock_type::time_point when, const schedulable& scbl) const { - state->schedule_absolute(state->to_relative(when - now()), scbl); + state->schedule_relative(state->to_relative(when - now()), scbl); } void schedule_absolute(absolute when, const schedulable& scbl) const { diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index 439f01a..4b2c4bb 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -47,17 +47,23 @@ struct error : public source_base auto controller = coordinator.get_output().get_worker(); auto exception = initial.exception; - controller.schedule( - [=](const rxsc::schedulable&){ - auto& dest = o; - if (!dest.is_subscribed()) { - // terminate loop - return; - } - - dest.on_error(exception); - // o is unsubscribed - }); + 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()); } }; @@ -82,8 +88,8 @@ auto make_error(throw_instance_tag&&, E e, Coordination cn) template auto error(E e) - -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_one_worker(rxsc::make_immediate()))) { - return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_one_worker(rxsc::make_immediate())); + -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate())) { + return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate()); } template auto error(E e, Coordination cn) diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 7916359..4860acc 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -52,29 +52,50 @@ struct interval : public source_base auto counter = std::make_shared(0); - controller.schedule_periodically( - initial.initial, - initial.period, - [o, counter](const rxsc::schedulable&) { - // send next value - o.on_next(++(*counter)); - }); + 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 +template struct delay_resolution { typedef observable> type; }; +} +template +static auto interval(TimePoint when) + -> typename detail::delay_resolution::type { + auto cn = identity_current_thread(); + return observable>( + rxs::detail::interval(when, rxsc::scheduler::clock_type::duration::max(), cn)); + static_assert(std::is_convertible::value, "TimePoint must be convertible to rxsc::scheduler::clock_type::time_point"); +} +template +static auto interval(rxsc::scheduler::clock_type::time_point when, Coordination cn) + -> typename std::enable_if::value, + observable>>::type { + return observable>( + rxs::detail::interval(when, rxsc::scheduler::clock_type::duration::max(), std::move(cn))); } template static auto interval(rxsc::scheduler::clock_type::time_point initial, Duration period) - -> typename detail::delay_resolution::type { + -> typename std::enable_if::value, + typename detail::delay_resolution>::type::type { return observable>( - rxs::detail::interval(initial, period, identity_one_worker(rxsc::make_current_thread()))); - static_assert(std::is_convertible::value, "duration must be convertible to rxsc::scheduler::clock_type::duration"); + rxs::detail::interval(initial, period, identity_current_thread())); } template static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, Coordination cn) diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index a013488..23107da 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -94,32 +94,39 @@ struct iterate : public source_base::value_t // 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, std::move(o)); + iterate_state_type state(initial, o); auto controller = coordinator.get_worker(); - controller.schedule( - [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 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()); + } }; @@ -129,7 +136,7 @@ template auto iterate(Collection c) -> observable::value_type, detail::iterate> { return observable::value_type, detail::iterate>( - detail::iterate(std::move(c), identity_one_worker(rxsc::make_current_thread()))); + detail::iterate(std::move(c), identity_immediate())); } template auto iterate(Collection c, Coordination cn) @@ -140,8 +147,8 @@ auto iterate(Collection c, Coordination cn) template auto from() - -> decltype(iterate(std::array(), identity_one_worker(rxsc::make_immediate()))) { - return iterate(std::array(), identity_one_worker(rxsc::make_immediate())); + -> decltype(iterate(std::array(), identity_immediate())) { + return iterate(std::array(), identity_immediate()); } template auto from(Coordination cn) @@ -152,9 +159,9 @@ auto from(Coordination cn) template auto from(Value0 v0, ValueN... vn) -> typename std::enable_if::value, - decltype(iterate(std::array(), identity_one_worker(rxsc::make_immediate())))>::type { + decltype(iterate(std::array(), identity_immediate()))>::type { std::array c = {v0, vn...}; - return iterate(std::move(c), identity_one_worker(rxsc::make_immediate())); + return iterate(std::move(c), identity_immediate()); } template auto from(Coordination cn, Value0 v0, ValueN... vn) diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index f304d6f..ec7ddf5 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -51,8 +51,7 @@ struct range : public source_base auto state = initial; - controller.schedule( - [=](const rxsc::schedulable& self){ + auto producer = [=](const rxsc::schedulable& self){ auto& dest = o; if (!dest.is_subscribed()) { // terminate loop @@ -78,7 +77,16 @@ struct range : public source_base // 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()); } }; @@ -88,7 +96,7 @@ template auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1) -> observable> { return observable>( - detail::range(first, last, step, identity_one_worker(rxsc::make_current_thread()))); + detail::range(first, last, step, identity_current_thread())); } template auto range(T first, T last, ptrdiff_t step, Coordination cn) diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index a128016..f00036a 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -203,12 +203,15 @@ class synchronize_in_one_worker : public coordination_base , coordination(factory) { } - rxsc::worker get_worker() const { + inline rxsc::worker get_worker() const { return controller; } - rxsc::scheduler get_scheduler() const { + inline rxsc::scheduler get_scheduler() const { return factory; } + inline rxsc::scheduler::clock_type::time_point now() const { + return factory.now(); + } template auto in(Observable o) const -> decltype(o.synchronize(coordination).ref_count()) { @@ -232,12 +235,26 @@ public: typedef coordinator coordinator_type; - coordinator_type create_coordinator(composite_subscription cs = composite_subscription()) const { + 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/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 34d2a4c..83354ef 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -1,4 +1,5 @@ #include "rxcpp/rx.hpp" +namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxsc=rxcpp::schedulers; @@ -619,3 +620,4 @@ SCENARIO("take, dispose after", "[take][operators]"){ } } } + -- GitLab From 0f1c6ab7ef34495922d58747b72b098e930387b6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 2 Jul 2014 18:18:39 -0700 Subject: [PATCH 368/782] add println utility --- Rx/v2/examples/println/main.cpp | 66 +++++++++++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-util.hpp | 23 ++++++++++++ projects/CMake/CMakeLists.txt | 7 ++++ 3 files changed, 96 insertions(+) create mode 100644 Rx/v2/examples/println/main.cpp diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp new file mode 100644 index 0000000..33598a5 --- /dev/null +++ b/Rx/v2/examples/println/main.cpp @@ -0,0 +1,66 @@ +#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;' + +#if 0 +// +// println will insert values into the specified stream +// +template +struct println_function +{ + OStream& os; + println_function(OStream& os) : os(os) {} + + template + void operator()(const TN&... tn) const { + bool inserts[] = {(os << tn, true)...}; + os << std::endl; + } + + template + void operator()(const std::tuple& tpl) const { + apply(tpl, *this); + } +}; +template +auto println(OStream& os) + -> println_function { + return println_function(os); +} +#endif + +#ifdef UNICODE +int wmain(int argc, wchar_t** argv) +#else +int main(int argc, char** argv) +#endif +{ + auto get_names = [](){return rx::observable<>::from( + "Matthew", + "Aaron" + );}; + + std::cout << "===== println stream of std::string =====" << std::endl; + auto hello_str = [&](){return get_names().map([](std::string n){ + return "Hello, " + n + "!"; + });}; + + 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(), ")"); + });}; + + hello_tpl().subscribe(rxu::println(std::cout)); + + return 0; +} diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index e30ff7f..713c5a3 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -160,6 +160,29 @@ inline auto pack() return detail::pack(); } +template +struct println_function +{ + OStream& os; + println_function(OStream& os) : os(os) {} + + template + void operator()(const TN&... tn) const { + bool inserts[] = {(os << tn, true)...}; + os << std::endl; + } + + template + void operator()(const std::tuple& tpl) const { + apply(tpl, *this); + } +}; +template +auto println(OStream& os) + -> println_function { + return println_function(os); +} + namespace detail { template diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index de7e3f3..4edfb22 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -67,6 +67,13 @@ set(PYTHAGORIAN_SOURCES add_executable(pythagorian ${PYTHAGORIAN_SOURCES}) TARGET_LINK_LIBRARIES(pythagorian ${CMAKE_THREAD_LIBS_INIT}) +# define the sources of the pythagorian example +set(PRINTLN_SOURCES + ${EXAMPLES_DIR}/println/main.cpp +) +add_executable(println ${PRINTLN_SOURCES}) +TARGET_LINK_LIBRARIES(println ${CMAKE_THREAD_LIBS_INIT}) + # configure unit tests via CTest enable_testing() -- GitLab From 67dbf832a1790a5f5a89f5c7f9abb6b7ee404c87 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 2 Jul 2014 18:20:11 -0700 Subject: [PATCH 369/782] rename synchronize to publish_synchronize --- Rx/v2/src/rxcpp/rx-observable.hpp | 11 ++++++----- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 4 ++-- Rx/v2/test/subscriptions/subscription.cpp | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 1d4bc1d..3720699 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -636,11 +636,12 @@ public: rxo::detail::multicast(*this, std::move(sub))); } - /// synchronize -> - /// turns a cold observable hot and allows connections to the source to be independent of subscriptions + /// publish_synchronized -> + /// turns a cold observable hot and allows connections to the source to be independent of subscriptions. + /// all values are queued and delivered using the scheduler from the supplied coordination /// template - auto synchronize(Coordination cn, composite_subscription cs = composite_subscription()) const + auto publish_synchronized(Coordination cn, composite_subscription cs = composite_subscription()) const -> decltype(EXPLICIT_THIS multicast(rxsub::synchronize(std::move(cn), cs))) { return multicast(rxsub::synchronize(std::move(cn), cs)); } @@ -800,7 +801,7 @@ public: /// take_until -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. - /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. + /// for each item from this observable until the specified time, emit them from the new observable that is returned. /// /// template @@ -813,7 +814,7 @@ public: /// take_until -> /// The coordination is used to synchronize sources from different contexts. - /// for each item from this observable until on_next occurs on the TriggerSource, emit them from the new observable that is returned. + /// for each item from this observable until the specified time, emit them from the new observable that is returned. /// /// template diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index f00036a..c28fa91 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -214,8 +214,8 @@ class synchronize_in_one_worker : public coordination_base } template auto in(Observable o) const - -> decltype(o.synchronize(coordination).ref_count()) { - return o.synchronize(coordination).ref_count(); + -> decltype(o.publish_synchronized(coordination).ref_count()) { + return o.publish_synchronized(coordination).ref_count(); } template auto out(Subscriber s) const diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 783a774..289e12c 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -139,7 +139,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto s0 = rxs::range(0, 499, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(es) + .publish_synchronized(es) .ref_count() .lift(liftrequirecompletion) .subscribe( @@ -153,7 +153,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto s1 = rxs::range(500, 999, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(es) + .publish_synchronized(es) .ref_count() .lift(liftrequirecompletion) .subscribe( @@ -167,7 +167,7 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto s2 = rxs::range(1000, 1499, 1, es) .lift(liftrequirecompletion) .as_dynamic() - .synchronize(es) + .publish_synchronized(es) .ref_count() .lift(liftrequirecompletion) .subscribe( -- GitLab From b8274a13bfa9e0e13e157410d4a889ea7c6f5151 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 2 Jul 2014 18:20:45 -0700 Subject: [PATCH 370/782] cleanup alias' --- Rx/v2/examples/pythagorian/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Rx/v2/examples/pythagorian/main.cpp b/Rx/v2/examples/pythagorian/main.cpp index d6aa6f0..2fd1fdf 100644 --- a/Rx/v2/examples/pythagorian/main.cpp +++ b/Rx/v2/examples/pythagorian/main.cpp @@ -4,8 +4,6 @@ // conflicts can be managed by the user. namespace rx=rxcpp; namespace rxu=rxcpp::util; -namespace rxsc=rxcpp::schedulers; -namespace rxsub=rxcpp::subjects; // At this time, RxCpp will fail to compile if the contents // of the std namespace are merged into the global namespace -- GitLab From 53241dc32fee709e2dcb136f1a6c09780708d2b7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 3 Jul 2014 00:28:04 -0700 Subject: [PATCH 371/782] add observe_on still has at least one race condition --- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 271 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 9 + Rx/v2/src/rxcpp/rx-observer.hpp | 2 +- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/concat.cpp | 48 +++- Rx/v2/test/operators/flat_map.cpp | 71 ++++- Rx/v2/test/operators/merge.cpp | 48 +++- Rx/v2/test/operators/observe_on.cpp | 50 ++++ Rx/v2/test/subjects/subject.cpp | 2 +- projects/CMake/CMakeLists.txt | 1 + 10 files changed, 479 insertions(+), 24 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-observe_on.hpp create mode 100644 Rx/v2/test/operators/observe_on.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp new file mode 100644 index 0000000..889c329 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -0,0 +1,271 @@ +// 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_OBSERVE_ON_HPP) +#define RXCPP_OPERATORS_RX_OBSERVE_ON_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct observe_on +{ + typedef typename std::decay::type source_value_type; + + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + + coordination_type coordination; + + observe_on(coordination_type cn) + : coordination(std::move(cn)) + { + } + + template + struct observe_on_observer : public observer_base + { + typedef observe_on_observer this_type; + typedef observer_base base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + + typedef rxn::notification notification_type; + typedef typename notification_type::type base_notification_type; + typedef std::queue queue_type; + + struct mode + { + enum type { + Invalid = 0, + Processing, + Empty, + Disposed + }; + }; + struct observe_on_state : std::enable_shared_from_this + { + mutable std::mutex lock; + mutable queue_type queue; + mutable queue_type drain_queue; + composite_subscription lifetime; + rxsc::worker processor; + 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 ensure_processing(std::unique_lock& guard) const { + if (!guard.owns_lock()) { + abort(); + } + if (current == mode::Empty) { + current = mode::Processing; + auto keepAlive = this->shared_from_this(); + + auto drain = [keepAlive, this](const rxsc::schedulable& self){ + try { + if (drain_queue.empty() || !destination.is_subscribed()) { + std::unique_lock guard(lock); + if (!destination.is_subscribed() || + (!lifetime.is_subscribed() && queue.empty())) { + current = mode::Disposed; + using std::swap; + queue_type expired; + swap(expired, queue); + guard.unlock(); + lifetime.unsubscribe(); + destination.unsubscribe(); + return; + } + if (queue.empty()) { + current = mode::Empty; + return; + } + using std::swap; + swap(queue, drain_queue); + } + auto notification = std::move(drain_queue.front()); + drain_queue.pop(); + notification->accept(destination); + self(); + } catch(...) { + destination.on_error(std::current_exception()); + std::unique_lock guard(lock); + current = mode::Empty; + } + }; + + auto selectedDrain = on_exception( + [&](){return coordinator.act(drain);}, + destination); + if (selectedDrain.empty()) { + return; + } + + auto processor = coordinator.get_worker(); + processor.schedule(lifetime, selectedDrain.get()); + } + } + }; + std::shared_ptr state; + + observe_on_observer(dest_type d, coordinator_type coor, composite_subscription cs) + : state(std::make_shared(std::move(d), std::move(coor), std::move(cs))) + { + } + + void on_next(source_value_type v) const { + if (state->lifetime.is_subscribed()) { + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_next(std::move(v))); + state->ensure_processing(guard); + } + } + void on_error(std::exception_ptr e) const { + if (state->lifetime.is_subscribed()) { + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_error(e)); + state->ensure_processing(guard); + } + } + void on_completed() const { + if (state->lifetime.is_subscribed()) { + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_completed()); + state->ensure_processing(guard); + } + } + + static subscriber 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([keepAlive](){ + std::unique_lock guard(keepAlive->lock); + keepAlive->ensure_processing(guard); + }); + + return make_subscriber(cs, std::move(o)); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(observe_on_observer::make(dest.as_dynamic(), coordination)) { + return observe_on_observer::make(dest.as_dynamic(), coordination); + } +}; + +template +class observe_on_factory +{ + typedef typename std::decay::type coordination_type; + coordination_type coordination; +public: + observe_on_factory(coordination_type cn) : coordination(std::move(cn)) {} + template + auto operator()(Observable&& source) + -> decltype(source.lift(observe_on::type::value_type, coordination_type>(coordination))) { + return source.lift(observe_on::type::value_type, coordination_type>(coordination)); + } +}; + +} + +template +auto observe_on(Coordination cn) + -> detail::observe_on_factory { + return detail::observe_on_factory(std::move(cn)); +} + + +} + +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 + auto in(Observable o) const + -> decltype(o.observe_on(coordination)) { + return o.observe_on(coordination); + } + template + auto out(Subscriber s) const + -> Subscriber { + return std::move(s); + } + template + auto act(F f) const + -> F { + return std::move(f); + } + }; + +public: + + explicit observe_on_one_worker(rxsc::scheduler sc) : factory(sc) {} + + typedef coordinator 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_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/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 3720699..4a016d8 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -664,6 +664,15 @@ public: return multicast(rxsub::behavior(first, cs)); } + /// observe_on -> + /// all values are queued and delivered using the scheduler from the supplied coordination + /// + template + auto observe_on(Coordination cn) const + -> decltype(EXPLICIT_THIS lift(rxo::detail::observe_on(std::move(cn)))) { + return lift(rxo::detail::observe_on(std::move(cn))); + } + /// reduce -> /// 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. /// diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 2dff1e8..12d151d 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -172,7 +172,7 @@ private: template static auto make_destination(Observer o) - -> typename std::enable_if::value, std::shared_ptr>::type { + -> std::shared_ptr { return std::make_shared>(std::move(o)); } diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index cd9410f..4ee9865 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -46,6 +46,7 @@ namespace rxo=operators; #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" #include "operators/rx-multicast.hpp" +#include "operators/rx-observe_on.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-reduce.hpp" #include "operators/rx-ref_count.hpp" diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 619894a..e4c23b7 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -9,7 +9,6 @@ namespace rxsc=rxcpp::schedulers; const int static_onnextcalls = 1000000; - SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("some ranges"){ @@ -20,9 +19,7 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::synchronize_in_one_worker(sc); + auto so = rx::synchronize_event_loop(); std::atomic c(0); int n = 1; @@ -51,6 +48,45 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" } } +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; + + std::mutex lock; + std::condition_variable wake; + + auto so = rx::observe_on_event_loop(); + + std::atomic c(0); + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + 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)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return c == onnextcalls;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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"){ @@ -61,9 +97,7 @@ SCENARIO("serialize concat ranges", "[hide][range][serialize][concat][perf]"){ std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::serialize_one_worker(sc); + auto so = rx::serialize_event_loop(); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 0179909..6999a14 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -53,9 +53,7 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe 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); + auto so = rx::identity_immediate(); int c = 0; int ct = 0; @@ -101,9 +99,7 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::synchronize_in_one_worker(sc); + auto so = rx::synchronize_event_loop(); int c = 0; std::atomic ct(0); @@ -152,6 +148,65 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn } } +SCENARIO("observe_on flat_map pythagorian ranges", "[hide][range][flat_map][observe_on][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + auto so = rx::observe_on_event_loop(); + + int c = 0; + std::atomic ct(0); + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, so) + .flat_map( + [&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; + if (x*x + y*y == z*z) { + return true;} + else { + return false;}}) + .map([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 triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + triples + .take(tripletCount) + .subscribe( + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return ct == tripletCount;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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 flat_map pythagorian ranges", "[hide][range][flat_map][serialize][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ @@ -162,9 +217,7 @@ SCENARIO("serialize flat_map pythagorian ranges", "[hide][range][flat_map][seria std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::serialize_one_worker(sc); + auto so = rx::serialize_event_loop(); int c = 0; std::atomic ct(0); diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index 73af651..a964b0e 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -20,9 +20,7 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::synchronize_in_one_worker(sc); + auto so = rx::synchronize_event_loop(); std::atomic c(0); int n = 1; @@ -52,6 +50,46 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ } } +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; + + std::mutex lock; + std::condition_variable wake; + + auto so = rx::observe_on_event_loop(); + + std::atomic c(0); + int n = 1; + auto sectionCount = onnextcalls / 3; + auto start = clock::now(); + 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)) + .subscribe( + [&c](int x){ + ++c;}, + [](std::exception_ptr){abort();}, + [&](){ + wake.notify_one(); + }); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return c == onnextcalls;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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"){ @@ -62,9 +100,7 @@ SCENARIO("serialize merge ranges", "[hide][range][serialize][merge][perf]"){ std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::serialize_one_worker(sc); + auto so = rx::serialize_event_loop(); std::atomic c(0); int n = 1; diff --git a/Rx/v2/test/operators/observe_on.cpp b/Rx/v2/test/operators/observe_on.cpp new file mode 100644 index 0000000..574fdfb --- /dev/null +++ b/Rx/v2/test/operators/observe_on.cpp @@ -0,0 +1,50 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; +namespace rxsub=rxcpp::subjects; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +const int static_onnextcalls = 100000; +static int aliased = 0; + +SCENARIO("range observed on current_thread", "[hide][range][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 done(false); + auto c = std::make_shared(0); + + auto start = clock::now(); + rxs::range(1) + .take(onnextcalls) + .observe_on(el) + .subscribe( + [c](int){ + ++(*c); + }, + [&](){ + done = true; + }); + while(!done) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + auto expected = onnextcalls; + REQUIRE(*c == expected); + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + std::cout << "range -> observe_on current_thread : " << (*c) << " on_next calls, " << msElapsed.count() << "ms elapsed, int-per-second " << *c / (msElapsed.count() / 1000.0) << std::endl; + } + } + } +} diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index 4d8faf7..ea2230a 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -14,7 +14,7 @@ namespace rxsub=rxcpp::subjects; const int static_onnextcalls = 100000000; -int aliased = 0; +static int aliased = 0; SCENARIO("for loop locks mutex", "[hide][for][mutex][long][perf]"){ const int& onnextcalls = static_onnextcalls; diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 4edfb22..a34de7f 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -45,6 +45,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/lift.cpp ${TEST_DIR}/operators/map.cpp ${TEST_DIR}/operators/merge.cpp + ${TEST_DIR}/operators/observe_on.cpp ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/repeat.cpp -- GitLab From 493950d100777f0150921f83667574541a1bd174 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 08:20:59 -0700 Subject: [PATCH 372/782] fix crazy subtle concurrency bug returning an observer instead of a subscriber. caused a break in the lifetime nesting that due to tests referencing stack vars caused weird stack stomping. --- Rx/v2/src/rxcpp/rx-coordination.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index 1a3c6f3..cbe030d 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -260,8 +260,8 @@ class serialize_one_worker : public coordination_base } template auto out(Subscriber s) const - -> serialize_observer { - return serialize_observer(std::move(s), lock); + -> decltype(serialize_observer::make(std::move(s), lock)) { + return serialize_observer::make(std::move(s), lock); } template auto act(F f) const -- GitLab From 81936ceeca7e09099dc881731a21e306d2ffad29 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 08:22:52 -0700 Subject: [PATCH 373/782] connect coordinators to subscriber lifetime --- Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 61d0d47..9a0b057 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -167,7 +167,7 @@ struct combine_latest : public operator_base(new combine_latest_state_type(initial, std::move(coordinator), std::move(scbr))); diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index a1f9061..98cec31 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -180,7 +180,7 @@ struct concat_map output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription auto state = std::shared_ptr(new concat_map_state_type(initial, std::move(coordinator), std::move(scbr))); diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 1906724..84aeb66 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -111,7 +111,7 @@ struct flat_map output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(scbr))); diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 684a13c..3b980ad 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -71,7 +71,7 @@ struct merge output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription auto state = std::shared_ptr(new merge_state_type(initial, std::move(coordinator), std::move(scbr))); diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index b47fd12..b8c63a4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -72,7 +72,7 @@ struct switch_on_next output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription auto state = std::shared_ptr(new switch_state_type(initial, std::move(coordinator), std::move(scbr))); diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index 2f25e74..b1fb8ff 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -74,7 +74,7 @@ struct take_until : public operator_base output_type out; }; - auto coordinator = initial.coordination.create_coordinator(); + auto coordinator = initial.coordination.create_coordinator(s.get_subscription()); // take a copy of the values for each subscription auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(s))); -- GitLab From 22cdb4f0ff321501a2ac8e8ddcbdc989d3ab6ba1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 08:33:33 -0700 Subject: [PATCH 374/782] fix deadlock, error and dispose --- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 63 ++++++++++++--------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 889c329..001a4e2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -47,7 +47,8 @@ struct observe_on Invalid = 0, Processing, Empty, - Disposed + Disposed, + Errored }; }; struct observe_on_state : std::enable_shared_from_this @@ -75,16 +76,17 @@ struct observe_on } if (current == mode::Empty) { current = mode::Processing; + auto keepAlive = this->shared_from_this(); auto drain = [keepAlive, this](const rxsc::schedulable& self){ + using std::swap; try { if (drain_queue.empty() || !destination.is_subscribed()) { std::unique_lock guard(lock); if (!destination.is_subscribed() || - (!lifetime.is_subscribed() && queue.empty())) { + (!lifetime.is_subscribed() && queue.empty() && drain_queue.empty())) { current = mode::Disposed; - using std::swap; queue_type expired; swap(expired, queue); guard.unlock(); @@ -92,12 +94,13 @@ struct observe_on destination.unsubscribe(); return; } - if (queue.empty()) { - current = mode::Empty; - return; + if (drain_queue.empty()) { + if (queue.empty()) { + current = mode::Empty; + return; + } + swap(queue, drain_queue); } - using std::swap; - swap(queue, drain_queue); } auto notification = std::move(drain_queue.front()); drain_queue.pop(); @@ -106,7 +109,9 @@ struct observe_on } catch(...) { destination.on_error(std::current_exception()); std::unique_lock guard(lock); - current = mode::Empty; + current = mode::Errored; + queue_type expired; + swap(expired, queue); } }; @@ -114,11 +119,20 @@ struct observe_on [&](){return coordinator.act(drain);}, destination); if (selectedDrain.empty()) { + std::unique_lock guard(lock); + current = mode::Errored; + using std::swap; + queue_type expired; + swap(expired, queue); return; } auto processor = coordinator.get_worker(); - processor.schedule(lifetime, selectedDrain.get()); + + RXCPP_UNWIND_AUTO([&](){guard.lock();}); + guard.unlock(); + + processor.schedule(selectedDrain.get()); } } }; @@ -130,25 +144,19 @@ struct observe_on } void on_next(source_value_type v) const { - if (state->lifetime.is_subscribed()) { - std::unique_lock guard(state->lock); - state->queue.push(notification_type::on_next(std::move(v))); - state->ensure_processing(guard); - } + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_next(std::move(v))); + state->ensure_processing(guard); } void on_error(std::exception_ptr e) const { - if (state->lifetime.is_subscribed()) { - std::unique_lock guard(state->lock); - state->queue.push(notification_type::on_error(e)); - state->ensure_processing(guard); - } + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_error(e)); + state->ensure_processing(guard); } void on_completed() const { - if (state->lifetime.is_subscribed()) { - std::unique_lock guard(state->lock); - state->queue.push(notification_type::on_completed()); - state->ensure_processing(guard); - } + std::unique_lock guard(state->lock); + state->queue.push(notification_type::on_completed()); + state->ensure_processing(guard); } static subscriber make(dest_type d, coordination_type cn, composite_subscription cs = composite_subscription()) { @@ -159,7 +167,10 @@ struct observe_on auto keepAlive = o.state; cs.add([keepAlive](){ std::unique_lock guard(keepAlive->lock); - keepAlive->ensure_processing(guard); + if (keepAlive->queue.empty() && keepAlive->current == mode::Empty && keepAlive->destination.is_subscribed()) { + keepAlive->current = mode::Disposed; + keepAlive->destination.unsubscribe(); + } }); return make_subscriber(cs, std::move(o)); -- GitLab From 4b2bb44cf2e9b6a2dc289beec0ac983a950c3baa Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 08:35:29 -0700 Subject: [PATCH 375/782] add some moves --- Rx/v2/src/rxcpp/rx-scheduler.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index e0a2a16..3596a0e 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -357,7 +357,7 @@ public: { } explicit scheduler(detail::const_scheduler_interface_ptr i) - : inner(std::const_pointer_cast(i)) + : inner(std::move(std::const_pointer_cast(i))) { } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp index 1059930..5b3ff4e 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp @@ -21,7 +21,7 @@ private: public: explicit same_worker(rxsc::worker w) - : controller(w) + : controller(std::move(w)) { } virtual ~same_worker() @@ -42,7 +42,7 @@ public: }; inline scheduler make_same_worker(rxsc::worker w) { - auto i = make_scheduler(w); + auto i = make_scheduler(std::move(w)); return i; } -- GitLab From 5466ddda76442374e3d90a28599c7bf9a6bd3869 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 08:36:31 -0700 Subject: [PATCH 376/782] test updates --- Rx/v2/test/operators/concat_map.cpp | 89 ++++++++++-- Rx/v2/test/operators/flat_map.cpp | 5 +- Rx/v2/test/operators/observe_on.cpp | 15 +- Rx/v2/test/subscriptions/subscription.cpp | 166 ++++++++++++++++++---- 4 files changed, 232 insertions(+), 43 deletions(-) diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 4f6b675..3c4c486 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -64,9 +64,7 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::synchronize_in_one_worker(sc); + auto so = rx::synchronize_event_loop(); int c = 0; std::atomic ct(0); @@ -115,6 +113,74 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] } } +SCENARIO("observe_on concat_map pythagorian ranges", "[hide][range][concat_map][observe_on][pythagorian][perf]"){ + const int& tripletCount = static_tripletCount; + GIVEN("some ranges"){ + WHEN("generating pythagorian triplets"){ + using namespace std::chrono; + typedef steady_clock clock; + + std::mutex lock; + std::condition_variable wake; + + auto so = rx::observe_on_event_loop(); + + int c = 0; + std::atomic_bool done(false); + std::atomic_bool disposed(false); + std::atomic ct(0); + int n = 1; + auto start = clock::now(); + auto triples = + rxs::range(1, so) + .concat_map( + [&c, so](int z){ + return rxs::range(1, z, 1, so) + .concat_map( + [&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;}}) + .map([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 triplet){return triplet;}, + so) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic();}, + [](int z, std::tuple triplet){return triplet;}, + so); + + rx::composite_subscription cs; + cs.add([&](){ + disposed = true; + wake.notify_one();}); + + triples + .take(tripletCount) + .subscribe( + cs, + rxu::apply_to([&ct](int x,int y,int z){ + ++ct;}), + [&](){ + done = true; + wake.notify_one();}); + + std::unique_lock guard(lock); + wake.wait(guard, [&](){return ct == tripletCount && done && disposed;}); + + auto finish = clock::now(); + auto msElapsed = duration_cast(finish.time_since_epoch()) - + duration_cast(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_map pythagorian ranges", "[hide][range][concat_map][serialize][pythagorian][perf]"){ const int& tripletCount = static_tripletCount; GIVEN("some ranges"){ @@ -125,11 +191,11 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s std::mutex lock; std::condition_variable wake; - auto sc = rxsc::make_event_loop(); - //auto sc = rxsc::make_new_thread(); - auto so = rx::serialize_one_worker(sc); + auto so = rx::serialize_event_loop(); int c = 0; + std::atomic_bool done(false); + std::atomic_bool disposed(false); std::atomic ct(0); int n = 1; auto start = clock::now(); @@ -156,17 +222,24 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}, so); + + rx::composite_subscription cs; + cs.add([&](){ + disposed = true; + wake.notify_one();}); + triples .take(tripletCount) .subscribe( + cs, rxu::apply_to([&ct](int x,int y,int z){ ++ct;}), - [](std::exception_ptr){abort();}, [&](){ + done = true; wake.notify_one();}); std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount;}); + wake.wait(guard, [&](){return ct == tripletCount && done && disposed;}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 6999a14..d32de54 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -78,8 +78,9 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe triples .take(tripletCount) .subscribe( - rxu::apply_to([&ct](int x,int y,int z){++ct;}), - [](std::exception_ptr){abort();}); + rxu::apply_to([&ct](int x,int y,int z){ + ++ct; + })); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - duration_cast(start.time_since_epoch()); diff --git a/Rx/v2/test/operators/observe_on.cpp b/Rx/v2/test/operators/observe_on.cpp index 574fdfb..5b3ac50 100644 --- a/Rx/v2/test/operators/observe_on.cpp +++ b/Rx/v2/test/operators/observe_on.cpp @@ -9,9 +9,8 @@ namespace rxsub=rxcpp::subjects; #include "catch.hpp" const int static_onnextcalls = 100000; -static int aliased = 0; -SCENARIO("range observed on current_thread", "[hide][range][observe_on][long][perf]"){ +SCENARIO("range observed on current_thread", "[hide][range][observe_on_debug][observe_on][long][perf]"){ const int& onnextcalls = static_onnextcalls; GIVEN("a range"){ WHEN("multicasting a million ints"){ @@ -22,23 +21,29 @@ SCENARIO("range observed on current_thread", "[hide][range][observe_on][long][pe for (int n = 0; n < 10; n++) { + std::atomic_bool disposed(false); std::atomic_bool done(false); auto c = std::make_shared(0); + rx::composite_subscription cs; + cs.add([&](){ + if (!done) {abort();} + disposed = true; + }); + auto start = clock::now(); rxs::range(1) .take(onnextcalls) .observe_on(el) .subscribe( + cs, [c](int){ ++(*c); }, [&](){ done = true; }); - while(!done) { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } + while(!done || !disposed); auto expected = onnextcalls; REQUIRE(*c == expected); auto finish = clock::now(); diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 289e12c..b979c4f 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -90,7 +90,7 @@ SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_lat } } -SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf]"){ +SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug][synchronize][long][perf]"){ GIVEN("range"){ WHEN("synchronized"){ using namespace std::chrono; @@ -99,8 +99,9 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf auto sc = rxsc::make_current_thread(); auto w = sc.create_worker(); - auto el = rxsc::make_event_loop(); - auto es = rx::synchronize_in_one_worker(el); + auto es = rx::synchronize_event_loop(); + + const int values = 10000; int runs = 10; @@ -108,35 +109,36 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf std::atomic c(0); int n = 1; auto liftrequirecompletion = [&](rx::subscriber dest){ - auto completionstate = std::make_shared>>(0, std::move(dest)); - completionstate->second.add([=](){ - if (completionstate->first != 500) { + auto completionstate = std::make_shared>>(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( - completionstate->second, - rx::make_observer_dynamic( - [=](int n){ - ++completionstate->first; - completionstate->second.on_next(n); - }, - [=](std::exception_ptr e){ + std::get<2>(*completionstate), + [=](int n){ + ++std::get<1>(*completionstate); + std::get<2>(*completionstate).on_next(n); + }, + [=](std::exception_ptr e){ + abort(); + std::get<2>(*completionstate).on_error(e); + }, + [=](){ + if (std::get<1>(*completionstate) != values) { abort(); - completionstate->second.on_error(e); - }, - [=](){ - if (completionstate->first != 500) { - abort(); - } - completionstate->second.on_completed(); - })); + } + std::get<0>(*completionstate) = true; + std::get<2>(*completionstate).on_completed(); + }).as_dynamic(); }; auto start = clock::now(); - auto ew = el.create_worker(); + auto ew = es.create_coordinator().get_worker(); std::atomic v(0); - auto s0 = rxs::range(0, 499, 1, es) + auto s0 = rxs::range(1, es) + .take(values) .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) @@ -150,7 +152,8 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf [&](){ ++c; })); - auto s1 = rxs::range(500, 999, 1, es) + auto s1 = rxs::range(values + 1, es) + .take(values) .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) @@ -164,7 +167,8 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf [&](){ ++c; })); - auto s2 = rxs::range(1000, 1499, 1, es) + auto s2 = rxs::range((values * 2) + 1, es) + .take(values) .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) @@ -178,13 +182,120 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf [&](){ ++c; })); - while(v != 1500 || c != 3); + while(v != values * 3 || c != 3); + s0.unsubscribe(); + s1.unsubscribe(); + s2.unsubscribe(); + auto finish = clock::now(); + auto msElapsed = duration_cast(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 c(0); + int n = 1; + auto liftrequirecompletion = [&](rx::subscriber dest){ + auto completionstate = std::make_shared>>(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( + std::get<2>(*completionstate), + [=](int n){ + ++std::get<1>(*completionstate); + std::get<2>(*completionstate).on_next(n); + }, + [=](std::exception_ptr e){ + abort(); + std::get<2>(*completionstate).on_error(e); + }, + [=](){ + 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 v(0); + auto s0 = rxs::range(1, es) + .take(values) + .lift(liftrequirecompletion) + .as_dynamic() + .observe_on(es) + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + auto s1 = rxs::range(values + 1, es) + .take(values) + .lift(liftrequirecompletion) + .as_dynamic() + .observe_on(es) + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + auto s2 = rxs::range((values * 2) + 1, es) + .take(values) + .lift(liftrequirecompletion) + .as_dynamic() + .observe_on(es) + .lift(liftrequirecompletion) + .subscribe( + rx::make_observer_dynamic( + [&](int i){ + ++v; + }, + [&](){ + ++c; + })); + while(v != values * 3 || c != 3); s0.unsubscribe(); s1.unsubscribe(); s2.unsubscribe(); auto finish = clock::now(); auto msElapsed = duration_cast(finish-start); - std::cout << "range synchronize : " << n << " subscribed, " << v << " on_next calls, " << msElapsed.count() << "ms elapsed, " << v / (msElapsed.count() / 1000.0) << " ops/sec" << std::endl; + 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(); @@ -198,7 +309,6 @@ SCENARIO("synchronized range", "[hide][subscribe][range][synchronize][long][perf SCENARIO("subscription traits", "[subscription][traits]"){ GIVEN("given some subscription types"){ - auto empty = [](){}; auto es = rx::make_subscription(); rx::composite_subscription cs; WHEN("tested"){ -- GitLab From b0a01c37ace98409bc0d5251212a06c1083139c1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 8 Jul 2014 08:04:47 -0700 Subject: [PATCH 377/782] gcc 32bit runs out of address space and memory on combine_latest.cpp, split the tests up --- Rx/v2/test/operators/combine_latest.1.cpp | 730 ++++++++++++++++++ ...ombine_latest.cpp => combine_latest.2.cpp} | 723 ----------------- projects/CMake/CMakeLists.txt | 3 +- 3 files changed, 732 insertions(+), 724 deletions(-) create mode 100644 Rx/v2/test/operators/combine_latest.1.cpp rename Rx/v2/test/operators/{combine_latest.cpp => combine_latest.2.cpp} (56%) diff --git a/Rx/v2/test/operators/combine_latest.1.cpp b/Rx/v2/test/operators/combine_latest.1.cpp new file mode 100644 index 0000000..acf2e93 --- /dev/null +++ b/Rx/v2/test/operators/combine_latest.1.cpp @@ -0,0 +1,730 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 on; + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(230) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(220, 3), + on.on_next(230, 5), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.on_next(220, 2 + 3), + on.on_next(225, 4 + 3), + on.on_next(230, 4 + 5), + on.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.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 on; + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(230) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_error(230, ex) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.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 on; + + std::runtime_error ex("combine_latest on_error from source"); + + auto o1 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_next(225, 4), + on.on_completed(250) + }); + + auto o2 = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(235, 6), + on.on_next(240, 7), + on.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.on_next(235, 4 + 6), + on.on_next(240, 4 + 7), + on.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 on; + + const size_t N = 16; + + std::vector> n; + for (int i = 0; i < N; ++i) { + n.push_back( + sc.make_hot_observable({ + on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15] + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output is empty"){ + auto required = std::vector::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 &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 on; + + const size_t N = 16; + + std::vector> e; + for (int i = 0; i < N; ++i) { + e.push_back( + sc.make_hot_observable({ + on.on_next(150, 1), + on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] + ) + // 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.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 &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 on; + + auto n = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.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::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 on; + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(210) + }); + + auto n = sc.make_hot_observable({ + on.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::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 on; + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_completed(210) + }); + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.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.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 on; + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(220) + }); + + auto e = sc.make_hot_observable({ + on.on_next(150, 1), + on.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.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 on; + + auto n = sc.make_hot_observable({ + on.on_next(150, 1) + }); + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.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::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 on; + + auto o = sc.make_hot_observable({ + on.on_next(150, 1), + on.on_next(215, 2), + on.on_completed(220) + }); + + auto n = sc.make_hot_observable({ + on.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::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); + } + } + } +} + diff --git a/Rx/v2/test/operators/combine_latest.cpp b/Rx/v2/test/operators/combine_latest.2.cpp similarity index 56% rename from Rx/v2/test/operators/combine_latest.cpp rename to Rx/v2/test/operators/combine_latest.2.cpp index 2916d20..4e26fcc 100644 --- a/Rx/v2/test/operators/combine_latest.cpp +++ b/Rx/v2/test/operators/combine_latest.2.cpp @@ -5,729 +5,6 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.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 on; - - auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(230) - }); - - auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(220, 3), - on.on_next(230, 5), - on.on_next(235, 6), - on.on_next(240, 7), - on.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.on_next(220, 2 + 3), - on.on_next(225, 4 + 3), - on.on_next(230, 4 + 5), - on.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.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 on; - - auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(230) - }); - - auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.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.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.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 on; - - std::runtime_error ex("combine_latest on_error from source"); - - auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_error(230, ex) - }); - - auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.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.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 on; - - std::runtime_error ex("combine_latest on_error from source"); - - auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(250) - }); - - auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.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.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.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 on; - - const size_t N = 16; - - std::vector> n; - for (int i = 0; i < N; ++i) { - n.push_back( - sc.make_hot_observable({ - on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ - return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; - }, - n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15] - ) - // forget type to workaround lambda deduction bug on msvc 2013 - .as_dynamic(); - } - ); - - THEN("the output is empty"){ - auto required = std::vector::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 &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 on; - - const size_t N = 16; - - std::vector> e; - for (int i = 0; i < N; ++i) { - e.push_back( - sc.make_hot_observable({ - on.on_next(150, 1), - on.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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ - return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; - }, - e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] - ) - // 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.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 &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 on; - - auto n = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.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::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 on; - - auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) - }); - - auto n = sc.make_hot_observable({ - on.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::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 on; - - auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) - }); - - auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.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.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 on; - - auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) - }); - - auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.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.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 on; - - auto n = sc.make_hot_observable({ - on.on_next(150, 1) - }); - - auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.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::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 on; - - auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) - }); - - auto n = sc.make_hot_observable({ - on.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::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(); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index a34de7f..b5a9cdd 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -36,7 +36,8 @@ set(TEST_SOURCES ${TEST_DIR}/sources/defer.cpp ${TEST_DIR}/sources/interval.cpp ${TEST_DIR}/operators/buffer.cpp - ${TEST_DIR}/operators/combine_latest.cpp + ${TEST_DIR}/operators/combine_latest.1.cpp + ${TEST_DIR}/operators/combine_latest.2.cpp ${TEST_DIR}/operators/concat.cpp ${TEST_DIR}/operators/concat_map.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp -- GitLab From b93318ae594c0ac8c9ebb698cebd0313774d6c20 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 7 Jul 2014 15:04:45 -0700 Subject: [PATCH 378/782] adds subscribe_on --- Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp | 124 ++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 10 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/subscribe_on.cpp | 53 ++++++++ projects/CMake/CMakeLists.txt | 1 + 5 files changed, 189 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp create mode 100644 Rx/v2/test/operators/subscribe_on.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp new file mode 100644 index 0000000..3899b19 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp @@ -0,0 +1,124 @@ +// 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_SUBSCRIBE_ON_HPP) +#define RXCPP_OPERATORS_RX_SUBSCRIBE_ON_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct subscribe_on : public operator_base +{ + typedef typename std::decay::type source_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + struct values + { + values(source_type s, coordination_type sf) + : source(std::move(s)) + , coordination(std::move(sf)) + { + } + source_type source; + coordination_type coordination; + }; + values initial; + + subscribe_on(source_type s, coordination_type sf) + : initial(std::move(s), std::move(sf)) + { + } + + template + void on_subscribe(Subscriber s) const { + + typedef Subscriber output_type; + struct subscribe_on_state_type + : public std::enable_shared_from_this + , public values + { + subscribe_on_state_type(const values& i, coordinator_type coor, const output_type& oarg) + : values(i) + , coordinator(std::move(coor)) + , out(oarg) + { + } + composite_subscription source_lifetime; + coordinator_type coordinator; + output_type out; + }; + + auto coordinator = initial.coordination.create_coordinator(s.get_subscription()); + + auto controller = coordinator.get_worker(); + + // take a copy of the values for each subscription + auto state = std::shared_ptr(new subscribe_on_state_type(initial, std::move(coordinator), std::move(s))); + + state->out.add([=](){ + auto disposer = [=](const rxsc::schedulable&){ + state->source_lifetime.unsubscribe(); + }; + auto selectedDisposer = on_exception( + [&](){return state->coordinator.act(disposer);}, + state->out); + if (selectedDisposer.empty()) { + return; + } + controller.schedule(selectedDisposer.get()); + }); + + auto producer = [=](const rxsc::schedulable&){ + state->source.subscribe(state->source_lifetime, state->out); + }; + + auto selectedProducer = on_exception( + [&](){return state->coordinator.act(producer);}, + state->out); + if (selectedProducer.empty()) { + return; + } + + controller.schedule(selectedProducer.get()); + } +}; + +template +class subscribe_on_factory +{ + typedef typename std::decay::type coordination_type; + + coordination_type coordination; +public: + subscribe_on_factory(coordination_type sf) + : coordination(std::move(sf)) + { + } + template + auto operator()(Observable&& source) + -> observable::type::value_type, subscribe_on::type::value_type, Observable, Coordination>> { + return observable::type::value_type, subscribe_on::type::value_type, Observable, Coordination>>( + subscribe_on::type::value_type, Observable, Coordination>(std::forward(source), coordination)); + } +}; + +} + +template +auto subscribe_on(Coordination sf) + -> detail::subscribe_on_factory { + return detail::subscribe_on_factory(std::move(sf)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 4a016d8..dfc23b2 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -664,6 +664,16 @@ public: return multicast(rxsub::behavior(first, cs)); } + /// subscribe_on -> + /// subscription and unsubscription are queued and delivered using the scheduler from the supplied coordination + /// + template + auto subscribe_on(Coordination cn) const + -> observable::value_type, rxo::detail::subscribe_on> { + return observable::value_type, rxo::detail::subscribe_on>( + rxo::detail::subscribe_on(*this, std::forward(cn))); + } + /// observe_on -> /// all values are queued and delivered using the scheduler from the supplied coordination /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 4ee9865..a8b22e4 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -55,6 +55,7 @@ namespace rxo=operators; #include "operators/rx-skip.hpp" #include "operators/rx-skip_until.hpp" #include "operators/rx-subscribe.hpp" +#include "operators/rx-subscribe_on.hpp" #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" diff --git a/Rx/v2/test/operators/subscribe_on.cpp b/Rx/v2/test/operators/subscribe_on.cpp new file mode 100644 index 0000000..733aa0e --- /dev/null +++ b/Rx/v2/test/operators/subscribe_on.cpp @@ -0,0 +1,53 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxs=rx::rxs; +namespace rxsc=rx::rxsc; + +#include "catch.hpp" + +static const int static_subscriptions = 100000; + +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 100K 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++) { + std::atomic_bool done(false); + 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()) + .subscribe([&](int i){ + ++c; + }, + [&](){ + done = true; + }); + while(!done); + } + auto finish = clock::now(); + auto msElapsed = duration_cast(finish-start); + 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; + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b5a9cdd..6529de1 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -53,6 +53,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/skip.cpp ${TEST_DIR}/operators/skip_until.cpp + ${TEST_DIR}/operators/subscribe_on.cpp ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/take_until.cpp -- GitLab From d23d7108c8b8c12f063b81cae379f6289108802d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 14 Jul 2014 08:55:58 -0700 Subject: [PATCH 379/782] revamp type deferral mechanism for observable --- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 32 ++- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 35 +-- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 22 +- .../src/rxcpp/operators/rx-switch_on_next.hpp | 37 +-- Rx/v2/src/rxcpp/rx-observable.hpp | 251 +++++++++--------- Rx/v2/src/rxcpp/rx-util.hpp | 93 +++++++ 6 files changed, 286 insertions(+), 184 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 68179be..2afe974 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -13,34 +13,36 @@ namespace operators { namespace detail { -template +template struct concat - : public operator_base::type::value_type::value_type> + : public operator_base::type::value_type> { - typedef concat this_type; + typedef concat this_type; + typedef typename std::decay::type source_value_type; typedef typename std::decay::type source_type; typedef typename std::decay::type coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - typedef typename source_type::value_type collection_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_type o, coordination_type sf) - : source(std::move(o)) + values(source_operator_type o, coordination_type sf) + : source_operator(std::move(o)) , coordination(std::move(sf)) { } - source_type source; + source_operator_type source_operator; coordination_type coordination; }; values initial; - concat(source_type o, coordination_type sf) - : initial(std::move(o), std::move(sf)) + concat(const source_type& o, coordination_type sf) + : initial(o.source_operator, std::move(sf)) { } @@ -55,7 +57,8 @@ struct concat , public values { concat_state_type(values i, coordinator_type coor, output_type oarg) - : values(std::move(i)) + : values(i) + , source(i.source_operator) , sourceLifetime(composite_subscription::empty()) , collectionLifetime(composite_subscription::empty()) , coordinator(std::move(coor)) @@ -117,6 +120,7 @@ struct concat } selectedSource->subscribe(std::move(selectedSinkInner.get())); } + observable source; composite_subscription sourceLifetime; composite_subscription collectionLifetime; std::deque selectedCollections; @@ -190,10 +194,10 @@ public: } template - auto operator()(Observable&& source) - -> observable::value_type, concat> { - return observable::value_type, concat>( - concat(std::forward(source), coordination)); + auto operator()(Observable source) + -> observable::value_type, concat> { + return observable::value_type, concat>( + concat(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 3b980ad..9faa862 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -13,18 +13,19 @@ namespace operators { namespace detail { -template +template struct merge - : public operator_base::type::value_type::value_type> + : public operator_base::type::value_type> { - static_assert(is_observable::value, "merge requires an observable"); - static_assert(is_observable::value, "merge an observable that contains observables"); + //static_assert(is_observable::value, "merge requires an observable"); + //static_assert(is_observable::value, "merge requires an observable that contains observables"); - typedef merge this_type; + typedef merge this_type; + typedef typename std::decay::type source_value_type; typedef typename std::decay::type source_type; - typedef typename source_type::value_type source_value_type; + typedef typename source_type::source_operator_type source_operator_type; typedef typename source_value_type::value_type value_type; typedef typename std::decay::type coordination_type; @@ -32,18 +33,18 @@ struct merge struct values { - values(source_type o, coordination_type sf) - : source(std::move(o)) + values(source_operator_type o, coordination_type sf) + : source_operator(std::move(o)) , coordination(std::move(sf)) { } - source_type source; + source_operator_type source_operator; coordination_type coordination; }; values initial; - merge(source_type o, coordination_type sf) - : initial(std::move(o), std::move(sf)) + merge(const source_type& o, coordination_type sf) + : initial(o.source_operator, std::move(sf)) { } @@ -58,12 +59,14 @@ struct merge , public values { merge_state_type(values i, coordinator_type coor, output_type oarg) - : values(std::move(i)) + : values(i) + , source(i.source_operator) , pendingCompletions(0) , coordinator(std::move(coor)) , out(std::move(oarg)) { } + observable source; // on_completed on the output must wait until all the // subscriptions have received on_completed int pendingCompletions; @@ -179,10 +182,10 @@ public: } template - auto operator()(Observable&& source) - -> observable::value_type, merge> { - return observable::value_type, merge>( - merge(std::forward(source), coordination)); + auto operator()(Observable source) + -> observable::value_type, merge> { + return observable::value_type, merge>( + merge(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 7ba7015..c70f7bd 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -47,10 +47,10 @@ struct is_result_function_for { static const bool value = !std::is_same::value; }; -template +template struct reduce_traits { - typedef typename std::decay::type source_type; + typedef typename std::decay::type source_type; typedef typename std::decay::type accumulator_type; typedef typename std::decay::type result_selector_type; typedef typename std::decay::type seed_type; @@ -64,11 +64,11 @@ struct reduce_traits typedef typename is_result_function_for::type value_type; }; -template -struct reduce : public operator_base::value_type> +template +struct reduce : public operator_base::value_type> { - typedef reduce this_type; - typedef reduce_traits traits; + typedef reduce this_type; + typedef reduce_traits traits; typedef typename traits::source_type source_type; typedef typename traits::accumulator_type accumulator_type; @@ -106,10 +106,12 @@ struct reduce : public operator_base source; seed_type current; Subscriber out; }; @@ -163,10 +165,10 @@ public: { } template - auto operator()(Observable&& source) - -> observable::type::value_type, Observable, Accumulator, ResultSelector, Seed>> { - return observable::type::value_type, Observable, Accumulator, ResultSelector, Seed>>( - reduce::type::value_type, Observable, Accumulator, ResultSelector, Seed>(std::forward(source), accumulator, result_selector, seed)); + auto operator()(const Observable& source) + -> observable> { + return observable>( + reduce(source.source_operator, accumulator, result_selector, seed)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index b8c63a4..3403553 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -13,18 +13,21 @@ namespace operators { namespace detail { -template +template struct switch_on_next - : public operator_base::type::value_type::value_type> + : public operator_base::type::value_type> { - static_assert(is_observable::value, "switch_on_next requires an observable"); - static_assert(is_observable::value, "switch_on_next an observable that contains observables"); + //static_assert(is_observable::value, "switch_on_next requires an observable"); + //static_assert(is_observable::value, "switch_on_next requires an observable that contains observables"); - typedef switch_on_next this_type; + typedef switch_on_next this_type; + typedef typename std::decay::type source_value_type; typedef typename std::decay::type source_type; - typedef typename source_type::value_type collection_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 typename std::decay::type coordination_type; @@ -32,18 +35,18 @@ struct switch_on_next struct values { - values(source_type o, coordination_type sf) - : source(std::move(o)) + values(source_operator_type o, coordination_type sf) + : source_operator(std::move(o)) , coordination(std::move(sf)) { } - source_type source; + source_operator_type source_operator; coordination_type coordination; }; values initial; - switch_on_next(source_type o, coordination_type sf) - : initial(std::move(o), std::move(sf)) + switch_on_next(const source_type& o, coordination_type sf) + : initial(o.source_operator, std::move(sf)) { } @@ -58,12 +61,14 @@ struct switch_on_next , public values { switch_state_type(values i, coordinator_type coor, output_type oarg) - : values(std::move(i)) + : values(i) + , source(i.source_operator) , pendingCompletions(0) , coordinator(std::move(coor)) , out(std::move(oarg)) { } + observable source; // on_completed on the output must wait until all the // subscriptions have received on_completed int pendingCompletions; @@ -188,10 +193,10 @@ public: } template - auto operator()(Observable&& source) - -> observable::value_type, switch_on_next> { - return observable::value_type, switch_on_next>( - switch_on_next(std::forward(source), coordination)); + auto operator()(Observable source) + -> observable::value_type, switch_on_next> { + return observable::value_type, switch_on_next>( + switch_on_next(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index dfc23b2..9ce96b4 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -161,12 +161,67 @@ class observable { static_assert(std::is_same::value, "SourceOperator::value_type must be the same as T in observable"); -protected: typedef observable this_type; + +public: typedef typename std::decay::type source_operator_type; mutable source_operator_type source_operator; +protected: + template + struct resolve_observable; + + template + struct resolve_observable + { + typedef typename SO::type type; + typedef typename type::value_type value_type; + static const bool value = true; + typedef observable observable_type; + template + static observable_type make(const Default&, AN&&... an) { + return observable_type(type(std::forward(an)...)); + } + }; + template + struct resolve_observable + { + static const bool value = false; + typedef Default observable_type; + template + static observable_type make(const observable_type& that, const AN&...) { + return that; + } + }; + template + struct resolve_observable + { + typedef typename SO::type type; + typedef typename type::value_type value_type; + static const bool value = true; + typedef observable observable_type; + template + static observable_type make(AN&&... an) { + return observable_type(type(std::forward(an)...)); + } + }; + template + struct resolve_observable + { + static const bool value = false; + typedef void observable_type; + template + static observable_type make(const AN&...) { + } + }; + template class SO, class... AN> + struct defer_observable + : public resolve_observable> + { + }; + private: + template friend class observable; @@ -341,28 +396,12 @@ public: return lift(rxo::detail::buffer_count(count, skip)); } - template::value> - struct switch_on_next_result; - template - struct switch_on_next_result + struct defer_switch_on_next : public defer_observable< + is_observable, + this_type, + rxo::detail::switch_on_next, value_type, observable, Coordination> { - typedef - observable< - typename this_type::value_type::value_type, - rxo::detail::switch_on_next> - type; - static type make(const this_type* that, Coordination sf) { - return type(rxo::detail::switch_on_next(*that, std::move(sf))); - } - }; - template - struct switch_on_next_result - { - typedef this_type type; - static type make(const this_type* that, Coordination) { - return *that; - } }; /// switch_on_next (AKA Switch) -> @@ -370,8 +409,8 @@ public: /// for each item from this observable subscribe to that observable after unsubscribing from any previous subscription. /// auto switch_on_next() const - -> typename switch_on_next_result::type { - return switch_on_next_result::make(this, identity_current_thread()); + -> typename defer_switch_on_next::observable_type { + return defer_switch_on_next::make(*this, *this, identity_current_thread()); } /// switch_on_next (AKA Switch) -> @@ -379,35 +418,19 @@ public: /// for each item from this observable subscribe to that observable after unsubscribing from any previous subscription. /// template - auto switch_on_next(Coordination&& sf) const - -> typename std::enable_if::value, - observable::value_type, rxo::detail::switch_on_next>>::type { - return observable::value_type, rxo::detail::switch_on_next>( - rxo::detail::switch_on_next(*this, std::forward(sf))); + auto switch_on_next(Coordination cn) const + -> typename std::enable_if< + defer_switch_on_next::value, + typename defer_switch_on_next::observable_type>::type { + return defer_switch_on_next::make(*this, *this, std::move(cn)); } - template::value> - struct merge_result; - template - struct merge_result + struct defer_merge : public defer_observable< + is_observable, + this_type, + rxo::detail::merge, value_type, observable, Coordination> { - typedef - observable< - typename this_type::value_type::value_type, - rxo::detail::merge, Coordination>> - type; - static type make(const this_type* that, Coordination sf) { - return type(rxo::detail::merge, Coordination>(*that, sf)); - } - }; - template - struct merge_result - { - typedef this_type type; - static type make(const this_type* that, Coordination) { - return *that; - } }; /// merge -> @@ -416,8 +439,8 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// auto merge() const - -> typename merge_result::type { - return merge_result::make(this, identity_current_thread()); + -> typename defer_merge::observable_type { + return defer_merge::make(*this, *this, identity_current_thread()); } /// merge -> @@ -426,11 +449,11 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// template - auto merge(Coordination&& sf) const - -> typename std::enable_if::value && !is_observable::value, - observable::value_type, rxo::detail::merge>>::type { - return observable::value_type, rxo::detail::merge>( - rxo::detail::merge(*this, std::forward(sf))); + auto merge(Coordination cn) const + -> typename std::enable_if< + defer_merge::value, + typename defer_merge::observable_type>::type { + return defer_merge::make(*this, *this, std::move(cn)); } /// merge -> @@ -480,28 +503,12 @@ public: rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } - template::value> - struct concat_result; - template - struct concat_result + struct defer_concat : public defer_observable< + is_observable, + this_type, + rxo::detail::concat, value_type, observable, Coordination> { - typedef - observable< - typename this_type::value_type::value_type, - rxo::detail::concat, Coordination>> - type; - static type make(const this_type* that, Coordination sf) { - return type(rxo::detail::concat, Coordination>(*that, sf)); - } - }; - template - struct concat_result - { - typedef this_type type; - static type make(const this_type* that, Coordination) { - return *that; - } }; /// concat -> @@ -510,8 +517,8 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// auto concat() const - -> typename concat_result::type { - return concat_result::make(this, identity_current_thread()); + -> typename defer_concat::observable_type { + return defer_concat::make(*this, *this, identity_current_thread()); } /// concat -> @@ -520,11 +527,11 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// template - auto concat(Coordination&& sf) const - -> typename std::enable_if::value && !is_observable::value, - observable::value_type, rxo::detail::concat>>::type { - return observable::value_type, rxo::detail::concat>( - rxo::detail::concat(*this, std::forward(sf))); + auto concat(Coordination cn) const + -> typename std::enable_if< + defer_concat::value, + typename defer_concat::observable_type>::type { + return defer_concat::make(*this, *this, std::move(cn)); } /// concat -> @@ -548,6 +555,7 @@ public: -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); } + /// concat_map -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. @@ -573,9 +581,11 @@ public: } template - struct delayed_combine_latest + struct defer_combine_latest : public defer_observable< + rxu::all_true::value, !is_observable::value, is_observable::value...>, + this_type, + rxo::detail::combine_latest, Coordination, Selector, ObservableN...> { - typedef observable::value_type, rxo::detail::combine_latest> type; }; /// combine_latest -> @@ -584,10 +594,10 @@ public: /// template auto combine_latest(Selector&& s, ObservableN... on) const - -> typename std::enable_if::value && !is_observable::value && rxu::all_true::value...>::value, - delayed_combine_latest>::type::type { - return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(identity_current_thread(), std::forward(s), std::make_tuple(*this, on...))); + -> typename std::enable_if< + defer_combine_latest::value, + typename defer_combine_latest::observable_type>::type { + return defer_combine_latest::make(*this, identity_current_thread(), std::forward(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -596,10 +606,10 @@ public: /// template auto combine_latest(Coordination cn, Selector&& s, ObservableN... on) const - -> typename std::enable_if::value && !is_observable::value && rxu::all_true::value...>::value, - delayed_combine_latest>::type::type { - return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(std::move(cn), std::forward(s), std::make_tuple(*this, on...))); + -> typename std::enable_if< + defer_combine_latest::value, + typename defer_combine_latest::observable_type>::type { + return defer_combine_latest::make(*this, std::move(cn), std::forward(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -608,10 +618,10 @@ public: /// template auto combine_latest(ObservableN... on) const - -> typename std::enable_if::value...>::value, - delayed_combine_latest>::type::type { - return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...))); + -> typename std::enable_if< + defer_combine_latest::value, + typename defer_combine_latest::observable_type>::type { + return defer_combine_latest::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -620,10 +630,10 @@ public: /// template auto combine_latest(Coordination cn, ObservableN... on) const - -> typename std::enable_if::value && rxu::all_true::value...>::value, - delayed_combine_latest>::type::type { - return observable::value_type, rxo::detail::combine_latest>( - rxo::detail::combine_latest(std::move(cn), rxu::pack(), std::make_tuple(*this, on...))); + -> typename std::enable_if< + defer_combine_latest::value, + typename defer_combine_latest::observable_type>::type { + return defer_combine_latest::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); } /// multicast -> @@ -688,50 +698,35 @@ public: /// template auto reduce(Seed seed, Accumulator&& a, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::reduce> { - return observable::value_type, rxo::detail::reduce>( - rxo::detail::reduce(*this, std::forward(a), std::forward(rs), seed)); + -> observable::value_type, rxo::detail::reduce> { + return observable::value_type, rxo::detail::reduce>( + rxo::detail::reduce(source_operator, std::forward(a), std::forward(rs), seed)); } - template::value && - rxo::detail::is_result_function_for::value> - struct specific_reduce_result; - - template - struct specific_reduce_result - { - typedef - observable< - typename rxo::detail::is_result_function_for::type, - rxo::detail::reduce> - type; - static type make(const this_type* that, Seed seed, Accumulator a, ResultSelector rs) { - return type(rxo::detail::reduce(*that, std::move(a), std::move(rs), std::move(seed))); - } - }; template - struct specific_reduce_result + struct defer_reduce : public defer_observable< + rxu::all_true< + rxu::defer_trait::value, + rxu::defer_trait::value>, + void, + rxo::detail::reduce, T, source_operator_type, Accumulator, ResultSelector, Seed> { - typedef void type; - static void make(const this_type* that, Seed, Accumulator, ResultSelector) { - } }; /// sum -> /// for each item from this observable reduce it by adding to the previous values. /// auto sum() const - -> typename specific_reduce_result::seed_type, std::plus, identity_for>::type { - return specific_reduce_result::seed_type, std::plus, identity_for>::make(this, rxo::detail::initialize_seeder().seed(), std::plus(), identity_for()); + -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { + return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, std::plus(), identity_for(), rxo::detail::initialize_seeder().seed()); } /// average -> /// 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. /// auto average() const - -> typename specific_reduce_result::seed_type, rxo::detail::average, rxo::detail::average>::type { - return specific_reduce_result::seed_type, rxo::detail::average, rxo::detail::average>::make(this, rxo::detail::average().seed(), rxo::detail::average(), rxo::detail::average()); + -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { + return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, rxo::detail::average(), rxo::detail::average(), rxo::detail::average().seed()); } /// scan -> diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 713c5a3..6f71c97 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -160,6 +160,99 @@ inline auto pack() return detail::pack(); } +template +struct resolve_type; + +template class Deferred, class... AN> +struct defer_trait +{ + template + 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::type...> resolved_type; + template + static auto check(int) -> tag_valid; + template + static tag_not_valid check(...); + + typedef decltype(check(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 class Deferred, class... AN> +struct defer_type +{ + template + 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::type...> resolved_type; + template + static auto check(int) -> tag_valid; + template + static tag_not_valid check(...); + + typedef decltype(check(0)) tag_type; + typedef typename tag_type::type type; + static const bool value = tag_type::value; +}; + +template class Deferred, class... AN> +struct defer_value_type +{ + template + 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::type...> resolved_type; + template + static auto check(int) -> tag_valid; + template + static tag_not_valid check(...); + + typedef decltype(check(0)) tag_type; + typedef typename tag_type::type type; + static const bool value = tag_type::value; +}; + +template class Deferred, class... AN> +struct defer_seed_type +{ + template + 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::type...> resolved_type; + template + static auto check(int) -> tag_valid; + template + static tag_not_valid check(...); + + typedef decltype(check(0)) tag_type; + typedef typename tag_type::type type; + static const bool value = tag_type::value; +}; + +template +struct resolve_type +{ + typedef D type; +}; +template class Deferred, class... AN> +struct resolve_type> +{ + typedef typename defer_type::type type; +}; +template class Deferred, class... AN> +struct resolve_type> +{ + typedef typename defer_value_type::type type; +}; +template class Deferred, class... AN> +struct resolve_type> +{ + typedef typename defer_seed_type::type type; +}; + template struct println_function { -- GitLab From 46cb2d02762c9cc92c80932c630cfe8ca7b981f1 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 14 Jul 2014 10:21:43 -0700 Subject: [PATCH 380/782] windows does not construct form bool --- Rx/v2/test/operators/concat_map.cpp | 8 ++++---- Rx/v2/test/operators/observe_on.cpp | 4 ++-- Rx/v2/test/operators/subscribe_on.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 3c4c486..2787089 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -126,8 +126,8 @@ SCENARIO("observe_on concat_map pythagorian ranges", "[hide][range][concat_map][ auto so = rx::observe_on_event_loop(); int c = 0; - std::atomic_bool done(false); - std::atomic_bool disposed(false); + std::atomic_bool done; + std::atomic_bool disposed; std::atomic ct(0); int n = 1; auto start = clock::now(); @@ -194,8 +194,8 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s auto so = rx::serialize_event_loop(); int c = 0; - std::atomic_bool done(false); - std::atomic_bool disposed(false); + std::atomic_bool done; + std::atomic_bool disposed; std::atomic ct(0); int n = 1; auto start = clock::now(); diff --git a/Rx/v2/test/operators/observe_on.cpp b/Rx/v2/test/operators/observe_on.cpp index 5b3ac50..fd0a0f8 100644 --- a/Rx/v2/test/operators/observe_on.cpp +++ b/Rx/v2/test/operators/observe_on.cpp @@ -21,8 +21,8 @@ SCENARIO("range observed on current_thread", "[hide][range][observe_on_debug][ob for (int n = 0; n < 10; n++) { - std::atomic_bool disposed(false); - std::atomic_bool done(false); + std::atomic_bool disposed; + std::atomic_bool done; auto c = std::make_shared(0); rx::composite_subscription cs; diff --git a/Rx/v2/test/operators/subscribe_on.cpp b/Rx/v2/test/operators/subscribe_on.cpp index 733aa0e..986a989 100644 --- a/Rx/v2/test/operators/subscribe_on.cpp +++ b/Rx/v2/test/operators/subscribe_on.cpp @@ -22,7 +22,7 @@ SCENARIO("for loop subscribes to map with subscribe_on and observe_on", "[hide][ int n = 1; auto start = clock::now(); for (int i = 0; i < subscriptions; i++) { - std::atomic_bool done(false); + std::atomic_bool done; rx::observable<>::just(1) .map([](int i) { std::stringstream serializer; -- GitLab From af89cd4ae10f10ca7ba4e05e7ef00d649c66dc3b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 14 Jul 2014 10:23:20 -0700 Subject: [PATCH 381/782] windows needs as_dynamic workaround --- Rx/v2/examples/println/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp index 33598a5..6904d7f 100644 --- a/Rx/v2/examples/println/main.cpp +++ b/Rx/v2/examples/println/main.cpp @@ -5,6 +5,8 @@ namespace rx=rxcpp; namespace rxu=rxcpp::util; +#include + // 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;' @@ -51,14 +53,14 @@ int main(int argc, char** argv) 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)); -- GitLab From f9a1b055cd1a55ad686da6a0a6c38d69d45a998e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 14 Jul 2014 10:24:04 -0700 Subject: [PATCH 382/782] more defferrals --- Rx/v2/src/rxcpp/rx-observable.hpp | 158 ++++++++++++++---------- Rx/v2/src/rxcpp/rx-predef.hpp | 3 + Rx/v2/src/rxcpp/sources/rx-interval.hpp | 56 +++++---- 3 files changed, 129 insertions(+), 88 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 9ce96b4..f2301bf 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -151,6 +151,62 @@ observable make_observable_dynamic(Source&& s) { return observable(dynamic_observable(std::forward(s))); } +namespace detail { +template +struct resolve_observable; + +template +struct resolve_observable +{ + typedef typename SO::type type; + typedef typename type::value_type value_type; + static const bool value = true; + typedef observable observable_type; + template + static observable_type make(const Default&, AN&&... an) { + return observable_type(type(std::forward(an)...)); + } +}; +template +struct resolve_observable +{ + static const bool value = false; + typedef Default observable_type; + template + static observable_type make(const observable_type& that, const AN&...) { + return that; + } +}; +template +struct resolve_observable +{ + typedef typename SO::type type; + typedef typename type::value_type value_type; + static const bool value = true; + typedef observable observable_type; + template + static observable_type make(AN&&... an) { + return observable_type(type(std::forward(an)...)); + } +}; +template +struct resolve_observable +{ + static const bool value = false; + typedef void observable_type; + template + static observable_type make(const AN&...) { + } +}; + +} + +template class SO, class... AN> +struct defer_observable + : public detail::resolve_observable> +{ +}; + template<> class observable; @@ -167,59 +223,6 @@ public: typedef typename std::decay::type source_operator_type; mutable source_operator_type source_operator; -protected: - template - struct resolve_observable; - - template - struct resolve_observable - { - typedef typename SO::type type; - typedef typename type::value_type value_type; - static const bool value = true; - typedef observable observable_type; - template - static observable_type make(const Default&, AN&&... an) { - return observable_type(type(std::forward(an)...)); - } - }; - template - struct resolve_observable - { - static const bool value = false; - typedef Default observable_type; - template - static observable_type make(const observable_type& that, const AN&...) { - return that; - } - }; - template - struct resolve_observable - { - typedef typename SO::type type; - typedef typename type::value_type value_type; - static const bool value = true; - typedef observable observable_type; - template - static observable_type make(AN&&... an) { - return observable_type(type(std::forward(an)...)); - } - }; - template - struct resolve_observable - { - static const bool value = false; - typedef void observable_type; - template - static observable_type make(const AN&...) { - } - }; - template class SO, class... AN> - struct defer_observable - : public resolve_observable> - { - }; - private: template @@ -456,6 +459,16 @@ public: return defer_merge::make(*this, *this, std::move(cn)); } + template + struct defer_merge_from : public defer_observable< + rxu::all_true< + is_coordination::value, + is_observable::value>, + this_type, + rxo::detail::merge, observable, observable>, Coordination> + { + }; + /// merge -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe. @@ -463,8 +476,10 @@ public: /// template auto merge(Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(); + -> typename std::enable_if< + defer_merge_from::value, + typename defer_merge_from::observable_type>::type { + return defer_merge_from::make(*this, rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()); } /// merge -> @@ -473,12 +488,13 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// template - auto merge(Coordination&& sf, Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).merge(std::forward(sf)); + auto merge(Coordination cn, Value0 v0, ValueN... vn) const + -> typename std::enable_if< + defer_merge_from::value, + typename defer_merge_from::observable_type>::type { + return defer_merge_from::make(*this, rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::move(cn)); } - /// flat_map (AKA SelectMany) -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable use the CollectionSelector to select an observable and subscribe to that observable. @@ -534,6 +550,16 @@ public: return defer_concat::make(*this, *this, std::move(cn)); } + template + struct defer_concat_from : public defer_observable< + rxu::all_true< + is_coordination::value, + is_observable::value>, + this_type, + rxo::detail::concat, observable, observable>, Coordination> + { + }; + /// concat -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from this observable subscribe to one at a time. in the order received. @@ -541,8 +567,10 @@ public: /// template auto concat(Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(); + -> typename std::enable_if< + defer_concat_from::value, + typename defer_concat_from::observable_type>::type { + return defer_concat_from::make(*this, rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), identity_current_thread()); } /// concat -> @@ -551,9 +579,11 @@ public: /// for each item from all of the nested observables deliver from the new observable that is returned. /// template - auto concat(Coordination&& sf, Value0 v0, ValueN... vn) const - -> typename std::enable_if::value, is_observable::value...>::value && !is_observable::value, observable>::type { - return rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...).concat(std::forward(sf)); + auto concat(Coordination cn, Value0 v0, ValueN... vn) const + -> typename std::enable_if< + defer_concat_from::value, + typename defer_concat_from::observable_type>::type { + return defer_concat_from::make(*this, rxs::from(this->as_dynamic(), v0.as_dynamic(), vn.as_dynamic()...), std::move(cn)); } /// concat_map -> diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 482b89e..3a36afa 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -131,6 +131,9 @@ class observable; template observable make_observable_dynamic(Source&&); +template class SO, class... AN> +struct defer_observable; + struct tag_observable {}; template struct observable_base { diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 4860acc..0bb62f5 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -68,40 +68,48 @@ struct interval : public source_base } }; -template -struct delay_resolution +template +struct defer_interval : public defer_observable< + rxu::all_true< + std::is_convertible::value, + is_coordination::value>, + void, + interval, Coordination> { - typedef observable> type; }; } + template -static auto interval(TimePoint when) - -> typename detail::delay_resolution::type { - auto cn = identity_current_thread(); - return observable>( - rxs::detail::interval(when, rxsc::scheduler::clock_type::duration::max(), cn)); - static_assert(std::is_convertible::value, "TimePoint must be convertible to rxsc::scheduler::clock_type::time_point"); +auto interval(TimePoint when) + -> typename std::enable_if< + detail::defer_interval::value, + typename detail::defer_interval::observable_type>::type { + return detail::defer_interval::make(when, rxsc::scheduler::clock_type::duration::max(), identity_current_thread()); } + template -static auto interval(rxsc::scheduler::clock_type::time_point when, Coordination cn) - -> typename std::enable_if::value, - observable>>::type { - return observable>( - rxs::detail::interval(when, rxsc::scheduler::clock_type::duration::max(), std::move(cn))); +auto interval(rxsc::scheduler::clock_type::time_point when, Coordination cn) + -> typename std::enable_if< + detail::defer_interval::value, + typename detail::defer_interval::observable_type>::type { + return detail::defer_interval::make(when, rxsc::scheduler::clock_type::duration::max(), std::move(cn)); } -template -static auto interval(rxsc::scheduler::clock_type::time_point initial, Duration period) - -> typename std::enable_if::value, - typename detail::delay_resolution>::type::type { - return observable>( - rxs::detail::interval(initial, period, identity_current_thread())); + +template +auto interval(TimePoint when, rxsc::scheduler::clock_type::duration period) + -> typename std::enable_if< + detail::defer_interval::value, + typename detail::defer_interval::observable_type>::type { + return detail::defer_interval::make(when, period, identity_current_thread()); } + template -static auto interval(rxsc::scheduler::clock_type::time_point initial, rxsc::scheduler::clock_type::duration period, Coordination cn) - -> observable> { - return observable>( - rxs::detail::interval(initial, period, std::move(cn))); +auto interval(rxsc::scheduler::clock_type::time_point when, rxsc::scheduler::clock_type::duration period, Coordination cn) + -> typename std::enable_if< + detail::defer_interval::value, + typename detail::defer_interval::observable_type>::type { + return detail::defer_interval::make(when, period, std::move(cn)); } } -- GitLab From 638ec22f5a6073f15829b542577afc79e163d7cf Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 15 Jul 2014 22:02:19 -0700 Subject: [PATCH 383/782] fixes some compilation issues adds a start_with ish thang --- Rx/v2/src/rxcpp/rx-observable.hpp | 37 +++++++++++++++++++++++--- Rx/v2/src/rxcpp/rx-util.hpp | 8 ++++++ Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 4 +-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index f2301bf..70c16a9 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -612,7 +612,7 @@ public: template struct defer_combine_latest : public defer_observable< - rxu::all_true::value, !is_observable::value, is_observable::value...>, + rxu::all_true::value, !is_coordination::value, !is_observable::value, is_observable::value...>, this_type, rxo::detail::combine_latest, Coordination, Selector, ObservableN...> { @@ -747,8 +747,8 @@ public: /// for each item from this observable reduce it by adding to the previous values. /// auto sum() const - -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { - return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, std::plus(), identity_for(), rxo::detail::initialize_seeder().seed()); + -> typename defer_reduce, rxu::plus, rxu::defer_type>::observable_type { + return defer_reduce, rxu::plus, rxu::defer_type>::make(source_operator, rxu::plus(), identity_for(), rxo::detail::initialize_seeder().seed()); } /// average -> @@ -888,6 +888,32 @@ public: return observable>( rxo::detail::repeat(*this, t)); } +#if 0 + +// causes infinite compile time recursion + + template + struct defer_start_with_from : public defer_observable< + rxu::all_true< + is_coordination::value, + std::is_convertible::value>, + this_type, + rxo::detail::concat, observable, observable>, Coordination> + { + }; + + /// start_with -> + /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// + /// + template + auto start_with(Value0 v0, ValueN... vn) const + -> typename std::enable_if< + defer_start_with_from::value, + typename defer_start_with_from::observable_type>::type { + return defer_start_with_from::make(*this, rxs::from(rxs::from(value_type(v0), value_type(vn)...).as_dynamic(), this->as_dynamic()), identity_immediate()); + } +#endif }; template @@ -1017,6 +1043,11 @@ public: -> decltype(rxs::error(std::forward(e), std::move(cn))) { return rxs::error(std::forward(e), std::move(cn)); } + template + static auto start_with(Observable o, Value0 v0, ValueN... vn) + -> decltype(rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o)) { + return rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o); + } }; diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 6f71c97..06da93e 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -253,6 +253,14 @@ struct resolve_type> typedef typename defer_seed_type::type type; }; +struct plus +{ + template + auto operator()(LHS&& lhs, RHS&& rhs) const + -> decltype(std::forward(lhs) + std::forward(rhs)) + { return std::forward(lhs) + std::forward(rhs); } +}; + template struct println_function { diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 23107da..4c1fbef 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -159,14 +159,14 @@ auto from(Coordination cn) template auto from(Value0 v0, ValueN... vn) -> typename std::enable_if::value, - decltype(iterate(std::array(), identity_immediate()))>::type { + decltype(iterate(std::array{v0, vn...}, identity_immediate()))>::type { std::array c = {v0, vn...}; return iterate(std::move(c), identity_immediate()); } template auto from(Coordination cn, Value0 v0, ValueN... vn) -> typename std::enable_if::value, - decltype(iterate(std::array(), std::move(cn)))>::type { + decltype(iterate(std::array{v0, vn...}, std::move(cn)))>::type { std::array c = {v0, vn...}; return iterate(std::move(c), std::move(cn)); } -- GitLab From ecf04618ca074a8184b3c99a95647234c2905556 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 16 Jul 2014 00:41:26 -0700 Subject: [PATCH 384/782] fix bugs in all the operators that use lift --- Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp | 9 ++- .../operators/rx-distinct_until_changed.hpp | 7 +-- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 11 ++-- Rx/v2/src/rxcpp/operators/rx-map.hpp | 7 +-- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 6 +- Rx/v2/src/rxcpp/rx-observer.hpp | 8 +++ Rx/v2/src/rxcpp/rx-subscriber.hpp | 60 +++++++++++++++++++ 7 files changed, 86 insertions(+), 22 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp index 5bd0ee4..1a9029a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -37,16 +37,15 @@ struct buffer_count } template - struct buffer_count_observer : public buffer_count_values, public observer_base> + struct buffer_count_observer : public buffer_count_values { typedef buffer_count_observer this_type; - typedef observer_base> base_type; - typedef typename base_type::value_type value_type; + typedef std::vector value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; mutable int cursor; - mutable std::deque> chunks; + mutable std::deque chunks; buffer_count_observer(dest_type d, buffer_count_values v) : buffer_count_values(v) @@ -85,7 +84,7 @@ struct buffer_count dest.on_completed(); } - static subscriber make(dest_type d, buffer_count_values v) { + static subscriber> make(dest_type d, buffer_count_values v) { auto cs = d.get_subscription(); return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); } diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp index 52954f5..a5ad360 100644 --- a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp @@ -19,11 +19,10 @@ struct distinct_until_changed typedef typename std::decay::type source_value_type; template - struct distinct_until_changed_observer : public observer_base + struct distinct_until_changed_observer { typedef distinct_until_changed_observer this_type; - typedef observer_base base_type; - typedef typename base_type::value_type value_type; + typedef source_value_type value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; @@ -46,7 +45,7 @@ struct distinct_until_changed dest.on_completed(); } - static subscriber make(dest_type d) { + static subscriber> make(dest_type d) { return make_subscriber(d, this_type(d)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index ae768c7..6dc727c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -26,19 +26,18 @@ struct filter } template - struct filter_observer : public observer_base + struct filter_observer { typedef filter_observer this_type; - typedef observer_base base_type; - typedef typename base_type::value_type value_type; + typedef source_value_type value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; test_type test; filter_observer(dest_type d, test_type t) - : dest(d) - , test(t) + : dest(std::move(d)) + , test(std::move(t)) { } void on_next(source_value_type v) const { @@ -59,7 +58,7 @@ struct filter dest.on_completed(); } - static subscriber make(dest_type d, test_type t) { + static subscriber> make(dest_type d, test_type t) { return make_subscriber(d, this_type(d, std::move(t))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 6719f1c..19e31d2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -27,11 +27,10 @@ struct map } template - struct map_observer : public observer_base + struct map_observer { typedef map_observer this_type; - typedef observer_base base_type; - typedef typename base_type::value_type value_type; + typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; @@ -59,7 +58,7 @@ struct map dest.on_completed(); } - static subscriber make(dest_type d, select_type s) { + static subscriber> make(dest_type d, select_type s) { auto cs = d.get_subscription(); return make_subscriber(std::move(cs), this_type(std::move(d), std::move(s))); } diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 001a4e2..8e6c18d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -29,11 +29,11 @@ struct observe_on } template - struct observe_on_observer : public observer_base + struct observe_on_observer { typedef observe_on_observer this_type; typedef observer_base base_type; - typedef typename base_type::value_type value_type; + typedef source_value_type value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; @@ -159,7 +159,7 @@ struct observe_on state->ensure_processing(guard); } - static subscriber make(dest_type d, coordination_type cn, composite_subscription cs = composite_subscription()) { + static subscriber> make(dest_type d, coordination_type cn, composite_subscription cs = composite_subscription()) { auto coor = cn.create_coordinator(d.get_subscription()); d.add(cs); diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 12d151d..42741fc 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -291,6 +291,14 @@ auto make_observer(observer o) -> observer { return observer(std::move(o)); } +template +auto make_observer(Observer ob) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_observer::value, + observer>::type { + return observer(std::move(ob)); +} template auto make_observer(OnNext on) -> typename std::enable_if< diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 90cc7d4..bd09873 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -145,6 +145,16 @@ auto make_subscriber( // observer // +template +auto make_subscriber() + -> typename std::enable_if< + detail::is_on_next_of>::value, + subscriber>>>>::type { + return subscriber>>>(composite_subscription(), + observer>>( + static_observer>(detail::OnNextEmpty()))); +} + template auto make_subscriber( const observer& o) @@ -158,6 +168,16 @@ auto make_subscriber(const Observer& o) subscriber>::type { return subscriber(composite_subscription(), o); } +template +auto make_subscriber(const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(composite_subscription(), o); +} template auto make_subscriber(const OnNext& on) -> typename std::enable_if< @@ -201,6 +221,15 @@ auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc) // explicit lifetime // + +template +auto make_subscriber(const composite_subscription& cs) + -> subscriber>>> { + return subscriber>>>(cs, + observer>>( + static_observer>(detail::OnNextEmpty()))); +} + template auto make_subscriber(const composite_subscription& cs, const observer& o) @@ -214,6 +243,16 @@ auto make_subscriber(const composite_subscription& cs, const Observer& o) subscriber>::type { return subscriber(cs, o); } +template +auto make_subscriber(const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(cs, o); +} template auto make_subscriber(const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< @@ -257,6 +296,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O // chain defaults from subscriber // + template auto make_subscriber(const subscriber& scbr, const observer& o) @@ -270,6 +310,16 @@ auto make_subscriber(const subscriber& scbr, const Observ subscriber>::type { return subscriber(scbr.get_subscription(), o); } +template +auto make_subscriber(const subscriber& scbr, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(scbr.get_subscription(), o); +} template auto make_subscriber(const subscriber& scbr, const OnNext& on) -> typename std::enable_if< @@ -324,6 +374,16 @@ auto make_subscriber(const subscriber& scbr, const compos subscriber>::type { return subscriber(cs, o); } +template +auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(cs, o); +} template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< -- GitLab From 71d24ac3fef3a813479c9da1fa0e4a707114697b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 16 Jul 2014 00:41:35 -0700 Subject: [PATCH 385/782] add finally --- Rx/v2/src/rxcpp/operators/rx-finally.hpp | 96 ++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 14 +++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-finally.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-finally.hpp b/Rx/v2/src/rxcpp/operators/rx-finally.hpp new file mode 100644 index 0000000..a5d7ef9 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-finally.hpp @@ -0,0 +1,96 @@ +// 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_FINALLY_HPP) +#define RXCPP_OPERATORS_RX_FINALLY_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct finally +{ + typedef typename std::decay::type source_value_type; + typedef typename std::decay::type last_call_type; + last_call_type last_call; + + finally(last_call_type lc) + : last_call(std::move(lc)) + { + } + + template + struct finally_observer + { + typedef finally_observer this_type; + typedef source_value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer 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(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static subscriber> 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(cs, this_type(d)); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(finally_observer::make(std::move(dest), last_call)) { + return finally_observer::make(std::move(dest), last_call); + } +}; + +template +class finally_factory +{ + typedef typename std::decay::type last_call_type; + last_call_type last_call; +public: + finally_factory(last_call_type lc) : last_call(std::move(lc)) {} + template + auto operator()(Observable&& source) + -> decltype(source.lift(filter::type::value_type, last_call_type>(last_call))) { + return source.lift(filter::type::value_type, last_call_type>(last_call)); + } +}; + +} + +template +auto finally(LastCall lc) + -> detail::finally_factory { + return detail::finally_factory(std::move(lc)); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 70c16a9..81edaae 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -351,10 +351,10 @@ public: /// 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 - auto subscribe(Arg0&& a0, ArgN&&... an) const + template + auto subscribe(ArgN&&... an) const -> composite_subscription { - return detail_subscribe(make_subscriber(std::forward(a0), std::forward(an)...)); + return detail_subscribe(make_subscriber(std::forward(an)...)); } /// filter (AKA Where) -> @@ -366,6 +366,14 @@ public: return lift(rxo::detail::filter(std::move(p))); } + /// finally () -> + /// + template + auto finally(LastCall lc) const + -> decltype(EXPLICIT_THIS lift(rxo::detail::finally(std::move(lc)))) { + return lift(rxo::detail::finally(std::move(lc))); + } + /// map (AKA Select) -> /// for each item from this observable use Selector to produce an item to emit from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index a8b22e4..ef23812 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -41,6 +41,7 @@ namespace rxo=operators; #include "operators/rx-connect_forever.hpp" #include "operators/rx-distinct_until_changed.hpp" #include "operators/rx-filter.hpp" +#include "operators/rx-finally.hpp" #include "operators/rx-flat_map.hpp" #include "operators/rx-lift.hpp" #include "operators/rx-map.hpp" -- GitLab From 7c415c1da911d83e790a1fbaea2d2e4050cbb5b6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 16 Jul 2014 12:03:41 -0700 Subject: [PATCH 386/782] try to find a solution that works on all compilers --- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 4c1fbef..19aa84e 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -159,14 +159,14 @@ auto from(Coordination cn) template auto from(Value0 v0, ValueN... vn) -> typename std::enable_if::value, - decltype(iterate(std::array{v0, vn...}, identity_immediate()))>::type { + decltype(iterate(*(std::array*)nullptr, identity_immediate()))>::type { std::array c = {v0, vn...}; return iterate(std::move(c), identity_immediate()); } template auto from(Coordination cn, Value0 v0, ValueN... vn) -> typename std::enable_if::value, - decltype(iterate(std::array{v0, vn...}, std::move(cn)))>::type { + decltype(iterate(*(std::array*)nullptr, std::move(cn)))>::type { std::array c = {v0, vn...}; return iterate(std::move(c), std::move(cn)); } -- GitLab From 2766c4688cc7bebabb584d94b7fc418b82a83136 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 28 Jul 2014 16:47:34 +0400 Subject: [PATCH 387/782] Add window operator --- Rx/v2/src/rxcpp/operators/rx-window.hpp | 145 ++++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 16 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + projects/CMake/CMakeLists.txt | 1 + 4 files changed, 163 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-window.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-window.hpp b/Rx/v2/src/rxcpp/operators/rx-window.hpp new file mode 100644 index 0000000..d87285d --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-window.hpp @@ -0,0 +1,145 @@ +// 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_WINDOW_HPP) +#define RXCPP_OPERATORS_RX_WINDOW_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct window +{ + typedef typename std::decay::type source_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) + { + } + + struct window_observable : public sources::source_base + { + mutable rxcpp::subjects::subject subj; + + window_observable(rxcpp::subjects::subject s) + : subj(std::move(s)) + { + } + + template + void on_subscribe(Subscriber o) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + subj.get_observable().subscribe(o); + } + }; + + template + struct window_observer : public window_values, public observer_base> + { + typedef window_observer this_type; + typedef observer_base> base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + dest_type dest; + mutable int cursor; + mutable std::deque> subj; + + window_observer(dest_type d, window_values v) + : window_values(v) + , dest(std::move(d)) + , cursor(0) + { + subj.push_back(rxcpp::subjects::subject()); + dest.on_next(observable(window_observable(subj[0]))); + } + 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()); + dest.on_next(observable(window_observable(subj[subj.size() - 1]))); + } + } + + void on_error(std::exception_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 make(dest_type d, window_values v) { + auto cs = d.get_subscription(); + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(window_observer::make(std::move(dest), initial)) { + return window_observer::make(std::move(dest), initial); + } +}; + +class window_factory +{ + int count; + int skip; +public: + window_factory(int c, int s) : count(c), skip(s) {} + template + auto operator()(Observable&& source) + -> decltype(source.lift(window::type::value_type>(count, skip))) { + return source.lift(window::type::value_type>(count, skip)); + } +}; + +} + +inline auto window(int count) + -> detail::window_factory { + return detail::window_factory(count, count); +} +inline auto window(int count, int skip) + -> detail::window_factory { + return detail::window_factory(count, skip); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 81edaae..72a8bb7 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -391,6 +391,22 @@ public: return lift(rxo::detail::distinct_until_changed()); } + /// window -> + /// produce observables containing count items emitted by this observable + /// + auto window(int count) const + -> decltype(EXPLICIT_THIS lift(rxo::detail::window(count, count))) { + return lift(rxo::detail::window(count, count)); + } + + /// window -> + /// produce observables containing count items emitted by this observable + /// + auto window(int count, int skip) const + -> decltype(EXPLICIT_THIS lift(rxo::detail::window(count, skip))) { + return lift(rxo::detail::window(count, skip)); + } + /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index ef23812..8ec9e74 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -60,5 +60,6 @@ namespace rxo=operators; #include "operators/rx-switch_on_next.hpp" #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" +#include "operators/rx-window.hpp" #endif diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 6529de1..9e34654 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -57,6 +57,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/switch_on_next.cpp ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/take_until.cpp + ${TEST_DIR}/operators/window.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From b4b4c4766a66d2b70448df870ba7480257df061a Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 28 Jul 2014 16:47:53 +0400 Subject: [PATCH 388/782] Add tests for window operator --- Rx/v2/test/operators/window.cpp | 307 ++++++++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 Rx/v2/test/operators/window.cpp diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp new file mode 100644 index 0000000..ed98030 --- /dev/null +++ b/Rx/v2/test/operators/window.cpp @@ -0,0 +1,307 @@ +#include "rxcpp/rx.hpp" +namespace rx = rxcpp; +namespace rxu = rxcpp::util; +namespace rxs = rxcpp::sources; +namespace rxsc = rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +namespace rxt = rxcpp::test; + +#include "catch.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 on; + const rxsc::test::messages> o_on; + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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 groups of ints"){ + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(420, 8), + on.on_next(470, 9), + on.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({ + 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 on; + const rxsc::test::messages> o_on; + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.on_completed(600) + }); + + WHEN("group each int with the next 2 ints"){ + auto res = rxcpp::observable>(); + auto windows = std::vector>(); + auto observers = std::vector>(); + + w.schedule_absolute( + rxsc::test::created_time, + [&](const rxsc::schedulable& scbl) { + res = xs + .window(3, 2); + } + ); + + w.schedule_absolute( + rxsc::test::subscribed_time, + [&](const rxsc::schedulable& scbl) { + res.subscribe( + // on_next + [&](rx::observable window) { + auto result = w.make_subscriber(); + 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.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_completed(280) + }); + auto actual = observers[0].messages(); + REQUIRE(required == actual); + } + + THEN("the 2nd output window contains ints"){ + auto required = rxu::to_vector({ + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_completed(350) + }); + auto actual = observers[1].messages(); + REQUIRE(required == actual); + } + + THEN("the 3rd output window contains ints"){ + auto required = rxu::to_vector({ + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_completed(420) + }); + auto actual = observers[2].messages(); + REQUIRE(required == actual); + } + + THEN("the 4th output window contains ints"){ + auto required = rxu::to_vector({ + on.on_next(420, 8), + on.on_next(470, 9), + on.on_completed(600) + }); + auto actual = observers[3].messages(); + REQUIRE(required == actual); + } + + THEN("the 5th output window contains only complete message"){ + auto required = rxu::to_vector({ + on.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, error", "[window][operators]"){ + GIVEN("1 hot observable of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + const rxsc::test::messages> o_on; + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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 groups of ints"){ + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(350, 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({ + o_on.subscribe(200, 370) + }); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + } + } +} + +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 on; + const rxsc::test::messages> o_on; + + std::runtime_error ex("window on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(100, 1), + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(470, 9), + on.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 groups of ints"){ + auto required = rxu::to_vector({ + on.on_next(210, 2), + on.on_next(240, 3), + on.on_next(280, 4), + on.on_next(280, 4), + on.on_next(320, 5), + on.on_next(350, 6), + on.on_next(350, 6), + on.on_next(380, 7), + on.on_next(420, 8), + on.on_next(420, 8), + on.on_next(470, 9), + on.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({ + o_on.subscribe(200, 600) + }); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + } + } +} -- GitLab From eb2af54bc2c0c2df479cee34ab21e1fd44219c11 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 29 Jul 2014 11:51:46 +0400 Subject: [PATCH 389/782] Change text on window tests --- Rx/v2/test/operators/window.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index ed98030..af54699 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -40,7 +40,7 @@ SCENARIO("window count, basic", "[window][operators]"){ } ); - THEN("the output contains groups of ints"){ + THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ on.on_next(210, 2), on.on_next(240, 3), @@ -59,7 +59,7 @@ SCENARIO("window count, basic", "[window][operators]"){ REQUIRE(required == actual); } - THEN("there was one subscription and one unsubscription to the xs"){ + THEN("there was one subscription and one unsubscription to the observable"){ auto required = rxu::to_vector({ o_on.subscribe(200, 600) }); @@ -167,7 +167,7 @@ SCENARIO("window count, inner timings", "[window][operators]"){ REQUIRE(required == actual); } - THEN("the 5th output window contains only complete message"){ + THEN("the 5th output window only contains complete message"){ auto required = rxu::to_vector({ on.on_completed(600) }); @@ -186,7 +186,7 @@ SCENARIO("window count, inner timings", "[window][operators]"){ } } -SCENARIO("window count, error", "[window][operators]"){ +SCENARIO("window count, dispose", "[window][operators]"){ GIVEN("1 hot observable of ints."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); @@ -218,7 +218,7 @@ SCENARIO("window count, error", "[window][operators]"){ 370 ); - THEN("the output contains groups of ints"){ + THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ on.on_next(210, 2), on.on_next(240, 3), @@ -232,7 +232,7 @@ SCENARIO("window count, error", "[window][operators]"){ REQUIRE(required == actual); } - THEN("there was one subscription and one unsubscription to the xs"){ + THEN("there was one subscription and one unsubscription to the observable"){ auto required = rxu::to_vector({ o_on.subscribe(200, 370) }); @@ -243,7 +243,7 @@ SCENARIO("window count, error", "[window][operators]"){ } } -SCENARIO("window count, basic", "[window][operators]"){ +SCENARIO("window count, error", "[window][operators]"){ GIVEN("1 hot observable of ints."){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); @@ -276,7 +276,7 @@ SCENARIO("window count, basic", "[window][operators]"){ } ); - THEN("the output contains groups of ints"){ + THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ on.on_next(210, 2), on.on_next(240, 3), @@ -295,7 +295,7 @@ SCENARIO("window count, basic", "[window][operators]"){ REQUIRE(required == actual); } - THEN("there was one subscription and one unsubscription to the xs"){ + THEN("there was one subscription and one unsubscription to the observable"){ auto required = rxu::to_vector({ o_on.subscribe(200, 600) }); -- GitLab From a5f53c4efff956d9f3c7232b23711dddc7f44612 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 22 Jul 2014 16:27:23 -0700 Subject: [PATCH 390/782] add tracing hooks --- Rx/v2/examples/pythagorian/main.cpp | 103 +++++++++++++++++++++++++- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 5 +- Rx/v2/src/rxcpp/rx-includes.hpp | 2 + Rx/v2/src/rxcpp/rx-observable.hpp | 4 + Rx/v2/src/rxcpp/rx-predef.hpp | 11 +++ Rx/v2/src/rxcpp/rx-scheduler.hpp | 25 ++++++- Rx/v2/src/rxcpp/rx-subscriber.hpp | 62 +++++++++++++--- Rx/v2/src/rxcpp/rx-subscription.hpp | 23 +++++- Rx/v2/src/rxcpp/rx-trace.hpp | 78 +++++++++++++++++++ 9 files changed, 293 insertions(+), 20 deletions(-) create mode 100644 Rx/v2/src/rxcpp/rx-trace.hpp diff --git a/Rx/v2/examples/pythagorian/main.cpp b/Rx/v2/examples/pythagorian/main.cpp index 2fd1fdf..379b1e2 100644 --- a/Rx/v2/examples/pythagorian/main.cpp +++ b/Rx/v2/examples/pythagorian/main.cpp @@ -1,3 +1,99 @@ + +#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 + inline void schedule_return(const Worker&) { + schedules++; + } + + template + inline void schedule_when_return(const Worker&) { + schedulewhens++; + } + + template + inline void action_return(const Schedulable&) { + actions++; + } + + template + inline void action_recurse(const Schedulable&) { + recurses++; + } + + template + inline void subscribe_return(const Observable& o) { + subscribes++; + } + + template + inline void lift_return(const OperatorSource&, const OperatorChain&) { + lifts++; + } + + template + inline void unsubscribe_return(const SubscriptionState&) { + unsubscribes++; + } + + template + inline void subscription_add_return(const SubscriptionState&) { + adds++; + } + + template + inline void subscription_remove_return(const SubscriptionState&) { + removes++; + } + + template + inline void on_next_return(const Observer&) { + onnexts++; + } + + template + inline void on_error_return(const Observer&) { + onerrors++; + } + + template + 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 @@ -42,7 +138,12 @@ int main(int argc, char** argv) ++ct; })); - std::cout << "concat_map pythagorian range : " << c << " filtered to, " << ct << " triplets" << std::endl; + 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/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index 80748b3..1800984 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -63,7 +63,10 @@ struct lift : public operator_base void on_subscribe(Subscriber o) const { - source.on_subscribe(chain(std::move(o))); + 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); } }; diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 2568d9d..86fd34a 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -5,6 +5,8 @@ #if !defined(RXCPP_RX_INCLUDES_HPP) #define RXCPP_RX_INCLUDES_HPP +#include "rx-trace.hpp" + // some configuration macros #if defined(_MSC_VER) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 72a8bb7..806e2c4 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -241,7 +241,10 @@ private: static_assert(std::is_same::value && std::is_convertible::value, "the value types in the sequence must match or be convertible"); static_assert(detail::has_on_subscribe_for::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(); } @@ -270,6 +273,7 @@ private: safe_subscribe(); } + trace_activity().subscribe_return(*this); return o.get_subscription(); } diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 3a36afa..805cb94 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -7,8 +7,19 @@ #include "rx-includes.hpp" +auto rxcpp_trace_activity(...) -> rxcpp::trace_noop; + namespace rxcpp { +// +// create a typedef for rxcpp_trace_type to override the default +// +auto trace_activity() -> decltype(rxcpp_trace_activity(trace_tag()))& { + static decltype(rxcpp_trace_activity(trace_tag())) trace; + return trace; +} + + struct tag_action {}; template class is_action diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 3596a0e..df5f681 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -653,6 +653,7 @@ inline action make_action(F&& f) { // tail-recurse inside of the virtual function call // until a new action, lifetime or scheduler is returned [fn](const schedulable& s, const recurse& r) { + trace_activity().action_enter(s); auto scope = s.set_recursed(r); while (s.is_subscribed()) { r.reset(); @@ -663,7 +664,9 @@ inline action make_action(F&& f) { } break; } + trace_activity().action_recurse(s); } + trace_activity().action_return(s); })); } @@ -732,11 +735,17 @@ auto worker::schedule(Arg0&& a0, ArgN&&... an) const (detail::is_action_function::value || is_subscription::value) && !is_schedulable::value>::type { - inner->schedule(make_schedulable(*this, std::forward(a0), std::forward(an)...)); + auto scbl = make_schedulable(*this, std::forward(a0), std::forward(an)...); + trace_activity().schedule_enter(*inner.get(), scbl); + inner->schedule(std::move(scbl)); + trace_activity().schedule_return(*inner.get()); } template void worker::schedule_rebind(const schedulable& scbl, ArgN&&... an) const { - inner->schedule(make_schedulable(scbl, *this, std::forward(an)...)); + auto rescbl = make_schedulable(scbl, *this, std::forward(an)...); + trace_activity().schedule_enter(*inner.get(), rescbl); + inner->schedule(std::move(rescbl)); + trace_activity().schedule_return(*inner.get()); } template @@ -745,11 +754,17 @@ auto worker::schedule(clock_type::time_point when, Arg0&& a0, ArgN&&... an) cons (detail::is_action_function::value || is_subscription::value) && !is_schedulable::value>::type { - inner->schedule(when, make_schedulable(*this, std::forward(a0), std::forward(an)...)); + auto scbl = make_schedulable(*this, std::forward(a0), std::forward(an)...); + trace_activity().schedule_when_enter(*inner.get(), when, scbl); + inner->schedule(when, std::move(scbl)); + trace_activity().schedule_when_return(*inner.get()); } template void worker::schedule_rebind(clock_type::time_point when, const schedulable& scbl, ArgN&&... an) const { - inner->schedule(when, make_schedulable(scbl, *this, std::forward(an)...)); + auto rescbl = make_schedulable(scbl, *this, std::forward(an)...); + trace_activity().schedule_when_enter(*inner.get(), when, rescbl); + inner->schedule(when, std::move(rescbl)); + trace_activity().schedule_when_return(*inner.get()); } template @@ -776,7 +791,9 @@ void worker::schedule_periodically_rebind(clock_type::time_point initial, clock_ *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 { diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index bd09873..53fbd92 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -24,18 +24,61 @@ class subscriber : public subscriber_base composite_subscription lifetime; observer_type destination; - struct detacher + struct nextdetacher { - ~detacher() + ~nextdetacher() { + trace_activity().on_next_return(*that); if (that) { that->unsubscribe(); } } - detacher(const this_type* that) + nextdetacher(const this_type* that) : that(that) { } + template + void operator()(U u) { + trace_activity().on_next_enter(*that, u); + that->destination.on_next(std::move(u)); + that = nullptr; + } + const this_type* that; + }; + + struct errordetacher + { + ~errordetacher() + { + trace_activity().on_error_return(*that); + that->unsubscribe(); + } + errordetacher(const this_type* that) + : that(that) + { + } + inline void operator()(std::exception_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; }; @@ -91,23 +134,22 @@ public: if (!is_subscribed()) { return; } - detacher protect(this); - destination.on_next(std::forward(v)); - protect.that = nullptr; + nextdetacher protect(this); + protect(std::forward(v)); } void on_error(std::exception_ptr e) const { if (!is_subscribed()) { return; } - detacher protect(this); - destination.on_error(e); + errordetacher protect(this); + protect(std::move(e)); } void on_completed() const { if (!is_subscribed()) { return; } - detacher protect(this); - destination.on_completed(); + completeddetacher protect(this); + protect(); } // composite_subscription diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 60f445c..3ee8441 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -76,7 +76,6 @@ class subscription : public subscription_base { } virtual void unsubscribe() { - issubscribed = false; } std::atomic issubscribed; }; @@ -95,16 +94,21 @@ private: } 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 state; friend bool operator<(const subscription&, const subscription&); friend bool operator==(const subscription&, const subscription&); +private: subscription(weak_state_type w) : state(w.lock()) { @@ -247,8 +251,9 @@ private: inline void remove(weak_subscription w) { if (issubscribed && !w.expired()) { + auto s = subscription::lock(w); std::unique_lock guard(lock); - subscriptions.erase(subscription::lock(w)); + subscriptions.erase(std::move(s)); } } @@ -394,7 +399,6 @@ public: using subscription::is_subscribed; using subscription::unsubscribe; - using inner_type::remove; using inner_type::clear; inline weak_subscription add(subscription s) const { @@ -403,7 +407,11 @@ public: abort(); //return s.get_weak(); } - return inner_type::add(std::move(s)); + 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 @@ -411,6 +419,13 @@ public: -> typename std::enable_if::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) { diff --git a/Rx/v2/src/rxcpp/rx-trace.hpp b/Rx/v2/src/rxcpp/rx-trace.hpp new file mode 100644 index 0000000..3da4ec8 --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-trace.hpp @@ -0,0 +1,78 @@ +// 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 + +namespace rxcpp { + +struct trace_noop +{ + template + inline void schedule_enter(const Worker&, const Schedulable&) {} + template + inline void schedule_return(const Worker&) {} + template + inline void schedule_when_enter(const Worker&, const When&, const Schedulable&) {} + template + inline void schedule_when_return(const Worker&) {} + + template + inline void action_enter(const Schedulable&) {} + template + inline void action_return(const Schedulable&) {} + template + inline void action_recurse(const Schedulable&) {} + + template + inline void subscribe_enter(const Observable& o, const Subscriber& s) {} + template + inline void subscribe_return(const Observable& o) {} + + template + inline void lift_enter(const OperatorSource&, const OperatorChain&, const Subscriber&, const SubscriberLifted&) {} + template + inline void lift_return(const OperatorSource&, const OperatorChain&) {} + + template + inline void unsubscribe_enter(const SubscriptionState&) {} + template + inline void unsubscribe_return(const SubscriptionState&) {} + + template + inline void subscription_add_enter(const SubscriptionState&, const Subscription&) {} + template + inline void subscription_add_return(const SubscriptionState&) {} + + template + inline void subscription_remove_enter(const SubscriptionState&, const WeakSubscription&) {} + template + inline void subscription_remove_return(const SubscriptionState&) {} + + template + inline void on_next_enter(const Subscriber&, const T&) {} + template + inline void on_next_return(const Subscriber&) {} + + template + inline void on_error_enter(const Subscriber&, const std::exception_ptr&) {} + template + inline void on_error_return(const Subscriber&) {} + + template + inline void on_completed_enter(const Subscriber&) {} + template + inline void on_completed_return(const Subscriber&) {} +}; + +struct trace_tag {}; + +} + +auto rxcpp_trace_activity(...) -> rxcpp::trace_noop; + + +#endif -- GitLab From 0caa97f932c4b96a5964d5c22076634e9fadb1a7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Jul 2014 07:39:29 -0700 Subject: [PATCH 391/782] add create and print. redo lift. arrrggg pulled a thread in lift and it unravelled.. --- Rx/v2/examples/println/main.cpp | 1 + Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp | 8 +- .../operators/rx-distinct_until_changed.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-finally.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 39 +- Rx/v2/src/rxcpp/operators/rx-map.hpp | 11 +- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-window.hpp | 29 +- Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 8 +- Rx/v2/src/rxcpp/rx-coordination.hpp | 22 +- Rx/v2/src/rxcpp/rx-observable.hpp | 97 ++-- Rx/v2/src/rxcpp/rx-predef.hpp | 4 +- Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/rx-subscriber.hpp | 462 ++++++++++++++++-- Rx/v2/src/rxcpp/rx-test.hpp | 10 +- Rx/v2/src/rxcpp/rx-trace.hpp | 38 +- Rx/v2/src/rxcpp/rx-util.hpp | 72 ++- Rx/v2/src/rxcpp/sources/rx-create.hpp | 55 +++ Rx/v2/src/rxcpp/sources/rx-error.hpp | 2 +- Rx/v2/src/rxcpp/subjects/rx-behavior.hpp | 17 +- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 30 +- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 15 +- Rx/v2/test/operators/lift.cpp | 12 +- Rx/v2/test/sources/create.cpp | 46 ++ Rx/v2/test/sources/defer.cpp | 2 +- Rx/v2/test/sources/interval.cpp | 6 +- Rx/v2/test/subscriptions/subscription.cpp | 24 +- projects/CMake/CMakeLists.txt | 1 + 29 files changed, 790 insertions(+), 238 deletions(-) create mode 100644 Rx/v2/src/rxcpp/sources/rx-create.hpp create mode 100644 Rx/v2/test/sources/create.cpp diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp index 6904d7f..efe09ca 100644 --- a/Rx/v2/examples/println/main.cpp +++ b/Rx/v2/examples/println/main.cpp @@ -64,5 +64,6 @@ int main(int argc, char** argv) hello_tpl().subscribe(rxu::println(std::cout)); + hello_tpl().subscribe(rxu::print_delimited_by(std::cout, " and "), rxu::endline(std::cout)); return 0; } diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp index 1a9029a..e3a2970 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -84,9 +84,9 @@ struct buffer_count dest.on_completed(); } - static subscriber> make(dest_type d, buffer_count_values v) { + static subscriber> make(dest_type d, buffer_count_values v) { auto cs = d.get_subscription(); - return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); } }; @@ -105,8 +105,8 @@ public: buffer_count_factory(int c, int s) : count(c), skip(s) {} template auto operator()(Observable&& source) - -> decltype(source.lift(buffer_count::type::value_type>(count, skip))) { - return source.lift(buffer_count::type::value_type>(count, skip)); + -> decltype(source.template lift::type::value_type>>(buffer_count::type::value_type>(count, skip))) { + return source.template lift::type::value_type>>(buffer_count::type::value_type>(count, skip)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp index a5ad360..910edda 100644 --- a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp @@ -62,8 +62,8 @@ class distinct_until_changed_factory public: template auto operator()(Observable&& source) - -> decltype(source.lift(distinct_until_changed::type>::value_type)) { - return source.lift(distinct_until_changed::type>::value_type); + -> decltype(source.template lift::type::value_type>(distinct_until_changed::type>::value_type)) { + return source.template lift::type::value_type>(distinct_until_changed::type>::value_type); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index 6dc727c..775bc16 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -79,8 +79,8 @@ public: filter_factory(test_type p) : predicate(std::move(p)) {} template auto operator()(Observable&& source) - -> decltype(source.lift(filter::type::value_type, test_type>(predicate))) { - return source.lift(filter::type::value_type, test_type>(predicate)); + -> decltype(source.template lift::type::value_type>(filter::type::value_type, test_type>(predicate))) { + return source.template lift::type::value_type>(filter::type::value_type, test_type>(predicate)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-finally.hpp b/Rx/v2/src/rxcpp/operators/rx-finally.hpp index a5d7ef9..6e2b7ad 100644 --- a/Rx/v2/src/rxcpp/operators/rx-finally.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-finally.hpp @@ -76,8 +76,8 @@ public: finally_factory(last_call_type lc) : last_call(std::move(lc)) {} template auto operator()(Observable&& source) - -> decltype(source.lift(filter::type::value_type, last_call_type>(last_call))) { - return source.lift(filter::type::value_type, last_call_type>(last_call)); + -> decltype(source.template lift::type::value_type>(filter::type::value_type, last_call_type>(last_call))) { + return source.template lift::type::value_type>(filter::type::value_type, last_call_type>(last_call)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index 1800984..ad2ec4f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -11,7 +11,7 @@ namespace rxcpp { namespace detail { -template +template struct is_lift_function_for { struct tag_not_valid {}; @@ -23,7 +23,7 @@ struct is_lift_function_for { typedef typename std::decay::type for_type; typedef typename std::decay::type func_type; typedef decltype(check(0)) detail_result; - static const bool value = is_subscriber::value && is_subscriber::value; + static const bool value = is_subscriber::value && is_subscriber::value && std::is_convertible::value; }; } @@ -32,25 +32,22 @@ namespace operators { namespace detail { -template +template struct lift_traits { + typedef typename std::decay::type result_value_type; typedef typename std::decay::type source_operator_type; typedef typename std::decay::type operator_type; typedef typename source_operator_type::value_type source_value_type; - static_assert(rxcpp::detail::is_lift_function_for, operator_type>::value, "lift Operator must be a function with the signature subscriber<...>(subscriber)"); - - typedef decltype((*(operator_type*)nullptr)(*(subscriber*)nullptr)) result_for_dynamic_source_subscriber_type; - - typedef typename result_for_dynamic_source_subscriber_type::value_type result_value_type; + static_assert(rxcpp::detail::is_lift_function_for, operator_type>::value, "lift Operator must be a function with the signature subscriber(subscriber)"); }; -template -struct lift : public operator_base::result_value_type> +template +struct lift : public operator_base::result_value_type> { - typedef lift_traits traits; + typedef lift_traits traits; typedef typename traits::source_operator_type source_operator_type; typedef typename traits::operator_type operator_type; source_operator_type source; @@ -70,6 +67,26 @@ struct lift : public operator_base +class lift_factory +{ + typedef typename std::decay::type operator_type; + operator_type chain; +public: + lift_factory(operator_type op) : chain(std::move(op)) {} + template + auto operator()(Observable&& source) + -> decltype(source.template lift(chain)) { + return source.template lift(chain); + } +}; + +} + +template +auto lift(Operator&& op) + -> detail::lift_factory { + return detail::lift_factory(std::forward(op)); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 19e31d2..1de7602 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -19,6 +19,7 @@ struct map { typedef typename std::decay::type source_value_type; typedef typename std::decay::type select_type; + typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type; select_type selector; map(select_type s) @@ -32,7 +33,7 @@ struct map typedef map_observer this_type; typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type; typedef typename std::decay::type dest_type; - typedef observer observer_type; + typedef observer observer_type; dest_type dest; select_type selector; @@ -58,9 +59,9 @@ struct map dest.on_completed(); } - static subscriber> make(dest_type d, select_type s) { + static subscriber make(dest_type d, select_type s) { auto cs = d.get_subscription(); - return make_subscriber(std::move(cs), this_type(std::move(d), std::move(s))); + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(s)))); } }; @@ -80,8 +81,8 @@ public: map_factory(select_type s) : selector(std::move(s)) {} template auto operator()(Observable&& source) - -> decltype(source.lift(map::type::value_type, select_type>(selector))) { - return source.lift(map::type::value_type, select_type>(selector)); + -> decltype(source.lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector))) { + return source.lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 8e6c18d..c1157de 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -193,8 +193,8 @@ public: observe_on_factory(coordination_type cn) : coordination(std::move(cn)) {} template auto operator()(Observable&& source) - -> decltype(source.lift(observe_on::type::value_type, coordination_type>(coordination))) { - return source.lift(observe_on::type::value_type, coordination_type>(coordination)); + -> decltype(source.template lift::type::value_type>(observe_on::type::value_type, coordination_type>(coordination))) { + return source.template lift::type::value_type>(observe_on::type::value_type, coordination_type>(coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window.hpp b/Rx/v2/src/rxcpp/operators/rx-window.hpp index d87285d..c2bf220 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window.hpp @@ -35,22 +35,6 @@ struct window { } - struct window_observable : public sources::source_base - { - mutable rxcpp::subjects::subject subj; - - window_observable(rxcpp::subjects::subject s) - : subj(std::move(s)) - { - } - - template - void on_subscribe(Subscriber o) const { - static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - subj.get_observable().subscribe(o); - } - }; - template struct window_observer : public window_values, public observer_base> { @@ -58,6 +42,7 @@ struct window typedef observer_base> base_type; typedef typename base_type::value_type value_type; typedef typename std::decay::type dest_type; + typedef observer observer_type; dest_type dest; mutable int cursor; mutable std::deque> subj; @@ -68,7 +53,7 @@ struct window , cursor(0) { subj.push_back(rxcpp::subjects::subject()); - dest.on_next(observable(window_observable(subj[0]))); + dest.on_next(subj[0].get_observable().as_dynamic()); } void on_next(T v) const { for (auto s : subj) { @@ -83,7 +68,7 @@ struct window if (++cursor % this->skip == 0) { subj.push_back(rxcpp::subjects::subject()); - dest.on_next(observable(window_observable(subj[subj.size() - 1]))); + dest.on_next(subj[subj.size() - 1].get_observable().as_dynamic()); } } @@ -101,9 +86,9 @@ struct window dest.on_completed(); } - static subscriber make(dest_type d, window_values v) { + static subscriber make(dest_type d, window_values v) { auto cs = d.get_subscription(); - return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v))); + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v)))); } }; @@ -122,8 +107,8 @@ public: window_factory(int c, int s) : count(c), skip(s) {} template auto operator()(Observable&& source) - -> decltype(source.lift(window::type::value_type>(count, skip))) { - return source.lift(window::type::value_type>(count, skip)); + -> decltype(source.template lift::type::value_type>>(window::type::value_type>(count, skip))) { + return source.template lift::type::value_type>>(window::type::value_type>(count, skip)); } }; diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 445e261..0352605 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -206,8 +206,8 @@ public: // template auto operator >> (const rxcpp::connectable_observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } // @@ -216,8 +216,8 @@ auto operator >> (const rxcpp::connectable_observable& source // template auto operator | (const rxcpp::connectable_observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } #endif diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index cbe030d..abd1506 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -195,13 +195,12 @@ class serialize_one_worker : public coordination_base } }; - template - struct serialize_observer : public observer_base + template + struct serialize_observer { - typedef serialize_observer this_type; - typedef observer_base base_type; - typedef typename base_type::value_type value_type; - typedef typename std::decay::type dest_type; + typedef serialize_observer this_type; + typedef typename std::decay::type dest_type; + typedef typename dest_type::value_type value_type; typedef observer observer_type; dest_type dest; std::shared_ptr lock; @@ -227,8 +226,9 @@ class serialize_one_worker : public coordination_base dest.on_completed(); } - static subscriber make(dest_type d, std::shared_ptr m) { - return make_subscriber(d, this_type(d, std::move(m))); + template + static subscriber make(const Subscriber& s, std::shared_ptr m) { + return make_subscriber(s, observer_type(this_type(s.get_observer(), std::move(m)))); } }; @@ -259,9 +259,9 @@ class serialize_one_worker : public coordination_base return std::move(o); } template - auto out(Subscriber s) const - -> decltype(serialize_observer::make(std::move(s), lock)) { - return serialize_observer::make(std::move(s), lock); + auto out(const Subscriber& s) const + -> decltype(serialize_observer::make(s, lock)) { + return serialize_observer::make(s, lock); } template auto act(F f) const diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 806e2c4..944d230 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -46,38 +46,6 @@ struct has_on_subscribe_for static const bool value = std::is_same::value; }; -struct lift_function { -template -static auto chain(const SourceObservable& source, OperatorFactory&& of) - -> decltype(source.lift(std::forward(of))) { - return source.lift(std::forward(of)); -} -}; -struct operator_factory { -template -static auto chain(const SourceObservable& source, OperatorFactory&& of) - -> decltype(source.op(std::forward(of))) { - return source.op(std::forward(of)); -} -}; -struct not_chainable { -}; - -template -struct select_chain -{ - typedef - typename std::conditional< - rxcpp::detail::is_lift_function_for, OperatorFactory>::value, - lift_function, - typename std::conditional< - rxcpp::detail::is_operator_factory_for::value, - operator_factory, - not_chainable - >::type - >::type type; -}; - } template @@ -131,9 +99,9 @@ public: } template - typename std::enable_if>::value, void>::type + typename std::enable_if::value, void>::type on_subscribe(Subscriber o) const { - state->on_subscribe(make_subscriber(o, make_observer_dynamic(o.get_observer()))); + state->on_subscribe(o.as_dynamic()); } }; @@ -237,7 +205,7 @@ private: typedef typename std::decay::type subscriber_type; - static_assert(is_observer::value, "subscribe must be passed an observer"); + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); static_assert(std::is_same::value && std::is_convertible::value, "the value types in the sequence must match or be convertible"); static_assert(detail::has_on_subscribe_for::value, "inner must have on_subscribe method that accepts this subscriber "); @@ -337,12 +305,12 @@ public: /// this is intended to allow externally defined operators, that use make_subscriber, to be connected /// into the expression. /// - template + template auto lift(Operator&& op) const - -> observable::value_type, rxo::detail::lift> { - return observable::value_type, rxo::detail::lift>( - rxo::detail::lift(source_operator, std::forward(op))); - static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); + -> observable::value_type, rxo::detail::lift> { + return observable::value_type, rxo::detail::lift>( + rxo::detail::lift(source_operator, std::forward(op))); + static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } /// @@ -366,16 +334,16 @@ public: /// template auto filter(Predicate p) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::filter(std::move(p)))) { - return lift(rxo::detail::filter(std::move(p))); + -> decltype(EXPLICIT_THIS lift(rxo::detail::filter(std::move(p)))) { + return lift(rxo::detail::filter(std::move(p))); } /// finally () -> /// template auto finally(LastCall lc) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::finally(std::move(lc)))) { - return lift(rxo::detail::finally(std::move(lc))); + -> decltype(EXPLICIT_THIS lift(rxo::detail::finally(std::move(lc)))) { + return lift(rxo::detail::finally(std::move(lc))); } /// map (AKA Select) -> @@ -383,48 +351,48 @@ public: /// template auto map(Selector&& s) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::map(std::move(s)))) { - return lift(rxo::detail::map(std::move(s))); + -> decltype(EXPLICIT_THIS lift::value_type>(rxo::detail::map(std::move(s)))) { + return lift::value_type>(rxo::detail::map(std::move(s))); } /// distinct_until_changed -> /// for each item from this observable, filter out repeated values and emit only changes from the new observable that is returned. /// auto distinct_until_changed() const - -> decltype(EXPLICIT_THIS lift(rxo::detail::distinct_until_changed())) { - return lift(rxo::detail::distinct_until_changed()); + -> decltype(EXPLICIT_THIS lift(rxo::detail::distinct_until_changed())) { + return lift(rxo::detail::distinct_until_changed()); } /// window -> /// produce observables containing count items emitted by this observable /// auto window(int count) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::window(count, count))) { - return lift(rxo::detail::window(count, count)); + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window(count, count))) { + return lift>(rxo::detail::window(count, count)); } /// window -> /// produce observables containing count items emitted by this observable /// auto window(int count, int skip) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::window(count, skip))) { - return lift(rxo::detail::window(count, skip)); + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window(count, skip))) { + return lift>(rxo::detail::window(count, skip)); } /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// auto buffer(int count) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::buffer_count(count, count))) { - return lift(rxo::detail::buffer_count(count, count)); + -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_count(count, count))) { + return lift>(rxo::detail::buffer_count(count, count)); } /// buffer -> /// start a new vector every skip items and collect count items from this observable into each vector to emit from the new observable that is returned. /// auto buffer(int count, int skip) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::buffer_count(count, skip))) { - return lift(rxo::detail::buffer_count(count, skip)); + -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_count(count, skip))) { + return lift>(rxo::detail::buffer_count(count, skip)); } template @@ -747,8 +715,8 @@ public: /// template auto observe_on(Coordination cn) const - -> decltype(EXPLICIT_THIS lift(rxo::detail::observe_on(std::move(cn)))) { - return lift(rxo::detail::observe_on(std::move(cn))); + -> decltype(EXPLICIT_THIS lift(rxo::detail::observe_on(std::move(cn)))) { + return lift(rxo::detail::observe_on(std::move(cn))); } /// reduce -> @@ -960,6 +928,11 @@ class observable { ~observable(); public: + template + static auto create(OnSubscribe os) + -> decltype(rxs::create(std::move(os))) { + return rxs::create(std::move(os)); + } template static auto range(T first = 0, T last = std::numeric_limits::max(), ptrdiff_t step = 1) -> decltype(rxs::range(first, last, step, identity_current_thread())) { @@ -1087,8 +1060,8 @@ public: // template auto operator >> (const rxcpp::observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } // @@ -1097,8 +1070,8 @@ auto operator >> (const rxcpp::observable& source, OperatorFa // template auto operator | (const rxcpp::observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } #endif diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 805cb94..1b82f40 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -7,14 +7,12 @@ #include "rx-includes.hpp" -auto rxcpp_trace_activity(...) -> rxcpp::trace_noop; - namespace rxcpp { // // create a typedef for rxcpp_trace_type to override the default // -auto trace_activity() -> decltype(rxcpp_trace_activity(trace_tag()))& { +inline auto trace_activity() -> decltype(rxcpp_trace_activity(trace_tag()))& { static decltype(rxcpp_trace_activity(trace_tag())) trace; return trace; } diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index b4205ff..c9fb73f 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -35,6 +35,7 @@ namespace rxs=sources; } +#include "sources/rx-create.hpp" #include "sources/rx-range.hpp" #include "sources/rx-iterate.hpp" #include "sources/rx-interval.hpp" diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 53fbd92..dbb3615 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -18,32 +18,37 @@ struct subscriber_base : public observer_base, public subscription_base template> class subscriber : public subscriber_base { + static_assert(!is_subscriber::value, "not allowed to nest subscribers"); + static_assert(is_observer::value, "subscriber must contain an observer"); typedef subscriber this_type; typedef typename std::decay::type observer_type; composite_subscription lifetime; observer_type destination; + trace_id id; struct nextdetacher { ~nextdetacher() { trace_activity().on_next_return(*that); - if (that) { + if (do_unsubscribe) { that->unsubscribe(); } } nextdetacher(const this_type* that) : that(that) + , do_unsubscribe(true) { } template void operator()(U u) { trace_activity().on_next_enter(*that, u); that->destination.on_next(std::move(u)); - that = nullptr; + do_unsubscribe = false; } const this_type* that; + bool do_unsubscribe; }; struct errordetacher @@ -89,24 +94,31 @@ public: 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 - subscriber(composite_subscription cs, U&& o) + subscriber(trace_id id, composite_subscription cs, U&& o) : lifetime(std::move(cs)) , destination(std::forward(o)) + , id(std::move(id)) { + static_assert(!is_subscriber::value, "cannot nest subscribers"); + static_assert(is_observer::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; } @@ -122,9 +134,12 @@ public: composite_subscription& get_subscription() { return lifetime; } + trace_id get_id() const { + return id; + } subscriber as_dynamic() const { - return subscriber(lifetime, destination.as_dynamic()); + return subscriber(id, lifetime, destination.as_dynamic()); } // observer @@ -192,7 +207,7 @@ auto make_subscriber() -> typename std::enable_if< detail::is_on_next_of>::value, subscriber>>>>::type { - return subscriber>>>(composite_subscription(), + return subscriber>>>(trace_id::make_next_id_subscriber(), composite_subscription(), observer>>( static_observer>(detail::OnNextEmpty()))); } @@ -201,14 +216,14 @@ template auto make_subscriber( const observer& o) -> subscriber> { - return subscriber>(composite_subscription(), o); + return subscriber>(trace_id::make_next_id_subscriber(), composite_subscription(), o); } template auto make_subscriber(const Observer& o) -> typename std::enable_if< is_observer::value, subscriber>::type { - return subscriber(composite_subscription(), o); + return subscriber(trace_id::make_next_id_subscriber(), composite_subscription(), o); } template auto make_subscriber(const Observer& o) @@ -218,14 +233,14 @@ auto make_subscriber(const Observer& o) !is_subscription::value && !is_observer::value, subscriber>>::type { - return subscriber>(composite_subscription(), o); + return subscriber>(trace_id::make_next_id_subscriber(), composite_subscription(), o); } template auto make_subscriber(const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), + return subscriber>>(trace_id::make_next_id_subscriber(), composite_subscription(), observer>( static_observer(on))); } @@ -235,7 +250,7 @@ auto make_subscriber(const OnNext& on, const OnError& oe) detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), + return subscriber>>(trace_id::make_next_id_subscriber(), composite_subscription(), observer>( static_observer(on, oe))); } @@ -245,7 +260,7 @@ auto make_subscriber(const OnNext& on, const OnCompleted& oc) detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), + return subscriber>>(trace_id::make_next_id_subscriber(), composite_subscription(), observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -256,7 +271,7 @@ auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc) detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(composite_subscription(), + return subscriber>>(trace_id::make_next_id_subscriber(), composite_subscription(), observer>( static_observer(on, oe, oc))); } @@ -267,7 +282,7 @@ auto make_subscriber(const OnNext& on, const OnError& oe, const OnCompleted& oc) template auto make_subscriber(const composite_subscription& cs) -> subscriber>>> { - return subscriber>>>(cs, + return subscriber>>>(trace_id::make_next_id_subscriber(), cs, observer>>( static_observer>(detail::OnNextEmpty()))); } @@ -276,14 +291,21 @@ template auto make_subscriber(const composite_subscription& cs, const observer& o) -> subscriber> { - return subscriber>(cs, o); + return subscriber>(trace_id::make_next_id_subscriber(), cs, o); +} +template +auto make_subscriber(const composite_subscription& cs, + const subscriber& s) + -> subscriber { + return subscriber(trace_id::make_next_id_subscriber(), cs, s.get_observer()); } template auto make_subscriber(const composite_subscription& cs, const Observer& o) -> typename std::enable_if< + !is_subscriber::value && is_observer::value, subscriber>::type { - return subscriber(cs, o); + return subscriber(trace_id::make_next_id_subscriber(), cs, o); } template auto make_subscriber(const composite_subscription& cs, const Observer& o) @@ -293,14 +315,14 @@ auto make_subscriber(const composite_subscription& cs, const Observer& o) !is_subscription::value && !is_observer::value, subscriber>>::type { - return subscriber>(cs, o); + return subscriber>(trace_id::make_next_id_subscriber(), cs, make_observer(o)); } template auto make_subscriber(const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, subscriber>>>::type { - return subscriber>>(cs, + return subscriber>>(trace_id::make_next_id_subscriber(), cs, observer>( static_observer(on))); } @@ -310,7 +332,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_next_of::value && detail::is_on_error::value, subscriber>>>::type { - return subscriber>>(cs, + return subscriber>>(trace_id::make_next_id_subscriber(), cs, observer>( static_observer(on, oe))); } @@ -320,7 +342,7 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_next_of::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, + return subscriber>>(trace_id::make_next_id_subscriber(), cs, observer>( static_observer(on, detail::OnErrorEmpty(), oc))); } @@ -331,7 +353,153 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O detail::is_on_error::value && detail::is_on_completed::value, subscriber>>>::type { - return subscriber>>(cs, + return subscriber>>(trace_id::make_next_id_subscriber(), cs, + observer>( + static_observer(on, oe, oc))); +} + +// explicit id +// + +template +auto make_subscriber(trace_id id) + -> subscriber>>> { + return subscriber>>>(std::move(id), composite_subscription(), + observer>>( + static_observer>(detail::OnNextEmpty()))); +} + +template +auto make_subscriber(trace_id id, const composite_subscription& cs) + -> subscriber>>> { + return subscriber>>>(std::move(id), cs, + observer>>( + static_observer>(detail::OnNextEmpty()))); +} + +template +auto make_subscriber(trace_id id, + const observer& o) + -> subscriber> { + return subscriber>(std::move(id), composite_subscription(), o); +} +template +auto make_subscriber(trace_id id, const composite_subscription& cs, + const observer& o) + -> subscriber> { + return subscriber>(std::move(id), cs, o); +} +template +auto make_subscriber(trace_id id, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(std::move(id), composite_subscription(), o); +} +template +auto make_subscriber(trace_id id, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + return subscriber(std::move(id), cs, o); +} +template +auto make_subscriber(trace_id id, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(std::move(id), composite_subscription(), o); +} +template +auto make_subscriber(trace_id id, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + return subscriber>(std::move(id), cs, o); +} +template +auto make_subscriber(trace_id id, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(std::move(id), composite_subscription(), + observer>( + static_observer(on))); +} +template +auto make_subscriber(trace_id id, const composite_subscription& cs, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + return subscriber>>(std::move(id), cs, + observer>( + static_observer(on))); +} +template +auto make_subscriber(trace_id id, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(std::move(id), composite_subscription(), + observer>( + static_observer(on, oe))); +} +template +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::value && + detail::is_on_error::value, + subscriber>>>::type { + return subscriber>>(std::move(id), cs, + observer>( + static_observer(on, oe))); +} +template +auto make_subscriber(trace_id id, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(std::move(id), composite_subscription(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +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::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(std::move(id), cs, + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); +} +template +auto make_subscriber(trace_id id, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(std::move(id), composite_subscription(), + observer>( + static_observer(on, oe, oc))); +} +template +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::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + return subscriber>>(std::move(id), cs, observer>( static_observer(on, oe, oc))); } @@ -342,15 +510,37 @@ auto make_subscriber(const composite_subscription& cs, const OnNext& on, const O template auto make_subscriber(const subscriber& scbr, const observer& o) - -> subscriber> { - return subscriber>(scbr.get_subscription(), o); + -> subscriber> { + auto r = subscriber>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), o); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, + const observer& o) + -> subscriber> { + auto r = subscriber>(std::move(id), scbr.get_subscription(), o); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + auto r = subscriber(std::move(id), scbr.get_subscription(), o); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const Observer& o) -> typename std::enable_if< + !is_subscription::value && is_observer::value, - subscriber>::type { - return subscriber(scbr.get_subscription(), o); + subscriber>::type { + auto r = subscriber(trace_id::make_next_id_subscriber(), scbr.get_subscription(), o); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const Observer& o) @@ -359,37 +549,92 @@ auto make_subscriber(const subscriber& scbr, const Observ !is_subscriber::value && !is_subscription::value && !is_observer::value, - subscriber>>::type { - return subscriber>(scbr.get_subscription(), o); + subscriber>>::type { + auto r = subscriber>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), make_observer(o)); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + auto r = subscriber>(std::move(id), scbr.get_subscription(), o); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), + observer>( + static_observer(on))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), scbr.get_subscription(), observer>( static_observer(on))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnError& oe) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_error::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), + observer>( + static_observer(on, oe))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), scbr.get_subscription(), observer>( static_observer(on, oe))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnCompleted& oc) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), scbr.get_subscription(), observer>( static_observer(on, detail::OnErrorEmpty(), oc))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const OnNext& on, const OnError& oe, const OnCompleted& oc) @@ -397,24 +642,56 @@ auto make_subscriber(const subscriber& scbr, const OnNext detail::is_on_next_of::value && detail::is_on_error::value && detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(scbr.get_subscription(), + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), scbr.get_subscription(), + observer>( + static_observer(on, oe, oc))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const OnNext& on, const OnError& oe, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), scbr.get_subscription(), observer>( static_observer(on, oe, oc))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const observer& o) -> subscriber> { - return subscriber>(cs, o); + return subscriber>(trace_id::make_next_id_subscriber(), cs, o); +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, + const observer& o) + -> subscriber> { + return subscriber>(std::move(id), cs, o); } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const Observer& o) -> typename std::enable_if< is_observer::value, - subscriber>::type { - return subscriber(cs, o); + subscriber>::type { + auto r = subscriber(trace_id::make_next_id_subscriber(), cs, o); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + is_observer::value, + subscriber>::type { + auto r = subscriber(std::move(id), cs, o); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const Observer& o) @@ -423,37 +700,92 @@ auto make_subscriber(const subscriber& scbr, const compos !is_subscriber::value && !is_subscription::value && !is_observer::value, - subscriber>>::type { - return subscriber>(cs, o); + subscriber>>::type { + auto r = subscriber>(trace_id::make_next_id_subscriber(), cs, o); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, const Observer& o) + -> typename std::enable_if< + !detail::is_on_next_of::value && + !is_subscriber::value && + !is_subscription::value && + !is_observer::value, + subscriber>>::type { + auto r = subscriber>(std::move(id), cs, o); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on) -> typename std::enable_if< detail::is_on_next_of::value, - subscriber>>>::type { - return subscriber>>(cs, + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), cs, + observer>( + static_observer(on))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, const OnNext& on) + -> typename std::enable_if< + detail::is_on_next_of::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), cs, observer>( static_observer(on))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_error::value, - subscriber>>>::type { - return subscriber>>(cs, + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), cs, + observer>( + static_observer(on, oe))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, const OnNext& on, const OnError& oe) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_error::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), cs, observer>( static_observer(on, oe))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc) -> typename std::enable_if< detail::is_on_next_of::value && detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(cs, + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), cs, + observer>( + static_observer(on, detail::OnErrorEmpty(), oc))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, const OnNext& on, const OnCompleted& oc) + -> typename std::enable_if< + detail::is_on_next_of::value && + detail::is_on_completed::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), cs, observer>( static_observer(on, detail::OnErrorEmpty(), oc))); + trace_activity().connect(r, scbr); + return r; } template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, const OnNext& on, const OnError& oe, const OnCompleted& oc) @@ -461,18 +793,48 @@ auto make_subscriber(const subscriber& scbr, const compos detail::is_on_next_of::value && detail::is_on_error::value && detail::is_on_completed::value, - subscriber>>>::type { - return subscriber>>(cs, + subscriber>>>::type { + auto r = subscriber>>(trace_id::make_next_id_subscriber(), cs, + observer>( + static_observer(on, oe, oc))); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& 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::value && + detail::is_on_error::value && + detail::is_on_completed::value, + subscriber>>>::type { + auto r = subscriber>>(std::move(id), cs, observer>( static_observer(on, oe, oc))); + trace_activity().connect(r, scbr); + return r; } -// override lifetime -// template auto make_subscriber(const subscriber& scbr, const composite_subscription& cs) -> subscriber { - return subscriber(cs, scbr.get_observer()); + auto r = subscriber(scbr.get_id(), cs, scbr.get_observer()); + trace_activity().connect(r, scbr); + return r; +} +template +auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs) + -> subscriber { + auto r = subscriber(std::move(id), cs, scbr.get_observer()); + trace_activity().connect(r, scbr); + return r; +} + +template +auto make_subscriber(const subscriber& scbr, trace_id id) + -> subscriber { + auto r = subscriber(std::move(id), scbr.get_subscription(), scbr.get_observer()); + trace_activity().connect(r, scbr); + return r; } } diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index cf4841b..542c55b 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -42,7 +42,7 @@ struct test_source static_assert(is_subscriber::value, "on_subscribe must be passed a subscriber."); - ts->on_subscribe(make_subscriber(o, make_observer_dynamic(o.get_observer()))); + ts->on_subscribe(o.as_dynamic()); } }; @@ -111,8 +111,8 @@ namespace rxt=test; // template auto operator >> (const rxcpp::test::testable_observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } // @@ -121,8 +121,8 @@ auto operator >> (const rxcpp::test::testable_observable& source, OperatorFac // template auto operator | (const rxcpp::test::testable_observable& source, OperatorFactory&& of) - -> decltype(rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of))) { - return rxcpp::detail::select_chain, OperatorFactory>::type::chain(source, std::forward(of)); + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); } #include "schedulers/rx-test.hpp" diff --git a/Rx/v2/src/rxcpp/rx-trace.hpp b/Rx/v2/src/rxcpp/rx-trace.hpp index 3da4ec8..e72caaf 100644 --- a/Rx/v2/src/rxcpp/rx-trace.hpp +++ b/Rx/v2/src/rxcpp/rx-trace.hpp @@ -5,10 +5,40 @@ #if !defined(RXCPP_RX_TRACE_HPP) #define RXCPP_RX_TRACE_HPP +#include #include +#include namespace rxcpp { +struct trace_id +{ + static inline trace_id make_next_id_subscriber() { + static std::atomic 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 @@ -32,6 +62,9 @@ struct trace_noop template inline void subscribe_return(const Observable& o) {} + template + inline void connect(const SubscriberFrom&, const SubscriberTo&) {} + template inline void lift_enter(const OperatorSource&, const OperatorChain&, const Subscriber&, const SubscriberLifted&) {} template @@ -52,6 +85,9 @@ struct trace_noop template inline void subscription_remove_return(const SubscriptionState&) {} + template + inline void create_subscriber(const Subscriber&) {} + template inline void on_next_enter(const Subscriber&, const T&) {} template @@ -72,7 +108,7 @@ struct trace_tag {}; } -auto rxcpp_trace_activity(...) -> rxcpp::trace_noop; +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 index 06da93e..9e613c4 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -261,27 +261,85 @@ struct plus { return std::forward(lhs) + std::forward(rhs); } }; -template -struct println_function +namespace detail { +template +struct print_function { OStream& os; - println_function(OStream& os) : os(os) {} + Delimit delimit; + print_function(OStream& os, Delimit d) : os(os), delimit(std::move(d)) {} template void operator()(const TN&... tn) const { bool inserts[] = {(os << tn, true)...}; - os << std::endl; + delimit(); } template void operator()(const std::tuple& tpl) const { - apply(tpl, *this); + rxcpp::util::apply(tpl, *this); } }; + +template +struct endline +{ + OStream& os; + endline(OStream& os) : os(os) {} + void operator()() const { + os << std::endl; + } +}; + +template +struct insert_value +{ + OStream& os; + ValueType value; + insert_value(OStream& os, ValueType v) : os(os), value(std::move(v)) {} + void operator()() const { + os << value; + } +}; + +template +struct insert_function +{ + OStream& os; + Function call; + insert_function(OStream& os, Function f) : os(os), call(std::move(f)) {} + void operator()() const { + call(os); + } +}; + +} + +template +auto endline(OStream& os) + -> detail::endline { + return detail::endline(os); +} + +template +auto print(OStream& os, Delimit d) + -> decltype(d(), detail::print_function(os, std::move(d))) { + return detail::print_function(os, std::move(d)); +} +template +auto print(OStream& os, Delimit d) + -> decltype(d(os), detail::print_function>(os, detail::insert_function(os, std::move(d)))) { + return detail::print_function>(os, detail::insert_function(os, std::move(d))); +} template auto println(OStream& os) - -> println_function { - return println_function(os); + -> decltype(print(os, endline(os))) { + return print(os, endline(os)); +} +template +auto print_delimited_by(OStream& os, DelimitValue dv) + -> detail::print_function> { + return detail::print_function>(os, detail::insert_value(os, std::move(dv))); } namespace detail { diff --git a/Rx/v2/src/rxcpp/sources/rx-create.hpp b/Rx/v2/src/rxcpp/sources/rx-create.hpp new file mode 100644 index 0000000..2c50e98 --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-create.hpp @@ -0,0 +1,55 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct create : public source_base +{ + typedef create this_type; + + typedef typename std::decay::type on_subscribe_type; + + on_subscribe_type on_subscribe_function; + + create(on_subscribe_type os) + : on_subscribe_function(std::move(os)) + { + } + + template + void on_subscribe(Subscriber o) const { + + on_exception( + [&](){ + this->on_subscribe_function(o); + return true; + }, + o); + } +}; + +} + +template +auto create(OnSubscribe os) + -> observable> { + return observable>( + detail::create(std::move(os))); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index 4b2c4bb..5014c7c 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -44,7 +44,7 @@ struct error : public source_base // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); - auto controller = coordinator.get_output().get_worker(); + auto controller = coordinator.get_worker(); auto exception = initial.exception; auto producer = [=](const rxsc::schedulable&){ diff --git a/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp b/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp index 539f8d6..ff3becb 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-behavior.hpp @@ -49,6 +49,10 @@ public: { } + subscriber get_subscriber() const { + return make_subscriber(this->get_id(), this->get_subscription(), observer>(*this)).as_dynamic(); + } + T get_value() const { return state->get(); } @@ -65,13 +69,11 @@ public: template class behavior { - composite_subscription lifetime; detail::behavior_observer s; public: explicit behavior(T f, composite_subscription cs = composite_subscription()) - : lifetime(std::move(cs)) - , s(std::move(f), lifetime) + : s(std::move(f), cs) { } @@ -84,15 +86,16 @@ public: } subscriber get_subscriber() const { - return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); + return s.get_subscriber(); } observable get_observable() const { - return make_observable_dynamic([this](subscriber o){ - if (lifetime.is_subscribed()) { + auto keepAlive = s; + return make_observable_dynamic([=](subscriber o){ + if (keepAlive.get_subscription().is_subscribed()) { o.on_next(get_value()); } - this->s.add(std::move(o)); + keepAlive.add(s.get_subscriber(), std::move(o)); }); } }; diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index eff91c9..e07cc69 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -77,12 +77,15 @@ class multicast_observer { explicit binder_type(composite_subscription cs) : state(std::make_shared(cs)) + , id(trace_id::make_next_id_subscriber()) , current_generation(0) { } std::shared_ptr state; + trace_id id; + // used to avoid taking lock in on_next mutable int current_generation; mutable std::shared_ptr current_completer; @@ -93,18 +96,29 @@ class multicast_observer std::shared_ptr b; - - public: + typedef subscriber>> input_subscriber_type; + explicit multicast_observer(composite_subscription cs) : b(std::make_shared(cs)) { } + 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(get_id(), get_subscription(), observer>(*this)); + } bool has_observers() const { std::unique_lock guard(b->state->lock); return b->current_completer && !b->current_completer->observers.empty(); } - void add(observer_type o) const { + template + void add(const SubscriberFrom& sf, observer_type o) const { + trace_activity().connect(sf, o); std::unique_lock guard(b->state->lock); switch (b->state->current) { case mode::Casting: @@ -197,17 +211,15 @@ public: template class subject { - composite_subscription lifetime; detail::multicast_observer s; public: subject() - : s(lifetime) + : s(composite_subscription()) { } explicit subject(composite_subscription cs) - : lifetime(cs) - , s(cs) + : s(cs) { } @@ -216,13 +228,13 @@ public: } subscriber>> get_subscriber() const { - return make_subscriber(lifetime, observer>(s)); + return s.get_subscriber(); } observable get_observable() const { auto keepAlive = s; return make_observable_dynamic([=](subscriber o){ - keepAlive.add(std::move(o)); + keepAlive.add(s.get_subscriber(), std::move(o)); }); } }; diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index c28fa91..564f564 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -143,6 +143,10 @@ public: state = std::make_shared(std::move(coordinator), std::move(il), std::move(o)); } + subscriber get_subscriber() const { + return make_subscriber(this->get_id(), state->lifetime, observer>(*this)).as_dynamic(); + } + template void on_next(V v) const { state->on_next(std::move(v)); @@ -160,13 +164,11 @@ public: template class synchronize { - composite_subscription lifetime; detail::synchronize_observer s; public: explicit synchronize(Coordination cn, composite_subscription cs = composite_subscription()) - : lifetime(composite_subscription()) - , s(std::move(cn), std::move(cs), lifetime) + : s(std::move(cn), std::move(cs), composite_subscription()) { } @@ -175,12 +177,13 @@ public: } subscriber get_subscriber() const { - return make_subscriber(lifetime, make_observer_dynamic(observer>(s))); + return s.get_subscriber(); } observable get_observable() const { - return make_observable_dynamic([this](subscriber o){ - this->s.add(std::move(o)); + auto keepAlive = s; + return make_observable_dynamic([=](subscriber o){ + keepAlive.add(s.get_subscriber(), std::move(o)); }); } }; diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp index 7cf35b6..0496019 100644 --- a/Rx/v2/test/operators/lift.cpp +++ b/Rx/v2/test/operators/lift.cpp @@ -57,8 +57,8 @@ struct liftfilter dest.on_completed(); } - static rx::subscriber make(const dest_type& d, const test_type& t) { - return rx::make_subscriber(d, this_type(d, t)); + static rx::subscriber make(const dest_type& d, const test_type& t) { + return rx::make_subscriber(d, observer_type(this_type(d, t))); } }; @@ -120,7 +120,7 @@ SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]" auto res = w.start( [&xs, &invoked]() { return xs - .lift(liftfilter([&invoked](int x) { + .lift(liftfilter([&invoked](int x) { invoked++; return IsPrime(x); })) @@ -183,10 +183,10 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stre auto res = w.start( [&xs, &invoked]() { return xs - >> liftfilter([&invoked](int x) { + >> rxo::lift(liftfilter([&invoked](int x) { invoked++; return IsPrime(x); - }) + })) // forget type to workaround lambda deduction bug on msvc 2013 >> rxo::as_dynamic(); }, @@ -250,7 +250,7 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ return IsPrime(x); }; return xs - .lift([=](rx::subscriber dest){ + .lift([=](rx::subscriber dest){ // VS2013 deduction issue requires dynamic (type-forgetting) return rx::make_subscriber( dest, diff --git a/Rx/v2/test/sources/create.cpp b/Rx/v2/test/sources/create.cpp new file mode 100644 index 0000000..063ff7e --- /dev/null +++ b/Rx/v2/test/sources/create.cpp @@ -0,0 +1,46 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +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 on; + + long invoked = 0; + + WHEN("created"){ + + auto res = w.start( + [&]() { + return rx::observable<>::create( + [&](const rx::subscriber& 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.on_next(200, 1), + on.on_next(200, 2) + }); + 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 index bf4779e..e9e62c2 100644 --- a/Rx/v2/test/sources/defer.cpp +++ b/Rx/v2/test/sources/defer.cpp @@ -6,7 +6,7 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.hpp" -SCENARIO("defer stops on completion", "[defer][operators]"){ +SCENARIO("defer stops on completion", "[defer][sources]"){ GIVEN("a test cold observable of ints"){ auto sc = rxsc::make_test(); auto w = sc.create_worker(); diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index 49d68e2..ae1a149 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -7,7 +7,7 @@ namespace rxsc=rxcpp::schedulers; #include "catch.hpp" -SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]"){ +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; @@ -29,7 +29,7 @@ SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf]") } } -SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][long][perf]"){ +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; @@ -72,7 +72,7 @@ SCENARIO("schedule_periodically by duration", "[hide][periodically][scheduler][l } } -SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf]"){ +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; diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index b979c4f..6919b63 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -139,11 +139,11 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug std::atomic v(0); auto s0 = rxs::range(1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) .ref_count() - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ @@ -154,11 +154,11 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug })); auto s1 = rxs::range(values + 1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) .ref_count() - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ @@ -169,11 +169,11 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug })); auto s2 = rxs::range((values * 2) + 1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .publish_synchronized(es) .ref_count() - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ @@ -249,10 +249,10 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o std::atomic v(0); auto s0 = rxs::range(1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .observe_on(es) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ @@ -263,10 +263,10 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o })); auto s1 = rxs::range(values + 1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .observe_on(es) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ @@ -277,10 +277,10 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o })); auto s2 = rxs::range((values * 2) + 1, es) .take(values) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .as_dynamic() .observe_on(es) - .lift(liftrequirecompletion) + .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( [&](int i){ diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 9e34654..3741630 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -33,6 +33,7 @@ set(TEST_SOURCES ${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/interval.cpp ${TEST_DIR}/operators/buffer.cpp -- GitLab From 667a8c86dc6c4e26026072bc48aec0a6d3d0531a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Jul 2014 11:12:31 -0700 Subject: [PATCH 392/782] print fixes --- Rx/v2/examples/println/main.cpp | 2 +- Rx/v2/src/rxcpp/rx-util.hpp | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp index efe09ca..b9cf842 100644 --- a/Rx/v2/examples/println/main.cpp +++ b/Rx/v2/examples/println/main.cpp @@ -64,6 +64,6 @@ int main(int argc, char** argv) hello_tpl().subscribe(rxu::println(std::cout)); - hello_tpl().subscribe(rxu::print_delimited_by(std::cout, " and "), rxu::endline(std::cout)); + hello_tpl().subscribe(rxu::print_followed_by(std::cout, " and "), rxu::endline(std::cout)); return 0; } diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 9e613c4..ef8155a 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -313,6 +313,12 @@ struct insert_function } }; +template +auto print_followed_with(OStream& os, Delimit d) + -> detail::print_function { + return detail::print_function(os, std::move(d)); +} + } template @@ -321,25 +327,20 @@ auto endline(OStream& os) return detail::endline(os); } -template -auto print(OStream& os, Delimit d) - -> decltype(d(), detail::print_function(os, std::move(d))) { - return detail::print_function(os, std::move(d)); -} -template -auto print(OStream& os, Delimit d) - -> decltype(d(os), detail::print_function>(os, detail::insert_function(os, std::move(d)))) { - return detail::print_function>(os, detail::insert_function(os, std::move(d))); -} template auto println(OStream& os) - -> decltype(print(os, endline(os))) { - return print(os, endline(os)); + -> decltype(detail::print_followed_with(os, endline(os))) { + return detail::print_followed_with(os, endline(os)); +} +template +auto print_followed_with(OStream& os, Delimit d) + -> decltype(detail::print_followed_with(os, detail::insert_function(os, std::move(d)))) { + return detail::print_followed_with(os, detail::insert_function(os, std::move(d))); } template -auto print_delimited_by(OStream& os, DelimitValue dv) - -> detail::print_function> { - return detail::print_function>(os, detail::insert_value(os, std::move(dv))); +auto print_followed_by(OStream& os, DelimitValue dv) + -> decltype(detail::print_followed_with(os, detail::insert_value(os, std::move(dv)))) { + return detail::print_followed_with(os, detail::insert_value(os, std::move(dv))); } namespace detail { -- GitLab From 8c32cc2f2d74dde2da6113a9d58bc8527ad10e05 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Jul 2014 13:30:32 -0700 Subject: [PATCH 393/782] more lift fixes --- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 4 ++-- Rx/v2/src/rxcpp/operators/rx-map.hpp | 4 ++-- Rx/v2/src/rxcpp/rx-observable.hpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index ad2ec4f..08cd629 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -45,7 +45,7 @@ struct lift_traits }; template -struct lift : public operator_base::result_value_type> +struct lift_operator : public operator_base::result_value_type> { typedef lift_traits traits; typedef typename traits::source_operator_type source_operator_type; @@ -53,7 +53,7 @@ struct lift : public operator_base auto operator()(Observable&& source) - -> decltype(source.lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector))) { - return source.lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector)); + -> decltype(source.template lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector))) { + return source.template lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector)); } }; diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 944d230..103e4d9 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -307,9 +307,9 @@ public: /// template auto lift(Operator&& op) const - -> observable::value_type, rxo::detail::lift> { - return observable::value_type, rxo::detail::lift>( - rxo::detail::lift(source_operator, std::forward(op))); + -> observable::value_type, rxo::detail::lift_operator> { + return observable::value_type, rxo::detail::lift_operator>( + rxo::detail::lift_operator(source_operator, std::forward(op))); static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } -- GitLab From 6fdd6f9b945d9f9be48dc1d36ca199336a7ea081 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 29 Jul 2014 13:30:40 -0700 Subject: [PATCH 394/782] fix travis script --- projects/scripts/travis-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 projects/scripts/travis-install.sh diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh old mode 100644 new mode 100755 index 8fb05f2..3078b8a --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -26,5 +26,6 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then elif [ "$TRAVIS_OS_NAME" = osx ]; then xcode-select --install brew update - brew install cmake + brew doctor + brew list cmake || brew install cmake fi -- GitLab From 40ebdf2b474bc98e509734690f95c23dc92b3f05 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Jul 2014 22:24:41 -0700 Subject: [PATCH 395/782] update catch library --- ext/catch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/catch b/ext/catch index 8ba6555..6880a0c 160000 --- a/ext/catch +++ b/ext/catch @@ -1 +1 @@ -Subproject commit 8ba6555acd25da27cc9d8210119c0c57edac4704 +Subproject commit 6880a0c909778e9036b37ac4ddc601eee56b7b39 -- GitLab From fc4f3fa47e67e7b1d99dcec1a7092761426ab375 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 30 Jul 2014 22:31:03 -0700 Subject: [PATCH 396/782] add start_with --- Rx/v2/src/rxcpp/operators/rx-start_with.hpp | 24 +++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 23 ++++---------------- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + 3 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-start_with.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-start_with.hpp b/Rx/v2/src/rxcpp/operators/rx-start_with.hpp new file mode 100644 index 0000000..d605ceb --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-start_with.hpp @@ -0,0 +1,24 @@ +// 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_START_WITH_HPP) +#define RXCPP_OPERATORS_RX_START_WITH_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +template +auto start_with(Observable o, Value0 v0, ValueN... vn) + -> decltype(rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o)) { + return rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 103e4d9..8297014 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -884,32 +884,17 @@ public: return observable>( rxo::detail::repeat(*this, t)); } -#if 0 - -// causes infinite compile time recursion - - template - struct defer_start_with_from : public defer_observable< - rxu::all_true< - is_coordination::value, - std::is_convertible::value>, - this_type, - rxo::detail::concat, observable, observable>, Coordination> - { - }; /// start_with -> - /// All sources must be synchronized! This means that calls across all the subscribers must be serial. + /// start with the supplied values, then concatenate this observable /// /// template auto start_with(Value0 v0, ValueN... vn) const - -> typename std::enable_if< - defer_start_with_from::value, - typename defer_start_with_from::observable_type>::type { - return defer_start_with_from::make(*this, rxs::from(rxs::from(value_type(v0), value_type(vn)...).as_dynamic(), this->as_dynamic()), identity_immediate()); + -> decltype(rxo::start_with(*(this_type*)nullptr, std::move(v0), std::move(vn)...)) { + return rxo::start_with(*this, std::move(v0), std::move(vn)...); } -#endif + }; template diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 8ec9e74..1c43ff5 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -55,6 +55,7 @@ namespace rxo=operators; #include "operators/rx-scan.hpp" #include "operators/rx-skip.hpp" #include "operators/rx-skip_until.hpp" +#include "operators/rx-start_with.hpp" #include "operators/rx-subscribe.hpp" #include "operators/rx-subscribe_on.hpp" #include "operators/rx-switch_on_next.hpp" -- GitLab From 3bf429778a08eda9498c61ec1daa3664d5f1bbfd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 2 Aug 2014 11:35:04 -0700 Subject: [PATCH 397/782] added group_by --- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 2 - Rx/v2/src/rxcpp/operators/rx-group_by.hpp | 220 ++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-grouped_observable.hpp | 203 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-includes.hpp | 1 + Rx/v2/src/rxcpp/rx-observable.hpp | 9 + Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/src/rxcpp/rx-predef.hpp | 37 ++++ Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 4 +- Rx/v2/test/operators/group_by.cpp | 112 +++++++++++ projects/CMake/CMakeLists.txt | 8 + 10 files changed, 594 insertions(+), 3 deletions(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-group_by.hpp create mode 100644 Rx/v2/src/rxcpp/rx-grouped_observable.hpp create mode 100644 Rx/v2/test/operators/group_by.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 84aeb66..f8fd1d7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -32,9 +32,7 @@ struct flat_map_traits { typedef decltype((*(collection_selector_type*)nullptr)((*(source_value_type*)nullptr))) collection_type; -//#if _MSC_VER >= 1900 static_assert(is_observable::value, "flat_map CollectionSelector must return an observable"); -//#endif typedef typename collection_type::value_type collection_value_type; diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp new file mode 100644 index 0000000..3982e8b --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -0,0 +1,220 @@ +// 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_GROUP_BY_HPP) +#define RXCPP_OPERATORS_RX_GROUP_BY_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct is_group_by_selector_for { + + typedef typename std::decay::type selector_type; + typedef T source_value_type; + + struct tag_not_valid {}; + template + static auto check(int) -> decltype((*(CS*)nullptr)(*(CV*)nullptr)); + template + static tag_not_valid check(...); + + typedef decltype(check(0)) type; + static const bool value = !std::is_same::value; +}; + +template +struct group_by_traits +{ + typedef T source_value_type; + typedef typename std::decay::type source_type; + typedef typename std::decay::type key_selector_type; + typedef typename std::decay::type marble_selector_type; + typedef typename std::decay::type predicate_type; + + static_assert(is_group_by_selector_for::value, "group_by KeySelector must be a function with the signature key_type(source_value_type)"); + + typedef typename is_group_by_selector_for::type key_type; + + static_assert(is_group_by_selector_for::value, "group_by MarbleSelector must be a function with the signature marble_type(source_value_type)"); + + typedef typename is_group_by_selector_for::type marble_type; + + typedef rxsub::subject subject_type; + + typedef std::map key_subscriber_map_type; + + typedef grouped_observable grouped_observable_type; +}; + +template +struct group_by +{ + typedef group_by_traits 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::predicate_type predicate_type; + typedef typename traits_type::subject_type subject_type; + typedef typename traits_type::key_type key_type; + + struct group_by_values + { + group_by_values(key_selector_type ks, marble_selector_type ms, predicate_type p) + : keySelector(std::move(ks)) + , marbleSelector(std::move(ms)) + , predicate(std::move(p)) + { + } + mutable key_selector_type keySelector; + mutable marble_selector_type marbleSelector; + mutable predicate_type predicate; + }; + + group_by_values initial; + + group_by(key_selector_type ks, marble_selector_type ms, predicate_type p) + : initial(std::move(ks), std::move(ms), std::move(p)) + { + } + + struct group_by_observable + { + subject_type subject; + key_type key; + + group_by_observable(subject_type s, key_type k) + : subject(std::move(s)) + , key(k) + { + } + + template + void on_subscribe(Subscriber&& o) const { + subject.get_observable().subscribe(std::forward(o)); + } + + key_type on_get_key() { + return key; + } + }; + + template + struct group_by_observer : public group_by_values + { + typedef group_by_observer this_type; + typedef typename traits_type::grouped_observable_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + + mutable typename traits_type::key_subscriber_map_type groups; + + group_by_observer(dest_type d, group_by_values v) + : group_by_values(v) + , dest(std::move(d)) + , groups(group_by_values::predicate) + { + } + void on_next(T v) const { + auto selectedKey = on_exception( + [&](){ + return this->keySelector(v);}, + *this); + if (selectedKey.empty()) { + return; + } + auto g = groups.find(selectedKey.get()); + if (g == groups.end()) { + auto sub = subject_type(); + g = groups.insert(std::make_pair(selectedKey.get(), sub.get_subscriber())).first; + dest.on_next(make_dynamic_grouped_observable(group_by_observable(sub, selectedKey.get()))); + } + auto selectedMarble = on_exception( + [&](){ + return this->marbleSelector(v);}, + *this); + if (selectedMarble.empty()) { + return; + } + g->second.on_next(std::move(selectedMarble.get())); + } + void on_error(std::exception_ptr e) const { + (*this)(e); + } + void operator()(std::exception_ptr e) const { + for(auto& g : groups) { + g.second.on_error(e); + } + dest.on_error(e); + } + void on_completed() const { + for(auto& g : groups) { + g.second.on_completed(); + } + dest.on_completed(); + } + + static subscriber make(dest_type d, group_by_values v) { + auto cs = d.get_subscription(); + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v)))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(group_by_observer::make(std::move(dest), initial)) { + return group_by_observer::make(std::move(dest), initial); + } +}; + +template +class group_by_factory +{ + typedef typename std::decay::type key_selector_type; + typedef typename std::decay::type marble_selector_type; + typedef typename std::decay::type predicate_type; + key_selector_type keySelector; + marble_selector_type marbleSelector; + predicate_type predicate; +public: + group_by_factory(key_selector_type ks, marble_selector_type ms, predicate_type p) + : keySelector(std::move(ks)) + , marbleSelector(std::move(ms)) + , predicate(std::move(p)) + { + } + template + struct group_by_factory_traits + { + typedef typename Observable::value_type value_type; + typedef detail::group_by_traits traits_type; + typedef detail::group_by group_by_type; + }; + template + auto operator()(Observable&& source) + -> decltype(source.template lift::traits_type::grouped_observable_type>(typename group_by_factory_traits::group_by_type(std::move(keySelector), std::move(marbleSelector), std::move(predicate)))) { + return source.template lift::traits_type::grouped_observable_type>(typename group_by_factory_traits::group_by_type(std::move(keySelector), std::move(marbleSelector), std::move(predicate))); + } +}; + +} + +template +inline auto group_by(KeySelector ks, MarbleSelector ms, BinaryPredicate p) + -> detail::group_by_factory { + return detail::group_by_factory(std::move(ks), std::move(ms), std::move(p)); +} + + +} + +} + +#endif + diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp new file mode 100644 index 0000000..8dca40b --- /dev/null +++ b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp @@ -0,0 +1,203 @@ +// 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 +struct has_on_get_key_for +{ + struct not_void {}; + template + static auto check(int) -> decltype((*(CS*)nullptr).on_get_key()); + template + static not_void check(...); + + typedef decltype(check(0)) detail_result; + static const bool value = std::is_same::type>::value; +}; + +} + +template +class dynamic_grouped_observable + : public rxs::source_base +{ +public: + typedef typename std::decay::type key_type; + typedef tag_dynamic_observable dynamic_observable_tag; + +private: + struct state_type + : public std::enable_shared_from_this + { + typedef std::function)> onsubscribe_type; + typedef std::function ongetkey_type; + + onsubscribe_type on_subscribe; + ongetkey_type on_get_key; + }; + std::shared_ptr state; + + template + void construct(const dynamic_observable& o, tag_dynamic_observable&&) { + state = o.state; + } + + template + void construct(dynamic_observable&& o, tag_dynamic_observable&&) { + state = std::move(o.state); + } + + template + void construct(SO&& source, rxs::tag_source&&) { + auto so = std::make_shared::type>(std::forward(source)); + state->on_subscribe = [so](subscriber o) mutable { + so->on_subscribe(std::move(o)); + }; + state->on_get_key = [so]() mutable { + return so->on_get_key(); + }; + } + +public: + + dynamic_grouped_observable() + { + } + + template + explicit dynamic_grouped_observable(SOF&& sof) + : state(std::make_shared()) + { + construct(std::forward(sof), + typename std::conditional::value, tag_dynamic_observable, rxs::tag_source>::type()); + } + + template + dynamic_grouped_observable(SF&& sf, CF&& cf) + : state(std::make_shared()) + { + state->on_subscribe = std::forward(sf); + state->on_connect = std::forward(cf); + } + + void on_subscribe(subscriber o) const { + state->on_subscribe(std::move(o)); + } + + template + typename std::enable_if::type, observer>::value, void>::type + on_subscribe(Subscriber&& o) const { + auto so = std::make_shared::type>(std::forward(o)); + state->on_subscribe( + make_subscriber( + *so, + // on_next + [so](T t){ + so->on_next(t); + }, + // on_error + [so](std::exception_ptr e){ + so->on_error(e); + }, + // on_completed + [so](){ + so->on_completed(); + }). + as_dynamic()); + } + + key_type on_get_key() const { + return state->on_get_key(); + } +}; + +template +grouped_observable make_dynamic_grouped_observable(Source&& s) { + return grouped_observable(dynamic_grouped_observable(std::forward(s))); +} + + + +template +class grouped_observable + : public observable +{ + typedef grouped_observable this_type; + typedef observable base_type; + typedef typename std::decay::type source_operator_type; + + static_assert(detail::has_on_get_key_for::value, "inner must have on_get_key method key_type()"); + +public: + typedef typename std::decay::type 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 + grouped_observable(const grouped_observable& o) + : base_type(o) + {} + // implicit conversion between observables of the same value_type + template + grouped_observable(grouped_observable&& o) + : base_type(std::move(o)) + {} + + /// + /// performs type-forgetting conversion to a new grouped_observable + /// + grouped_observable 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 +auto operator >> (const rxcpp::grouped_observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} + +// +// support range() | filter() | subscribe() syntax +// '|' is spelled 'pipe' +// +template +auto operator | (const rxcpp::grouped_observable& source, OperatorFactory&& of) + -> decltype(source.op(std::forward(of))) { + return source.op(std::forward(of)); +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 86fd34a..5ca50e1 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -132,6 +132,7 @@ #include "rx-operators.hpp" #include "rx-observable.hpp" #include "rx-connectable_observable.hpp" +#include "rx-grouped_observable.hpp" #pragma pop_macro("min") #pragma pop_macro("max") diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 8297014..c93d408 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -662,6 +662,15 @@ public: return defer_combine_latest::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); } + /// group_by -> + /// + template + inline auto group_by(KeySelector ks, MarbleSelector ms, BinaryPredicate p) const + -> decltype(EXPLICIT_THIS lift::grouped_observable_type>(rxo::detail::group_by(std::move(ks), std::move(ms), std::move(p)))) { + return lift::grouped_observable_type>(rxo::detail::group_by(std::move(ks), std::move(ms), std::move(p))); + } + + /// multicast -> /// allows connections to the source to be independent of subscriptions /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 1c43ff5..b62ddd6 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -43,6 +43,7 @@ namespace rxo=operators; #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-lift.hpp" #include "operators/rx-map.hpp" #include "operators/rx-merge.hpp" diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 1b82f40..bd94151 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -194,6 +194,43 @@ public: static const bool value = std::is_convertible::type>(0)), tag_connectable_observable>::value; }; +struct tag_dynamic_grouped_observable : public tag_dynamic_observable {}; + +template +class is_dynamic_grouped_observable +{ + struct not_void {}; + template + static typename C::dynamic_observable_tag* check(int); + template + static not_void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_dynamic_grouped_observable*>::value; +}; + +template +class dynamic_grouped_observable; + +template::value, + void, dynamic_grouped_observable>::type> +class grouped_observable; + +template +grouped_observable make_dynamic_grouped_observable(Source&& s); + +struct tag_grouped_observable : public tag_observable {}; +template +class is_grouped_observable +{ + template + static typename C::observable_tag check(int); + template + static void check(...); +public: + static const bool value = std::is_convertible::type>(0)), tag_grouped_observable>::value; +}; + // // this type is the default used by operators that subscribe to // multiple sources. It assumes that the sources are already synchronized diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index e07cc69..4ead228 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -214,6 +214,8 @@ class subject detail::multicast_observer s; public: + typedef subscriber>> subscriber_type; + typedef observable observable_type; subject() : s(composite_subscription()) { @@ -227,7 +229,7 @@ public: return s.has_observers(); } - subscriber>> get_subscriber() const { + subscriber_type get_subscriber() const { return s.get_subscriber(); } diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp new file mode 100644 index 0000000..30e06ec --- /dev/null +++ b/Rx/v2/test/operators/group_by.cpp @@ -0,0 +1,112 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxs=rxcpp::sources; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +char whitespace(char c) { + return std::isspace(c) || std::iscntrl(c); +} + +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 std::move(s); +} + +bool tolowerLess(char lhs, char rhs) { + return std::tolower(lhs) < std::tolower(rhs); +} + +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 on; + int keyInvoked = 0; + int marbleInvoked = 0; + + auto xs = sc.make_hot_observable({ + on.on_next(90, "error"), + on.on_next(110, "error"), + on.on_next(130, "error"), + on.on_next(220, " foo"), + on.on_next(240, " FoO "), + on.on_next(270, "baR "), + on.on_next(310, "foO "), + on.on_next(350, " Baz "), + on.on_next(360, " qux "), + on.on_next(390, " bar"), + on.on_next(420, " BAR "), + on.on_next(470, "FOO "), + on.on_next(480, "baz "), + on.on_next(510, " bAZ "), + on.on_next(530, " fOo "), + on.on_completed(570), + on.on_next(580, "error"), + on.on_completed(600), + on.on_error(650, new std::runtime_error("error in completed sequence")) + }); + + WHEN("group each int with the next 2 ints"){ + + 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& g){return g.get_key();}) + // 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.on_next(220, "foo"), + on.on_next(270, "baR"), + on.on_next(350, "Baz"), + on.on_next(360, "qux"), + on.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); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 3741630..99c20f2 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -44,6 +44,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/distinct_until_changed.cpp ${TEST_DIR}/operators/filter.cpp ${TEST_DIR}/operators/flat_map.cpp + ${TEST_DIR}/operators/group_by.cpp ${TEST_DIR}/operators/lift.cpp ${TEST_DIR}/operators/map.cpp ${TEST_DIR}/operators/merge.cpp @@ -63,6 +64,13 @@ set(TEST_SOURCES add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) +set(OP_SOURCES + ${TEST_DIR}/test.cpp + ${TEST_DIR}/operators/group_by.cpp +) +#add_executable(op_test ${OP_SOURCES}) +#TARGET_LINK_LIBRARIES(op_test ${CMAKE_THREAD_LIBS_INIT}) + set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples) # define the sources of the pythagorian example -- GitLab From 69bf799b3f11d4f5ceebf1984a613efc91552e69 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 2 Aug 2014 22:48:47 -0700 Subject: [PATCH 398/782] alternative error propagation --- Rx/v2/src/rxcpp/operators/rx-group_by.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp index 3982e8b..726d2da 100644 --- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -125,7 +125,7 @@ struct group_by auto selectedKey = on_exception( [&](){ return this->keySelector(v);}, - *this); + [this](std::exception_ptr e){on_error(e);}); if (selectedKey.empty()) { return; } @@ -138,16 +138,13 @@ struct group_by auto selectedMarble = on_exception( [&](){ return this->marbleSelector(v);}, - *this); + [this](std::exception_ptr e){on_error(e);}); if (selectedMarble.empty()) { return; } g->second.on_next(std::move(selectedMarble.get())); } void on_error(std::exception_ptr e) const { - (*this)(e); - } - void operator()(std::exception_ptr e) const { for(auto& g : groups) { g.second.on_error(e); } -- GitLab From 206955e96e184f99c7a4c7002ae6f0af6b469a3c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 2 Aug 2014 23:45:19 -0700 Subject: [PATCH 399/782] fix travis failure, move to clang 3.6 --- projects/scripts/travis-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 3078b8a..8f9f5fe 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -14,7 +14,7 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo apt-get install -q --fix-missing cmake libssl-dev if [ "$CC" = clang ]; then - sudo apt-get install -q --fix-missing clang-3.5 + sudo apt-get install -q --fix-missing clang-3.6 fi if [ "$CC" = gcc ]; then -- GitLab From 479f737e1a9fb77ae26eb14455da263d76e9bfd8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 3 Aug 2014 00:06:38 -0700 Subject: [PATCH 400/782] change tolower and isspace to use classic locale --- Rx/v2/test/operators/group_by.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index 30e06ec..4e81245 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -7,7 +7,7 @@ namespace rxsc=rxcpp::schedulers; #include "catch.hpp" char whitespace(char c) { - return std::isspace(c) || std::iscntrl(c); + return std::isspace(c, std::locale::classic()); } std::string trim(std::string s) { @@ -21,7 +21,7 @@ std::string trim(std::string s) { } bool tolowerLess(char lhs, char rhs) { - return std::tolower(lhs) < std::tolower(rhs); + return std::tolower(lhs, std::locale::classic()) < std::tolower(rhs, std::locale::classic()); } bool tolowerStringLess(const std::string& lhs, const std::string& rhs) { -- GitLab From 66985d48eb67976256d4758fdf0a9fe836664c0a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sun, 3 Aug 2014 00:35:29 -0700 Subject: [PATCH 401/782] msvc 2013 fixes --- Rx/v2/src/rxcpp/rx-grouped_observable.hpp | 14 +++++++------- Rx/v2/test/operators/group_by.cpp | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp index 8dca40b..a56878c 100644 --- a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp @@ -32,7 +32,7 @@ class dynamic_grouped_observable { public: typedef typename std::decay::type key_type; - typedef tag_dynamic_observable dynamic_observable_tag; + typedef tag_dynamic_grouped_observable dynamic_observable_tag; private: struct state_type @@ -46,18 +46,18 @@ private: }; std::shared_ptr state; - template - void construct(const dynamic_observable& o, tag_dynamic_observable&&) { + template + void construct(const dynamic_grouped_observable& o, const tag_dynamic_grouped_observable&) { state = o.state; } - template - void construct(dynamic_observable&& o, tag_dynamic_observable&&) { + template + void construct(dynamic_grouped_observable&& o, const tag_dynamic_grouped_observable&) { state = std::move(o.state); } template - void construct(SO&& source, rxs::tag_source&&) { + void construct(SO&& source, const rxs::tag_source&) { auto so = std::make_shared::type>(std::forward(source)); state->on_subscribe = [so](subscriber o) mutable { so->on_subscribe(std::move(o)); @@ -78,7 +78,7 @@ public: : state(std::make_shared()) { construct(std::forward(sof), - typename std::conditional::value, tag_dynamic_observable, rxs::tag_source>::type()); + typename std::conditional::value, tag_dynamic_grouped_observable, rxs::tag_source>::type()); } template diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index 4e81245..ac1b8cc 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -6,6 +6,8 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.hpp" +#include + char whitespace(char c) { return std::isspace(c, std::locale::classic()); } -- GitLab From c12bb8ffb1167ddd5ef11fb31586357f4a893dff Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 4 Aug 2014 08:16:15 -0700 Subject: [PATCH 402/782] add blocking_observable and last, count operators --- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 35 ++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 108 +++++++++++++++++++++++- Rx/v2/src/rxcpp/rx-util.hpp | 9 ++ Rx/v2/test/operators/concat.cpp | 51 ++--------- Rx/v2/test/operators/concat_map.cpp | 67 ++------------- Rx/v2/test/operators/flat_map.cpp | 51 ++--------- Rx/v2/test/operators/merge.cpp | 54 ++---------- 7 files changed, 186 insertions(+), 189 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index c70f7bd..043566e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -180,6 +180,35 @@ struct initialize_seeder { } }; +template +struct last { + typedef rxu::maybe::type> seed_type; + seed_type seed() { + return seed_type{}; + } + seed_type operator()(const seed_type& a, T v) { + return seed_type(v); + } + typename std::decay::type operator()(seed_type a) { + // should abort if a is empty + return a.get(); + } +}; + +template +struct count { + typedef int seed_type; + seed_type seed() { + return seed_type{}; + } + seed_type operator()(seed_type a, T v) { + return ++a; + } + seed_type operator()(seed_type a) { + return a; + } +}; + template struct average { struct seed_type @@ -232,6 +261,12 @@ struct average { } +template +auto first(Observable o) + -> decltype(o.take(1).last()) { + return o.take(1).last(); +} + template auto reduce(Seed s, Accumulator a, ResultSelector rs) -> detail::reduce_factory { diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index c93d408..0a72748 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -175,6 +175,72 @@ struct defer_observable { }; +template +class blocking_observable +{ + template + static auto blocking_subscribe(const Obsvbl& source, ArgN&&... an) + -> composite_subscription { + std::mutex lock; + std::condition_variable wake; + std::atomic_bool disposed; + auto scbr = make_subscriber(std::forward(an)...); + auto cs = scbr.get_subscription(); + cs.add([&](){ + disposed = true; + wake.notify_one(); + }); + std::unique_lock guard(lock); + source.subscribe(scbr); + wake.wait(guard, [&](){return !!disposed;}); + return cs; + } + +public: + typedef typename std::decay::type observable_type; + observable_type source; + blocking_observable(observable_type s) : source(std::move(s)) {} + + /// + /// subscribe will cause this observable to emit values to the provided 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 + auto subscribe(ArgN&&... an) const + -> composite_subscription { + return blocking_subscribe(source, std::forward(an)...); + } + + T first() { + rxu::maybe result; + composite_subscription cs; + subscribe(cs, [&](T v){result.reset(v); cs.unsubscribe();}); + return result.get(); + } + + T last() const { + rxu::maybe result; + subscribe([&](T v){result.reset(v);}); + return result.get(); + } + + int count() const { + return source.count().as_blocking().last(); + } + T sum() const { + return source.sum().as_blocking().last(); + } + double average() const { + return source.average().as_blocking().last(); + } +}; + template<> class observable; @@ -282,12 +348,19 @@ public: #endif /// - /// performs type-forgetting conversion to a new observable + /// returns a new observable that performs type-forgetting conversion of this observable /// observable as_dynamic() const { return *this; } + /// + /// returns new observable that contains the blocking methods for this observable + /// + blocking_observable as_blocking() const { + return blocking_observable(*this); + } + /// /// takes any function that will take this observable and produce a result value. /// this is intended to allow externally defined operators, that use subscribe, @@ -670,6 +743,13 @@ public: return lift::grouped_observable_type>(rxo::detail::group_by(std::move(ks), std::move(ms), std::move(p))); } + /// group_by -> + /// + template + inline auto group_by(KeySelector ks, MarbleSelector ms) const + -> decltype(EXPLICIT_THIS lift::grouped_observable_type>(rxo::detail::group_by(std::move(ks), std::move(ms), rxu::less()))) { + return lift::grouped_observable_type>(rxo::detail::group_by(std::move(ks), std::move(ms), rxu::less())); + } /// multicast -> /// allows connections to the source to be independent of subscriptions @@ -748,8 +828,32 @@ public: { }; + /// first -> + /// for each item from this observable reduce it by sending only the first item. + /// +// auto first() const +// -> decltype(rxo::first(*(this_type*)nullptr)) { +// return rxo::first(*this); +// } + + /// last -> + /// for each item from this observable reduce it by sending only the last item. + /// + auto last() const + -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { + return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, rxo::detail::last(), rxo::detail::last(), rxo::detail::last().seed()); + } + + /// count -> + /// for each item from this observable reduce it by incrementing a count. + /// + auto count() const + -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { + return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, rxo::detail::count(), rxo::detail::count(), rxo::detail::count().seed()); + } + /// sum -> - /// for each item from this observable reduce it by adding to the previous values. + /// for each item from this observable reduce it by adding to the previous items. /// auto sum() const -> typename defer_reduce, rxu::plus, rxu::defer_type>::observable_type { diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index ef8155a..470b532 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -261,6 +261,14 @@ struct plus { return std::forward(lhs) + std::forward(rhs); } }; +struct less +{ + template + auto operator()(LHS&& lhs, RHS&& rhs) const + -> decltype(std::forward(lhs) < std::forward(rhs)) + { return std::forward(lhs) < std::forward(rhs); } +}; + namespace detail { template struct print_function @@ -471,6 +479,7 @@ public: }; } +using detail::maybe; namespace detail { struct surely diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index e4c23b7..91be2be 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -16,29 +16,18 @@ SCENARIO("synchronize concat ranges", "[hide][range][synchronize][concat][perf]" using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::synchronize_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -55,29 +44,18 @@ SCENARIO("observe_on concat ranges", "[hide][range][observe_on][concat][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::observe_on_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -94,29 +72,18 @@ SCENARIO("serialize concat ranges", "[hide][range][serialize][concat][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::serialize_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 2787089..7dc1302 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -61,13 +61,9 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::synchronize_event_loop(); int c = 0; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -93,17 +89,10 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}, so); - triples + int ct = triples .take(tripletCount) - .subscribe( - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -120,15 +109,9 @@ SCENARIO("observe_on concat_map pythagorian ranges", "[hide][range][concat_map][ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::observe_on_event_loop(); int c = 0; - std::atomic_bool done; - std::atomic_bool disposed; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -155,23 +138,10 @@ SCENARIO("observe_on concat_map pythagorian ranges", "[hide][range][concat_map][ [](int z, std::tuple triplet){return triplet;}, so); - rx::composite_subscription cs; - cs.add([&](){ - disposed = true; - wake.notify_one();}); - - triples + int ct = triples .take(tripletCount) - .subscribe( - cs, - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [&](){ - done = true; - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount && done && disposed;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -188,15 +158,9 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::serialize_event_loop(); int c = 0; - std::atomic_bool done; - std::atomic_bool disposed; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -223,23 +187,10 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s [](int z, std::tuple triplet){return triplet;}, so); - rx::composite_subscription cs; - cs.add([&](){ - disposed = true; - wake.notify_one();}); - - triples + int ct = triples .take(tripletCount) - .subscribe( - cs, - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [&](){ - done = true; - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount && done && disposed;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index d32de54..9f99055 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -97,13 +97,9 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::synchronize_event_loop(); int c = 0; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -129,17 +125,10 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}, so); - triples + int ct = triples .take(tripletCount) - .subscribe( - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -156,13 +145,9 @@ SCENARIO("observe_on flat_map pythagorian ranges", "[hide][range][flat_map][obse using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::observe_on_event_loop(); int c = 0; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -188,17 +173,10 @@ SCENARIO("observe_on flat_map pythagorian ranges", "[hide][range][flat_map][obse .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}, so); - triples + int ct = triples .take(tripletCount) - .subscribe( - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -215,13 +193,9 @@ SCENARIO("serialize flat_map pythagorian ranges", "[hide][range][flat_map][seria using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::serialize_event_loop(); int c = 0; - std::atomic ct(0); int n = 1; auto start = clock::now(); auto triples = @@ -247,17 +221,10 @@ SCENARIO("serialize flat_map pythagorian ranges", "[hide][range][flat_map][seria .as_dynamic();}, [](int z, std::tuple triplet){return triplet;}, so); - triples + int ct = triples .take(tripletCount) - .subscribe( - rxu::apply_to([&ct](int x,int y,int z){ - ++ct;}), - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one();}); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return ct == tripletCount;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index a964b0e..a8a32ad 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -17,30 +17,18 @@ SCENARIO("synchronize merge ranges", "[hide][range][synchronize][merge][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::synchronize_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one(); - }); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -57,30 +45,18 @@ SCENARIO("observe_on merge ranges", "[hide][range][observe_on][merge][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::observe_on_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one(); - }); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -97,30 +73,18 @@ SCENARIO("serialize merge ranges", "[hide][range][serialize][merge][perf]"){ using namespace std::chrono; typedef steady_clock clock; - std::mutex lock; - std::condition_variable wake; - auto so = rx::serialize_event_loop(); - std::atomic c(0); int n = 1; auto sectionCount = onnextcalls / 3; auto start = clock::now(); - rxs::range(0, sectionCount - 1, 1, so) + 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)) - .subscribe( - [&c](int x){ - ++c;}, - [](std::exception_ptr){abort();}, - [&](){ - wake.notify_one(); - }); - - std::unique_lock guard(lock); - wake.wait(guard, [&](){return c == onnextcalls;}); + .as_blocking() + .count(); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - -- GitLab From 6ca3b3ef1321e6a938ac95b9736b5993e4cc7232 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 5 Aug 2014 16:12:47 -0700 Subject: [PATCH 403/782] add first --- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 6 ------ Rx/v2/src/rxcpp/rx-observable.hpp | 13 +++++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 043566e..0baa827 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -261,12 +261,6 @@ struct average { } -template -auto first(Observable o) - -> decltype(o.take(1).last()) { - return o.take(1).last(); -} - template auto reduce(Seed s, Accumulator a, ResultSelector rs) -> detail::reduce_factory { diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 0a72748..b8c6a1a 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -831,10 +831,8 @@ public: /// first -> /// for each item from this observable reduce it by sending only the first item. /// -// auto first() const -// -> decltype(rxo::first(*(this_type*)nullptr)) { -// return rxo::first(*this); -// } + auto first() const + -> observable; /// last -> /// for each item from this observable reduce it by sending only the last item. @@ -1010,6 +1008,13 @@ public: }; +template +auto observable::first() const + -> observable { + return this->take(1).last(); +} + + template inline bool operator==(const observable& lhs, const observable& rhs) { return lhs.source_operator == rhs.source_operator; -- GitLab From 40c270e5409f9911c5e286b85ff7db5df62d9701 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 5 Aug 2014 16:13:02 -0700 Subject: [PATCH 404/782] ignore sublime projects --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 6fe9162..73574ce 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,9 @@ Desktop.ini projects/* !projects/CMake/CMakeLists.txt !projects/nuget/rxcpp.autopackage + +############ +## Sublime +############ + +*.sublime-* -- GitLab From 4e693790b7aaa46bde9a20c90addaefbf46c34c8 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 17:03:30 -0700 Subject: [PATCH 405/782] minor fixes --- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 7 +-- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 8 ++- Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp | 41 ++++++++----- Rx/v2/test/operators/subscribe_on.cpp | 60 +++++++++++++++---- 4 files changed, 83 insertions(+), 33 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index c1157de..4d89044 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -167,13 +167,10 @@ struct observe_on auto keepAlive = o.state; cs.add([keepAlive](){ std::unique_lock guard(keepAlive->lock); - if (keepAlive->queue.empty() && keepAlive->current == mode::Empty && keepAlive->destination.is_subscribed()) { - keepAlive->current = mode::Disposed; - keepAlive->destination.unsubscribe(); - } + keepAlive->ensure_processing(guard); }); - return make_subscriber(cs, std::move(o)); + return make_subscriber(d, cs, make_observer(std::move(o))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 0baa827..e53f2c5 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -80,6 +80,9 @@ struct reduce : public operator_base - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { struct reduce_state_type : public reduce_initial_type , public std::enable_shared_from_this diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp index 3899b19..e62e8ff 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp @@ -19,9 +19,12 @@ struct subscribe_on : public operator_base typedef typename std::decay::type source_type; typedef typename std::decay::type coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - struct values + struct subscribe_on_values { - values(source_type s, coordination_type sf) + ~subscribe_on_values() + { + } + subscribe_on_values(source_type s, coordination_type sf) : source(std::move(s)) , coordination(std::move(sf)) { @@ -29,8 +32,11 @@ struct subscribe_on : public operator_base source_type source; coordination_type coordination; }; - values initial; + const subscribe_on_values initial; + ~subscribe_on() + { + } subscribe_on(source_type s, coordination_type sf) : initial(std::move(s), std::move(sf)) { @@ -42,10 +48,10 @@ struct subscribe_on : public operator_base typedef Subscriber output_type; struct subscribe_on_state_type : public std::enable_shared_from_this - , public values + , public subscribe_on_values { - subscribe_on_state_type(const values& i, coordinator_type coor, const output_type& oarg) - : values(i) + subscribe_on_state_type(const subscribe_on_values& i, coordinator_type coor, const output_type& oarg) + : subscribe_on_values(i) , coordinator(std::move(coor)) , out(oarg) { @@ -62,16 +68,21 @@ struct subscribe_on : public operator_base // take a copy of the values for each subscription auto state = std::shared_ptr(new subscribe_on_state_type(initial, std::move(coordinator), std::move(s))); + auto disposer = [=](const rxsc::schedulable&){ + state->source_lifetime.unsubscribe(); + state->out.unsubscribe(); + }; + auto selectedDisposer = on_exception( + [&](){return state->coordinator.act(disposer);}, + state->out); + if (selectedDisposer.empty()) { + return; + } + state->out.add([=](){ - auto disposer = [=](const rxsc::schedulable&){ - state->source_lifetime.unsubscribe(); - }; - auto selectedDisposer = on_exception( - [&](){return state->coordinator.act(disposer);}, - state->out); - if (selectedDisposer.empty()) { - return; - } + controller.schedule(selectedDisposer.get()); + }); + state->source_lifetime.add([=](){ controller.schedule(selectedDisposer.get()); }); diff --git a/Rx/v2/test/operators/subscribe_on.cpp b/Rx/v2/test/operators/subscribe_on.cpp index 986a989..c8a25f7 100644 --- a/Rx/v2/test/operators/subscribe_on.cpp +++ b/Rx/v2/test/operators/subscribe_on.cpp @@ -5,12 +5,12 @@ namespace rxsc=rx::rxsc; #include "catch.hpp" -static const int static_subscriptions = 100000; +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 100K times"){ + WHEN("subscribe 50K times"){ using namespace std::chrono; typedef steady_clock clock; @@ -21,9 +21,8 @@ SCENARIO("for loop subscribes to map with subscribe_on and observe_on", "[hide][ int c = 0; int n = 1; auto start = clock::now(); - for (int i = 0; i < subscriptions; i++) { - std::atomic_bool done; - rx::observable<>::just(1) + for (int i = 0; i < subscriptions; ++i) { + c += rx::observable<>::just(1) .map([](int i) { std::stringstream serializer; serializer << i; @@ -36,18 +35,55 @@ SCENARIO("for loop subscribes to map with subscribe_on and observe_on", "[hide][ }) .subscribe_on(rx::observe_on_event_loop()) .observe_on(rx::observe_on_event_loop()) - .subscribe([&](int i){ - ++c; - }, - [&](){ - done = true; - }); - while(!done); + .as_blocking() + .count(); } auto finish = clock::now(); auto msElapsed = duration_cast(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(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; + } + } + } +} -- GitLab From 065098dd3175564b9405d7faf55b8e483c0f4ed0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 17:03:59 -0700 Subject: [PATCH 406/782] fix lifetime and workaround bugs in osx condition_variables --- Rx/v2/src/rxcpp/rx-observable.hpp | 67 ++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index b8c6a1a..b64c9fe 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -183,22 +183,61 @@ class blocking_observable -> composite_subscription { std::mutex lock; std::condition_variable wake; - std::atomic_bool disposed; + composite_subscription cs; + struct tracking + { + ~tracking(){ + if (!disposed || !wakened) abort(); + } + tracking() : + disposed(false), + wakened(false), + false_wakes(0), + true_wakes(0) + { + } + std::atomic_bool disposed; + std::atomic_bool wakened; + std::atomic_int false_wakes; + std::atomic_int true_wakes; + }; + auto track = std::make_shared(); + auto scbr = make_subscriber(std::forward(an)...); - auto cs = scbr.get_subscription(); - cs.add([&](){ - disposed = true; - wake.notify_one(); - }); + cs = scbr.get_subscription(); + cs.add( + [&, track](){ + // OSX geting invalid x86 op if notify_one is after the disposed = true + // presumably because the condition_variable may already have been awakened + // and is now sitting in a while loop on disposed + wake.notify_one(); + track->disposed = true; + }); std::unique_lock guard(lock); - source.subscribe(scbr); - wake.wait(guard, [&](){return !!disposed;}); - return cs; + source.subscribe(std::move(scbr)); + wake.wait(guard, + [&, track](){ + // this is really not good. + // false wakeups were never followed by true wakeups on OSX so.. + + // anyways this gets triggered before disposed is set now so wait. + while (!track->disposed) { + ++track->false_wakes; + } + ++track->true_wakes; + return true; + }); + track->wakened = true; + if (!track->disposed || !track->wakened) abort(); + return composite_subscription::empty(); } public: typedef typename std::decay::type observable_type; observable_type source; + ~blocking_observable() + { + } blocking_observable(observable_type s) : source(std::move(s)) {} /// @@ -221,12 +260,14 @@ public: rxu::maybe result; composite_subscription cs; subscribe(cs, [&](T v){result.reset(v); cs.unsubscribe();}); + if (result.empty()) abort(); return result.get(); } T last() const { rxu::maybe result; subscribe([&](T v){result.reset(v);}); + if (result.empty()) abort(); return result.get(); } @@ -316,6 +357,10 @@ public: static_assert(rxo::is_operator::value || rxs::is_source::value, "observable must wrap an operator or source"); + ~observable() + { + } + observable() { } @@ -423,7 +468,7 @@ public: /// for each item from this observable use Selector to produce an item to emit from the new observable that is returned. /// template - auto map(Selector&& s) const + auto map(Selector s) const -> decltype(EXPLICIT_THIS lift::value_type>(rxo::detail::map(std::move(s)))) { return lift::value_type>(rxo::detail::map(std::move(s))); } @@ -796,7 +841,7 @@ public: auto subscribe_on(Coordination cn) const -> observable::value_type, rxo::detail::subscribe_on> { return observable::value_type, rxo::detail::subscribe_on>( - rxo::detail::subscribe_on(*this, std::forward(cn))); + rxo::detail::subscribe_on(*this, std::move(cn))); } /// observe_on -> -- GitLab From c655280fa2ca28e59137730ee203eae04bf71741 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 17:04:20 -0700 Subject: [PATCH 407/782] add group_by test (pi series) --- Rx/v2/src/rxcpp/rx-grouped_observable.hpp | 12 +++ Rx/v2/test/operators/group_by.cpp | 125 ++++++++++++++++++++++ 2 files changed, 137 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp index a56878c..3b248af 100644 --- a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp @@ -46,6 +46,9 @@ private: }; std::shared_ptr state; + template + friend bool operator==(const dynamic_grouped_observable&, const dynamic_grouped_observable&); + template void construct(const dynamic_grouped_observable& o, const tag_dynamic_grouped_observable&) { state = o.state; @@ -120,6 +123,15 @@ public: } }; +template +inline bool operator==(const dynamic_grouped_observable& lhs, const dynamic_grouped_observable& rhs) { + return lhs.state == rhs.state; +} +template +inline bool operator!=(const dynamic_grouped_observable& lhs, const dynamic_grouped_observable& rhs) { + return !(lhs == rhs); +} + template grouped_observable make_dynamic_grouped_observable(Source&& s) { return grouped_observable(dynamic_grouped_observable(std::forward(s))); diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index ac1b8cc..d3e1913 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -8,6 +8,131 @@ namespace rxsc=rxcpp::schedulers; #include +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(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()); + + // use all available hardware threads + auto total = rxcpp::observable<>::range(0, 19). + group_by( + [](int i) -> int {return i % std::thread::hardware_concurrency();}, + [](int i){return i;}). + map( + [=, &c](rxcpp::grouped_observable onproc) { + auto key = onproc.get_key(); + // share a producer thread across all the ranges in this group + auto producerthread = rxcpp::observe_on_one_worker(rxcpp::observe_on_new_thread().create_coordinator().get_scheduler()); + return onproc. + map( + [=, &c](int index){ + static const int chunk = 1000000; + auto first = (chunk * index) + 1; + auto last = chunk * (index + 1); + std::cout << std::setw(3) << index << ": range - " << first << "-" << last << std::endl; + + return rxcpp::observable<>::range(first, 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); + }). + 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(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(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()); + + // use all available hardware threads + auto total = rxcpp::observable<>::range(0, std::thread::hardware_concurrency() - 1). + map( + [=, &c](int index){ + // partition equally across threads + static const int chunk = 20000000 / std::thread::hardware_concurrency(); + auto first = (chunk * index) + 1; + auto last = chunk * (index + 1); + std::cout << std::setw(3) << index << ": range - " << first << "-" << last << std::endl; + + return rxcpp::observable<>::range(first, 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 << std::this_thread::get_id() << " - value: " << std::setprecision(16) << v; + return std::make_tuple(message.str(), v); + }). + as_dynamic(); + }). + observe_on(outputthread). + merge(). + 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(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(c, std::locale::classic()); } -- GitLab From 7307e7e71c042cead948e330a2ab2485921318d4 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 18:16:49 -0700 Subject: [PATCH 408/782] windows workarounds --- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 29 -------------------- Rx/v2/src/rxcpp/rx-observable.hpp | 35 ++++++++++++++++--------- Rx/v2/test/operators/group_by.cpp | 6 +++-- projects/CMake/CMakeLists.txt | 9 ++++--- 4 files changed, 31 insertions(+), 48 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index e53f2c5..1c721e4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -186,35 +186,6 @@ struct initialize_seeder { } }; -template -struct last { - typedef rxu::maybe::type> seed_type; - seed_type seed() { - return seed_type{}; - } - seed_type operator()(const seed_type& a, T v) { - return seed_type(v); - } - typename std::decay::type operator()(seed_type a) { - // should abort if a is empty - return a.get(); - } -}; - -template -struct count { - typedef int seed_type; - seed_type seed() { - return seed_type{}; - } - seed_type operator()(seed_type a, T v) { - return ++a; - } - seed_type operator()(seed_type a) { - return a; - } -}; - template struct average { struct seed_type diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index b64c9fe..bbb9599 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -186,15 +186,16 @@ class blocking_observable composite_subscription cs; struct tracking { - ~tracking(){ + ~tracking() + { if (!disposed || !wakened) abort(); } - tracking() : - disposed(false), - wakened(false), - false_wakes(0), - true_wakes(0) + tracking() { + disposed = false; + wakened = false; + false_wakes = 0; + true_wakes = 0; } std::atomic_bool disposed; std::atomic_bool wakened; @@ -218,7 +219,7 @@ class blocking_observable wake.wait(guard, [&, track](){ // this is really not good. - // false wakeups were never followed by true wakeups on OSX so.. + // false wakeups were never followed by true wakeups so.. // anyways this gets triggered before disposed is set now so wait. while (!track->disposed) { @@ -883,17 +884,13 @@ public: /// for each item from this observable reduce it by sending only the last item. /// auto last() const - -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { - return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, rxo::detail::last(), rxo::detail::last(), rxo::detail::last().seed()); - } + -> observable; /// count -> /// for each item from this observable reduce it by incrementing a count. /// auto count() const - -> typename defer_reduce, rxu::defer_type, rxu::defer_type>::observable_type { - return defer_reduce, rxu::defer_type, rxu::defer_type>::make(source_operator, rxo::detail::count(), rxo::detail::count(), rxo::detail::count().seed()); - } + -> observable; /// sum -> /// for each item from this observable reduce it by adding to the previous items. @@ -1053,12 +1050,24 @@ public: }; +template +auto observable::last() const + -> observable { + rxu::util::maybe seed; + return this->reduce(seed, [](rxu::util::maybe, T t){return rxu::util::maybe(std::move(t));}, [](rxu::util::maybe result){return result.get();}); +} + template auto observable::first() const -> observable { return this->take(1).last(); } +template +auto observable::count() const + -> observable { + return this->reduce(0, [](int current, const T&){return ++current;}, [](int result){return result;}); +} template inline bool operator==(const observable& lhs, const observable& rhs) { diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index d3e1913..1d85193 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -12,7 +12,8 @@ SCENARIO("range partitioned by group_by across hardware threads to derive pi", " GIVEN("a for loop"){ WHEN("partitioning pi series across all hardware threads"){ - std::atomic_int c(0); + std::atomic_int c; + c = 0; auto pi = [&](int k) { ++c; return ( k % 2 == 0 ? -4.0L : 4.0L ) / ( ( 2.0L * k ) - 1.0L ); @@ -80,7 +81,8 @@ SCENARIO("range partitioned by dividing work across hardware threads to derive p GIVEN("a for loop"){ WHEN("partitioning pi series across all hardware threads"){ - std::atomic_int c(0); + std::atomic_int c; + c = 0; auto pi = [&](int k) { ++c; return ( k % 2 == 0 ? -4.0L : 4.0L ) / ( ( 2.0L * k ) - 1.0L ); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 99c20f2..b71b95e 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -64,12 +64,13 @@ set(TEST_SOURCES add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) -set(OP_SOURCES +# define the sources of the self test +set(ONE_SOURCES ${TEST_DIR}/test.cpp - ${TEST_DIR}/operators/group_by.cpp + ${TEST_DIR}/operators/subscribe_on.cpp ) -#add_executable(op_test ${OP_SOURCES}) -#TARGET_LINK_LIBRARIES(op_test ${CMAKE_THREAD_LIBS_INIT}) +add_executable(one_test ${ONE_SOURCES}) +TARGET_LINK_LIBRARIES(one_test ${CMAKE_THREAD_LIBS_INIT}) set(EXAMPLES_DIR ${RXCPP_DIR}/Rx/v2/examples) -- GitLab From 80f3ca2178549b3c37bd566f6cce9ea8340c6db2 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 18:26:53 -0700 Subject: [PATCH 409/782] remove redundant namspace --- Rx/v2/src/rxcpp/rx-observable.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index bbb9599..a12d88b 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -1053,8 +1053,8 @@ public: template auto observable::last() const -> observable { - rxu::util::maybe seed; - return this->reduce(seed, [](rxu::util::maybe, T t){return rxu::util::maybe(std::move(t));}, [](rxu::util::maybe result){return result.get();}); + rxu::maybe seed; + return this->reduce(seed, [](rxu::maybe, T t){return rxu::maybe(std::move(t));}, [](rxu::maybe result){return result.get();}); } template -- GitLab From 1e80c4b244fb764d6d4a1da5a6d40bc1e27645ca Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 9 Aug 2014 20:32:39 -0700 Subject: [PATCH 410/782] linux fixes --- projects/CMake/CMakeLists.txt | 2 +- projects/scripts/travis-install.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b71b95e..d5e260f 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -7,7 +7,7 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) FIND_PACKAGE(Threads) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") + list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -ftemplate-depth=1024 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 8f9f5fe..466c1fa 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -15,6 +15,8 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then if [ "$CC" = clang ]; then sudo apt-get install -q --fix-missing clang-3.6 + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 20 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 20 fi if [ "$CC" = gcc ]; then -- GitLab From c9774c09c7f3a880dff80cb46a0408bcde77274e Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 7 Aug 2014 19:08:59 +0400 Subject: [PATCH 411/782] Add scope operator --- Rx/v2/src/rxcpp/rx-observable.hpp | 5 ++ Rx/v2/src/rxcpp/rx-sources.hpp | 1 + Rx/v2/src/rxcpp/rx-subscription.hpp | 52 ++++++++++++ Rx/v2/src/rxcpp/sources/rx-scope.hpp | 122 +++++++++++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 Rx/v2/src/rxcpp/sources/rx-scope.hpp diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a12d88b..3e083ed 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -1206,6 +1206,11 @@ public: -> decltype(rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o)) { return rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o); } + template + 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)); + } }; diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index c9fb73f..25d40ec 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -42,5 +42,6 @@ namespace rxs=sources; #include "sources/rx-defer.hpp" #include "sources/rx-never.hpp" #include "sources/rx-error.hpp" +#include "sources/rx-scope.hpp" #endif diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 3ee8441..5875ac5 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -441,6 +441,58 @@ inline bool operator!=(const composite_subscription& lhs, const composite_subscr //static RXCPP_SELECT_ANY composite_subscription composite_subscription::shared_empty = composite_subscription(detail::tag_composite_subscription_empty()); + +template +class resource : public subscription_base +{ +public: + typedef typename composite_subscription::weak_subscription weak_subscription; + + resource(T t, composite_subscription cs = composite_subscription()) + : lifetime(std::move(cs)) + , value(new std::shared_ptr(new T(std::move(t)))) + { + auto localValue = value; + lifetime.add( + [localValue](){ + localValue->reset(); + } + ); + } + + T& get() const { + return *value.get()->get(); + } + composite_subscription& get_subscription() const { + return lifetime; + } + + bool is_subscribed() const { + return lifetime.is_subscribed(); + } + weak_subscription add(subscription s) const { + return lifetime.add(std::move(s)); + } + template + auto add(F f) const + -> typename std::enable_if::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> value; +}; + } #endif diff --git a/Rx/v2/src/rxcpp/sources/rx-scope.hpp b/Rx/v2/src/rxcpp/sources/rx-scope.hpp new file mode 100644 index 0000000..43b0194 --- /dev/null +++ b/Rx/v2/src/rxcpp/sources/rx-scope.hpp @@ -0,0 +1,122 @@ +// 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" + +namespace rxcpp { + +namespace sources { + +namespace detail { + +template +struct scope_traits +{ + typedef typename std::decay::type resource_factory_type; + typedef typename std::decay::type 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::value, "ResourceFactory must return a subscription"); +}; + +template +struct scope : public source_base::value_type> +{ + typedef scope_traits 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 + void on_subscribe(Subscriber o) const { + + struct state_type + : public std::enable_shared_from_this + , public values + { + state_type(values i, Subscriber o) + : values(i) + , out(std::move(o)) + { + out.add(lifetime); + } + Subscriber out; + rxu::detail::maybe resource; + composite_subscription lifetime; + }; + + auto state = std::shared_ptr(new state_type(initial, std::move(o))); + + state->resource = on_exception( + [&](){return state->resource_factory(); }, + state->out); + if (state->resource.empty()) { + return; + } + + auto selectedCollection = on_exception( + [state](){return state->observable_factory(state->resource.get()); }, + state->out); + if (selectedCollection.empty()) { + return; + } + + selectedCollection->subscribe(make_subscriber( + state->lifetime, + // on_next + [state](value_type st) { + state->out.on_next(st); + }, + // on_error + [state](std::exception_ptr e) { + state->out.on_error(e); + state->resource->unsubscribe(); + }, + // on_completed + [state]() { + state->out.on_completed(); + state->resource->unsubscribe(); + } + )); + } +}; + +} + +template +auto scope(ResourceFactory rf, ObservableFactory of) + -> observable::value_type, detail::scope> { + return observable::value_type, detail::scope>( + detail::scope(std::move(rf), std::move(of))); +} + +} + +} + +#endif -- GitLab From 609ec19178ac2c383f52571cf0d9ee7c2d1df527 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 7 Aug 2014 19:13:39 +0400 Subject: [PATCH 412/782] Add tests for scope operator --- Rx/v2/test/sources/scope.cpp | 427 ++++++++++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 1 + 2 files changed, 428 insertions(+) create mode 100644 Rx/v2/test/sources/scope.cpp diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp new file mode 100644 index 0000000..4201b50 --- /dev/null +++ b/Rx/v2/test/sources/scope.cpp @@ -0,0 +1,427 @@ +#include "rxcpp/rx.hpp" +namespace rx=rxcpp; +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +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 on; + + rxu::detail::maybe> xs; + + typedef rx::resource> 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::recorded_type>(); + int time = 10; + auto values = r.get(); + std::for_each(values.begin(), values.end(), [&](int &v){ + msg.push_back(on.on_next(time, v)); + time += 10; + }); + msg.push_back(on.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.on_next(210, 1), + on.on_next(220, 2), + on.on_next(230, 3), + on.on_next(240, 4), + on.on_next(250, 5), + on.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 on; + + rxu::detail::maybe> xs; + + typedef rx::resource> 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::recorded_type>(); + int time = 210; + auto values = r.get(); + std::for_each(values.begin(), values.end(), [&](int &v){ + msg.push_back(on.on_next(time, v)); + time += 10; + }); + msg.push_back(on.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.on_next(210, 1), + on.on_next(220, 2), + on.on_next(230, 3), + on.on_next(240, 4), + on.on_next(250, 5), + on.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 on; + + int resource_factory_invoked = 0; + int observable_factory_invoked = 0; + + rxu::detail::maybe> xs; + + typedef rx::resource 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.on_next(100, r.get()), + on.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.on_next(300, 200), + on.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 on; + + std::runtime_error ex("scope on_error from source"); + + int resource_factory_invoked = 0; + int observable_factory_invoked = 0; + + rxu::detail::maybe> xs; + + typedef rx::resource 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.on_next(100, r.get()), + on.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.on_next(300, 200), + on.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 on; + + int resource_factory_invoked = 0; + int observable_factory_invoked = 0; + + rxu::detail::maybe> xs; + + typedef rx::resource 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.on_next(100, r.get()), + on.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.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]"){ + GIVEN("a test cold observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + std::runtime_error ex("scope on_error from source"); + + int resource_factory_invoked = 0; + int observable_factory_invoked = 0; + + WHEN("created by scope"){ + + auto res = w.start( + [&]() { + return rx::observable<>:: + scope( + [&](){ + ++resource_factory_invoked; + throw ex; + return rx::make_subscription(); + }, + [&](rx::subscription& s){ + ++observable_factory_invoked; + return rx::observable<>::never(); + } + ) + // 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.on_error(200, ex) + }); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + } + } +} + +SCENARIO("scope, throw resource usage", "[scope][sources]"){ + GIVEN("a test cold observable of ints"){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + std::runtime_error ex("scope on_error from source"); + + int resource_factory_invoked = 0; + int observable_factory_invoked = 0; + + WHEN("created by scope"){ + + auto res = w.start( + [&]() { + return rx::observable<>:: + scope( + [&](){ + ++resource_factory_invoked; + return rx::make_subscription(); + }, + [&](rx::subscription& s){ + ++observable_factory_invoked; + throw ex; + return rx::observable<>::never(); + } + ) + // 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.on_error(200, ex) + }); + auto actual = res.get_observer().messages(); + REQUIRE(required == actual); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index d5e260f..5ed89a9 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -36,6 +36,7 @@ set(TEST_SOURCES ${TEST_DIR}/sources/create.cpp ${TEST_DIR}/sources/defer.cpp ${TEST_DIR}/sources/interval.cpp + ${TEST_DIR}/sources/scope.cpp ${TEST_DIR}/operators/buffer.cpp ${TEST_DIR}/operators/combine_latest.1.cpp ${TEST_DIR}/operators/combine_latest.2.cpp -- GitLab From 8e617019b3a111624de99309c2febbf5d27a41ab Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Fri, 8 Aug 2014 14:00:20 +0400 Subject: [PATCH 413/782] Small changes on scope operator --- Rx/v2/src/rxcpp/rx-subscription.hpp | 8 ++++---- Rx/v2/src/rxcpp/sources/rx-scope.hpp | 23 +++-------------------- Rx/v2/test/sources/scope.cpp | 22 +++++++++++++--------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 5875ac5..2f61652 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -450,7 +450,7 @@ public: resource(T t, composite_subscription cs = composite_subscription()) : lifetime(std::move(cs)) - , value(new std::shared_ptr(new T(std::move(t)))) + , value(std::make_shared>(std::make_unique(std::move(t)))) { auto localValue = value; lifetime.add( @@ -460,10 +460,10 @@ public: ); } - T& get() const { + T& get() { return *value.get()->get(); } - composite_subscription& get_subscription() const { + composite_subscription& get_subscription() { return lifetime; } @@ -490,7 +490,7 @@ public: protected: composite_subscription lifetime; - std::shared_ptr> value; + std::shared_ptr> value; }; } diff --git a/Rx/v2/src/rxcpp/sources/rx-scope.hpp b/Rx/v2/src/rxcpp/sources/rx-scope.hpp index 43b0194..589493e 100644 --- a/Rx/v2/src/rxcpp/sources/rx-scope.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-scope.hpp @@ -63,11 +63,9 @@ struct scope : public source_base resource; - composite_subscription lifetime; }; auto state = std::shared_ptr(new state_type(initial, std::move(o))); @@ -78,7 +76,8 @@ struct scope : public source_baseresource.empty()) { return; } - + state->out.add(state->resource->get_subscription()); + auto selectedCollection = on_exception( [state](){return state->observable_factory(state->resource.get()); }, state->out); @@ -86,23 +85,7 @@ struct scope : public source_basesubscribe(make_subscriber( - state->lifetime, - // on_next - [state](value_type st) { - state->out.on_next(st); - }, - // on_error - [state](std::exception_ptr e) { - state->out.on_error(e); - state->resource->unsubscribe(); - }, - // on_completed - [state]() { - state->out.on_completed(); - state->resource->unsubscribe(); - } - )); + selectedCollection->subscribe(state->out); } }; diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp index 4201b50..b8d36cb 100644 --- a/Rx/v2/test/sources/scope.cpp +++ b/Rx/v2/test/sources/scope.cpp @@ -25,7 +25,7 @@ SCENARIO("scope, cold observable", "[scope][sources]"){ [&](){ return resource(rxu::to_vector({1, 2, 3, 4, 5})); }, - [&](resource& r){ + [&](resource r){ auto msg = std::vector::recorded_type>(); int time = 10; auto values = r.get(); @@ -86,7 +86,7 @@ SCENARIO("scope, hot observable", "[scope][sources]"){ [&](){ return resource(rxu::to_vector({1, 2, 3, 4, 5})); }, - [&](resource& r){ + [&](resource r){ auto msg = std::vector::recorded_type>(); int time = 210; auto values = r.get(); @@ -151,7 +151,7 @@ SCENARIO("scope, complete", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -218,7 +218,7 @@ SCENARIO("scope, error", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -283,7 +283,7 @@ SCENARIO("scope, dispose", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource& r){ + [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ on.on_next(100, r.get()), @@ -335,6 +335,8 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ int resource_factory_invoked = 0; int observable_factory_invoked = 0; + typedef rx::resource resource; + WHEN("created by scope"){ auto res = w.start( @@ -344,9 +346,9 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ [&](){ ++resource_factory_invoked; throw ex; - return rx::make_subscription(); + return resource(sc.clock()); }, - [&](rx::subscription& s){ + [&](resource r){ ++observable_factory_invoked; return rx::observable<>::never(); } @@ -386,6 +388,8 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ int resource_factory_invoked = 0; int observable_factory_invoked = 0; + typedef rx::resource resource; + WHEN("created by scope"){ auto res = w.start( @@ -394,9 +398,9 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ scope( [&](){ ++resource_factory_invoked; - return rx::make_subscription(); + return resource(sc.clock()); }, - [&](rx::subscription& s){ + [&](resource r){ ++observable_factory_invoked; throw ex; return rx::observable<>::never(); -- GitLab From 181102a831780ab5cffba20051cfe24ea3bc9335 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Fri, 8 Aug 2014 15:27:10 +0400 Subject: [PATCH 414/782] Fixes for GCC --- Rx/v2/src/rxcpp/rx-subscription.hpp | 4 ++-- Rx/v2/src/rxcpp/sources/rx-scope.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 2f61652..3e70c87 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -448,9 +448,9 @@ class resource : public subscription_base public: typedef typename composite_subscription::weak_subscription weak_subscription; - resource(T t, composite_subscription cs = composite_subscription()) + resource(T t = T(), composite_subscription cs = composite_subscription()) : lifetime(std::move(cs)) - , value(std::make_shared>(std::make_unique(std::move(t)))) + , value(std::make_shared>(std::unique_ptr(new T(std::move(t))))) { auto localValue = value; lifetime.add( diff --git a/Rx/v2/src/rxcpp/sources/rx-scope.hpp b/Rx/v2/src/rxcpp/sources/rx-scope.hpp index 589493e..1b7a26d 100644 --- a/Rx/v2/src/rxcpp/sources/rx-scope.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-scope.hpp @@ -68,7 +68,7 @@ struct scope : public source_base resource; }; - auto state = std::shared_ptr(new state_type(initial, std::move(o))); + auto state = std::make_shared(state_type(initial, std::move(o))); state->resource = on_exception( [&](){return state->resource_factory(); }, -- GitLab From 4fe1497dd8e2052f157113118d85a5ec5f6a3f4c Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 11 Aug 2014 13:01:14 +0400 Subject: [PATCH 415/782] Small changes on resource class --- Rx/v2/src/rxcpp/rx-subscription.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 3e70c87..6263a1f 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -448,9 +448,15 @@ class resource : public subscription_base public: typedef typename composite_subscription::weak_subscription weak_subscription; - resource(T t = T(), composite_subscription cs = composite_subscription()) + resource() + : lifetime(composite_subscription()) + , value(std::make_shared>()) + { + } + + explicit resource(T t, composite_subscription cs = composite_subscription()) : lifetime(std::move(cs)) - , value(std::make_shared>(std::unique_ptr(new T(std::move(t))))) + , value(std::make_shared>(rxu::detail::maybe(std::move(t)))) { auto localValue = value; lifetime.add( @@ -461,7 +467,7 @@ public: } T& get() { - return *value.get()->get(); + return value.get()->get(); } composite_subscription& get_subscription() { return lifetime; @@ -490,7 +496,7 @@ public: protected: composite_subscription lifetime; - std::shared_ptr> value; + std::shared_ptr> value; }; } -- GitLab From ae454dd8ec80df01781b4421e75daeabd60d26b0 Mon Sep 17 00:00:00 2001 From: jonathan pickett Date: Thu, 21 Aug 2014 18:32:52 -0700 Subject: [PATCH 416/782] added retry operator --- Rx/v2/src/rxcpp/operators/rx-retry.hpp | 118 ++++++++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 21 ++++ Rx/v2/src/rxcpp/rx-operators.hpp | 2 +- Rx/v2/test/operators/retry.cpp | 146 +++++++++++++++++++++++++ 4 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-retry.hpp create mode 100644 Rx/v2/test/operators/retry.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-retry.hpp b/Rx/v2/src/rxcpp/operators/rx-retry.hpp new file mode 100644 index 0000000..112edef --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-retry.hpp @@ -0,0 +1,118 @@ +// 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_RETRY_HPP) +#define RXCPP_OPERATORS_RX_RETRY_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + + namespace operators { + + namespace detail { + + template + struct retry : public operator_base { + typedef typename std::decay::type source_type; + typedef typename std::decay::type count_type; + struct values { + values(source_type s, count_type t) + : source(std::move(s)) + , remaining(std::move(t)) + , retry_infinitely(t == 0) { + } + source_type source; + count_type remaining; + bool retry_infinitely; + }; + values initial; + + retry(source_type s, count_type t) + : initial(std::move(s), std::move(t)) { + } + + template + void on_subscribe(const Subscriber& s) const { + + typedef Subscriber output_type; + struct state_type + : public std::enable_shared_from_this + , public values { + state_type(const values& i, const output_type& oarg) + : values(i) + , source_lifetime(composite_subscription::empty()) + , out(oarg) { + } + composite_subscription source_lifetime; + output_type out; + + void do_subscribe() { + auto state = this->shared_from_this(); + + state->source_lifetime = composite_subscription(); + 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](std::exception_ptr e) { + if (state->retry_infinitely || (--state->remaining >= 0)) { + state->do_subscribe(); + } else { + state->out.on_error(e); + } + }, + // on_completed + [state]() { + + // JEP: never appeears to be called? + + state->out.on_completed(); + } + ); + } + }; + + // take a copy of the values for each subscription + auto state = std::shared_ptr(new state_type(initial, s)); + + // start the first iteration + state->do_subscribe(); + } + }; + + template + class retry_factory { + typedef typename std::decay::type count_type; + count_type count; + public: + retry_factory(count_type t) : count(std::move(t)) {} + + template + auto operator()(Observable&& source) + -> observable::type::value_type, retry::type::value_type, Observable, count_type>> { + return observable::type::value_type, retry::type::value_type, Observable, count_type>>( + retry::type::value_type, Observable, count_type>(std::forward(source), count)); + } + }; + + } + + template + auto retry(T&& t) + -> detail::retry_factory { + return detail::retry_factory(std::forward(t)); + } + + } + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a12d88b..a6592b7 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -1038,6 +1038,27 @@ public: rxo::detail::repeat(*this, t)); } + /// retry -> + /// infinitely retrys this observable + /// + /// + auto retry() const + -> observable> { + return observable>( + rxo::detail::retry(*this, 0)); + } + + /// retry -> + /// retrys this observable for given number of times + /// + /// + template + auto retry(Count t) const + -> observable> { + return observable>( + rxo::detail::retry(*this, t)); + } + /// start_with -> /// start with the supplied values, then concatenate this observable /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index b62ddd6..3b8d21a 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -63,5 +63,5 @@ namespace rxo=operators; #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" #include "operators/rx-window.hpp" - +#include "operators/rx-retry.hpp" #endif diff --git a/Rx/v2/test/operators/retry.cpp b/Rx/v2/test/operators/retry.cpp new file mode 100644 index 0000000..9bec879 --- /dev/null +++ b/Rx/v2/test/operators/retry.cpp @@ -0,0 +1,146 @@ +#include "rxcpp/rx.hpp" +namespace rxu = rxcpp::util; +namespace rxsc = rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 on; + std::runtime_error ex("retry on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(300, 1), + on.on_next(325, 2), + on.on_next(350, 3), + on.on_error(400, ex), + on.on_next(425, 1), + on.on_next(450, 2), + on.on_next(475, 3), + on.on_next(500, 4), + on.on_error(525, ex), + on.on_next(550, 1), + on.on_next(575, 2), + on.on_next(600, 3), + on.on_next(625, 4), + on.on_next(650, 5), + on.on_next(675, 6), + on.on_next(700, 7), + on.on_completed(725) + }); + + WHEN("infinite retry is launched") { + + auto res = w.start( + [&]() { + return xs + .retry() + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output contains all the data until complete") { + auto required = rxu::to_vector({ + on.on_next(300, 1), + on.on_next(325, 2), + on.on_next(350, 3), + on.on_next(425, 1), + on.on_next(450, 2), + on.on_next(475, 3), + on.on_next(500, 4), + on.on_next(550, 1), + on.on_next(575, 2), + on.on_next(600, 3), + on.on_next(625, 4), + on.on_next(650, 5), + on.on_next(675, 6), + on.on_next(700, 7), + on.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 with failure", "[retry][operators]") { + GIVEN("hot observable of 3x4x7 ints with errors inbetween the groups. Retry 1. Must fail.") { + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + std::runtime_error ex("retry on_error from source"); + + auto xs = sc.make_hot_observable({ + on.on_next(300, 1), + on.on_next(325, 2), + on.on_next(350, 3), + on.on_error(400, ex), + on.on_next(425, 1), + on.on_next(450, 2), + on.on_next(475, 3), + on.on_next(500, 4), + on.on_error(525, ex), + on.on_next(550, 1), + on.on_next(575, 2), + on.on_next(600, 3), + on.on_next(625, 4), + on.on_next(650, 5), + on.on_next(675, 6), + on.on_next(700, 7), + on.on_completed(725) + }); + + WHEN("retry of 1 is launched with expected error before complete") { + + auto res = w.start( + [&]() { + return xs + .retry(1) + // 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.on_next(300, 1), + on.on_next(325, 2), + on.on_next(350, 3), + on.on_next(425, 1), + on.on_next(450, 2), + on.on_next(475, 3), + on.on_next(500, 4), + on.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); + } + } + } +} + + -- GitLab From 2f45ae51b13ae3031e504448f09a42a22665b661 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Aug 2014 00:08:48 -0700 Subject: [PATCH 417/782] add retry tests --- projects/CMake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 5ed89a9..0e71bc4 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -53,6 +53,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/repeat.cpp + ${TEST_DIR}/operators/retry.cpp ${TEST_DIR}/operators/scan.cpp ${TEST_DIR}/operators/skip.cpp ${TEST_DIR}/operators/skip_until.cpp -- GitLab From 4d90d99aba0d60a60b576433f1a99e1bd68d1236 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Aug 2014 23:56:39 -0700 Subject: [PATCH 418/782] wrong type specified in group_by --- Rx/v2/src/rxcpp/operators/rx-group_by.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp index 726d2da..dcba7ed 100644 --- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -109,6 +109,7 @@ struct group_by { typedef group_by_observer this_type; typedef typename traits_type::grouped_observable_type value_type; + typedef typename traits_type::marble_type marble_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; @@ -133,7 +134,7 @@ struct group_by if (g == groups.end()) { auto sub = subject_type(); g = groups.insert(std::make_pair(selectedKey.get(), sub.get_subscriber())).first; - dest.on_next(make_dynamic_grouped_observable(group_by_observable(sub, selectedKey.get()))); + dest.on_next(make_dynamic_grouped_observable(group_by_observable(sub, selectedKey.get()))); } auto selectedMarble = on_exception( [&](){ -- GitLab From 640884aa45ed9e1385ca8643c5e0b60a42c3ceee Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Aug 2014 23:56:59 -0700 Subject: [PATCH 419/782] wrong type for seed in scan --- Rx/v2/src/rxcpp/operators/rx-scan.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp index 3776832..12c4b2f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -39,7 +39,7 @@ struct scan : public operator_base::type> template static void check(...); - scan(source_type o, accumulator_type a, T s) + scan(source_type o, accumulator_type a, seed_type s) : initial(std::move(o), a, s) { static_assert(std::is_convertible(0)), seed_type>::value, "scan Accumulator must be a function with the signature Seed(Seed, T)"); -- GitLab From 40b186d6ac8ff3cf3580af3f7586ed9850221d58 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Aug 2014 23:57:22 -0700 Subject: [PATCH 420/782] ensure that maybe type is decayed --- Rx/v2/src/rxcpp/rx-observer.hpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 42741fc..6fad944 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -381,11 +381,22 @@ auto make_observer_dynamic(OnNext&& on, OnError&& oe, OnCompleted&& oc) dynamic_observer(make_observer(std::forward(on), std::forward(oe), std::forward(oc)))); } +namespace detail { + +template +struct maybe_from_result +{ + typedef decltype((*(F*)nullptr)()) decl_result_type; + typedef typename std::decay::type result_type; + typedef rxu::maybe type; +}; + +} template auto on_exception(const F& f, const OnError& c) - -> typename std::enable_if::value, rxu::detail::maybe>::type { - rxu::detail::maybe r; + -> typename std::enable_if::value, typename detail::maybe_from_result::type>::type { + typename detail::maybe_from_result::type r; try { r.reset(f()); } catch (...) { @@ -396,8 +407,8 @@ auto on_exception(const F& f, const OnError& c) template auto on_exception(const F& f, const Subscriber& s) - -> typename std::enable_if::value, rxu::detail::maybe>::type { - rxu::detail::maybe r; + -> typename std::enable_if::value, typename detail::maybe_from_result::type>::type { + typename detail::maybe_from_result::type r; try { r.reset(f()); } catch (...) { -- GitLab From ebfff78d8e64f67e8e58717c7780bb2f8a8733d2 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Aug 2014 23:57:50 -0700 Subject: [PATCH 421/782] a loop must prevent moves. --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index 4ead228..f94f8f9 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -149,7 +149,7 @@ public: } } template - void on_next(V&& v) const { + void on_next(V v) const { if (b->current_generation != b->state->generation) { std::unique_lock guard(b->state->lock); b->current_generation = b->state->generation; @@ -160,7 +160,7 @@ public: } for (auto& o : b->current_completer->observers) { if (o.is_subscribed()) { - o.on_next(std::forward(v)); + o.on_next(v); } } } -- GitLab From 4b6b5491d28e14b2caca95516bd5c06fd8956d3c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 27 Aug 2014 23:59:12 -0700 Subject: [PATCH 422/782] update tests to use on.next instead of on.on_next --- Rx/v2/examples/tests/main.cpp | 2 + Rx/v2/examples/tests/take.cpp | 105 ++++ Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 12 +- Rx/v2/test/operators/buffer.cpp | 188 +++---- Rx/v2/test/operators/combine_latest.1.cpp | 160 +++--- Rx/v2/test/operators/combine_latest.2.cpp | 168 +++--- Rx/v2/test/operators/concat.cpp | 76 +-- Rx/v2/test/operators/concat_map.cpp | 34 +- .../test/operators/distinct_until_changed.cpp | 94 ++-- Rx/v2/test/operators/filter.cpp | 182 +++--- Rx/v2/test/operators/flat_map.cpp | 156 +++--- Rx/v2/test/operators/group_by.cpp | 48 +- Rx/v2/test/operators/lift.cpp | 90 +-- Rx/v2/test/operators/map.cpp | 28 +- Rx/v2/test/operators/merge.cpp | 144 ++--- Rx/v2/test/operators/publish.cpp | 120 ++-- Rx/v2/test/operators/reduce.cpp | 32 +- Rx/v2/test/operators/repeat.cpp | 128 ++--- Rx/v2/test/operators/scan.cpp | 64 +-- Rx/v2/test/operators/skip.cpp | 486 ++++++++-------- Rx/v2/test/operators/skip_until.cpp | 130 ++--- Rx/v2/test/operators/switch_on_next.cpp | 200 +++---- Rx/v2/test/operators/take.cpp | 520 +++++++++--------- Rx/v2/test/operators/take_until.cpp | 202 +++---- Rx/v2/test/operators/window.cpp | 174 +++--- Rx/v2/test/sources/create.cpp | 4 +- Rx/v2/test/sources/defer.cpp | 8 +- Rx/v2/test/sources/scope.cpp | 58 +- Rx/v2/test/subjects/subject.cpp | 110 ++-- projects/CMake/CMakeLists.txt | 12 +- 30 files changed, 1925 insertions(+), 1810 deletions(-) create mode 100644 Rx/v2/examples/tests/main.cpp create mode 100644 Rx/v2/examples/tests/take.cpp diff --git a/Rx/v2/examples/tests/main.cpp b/Rx/v2/examples/tests/main.cpp new file mode 100644 index 0000000..0c7c351 --- /dev/null +++ b/Rx/v2/examples/tests/main.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include "catch.hpp" diff --git a/Rx/v2/examples/tests/take.cpp b/Rx/v2/examples/tests/take.cpp new file mode 100644 index 0000000..41ec184 --- /dev/null +++ b/Rx/v2/examples/tests/take.cpp @@ -0,0 +1,105 @@ +#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 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 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/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 068125a..ec77c40 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -398,9 +398,9 @@ public: } }; - static const on_next_factory on_next; - static const on_completed_factory on_completed; - static const on_error_factory on_error; + static const on_next_factory next; + static const on_completed_factory completed; + static const on_error_factory error; struct subscribe_factory { @@ -587,15 +587,15 @@ public: template //static -RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::on_next = test::messages::on_next_factory(); +RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::next = test::messages::on_next_factory(); template //static -RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::on_completed = test::messages::on_completed_factory(); +RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::completed = test::messages::on_completed_factory(); template //static -RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::on_error = test::messages::on_error_factory(); +RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::error = test::messages::on_error_factory(); template //static diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index f02d8fe..4a60877 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -14,12 +14,12 @@ SCENARIO("buffer count partial window", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -35,8 +35,8 @@ SCENARIO("buffer count partial window", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(250, rxu::to_vector({ 2, 3, 4, 5 })), - v_on.on_completed(250) + v_on.next(250, rxu::to_vector({ 2, 3, 4, 5 })), + v_on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -61,12 +61,12 @@ SCENARIO("buffer count full windows", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -82,9 +82,9 @@ SCENARIO("buffer count full windows", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(220, rxu::to_vector({ 2, 3 })), - v_on.on_next(240, rxu::to_vector({ 4, 5 })), - v_on.on_completed(250) + 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); @@ -109,12 +109,12 @@ SCENARIO("buffer count full and partial windows", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -130,9 +130,9 @@ SCENARIO("buffer count full and partial windows", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(230, rxu::to_vector({ 2, 3, 4 })), - v_on.on_next(250, rxu::to_vector({ 5 })), - v_on.on_completed(250) + 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); @@ -159,12 +159,12 @@ SCENARIO("buffer count error", "[buffer][operators]"){ std::runtime_error ex("buffer on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_error(250, ex) + 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"){ @@ -180,7 +180,7 @@ SCENARIO("buffer count error", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_error(250, ex) + v_on.error(250, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -205,12 +205,12 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -226,11 +226,11 @@ SCENARIO("buffer count skip less", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(230, rxu::to_vector({ 2, 3, 4 })), - v_on.on_next(240, rxu::to_vector({ 3, 4, 5 })), - v_on.on_next(250, rxu::to_vector({ 4, 5 })), - v_on.on_next(250, rxu::to_vector({ 5 })), - v_on.on_completed(250) + 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); @@ -255,12 +255,12 @@ SCENARIO("buffer count skip more", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -276,9 +276,9 @@ SCENARIO("buffer count skip more", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(220, rxu::to_vector({ 2, 3 })), - v_on.on_next(250, rxu::to_vector({ 5 })), - v_on.on_completed(250) + 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); @@ -303,16 +303,16 @@ SCENARIO("buffer count basic", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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"){ @@ -328,11 +328,11 @@ SCENARIO("buffer count basic", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(280, rxu::to_vector({ 2, 3, 4 })), - v_on.on_next(350, rxu::to_vector({ 4, 5, 6 })), - v_on.on_next(420, rxu::to_vector({ 6, 7, 8 })), - v_on.on_next(600, rxu::to_vector({ 8, 9 })), - v_on.on_completed(600) + 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); @@ -357,16 +357,16 @@ SCENARIO("buffer count disposed", "[buffer][operators]"){ const rxsc::test::messages> v_on; auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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"){ @@ -383,8 +383,8 @@ SCENARIO("buffer count disposed", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(280, rxu::to_vector({ 2, 3, 4 })), - v_on.on_next(350, rxu::to_vector({ 4, 5, 6 })), + 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); @@ -411,16 +411,16 @@ SCENARIO("buffer count error 2", "[buffer][operators]"){ std::runtime_error ex("buffer on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_error(600, ex) + 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"){ @@ -436,10 +436,10 @@ SCENARIO("buffer count error 2", "[buffer][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.on_next(280, rxu::to_vector({ 2, 3, 4 })), - v_on.on_next(350, rxu::to_vector({ 4, 5, 6 })), - v_on.on_next(420, rxu::to_vector({ 6, 7, 8 })), - v_on.on_error(600, ex) + 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); diff --git a/Rx/v2/test/operators/combine_latest.1.cpp b/Rx/v2/test/operators/combine_latest.1.cpp index acf2e93..0493c78 100644 --- a/Rx/v2/test/operators/combine_latest.1.cpp +++ b/Rx/v2/test/operators/combine_latest.1.cpp @@ -12,19 +12,19 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato const rxsc::test::messages on; auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(230) + on.next(150, 1), + on.next(215, 2), + on.next(225, 4), + on.completed(230) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(220, 3), - on.on_next(230, 5), - on.on_next(235, 6), - on.on_next(240, 7), - on.on_completed(250) + 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"){ @@ -45,12 +45,12 @@ SCENARIO("combine_latest interleaved with tail", "[combine_latest][join][operato THEN("the output contains combined ints"){ auto required = rxu::to_vector({ - on.on_next(220, 2 + 3), - on.on_next(225, 4 + 3), - on.on_next(230, 4 + 5), - on.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.on_completed(250) + 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); @@ -82,17 +82,17 @@ SCENARIO("combine_latest consecutive", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(230) + on.next(150, 1), + on.next(215, 2), + on.next(225, 4), + on.completed(230) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.on_completed(250) + 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"){ @@ -113,9 +113,9 @@ SCENARIO("combine_latest consecutive", "[combine_latest][join][operators]"){ THEN("the output contains combined ints"){ auto required = rxu::to_vector({ - on.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.on_completed(250) + on.next(235, 4 + 6), + on.next(240, 4 + 7), + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -149,17 +149,17 @@ SCENARIO("combine_latest consecutive ends with error left", "[combine_latest][jo std::runtime_error ex("combine_latest on_error from source"); auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_error(230, ex) + on.next(150, 1), + on.next(215, 2), + on.next(225, 4), + on.error(230, ex) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.on_completed(250) + 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"){ @@ -180,7 +180,7 @@ SCENARIO("combine_latest consecutive ends with error left", "[combine_latest][jo THEN("the output contains only an error"){ auto required = rxu::to_vector({ - on.on_error(230, ex) + on.error(230, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -214,17 +214,17 @@ SCENARIO("combine_latest consecutive ends with error right", "[combine_latest][j std::runtime_error ex("combine_latest on_error from source"); auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_next(225, 4), - on.on_completed(250) + on.next(150, 1), + on.next(215, 2), + on.next(225, 4), + on.completed(250) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(235, 6), - on.on_next(240, 7), - on.on_error(245, ex) + 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"){ @@ -245,9 +245,9 @@ SCENARIO("combine_latest consecutive ends with error right", "[combine_latest][j THEN("the output contains combined ints followed by an error"){ auto required = rxu::to_vector({ - on.on_next(235, 4 + 6), - on.on_next(240, 4 + 7), - on.on_error(245, ex) + on.next(235, 4 + 6), + on.next(240, 4 + 7), + on.error(245, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -284,7 +284,7 @@ SCENARIO("combine_latest never N", "[combine_latest][join][operators]"){ for (int i = 0; i < N; ++i) { n.push_back( sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }) ); } @@ -336,9 +336,9 @@ SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){ std::vector> e; for (int i = 0; i < N; ++i) { e.push_back( - sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210 + 10 * i) + sc.make_hot_observable({ + on.next(150, 1), + on.completed(210 + 10 * i) }) ); } @@ -350,7 +350,7 @@ SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){ return e[0] .combine_latest( [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ - return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; }, e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] ) @@ -361,14 +361,14 @@ SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){ THEN("the output contains only complete message"){ auto required = rxu::to_vector({ - on.on_completed(200 + 10 * N) + 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 &s){ auto required = rxu::to_vector({ @@ -389,12 +389,12 @@ SCENARIO("combine_latest never/empty", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) + on.next(150, 1), + on.completed(210) }); WHEN("each int is combined with the latest from the other source"){ @@ -445,12 +445,12 @@ SCENARIO("combine_latest empty/never", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) + on.next(150, 1), + on.completed(210) }); auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("each int is combined with the latest from the other source"){ @@ -501,14 +501,14 @@ SCENARIO("combine_latest empty/return", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) + on.next(150, 1), + on.completed(210) }); auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) + on.next(150, 1), + on.next(215, 2), + on.completed(220) }); WHEN("each int is combined with the latest from the other source"){ @@ -529,7 +529,7 @@ SCENARIO("combine_latest empty/return", "[combine_latest][join][operators]"){ THEN("the output contains only complete message"){ auto required = rxu::to_vector({ - on.on_completed(220) + on.completed(220) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -561,14 +561,14 @@ SCENARIO("combine_latest return/empty", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) + on.next(150, 1), + on.next(215, 2), + on.completed(220) }); auto e = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(210) + on.next(150, 1), + on.completed(210) }); WHEN("each int is combined with the latest from the other source"){ @@ -589,7 +589,7 @@ SCENARIO("combine_latest return/empty", "[combine_latest][join][operators]"){ THEN("the output contains only complete message"){ auto required = rxu::to_vector({ - on.on_completed(220) + on.completed(220) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -621,13 +621,13 @@ SCENARIO("combine_latest never/return", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) + on.next(150, 1), + on.next(215, 2), + on.completed(220) }); WHEN("each int is combined with the latest from the other source"){ @@ -678,13 +678,13 @@ SCENARIO("combine_latest return/never", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(220) + on.next(150, 1), + on.next(215, 2), + on.completed(220) }); auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("each int is combined with the latest from the other source"){ diff --git a/Rx/v2/test/operators/combine_latest.2.cpp b/Rx/v2/test/operators/combine_latest.2.cpp index 4e26fcc..7406a26 100644 --- a/Rx/v2/test/operators/combine_latest.2.cpp +++ b/Rx/v2/test/operators/combine_latest.2.cpp @@ -12,15 +12,15 @@ SCENARIO("combine_latest return/return", "[combine_latest][join][operators]"){ const rxsc::test::messages on; auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(230) + on.next(150, 1), + on.next(215, 2), + on.completed(230) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(220, 3), - on.on_completed(240) + on.next(150, 1), + on.next(220, 3), + on.completed(240) }); WHEN("each int is combined with the latest from the other source"){ @@ -41,8 +41,8 @@ SCENARIO("combine_latest return/return", "[combine_latest][join][operators]"){ THEN("the output contains combined ints"){ auto required = rxu::to_vector({ - on.on_next(220, 2 + 3), - on.on_completed(240) + on.next(220, 2 + 3), + on.completed(240) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -76,13 +76,13 @@ SCENARIO("combine_latest empty/error", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto emp = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(230) + on.next(150, 1), + on.completed(230) }); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); WHEN("each int is combined with the latest from the other source"){ @@ -103,7 +103,7 @@ SCENARIO("combine_latest empty/error", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -137,13 +137,13 @@ SCENARIO("combine_latest error/empty", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); auto emp = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(230) + on.next(150, 1), + on.completed(230) }); WHEN("each int is combined with the latest from the other source"){ @@ -164,7 +164,7 @@ SCENARIO("combine_latest error/empty", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -198,14 +198,14 @@ SCENARIO("combine_latest return/error", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto o = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_completed(230) + on.next(150, 1), + on.next(210, 2), + on.completed(230) }); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); WHEN("each int is combined with the latest from the other source"){ @@ -226,7 +226,7 @@ SCENARIO("combine_latest return/error", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -260,14 +260,14 @@ SCENARIO("combine_latest error/return", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); auto ret = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_completed(230) + on.next(150, 1), + on.next(210, 2), + on.completed(230) }); WHEN("each int is combined with the latest from the other source"){ @@ -288,7 +288,7 @@ SCENARIO("combine_latest error/return", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -323,13 +323,13 @@ SCENARIO("combine_latest error/error", "[combine_latest][join][operators]"){ std::runtime_error ex2("combine_latest on_error from source 2"); auto err1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex1) + on.next(150, 1), + on.error(220, ex1) }); auto err2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(230, ex2) + on.next(150, 1), + on.error(230, ex2) }); WHEN("each int is combined with the latest from the other source"){ @@ -350,7 +350,7 @@ SCENARIO("combine_latest error/error", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex1) + on.error(220, ex1) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -385,14 +385,14 @@ SCENARIO("combine_latest next+error/error", "[combine_latest][join][operators]") std::runtime_error ex2("combine_latest on_error from source 2"); auto err1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_error(220, ex1) + on.next(150, 1), + on.next(210, 2), + on.error(220, ex1) }); auto err2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(230, ex2) + on.next(150, 1), + on.error(230, ex2) }); WHEN("each int is combined with the latest from the other source"){ @@ -413,7 +413,7 @@ SCENARIO("combine_latest next+error/error", "[combine_latest][join][operators]") THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex1) + on.error(220, ex1) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -448,14 +448,14 @@ SCENARIO("combine_latest error/next+error", "[combine_latest][join][operators]") std::runtime_error ex2("combine_latest on_error from source 2"); auto err1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(230, ex1) + on.next(150, 1), + on.error(230, ex1) }); auto err2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_error(220, ex2) + on.next(150, 1), + on.next(210, 2), + on.error(220, ex2) }); WHEN("each int is combined with the latest from the other source"){ @@ -476,7 +476,7 @@ SCENARIO("combine_latest error/next+error", "[combine_latest][join][operators]") THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex2) + on.error(220, ex2) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -510,12 +510,12 @@ SCENARIO("combine_latest never/error", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); WHEN("each int is combined with the latest from the other source"){ @@ -536,7 +536,7 @@ SCENARIO("combine_latest never/error", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -570,12 +570,12 @@ SCENARIO("combine_latest error/never", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); auto n = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("each int is combined with the latest from the other source"){ @@ -596,7 +596,7 @@ SCENARIO("combine_latest error/never", "[combine_latest][join][operators]"){ THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -630,14 +630,14 @@ SCENARIO("combine_latest error after completed left", "[combine_latest][join][op std::runtime_error ex("combine_latest on_error from source"); auto ret = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_completed(215) + on.next(150, 1), + on.next(210, 2), + on.completed(215) }); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); WHEN("each int is combined with the latest from the other source"){ @@ -658,7 +658,7 @@ SCENARIO("combine_latest error after completed left", "[combine_latest][join][op THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -692,14 +692,14 @@ SCENARIO("combine_latest error after completed right", "[combine_latest][join][o std::runtime_error ex("combine_latest on_error from source"); auto err = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(220, ex) + on.next(150, 1), + on.error(220, ex) }); auto ret = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_completed(215) + on.next(150, 1), + on.next(210, 2), + on.completed(215) }); WHEN("each int is combined with the latest from the other source"){ @@ -720,7 +720,7 @@ SCENARIO("combine_latest error after completed right", "[combine_latest][join][o THEN("the output contains only error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -754,15 +754,15 @@ SCENARIO("combine_latest selector throws", "[combine_latest][join][operators]"){ std::runtime_error ex("combine_latest on_error from source"); auto o1 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(215, 2), - on.on_completed(230) + on.next(150, 1), + on.next(215, 2), + on.completed(230) }); auto o2 = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(220, 3), - on.on_completed(240) + on.next(150, 1), + on.next(220, 3), + on.completed(240) }); WHEN("each int is combined with the latest from the other source"){ @@ -783,7 +783,7 @@ SCENARIO("combine_latest selector throws", "[combine_latest][join][operators]"){ THEN("the output contains only error"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -822,8 +822,8 @@ SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators]" for (int i = 0; i < N; ++i) { e.push_back( sc.make_hot_observable({ - on.on_next(210 + 10 * i, 1), - on.on_completed(500) + on.next(210 + 10 * i, 1), + on.completed(500) }) ); } @@ -846,7 +846,7 @@ SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators]" THEN("the output contains only error"){ auto required = rxu::to_vector({ - on.on_error(200 + 10 * N, ex) + on.error(200 + 10 * N, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -878,10 +878,10 @@ SCENARIO("combine_latest typical N", "[combine_latest][join][operators]"){ for (int i = 0; i < N; ++i) { o.push_back( sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210 + 10 * i, i + 1), - on.on_next(410 + 10 * i, i + N + 1), - on.on_completed(800) + on.next(150, 1), + on.next(210 + 10 * i, i + 1), + on.next(410 + 10 * i, i + N + 1), + on.completed(800) }) ); } @@ -904,12 +904,12 @@ SCENARIO("combine_latest typical N", "[combine_latest][join][operators]"){ THEN("the output contains combined ints"){ auto required = rxu::to_vector({ - on.on_next(200 + 10 * N, N * (N + 1) / 2) + on.next(200 + 10 * N, N * (N + 1) / 2) }); for (int i = 0; i < N; ++i) { - required.push_back(on.on_next(410 + 10 * i, N * (N + 1) / 2 + N + N * i)); + required.push_back(on.next(410 + 10 * i, N * (N + 1) / 2 + N + N * i)); } - required.push_back(on.on_completed(800)); + required.push_back(on.completed(800)); auto actual = res.get_observer().messages(); REQUIRE(required == actual); } diff --git a/Rx/v2/test/operators/concat.cpp b/Rx/v2/test/operators/concat.cpp index 91be2be..f37ec24 100644 --- a/Rx/v2/test/operators/concat.cpp +++ b/Rx/v2/test/operators/concat.cpp @@ -102,37 +102,37 @@ SCENARIO("concat completes", "[concat][join][operators]"){ const rxsc::test::messages> o_on; auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_completed(50) + 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.on_next(10, 301), - on.on_next(20, 302), - on.on_next(30, 303), - on.on_next(40, 304), - on.on_next(120, 305), - on.on_completed(150) + 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.on_next(300, ys1), - o_on.on_next(400, ys2), - o_on.on_next(500, ys3), - o_on.on_completed(600) + o_on.next(300, ys1), + o_on.next(400, ys2), + o_on.next(500, ys3), + o_on.completed(600) }); WHEN("each int is merged"){ @@ -148,22 +148,22 @@ SCENARIO("concat completes", "[concat][join][operators]"){ THEN("the output contains merged ints"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 103), - on.on_next(420, 104), - on.on_next(510, 105), - on.on_next(520, 106), - on.on_next(540, 201), - on.on_next(550, 202), - on.on_next(560, 203), - on.on_next(570, 204), - on.on_next(590, 301), - on.on_next(600, 302), - on.on_next(610, 303), - on.on_next(620, 304), - on.on_next(700, 305), - on.on_completed(730) + 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); diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 7dc1302..0d3402c 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -208,17 +208,17 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ const rxsc::test::messages s_on; auto xs = sc.make_cold_observable({ - i_on.on_next(100, 4), - i_on.on_next(200, 2), - i_on.on_completed(500) + i_on.next(100, 4), + i_on.next(200, 2), + i_on.completed(500) }); auto ys = sc.make_cold_observable({ - s_on.on_next(50, "foo"), - s_on.on_next(100, "bar"), - s_on.on_next(150, "baz"), - s_on.on_next(200, "qux"), - s_on.on_completed(250) + 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"){ @@ -238,15 +238,15 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ THEN("the output contains strings repeated for each int"){ auto required = rxu::to_vector({ - s_on.on_next(350, "foo"), - s_on.on_next(400, "bar"), - s_on.on_next(450, "baz"), - s_on.on_next(500, "qux"), - s_on.on_next(600, "foo"), - s_on.on_next(650, "bar"), - s_on.on_next(700, "baz"), - s_on.on_next(750, "qux"), - s_on.on_completed(800) + 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); diff --git a/Rx/v2/test/operators/distinct_until_changed.cpp b/Rx/v2/test/operators/distinct_until_changed.cpp index 150b086..cf8d5cf 100644 --- a/Rx/v2/test/operators/distinct_until_changed.cpp +++ b/Rx/v2/test/operators/distinct_until_changed.cpp @@ -12,7 +12,7 @@ SCENARIO("distinct_until_changed - never", "[distinct_until_changed][operators]" const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("distinct values are taken"){ @@ -47,8 +47,8 @@ SCENARIO("distinct_until_changed - empty", "[distinct_until_changed][operators]" const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(250) + on.next(150, 1), + on.completed(250) }); WHEN("distinct values are taken"){ @@ -61,7 +61,7 @@ SCENARIO("distinct_until_changed - empty", "[distinct_until_changed][operators]" THEN("the output only contains complete message"){ auto required = rxu::to_vector({ - on.on_completed(250) + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -86,9 +86,9 @@ SCENARIO("distinct_until_changed - return", "[distinct_until_changed][operators] const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_completed(250) + on.next(150, 1), + on.next(210, 2), + on.completed(250) }); WHEN("distinct values are taken"){ @@ -101,8 +101,8 @@ SCENARIO("distinct_until_changed - return", "[distinct_until_changed][operators] THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_completed(250) + on.next(210, 2), + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -127,10 +127,10 @@ SCENARIO("distinct_until_changed - throw", "[distinct_until_changed][operators]" const rxsc::test::messages on; std::runtime_error ex("distinct_until_changed on_error from source"); - + auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(250, ex) + on.next(150, 1), + on.error(250, ex) }); WHEN("distinct values are taken"){ @@ -143,7 +143,7 @@ SCENARIO("distinct_until_changed - throw", "[distinct_until_changed][operators]" THEN("the output only contains only error"){ auto required = rxu::to_vector({ - on.on_error(250, ex) + on.error(250, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -168,12 +168,12 @@ SCENARIO("distinct_until_changed - all changes", "[distinct_until_changed][opera const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -186,11 +186,11 @@ SCENARIO("distinct_until_changed - all changes", "[distinct_until_changed][opera THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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); @@ -215,12 +215,12 @@ SCENARIO("distinct_until_changed - all same", "[distinct_until_changed][operator const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 2), - on.on_next(230, 2), - on.on_next(240, 2), - on.on_completed(250) + 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"){ @@ -233,8 +233,8 @@ SCENARIO("distinct_until_changed - all same", "[distinct_until_changed][operator THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_completed(250) + on.next(210, 2), + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -259,15 +259,15 @@ SCENARIO("distinct_until_changed - some changes", "[distinct_until_changed][oper const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), //* - on.on_next(215, 3), //* - on.on_next(220, 3), - on.on_next(225, 2), //* - on.on_next(230, 2), - on.on_next(230, 1), //* - on.on_next(240, 2), //* - on.on_completed(250) + 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"){ @@ -280,12 +280,12 @@ SCENARIO("distinct_until_changed - some changes", "[distinct_until_changed][oper THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), //* - on.on_next(215, 3), //* - on.on_next(225, 2), //* - on.on_next(230, 1), //* - on.on_next(240, 2), //* - on.on_completed(250) + 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); diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index 529f10a..fdab02a 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -31,21 +31,21 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600), - on.on_next(610, 12), - on.on_error(620, std::runtime_error("error in unsubscribed stream")), - on.on_completed(630) + 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"){ @@ -76,11 +76,11 @@ SCENARIO("filter stops on completion", "[filter][operators]"){ ); THEN("the output only contains primes"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7), - on.on_next(580, 11), - on.on_completed(600) + 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); @@ -111,18 +111,18 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600) + 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"){ @@ -152,9 +152,9 @@ SCENARIO("filter stops on disposal", "[where][filter][operators]"){ THEN("the output only contains primes that arrived before disposal"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7) + on.next(230, 3), + on.next(340, 5), + on.next(390, 7) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -186,21 +186,21 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ std::runtime_error ex("filter on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_error(600, ex), - on.on_next(610, 12), - on.on_error(620, std::runtime_error("error in unsubscribed stream")), - on.on_completed(630) + 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"){ @@ -229,11 +229,11 @@ SCENARIO("filter stops on error", "[where][filter][operators]"){ THEN("the output only contains primes"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7), - on.on_next(580, 11), - on.on_error(600, ex), + 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); @@ -265,21 +265,21 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ std::runtime_error ex("filter predicate error"); auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600), - on.on_next(610, 12), - on.on_error(620, std::runtime_error("error in unsubscribed stream")), - on.on_completed(630) + 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"){ @@ -314,9 +314,9 @@ SCENARIO("filter stops on throw from predicate", "[where][filter][operators]"){ THEN("the output only contains primes"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_error(380, ex) + on.next(230, 3), + on.next(340, 5), + on.error(380, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -346,21 +346,21 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600), - on.on_next(610, 12), - on.on_error(620, std::exception()), - on.on_completed(630) + 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(); @@ -402,9 +402,9 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") THEN("the output only contains primes"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7) + on.next(230, 3), + on.next(340, 5), + on.next(390, 7) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 9f99055..8490de8 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -242,19 +242,19 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ const rxsc::test::messages s_on; auto xs = sc.make_cold_observable({ - i_on.on_next(100, 4), - i_on.on_next(200, 2), - i_on.on_next(300, 3), - i_on.on_next(400, 1), - i_on.on_completed(500) + 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.on_next(50, "foo"), - s_on.on_next(100, "bar"), - s_on.on_next(150, "baz"), - s_on.on_next(200, "qux"), - s_on.on_completed(250) + 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"){ @@ -274,23 +274,23 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ THEN("the output contains strings repeated for each int"){ auto required = rxu::to_vector({ - s_on.on_next(350, "foo"), - s_on.on_next(400, "bar"), - s_on.on_next(450, "baz"), - s_on.on_next(450, "foo"), - s_on.on_next(500, "qux"), - s_on.on_next(500, "bar"), - s_on.on_next(550, "baz"), - s_on.on_next(550, "foo"), - s_on.on_next(600, "qux"), - s_on.on_next(600, "bar"), - s_on.on_next(650, "baz"), - s_on.on_next(650, "foo"), - s_on.on_next(700, "qux"), - s_on.on_next(700, "bar"), - s_on.on_next(750, "baz"), - s_on.on_next(800, "qux"), - s_on.on_completed(850) + 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); @@ -327,20 +327,20 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ const rxsc::test::messages s_on; auto xs = sc.make_cold_observable({ - i_on.on_next(100, 4), - i_on.on_next(200, 2), - i_on.on_next(300, 3), - i_on.on_next(400, 1), - i_on.on_next(500, 5), - i_on.on_next(700, 0) + 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.on_next(50, "foo"), - s_on.on_next(100, "bar"), - s_on.on_next(150, "baz"), - s_on.on_next(200, "qux"), - s_on.on_completed(250) + 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"){ @@ -356,27 +356,27 @@ SCENARIO("flat_map source never ends", "[flat_map][map][operators]"){ THEN("the output contains strings repeated for each int"){ auto required = rxu::to_vector({ - s_on.on_next(350, "foo"), - s_on.on_next(400, "bar"), - s_on.on_next(450, "baz"), - s_on.on_next(450, "foo"), - s_on.on_next(500, "qux"), - s_on.on_next(500, "bar"), - s_on.on_next(550, "baz"), - s_on.on_next(550, "foo"), - s_on.on_next(600, "qux"), - s_on.on_next(600, "bar"), - s_on.on_next(650, "baz"), - s_on.on_next(650, "foo"), - s_on.on_next(700, "qux"), - s_on.on_next(700, "bar"), - s_on.on_next(750, "baz"), - s_on.on_next(750, "foo"), - s_on.on_next(800, "qux"), - s_on.on_next(800, "bar"), - s_on.on_next(850, "baz"), - s_on.on_next(900, "qux"), - s_on.on_next(950, "foo") + 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); @@ -414,21 +414,21 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ const rxsc::test::messages s_on; auto xs = sc.make_cold_observable({ - i_on.on_next(100, 4), - i_on.on_next(200, 2), - i_on.on_next(300, 3), - i_on.on_next(400, 1), - i_on.on_completed(500) + 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.on_next(55, "foo"), - s_on.on_next(104, "bar"), - s_on.on_next(153, "baz"), - s_on.on_next(202, "qux"), - s_on.on_error(301, ex) + 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"){ @@ -444,15 +444,15 @@ SCENARIO("flat_map inner error", "[flat_map][map][operators]"){ THEN("the output contains strings repeated for each int"){ auto required = rxu::to_vector({ - s_on.on_next(355, "foo"), - s_on.on_next(404, "bar"), - s_on.on_next(453, "baz"), - s_on.on_next(455, "foo"), - s_on.on_next(502, "qux"), - s_on.on_next(504, "bar"), - s_on.on_next(553, "baz"), - s_on.on_next(555, "foo"), - s_on.on_error(601, ex) + 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); diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index 1d85193..674c54a 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -166,25 +166,25 @@ SCENARIO("group_by", "[group_by][operators]"){ int marbleInvoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(90, "error"), - on.on_next(110, "error"), - on.on_next(130, "error"), - on.on_next(220, " foo"), - on.on_next(240, " FoO "), - on.on_next(270, "baR "), - on.on_next(310, "foO "), - on.on_next(350, " Baz "), - on.on_next(360, " qux "), - on.on_next(390, " bar"), - on.on_next(420, " BAR "), - on.on_next(470, "FOO "), - on.on_next(480, "baz "), - on.on_next(510, " bAZ "), - on.on_next(530, " fOo "), - on.on_completed(570), - on.on_next(580, "error"), - on.on_completed(600), - on.on_error(650, new std::runtime_error("error in completed sequence")) + 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, new std::runtime_error("error in completed sequence")) }); WHEN("group each int with the next 2 ints"){ @@ -211,11 +211,11 @@ SCENARIO("group_by", "[group_by][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - on.on_next(220, "foo"), - on.on_next(270, "baR"), - on.on_next(350, "Baz"), - on.on_next(360, "qux"), - on.on_completed(570) + 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); diff --git a/Rx/v2/test/operators/lift.cpp b/Rx/v2/test/operators/lift.cpp index 0496019..0794178 100644 --- a/Rx/v2/test/operators/lift.cpp +++ b/Rx/v2/test/operators/lift.cpp @@ -101,18 +101,18 @@ SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]" long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600) + 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"){ @@ -132,9 +132,9 @@ SCENARIO("lift liftfilter stops on disposal", "[where][filter][lift][operators]" THEN("the output only contains primes that arrived before disposal"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7) + on.next(230, 3), + on.next(340, 5), + on.next(390, 7) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -164,18 +164,18 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stre long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600) + 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"){ @@ -195,9 +195,9 @@ SCENARIO("stream lift liftfilter stops on disposal", "[where][filter][lift][stre THEN("the output only contains primes that arrived before disposal"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7) + on.next(230, 3), + on.next(340, 5), + on.next(390, 7) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -227,18 +227,18 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(110, 1), - on.on_next(180, 2), - on.on_next(230, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(380, 6), - on.on_next(390, 7), - on.on_next(450, 8), - on.on_next(470, 9), - on.on_next(560, 10), - on.on_next(580, 11), - on.on_completed(600) + 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"){ @@ -271,9 +271,9 @@ SCENARIO("lift lambda filter stops on disposal", "[where][filter][lift][lambda][ THEN("the output only contains primes that arrived before disposal"){ auto required = rxu::to_vector({ - on.on_next(230, 3), - on.on_next(340, 5), - on.on_next(390, 7) + on.next(230, 3), + on.next(340, 5), + on.next(390, 7) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/map.cpp b/Rx/v2/test/operators/map.cpp index 4491511..aab227f 100644 --- a/Rx/v2/test/operators/map.cpp +++ b/Rx/v2/test/operators/map.cpp @@ -13,15 +13,15 @@ SCENARIO("map stops on completion", "[map][operators]"){ long invoked = 0; auto xs = sc.make_hot_observable({ - on.on_next(180, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(290, 4), - on.on_next(350, 5), - on.on_completed(400), - on.on_next(410, -1), - on.on_completed(420), - on.on_error(430, std::runtime_error("error on unsubscribed stream")) + 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"){ @@ -40,11 +40,11 @@ SCENARIO("map stops on completion", "[map][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(210, 3), - on.on_next(240, 4), - on.on_next(290, 5), - on.on_next(350, 6), - on.on_completed(400) + 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); diff --git a/Rx/v2/test/operators/merge.cpp b/Rx/v2/test/operators/merge.cpp index a8a32ad..2b32838 100644 --- a/Rx/v2/test/operators/merge.cpp +++ b/Rx/v2/test/operators/merge.cpp @@ -102,37 +102,37 @@ SCENARIO("merge completes", "[merge][join][operators]"){ const rxsc::test::messages> o_on; auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_completed(50) + 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.on_next(10, 301), - on.on_next(20, 302), - on.on_next(30, 303), - on.on_next(40, 304), - on.on_next(120, 305), - on.on_completed(150) + 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.on_next(300, ys1), - o_on.on_next(400, ys2), - o_on.on_next(500, ys3), - o_on.on_completed(600) + o_on.next(300, ys1), + o_on.next(400, ys2), + o_on.next(500, ys3), + o_on.completed(600) }); WHEN("each int is merged"){ @@ -148,22 +148,22 @@ SCENARIO("merge completes", "[merge][join][operators]"){ THEN("the output contains merged ints"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 103), - on.on_next(410, 201), - on.on_next(420, 104), - on.on_next(420, 202), - on.on_next(430, 203), - on.on_next(440, 204), - on.on_next(510, 105), - on.on_next(510, 301), - on.on_next(520, 106), - on.on_next(520, 302), - on.on_next(530, 303), - on.on_next(540, 304), - on.on_next(620, 305), - on.on_completed(650) + 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); @@ -212,30 +212,30 @@ SCENARIO("variadic merge completes", "[merge][join][operators]"){ const rxsc::test::messages> o_on; auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_completed(50) + 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.on_next(10, 301), - on.on_next(20, 302), - on.on_next(30, 303), - on.on_next(40, 304), - on.on_next(120, 305), - on.on_completed(150) + 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"){ @@ -249,22 +249,22 @@ SCENARIO("variadic merge completes", "[merge][join][operators]"){ THEN("the output contains merged ints"){ auto required = rxu::to_vector({ - on.on_next(210, 101), - on.on_next(210, 201), - on.on_next(210, 301), - on.on_next(220, 102), - on.on_next(220, 202), - on.on_next(220, 302), - on.on_next(230, 203), - on.on_next(230, 303), - on.on_next(240, 204), - on.on_next(240, 304), - on.on_next(310, 103), - on.on_next(320, 104), - on.on_next(320, 305), - on.on_next(410, 105), - on.on_next(420, 106), - on.on_completed(430) + 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); diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 5972ac2..27bc574 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -49,20 +49,20 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(110, 7), - on.on_next(220, 3), - on.on_next(280, 4), - on.on_next(290, 1), - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(410, 13), - on.on_next(430, 2), - on.on_next(450, 9), - on.on_next(520, 11), - on.on_next(560, 20), - on.on_completed(600) + 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(); @@ -130,11 +130,11 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(520, 11) + 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); @@ -164,20 +164,20 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ std::runtime_error ex("publish on_error"); auto xs = sc.make_hot_observable({ - on.on_next(110, 7), - on.on_next(220, 3), - on.on_next(280, 4), - on.on_next(290, 1), - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(410, 13), - on.on_next(430, 2), - on.on_next(450, 9), - on.on_next(520, 11), - on.on_next(560, 20), - on.on_error(600, ex) + 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(); @@ -231,13 +231,13 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(520, 11), - on.on_next(560, 20), - on.on_error(600, ex) + 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); @@ -263,20 +263,20 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(110, 7), - on.on_next(220, 3), - on.on_next(280, 4), - on.on_next(290, 1), - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(410, 13), - on.on_next(430, 2), - on.on_next(450, 9), - on.on_next(520, 11), - on.on_next(560, 20), - on.on_completed(600) + 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(); @@ -343,12 +343,12 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(200, 1979), - on.on_next(340, 8), - on.on_next(360, 5), - on.on_next(370, 6), - on.on_next(390, 7), - on.on_next(520, 11) + 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); diff --git a/Rx/v2/test/operators/reduce.cpp b/Rx/v2/test/operators/reduce.cpp index 4872ca5..8a552e3 100644 --- a/Rx/v2/test/operators/reduce.cpp +++ b/Rx/v2/test/operators/reduce.cpp @@ -14,13 +14,13 @@ SCENARIO("reduce some data with seed", "[reduce][operators]"){ int seed = 42; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 0), - on.on_next(220, 1), - on.on_next(230, 2), - on.on_next(240, 3), - on.on_next(250, 4), - on.on_completed(260) + 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) }); auto sum = xs.sum(); @@ -44,8 +44,8 @@ SCENARIO("reduce some data with seed", "[reduce][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(260, (seed + 0 + 1 + 2 + 3 + 4) * 5), - on.on_completed(260) + on.next(260, (seed + 0 + 1 + 2 + 3 + 4) * 5), + on.completed(260) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -70,11 +70,11 @@ SCENARIO("average some data", "[reduce][average][operators]"){ const rxsc::test::messages d_on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 3), - on.on_next(220, 4), - on.on_next(230, 2), - on.on_completed(250) + 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"){ @@ -87,8 +87,8 @@ SCENARIO("average some data", "[reduce][average][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - d_on.on_next(250, 3.0), - d_on.on_completed(250) + d_on.next(250, 3.0), + d_on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/repeat.cpp b/Rx/v2/test/operators/repeat.cpp index 10361ea..cf91a37 100644 --- a/Rx/v2/test/operators/repeat.cpp +++ b/Rx/v2/test/operators/repeat.cpp @@ -12,10 +12,10 @@ SCENARIO("repeat, basic test", "[repeat][operators]"){ const rxsc::test::messages on; auto xs = sc.make_cold_observable({ - on.on_next(100, 1), - on.on_next(150, 2), - on.on_next(200, 3), - on.on_completed(250) + on.next(100, 1), + on.next(150, 2), + on.next(200, 3), + on.completed(250) }); WHEN("infinite repeat is launched"){ @@ -31,15 +31,15 @@ SCENARIO("repeat, basic test", "[repeat][operators]"){ THEN("the output contains 3 sets of ints"){ auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(350, 2), - on.on_next(400, 3), - on.on_next(550, 1), - on.on_next(600, 2), - on.on_next(650, 3), - on.on_next(800, 1), - on.on_next(850, 2), - on.on_next(900, 3) + 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); @@ -66,9 +66,9 @@ SCENARIO("repeat, infinite observable test", "[repeat][operators]"){ const rxsc::test::messages on; auto xs = sc.make_cold_observable({ - on.on_next(100, 1), - on.on_next(150, 2), - on.on_next(200, 3) + on.next(100, 1), + on.next(150, 2), + on.next(200, 3) }); WHEN("infinite repeat is launched"){ @@ -84,9 +84,9 @@ SCENARIO("repeat, infinite observable test", "[repeat][operators]"){ THEN("the output contains a set of ints"){ auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(350, 2), - on.on_next(400, 3) + on.next(300, 1), + on.next(350, 2), + on.next(400, 3) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -112,10 +112,10 @@ SCENARIO("repeat, error test", "[repeat][operators]"){ std::runtime_error ex("repeat on_error from source"); auto xs = sc.make_cold_observable({ - on.on_next(100, 1), - on.on_next(150, 2), - on.on_next(200, 3), - on.on_error(250, ex) + on.next(100, 1), + on.next(150, 2), + on.next(200, 3), + on.error(250, ex) }); WHEN("infinite repeat is launched"){ @@ -131,10 +131,10 @@ SCENARIO("repeat, error test", "[repeat][operators]"){ THEN("the output contains a set of ints and an error"){ auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(350, 2), - on.on_next(400, 3), - on.on_error(450, ex) + 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); @@ -158,10 +158,10 @@ SCENARIO("countable repeat, basic test", "[repeat][operators]"){ const rxsc::test::messages on; auto xs = sc.make_cold_observable({ - on.on_next(5, 1), - on.on_next(10, 2), - on.on_next(15, 3), - on.on_completed(20) + on.next(5, 1), + on.next(10, 2), + on.next(15, 3), + on.completed(20) }); WHEN("repeat of 3 iterations is launched"){ @@ -177,16 +177,16 @@ SCENARIO("countable repeat, basic test", "[repeat][operators]"){ THEN("the output contains 3 sets of ints"){ auto required = rxu::to_vector({ - on.on_next(205, 1), - on.on_next(210, 2), - on.on_next(215, 3), - on.on_next(225, 1), - on.on_next(230, 2), - on.on_next(235, 3), - on.on_next(245, 1), - on.on_next(250, 2), - on.on_next(255, 3), - on.on_completed(260) + 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); @@ -212,10 +212,10 @@ SCENARIO("countable repeat, dispose test", "[repeat][operators]"){ const rxsc::test::messages on; auto xs = sc.make_cold_observable({ - on.on_next(5, 1), - on.on_next(10, 2), - on.on_next(15, 3), - on.on_completed(20) + on.next(5, 1), + on.next(10, 2), + on.next(15, 3), + on.completed(20) }); WHEN("repeat of 3 iterations is launched"){ @@ -232,11 +232,11 @@ SCENARIO("countable repeat, dispose test", "[repeat][operators]"){ THEN("the output contains less than 2 full sets of ints"){ auto required = rxu::to_vector({ - on.on_next(205, 1), - on.on_next(210, 2), - on.on_next(215, 3), - on.on_next(225, 1), - on.on_next(230, 2), + 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); @@ -261,9 +261,9 @@ SCENARIO("countable repeat, infinite observable test", "[repeat][operators]"){ const rxsc::test::messages on; auto xs = sc.make_cold_observable({ - on.on_next(100, 1), - on.on_next(150, 2), - on.on_next(200, 3) + on.next(100, 1), + on.next(150, 2), + on.next(200, 3) }); WHEN("infinite repeat is launched"){ @@ -279,9 +279,9 @@ SCENARIO("countable repeat, infinite observable test", "[repeat][operators]"){ THEN("the output contains a set of ints"){ auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(350, 2), - on.on_next(400, 3) + on.next(300, 1), + on.next(350, 2), + on.next(400, 3) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -307,10 +307,10 @@ SCENARIO("countable repeat, error test", "[repeat][operators]"){ std::runtime_error ex("repeat on_error from source"); auto xs = sc.make_cold_observable({ - on.on_next(100, 1), - on.on_next(150, 2), - on.on_next(200, 3), - on.on_error(250, ex) + on.next(100, 1), + on.next(150, 2), + on.next(200, 3), + on.error(250, ex) }); WHEN("infinite repeat is launched"){ @@ -326,10 +326,10 @@ SCENARIO("countable repeat, error test", "[repeat][operators]"){ THEN("the output contains a set of ints and an error"){ auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(350, 2), - on.on_next(400, 3), - on.on_error(450, ex) + 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); diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp index 58ec27e..9d60d11 100644 --- a/Rx/v2/test/operators/scan.cpp +++ b/Rx/v2/test/operators/scan.cpp @@ -14,7 +14,7 @@ SCENARIO("scan: seed, never", "[scan][operators]"){ int seed = 1; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), + on.next(150, 1), }); WHEN("mapped to ints that are one larger"){ @@ -56,8 +56,8 @@ SCENARIO("scan: seed, empty", "[scan][operators]"){ int seed = 1; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(250) + on.next(150, 1), + on.completed(250) }); WHEN("mapped to ints that are one larger"){ @@ -75,7 +75,7 @@ SCENARIO("scan: seed, empty", "[scan][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_completed(250) + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -101,9 +101,9 @@ SCENARIO("scan: seed, return", "[scan][operators]"){ int seed = 1; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(220, 2), - on.on_completed(250) + on.next(150, 1), + on.next(220, 2), + on.completed(250) }); WHEN("mapped to ints that are one larger"){ @@ -121,8 +121,8 @@ SCENARIO("scan: seed, return", "[scan][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(220, seed + 2), - on.on_completed(250) + on.next(220, seed + 2), + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -150,8 +150,8 @@ SCENARIO("scan: seed, throw", "[scan][operators]"){ std::runtime_error ex("scan on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(250, ex) + on.next(150, 1), + on.error(250, ex) }); WHEN("mapped to ints that are one larger"){ @@ -169,7 +169,7 @@ SCENARIO("scan: seed, throw", "[scan][operators]"){ THEN("the output stops on error"){ auto required = rxu::to_vector({ - on.on_error(250, ex) + on.error(250, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -195,12 +195,12 @@ SCENARIO("scan: seed, some data", "[scan][operators]"){ int seed = 1; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -218,11 +218,11 @@ SCENARIO("scan: seed, some data", "[scan][operators]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(210, seed + 2), - on.on_next(220, seed + 2 + 3), - on.on_next(230, seed + 2 + 3 + 4), - on.on_next(240, seed + 2 + 3 + 4 + 5), - on.on_completed(250) + 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); @@ -250,12 +250,12 @@ SCENARIO("scan: seed, accumulator throws", "[scan][operators]"){ std::runtime_error ex("scan on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -276,9 +276,9 @@ SCENARIO("scan: seed, accumulator throws", "[scan][operators]"){ THEN("the output stops on error"){ auto required = rxu::to_vector({ - on.on_next(210, seed + 2), - on.on_next(220, seed + 2 + 3), - on.on_error(230, ex) + on.next(210, seed + 2), + on.next(220, seed + 2 + 3), + on.error(230, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/skip.cpp b/Rx/v2/test/operators/skip.cpp index 72ede48..2596e74 100644 --- a/Rx/v2/test/operators/skip.cpp +++ b/Rx/v2/test/operators/skip.cpp @@ -12,26 +12,26 @@ SCENARIO("skip, complete after", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -47,7 +47,7 @@ SCENARIO("skip, complete after", "[skip][operators]"){ THEN("the output only contains only complete message"){ auto required = rxu::to_vector({ - on.on_completed(690) + on.completed(690) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -71,26 +71,26 @@ SCENARIO("skip, complete same", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -106,7 +106,7 @@ SCENARIO("skip, complete same", "[skip][operators]"){ THEN("the output only contains only complete message"){ auto required = rxu::to_vector({ - on.on_completed(690) + on.completed(690) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -130,26 +130,26 @@ SCENARIO("skip, complete before", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -165,14 +165,14 @@ SCENARIO("skip, complete before", "[skip][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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); @@ -196,26 +196,26 @@ SCENARIO("skip, complete zero", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -231,24 +231,24 @@ SCENARIO("skip, complete zero", "[skip][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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); @@ -274,26 +274,26 @@ SCENARIO("skip, error after", "[skip][operators]"){ std::runtime_error ex("skip on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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"){ @@ -309,7 +309,7 @@ SCENARIO("skip, error after", "[skip][operators]"){ THEN("the output only contains only error message"){ auto required = rxu::to_vector({ - on.on_error(690, ex) + on.error(690, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -335,26 +335,26 @@ SCENARIO("skip, error same", "[skip][operators]"){ std::runtime_error ex("skip on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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"){ @@ -370,7 +370,7 @@ SCENARIO("skip, error same", "[skip][operators]"){ THEN("the output only contains only error message"){ auto required = rxu::to_vector({ - on.on_error(690, ex) + on.error(690, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -396,26 +396,26 @@ SCENARIO("skip, error before", "[skip][operators]"){ std::runtime_error ex("skip on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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"){ @@ -431,21 +431,21 @@ SCENARIO("skip, error before", "[skip][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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); @@ -469,25 +469,25 @@ SCENARIO("skip, dispose before", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10) + 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"){ @@ -526,25 +526,25 @@ SCENARIO("skip, dispose after", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10) + 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"){ @@ -561,11 +561,11 @@ SCENARIO("skip, dispose after", "[skip][operators]"){ THEN("the output contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11) + 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); @@ -589,17 +589,17 @@ SCENARIO("skip, consecutive", "[skip][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_completed(400) + 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"){ @@ -616,10 +616,10 @@ SCENARIO("skip, consecutive", "[skip][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_completed(400) + on.next(310, 3), + on.next(340, 8), + on.next(370, 11), + on.completed(400) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/skip_until.cpp b/Rx/v2/test/operators/skip_until.cpp index 51db1ba..2b44673 100644 --- a/Rx/v2/test/operators/skip_until.cpp +++ b/Rx/v2/test/operators/skip_until.cpp @@ -12,18 +12,18 @@ SCENARIO("skip_until, some data next", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_next(225, 99), - on.on_completed(230) + on.next(150, 1), + on.next(225, 99), + on.completed(230) }); WHEN("one is taken until the other emits a marble"){ @@ -39,9 +39,9 @@ SCENARIO("skip_until, some data next", "[skip_until][skip][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + on.next(230, 4), + on.next(240, 5), + on.completed(250) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -75,17 +75,17 @@ SCENARIO("skip_until, some data error", "[skip_until][skip][operators]"){ std::runtime_error ex("skip_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_error(225, ex) + on.next(150, 1), + on.error(225, ex) }); WHEN("one is taken until the other emits a marble"){ @@ -101,7 +101,7 @@ SCENARIO("skip_until, some data error", "[skip_until][skip][operators]"){ THEN("the output only contains error message"){ auto required = rxu::to_vector({ - on.on_error(225, ex) + on.error(225, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -135,15 +135,15 @@ SCENARIO("skip_until, error some data", "[skip_until][skip][operators]"){ std::runtime_error ex("skip_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_error(220, ex) + on.next(150, 1), + on.next(210, 2), + on.error(220, ex) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(230, 3), - on.on_completed(250) + on.next(150, 1), + on.next(230, 3), + on.completed(250) }); WHEN("one is taken until the other emits a marble"){ @@ -159,7 +159,7 @@ SCENARIO("skip_until, error some data", "[skip_until][skip][operators]"){ THEN("the output only contains error message"){ auto required = rxu::to_vector({ - on.on_error(220, ex) + on.error(220, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -191,17 +191,17 @@ SCENARIO("skip_until, some data empty", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_completed(225) + on.next(150, 1), + on.completed(225) }); WHEN("one is taken until the other emits a marble"){ @@ -247,13 +247,13 @@ SCENARIO("skip_until, never next", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(225, 2), - on.on_completed(250) + on.next(150, 1), + on.next(225, 2), + on.completed(250) }); WHEN("one is taken until the other emits a marble"){ @@ -301,12 +301,12 @@ SCENARIO("skip_until, never error", "[skip_until][skip][operators]"){ std::runtime_error ex("skip_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(225, ex) + on.next(150, 1), + on.error(225, ex) }); WHEN("one is taken until the other emits a marble"){ @@ -322,7 +322,7 @@ SCENARIO("skip_until, never error", "[skip_until][skip][operators]"){ THEN("the output only contains error message"){ auto required = rxu::to_vector({ - on.on_error(225, ex) + on.error(225, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -356,17 +356,17 @@ SCENARIO("skip_until, some data error after completed", "[skip_until][skip][oper std::runtime_error ex("skip_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_error(300, ex) + on.next(150, 1), + on.error(300, ex) }); WHEN("one is taken until the other emits a marble"){ @@ -382,7 +382,7 @@ SCENARIO("skip_until, some data error after completed", "[skip_until][skip][oper THEN("the output only contains error message"){ auto required = rxu::to_vector({ - on.on_error(300, ex) + on.error(300, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -414,16 +414,16 @@ SCENARIO("skip_until, some data never", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1) + on.next(150, 1) }); WHEN("one is taken until the other emits a marble"){ @@ -469,12 +469,12 @@ SCENARIO("skip_until, never empty", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(225) + on.next(150, 1), + on.completed(225) }); WHEN("one is taken until the other emits a marble"){ @@ -520,11 +520,11 @@ SCENARIO("skip_until, never never", "[skip_until][skip][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("one is taken until the other emits a marble"){ diff --git a/Rx/v2/test/operators/switch_on_next.cpp b/Rx/v2/test/operators/switch_on_next.cpp index 9a06b68..32c4bac 100644 --- a/Rx/v2/test/operators/switch_on_next.cpp +++ b/Rx/v2/test/operators/switch_on_next.cpp @@ -15,36 +15,36 @@ SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){ const rxsc::test::messages> o_on; auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_completed(50) + 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.on_next(10, 301), - on.on_next(20, 302), - on.on_next(30, 303), - on.on_next(40, 304), - on.on_completed(150) + 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.on_next(300, ys1), - o_on.on_next(400, ys2), - o_on.on_next(500, ys3), - o_on.on_completed(600) + o_on.next(300, ys1), + o_on.next(400, ys2), + o_on.next(500, ys3), + o_on.completed(600) }); WHEN("distinct values are taken"){ @@ -57,17 +57,17 @@ SCENARIO("switch_on_next - some changes", "[switch_on_next][operators]"){ THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 201), - on.on_next(420, 202), - on.on_next(430, 203), - on.on_next(440, 204), - on.on_next(510, 301), - on.on_next(520, 302), - on.on_next(530, 303), - on.on_next(540, 304), - on.on_completed(650) + 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); @@ -118,36 +118,36 @@ SCENARIO("switch_on_next - inner throws", "[switch_on_next][operators]"){ std::runtime_error ex("switch_on_next on_error from source"); auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_error(50, ex) + 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.on_next(10, 301), - on.on_next(20, 302), - on.on_next(30, 303), - on.on_next(40, 304), - on.on_completed(150) + 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.on_next(300, ys1), - o_on.on_next(400, ys2), - o_on.on_next(500, ys3), - o_on.on_completed(600) + o_on.next(300, ys1), + o_on.next(400, ys2), + o_on.next(500, ys3), + o_on.completed(600) }); WHEN("distinct values are taken"){ @@ -160,13 +160,13 @@ SCENARIO("switch_on_next - inner throws", "[switch_on_next][operators]"){ THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 201), - on.on_next(420, 202), - on.on_next(430, 203), - on.on_next(440, 204), - on.on_error(450, ex) + 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); @@ -215,27 +215,27 @@ SCENARIO("switch_on_next - outer throws", "[switch_on_next][operators]"){ std::runtime_error ex("switch_on_next on_error from source"); auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(10, 201), - on.on_next(20, 202), - on.on_next(30, 203), - on.on_next(40, 204), - on.on_completed(50) + 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.on_next(300, ys1), - o_on.on_next(400, ys2), - o_on.on_error(500, ex) + o_on.next(300, ys1), + o_on.next(400, ys2), + o_on.error(500, ex) }); WHEN("distinct values are taken"){ @@ -248,13 +248,13 @@ SCENARIO("switch_on_next - outer throws", "[switch_on_next][operators]"){ THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 201), - on.on_next(420, 202), - on.on_next(430, 203), - on.on_next(440, 204), - on.on_error(500, ex) + 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); @@ -295,7 +295,7 @@ SCENARIO("switch_on_next - no inner", "[switch_on_next][operators]"){ const rxsc::test::messages> o_on; auto xs = sc.make_hot_observable({ - o_on.on_completed(500) + o_on.completed(500) }); WHEN("distinct values are taken"){ @@ -308,7 +308,7 @@ SCENARIO("switch_on_next - no inner", "[switch_on_next][operators]"){ THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_completed(500) + on.completed(500) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -333,18 +333,18 @@ SCENARIO("switch_on_next - inner completes", "[switch_on_next][operators]"){ const rxsc::test::messages> o_on; auto ys1 = sc.make_cold_observable({ - on.on_next(10, 101), - on.on_next(20, 102), - on.on_next(110, 103), - on.on_next(120, 104), - on.on_next(210, 105), - on.on_next(220, 106), - on.on_completed(230) + 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.on_next(300, ys1), - o_on.on_completed(540) + o_on.next(300, ys1), + o_on.completed(540) }); WHEN("distinct values are taken"){ @@ -357,13 +357,13 @@ SCENARIO("switch_on_next - inner completes", "[switch_on_next][operators]"){ THEN("the output only contains distinct items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(310, 101), - on.on_next(320, 102), - on.on_next(410, 103), - on.on_next(420, 104), - on.on_next(510, 105), - on.on_next(520, 106), - on.on_completed(540) + 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); diff --git a/Rx/v2/test/operators/take.cpp b/Rx/v2/test/operators/take.cpp index 83354ef..846734b 100644 --- a/Rx/v2/test/operators/take.cpp +++ b/Rx/v2/test/operators/take.cpp @@ -13,12 +13,12 @@ SCENARIO("take 2", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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"){ @@ -34,9 +34,9 @@ SCENARIO("take 2", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_completed(220) + on.next(210, 2), + on.next(220, 3), + on.completed(220) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -61,26 +61,26 @@ SCENARIO("take, complete after", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -96,24 +96,24 @@ SCENARIO("take, complete after", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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); @@ -138,26 +138,26 @@ SCENARIO("take, complete same", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -173,24 +173,24 @@ SCENARIO("take, complete same", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(630) + 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); @@ -215,26 +215,26 @@ SCENARIO("take, complete before", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(690) + 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"){ @@ -250,17 +250,17 @@ SCENARIO("take, complete before", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_completed(415) + 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); @@ -287,26 +287,26 @@ SCENARIO("take, error after", "[take][operators]"){ std::runtime_error ex("take on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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"){ @@ -322,24 +322,24 @@ SCENARIO("take, error after", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, ex) + 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); @@ -364,26 +364,26 @@ SCENARIO("take, error same", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, std::runtime_error("error in unsubscribed stream")) + 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"){ @@ -399,24 +399,24 @@ SCENARIO("take, error same", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_completed(630) + 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); @@ -441,26 +441,26 @@ SCENARIO("take, error before", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10), - on.on_error(690, std::runtime_error("error in unsubscribed stream")) + 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"){ @@ -476,10 +476,10 @@ SCENARIO("take, error before", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_completed(270) + on.next(210, 9), + on.next(230, 13), + on.next(270, 7), + on.completed(270) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -504,25 +504,25 @@ SCENARIO("take, dispose before", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10) + 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"){ @@ -539,8 +539,8 @@ SCENARIO("take, dispose before", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13) + on.next(210, 9), + on.next(230, 13) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -565,25 +565,25 @@ SCENARIO("take, dispose after", "[take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 6), - on.on_next(150, 4), - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_next(280, 1), - on.on_next(300, -1), - on.on_next(310, 3), - on.on_next(340, 8), - on.on_next(370, 11), - on.on_next(410, 15), - on.on_next(415, 16), - on.on_next(460, 72), - on.on_next(510, 76), - on.on_next(560, 32), - on.on_next(570, -100), - on.on_next(580, -3), - on.on_next(590, 5), - on.on_next(630, 10) + 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"){ @@ -600,10 +600,10 @@ SCENARIO("take, dispose after", "[take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 9), - on.on_next(230, 13), - on.on_next(270, 7), - on.on_completed(270) + on.next(210, 9), + on.next(230, 13), + on.next(270, 7), + on.completed(270) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/take_until.cpp b/Rx/v2/test/operators/take_until.cpp index 432b7e3..8afb0f6 100644 --- a/Rx/v2/test/operators/take_until.cpp +++ b/Rx/v2/test/operators/take_until.cpp @@ -12,18 +12,18 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_next(225, 99), - on.on_completed(230) + on.next(150, 1), + on.next(225, 99), + on.completed(230) }); WHEN("one is taken until the other emits a marble"){ @@ -39,9 +39,9 @@ SCENARIO("take_until trigger on_next", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_completed(225) + on.next(210, 2), + on.next(220, 3), + on.completed(225) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -74,18 +74,18 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_next(225, 99), - on.on_completed(230) + on.next(150, 1), + on.next(225, 99), + on.completed(230) }); WHEN("one is taken until the other emits a marble"){ @@ -101,9 +101,9 @@ SCENARIO("take_until, preempt some data next", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_completed(225) + on.next(210, 2), + on.next(220, 3), + on.completed(225) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -138,17 +138,17 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") std::runtime_error ex("take_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_error(225, ex) + on.next(150, 1), + on.error(225, ex) }); WHEN("one is taken until the other emits a marble"){ @@ -164,9 +164,9 @@ SCENARIO("take_until, preempt some data error", "[take_until][take][operators]") THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_error(225, ex) + on.next(210, 2), + on.next(220, 3), + on.error(225, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -199,17 +199,17 @@ SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1), - on.on_completed(225) + on.next(150, 1), + on.completed(225) }); WHEN("one is taken until the other emits a marble"){ @@ -225,11 +225,11 @@ SCENARIO("take_until, no-preempt some data empty", "[take_until][take][operators THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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); @@ -262,16 +262,16 @@ SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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.on_next(150, 1) + on.next(150, 1) }); WHEN("one is taken until the other emits a marble"){ @@ -287,11 +287,11 @@ SCENARIO("take_until, no-preempt some data never", "[take_until][take][operators THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(220, 3), - on.on_next(230, 4), - on.on_next(240, 5), - on.on_completed(250) + 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); @@ -324,13 +324,13 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(225, 2), //! - on.on_completed(250) + on.next(150, 1), + on.next(225, 2), //! + on.completed(250) }); WHEN("one is taken until the other emits a marble"){ @@ -346,7 +346,7 @@ SCENARIO("take_until, preempt never next", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_completed(225) + on.completed(225) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -381,12 +381,12 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ std::runtime_error ex("take_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(225, ex) + on.next(150, 1), + on.error(225, ex) }); WHEN("one is taken until the other emits a marble"){ @@ -402,7 +402,7 @@ SCENARIO("take_until, preempt never error", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_error(225, ex) + on.error(225, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -435,12 +435,12 @@ SCENARIO("take_until, no-preempt never empty", "[take_until][take][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_completed(225) + on.next(150, 1), + on.completed(225) }); WHEN("one is taken until the other emits a marble"){ @@ -487,11 +487,11 @@ SCENARIO("take_until, no-preempt never never", "[take_until][take][operators]"){ const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1) + on.next(150, 1) }); WHEN("one is taken until the other emits a marble"){ @@ -538,15 +538,15 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat const rxsc::test::messages on; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(230, 2), - on.on_completed(240) + on.next(150, 1), + on.next(230, 2), + on.completed(240) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(210, 2), //! - on.on_completed(220) + on.next(150, 1), + on.next(210, 2), //! + on.completed(220) }); WHEN("one is taken until the other emits a marble"){ @@ -562,7 +562,7 @@ SCENARIO("take_until, preempt before first produced", "[take_until][take][operat THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_completed(210) + on.completed(210) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -597,15 +597,15 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un bool sourceNotDisposed = false; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(215, std::runtime_error("error in unsubscribed stream")), // should not come - on.on_completed(240) + 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.on_next(150, 1), - on.on_next(210, 2), //! - on.on_completed(220) + on.next(150, 1), + on.next(210, 2), //! + on.completed(220) }); WHEN("one is taken until the other emits a marble"){ @@ -622,7 +622,7 @@ SCENARIO("take_until, preempt before first produced, remain silent and proper un THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_completed(210) + on.completed(210) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -647,15 +647,15 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" bool signalNotDisposed = false; auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(230, 2), - on.on_completed(240) + on.next(150, 1), + on.next(230, 2), + on.completed(240) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(250, 2), - on.on_completed(260) + on.next(150, 1), + on.next(250, 2), + on.completed(260) }); WHEN("one is taken until the other emits a marble"){ @@ -672,8 +672,8 @@ SCENARIO("take_until, no-preempt after last produced, proper unsubscribe signal" THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_next(230, 2), - on.on_completed(240) + on.next(230, 2), + on.completed(240) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -698,13 +698,13 @@ SCENARIO("take_until, error some", "[take_until][take][operators]"){ std::runtime_error ex("take_until on_error from source"); auto l = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_error(225, ex) + on.next(150, 1), + on.error(225, ex) }); auto r = sc.make_hot_observable({ - on.on_next(150, 1), - on.on_next(240, 2) + on.next(150, 1), + on.next(240, 2) }); WHEN("one is taken until the other emits a marble"){ @@ -720,7 +720,7 @@ SCENARIO("take_until, error some", "[take_until][take][operators]"){ THEN("the output only contains items sent while subscribed"){ auto required = rxu::to_vector({ - on.on_error(225, ex) + on.error(225, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index af54699..73ef113 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -17,16 +17,16 @@ SCENARIO("window count, basic", "[window][operators]"){ const rxsc::test::messages> o_on; auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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"){ @@ -42,18 +42,18 @@ SCENARIO("window count, basic", "[window][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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); @@ -78,16 +78,16 @@ SCENARIO("window count, inner timings", "[window][operators]"){ const rxsc::test::messages> o_on; auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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"){ @@ -126,10 +126,10 @@ SCENARIO("window count, inner timings", "[window][operators]"){ THEN("the 1st output window contains ints"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_completed(280) + on.next(210, 2), + on.next(240, 3), + on.next(280, 4), + on.completed(280) }); auto actual = observers[0].messages(); REQUIRE(required == actual); @@ -137,10 +137,10 @@ SCENARIO("window count, inner timings", "[window][operators]"){ THEN("the 2nd output window contains ints"){ auto required = rxu::to_vector({ - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_completed(350) + on.next(280, 4), + on.next(320, 5), + on.next(350, 6), + on.completed(350) }); auto actual = observers[1].messages(); REQUIRE(required == actual); @@ -148,10 +148,10 @@ SCENARIO("window count, inner timings", "[window][operators]"){ THEN("the 3rd output window contains ints"){ auto required = rxu::to_vector({ - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_completed(420) + on.next(350, 6), + on.next(380, 7), + on.next(420, 8), + on.completed(420) }); auto actual = observers[2].messages(); REQUIRE(required == actual); @@ -159,9 +159,9 @@ SCENARIO("window count, inner timings", "[window][operators]"){ THEN("the 4th output window contains ints"){ auto required = rxu::to_vector({ - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + on.next(420, 8), + on.next(470, 9), + on.completed(600) }); auto actual = observers[3].messages(); REQUIRE(required == actual); @@ -169,7 +169,7 @@ SCENARIO("window count, inner timings", "[window][operators]"){ THEN("the 5th output window only contains complete message"){ auto required = rxu::to_vector({ - on.on_completed(600) + on.completed(600) }); auto actual = observers[4].messages(); REQUIRE(required == actual); @@ -194,16 +194,16 @@ SCENARIO("window count, dispose", "[window][operators]"){ const rxsc::test::messages> o_on; auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_completed(600) + 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"){ @@ -220,13 +220,13 @@ SCENARIO("window count, dispose", "[window][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(350, 6) + 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); @@ -253,16 +253,16 @@ SCENARIO("window count, error", "[window][operators]"){ std::runtime_error ex("window on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(100, 1), - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_error(600, ex) + 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"){ @@ -278,18 +278,18 @@ SCENARIO("window count, error", "[window][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.on_next(210, 2), - on.on_next(240, 3), - on.on_next(280, 4), - on.on_next(280, 4), - on.on_next(320, 5), - on.on_next(350, 6), - on.on_next(350, 6), - on.on_next(380, 7), - on.on_next(420, 8), - on.on_next(420, 8), - on.on_next(470, 9), - on.on_error(600, ex) + 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); diff --git a/Rx/v2/test/sources/create.cpp b/Rx/v2/test/sources/create.cpp index 063ff7e..44dcc30 100644 --- a/Rx/v2/test/sources/create.cpp +++ b/Rx/v2/test/sources/create.cpp @@ -31,8 +31,8 @@ SCENARIO("create stops on completion", "[create][sources]"){ THEN("the output contains all items"){ auto required = rxu::to_vector({ - on.on_next(200, 1), - on.on_next(200, 2) + on.next(200, 1), + on.next(200, 2) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/sources/defer.cpp b/Rx/v2/test/sources/defer.cpp index e9e62c2..79f8c91 100644 --- a/Rx/v2/test/sources/defer.cpp +++ b/Rx/v2/test/sources/defer.cpp @@ -30,8 +30,8 @@ SCENARIO("defer stops on completion", "[defer][sources]"){ [&](){ invoked++; xs.reset(sc.make_cold_observable({ - on.on_next(100, sc.clock()), - on.on_completed(200) + on.next(100, sc.clock()), + on.completed(200) })); return xs.get(); }) @@ -42,8 +42,8 @@ SCENARIO("defer stops on completion", "[defer][sources]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(300, 200L), - on.on_completed(400) + on.next(300, 200L), + on.completed(400) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp index b8d36cb..cca805d 100644 --- a/Rx/v2/test/sources/scope.cpp +++ b/Rx/v2/test/sources/scope.cpp @@ -30,10 +30,10 @@ SCENARIO("scope, cold observable", "[scope][sources]"){ int time = 10; auto values = r.get(); std::for_each(values.begin(), values.end(), [&](int &v){ - msg.push_back(on.on_next(time, v)); + msg.push_back(on.next(time, v)); time += 10; }); - msg.push_back(on.on_completed(time)); + msg.push_back(on.completed(time)); xs.reset(sc.make_cold_observable(msg)); return xs.get(); } @@ -45,12 +45,12 @@ SCENARIO("scope, cold observable", "[scope][sources]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(210, 1), - on.on_next(220, 2), - on.on_next(230, 3), - on.on_next(240, 4), - on.on_next(250, 5), - on.on_completed(260) + 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); @@ -91,10 +91,10 @@ SCENARIO("scope, hot observable", "[scope][sources]"){ int time = 210; auto values = r.get(); std::for_each(values.begin(), values.end(), [&](int &v){ - msg.push_back(on.on_next(time, v)); + msg.push_back(on.next(time, v)); time += 10; }); - msg.push_back(on.on_completed(time)); + msg.push_back(on.completed(time)); xs.reset(sc.make_hot_observable(msg)); return xs.get(); } @@ -106,12 +106,12 @@ SCENARIO("scope, hot observable", "[scope][sources]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(210, 1), - on.on_next(220, 2), - on.on_next(230, 3), - on.on_next(240, 4), - on.on_next(250, 5), - on.on_completed(260) + 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); @@ -154,8 +154,8 @@ SCENARIO("scope, complete", "[scope][sources]"){ [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ - on.on_next(100, r.get()), - on.on_completed(200) + on.next(100, r.get()), + on.completed(200) }))); return xs.get(); } @@ -175,8 +175,8 @@ SCENARIO("scope, complete", "[scope][sources]"){ THEN("the output stops on completion"){ auto required = rxu::to_vector({ - on.on_next(300, 200), - on.on_completed(400) + on.next(300, 200), + on.completed(400) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -221,8 +221,8 @@ SCENARIO("scope, error", "[scope][sources]"){ [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ - on.on_next(100, r.get()), - on.on_error(200, ex) + on.next(100, r.get()), + on.error(200, ex) }))); return xs.get(); } @@ -242,8 +242,8 @@ SCENARIO("scope, error", "[scope][sources]"){ THEN("the output stops on error"){ auto required = rxu::to_vector({ - on.on_next(300, 200), - on.on_error(400, ex) + on.next(300, 200), + on.error(400, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -286,8 +286,8 @@ SCENARIO("scope, dispose", "[scope][sources]"){ [&](resource r){ ++observable_factory_invoked; xs.reset(sc.make_cold_observable(rxu::to_vector({ - on.on_next(100, r.get()), - on.on_next(1000, r.get() + 1) + on.next(100, r.get()), + on.next(1000, r.get() + 1) }))); return xs.get(); } @@ -307,7 +307,7 @@ SCENARIO("scope, dispose", "[scope][sources]"){ THEN("the output contains resulting ints"){ auto required = rxu::to_vector({ - on.on_next(300, 200) + on.next(300, 200) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -368,7 +368,7 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ THEN("the output stops on error"){ auto required = rxu::to_vector({ - on.on_error(200, ex) + on.error(200, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -421,7 +421,7 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ THEN("the output stops on error"){ auto required = rxu::to_vector({ - on.on_error(200, ex) + on.error(200, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index ea2230a..dd097d8 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -441,18 +441,18 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 1), - on.on_next(110, 2), - on.on_next(220, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7), - on.on_next(630, 8), - on.on_next(710, 9), - on.on_next(870, 10), - on.on_next(940, 11), - on.on_next(1020, 12) + 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 s; @@ -494,9 +494,9 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ THEN("result1 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7) + on.next(340, 5), + on.next(410, 6), + on.next(520, 7) }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); @@ -504,9 +504,9 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ THEN("result2 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(410, 6), - on.on_next(520, 7), - on.on_next(630, 8) + on.next(410, 6), + on.next(520, 7), + on.next(630, 8) }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); @@ -514,7 +514,7 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ THEN("result3 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(940, 11) + on.next(940, 11) }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); @@ -532,17 +532,17 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ const rxsc::test::messages on; auto xs = sc.make_hot_observable({ - on.on_next(70, 1), - on.on_next(110, 2), - on.on_next(220, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7), - on.on_completed(630), - on.on_next(640, 9), - on.on_completed(650), - on.on_error(660, std::runtime_error("error on unsubscribed stream")) + 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 s; @@ -584,9 +584,9 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ THEN("result1 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7) + on.next(340, 5), + on.next(410, 6), + on.next(520, 7) }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); @@ -594,9 +594,9 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ THEN("result2 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(410, 6), - on.on_next(520, 7), - on.on_completed(630) + on.next(410, 6), + on.next(520, 7), + on.completed(630) }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); @@ -604,7 +604,7 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ THEN("result3 contains expected messages"){ auto required = rxu::to_vector({ - on.on_completed(900) + on.completed(900) }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); @@ -625,17 +625,17 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ std::runtime_error ex("subject on_error in stream"); auto xs = sc.make_hot_observable({ - on.on_next(70, 1), - on.on_next(110, 2), - on.on_next(220, 3), - on.on_next(270, 4), - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7), - on.on_error(630, ex), - on.on_next(640, 9), - on.on_completed(650), - on.on_error(660, std::runtime_error("error on unsubscribed stream")) + 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 s; @@ -677,9 +677,9 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ THEN("result1 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(340, 5), - on.on_next(410, 6), - on.on_next(520, 7) + on.next(340, 5), + on.next(410, 6), + on.next(520, 7) }); auto actual = results1.get_observer().messages(); REQUIRE(required == actual); @@ -687,9 +687,9 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ THEN("result2 contains expected messages"){ auto required = rxu::to_vector({ - on.on_next(410, 6), - on.on_next(520, 7), - on.on_error(630, ex) + on.next(410, 6), + on.next(520, 7), + on.error(630, ex) }); auto actual = results2.get_observer().messages(); REQUIRE(required == actual); @@ -697,7 +697,7 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ THEN("result3 contains expected messages"){ auto required = rxu::to_vector({ - on.on_error(900, ex) + on.error(900, ex) }); auto actual = results3.get_observer().messages(); REQUIRE(required == actual); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 0e71bc4..ae8dd39 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -69,7 +69,7 @@ TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) # define the sources of the self test set(ONE_SOURCES ${TEST_DIR}/test.cpp - ${TEST_DIR}/operators/subscribe_on.cpp +# ${TEST_DIR}/operators/subscribe_on.cpp ) add_executable(one_test ${ONE_SOURCES}) TARGET_LINK_LIBRARIES(one_test ${CMAKE_THREAD_LIBS_INIT}) @@ -83,13 +83,21 @@ set(PYTHAGORIAN_SOURCES add_executable(pythagorian ${PYTHAGORIAN_SOURCES}) TARGET_LINK_LIBRARIES(pythagorian ${CMAKE_THREAD_LIBS_INIT}) -# define the sources of the pythagorian example +# define the sources of the println example set(PRINTLN_SOURCES ${EXAMPLES_DIR}/println/main.cpp ) add_executable(println ${PRINTLN_SOURCES}) TARGET_LINK_LIBRARIES(println ${CMAKE_THREAD_LIBS_INIT}) +# define the sources of the tests example +set(TESTS_EXAMPLE_SOURCES + ${EXAMPLES_DIR}/tests/main.cpp + ${EXAMPLES_DIR}/tests/take.cpp +) +add_executable(tests_example ${TESTS_EXAMPLE_SOURCES}) +TARGET_LINK_LIBRARIES(tests_example ${CMAKE_THREAD_LIBS_INIT}) + # configure unit tests via CTest enable_testing() -- GitLab From 30a87eb8980b16b8212832866a1ec3d447cefc4c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 28 Aug 2014 00:17:19 -0700 Subject: [PATCH 423/782] update new retry tests --- Rx/v2/test/operators/retry.cpp | 114 ++++++++++++++++----------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/Rx/v2/test/operators/retry.cpp b/Rx/v2/test/operators/retry.cpp index 9bec879..f2d4df4 100644 --- a/Rx/v2/test/operators/retry.cpp +++ b/Rx/v2/test/operators/retry.cpp @@ -13,23 +13,23 @@ SCENARIO("retry, basic test", "[retry][operators]") { std::runtime_error ex("retry on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(300, 1), - on.on_next(325, 2), - on.on_next(350, 3), - on.on_error(400, ex), - on.on_next(425, 1), - on.on_next(450, 2), - on.on_next(475, 3), - on.on_next(500, 4), - on.on_error(525, ex), - on.on_next(550, 1), - on.on_next(575, 2), - on.on_next(600, 3), - on.on_next(625, 4), - on.on_next(650, 5), - on.on_next(675, 6), - on.on_next(700, 7), - on.on_completed(725) + 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") { @@ -45,21 +45,21 @@ SCENARIO("retry, basic test", "[retry][operators]") { THEN("the output contains all the data until complete") { auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(325, 2), - on.on_next(350, 3), - on.on_next(425, 1), - on.on_next(450, 2), - on.on_next(475, 3), - on.on_next(500, 4), - on.on_next(550, 1), - on.on_next(575, 2), - on.on_next(600, 3), - on.on_next(625, 4), - on.on_next(650, 5), - on.on_next(675, 6), - on.on_next(700, 7), - on.on_completed(725) + 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); @@ -87,23 +87,23 @@ SCENARIO("retry with failure", "[retry][operators]") { std::runtime_error ex("retry on_error from source"); auto xs = sc.make_hot_observable({ - on.on_next(300, 1), - on.on_next(325, 2), - on.on_next(350, 3), - on.on_error(400, ex), - on.on_next(425, 1), - on.on_next(450, 2), - on.on_next(475, 3), - on.on_next(500, 4), - on.on_error(525, ex), - on.on_next(550, 1), - on.on_next(575, 2), - on.on_next(600, 3), - on.on_next(625, 4), - on.on_next(650, 5), - on.on_next(675, 6), - on.on_next(700, 7), - on.on_completed(725) + 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 1 is launched with expected error before complete") { @@ -118,14 +118,14 @@ SCENARIO("retry with failure", "[retry][operators]") { THEN("The output contains all the data until retry fails") { auto required = rxu::to_vector({ - on.on_next(300, 1), - on.on_next(325, 2), - on.on_next(350, 3), - on.on_next(425, 1), - on.on_next(450, 2), - on.on_next(475, 3), - on.on_next(500, 4), - on.on_error(525, ex), + 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); -- GitLab From ff573fcd26752d14b5e00b7a4e42f147ae7bc92e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 1 Sep 2014 22:38:02 -0700 Subject: [PATCH 424/782] allow conversions to dynamic --- Rx/v2/src/rxcpp/operators/rx-group_by.hpp | 4 +- Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 43 ++++-------------- Rx/v2/src/rxcpp/rx-grouped_observable.hpp | 44 ++++--------------- Rx/v2/src/rxcpp/rx-subscriber.hpp | 15 +++++++ 4 files changed, 33 insertions(+), 73 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp index dcba7ed..5ef609b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -59,6 +59,7 @@ struct group_by typedef group_by_traits 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::subject_type subject_type; typedef typename traits_type::key_type key_type; @@ -83,7 +84,7 @@ struct group_by { } - struct group_by_observable + struct group_by_observable : public rxs::source_base { subject_type subject; key_type key; @@ -109,7 +110,6 @@ struct group_by { typedef group_by_observer this_type; typedef typename traits_type::grouped_observable_type value_type; - typedef typename traits_type::marble_type marble_type; typedef typename std::decay::type dest_type; typedef observer observer_type; dest_type dest; diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 0352605..731d844 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -28,15 +28,13 @@ struct has_on_connect template class dynamic_connectable_observable - : public rxs::source_base + : public dynamic_observable { struct state_type : public std::enable_shared_from_this { - typedef std::function)> onsubscribe_type; typedef std::function onconnect_type; - onsubscribe_type on_subscribe; onconnect_type on_connect; }; std::shared_ptr state; @@ -54,9 +52,6 @@ class dynamic_connectable_observable template void construct(SO&& source, rxs::tag_source&&) { auto so = std::make_shared::type>(std::forward(source)); - state->on_subscribe = [so](subscriber o) mutable { - so->on_subscribe(std::move(o)); - }; state->on_connect = [so](composite_subscription cs) mutable { so->on_connect(std::move(cs)); }; @@ -71,45 +66,23 @@ public: } template - explicit dynamic_connectable_observable(SOF&& sof) - : state(std::make_shared()) + explicit dynamic_connectable_observable(SOF sof) + : dynamic_observable(sof) + , state(std::make_shared()) { - construct(std::forward(sof), + construct(std::move(sof), typename std::conditional::value, tag_dynamic_observable, rxs::tag_source>::type()); } template dynamic_connectable_observable(SF&& sf, CF&& cf) - : state(std::make_shared()) + : dynamic_observable(std::forward(sf)) + , state(std::make_shared()) { - state->on_subscribe = std::forward(sf); state->on_connect = std::forward(cf); } - void on_subscribe(subscriber o) const { - state->on_subscribe(std::move(o)); - } - - template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Subscriber&& o) const { - auto so = std::make_shared::type>(std::forward(o)); - state->on_subscribe(make_subscriber( - *so, - make_observer_dynamic( - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - }))); - } + using dynamic_observable::on_subscribe; void on_connect(composite_subscription cs) const { state->on_connect(std::move(cs)); diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp index 3b248af..84deef9 100644 --- a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp @@ -28,7 +28,7 @@ struct has_on_get_key_for template class dynamic_grouped_observable - : public rxs::source_base + : public dynamic_observable { public: typedef typename std::decay::type key_type; @@ -38,10 +38,8 @@ private: struct state_type : public std::enable_shared_from_this { - typedef std::function)> onsubscribe_type; typedef std::function ongetkey_type; - onsubscribe_type on_subscribe; ongetkey_type on_get_key; }; std::shared_ptr state; @@ -62,9 +60,6 @@ private: template void construct(SO&& source, const rxs::tag_source&) { auto so = std::make_shared::type>(std::forward(source)); - state->on_subscribe = [so](subscriber o) mutable { - so->on_subscribe(std::move(o)); - }; state->on_get_key = [so]() mutable { return so->on_get_key(); }; @@ -77,46 +72,23 @@ public: } template - explicit dynamic_grouped_observable(SOF&& sof) - : state(std::make_shared()) + explicit dynamic_grouped_observable(SOF sof) + : dynamic_observable(sof) + , state(std::make_shared()) { - construct(std::forward(sof), + construct(std::move(sof), typename std::conditional::value, tag_dynamic_grouped_observable, rxs::tag_source>::type()); } template dynamic_grouped_observable(SF&& sf, CF&& cf) - : state(std::make_shared()) + : dynamic_observable(std::forward(sf)) + , state(std::make_shared()) { - state->on_subscribe = std::forward(sf); state->on_connect = std::forward(cf); } - void on_subscribe(subscriber o) const { - state->on_subscribe(std::move(o)); - } - - template - typename std::enable_if::type, observer>::value, void>::type - on_subscribe(Subscriber&& o) const { - auto so = std::make_shared::type>(std::forward(o)); - state->on_subscribe( - make_subscriber( - *so, - // on_next - [so](T t){ - so->on_next(t); - }, - // on_error - [so](std::exception_ptr e){ - so->on_error(e); - }, - // on_completed - [so](){ - so->on_completed(); - }). - as_dynamic()); - } + using dynamic_observable::on_subscribe; key_type on_get_key() const { return state->on_get_key(); diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index dbb3615..39e6bdc 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -104,6 +104,21 @@ public: { } + template + friend class subscriber; + + template + subscriber( + const subscriber& o, + typename std::enable_if< + !std::is_same>::value && + std::is_same>::value, void**>::type select = nullptr) + : lifetime(o.lifetime) + , destination(o.destination.as_dynamic()) + , id(o.id) + { + } + template subscriber(trace_id id, composite_subscription cs, U&& o) : lifetime(std::move(cs)) -- GitLab From 2d5d75266d4ecc78e2112fbad96b93c7ad64ec0b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 2 Sep 2014 08:57:27 -0700 Subject: [PATCH 425/782] add more badges using @sheilds_io --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ffa1b1e..9790fff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -[![Build Status](https://travis-ci.org/Reactive-Extensions/RxCpp.png)](https://travis-ci.org/Reactive-Extensions/RxCpp) +[![Build Status](http://img.shields.io/travis/Reactive-Extensions/RxCpp.svg?style=flat-square)](https://travis-ci.org/Reactive-Extensions/RxCpp) +[![NuGet version](http://img.shields.io/nuget/v/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) +[![NuGet downloads](http://img.shields.io/nuget/dt/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) # Reactive Extensions: -- GitLab From 539438ba64e7612aef42c96f50d37fe1b2be8a7b Mon Sep 17 00:00:00 2001 From: "Kirk Shoop (MS OPEN TECH)" Date: Wed, 3 Sep 2014 12:45:58 -0700 Subject: [PATCH 426/782] add appveyor CI for windows --- README.md | 5 ++++- appveyor.yml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 appveyor.yml diff --git a/README.md b/README.md index 9790fff..ed8a4f3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -[![Build Status](http://img.shields.io/travis/Reactive-Extensions/RxCpp.svg?style=flat-square)](https://travis-ci.org/Reactive-Extensions/RxCpp) +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/Reactive-Extensions/RxCpp.svg?style=flat-square)](https://travis-ci.org/Reactive-Extensions/RxCpp) + [![NuGet version](http://img.shields.io/nuget/v/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) [![NuGet downloads](http://img.shields.io/nuget/dt/RxCpp.svg?style=flat-square)](http://www.nuget.org/packages/RxCpp/) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..98a2cc6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,19 @@ +version: 2.1.{build} + +branches: +# whitelist + only: + - master + - appveyor + +install: + - git submodule -q update --init + +before_build: + - mkdir projects\build + - cd projects\build + - cmake -G"Visual Studio 12" -T"v120" -B. ..\CMake\ + - cd ..\.. + +build: + project: projects\build\rxcpp.sln -- GitLab From f13776b4c79972f14694ef67a1df6967845131af Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 2 Sep 2014 07:32:07 -0700 Subject: [PATCH 427/782] turn lack of equality support into runtime error --- Rx/v2/src/rxcpp/rx-notification.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index b572c27..fb23c36 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -93,6 +93,17 @@ inline std::ostream& operator<< (std::ostream& os, const std::vector& v) { return os; } +template +auto equals(const T& lhs, const T& rhs, int) + -> decltype(lhs == rhs, true) { + return lhs == rhs; +} + +template +bool equals(const T& lhs, const T& rhs, ...) { + throw std::runtime_error("value does not support equality tests"); + return false; +} } @@ -116,7 +127,7 @@ private: virtual bool equals(const typename base::type& other) const { bool result = false; other->accept(make_subscriber(make_observer_dynamic([this, &result](T v) { - result = this->value == v; + result = detail::equals(this->value, v, 0); }))); return result; } -- GitLab From 9deb8a8b25454a37ea9a1c0059d2d5e6749ea524 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 16 Sep 2014 19:15:49 +0400 Subject: [PATCH 428/782] Add buffer_with_time operator including tests. --- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 160 ++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 42 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/buffer.cpp | 504 +++++++++++++++++++ 4 files changed, 707 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp new file mode 100644 index 0000000..f6766d7 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -0,0 +1,160 @@ +// 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_BUFFER_WITH_TIME_HPP) +#define RXCPP_OPERATORS_RX_BUFFER_WITH_TIME_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct buffer_with_time +{ + typedef typename std::decay::type source_value_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + typedef typename std::decay::type 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 + struct buffer_with_time_observer + { + typedef buffer_with_time_observer this_type; + typedef std::vector value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + + struct buffer_with_time_subscriber_values : public buffer_with_time_values + { + buffer_with_time_subscriber_values(dest_type d, buffer_with_time_values v, coordinator_type c) + : buffer_with_time_values(v) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + { + } + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable std::deque chunks; + }; + std::shared_ptr state; + + buffer_with_time_observer(dest_type d, buffer_with_time_values v, coordinator_type c) + : state(std::make_shared(buffer_with_time_subscriber_values(std::move(d), v, std::move(c)))) + { + auto localState = state; + auto produce_buffer = [localState](const rxsc::schedulable& self) { + localState->dest.on_next(std::move(localState->chunks.front())); + localState->chunks.pop_front(); + }; + auto create_buffer = [localState, produce_buffer](const rxsc::schedulable& self) { + localState->chunks.emplace_back(); + localState->worker.schedule(localState->worker.now() + localState->period, produce_buffer); + self.schedule(localState->worker.now() + localState->skip); + }; + + state->chunks.emplace_back(); + state->worker.schedule(state->worker.now() + state->period, produce_buffer); + state->worker.schedule(state->worker.now() + state->skip, create_buffer); + } + void on_next(T v) const { + for(auto& chunk : state->chunks) { + chunk.push_back(v); + } + } + void on_error(std::exception_ptr e) const { + state->dest.on_error(e); + } + void on_completed() const { + auto done = on_exception( + [&](){ + while (!state->chunks.empty()) { + state->dest.on_next(std::move(state->chunks.front())); + state->chunks.pop_front(); + } + return true; + }, + state->dest); + if (done.empty()) { + return; + } + state->dest.on_completed(); + } + + static subscriber> make(dest_type d, buffer_with_time_values v) { + auto cs = d.get_subscription(); + auto coordinator = v.coordination.create_coordinator(cs); + + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v), std::move(coordinator))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(buffer_with_time_observer::make(std::move(dest), initial)) { + return buffer_with_time_observer::make(std::move(dest), initial); + } +}; + +template +class buffer_with_time_factory +{ + typedef typename std::decay::type duration_type; + typedef typename std::decay::type coordination_type; + + duration_type period; + duration_type skip; + coordination_type coordination; +public: + buffer_with_time_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} + template + auto operator()(Observable&& source) + -> decltype(source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { + return source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); + } +}; + +} + +template +inline auto buffer_with_time(Duration period, Coordination coordination) + -> detail::buffer_with_time_factory { + return detail::buffer_with_time_factory(period, period, coordination); +} + +template +inline auto buffer_with_time(Duration period, Duration skip, Coordination coordination) + -> detail::buffer_with_time_factory { + return detail::buffer_with_time_factory(period, skip, coordination); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 6014b4d..f6dee56 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -514,6 +514,48 @@ public: return lift>(rxo::detail::buffer_count(count, skip)); } + /// buffer_with_time -> + /// start a new vector every skip time interval and collect items into it from this observable for period of time. + /// + template + auto buffer_with_time(Duration period, Duration skip, Coordination coordination) const + -> typename std::enable_if< + is_coordination::value, + decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, skip, coordination)))>::type { + return lift>(rxo::detail::buffer_with_time(period, skip, coordination)); + } + + /// buffer_with_time -> + /// start a new vector every skip time interval and collect items into it from this observable for period of time. + /// + template + auto buffer_with_time(Duration period, Duration skip) const + -> typename std::enable_if< + !is_coordination::value, + decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, skip, identity_current_thread())))>::type { + return lift>(rxo::detail::buffer_with_time(period, skip, identity_current_thread())); + } + + /// buffer_with_time -> + /// start a new vector every period time interval and collect items into it from this observable for period of time. + /// + template + auto buffer_with_time(Duration period, Coordination coordination) const + -> typename std::enable_if< + is_coordination::value, + decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, period, coordination)))>::type { + return lift>(rxo::detail::buffer_with_time(period, period, coordination)); + } + + /// buffer_with_time -> + /// start a new vector every period time interval and collect items into it from this observable for period of time. + /// + template + auto buffer_with_time(Duration period) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, period, identity_current_thread()))) { + return lift>(rxo::detail::buffer_with_time(period, period, identity_current_thread())); + } + template struct defer_switch_on_next : public defer_observable< is_observable, diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 3b8d21a..762f366 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -35,6 +35,7 @@ namespace rxo=operators; } #include "operators/rx-buffer_count.hpp" +#include "operators/rx-buffer_time.hpp" #include "operators/rx-combine_latest.hpp" #include "operators/rx-concat.hpp" #include "operators/rx-concat_map.hpp" diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index 4a60877..072a2db 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -1,4 +1,5 @@ #include "rxcpp/rx.hpp" +namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxs=rxcpp::sources; namespace rxsc=rxcpp::schedulers; @@ -455,3 +456,506 @@ SCENARIO("buffer count error 2", "[buffer][operators]"){ } } } + +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; + typedef steady_clock clock; + + #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), so) + .subscribe( + [](std::vector counter){ + printf("on_next: "); + std::for_each(counter.begin(), counter.end(), [](long c){ + printf("%d ", c); + }); + printf("\n"); + }, + [](std::exception_ptr e){ + 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; + typedef steady_clock clock; + + #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 counter){ + printf("on_next: "); + std::for_each(counter.begin(), counter.end(), [](long c){ + printf("%d ", c); + }); + printf("\n"); + }, + [](std::exception_ptr e){ + 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; + typedef steady_clock clock; + + #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 counter){ + printf("on_next: "); + std::for_each(counter.begin(), counter.end(), [](long c){ + printf("%d ", c); + }); + printf("\n"); + }, + [](std::exception_ptr e){ + 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; + typedef steady_clock clock; + + #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 counter){ + printf("on_next: "); + std::for_each(counter.begin(), counter.end(), [](long c){ + printf("%d ", c); + }); + printf("\n"); + }, + [](std::exception_ptr e){ + 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; + typedef steady_clock clock; + + #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(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 counter){ + printf("on_next: "); + std::for_each(counter.begin(), counter.end(), [](long c){ + printf("%d ", c); + }); + printf("\n"); + }, + [](std::exception_ptr e){ + 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 on; + const rxsc::test::messages> 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(300, rxu::to_vector({ 2, 3, 4 })), + v_on.next(370, rxu::to_vector({ 4, 5, 6 })), + v_on.next(440, rxu::to_vector({ 6, 7, 8 })), + v_on.next(510, rxu::to_vector({ 8, 9 })), + v_on.next(580, std::vector()), + v_on.next(600, std::vector()), + 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 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 on; + const rxsc::test::messages> 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(270, rxu::to_vector({ 2, 3 })), + v_on.next(370, rxu::to_vector({ 5, 6 })), + v_on.next(470, rxu::to_vector({ 8, 9 })), + v_on.next(570, std::vector()), + 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 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 on; + const rxsc::test::messages> 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(300, rxu::to_vector({ 2, 3, 4 })), + v_on.next(370, rxu::to_vector({ 4, 5, 6 })), + v_on.next(440, rxu::to_vector({ 6, 7, 8 })), + v_on.next(510, rxu::to_vector({ 8, 9 })), + v_on.next(580, std::vector()), + 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, 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 on; + const rxsc::test::messages> 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(300, 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, 370) + }); + 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 on; + const rxsc::test::messages> 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(300, rxu::to_vector({ 2, 3, 4 })), + v_on.next(400, rxu::to_vector({ 5, 6, 7 })), + v_on.next(500, rxu::to_vector({ 8, 9 })), + v_on.next(600, std::vector()), + 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); + } + } + } +} -- GitLab From 808e95013052e90f6281d0a57ba77d484ee4cfa9 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 16 Sep 2014 19:21:15 +0400 Subject: [PATCH 429/782] Add window_with_time operator including tests. --- Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 160 +++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 36 ++ Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/window.cpp | 443 +++++++++++++++++++ 4 files changed, 640 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-window_time.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp new file mode 100644 index 0000000..7981d8d --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -0,0 +1,160 @@ +// 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_WINDOW_WITH_TIME_HPP) +#define RXCPP_OPERATORS_RX_WINDOW_WITH_TIME_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct window_with_time +{ + typedef typename std::decay::type source_value_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + typedef typename std::decay::type 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 + struct window_with_time_observer : public observer_base> + { + typedef window_with_time_observer this_type; + typedef observer_base> base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + + struct window_with_time_subscriber_values : public window_with_time_values + { + window_with_time_subscriber_values(dest_type d, window_with_time_values v, coordinator_type c) + : window_with_time_values(v) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + { + } + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable std::deque> subj; + }; + std::shared_ptr state; + + window_with_time_observer(dest_type d, window_with_time_values v, coordinator_type c) + : state(std::make_shared(window_with_time_subscriber_values(std::move(d), v, std::move(c)))) + { + auto localState = state; + auto release_window = [localState](const rxsc::schedulable& self) { + localState->subj[0].get_subscriber().on_completed(); + localState->subj.pop_front(); + }; + auto create_window = [localState, release_window](const rxsc::schedulable& self) { + localState->subj.push_back(rxcpp::subjects::subject()); + localState->dest.on_next(localState->subj[localState->subj.size() - 1].get_observable().as_dynamic()); + localState->worker.schedule(localState->worker.now() + localState->period, release_window); + self.schedule(localState->worker.now() + localState->skip); + }; + + state->subj.push_back(rxcpp::subjects::subject()); + state->dest.on_next(state->subj[0].get_observable().as_dynamic()); + state->worker.schedule(state->worker.now() + state->period, release_window); + state->worker.schedule(state->worker.now() + state->skip, create_window); + } + + void on_next(T v) const { + for (auto s : state->subj) { + s.get_subscriber().on_next(v); + } + } + + void on_error(std::exception_ptr e) const { + for (auto s : state->subj) { + s.get_subscriber().on_error(e); + } + state->dest.on_error(e); + } + + void on_completed() const { + for (auto s : state->subj) { + s.get_subscriber().on_completed(); + } + state->dest.on_completed(); + } + + static subscriber make(dest_type d, window_with_time_values v) { + auto cs = d.get_subscription(); + auto coordinator = v.coordination.create_coordinator(cs); + + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v), std::move(coordinator)))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(window_with_time_observer::make(std::move(dest), initial)) { + return window_with_time_observer::make(std::move(dest), initial); + } +}; + +template +class window_with_time_factory +{ + typedef typename std::decay::type duration_type; + typedef typename std::decay::type coordination_type; + + duration_type period; + duration_type skip; + coordination_type coordination; +public: + window_with_time_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} + template + auto operator()(Observable&& source) + -> decltype(source.template lift::type::value_type>>(window_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { + return source.template lift::type::value_type>>(window_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); + } +}; + +} + +template +inline auto window_with_time(Duration period, Coordination coordination) + -> detail::window_with_time_factory { + return detail::window_with_time_factory(period, period, coordination); +} + +template +inline auto window_with_time(Duration period, Duration skip, Coordination coordination) + -> detail::window_with_time_factory { + return detail::window_with_time_factory(period, skip, coordination); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index f6dee56..a603b57 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -498,6 +498,42 @@ public: return lift>(rxo::detail::window(count, skip)); } + /// window_with_time -> + /// produce observables every skip time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time(Duration period, Duration skip, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time(period, skip, coordination))) { + return lift>(rxo::detail::window_with_time(period, skip, coordination)); + } + + /// window_with_time -> + /// produce observables every skip time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time(Duration period, Duration skip) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time(period, skip, identity_current_thread()))) { + return lift>(rxo::detail::window_with_time(period, skip, identity_current_thread())); + } + + /// window_with_time -> + /// produce observables every period time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time(Duration period, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time(period, period, coordination))) { + return lift>(rxo::detail::window_with_time(period, period, coordination)); + } + + /// window_with_time -> + /// produce observables every period time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time(Duration period) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time(period, period, identity_current_thread()))) { + return lift>(rxo::detail::window_with_time(period, period, identity_current_thread())); + } + /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 762f366..b74d7a6 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -64,5 +64,6 @@ namespace rxo=operators; #include "operators/rx-take.hpp" #include "operators/rx-take_until.hpp" #include "operators/rx-window.hpp" +#include "operators/rx-window_time.hpp" #include "operators/rx-retry.hpp" #endif diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index 73ef113..12d32b1 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -305,3 +305,446 @@ SCENARIO("window count, error", "[window][operators]"){ } } } + +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 on; + const rxsc::test::messages> 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 + .window_with_time(milliseconds(100), milliseconds(50), 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(210, 2), + on.next(240, 3), + on.next(270, 4), + on.next(270, 4), + on.next(320, 5), + on.next(320, 5), + on.next(360, 6), + on.next(360, 6), + on.next(390, 7), + on.next(390, 7), + on.next(410, 8), + on.next(410, 8), + on.next(460, 9), + on.next(460, 9), + on.next(470, 10), + on.next(470, 10), + on.completed(490) + }); + 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 on; + const rxsc::test::messages> 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(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) + }); + 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 on; + const rxsc::test::messages> 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(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 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 on; + const rxsc::test::messages> 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(210, 2), + on.next(240, 3), + on.next(320, 5), + on.next(350, 6), + 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 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 on; + const rxsc::test::messages> 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(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, 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 on; + const rxsc::test::messages> 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(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 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 on; + const rxsc::test::messages> 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(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) + }); + 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); + } + } + } +} -- GitLab From 9f8ea67d455dda0093891c47e8f46dd72949a20c Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:29:57 -0700 Subject: [PATCH 430/782] silence warning on clang --- Rx/v2/src/rxcpp/rx-notification.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index fb23c36..064851a 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -95,7 +95,7 @@ inline std::ostream& operator<< (std::ostream& os, const std::vector& v) { template auto equals(const T& lhs, const T& rhs, int) - -> decltype(lhs == rhs, true) { + -> decltype(bool(lhs == rhs)) { return lhs == rhs; } -- GitLab From ece01804a783ed407f0b54702779bbe2e0a4072a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:30:39 -0700 Subject: [PATCH 431/782] fix clang errors in printf specs --- Rx/v2/test/operators/buffer.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index 072a2db..eb71572 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -473,7 +473,7 @@ SCENARIO("buffer with time on intervals", "[buffer_with_time][operators][long][h #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); @@ -486,7 +486,7 @@ SCENARIO("buffer with time on intervals", "[buffer_with_time][operators][long][h [](std::vector counter){ printf("on_next: "); std::for_each(counter.begin(), counter.end(), [](long c){ - printf("%d ", c); + printf("%ld ", c); }); printf("\n"); }, @@ -517,7 +517,7 @@ SCENARIO("buffer with time on intervals, implicit coordination", "[buffer_with_t #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); @@ -530,7 +530,7 @@ SCENARIO("buffer with time on intervals, implicit coordination", "[buffer_with_t [](std::vector counter){ printf("on_next: "); std::for_each(counter.begin(), counter.end(), [](long c){ - printf("%d ", c); + printf("%ld ", c); }); printf("\n"); }, @@ -562,7 +562,7 @@ SCENARIO("buffer with time on overlapping intervals", "[buffer_with_time][operat #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); @@ -575,7 +575,7 @@ SCENARIO("buffer with time on overlapping intervals", "[buffer_with_time][operat [](std::vector counter){ printf("on_next: "); std::for_each(counter.begin(), counter.end(), [](long c){ - printf("%d ", c); + printf("%ld ", c); }); printf("\n"); }, @@ -607,7 +607,7 @@ SCENARIO("buffer with time on overlapping intervals, implicit coordination", "[b #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); @@ -620,7 +620,7 @@ SCENARIO("buffer with time on overlapping intervals, implicit coordination", "[b [](std::vector counter){ printf("on_next: "); std::for_each(counter.begin(), counter.end(), [](long c){ - printf("%d ", c); + printf("%ld ", c); }); printf("\n"); }, @@ -652,7 +652,7 @@ SCENARIO("buffer with time on intervals, error", "[buffer_with_time][operators][ #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); @@ -668,7 +668,7 @@ SCENARIO("buffer with time on intervals, error", "[buffer_with_time][operators][ [](std::vector counter){ printf("on_next: "); std::for_each(counter.begin(), counter.end(), [](long c){ - printf("%d ", c); + printf("%ld ", c); }); printf("\n"); }, -- GitLab From bc96604bc2573e9e977995201c69475b6fec15ec Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:33:42 -0700 Subject: [PATCH 432/782] add types_checked based on void_t proposal --- Rx/v2/src/rxcpp/rx-util.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 470b532..1d265c7 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -79,6 +79,31 @@ struct all_true static const bool value = B0 && all_true::value; }; +// +// 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 struct types_checked_from {typedef types_checked type;}; +} + +template +struct types_checked_from {typedef typename detail::types_checked_from::type type;}; + + + +template +struct value_type_from : public std::false_type {typedef types_checked type;}; + +template +struct value_type_from::type> + : public std::true_type {typedef typename T::value_type type;}; + + + namespace detail { template -- GitLab From 63ecc901bcaf85358221fc4329d0ce2f95b1789e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:34:53 -0700 Subject: [PATCH 433/782] add some types_checked usage --- Rx/v2/src/rxcpp/rx-coordination.hpp | 30 ++++++++++++----------------- Rx/v2/src/rxcpp/rx-predef.hpp | 16 ++++++--------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index abd1506..23c5405 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -11,29 +11,23 @@ namespace rxcpp { struct tag_coordinator {}; struct coordinator_base {typedef tag_coordinator coordinator_tag;}; + +template +struct is_coordinator : public std::false_type {}; + template -class is_coordinator -{ - template - static typename C::coordinator_tag* check(int); - template - static void check(...); -public: - static const bool value = std::is_convertible::type>(0)), tag_coordinator*>::value; -}; +struct is_coordinator::type> + : public std::is_convertible {}; struct tag_coordination {}; struct coordination_base {typedef tag_coordination coordination_tag;}; + +template +struct is_coordination : public std::false_type {}; + template -class is_coordination -{ - template - static typename C::coordination_tag* check(int); - template - static void check(...); -public: - static const bool value = std::is_convertible::type>(0)), tag_coordination*>::value; -}; +struct is_coordination::type> + : public std::is_convertible {}; template class coordinator : public coordinator_base diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index bd94151..634b73f 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -19,17 +19,13 @@ inline auto trace_activity() -> decltype(rxcpp_trace_activity(trace_tag()))& { struct tag_action {}; +template +struct is_action : public std::false_type {}; + template -class is_action -{ - struct not_void {}; - template - static typename C::action_tag* check(int); - template - static not_void check(...); -public: - static const bool value = std::is_convertible::type>(0)), tag_action*>::value; -}; +struct is_action::type> + : public std::is_convertible {}; + struct tag_worker {}; template -- GitLab From b70b84b8ff95065c9225d9deed9b40a7ccc23895 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:36:09 -0700 Subject: [PATCH 434/782] fix clang errors --- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 9 ++- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 5 +- Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 4 +- Rx/v2/src/rxcpp/rx-observable.hpp | 69 ++++++++++++-------- 4 files changed, 54 insertions(+), 33 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index f6766d7..c580af8 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -16,6 +16,9 @@ namespace detail { template struct buffer_with_time { + static_assert(std::is_convertible::value, "Duration parameter must convert to rxsc::scheduler::clock_type::duration"); + static_assert(is_coordination::value, "Coordination parameter must satisfy the requirements for a Coordination"); + typedef typename std::decay::type source_value_type; typedef typename std::decay::type coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; @@ -41,7 +44,7 @@ struct buffer_with_time } template - struct buffer_with_time_observer + struct buffer_with_time_observer { typedef buffer_with_time_observer this_type; typedef std::vector value_type; @@ -134,8 +137,8 @@ public: buffer_with_time_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { - return source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); + -> decltype(source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { + return source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index 08cd629..d91d43e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -23,7 +23,7 @@ struct is_lift_function_for { typedef typename std::decay::type for_type; typedef typename std::decay::type func_type; typedef decltype(check(0)) detail_result; - static const bool value = is_subscriber::value && is_subscriber::value && std::is_convertible::value; + static const bool value = is_subscriber::value && is_subscriber::value && std::is_convertible::type>::value; }; } @@ -41,7 +41,7 @@ struct lift_traits typedef typename source_operator_type::value_type source_value_type; - static_assert(rxcpp::detail::is_lift_function_for, operator_type>::value, "lift Operator must be a function with the signature subscriber(subscriber)"); + static const bool value = rxcpp::detail::is_lift_function_for, operator_type>::value; }; template @@ -78,6 +78,7 @@ public: auto operator()(Observable&& source) -> decltype(source.template lift(chain)) { return source.template lift(chain); + static_assert(rxcpp::detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index 7981d8d..4bd9c68 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -144,13 +144,13 @@ public: template inline auto window_with_time(Duration period, Coordination coordination) -> detail::window_with_time_factory { - return detail::window_with_time_factory(period, period, coordination); + return detail::window_with_time_factory(period, period, coordination); } template inline auto window_with_time(Duration period, Duration skip, Coordination coordination) -> detail::window_with_time_factory { - return detail::window_with_time_factory(period, skip, coordination); + return detail::window_with_time_factory(period, skip, coordination); } } diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index a603b57..1561c8e 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -432,6 +432,30 @@ public: static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } + /// + /// 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 + auto lift_if(Operator&& op) const + -> typename std::enable_if, Operator>::value, + observable::value_type, rxo::detail::lift_operator>>::type { + return observable::value_type, rxo::detail::lift_operator>( + rxo::detail::lift_operator(source_operator, std::forward(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 + auto lift_if(Operator&& op) const + -> typename std::enable_if, Operator>::value, + decltype(rxs::from())>::type { + return rxs::from(); + } + /// /// subscribe will cause this observable to emit values to the provided subscriber. /// callers must provide enough arguments to make a subscriber. @@ -538,58 +562,51 @@ public: /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// auto buffer(int count) const - -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_count(count, count))) { - return lift>(rxo::detail::buffer_count(count, count)); + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_count(count, count))) { + return lift_if>(rxo::detail::buffer_count(count, count)); } /// buffer -> /// start a new vector every skip items and collect count items from this observable into each vector to emit from the new observable that is returned. /// auto buffer(int count, int skip) const - -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_count(count, skip))) { - return lift>(rxo::detail::buffer_count(count, skip)); + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_count(count, skip))) { + return lift_if>(rxo::detail::buffer_count(count, skip)); } /// buffer_with_time -> /// start a new vector every skip time interval and collect items into it from this observable for period of time. /// - template - auto buffer_with_time(Duration period, Duration skip, Coordination coordination) const - -> typename std::enable_if< - is_coordination::value, - decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, skip, coordination)))>::type { - return lift>(rxo::detail::buffer_with_time(period, skip, coordination)); + template + auto buffer_with_time(rxsc::scheduler::clock_type::duration period, rxsc::scheduler::clock_type::duration skip, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time(period, skip, coordination))) { + return lift_if>(rxo::detail::buffer_with_time(period, skip, coordination)); } /// buffer_with_time -> /// start a new vector every skip time interval and collect items into it from this observable for period of time. /// - template - auto buffer_with_time(Duration period, Duration skip) const - -> typename std::enable_if< - !is_coordination::value, - decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, skip, identity_current_thread())))>::type { - return lift>(rxo::detail::buffer_with_time(period, skip, identity_current_thread())); + auto buffer_with_time(rxsc::scheduler::clock_type::duration period, rxsc::scheduler::clock_type::duration skip) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time(period, skip, identity_current_thread()))) { + return lift_if>(rxo::detail::buffer_with_time(period, skip, identity_current_thread())); } /// buffer_with_time -> /// start a new vector every period time interval and collect items into it from this observable for period of time. /// - template - auto buffer_with_time(Duration period, Coordination coordination) const - -> typename std::enable_if< - is_coordination::value, - decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, period, coordination)))>::type { - return lift>(rxo::detail::buffer_with_time(period, period, coordination)); + template::value, rxu::types_checked>::type> + auto buffer_with_time(rxsc::scheduler::clock_type::duration period, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time(period, period, coordination))) { + return lift_if>(rxo::detail::buffer_with_time(period, period, coordination)); } /// buffer_with_time -> /// start a new vector every period time interval and collect items into it from this observable for period of time. /// - template - auto buffer_with_time(Duration period) const - -> decltype(EXPLICIT_THIS lift>(rxo::detail::buffer_with_time(period, period, identity_current_thread()))) { - return lift>(rxo::detail::buffer_with_time(period, period, identity_current_thread())); + auto buffer_with_time(rxsc::scheduler::clock_type::duration period) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time(period, period, identity_current_thread()))) { + return lift_if>(rxo::detail::buffer_with_time(period, period, identity_current_thread())); } template -- GitLab From bc7a99ab4945fa21a31971b15b6a57d9fe062f1d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:39:44 -0700 Subject: [PATCH 435/782] stop time drift in buffer_with_time --- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index c580af8..a14e854 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -58,12 +58,14 @@ struct buffer_with_time , dest(std::move(d)) , coordinator(std::move(c)) , worker(std::move(coordinator.get_worker())) + , expected(worker.now()) { } dest_type dest; coordinator_type coordinator; rxsc::worker worker; mutable std::deque chunks; + rxsc::scheduler::clock_type::time_point expected; }; std::shared_ptr state; @@ -75,15 +77,17 @@ struct buffer_with_time localState->dest.on_next(std::move(localState->chunks.front())); localState->chunks.pop_front(); }; - auto create_buffer = [localState, produce_buffer](const rxsc::schedulable& self) { + auto create_buffer = [localState, produce_buffer](const rxsc::schedulable&) { localState->chunks.emplace_back(); - localState->worker.schedule(localState->worker.now() + localState->period, produce_buffer); - self.schedule(localState->worker.now() + localState->skip); + auto produce_at = localState->expected + localState->period; + localState->expected += localState->skip; + localState->worker.schedule(produce_at, produce_buffer); }; - state->chunks.emplace_back(); - state->worker.schedule(state->worker.now() + state->period, produce_buffer); - state->worker.schedule(state->worker.now() + state->skip, create_buffer); + state->worker.schedule_periodically( + state->expected, + state->skip, + create_buffer); } void on_next(T v) const { for(auto& chunk : state->chunks) { -- GitLab From 9ef6110f9e5e93eac8d0f0fdd5be78be29c0a233 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 18 Sep 2014 21:45:21 -0700 Subject: [PATCH 436/782] stop time drift in window_with_time --- Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index 4bd9c68..aa01caa 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -56,12 +56,14 @@ struct window_with_time , dest(std::move(d)) , coordinator(std::move(c)) , worker(std::move(coordinator.get_worker())) + , expected(worker.now()) { } dest_type dest; coordinator_type coordinator; rxsc::worker worker; mutable std::deque> subj; + rxsc::scheduler::clock_type::time_point expected; }; std::shared_ptr state; @@ -73,17 +75,19 @@ struct window_with_time localState->subj[0].get_subscriber().on_completed(); localState->subj.pop_front(); }; - auto create_window = [localState, release_window](const rxsc::schedulable& self) { + auto create_window = [localState, release_window](const rxsc::schedulable&) { localState->subj.push_back(rxcpp::subjects::subject()); localState->dest.on_next(localState->subj[localState->subj.size() - 1].get_observable().as_dynamic()); - localState->worker.schedule(localState->worker.now() + localState->period, release_window); - self.schedule(localState->worker.now() + localState->skip); + + auto produce_at = localState->expected + localState->period; + localState->expected += localState->skip; + localState->worker.schedule(produce_at, release_window); }; - state->subj.push_back(rxcpp::subjects::subject()); - state->dest.on_next(state->subj[0].get_observable().as_dynamic()); - state->worker.schedule(state->worker.now() + state->period, release_window); - state->worker.schedule(state->worker.now() + state->skip, create_window); + state->worker.schedule_periodically( + state->expected, + state->skip, + create_window); } void on_next(T v) const { -- GitLab From 532cb26023a8d89799680144cfd44655b697373d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 19 Sep 2014 07:34:25 -0700 Subject: [PATCH 437/782] fix clang error --- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index d91d43e..58fa4d6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -75,7 +75,7 @@ class lift_factory public: lift_factory(operator_type op) : chain(std::move(op)) {} template - auto operator()(Observable&& source) + auto operator()(const Observable& source) -> decltype(source.template lift(chain)) { return source.template lift(chain); static_assert(rxcpp::detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); -- GitLab From cb6ef300af1435ad19475b97817942ccabe37fe5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 19 Sep 2014 07:34:49 -0700 Subject: [PATCH 438/782] ci script update --- projects/scripts/travis-install.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 466c1fa..2cfcd39 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -8,26 +8,26 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' sudo add-apt-repository -y ppa:28msec/utils # Recent cmake sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang-3.5 - sudo apt-get clean - sudo apt-get update + sudo apt-get clean -qq || echo "ignore clean failure" + sudo apt-get update -qq || echo "ignore update failure" - sudo apt-get install -q --fix-missing cmake libssl-dev + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev if [ "$CC" = clang ]; then - sudo apt-get install -q --fix-missing clang-3.6 + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.6 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 20 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 20 fi if [ "$CC" = gcc ]; then - sudo apt-get install -q --fix-missing gcc-4.8 g++-4.8 + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing gcc-4.8 g++-4.8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 fi elif [ "$TRAVIS_OS_NAME" = osx ]; then xcode-select --install - brew update - brew doctor - brew list cmake || brew install cmake + brew update || echo "suppress failures in order to ignore warnings" + brew doctor || echo "suppress failures in order to ignore warnings" + brew list cmake || brew install cmake || echo "suppress failures in order to ignore warnings" fi -- GitLab From 0ecee09a6fbc9f0062dac7342b47279db0e48898 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 2 Oct 2014 20:57:27 -0700 Subject: [PATCH 439/782] fix some warnings --- Rx/v2/test/operators/concat_map.cpp | 18 +++---- Rx/v2/test/operators/filter.cpp | 6 +-- Rx/v2/test/operators/flat_map.cpp | 18 +++---- Rx/v2/test/operators/publish.cpp | 50 +++++++++---------- Rx/v2/test/operators/window.cpp | 4 +- Rx/v2/test/sources/scope.cpp | 7 ++- Rx/v2/test/subjects/subject.cpp | 60 +++++++++++------------ Rx/v2/test/subscriptions/subscription.cpp | 21 ++++---- 8 files changed, 93 insertions(+), 91 deletions(-) diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 0d3402c..8423e46 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -36,14 +36,14 @@ SCENARIO("concat_map pythagorian ranges", "[hide][range][concat_map][pythagorian .map([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 triplet){return triplet;}) + [](int /*x*/, std::tuple triplet){return triplet;}) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}); + [](int /*z*/, std::tuple triplet){return triplet;}); triples .take(tripletCount) .subscribe( - rxu::apply_to([&ct](int x,int y,int z){++ct;}), + rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){++ct;}), [](std::exception_ptr){abort();}); auto finish = clock::now(); auto msElapsed = duration_cast(finish.time_since_epoch()) - @@ -83,11 +83,11 @@ SCENARIO("synchronize concat_map pythagorian ranges", "[hide][range][concat_map] .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples .take(tripletCount) @@ -131,11 +131,11 @@ SCENARIO("observe_on concat_map pythagorian ranges", "[hide][range][concat_map][ .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples @@ -180,11 +180,11 @@ SCENARIO("serialize concat_map pythagorian ranges", "[hide][range][concat_map][s .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples diff --git a/Rx/v2/test/operators/filter.cpp b/Rx/v2/test/operators/filter.cpp index fdab02a..accb527 100644 --- a/Rx/v2/test/operators/filter.cpp +++ b/Rx/v2/test/operators/filter.cpp @@ -370,7 +370,7 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") WHEN("filtered to ints that are primes"){ w.schedule_absolute(rxsc::test::created_time, - [&invoked, &res, &ys, &xs](const rxsc::schedulable& scbl) { + [&invoked, &res, &ys, &xs](const rxsc::schedulable&) { #if RXCPP_USE_OBSERVABLE_MEMBERS ys = xs .filter([&invoked, &res](int x) { @@ -390,11 +390,11 @@ SCENARIO("filter stops on dispose from predicate", "[where][filter][operators]") #endif }); - w.schedule_absolute(rxsc::test::subscribed_time, [&ys, &res](const rxsc::schedulable& scbl) { + 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& scbl) { + w.schedule_absolute(rxsc::test::unsubscribed_time, [&res](const rxsc::schedulable&) { res.unsubscribe(); }); diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 8490de8..44b6869 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -71,14 +71,14 @@ SCENARIO("flat_map pythagorian ranges", "[hide][range][flat_map][pythagorian][pe .map([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 triplet){return triplet;}) + [](int /*x*/, std::tuple triplet){return triplet;}) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}); + [](int /*z*/, std::tuple triplet){return triplet;}); triples .take(tripletCount) .subscribe( - rxu::apply_to([&ct](int x,int y,int z){ + rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){ ++ct; })); auto finish = clock::now(); @@ -119,11 +119,11 @@ SCENARIO("synchronize flat_map pythagorian ranges", "[hide][range][flat_map][syn .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples .take(tripletCount) @@ -167,11 +167,11 @@ SCENARIO("observe_on flat_map pythagorian ranges", "[hide][range][flat_map][obse .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples .take(tripletCount) @@ -215,11 +215,11 @@ SCENARIO("serialize flat_map pythagorian ranges", "[hide][range][flat_map][seria .map([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 triplet){return triplet;}, + [](int /*x*/, std::tuple triplet){return triplet;}, so) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}, + [](int /*z*/, std::tuple triplet){return triplet;}, so); int ct = triples .take(tripletCount) diff --git a/Rx/v2/test/operators/publish.cpp b/Rx/v2/test/operators/publish.cpp index 27bc574..0a22309 100644 --- a/Rx/v2/test/operators/publish.cpp +++ b/Rx/v2/test/operators/publish.cpp @@ -72,18 +72,18 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ WHEN("subscribed and then connected"){ w.schedule_absolute(rxsc::test::created_time, - [&ys, &xs](const rxsc::schedulable& scbl){ + [&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& scbl){ + [&ys, &res](const rxsc::schedulable&){ ys.subscribe(res); }); w.schedule_absolute(rxsc::test::unsubscribed_time, - [&res](const rxsc::schedulable& scbl){ + [&res](const rxsc::schedulable&){ res.unsubscribe(); }); @@ -91,11 +91,11 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ rx::composite_subscription connection; w.schedule_absolute(300, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(400, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -104,11 +104,11 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ rx::composite_subscription connection; w.schedule_absolute(500, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(550, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -117,11 +117,11 @@ SCENARIO("publish basic", "[publish][multicast][subject][operators]"){ rx::composite_subscription connection; w.schedule_absolute(650, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(800, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -187,17 +187,17 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ WHEN("subscribed and then connected"){ w.schedule_absolute(rxsc::test::created_time, - [&ys, &xs](const rxsc::schedulable& scbl){ + [&ys, &xs](const rxsc::schedulable&){ ys = xs.publish().as_dynamic(); }); w.schedule_absolute(rxsc::test::subscribed_time, - [&ys, &res](const rxsc::schedulable& scbl){ + [&ys, &res](const rxsc::schedulable&){ ys.subscribe(res); }); w.schedule_absolute(rxsc::test::unsubscribed_time, - [&res](const rxsc::schedulable& scbl){ + [&res](const rxsc::schedulable&){ res.unsubscribe(); }); @@ -205,11 +205,11 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ rx::composite_subscription connection; w.schedule_absolute(300, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(400, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -218,11 +218,11 @@ SCENARIO("publish error", "[publish][error][multicast][subject][operators]"){ rx::composite_subscription connection; w.schedule_absolute(500, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(800, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -286,17 +286,17 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope WHEN("subscribed and then connected"){ w.schedule_absolute(rxsc::test::created_time, - [&ys, &xs](const rxsc::schedulable& scbl){ + [&ys, &xs](const rxsc::schedulable&){ ys = xs.publish(1979).as_dynamic(); }); w.schedule_absolute(rxsc::test::subscribed_time, - [&ys, &res](const rxsc::schedulable& scbl){ + [&ys, &res](const rxsc::schedulable&){ ys.subscribe(res); }); w.schedule_absolute(rxsc::test::unsubscribed_time, - [&res](const rxsc::schedulable& scbl){ + [&res](const rxsc::schedulable&){ res.unsubscribe(); }); @@ -304,11 +304,11 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope rx::composite_subscription connection; w.schedule_absolute(300, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(400, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -317,11 +317,11 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope rx::composite_subscription connection; w.schedule_absolute(500, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(550, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } @@ -330,11 +330,11 @@ SCENARIO("publish basic with initial value", "[publish][multicast][behavior][ope rx::composite_subscription connection; w.schedule_absolute(650, - [connection, &ys](const rxsc::schedulable& scbl){ + [connection, &ys](const rxsc::schedulable&){ ys.connect(connection); }); w.schedule_absolute(800, - [connection](const rxsc::schedulable& scbl){ + [connection](const rxsc::schedulable&){ connection.unsubscribe(); }); } diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index 12d32b1..141a07c 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -97,7 +97,7 @@ SCENARIO("window count, inner timings", "[window][operators]"){ w.schedule_absolute( rxsc::test::created_time, - [&](const rxsc::schedulable& scbl) { + [&](const rxsc::schedulable&) { res = xs .window(3, 2); } @@ -105,7 +105,7 @@ SCENARIO("window count, inner timings", "[window][operators]"){ w.schedule_absolute( rxsc::test::subscribed_time, - [&](const rxsc::schedulable& scbl) { + [&](const rxsc::schedulable&) { res.subscribe( // on_next [&](rx::observable window) { diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp index cca805d..ac3fc16 100644 --- a/Rx/v2/test/sources/scope.cpp +++ b/Rx/v2/test/sources/scope.cpp @@ -343,10 +343,10 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ [&]() { return rx::observable<>:: scope( - [&](){ + [&]() -> resource { ++resource_factory_invoked; throw ex; - return resource(sc.clock()); + //return resource(sc.clock()); }, [&](resource r){ ++observable_factory_invoked; @@ -400,10 +400,9 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource r){ + [&](resource r) -> rx::observable { ++observable_factory_invoked; throw ex; - return rx::observable<>::never(); } ) // forget type to workaround lambda deduction bug on msvc 2013 diff --git a/Rx/v2/test/subjects/subject.cpp b/Rx/v2/test/subjects/subject.cpp index dd097d8..e1e91a0 100644 --- a/Rx/v2/test/subjects/subject.cpp +++ b/Rx/v2/test/subjects/subject.cpp @@ -467,27 +467,27 @@ SCENARIO("subject - infinite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable&){ s = rxsub::subject(); o = s.get_subscriber();}); - w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable&){ xs.subscribe(o);}); - w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable&){ o.unsubscribe();}); - w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable&){ s.get_observable().subscribe(results1);}); - w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable&){ s.get_observable().subscribe(results2);}); - w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable&){ s.get_observable().subscribe(results3);}); - w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable&){ results2.unsubscribe();}); - w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable&){ results3.unsubscribe();}); w.start(); @@ -557,27 +557,27 @@ SCENARIO("subject - finite source", "[subject][subjects]"){ auto o = s.get_subscriber(); - w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable&){ s = rxsub::subject(); o = s.get_subscriber();}); - w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable&){ xs.subscribe(o);}); - w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable&){ o.unsubscribe();}); - w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable&){ s.get_observable().subscribe(results1);}); - w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable&){ s.get_observable().subscribe(results2);}); - w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable&){ s.get_observable().subscribe(results3);}); - w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable&){ results2.unsubscribe();}); - w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable&){ results3.unsubscribe();}); w.start(); @@ -650,27 +650,27 @@ SCENARIO("subject - on_error in source", "[subject][subjects]"){ auto o = s.get_subscriber(); - w.schedule_absolute(100, [&s, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(100, [&s, &o](const rxsc::schedulable&){ s = rxsub::subject(); o = s.get_subscriber();}); - w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable& scbl){ + w.schedule_absolute(200, [&xs, &o](const rxsc::schedulable&){ xs.subscribe(o);}); - w.schedule_absolute(1000, [&o](const rxsc::schedulable& scbl){ + w.schedule_absolute(1000, [&o](const rxsc::schedulable&){ o.unsubscribe();}); - w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(300, [&s, &results1](const rxsc::schedulable&){ s.get_observable().subscribe(results1);}); - w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(400, [&s, &results2](const rxsc::schedulable&){ s.get_observable().subscribe(results2);}); - w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(900, [&s, &results3](const rxsc::schedulable&){ s.get_observable().subscribe(results3);}); - w.schedule_absolute(600, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(600, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(700, [&results2](const rxsc::schedulable& scbl){ + w.schedule_absolute(700, [&results2](const rxsc::schedulable&){ results2.unsubscribe();}); - w.schedule_absolute(800, [&results1](const rxsc::schedulable& scbl){ + w.schedule_absolute(800, [&results1](const rxsc::schedulable&){ results1.unsubscribe();}); - w.schedule_absolute(950, [&results3](const rxsc::schedulable& scbl){ + w.schedule_absolute(950, [&results3](const rxsc::schedulable&){ results3.unsubscribe();}); w.start(); diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 6919b63..37c3683 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -34,7 +34,7 @@ SCENARIO("for loop subscribes to map", "[hide][for][just][subscribe][long][perf] std::stringstream(s) >> i; return i; }) - .subscribe([&](int i){ + .subscribe([&](int){ ++c; }); } @@ -52,6 +52,7 @@ SCENARIO("for loop subscribes to map", "[hide][for][just][subscribe][long][perf] } } +#if 0 SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_latest][subscribe][long][perf]"){ const int& subscriptions = static_subscriptions; GIVEN("a for loop"){ @@ -89,6 +90,7 @@ SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_lat } } } +#endif SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug][synchronize][long][perf]"){ GIVEN("range"){ @@ -124,7 +126,6 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug }, [=](std::exception_ptr e){ abort(); - std::get<2>(*completionstate).on_error(e); }, [=](){ if (std::get<1>(*completionstate) != values) { @@ -146,7 +147,7 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -161,7 +162,7 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -176,7 +177,7 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -234,7 +235,6 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o }, [=](std::exception_ptr e){ abort(); - std::get<2>(*completionstate).on_error(e); }, [=](){ if (std::get<1>(*completionstate) != values) { @@ -255,7 +255,7 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -269,7 +269,7 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -283,7 +283,7 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o .lift(liftrequirecompletion) .subscribe( rx::make_observer_dynamic( - [&](int i){ + [&](int){ ++v; }, [&](){ @@ -329,12 +329,15 @@ SCENARIO("non-subscription traits", "[subscription][traits]"){ void* v = nullptr; WHEN("tested"){ THEN("is_subscription value is false for lambda"){ + l(); REQUIRE(!rx::is_subscription::value); } THEN("is_subscription value is false for int"){ + i = 0; REQUIRE(!rx::is_subscription::value); } THEN("is_subscription value is false for void*"){ + v = nullptr; REQUIRE(!rx::is_subscription::value); } THEN("is_subscription value is false for void"){ -- GitLab From d859663d764f41197def026ae4a789fff2cf6c55 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 2 Oct 2014 20:59:30 -0700 Subject: [PATCH 440/782] add RXCPP_DELETE and types<...> --- Rx/v2/src/rxcpp/rx-util.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 1d265c7..b6de101 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -23,6 +23,14 @@ #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) @@ -79,6 +87,9 @@ struct all_true static const bool value = B0 && all_true::value; }; +template +struct types; + // // based on Walter Brown's void_t proposal // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3911.pdf -- GitLab From 8160e1a40216a8159120d933a2a3c077321d633a Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 2 Oct 2014 21:04:04 -0700 Subject: [PATCH 441/782] more warnings squashed --- Rx/v2/examples/pythagorian/main.cpp | 12 ++++++------ Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 4 ++++ Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 8 ++++++++ Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp | 6 ++++++ Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 2 +- Rx/v2/src/rxcpp/rx-scheduler.hpp | 5 ++++- Rx/v2/src/rxcpp/rx-subscriber.hpp | 2 +- Rx/v2/src/rxcpp/rx-trace.hpp | 4 ++-- 10 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Rx/v2/examples/pythagorian/main.cpp b/Rx/v2/examples/pythagorian/main.cpp index 379b1e2..309b16d 100644 --- a/Rx/v2/examples/pythagorian/main.cpp +++ b/Rx/v2/examples/pythagorian/main.cpp @@ -39,7 +39,7 @@ struct trace_calls : rxcpp::trace_noop } template - inline void subscribe_return(const Observable& o) { + inline void subscribe_return(const Observable&) { subscribes++; } @@ -106,9 +106,9 @@ namespace rxu=rxcpp::util; // DO NOT USE: 'using namespace std;' #ifdef UNICODE -int wmain(int argc, wchar_t** argv) +int wmain() #else -int main(int argc, char** argv) +int main() #endif { int c = 0; @@ -125,16 +125,16 @@ int main(int argc, char** argv) .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 triplet){return triplet;}) + [](int /*x*/, std::tuple triplet){return triplet;}) // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic();}, - [](int z, std::tuple triplet){return triplet;}); + [](int /*z*/, std::tuple triplet){return triplet;}); int ct = 0; triples .take(100) - .subscribe(rxu::apply_to([&ct](int x,int y,int z){ + .subscribe(rxu::apply_to([&ct](int /*x*/,int /*y*/,int /*z*/){ ++ct; })); diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp index e3a2970..56507d4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -60,7 +60,7 @@ struct buffer_count for(auto& chunk : chunks) { chunk.push_back(v); } - while (!chunks.empty() && chunks.front().size() == this->count) { + while (!chunks.empty() && int(chunks.front().size()) == this->count) { dest.on_next(std::move(chunks.front())); chunks.pop_front(); } diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index a14e854..dac1302 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -73,7 +73,7 @@ struct buffer_with_time : state(std::make_shared(buffer_with_time_subscriber_values(std::move(d), v, std::move(c)))) { auto localState = state; - auto produce_buffer = [localState](const rxsc::schedulable& self) { + auto produce_buffer = [localState](const rxsc::schedulable&) { localState->dest.on_next(std::move(localState->chunks.front())); localState->chunks.pop_front(); }; diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 98cec31..a8be1a7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -79,6 +79,8 @@ struct concat_map collection_selector_type selectCollection; result_selector_type selectResult; coordination_type coordination; + private: + values& operator=(const values&) RXCPP_DELETE; }; values initial; @@ -232,6 +234,8 @@ struct concat_map source->subscribe(std::move(selectedSink.get())); } +private: + concat_map& operator=(const concat_map&) RXCPP_DELETE; }; template diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 1c721e4..9d3d39b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -94,6 +94,9 @@ struct reduce : public operator_base source; seed_type current; Subscriber out; + + private: + reduce_state_type& operator=(reduce_state_type o) RXCPP_DELETE; }; auto state = std::make_shared(initial, std::move(o)); state->source.subscribe( @@ -151,6 +157,8 @@ struct reduce : public operator_base diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp index e62e8ff..c1adb2c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp @@ -31,6 +31,8 @@ struct subscribe_on : public operator_base } source_type source; coordination_type coordination; + private: + subscribe_on_values& operator=(subscribe_on_values o) RXCPP_DELETE; }; const subscribe_on_values initial; @@ -59,6 +61,8 @@ struct subscribe_on : public operator_base composite_subscription source_lifetime; coordinator_type coordinator; output_type out; + private: + subscribe_on_state_type& operator=(subscribe_on_state_type o) RXCPP_DELETE; }; auto coordinator = initial.coordination.create_coordinator(s.get_subscription()); @@ -99,6 +103,8 @@ struct subscribe_on : public operator_base controller.schedule(selectedProducer.get()); } +private: + subscribe_on& operator=(subscribe_on o) RXCPP_DELETE; }; template diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index aa01caa..aca16de 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -71,7 +71,7 @@ struct window_with_time : state(std::make_shared(window_with_time_subscriber_values(std::move(d), v, std::move(c)))) { auto localState = state; - auto release_window = [localState](const rxsc::schedulable& self) { + auto release_window = [localState](const rxsc::schedulable&) { localState->subj[0].get_subscriber().on_completed(); localState->subj.pop_front(); }; diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index df5f681..f91e66c 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -38,6 +38,7 @@ typedef std::shared_ptr const_scheduler_interface_ptr class recursed { bool& isrequested; + recursed operator=(const recursed&); public: explicit recursed(bool& r) : isrequested(r) @@ -56,6 +57,7 @@ class recurse bool& isallowed; mutable bool isrequested; recursed requestor; + recurse operator=(const recurse&); public: explicit recurse(bool& a) : isallowed(a) @@ -86,6 +88,7 @@ class recursion { mutable bool isallowed; recurse recursor; + recursion operator=(const recursion&); public: recursion() : isallowed(true) @@ -433,7 +436,7 @@ class schedulable : public schedulable_base { // does not aquire recursion scope } - recursed_scope_type& operator=(const recursed_scope_type& o) + recursed_scope_type& operator=(const recursed_scope_type& ) { // no change in recursion scope return *this; diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 39e6bdc..2e2661d 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -679,7 +679,7 @@ auto make_subscriber(const subscriber& scbr, trace_id id, } template -auto make_subscriber(const subscriber& scbr, const composite_subscription& cs, +auto make_subscriber(const subscriber& , const composite_subscription& cs, const observer& o) -> subscriber> { return subscriber>(trace_id::make_next_id_subscriber(), cs, o); diff --git a/Rx/v2/src/rxcpp/rx-trace.hpp b/Rx/v2/src/rxcpp/rx-trace.hpp index e72caaf..a148953 100644 --- a/Rx/v2/src/rxcpp/rx-trace.hpp +++ b/Rx/v2/src/rxcpp/rx-trace.hpp @@ -58,9 +58,9 @@ struct trace_noop inline void action_recurse(const Schedulable&) {} template - inline void subscribe_enter(const Observable& o, const Subscriber& s) {} + inline void subscribe_enter(const Observable& , const Subscriber& ) {} template - inline void subscribe_return(const Observable& o) {} + inline void subscribe_return(const Observable& ) {} template inline void connect(const SubscriberFrom&, const SubscriberTo&) {} -- GitLab From 00766799d6950706167af26fe2e344f744b509ab Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 2 Oct 2014 21:06:29 -0700 Subject: [PATCH 442/782] increases warning level, fixes warnings temporarily removes combine_latest probably breaks clang and gcc compilation both must be fixed before pushing to master --- Rx/v2/src/rxcpp/rx-observable.hpp | 47 +++++++++++++++----------- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 12 +++---- projects/CMake/CMakeLists.txt | 19 ++++++----- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 1561c8e..10836ff 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -341,7 +341,7 @@ private: if (rxsc::current_thread::is_schedule_required()) { const auto& sc = rxsc::make_current_thread(); sc.create_worker(o.get_subscription()).schedule( - [&](const rxsc::schedulable& scbl) { + [&](const rxsc::schedulable&) { safe_subscribe(); }); } else { @@ -820,14 +820,23 @@ public: rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } +#if 0 + template + struct defer_combine_latest : public defer_observable{}; +#if 0 template - struct defer_combine_latest : public defer_observable< - rxu::all_true::value, !is_coordination::value, !is_observable::value, is_observable::value...>, - this_type, - rxo::detail::combine_latest, Coordination, Selector, ObservableN...> + struct defer_combine_latest< + Coordination, + Selector, + rxu::types, + typename rxu::types_checked_from::type> : + public defer_observable< + rxu::all_true::value, !is_coordination::value, !is_observable::value, is_observable::value...>, + this_type, + rxo::detail::combine_latest, Coordination, Selector, ObservableN...> { }; - +#endif /// combine_latest -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. @@ -835,9 +844,9 @@ public: template auto combine_latest(Selector&& s, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest::value, - typename defer_combine_latest::observable_type>::type { - return defer_combine_latest::make(*this, identity_current_thread(), std::forward(s), std::make_tuple(*this, on...)); + defer_combine_latest>::value, + typename defer_combine_latest>::observable_type>::type { + return defer_combine_latest>::make(*this, identity_current_thread(), std::forward(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -847,9 +856,9 @@ public: template auto combine_latest(Coordination cn, Selector&& s, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest::value, - typename defer_combine_latest::observable_type>::type { - return defer_combine_latest::make(*this, std::move(cn), std::forward(s), std::make_tuple(*this, on...)); + defer_combine_latest>::value, + typename defer_combine_latest>::observable_type>::type { + return defer_combine_latest>::make(*this, std::move(cn), std::forward(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -859,9 +868,9 @@ public: template auto combine_latest(ObservableN... on) const -> typename std::enable_if< - defer_combine_latest::value, - typename defer_combine_latest::observable_type>::type { - return defer_combine_latest::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); + defer_combine_latest>::value, + typename defer_combine_latest>::observable_type>::type { + return defer_combine_latest>::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -871,11 +880,11 @@ public: template auto combine_latest(Coordination cn, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest::value, - typename defer_combine_latest::observable_type>::type { - return defer_combine_latest::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); + defer_combine_latest>::value, + typename defer_combine_latest>::observable_type>::type { + return defer_combine_latest>::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); } - +#endif /// group_by -> /// template diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index ec77c40..331bea9 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -174,7 +174,7 @@ public: abort(); } virtual std::vector subscriptions() const { - abort(); return std::vector(); + abort(); } virtual std::vector messages() const { @@ -247,7 +247,7 @@ public: auto n = message.value(); sc->schedule_relative(message.time(), make_schedulable( controller, - [n, o](const schedulable& scbl) { + [n, o](const schedulable&) { if (o.is_subscribed()) { n->accept(o); } @@ -300,7 +300,7 @@ public: auto n = message.value(); sc->schedule_absolute(message.time(), make_schedulable( controller, - [this, n](const schedulable& scbl) { + [this, n](const schedulable&) { auto local = this->observers; for (auto& o : local) { if (o.is_subscribed()) { @@ -471,13 +471,13 @@ public: }; std::shared_ptr state(new state_type(this->make_subscriber())); - schedule_absolute(created, [createSource, state](const schedulable& scbl) { + schedule_absolute(created, [createSource, state](const schedulable&) { state->source.reset(new typename state_type::source_type(createSource())); }); - schedule_absolute(subscribed, [state](const schedulable& scbl) { + schedule_absolute(subscribed, [state](const schedulable&) { state->source->subscribe(state->o); }); - schedule_absolute(unsubscribed, [state](const schedulable& scbl) { + schedule_absolute(unsubscribed, [state](const schedulable&) { state->o.unsubscribe(); }); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index ae8dd39..b94247c 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -7,11 +7,16 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) FIND_PACKAGE(Threads) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -ftemplate-depth=1024 ${CMAKE_CXX_FLAGS}") + add_compile_options( -Wall -Wextra -Werror ) + add_compile_options( -std=c++11 ) + add_compile_options( -ftemplate-depth=1024 ) # sometimes you just do what the compiler tells you elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") + add_compile_options( -Wall -Wextra -Werror ) + add_compile_options( -std=c++11 ) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - list( APPEND CMAKE_CXX_FLAGS " /DUNICODE /D_UNICODE /bigobj ${CMAKE_CXX_FLAGS}") + add_compile_options( /W4 /WX ) + add_compile_options( /wd4503 ) # truncated symbol + add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium endif() @@ -21,10 +26,8 @@ get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) - include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) - set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) # define the sources of the self test @@ -38,8 +41,8 @@ set(TEST_SOURCES ${TEST_DIR}/sources/interval.cpp ${TEST_DIR}/sources/scope.cpp ${TEST_DIR}/operators/buffer.cpp - ${TEST_DIR}/operators/combine_latest.1.cpp - ${TEST_DIR}/operators/combine_latest.2.cpp + #${TEST_DIR}/operators/combine_latest.1.cpp + #${TEST_DIR}/operators/combine_latest.2.cpp ${TEST_DIR}/operators/concat.cpp ${TEST_DIR}/operators/concat_map.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp @@ -69,7 +72,7 @@ TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) # define the sources of the self test set(ONE_SOURCES ${TEST_DIR}/test.cpp -# ${TEST_DIR}/operators/subscribe_on.cpp + ${TEST_DIR}/operators/buffer.cpp ) add_executable(one_test ${ONE_SOURCES}) TARGET_LINK_LIBRARIES(one_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From 0768cbf4aa5706b7b91e54cfc6c764aaacd57ce7 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Thu, 2 Oct 2014 22:24:31 -0700 Subject: [PATCH 443/782] fix clang warnings --- Rx/v2/examples/println/main.cpp | 4 ++-- Rx/v2/src/rxcpp/rx-notification.hpp | 2 +- Rx/v2/src/rxcpp/rx-observable.hpp | 2 +- Rx/v2/src/rxcpp/rx-subscriber.hpp | 4 ++-- Rx/v2/src/rxcpp/rx-util.hpp | 1 + Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 4 ++-- Rx/v2/src/rxcpp/sources/rx-never.hpp | 2 +- Rx/v2/test/operators/buffer.cpp | 10 +++++----- Rx/v2/test/sources/scope.cpp | 4 ++-- Rx/v2/test/subscriptions/subscription.cpp | 4 ++-- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Rx/v2/examples/println/main.cpp b/Rx/v2/examples/println/main.cpp index b9cf842..e41a8c3 100644 --- a/Rx/v2/examples/println/main.cpp +++ b/Rx/v2/examples/println/main.cpp @@ -40,9 +40,9 @@ auto println(OStream& os) #endif #ifdef UNICODE -int wmain(int argc, wchar_t** argv) +int wmain() #else -int main(int argc, char** argv) +int main() #endif { auto get_names = [](){return rx::observable<>::from( diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index 064851a..0ba09ea 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -100,7 +100,7 @@ auto equals(const T& lhs, const T& rhs, int) } template -bool equals(const T& lhs, const T& rhs, ...) { +bool equals(const T&, const T&, ...) { throw std::runtime_error("value does not support equality tests"); return false; } diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 10836ff..6b1ba3e 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -450,7 +450,7 @@ public: /// into the expression. /// template - auto lift_if(Operator&& op) const + auto lift_if(Operator&&) const -> typename std::enable_if, Operator>::value, decltype(rxs::from())>::type { return rxs::from(); diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 2e2661d..0092637 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -112,7 +112,7 @@ public: const subscriber& o, typename std::enable_if< !std::is_same>::value && - std::is_same>::value, void**>::type select = nullptr) + std::is_same>::value, void**>::type = nullptr) : lifetime(o.lifetime) , destination(o.destination.as_dynamic()) , id(o.id) @@ -685,7 +685,7 @@ auto make_subscriber(const subscriber& , const composite_ return subscriber>(trace_id::make_next_id_subscriber(), cs, o); } template -auto make_subscriber(const subscriber& scbr, trace_id id, const composite_subscription& cs, +auto make_subscriber(const subscriber&, trace_id id, const composite_subscription& cs, const observer& o) -> subscriber> { return subscriber>(std::move(id), cs, o); diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index b6de101..2a6dae0 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -316,6 +316,7 @@ struct print_function template void operator()(const TN&... tn) const { bool inserts[] = {(os << tn, true)...}; + inserts[0] = *(inserts); // silence warning delimit(); } diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index 19aa84e..c78d0a2 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -160,14 +160,14 @@ template auto from(Value0 v0, ValueN... vn) -> typename std::enable_if::value, decltype(iterate(*(std::array*)nullptr, identity_immediate()))>::type { - std::array c = {v0, vn...}; + std::array c{{v0, vn...}}; return iterate(std::move(c), identity_immediate()); } template auto from(Coordination cn, Value0 v0, ValueN... vn) -> typename std::enable_if::value, decltype(iterate(*(std::array*)nullptr, std::move(cn)))>::type { - std::array c = {v0, vn...}; + std::array c{{v0, vn...}}; return iterate(std::move(c), std::move(cn)); } diff --git a/Rx/v2/src/rxcpp/sources/rx-never.hpp b/Rx/v2/src/rxcpp/sources/rx-never.hpp index 22b6c24..bcb991e 100644 --- a/Rx/v2/src/rxcpp/sources/rx-never.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-never.hpp @@ -17,7 +17,7 @@ template struct never : public source_base { template - void on_subscribe(Subscriber o) const { + void on_subscribe(Subscriber) const { } }; diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index eb71572..c8ade17 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -490,7 +490,7 @@ SCENARIO("buffer with time on intervals", "[buffer_with_time][operators][long][h }); printf("\n"); }, - [](std::exception_ptr e){ + [](std::exception_ptr){ printf("on_error\n"); }, [](){ @@ -534,7 +534,7 @@ SCENARIO("buffer with time on intervals, implicit coordination", "[buffer_with_t }); printf("\n"); }, - [](std::exception_ptr e){ + [](std::exception_ptr){ printf("on_error\n"); }, [](){ @@ -579,7 +579,7 @@ SCENARIO("buffer with time on overlapping intervals", "[buffer_with_time][operat }); printf("\n"); }, - [](std::exception_ptr e){ + [](std::exception_ptr){ printf("on_error\n"); }, [](){ @@ -624,7 +624,7 @@ SCENARIO("buffer with time on overlapping intervals, implicit coordination", "[b }); printf("\n"); }, - [](std::exception_ptr e){ + [](std::exception_ptr){ printf("on_error\n"); }, [](){ @@ -672,7 +672,7 @@ SCENARIO("buffer with time on intervals, error", "[buffer_with_time][operators][ }); printf("\n"); }, - [](std::exception_ptr e){ + [](std::exception_ptr){ printf("on_error\n"); }, [](){ diff --git a/Rx/v2/test/sources/scope.cpp b/Rx/v2/test/sources/scope.cpp index ac3fc16..476d434 100644 --- a/Rx/v2/test/sources/scope.cpp +++ b/Rx/v2/test/sources/scope.cpp @@ -348,7 +348,7 @@ SCENARIO("scope, throw resource selector", "[scope][sources]"){ throw ex; //return resource(sc.clock()); }, - [&](resource r){ + [&](resource){ ++observable_factory_invoked; return rx::observable<>::never(); } @@ -400,7 +400,7 @@ SCENARIO("scope, throw resource usage", "[scope][sources]"){ ++resource_factory_invoked; return resource(sc.clock()); }, - [&](resource r) -> rx::observable { + [&](resource) -> rx::observable { ++observable_factory_invoked; throw ex; } diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index 37c3683..ec4557f 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -124,7 +124,7 @@ SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug ++std::get<1>(*completionstate); std::get<2>(*completionstate).on_next(n); }, - [=](std::exception_ptr e){ + [=](std::exception_ptr){ abort(); }, [=](){ @@ -233,7 +233,7 @@ SCENARIO("observe_on range debug", "[hide][subscribe][range][observe_on_debug][o ++std::get<1>(*completionstate); std::get<2>(*completionstate).on_next(n); }, - [=](std::exception_ptr e){ + [=](std::exception_ptr){ abort(); }, [=](){ -- GitLab From 744ca46f8e050dffac77e285e1bbe8b9d4322153 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 3 Oct 2014 07:34:09 -0700 Subject: [PATCH 444/782] gcc warning fixes --- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 2 -- Rx/v2/src/rxcpp/sources/rx-range.hpp | 2 -- Rx/v2/test/operators/buffer.cpp | 5 ----- Rx/v2/test/sources/interval.cpp | 2 -- projects/CMake/CMakeLists.txt | 3 ++- projects/scripts/travis-install.sh | 1 + 6 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index 0bb62f5..dade61a 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -43,8 +43,6 @@ struct interval : public source_base void on_subscribe(Subscriber o) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef typename coordinator_type::template get::type output_type; - // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index ec7ddf5..4af7c24 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -42,8 +42,6 @@ struct range : public source_base void on_subscribe(Subscriber o) const { static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); - typedef Subscriber output_type; - // creates a worker whose lifetime is the same as this subscription auto coordinator = initial.coordination.create_coordinator(o.get_subscription()); diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index c8ade17..b3103ea 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -469,7 +469,6 @@ SCENARIO("buffer with time on intervals", "[buffer_with_time][operators][long][h // 5-6 // -7 using namespace std::chrono; - typedef steady_clock clock; #define TIME milliseconds #define UNIT *15 @@ -513,7 +512,6 @@ SCENARIO("buffer with time on intervals, implicit coordination", "[buffer_with_t // 5-6 // -7 using namespace std::chrono; - typedef steady_clock clock; #define TIME milliseconds #define UNIT *15 @@ -558,7 +556,6 @@ SCENARIO("buffer with time on overlapping intervals", "[buffer_with_time][operat // 4-5 // 5 using namespace std::chrono; - typedef steady_clock clock; #define TIME milliseconds #define UNIT *15 @@ -603,7 +600,6 @@ SCENARIO("buffer with time on overlapping intervals, implicit coordination", "[b // 4-5 // 5 using namespace std::chrono; - typedef steady_clock clock; #define TIME milliseconds #define UNIT *15 @@ -648,7 +644,6 @@ SCENARIO("buffer with time on intervals, error", "[buffer_with_time][operators][ // 4-5 // 5 using namespace std::chrono; - typedef steady_clock clock; #define TIME milliseconds #define UNIT *15 diff --git a/Rx/v2/test/sources/interval.cpp b/Rx/v2/test/sources/interval.cpp index ae1a149..6ea3aeb 100644 --- a/Rx/v2/test/sources/interval.cpp +++ b/Rx/v2/test/sources/interval.cpp @@ -11,7 +11,6 @@ SCENARIO("schedule_periodically", "[hide][periodically][scheduler][long][perf][s GIVEN("schedule_periodically"){ 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(); @@ -76,7 +75,6 @@ SCENARIO("intervals", "[hide][periodically][interval][scheduler][long][perf][sou GIVEN("10 intervals of 1 seconds"){ 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(); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index b94247c..4665cea 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -26,7 +26,8 @@ get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) -include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) +include_directories(SYSTEM ${RXCPP_DIR}/ext/catch/include) +include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 2cfcd39..ef64661 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -6,6 +6,7 @@ set -e if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' + sudo add-apt-repository -y "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" sudo add-apt-repository -y ppa:28msec/utils # Recent cmake sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang-3.5 sudo apt-get clean -qq || echo "ignore clean failure" -- GitLab From bcddb5e06675292fe313c2b5b51102e341955583 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Fri, 3 Oct 2014 15:10:22 -0700 Subject: [PATCH 445/782] re-enable combine_latest not pleased with the resulting code in observable. I want concepts :) --- .../src/rxcpp/operators/rx-combine_latest.hpp | 2 +- Rx/v2/src/rxcpp/rx-observable.hpp | 131 ++++++++++-------- Rx/v2/src/rxcpp/rx-util.hpp | 6 + Rx/v2/test/operators/combine_latest.2.cpp | 4 +- Rx/v2/test/subscriptions/subscription.cpp | 4 +- projects/CMake/CMakeLists.txt | 7 +- 6 files changed, 89 insertions(+), 65 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 9a0b057..3128217 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -15,7 +15,6 @@ namespace detail { template struct combine_latest_traits { - static_assert(rxu::all_true::value...>::value, "combine_latest requires observables"); typedef std::tuple tuple_source_type; typedef std::tuple...> tuple_source_value_type; @@ -137,6 +136,7 @@ struct combine_latest : public operator_base void subscribe_all(std::shared_ptr state, rxu::values) const { bool subscribed[] = {(subscribe_one(state), true)...}; + subscribed[0] = (*subscribed); // silence warning } template diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 6b1ba3e..fc724b9 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -820,71 +820,90 @@ public: rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } -#if 0 - template - struct defer_combine_latest : public defer_observable{}; -#if 0 - template - struct defer_combine_latest< - Coordination, - Selector, - rxu::types, - typename rxu::types_checked_from::type> : - public defer_observable< - rxu::all_true::value, !is_coordination::value, !is_observable::value, is_observable::value...>, - this_type, - rxo::detail::combine_latest, Coordination, Selector, ObservableN...> + template + struct select_combine_latest_cn : public std::false_type {}; + + template + struct select_combine_latest_cn, typename rxu::types_checked_from::type> + : public std::true_type { + typedef rxo::detail::combine_latest operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Coordination cn, ObservableN... on) const { + return observable_type(operator_type(std::move(cn), rxu::pack(), std::make_tuple(src, std::move(on)...))); + }; }; -#endif - /// combine_latest -> - /// All sources must be synchronized! This means that calls across all the subscribers must be serial. - /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. - /// - template - auto combine_latest(Selector&& s, ObservableN... on) const - -> typename std::enable_if< - defer_combine_latest>::value, - typename defer_combine_latest>::observable_type>::type { - return defer_combine_latest>::make(*this, identity_current_thread(), std::forward(s), std::make_tuple(*this, on...)); - } - /// combine_latest -> - /// The coordination is used to synchronize sources from different contexts. - /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. - /// - template - auto combine_latest(Coordination cn, Selector&& s, ObservableN... on) const - -> typename std::enable_if< - defer_combine_latest>::value, - typename defer_combine_latest>::observable_type>::type { - return defer_combine_latest>::make(*this, std::move(cn), std::forward(s), std::make_tuple(*this, on...)); - } + template + struct select_combine_latest_cn, typename rxu::types_checked_from::type, typename Coordination::coordination_tag, typename TN::observable_tag...>::type> + : public std::true_type + { + typedef rxo::detail::combine_latest operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Coordination cn, T0 t0, ObservableN... on) const { + return observable_type(operator_type(std::move(cn), std::move(t0), std::make_tuple(src, std::move(on)...))); + }; + }; - /// combine_latest -> - /// All sources must be synchronized! This means that calls across all the subscribers must be serial. - /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. - /// - template - auto combine_latest(ObservableN... on) const - -> typename std::enable_if< - defer_combine_latest>::value, - typename defer_combine_latest>::observable_type>::type { - return defer_combine_latest>::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); - } + template + struct select_combine_latest : public std::false_type { + template + void operator()(const Source&, T0, T1, TN...) const { + static_assert(is_coordination::value || + is_observable::value || + std::is_convertible>::value + , "T0 must be selector, coordination or observable"); + static_assert(is_observable::value || + std::is_convertible>::value, "T1 must be selector or observable"); + static_assert(rxu::all_true::value...>::value, "TN... must be observable"); + } + template + void operator()(const Source&, T0) const { + static_assert(is_observable::value, "T0 must be observable"); + } + }; + + template + struct select_combine_latest, typename rxu::types_checked_from::type> + : public select_combine_latest_cn> + { + }; + + template + struct select_combine_latest, typename rxu::types_checked_from::type, typename TN::observable_tag...>::type> + : public std::true_type + { + typedef rxo::detail::combine_latest operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Selector sel, ObservableN... on) const { + return observable_type(operator_type(identity_current_thread(), std::move(sel), std::make_tuple(src, std::move(on)...))); + }; + }; + + template + struct select_combine_latest, typename rxu::types_checked_from::type> + : public std::true_type + { + typedef rxo::detail::combine_latest operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, ObservableN... on) const { + return observable_type(operator_type(identity_current_thread(), rxu::pack(), std::make_tuple(src, std::move(on)...))); + }; + }; /// combine_latest -> - /// The coordination is used to synchronize sources from different contexts. /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. /// - template - auto combine_latest(Coordination cn, ObservableN... on) const - -> typename std::enable_if< - defer_combine_latest>::value, - typename defer_combine_latest>::observable_type>::type { - return defer_combine_latest>::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); + template + auto combine_latest(AN... an) const + -> decltype(select_combine_latest>{}(*(this_type*)nullptr, std::move(an)...)) { + return select_combine_latest>{}(*this, std::move(an)...); } -#endif + /// group_by -> /// template diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 2a6dae0..94bbadf 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -334,6 +334,8 @@ struct endline void operator()() const { os << std::endl; } +private: + endline& operator=(const endline&) RXCPP_DELETE; }; template @@ -345,6 +347,8 @@ struct insert_value void operator()() const { os << value; } +private: + insert_value& operator=(const insert_value&) RXCPP_DELETE; }; template @@ -356,6 +360,8 @@ struct insert_function void operator()() const { call(os); } +private: + insert_function& operator=(const insert_function&) RXCPP_DELETE; }; template diff --git a/Rx/v2/test/operators/combine_latest.2.cpp b/Rx/v2/test/operators/combine_latest.2.cpp index 7406a26..de7167a 100644 --- a/Rx/v2/test/operators/combine_latest.2.cpp +++ b/Rx/v2/test/operators/combine_latest.2.cpp @@ -771,7 +771,7 @@ SCENARIO("combine_latest selector throws", "[combine_latest][join][operators]"){ [&]() { return o1 .combine_latest( - [&ex](int v2, int v1) -> int { + [&ex](int, int) -> int { throw ex; }, o2 @@ -834,7 +834,7 @@ SCENARIO("combine_latest selector throws N", "[combine_latest][join][operators]" [&]() { return e[0] .combine_latest( - [&ex](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) -> int { + [&ex](int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) -> int { throw ex; }, e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] diff --git a/Rx/v2/test/subscriptions/subscription.cpp b/Rx/v2/test/subscriptions/subscription.cpp index ec4557f..f60cded 100644 --- a/Rx/v2/test/subscriptions/subscription.cpp +++ b/Rx/v2/test/subscriptions/subscription.cpp @@ -52,7 +52,6 @@ SCENARIO("for loop subscribes to map", "[hide][for][just][subscribe][long][perf] } } -#if 0 SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_latest][subscribe][long][perf]"){ const int& subscriptions = static_subscriptions; GIVEN("a for loop"){ @@ -73,7 +72,7 @@ SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_lat .combine_latest([](int i, int j) { return i + j; }, rx::observable<>::just(2)) - .subscribe([&](int i){ + .subscribe([&](int){ ++c; }); } @@ -90,7 +89,6 @@ SCENARIO("for loop subscribes to combine_latest", "[hide][for][just][combine_lat } } } -#endif SCENARIO("synchronized range debug", "[hide][subscribe][range][synchronize_debug][synchronize][long][perf]"){ GIVEN("range"){ diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index 4665cea..a065376 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -42,8 +42,8 @@ set(TEST_SOURCES ${TEST_DIR}/sources/interval.cpp ${TEST_DIR}/sources/scope.cpp ${TEST_DIR}/operators/buffer.cpp - #${TEST_DIR}/operators/combine_latest.1.cpp - #${TEST_DIR}/operators/combine_latest.2.cpp + ${TEST_DIR}/operators/combine_latest.1.cpp + ${TEST_DIR}/operators/combine_latest.2.cpp ${TEST_DIR}/operators/concat.cpp ${TEST_DIR}/operators/concat_map.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp @@ -73,7 +73,8 @@ TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) # define the sources of the self test set(ONE_SOURCES ${TEST_DIR}/test.cpp - ${TEST_DIR}/operators/buffer.cpp + #${TEST_DIR}/operators/combine_latest.1.cpp + #${TEST_DIR}/operators/combine_latest.2.cpp ) add_executable(one_test ${ONE_SOURCES}) TARGET_LINK_LIBRARIES(one_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From 41b74f99c254bc12ea2aa0da4c242c99aaaafc9d Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 6 Oct 2014 07:50:39 -0700 Subject: [PATCH 446/782] clang warning clean --- Rx/v2/src/rxcpp/rx-observable.hpp | 10 +++++----- Rx/v2/test/operators/combine_latest.1.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index fc724b9..8ca0d57 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -820,7 +820,7 @@ public: rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } - template + template struct select_combine_latest_cn : public std::false_type {}; template @@ -836,7 +836,7 @@ public: }; template - struct select_combine_latest_cn, typename rxu::types_checked_from::type, typename Coordination::coordination_tag, typename TN::observable_tag...>::type> + struct select_combine_latest_cn, typename rxu::types_checked_from::type, typename Coordination::coordination_tag, typename TN::observable_tag...>::type> : public std::true_type { typedef rxo::detail::combine_latest operator_type; @@ -847,7 +847,7 @@ public: }; }; - template + template struct select_combine_latest : public std::false_type { template void operator()(const Source&, T0, T1, TN...) const { @@ -857,7 +857,7 @@ public: , "T0 must be selector, coordination or observable"); static_assert(is_observable::value || std::is_convertible>::value, "T1 must be selector or observable"); - static_assert(rxu::all_true::value...>::value, "TN... must be observable"); + static_assert(rxu::all_true::value...>::value, "TN... must be observable"); } template void operator()(const Source&, T0) const { @@ -872,7 +872,7 @@ public: }; template - struct select_combine_latest, typename rxu::types_checked_from::type, typename TN::observable_tag...>::type> + struct select_combine_latest, typename rxu::types_checked_from::type, typename TN::observable_tag...>::type> : public std::true_type { typedef rxo::detail::combine_latest operator_type; diff --git a/Rx/v2/test/operators/combine_latest.1.cpp b/Rx/v2/test/operators/combine_latest.1.cpp index 0493c78..04d98b4 100644 --- a/Rx/v2/test/operators/combine_latest.1.cpp +++ b/Rx/v2/test/operators/combine_latest.1.cpp @@ -278,7 +278,7 @@ SCENARIO("combine_latest never N", "[combine_latest][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const size_t N = 16; + const int N = 16; std::vector> n; for (int i = 0; i < N; ++i) { @@ -331,7 +331,7 @@ SCENARIO("combine_latest empty N", "[combine_latest][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const size_t N = 16; + const int N = 16; std::vector> e; for (int i = 0; i < N; ++i) { -- GitLab From daa2e0452d9137376e40f9b823fd35d386ee745e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 6 Oct 2014 08:42:15 -0700 Subject: [PATCH 447/782] ctest is broken on linux --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9fda0a0..bc9a026 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ compiler: env: - BUILD_TYPE=Release - + matrix: exclude: - compiler: gcc @@ -29,7 +29,7 @@ install: script: - cd projects/build - - ctest -V + - ./rxcppv2_test - cd ../.. branches: -- GitLab From f948ab5266bcdc5fd98d9536499fdd9798ca45ac Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 16 Oct 2014 12:43:02 +0400 Subject: [PATCH 448/782] Travis compiling is repaired: 1. Use GCC 4.8.1. Note: - 4.8.2 causes run time error. 2. Use Clang 3.5 + GCC 4.8.1 libraries. Notes: - Libs from 4.8.2 cause run time error; - Clang 3.6 is incompatible with 4.8.2 libs; - Travis used Clang 3.4 earlier: the old script did not work, it was just installing clang 3.6 and not selecting it. 3. Reduce number of compiling threads to 2 - Travis VMs sometimes go out of memory on 4 threads. --- .travis.yml | 3 ++- projects/scripts/travis-install.sh | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc9a026..cb701d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,10 +21,11 @@ before_install: - sh projects/scripts/travis-install.sh install: + - export PATH=/usr/bin:$PATH - cd projects - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX - cd build - - make -j4 + - make -j2 - cd ../.. script: diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index ef64661..950e8e7 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -15,13 +15,12 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev if [ "$CC" = clang ]; then - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.6 - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 20 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 20 + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.5 + sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 fi if [ "$CC" = gcc ]; then - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing gcc-4.8 g++-4.8 + sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 gcc-4.8=4.8.1-2ubuntu1~12.04 g++-4.8=4.8.1-2ubuntu1~12.04 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 fi -- GitLab From 84abdaf85035ce63c2390d03ae2d8e9ceca8a689 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 10 Nov 2014 07:51:01 -0800 Subject: [PATCH 449/782] #41 - scan on_subscribe should be const --- Rx/v2/src/rxcpp/operators/rx-scan.hpp | 2 +- Rx/v2/test/operators/scan.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp index 12c4b2f..1b45437 100644 --- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -45,7 +45,7 @@ struct scan : public operator_base::type> static_assert(std::is_convertible(0)), seed_type>::value, "scan Accumulator must be a function with the signature Seed(Seed, T)"); } template - void on_subscribe(Subscriber o) { + void on_subscribe(Subscriber o) const { struct scan_state_type : public scan_initial_type , public std::enable_shared_from_this diff --git a/Rx/v2/test/operators/scan.cpp b/Rx/v2/test/operators/scan.cpp index 9d60d11..0645c87 100644 --- a/Rx/v2/test/operators/scan.cpp +++ b/Rx/v2/test/operators/scan.cpp @@ -5,6 +5,22 @@ namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" #include "catch.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(); -- GitLab From c257c0574795cd2ac5f7c67782e1b6048c715f7f Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 10 Nov 2014 08:43:25 -0800 Subject: [PATCH 450/782] #39 - race on function static causes AV This moves function statics to class statics. Side effect is that the event_loop threads are started even if they are not used. A future change might make event_loop thread creation lazy. --- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 7 +++++-- Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp | 7 +++++-- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 7 +++++-- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 8 ++++++-- Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp | 3 +-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 3c7bb90..64ae60b 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -248,11 +248,14 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(std::move(cs), wi); } + const static scheduler instance; }; +//static +RXCPP_SELECT_ANY const scheduler current_thread::instance = make_scheduler(); + inline const scheduler& make_current_thread() { - static auto ct = make_scheduler(); - return ct; + return current_thread::instance; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp index fc8deb7..b5adf5b 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp @@ -93,11 +93,14 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(cs, std::shared_ptr(new loop_worker(cs, loops[++count % loops.size()]))); } + const static scheduler instance; }; +//static +RXCPP_SELECT_ANY const scheduler event_loop::instance = make_scheduler(); + inline scheduler make_event_loop() { - static auto loop = make_scheduler(); - return loop; + return event_loop::instance; } inline scheduler make_event_loop(thread_factory tf) { return make_scheduler(tf); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index 73592ec..c990837 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -70,11 +70,14 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(std::move(cs), wi); } + const static scheduler instance; }; +//static +RXCPP_SELECT_ANY const scheduler immediate::instance = make_scheduler(); + inline const scheduler& make_immediate() { - static auto i = make_scheduler(); - return i; + return immediate::instance; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index 4144053..4d60cb6 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -162,11 +162,15 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(cs, std::shared_ptr(new new_worker(cs, factory))); } + + const static scheduler instance; }; +//static +RXCPP_SELECT_ANY const scheduler new_thread::instance = make_scheduler(); + inline scheduler make_new_thread() { - static auto nt = make_scheduler(); - return nt; + return new_thread::instance; } inline scheduler make_new_thread(thread_factory tf) { return make_scheduler(tf); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp index 5b3ff4e..4bfbd0b 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-sameworker.hpp @@ -42,8 +42,7 @@ public: }; inline scheduler make_same_worker(rxsc::worker w) { - auto i = make_scheduler(std::move(w)); - return i; + return make_scheduler(std::move(w)); } } -- GitLab From 290b645e253303d703cb89865feadd3ccb65f524 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Mon, 10 Nov 2014 08:50:11 -0800 Subject: [PATCH 451/782] ignore apt errors --- projects/scripts/travis-install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 950e8e7..9216297 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -12,17 +12,17 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo apt-get clean -qq || echo "ignore clean failure" sudo apt-get update -qq || echo "ignore update failure" - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev || echo "ignore install failure" if [ "$CC" = clang ]; then - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.5 - sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.5 || echo "ignore install failure" + sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 || echo "ignore install failure" fi if [ "$CC" = gcc ]; then - sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 gcc-4.8=4.8.1-2ubuntu1~12.04 g++-4.8=4.8.1-2ubuntu1~12.04 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 gcc-4.8=4.8.1-2ubuntu1~12.04 g++-4.8=4.8.1-2ubuntu1~12.04 || echo "ignore install failure" + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 || echo "ignore update failure" + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 || echo "ignore update failure" fi elif [ "$TRAVIS_OS_NAME" = osx ]; then -- GitLab From 37668c96a49e6f5082caa36a0581f1d6b565291b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 11 Nov 2014 17:56:08 -0800 Subject: [PATCH 452/782] fix travis and workaround for libstd++ bug --- .travis.yml | 2 +- Rx/v2/test/test.cpp | 9 +++++++++ ext/catch | 2 +- projects/scripts/travis-install.sh | 25 ++++++++++++++++++++----- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cb701d0..c7f1c83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ install: script: - cd projects/build - - ./rxcppv2_test + - ./rxcppv2_test --success -r compact - cd ../.. branches: diff --git a/Rx/v2/test/test.cpp b/Rx/v2/test/test.cpp index 0c7c351..8fe512e 100644 --- a/Rx/v2/test/test.cpp +++ b/Rx/v2/test/test.cpp @@ -1,2 +1,11 @@ +#include +#if (__GLIBCXX__ / 10000) == 2014 +namespace std { +inline bool uncaught_exception() noexcept(true) { + return current_exception() != nullptr; +} +} +#endif + #define CATCH_CONFIG_MAIN #include "catch.hpp" diff --git a/ext/catch b/ext/catch index 6880a0c..d4e5f18 160000 --- a/ext/catch +++ b/ext/catch @@ -1 +1 @@ -Subproject commit 6880a0c909778e9036b37ac4ddc601eee56b7b39 +Subproject commit d4e5f184369ce34592bb6f89e793bdb22d1d011a diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 9216297..c6f9458 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -15,14 +15,29 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev || echo "ignore install failure" if [ "$CC" = clang ]; then - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.5 || echo "ignore install failure" - sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 || echo "ignore install failure" + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.6 || echo "ignore install failure" + + sudo update-alternatives --remove-all clang || echo "ignore remove failure" + sudo update-alternatives --remove-all clang++ || echo "ignore remove failure" + + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 20 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 20 + + sudo update-alternatives --config clang + sudo update-alternatives --config clang++ fi if [ "$CC" = gcc ]; then - sudo apt-get install --allow-unauthenticated --force-yes --fix-missing libgomp1=4.8.1-2ubuntu1~12.04 libitm1=4.8.1-2ubuntu1~12.04 libatomic1=4.8.1-2ubuntu1~12.04 libasan0=4.8.1-2ubuntu1~12.04 libtsan0=4.8.1-2ubuntu1~12.04 libquadmath0=4.8.1-2ubuntu1~12.04 libstdc++6=4.8.1-2ubuntu1~12.04 gcc-4.8-base=4.8.1-2ubuntu1~12.04 libstdc++-4.8-dev=4.8.1-2ubuntu1~12.04 cpp-4.8=4.8.1-2ubuntu1~12.04 libgcc-4.8-dev=4.8.1-2ubuntu1~12.04 gcc-4.8=4.8.1-2ubuntu1~12.04 g++-4.8=4.8.1-2ubuntu1~12.04 || echo "ignore install failure" - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 || echo "ignore update failure" - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 || echo "ignore update failure" + sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing gcc-4.8 g++-4.8 || echo "ignore install failure" + + sudo update-alternatives --remove-all gcc || echo "ignore remove failure" + sudo update-alternatives --remove-all g++ || echo "ignore remove failure" + + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + + sudo update-alternatives --config gcc + sudo update-alternatives --config g++ fi elif [ "$TRAVIS_OS_NAME" = osx ]; then -- GitLab From f8e6ed64d858b48fa939f6a4f62ba20b8ec684e6 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 20 Oct 2014 17:52:35 +0400 Subject: [PATCH 453/782] Add zip operator including tests --- Rx/v2/src/rxcpp/operators/rx-zip.hpp | 220 +++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 84 +++ Rx/v2/src/rxcpp/rx-operators.hpp | 3 +- Rx/v2/src/rxcpp/rx-util.hpp | 56 ++ Rx/v2/test/operators/zip.1.cpp | 942 ++++++++++++++++++++++++++ Rx/v2/test/operators/zip.2.cpp | 949 +++++++++++++++++++++++++++ projects/CMake/CMakeLists.txt | 2 + 7 files changed, 2255 insertions(+), 1 deletion(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-zip.hpp create mode 100644 Rx/v2/test/operators/zip.1.cpp create mode 100644 Rx/v2/test/operators/zip.2.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp new file mode 100644 index 0000000..d3c3ee7 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -0,0 +1,220 @@ +// 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" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct zip_traits { + typedef std::tuple tuple_source_type; + typedef std::tuple...> tuple_source_values_type; + + typedef typename std::decay::type selector_type; + typedef typename std::decay::type coordination_type; + + struct tag_not_valid {}; + template + static auto check(int) -> decltype((*(CS*)nullptr)((*(CVN*)nullptr)...)); + template + static tag_not_valid check(...); + + static_assert(!std::is_same(0)), tag_not_valid>::value, "zip Selector must be a function with the signature value_type(Observable::value_type...)"); + + typedef decltype(check(0)) value_type; +}; + +template +struct zip : public operator_base::value_type> +{ + typedef zip this_type; + + typedef zip_traits 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 + void subscribe_one(std::shared_ptr state) const { + + typedef typename std::tuple_element::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(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( + state->out, + innercs, + // on_next + [state](source_value_type st) { + auto& values = std::get(state->pending); + values.push_back(st); + auto lne = rxu::list_not_empty(); + auto avt = rxu::all_values_true(); + if (rxu::apply_to_each(state->pending, lne, avt)) { + //if (rxu::apply_to_each(state->pending, rxu::list_not_empty(), rxu::all_values_true())) { + auto selectedResult = on_exception( + [&](){ + auto elf = rxu::extract_list_front(); + return rxu::apply_to_each(state->pending, elf, state->selector); + //return rxu::apply_to_each(state->pending, rxu::extract_list_front(), state->selector); + }, + state->out); + if (selectedResult.empty()) { + return; + } + state->out.on_next(selectedResult.get()); + } + }, + // on_error + [state](std::exception_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 + void subscribe_all(std::shared_ptr state, rxu::values) const { + bool subscribed[] = {(subscribe_one(state), true)...}; + subscribed[0] = (*subscribed); // silence warning + } + + template + void on_subscribe(Subscriber scbr) const { + static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); + + typedef Subscriber output_type; + + struct zip_state_type + : public std::enable_shared_from_this + , 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::shared_ptr(new zip_state_type(initial, std::move(coordinator), std::move(scbr))); + + subscribe_all(state, typename rxu::values_from::type()); + } +}; + +template +class zip_factory +{ + typedef typename std::decay::type coordination_type; + typedef typename std::decay::type selector_type; + typedef std::tuple tuple_source_type; + + coordination_type coordination; + selector_type selector; + tuple_source_type sourcen; + + template + auto make(std::tuple source) + -> observable::value_type, zip> { + return observable::value_type, zip>( + zip(coordination, selector, std::move(source))); + } +public: + zip_factory(coordination_type sf, selector_type s, ObservableN... on) + : coordination(std::move(sf)) + , selector(std::move(s)) + , sourcen(std::make_tuple(std::move(on)...)) + { + } + + template + auto operator()(Observable source) + -> decltype(make(std::tuple_cat(std::make_tuple(source), *(tuple_source_type*)nullptr))) { + return make(std::tuple_cat(std::make_tuple(source), sourcen)); + } +}; + +} + +template +auto zip(Coordination sf, Selector s, ObservableN... on) + -> detail::zip_factory { + return detail::zip_factory(std::move(sf), std::move(s), std::move(on)...); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 8ca0d57..61ada1a 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -904,6 +904,90 @@ public: return select_combine_latest>{}(*this, std::move(an)...); } + template + struct select_zip_cn : public std::false_type {}; + + template + struct select_zip_cn, typename rxu::types_checked_from::type> + : public std::true_type + { + typedef rxo::detail::zip operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Coordination cn, ObservableN... on) const { + return observable_type(operator_type(std::move(cn), rxu::pack(), std::make_tuple(src, std::move(on)...))); + }; + }; + + template + struct select_zip_cn, typename rxu::types_checked_from::type, typename Coordination::coordination_tag, typename TN::observable_tag...>::type> + : public std::true_type + { + typedef rxo::detail::zip operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Coordination cn, T0 t0, ObservableN... on) const { + return observable_type(operator_type(std::move(cn), std::move(t0), std::make_tuple(src, std::move(on)...))); + }; + }; + + template + struct select_zip : public std::false_type { + template + void operator()(const Source&, T0, T1, TN...) const { + static_assert(is_coordination::value || + is_observable::value || + std::is_convertible>::value + , "T0 must be selector, coordination or observable"); + static_assert(is_observable::value || + std::is_convertible>::value, "T1 must be selector or observable"); + static_assert(rxu::all_true::value...>::value, "TN... must be observable"); + } + template + void operator()(const Source&, T0) const { + static_assert(is_observable::value, "T0 must be observable"); + } + }; + + template + struct select_zip, typename rxu::types_checked_from::type> + : public select_zip_cn> + { + }; + + template + struct select_zip, typename rxu::types_checked_from::type, typename TN::observable_tag...>::type> + : public std::true_type + { + typedef rxo::detail::zip operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, Selector sel, ObservableN... on) const { + return observable_type(operator_type(identity_current_thread(), std::move(sel), std::make_tuple(src, std::move(on)...))); + }; + }; + + template + struct select_zip, typename rxu::types_checked_from::type> + : public std::true_type + { + typedef rxo::detail::zip operator_type; + typedef observable observable_type; + template + observable_type operator()(const Source& src, ObservableN... on) const { + return observable_type(operator_type(identity_current_thread(), rxu::pack(), std::make_tuple(src, std::move(on)...))); + }; + }; + + /// zip -> + /// bring by one item from all given observables and use the Selector to select a value to emit from the new observable that is returned. + /// + template + auto zip(AN... an) const + -> decltype(select_zip>{}(*(this_type*)nullptr, std::move(an)...)) { + return select_zip>{}(*this, std::move(an)...); + } + /// group_by -> /// template diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index b74d7a6..e9c4931 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -54,6 +54,7 @@ namespace rxo=operators; #include "operators/rx-reduce.hpp" #include "operators/rx-ref_count.hpp" #include "operators/rx-repeat.hpp" +#include "operators/rx-retry.hpp" #include "operators/rx-scan.hpp" #include "operators/rx-skip.hpp" #include "operators/rx-skip_until.hpp" @@ -65,5 +66,5 @@ namespace rxo=operators; #include "operators/rx-take_until.hpp" #include "operators/rx-window.hpp" #include "operators/rx-window_time.hpp" -#include "operators/rx-retry.hpp" +#include "operators/rx-zip.hpp" #endif diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 94bbadf..2f9868c 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -87,6 +87,21 @@ struct all_true static const bool value = B0 && all_true::value; }; +struct all_values_true { + template + bool operator()(ValueN... vn); + + template + bool operator()(Value0 v0) { + return v0; + } + + template + bool operator()(Value0 v0, ValueN... vn) { + return v0 && all_values_true()(vn...); + } +}; + template struct types; @@ -128,6 +143,18 @@ auto apply(std::tuple p, values, const F& f) return f(std::forward(std::get(p))...); } +template +auto apply_to_each(std::tuple& p, values, F_inner& f_inner, F_outer& f_outer) + -> decltype(f_outer(f_inner(std::get(p))...)) { + return f_outer(f_inner(std::get(p))...); +} + +template +auto apply_to_each(std::tuple& p, values, const F_inner& f_inner, const F_outer& f_outer) + -> decltype(f_outer(f_inner(std::forward(std::get(p)))...)) { + return f_outer(f_inner(std::forward(std::get(p)))...); +} + } template @@ -141,6 +168,18 @@ auto apply(std::tuple p, const F& f) return detail::apply(std::move(p), typename values_from::type(), f); } +template +auto apply_to_each(std::tuple& p, F_inner& f_inner, F_outer& f_outer) + -> decltype(detail::apply_to_each(p, typename values_from::type(), f_inner, f_outer)) { + return detail::apply_to_each(p, typename values_from::type(), f_inner, f_outer); +} + +template +auto apply_to_each(std::tuple& p, const F_inner& f_inner, const F_outer& f_outer) + -> decltype(detail::apply_to_each(p, typename values_from::type(), f_inner, f_outer)) { + return detail::apply_to_each(p, typename values_from::type(), f_inner, f_outer); +} + namespace detail { template @@ -546,6 +585,23 @@ inline auto surely(const std::tuple& tpl) return apply(tpl, detail::surely()); } +struct list_not_empty { + template + bool operator()(std::list& list) const { + return !list.empty(); + } +}; + +struct extract_list_front { + template + auto operator()(std::list& list) + -> decltype(std::move(list.front())) { + auto val = std::move(list.front()); + list.pop_front(); + return std::move(val); + } +}; + namespace detail { template diff --git a/Rx/v2/test/operators/zip.1.cpp b/Rx/v2/test/operators/zip.1.cpp new file mode 100644 index 0000000..5763177 --- /dev/null +++ b/Rx/v2/test/operators/zip.1.cpp @@ -0,0 +1,942 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.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 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 + .zip( + [](int v2, int v1){ + return v2 + v1; + }, + n2 + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output is empty"){ + auto required = std::vector::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 on; + + const size_t N = 16; + + std::vector> 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] + .zip( + [](int v0, int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15] + ) + // forget type to workaround lambda deduction bug on msvc 2013 + .as_dynamic(); + } + ); + + THEN("the output is empty"){ + auto required = std::vector::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 &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 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::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 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::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 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 on; + + const size_t N = 16; + + std::vector> 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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15){ + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] + ) + // 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 &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 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(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("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 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(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("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 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::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 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::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 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 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 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 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 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 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); + } + } + } +} diff --git a/Rx/v2/test/operators/zip.2.cpp b/Rx/v2/test/operators/zip.2.cpp new file mode 100644 index 0000000..d56cb83 --- /dev/null +++ b/Rx/v2/test/operators/zip.2.cpp @@ -0,0 +1,949 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +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 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 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 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 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]"){ + GIVEN("2 hot observables of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages 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 { + throw 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]"){ + GIVEN("N hot observables of ints."){ + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + + const int N = 16; + + std::runtime_error ex("zip on_error from source"); + + std::vector> 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, int, int, int, int, int, int, int, int, int, int, int) -> int { + throw ex; + }, + e[1], e[2], e[3], e[4], e[5], e[6], e[7], e[8], e[9], e[10], e[11], e[12], e[13], e[14], e[15] + ) + // 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 &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 on; + + const int N = 16; + + std::vector> 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, int v4, int v5, int v6, int v7, int v8, int v9, int v10, int v11, int v12, int v13, int v14, int v15) { + return v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 + v11 + v12 + v13 + v14 + v15; + }, + o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11], o[12], o[13], o[14], o[15] + ) + // 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 &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 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(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("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 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(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("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 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 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 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 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 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 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/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index a065376..e5696f3 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -66,6 +66,8 @@ set(TEST_SOURCES ${TEST_DIR}/operators/take.cpp ${TEST_DIR}/operators/take_until.cpp ${TEST_DIR}/operators/window.cpp + ${TEST_DIR}/operators/zip.1.cpp + ${TEST_DIR}/operators/zip.2.cpp ) add_executable(rxcppv2_test ${TEST_SOURCES}) TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) -- GitLab From 537a7d5ba5df2a2781ca4407133f00e2ae2e57c0 Mon Sep 17 00:00:00 2001 From: vkopylov Date: Tue, 21 Oct 2014 02:32:34 -0700 Subject: [PATCH 454/782] Clang compilation fixes --- Rx/v2/test/operators/zip.1.cpp | 4 ++-- Rx/v2/test/operators/zip.2.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/test/operators/zip.1.cpp b/Rx/v2/test/operators/zip.1.cpp index 5763177..a1313c6 100644 --- a/Rx/v2/test/operators/zip.1.cpp +++ b/Rx/v2/test/operators/zip.1.cpp @@ -69,7 +69,7 @@ SCENARIO("zip never N", "[zip][join][operators]"){ const size_t N = 16; std::vector> n; - for (int i = 0; i < N; ++i) { + for (size_t i = 0; i < N; ++i) { n.push_back( sc.make_hot_observable({ on.next(150, 1) @@ -293,7 +293,7 @@ SCENARIO("zip empty N", "[zip][join][operators]"){ const size_t N = 16; std::vector> e; - for (int i = 0; i < N; ++i) { + for (size_t i = 0; i < N; ++i) { e.push_back( sc.make_hot_observable({ on.next(150, 1), diff --git a/Rx/v2/test/operators/zip.2.cpp b/Rx/v2/test/operators/zip.2.cpp index d56cb83..38eaec7 100644 --- a/Rx/v2/test/operators/zip.2.cpp +++ b/Rx/v2/test/operators/zip.2.cpp @@ -322,12 +322,12 @@ SCENARIO("zip selector throws N", "[zip][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const int N = 16; + const size_t N = 16; std::runtime_error ex("zip on_error from source"); std::vector> e; - for (int i = 0; i < N; ++i) { + for (size_t i = 0; i < N; ++i) { e.push_back( sc.make_hot_observable({ on.next(210 + 10 * i, 1), @@ -380,10 +380,10 @@ SCENARIO("zip typical N", "[zip][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const int N = 16; + const size_t N = 16; std::vector> o; - for (int i = 0; i < N; ++i) { + for (size_t i = 0; i < N; ++i) { o.push_back( sc.make_hot_observable({ on.next(150, 1), -- GitLab From a9391dec38be90bd16c047353e8acea539c4c688 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Wed, 12 Nov 2014 11:56:53 +0300 Subject: [PATCH 455/782] Disable clang optimization that spoils value extracted from list. --- Rx/v2/src/rxcpp/rx-util.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 2f9868c..08310c8 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -594,6 +594,9 @@ struct list_not_empty { struct extract_list_front { template +#ifdef __clang__ + [[clang::optnone]] +#endif auto operator()(std::list& list) -> decltype(std::move(list.front())) { auto val = std::move(list.front()); -- GitLab From 9f8b290bfcf6409dfad6c62089aa0cb1748b1fea Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 13 Nov 2014 13:42:54 +0300 Subject: [PATCH 456/782] [[clang::optnone]] attribute doesn't work on OSX Check whether it is required there at all. --- Rx/v2/src/rxcpp/rx-util.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 08310c8..e51d151 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -594,7 +594,7 @@ struct list_not_empty { struct extract_list_front { template -#ifdef __clang__ +#if defined(__clang__) && defined(__linux__) [[clang::optnone]] #endif auto operator()(std::list& list) -- GitLab From f90dee60427f4b99870b8668ed0e9807f8474d0d Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Thu, 13 Nov 2014 13:59:30 +0300 Subject: [PATCH 457/782] optnone is required for OSX Clang Try to pass it in old fashion. --- Rx/v2/src/rxcpp/rx-util.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index e51d151..b5c3d13 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -594,8 +594,8 @@ struct list_not_empty { struct extract_list_front { template -#if defined(__clang__) && defined(__linux__) - [[clang::optnone]] +#if defined(__clang__) + __attribute__((optnone)) #endif auto operator()(std::list& list) -> decltype(std::move(list.front())) { -- GitLab From f62887a969186c2a2d1671a89a63cabe73d7add0 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 17 Nov 2014 15:49:26 +0300 Subject: [PATCH 458/782] Clean zip sources --- Rx/v2/src/rxcpp/operators/rx-zip.hpp | 9 ++------- Rx/v2/src/rxcpp/rx-util.hpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp index d3c3ee7..a391c48 100644 --- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -94,15 +94,10 @@ struct zip : public operator_base(state->pending); values.push_back(st); - auto lne = rxu::list_not_empty(); - auto avt = rxu::all_values_true(); - if (rxu::apply_to_each(state->pending, lne, avt)) { - //if (rxu::apply_to_each(state->pending, rxu::list_not_empty(), rxu::all_values_true())) { + if (rxu::apply_to_each(state->pending, rxu::list_not_empty(), rxu::all_values_true())) { auto selectedResult = on_exception( [&](){ - auto elf = rxu::extract_list_front(); - return rxu::apply_to_each(state->pending, elf, state->selector); - //return rxu::apply_to_each(state->pending, rxu::extract_list_front(), state->selector); + return rxu::apply_to_each(state->pending, rxu::extract_list_front(), state->selector); }, state->out); if (selectedResult.empty()) { diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index b5c3d13..7a83b7d 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -89,15 +89,15 @@ struct all_true struct all_values_true { template - bool operator()(ValueN... vn); + bool operator()(ValueN... vn) const; template - bool operator()(Value0 v0) { + bool operator()(Value0 v0) const { return v0; } template - bool operator()(Value0 v0, ValueN... vn) { + bool operator()(Value0 v0, ValueN... vn) const { return v0 && all_values_true()(vn...); } }; @@ -145,14 +145,14 @@ auto apply(std::tuple p, values, const F& f) template auto apply_to_each(std::tuple& p, values, F_inner& f_inner, F_outer& f_outer) - -> decltype(f_outer(f_inner(std::get(p))...)) { - return f_outer(f_inner(std::get(p))...); + -> decltype(f_outer(std::move(f_inner(std::get(p)))...)) { + return f_outer(std::move(f_inner(std::get(p)))...); } template auto apply_to_each(std::tuple& p, values, const F_inner& f_inner, const F_outer& f_outer) - -> decltype(f_outer(f_inner(std::forward(std::get(p)))...)) { - return f_outer(f_inner(std::forward(std::get(p)))...); + -> decltype(f_outer(std::move(f_inner(std::get(p)))...)) { + return f_outer(std::move(f_inner(std::get(p)))...); } } @@ -597,7 +597,7 @@ struct extract_list_front { #if defined(__clang__) __attribute__((optnone)) #endif - auto operator()(std::list& list) + auto operator()(std::list& list) const -> decltype(std::move(list.front())) { auto val = std::move(list.front()); list.pop_front(); -- GitLab From 58ce1c8dcbb336785617caa1d6842f07f2ae20b3 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Mon, 17 Nov 2014 18:36:10 +0300 Subject: [PATCH 459/782] Disable clang optimization on extract_list_front() for OSX --- Rx/v2/src/rxcpp/rx-util.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 7a83b7d..172720c 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -593,15 +593,24 @@ struct list_not_empty { }; struct extract_list_front { + // Clang optimisation loses moved list.front() value after list.pop_front(), so optimization must be switched off. template -#if defined(__clang__) +#if defined(__clang__) && defined(__linux__) + // Clang on Linux has an attribute to forbid optimization __attribute__((optnone)) #endif auto operator()(std::list& list) const -> decltype(std::move(list.front())) { +#if defined(__clang__) && !defined(__linux__) + // Clang on OSX doesn't support the attribute + volatile auto val = std::move(list.front()); + list.pop_front(); + return std::move(const_cast(val)); +#else auto val = std::move(list.front()); list.pop_front(); return std::move(val); +#endif } }; -- GitLab From 725017e02ee7df9f6998de8eee7baee62e6dc756 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 18 Nov 2014 12:04:34 +0300 Subject: [PATCH 460/782] Add buffer/window with time&count operators including tests --- .../rxcpp/operators/rx-buffer_time_count.hpp | 146 ++++++++++++++ .../rxcpp/operators/rx-window_time_count.hpp | 147 ++++++++++++++ Rx/v2/src/rxcpp/rx-observable.hpp | 35 ++++ Rx/v2/src/rxcpp/rx-operators.hpp | 2 + Rx/v2/test/operators/buffer.cpp | 171 ++++++++++++++++ Rx/v2/test/operators/window.cpp | 186 ++++++++++++++++++ 6 files changed, 687 insertions(+) create mode 100644 Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp create mode 100644 Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp new file mode 100644 index 0000000..ef12662 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -0,0 +1,146 @@ +// 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_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 +struct buffer_with_time_or_count +{ + static_assert(std::is_convertible::value, "Duration parameter must convert to rxsc::scheduler::clock_type::duration"); + static_assert(is_coordination::value, "Coordination parameter must satisfy the requirements for a Coordination"); + + typedef typename std::decay::type source_value_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + typedef typename std::decay::type 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 + struct buffer_with_time_or_count_observer : public buffer_with_time_or_count_values + { + typedef buffer_with_time_or_count_observer this_type; + typedef std::vector value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable int number; + mutable int chunk_id; + mutable value_type chunk; + + buffer_with_time_or_count_observer(dest_type d, buffer_with_time_or_count_values v, coordinator_type c) + : buffer_with_time_or_count_values(v) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + , number(0) + , chunk_id(0) + { + auto new_id = chunk_id; + auto produce_time = worker.now() + period; + worker.schedule(produce_time, [=](const rxsc::schedulable&){produce_buffer(new_id, produce_time);}); + } + + void produce_buffer(int id, rxsc::scheduler::clock_type::time_point expected) const { + if (id != chunk_id) + return; + + dest.on_next(chunk); + chunk.resize(0); + number = 0; + auto new_id = ++chunk_id; + auto produce_time = expected + period; + worker.schedule(produce_time, [=](const rxsc::schedulable&){produce_buffer(new_id, produce_time);}); + } + + void on_next(T v) const { + chunk.push_back(v); + if (++number == count) { + produce_buffer(chunk_id, worker.now()); + } + } + void on_error(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_next(chunk); + chunk_id += 1; + dest.on_completed(); + } + + static subscriber> make(dest_type d, buffer_with_time_or_count_values v) { + auto cs = d.get_subscription(); + auto coordinator = v.coordination.create_coordinator(cs); + + return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v), std::move(coordinator))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(buffer_with_time_or_count_observer::make(std::move(dest), initial)) { + return buffer_with_time_or_count_observer::make(std::move(dest), initial); + } +}; + +template +class buffer_with_time_or_count_factory +{ + typedef typename std::decay::type duration_type; + typedef typename std::decay::type coordination_type; + + duration_type period; + duration_type skip; + coordination_type coordination; +public: + buffer_with_time_or_count_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} + template + auto operator()(Observable&& source) + -> decltype(source.template lift::type::value_type>>(buffer_with_time_or_count::type::value_type, Duration, Coordination>(period, skip, coordination))) { + return source.template lift::type::value_type>>(buffer_with_time_or_count::type::value_type, Duration, Coordination>(period, skip, coordination)); + } +}; + +} + +template +inline auto buffer_with_time_or_count(Duration period, int count, Coordination coordination) + -> detail::buffer_with_time_or_count_factory { + return detail::buffer_with_time_or_count_factory(period, count, 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 new file mode 100644 index 0000000..ef2f13e --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -0,0 +1,147 @@ +// 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_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 +struct window_with_time_or_count +{ + typedef typename std::decay::type source_value_type; + typedef typename std::decay::type coordination_type; + typedef typename coordination_type::coordinator_type coordinator_type; + typedef typename std::decay::type 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 + struct window_with_time_or_count_observer : public window_with_time_or_count_values, public observer_base> + { + typedef window_with_time_or_count_observer this_type; + typedef observer_base> base_type; + typedef typename base_type::value_type value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable int number; + mutable int subj_id; + mutable rxcpp::subjects::subject subj; + + window_with_time_or_count_observer(dest_type d, window_with_time_or_count_values v, coordinator_type c) + : window_with_time_or_count_values(v) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + , number(0) + , subj_id(0) + { + dest.on_next(subj.get_observable().as_dynamic()); + auto new_id = subj_id; + auto produce_time = worker.now() + period; + worker.schedule(produce_time, [=](const rxsc::schedulable&){release_window(new_id, produce_time);}); + } + + void release_window(int id, rxsc::scheduler::clock_type::time_point expected) const { + if (id != subj_id) + return; + + subj.get_subscriber().on_completed(); + subj = rxcpp::subjects::subject(); + dest.on_next(subj.get_observable().as_dynamic()); + number = 0; + auto new_id = ++subj_id; + auto produce_time = expected + period; + worker.schedule(produce_time, [=](const rxsc::schedulable&){release_window(new_id, produce_time);}); + } + + void on_next(T v) const { + subj.get_subscriber().on_next(v); + if (++number == count) { + release_window(subj_id, worker.now()); + } + } + + void on_error(std::exception_ptr e) const { + subj.get_subscriber().on_error(e); + dest.on_error(e); + } + + void on_completed() const { + subj.get_subscriber().on_completed(); + dest.on_completed(); + } + + static subscriber make(dest_type d, window_with_time_or_count_values v) { + auto cs = d.get_subscription(); + auto coordinator = v.coordination.create_coordinator(cs); + + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v), std::move(coordinator)))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(window_with_time_or_count_observer::make(std::move(dest), initial)) { + return window_with_time_or_count_observer::make(std::move(dest), initial); + } +}; + +template +class window_with_time_or_count_factory +{ + typedef typename std::decay::type duration_type; + typedef typename std::decay::type coordination_type; + + duration_type period; + int count; + coordination_type coordination; +public: + window_with_time_or_count_factory(duration_type p, int n, coordination_type c) : period(p), count(n), coordination(c) {} + template + auto operator()(Observable&& source) + -> decltype(source.template lift::type::value_type>>(window_with_time_or_count::type::value_type, Duration, Coordination>(period, count, coordination))) { + return source.template lift::type::value_type>>(window_with_time_or_count::type::value_type, Duration, Coordination>(period, count, coordination)); + } +}; + +} + +template +inline auto window_with_time_or_count(Duration period, int count, Coordination coordination) + -> detail::window_with_time_or_count_factory { + return detail::window_with_time_or_count_factory(period, count, coordination); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 61ada1a..c9efdc8 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -558,6 +558,24 @@ public: return lift>(rxo::detail::window_with_time(period, period, identity_current_thread())); } + /// window_with_time_or_count -> + /// produce observables every skip time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time_or_count(Duration period, int count, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time_or_count(period, count, coordination))) { + return lift>(rxo::detail::window_with_time_or_count(period, count, coordination)); + } + + /// window_with_time_or_count -> + /// produce observables every skip time interval and collect items from this observable for period of time into each produced observable. + /// + template + auto window_with_time_or_count(Duration period, int count) const + -> decltype(EXPLICIT_THIS lift>(rxo::detail::window_with_time_or_count(period, count, identity_current_thread()))) { + return lift>(rxo::detail::window_with_time_or_count(period, count, identity_current_thread())); + } + /// buffer -> /// collect count items from this observable and produce a vector of them to emit from the new observable that is returned. /// @@ -609,6 +627,23 @@ public: return lift_if>(rxo::detail::buffer_with_time(period, period, identity_current_thread())); } + /// buffer_with_time_or_count -> + /// start a new vector every skip time interval and collect items into it from this observable for period of time. + /// + template + auto buffer_with_time_or_count(rxsc::scheduler::clock_type::duration period, int count, Coordination coordination) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time_or_count(period, count, coordination))) { + return lift_if>(rxo::detail::buffer_with_time_or_count(period, count, coordination)); + } + + /// buffer_with_time_or_count -> + /// start a new vector every skip time interval and collect items into it from this observable for period of time. + /// + auto buffer_with_time_or_count(rxsc::scheduler::clock_type::duration period, int count) const + -> decltype(EXPLICIT_THIS lift_if>(rxo::detail::buffer_with_time_or_count(period, count, identity_current_thread()))) { + return lift_if>(rxo::detail::buffer_with_time_or_count(period, count, identity_current_thread())); + } + template struct defer_switch_on_next : public defer_observable< is_observable, diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index e9c4931..37f443e 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -36,6 +36,7 @@ namespace rxo=operators; #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" @@ -66,5 +67,6 @@ namespace rxo=operators; #include "operators/rx-take_until.hpp" #include "operators/rx-window.hpp" #include "operators/rx-window_time.hpp" +#include "operators/rx-window_time_count.hpp" #include "operators/rx-zip.hpp" #endif diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index b3103ea..62bd1bd 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -954,3 +954,174 @@ SCENARIO("buffer with time, same", "[buffer_with_time][operators]"){ } } } + +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 on; + const rxsc::test::messages> 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(); + } + ); + + THEN("the output contains groups of ints"){ + auto required = rxu::to_vector({ + v_on.next(240, rxu::to_vector({ 1, 2, 3 })), + v_on.next(310, rxu::to_vector({ 4 })), + v_on.next(370, rxu::to_vector({ 5, 6, 7 })), + v_on.next(440, rxu::to_vector({ 8 })), + v_on.next(510, rxu::to_vector({ 9 })), + v_on.next(580, std::vector()), + v_on.next(600, std::vector()), + 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 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 on; + const rxsc::test::messages> 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(240, rxu::to_vector({ 1, 2, 3 })), + v_on.next(310, rxu::to_vector({ 4 })), + v_on.next(370, rxu::to_vector({ 5, 6, 7 })), + v_on.next(440, rxu::to_vector({ 8 })), + v_on.next(510, rxu::to_vector({ 9 })), + v_on.next(580, std::vector()), + 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 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 on; + const rxsc::test::messages> 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(); + }, + 370 + ); + + THEN("the output contains groups of ints"){ + auto required = rxu::to_vector({ + v_on.next(240, rxu::to_vector({ 1, 2, 3 })), + v_on.next(310, rxu::to_vector({ 4 })), + v_on.next(370, 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, 370) + }); + auto actual = xs.subscriptions(); + REQUIRE(required == actual); + } + } + } +} diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index 141a07c..931f694 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -748,3 +748,189 @@ SCENARIO("window with time, basic same 1", "[window_with_time][operators]"){ } } } + +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 on; + const rxsc::test::messages> 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(); + } + ); + + THEN("the output contains merged groups of ints"){ + auto required = rxu::to_vector({ + 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) + }); + 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 on; + const rxsc::test::messages> 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(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) + }); + 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 on; + const rxsc::test::messages> 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(); + }, + 370 + ); + + THEN("the output contains merged groups of ints"){ + auto required = rxu::to_vector({ + 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) + }); + 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); + } + } + } +} -- GitLab From 83c60a85399be619ffc52154c8ef805052d9d436 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Tue, 18 Nov 2014 12:21:59 +0300 Subject: [PATCH 461/782] Clean buffer/window code --- Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp | 10 +++------- Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index ef12662..e8b49be 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -2,8 +2,8 @@ #pragma once -#if !defined(RXCPP_OPERATORS_RX_buffer_with_time_or_count_HPP) -#define RXCPP_OPERATORS_RX_buffer_with_time_or_count_HPP +#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" @@ -54,7 +54,6 @@ struct buffer_with_time_or_count dest_type dest; coordinator_type coordinator; rxsc::worker worker; - mutable int number; mutable int chunk_id; mutable value_type chunk; @@ -63,7 +62,6 @@ struct buffer_with_time_or_count , dest(std::move(d)) , coordinator(std::move(c)) , worker(std::move(coordinator.get_worker())) - , number(0) , chunk_id(0) { auto new_id = chunk_id; @@ -77,7 +75,6 @@ struct buffer_with_time_or_count dest.on_next(chunk); chunk.resize(0); - number = 0; auto new_id = ++chunk_id; auto produce_time = expected + period; worker.schedule(produce_time, [=](const rxsc::schedulable&){produce_buffer(new_id, produce_time);}); @@ -85,7 +82,7 @@ struct buffer_with_time_or_count void on_next(T v) const { chunk.push_back(v); - if (++number == count) { + if (int(chunk.size()) == count) { produce_buffer(chunk_id, worker.now()); } } @@ -94,7 +91,6 @@ struct buffer_with_time_or_count } void on_completed() const { dest.on_next(chunk); - chunk_id += 1; dest.on_completed(); } diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index ef2f13e..95a2aeb 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -51,7 +51,7 @@ struct window_with_time_or_count dest_type dest; coordinator_type coordinator; rxsc::worker worker; - mutable int number; + mutable int cursor; mutable int subj_id; mutable rxcpp::subjects::subject subj; @@ -60,7 +60,7 @@ struct window_with_time_or_count , dest(std::move(d)) , coordinator(std::move(c)) , worker(std::move(coordinator.get_worker())) - , number(0) + , cursor(0) , subj_id(0) { dest.on_next(subj.get_observable().as_dynamic()); @@ -76,7 +76,7 @@ struct window_with_time_or_count subj.get_subscriber().on_completed(); subj = rxcpp::subjects::subject(); dest.on_next(subj.get_observable().as_dynamic()); - number = 0; + cursor = 0; auto new_id = ++subj_id; auto produce_time = expected + period; worker.schedule(produce_time, [=](const rxsc::schedulable&){release_window(new_id, produce_time);}); @@ -84,7 +84,7 @@ struct window_with_time_or_count void on_next(T v) const { subj.get_subscriber().on_next(v); - if (++number == count) { + if (++cursor == count) { release_window(subj_id, worker.now()); } } -- GitLab From afb7f6263f72c4feaded6d6a34c2be7fba197ba2 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Fri, 21 Nov 2014 12:11:35 +0300 Subject: [PATCH 462/782] Fix accessing to non-existed instance issue on buffer/windows with time&count * Move class data to state object * Do not use pointer to this inside lambda * Add test for time only triggered buffer/window --- .../rxcpp/operators/rx-buffer_time_count.hpp | 69 ++++++++++------ .../rxcpp/operators/rx-window_time_count.hpp | 82 +++++++++++-------- Rx/v2/test/operators/buffer.cpp | 54 ++++++++++++ Rx/v2/test/operators/window.cpp | 54 ++++++++++++ 4 files changed, 199 insertions(+), 60 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index e8b49be..ea4d608 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -44,54 +44,69 @@ struct buffer_with_time_or_count } template - struct buffer_with_time_or_count_observer : public buffer_with_time_or_count_values + struct buffer_with_time_or_count_observer { typedef buffer_with_time_or_count_observer this_type; typedef std::vector value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; - dest_type dest; - coordinator_type coordinator; - rxsc::worker worker; - mutable int chunk_id; - mutable value_type chunk; + struct buffer_with_time_or_count_subscriber_values : public buffer_with_time_or_count_values + { + buffer_with_time_or_count_subscriber_values(dest_type d, buffer_with_time_or_count_values v, coordinator_type c) + : buffer_with_time_or_count_values(std::move(v)) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + , chunk_id(0) + { + } + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable int chunk_id; + mutable value_type chunk; + }; + typedef std::shared_ptr state_type; + state_type state; buffer_with_time_or_count_observer(dest_type d, buffer_with_time_or_count_values v, coordinator_type c) - : buffer_with_time_or_count_values(v) - , dest(std::move(d)) - , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) - , chunk_id(0) + : state(std::make_shared(buffer_with_time_or_count_subscriber_values(std::move(d), std::move(v), std::move(c)))) { - auto new_id = chunk_id; - auto produce_time = worker.now() + period; - worker.schedule(produce_time, [=](const rxsc::schedulable&){produce_buffer(new_id, produce_time);}); + auto new_id = state->chunk_id; + auto produce_time = state->worker.now() + state->period; + auto localState = state; + state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ + produce_buffer(new_id, produce_time, localState); + }); } - void produce_buffer(int id, rxsc::scheduler::clock_type::time_point expected) const { - if (id != chunk_id) + static void produce_buffer(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) { + if (id != state->chunk_id) return; - dest.on_next(chunk); - chunk.resize(0); - auto new_id = ++chunk_id; - auto produce_time = expected + period; - worker.schedule(produce_time, [=](const rxsc::schedulable&){produce_buffer(new_id, produce_time);}); + state->dest.on_next(state->chunk); + state->chunk.resize(0); + auto new_id = ++state->chunk_id; + auto produce_time = expected + state->period; + auto localState = state; + state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ + produce_buffer(new_id, produce_time, localState); + }); } void on_next(T v) const { - chunk.push_back(v); - if (int(chunk.size()) == count) { - produce_buffer(chunk_id, worker.now()); + state->chunk.push_back(v); + if (int(state->chunk.size()) == state->count) { + produce_buffer(state->chunk_id, state->worker.now(), state); } } void on_error(std::exception_ptr e) const { - dest.on_error(e); + state->dest.on_error(e); } void on_completed() const { - dest.on_next(chunk); - dest.on_completed(); + state->dest.on_next(state->chunk); + state->dest.on_completed(); } static subscriber> make(dest_type d, buffer_with_time_or_count_values v) { diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index 95a2aeb..a3e45f4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -41,62 +41,78 @@ struct window_with_time_or_count } template - struct window_with_time_or_count_observer : public window_with_time_or_count_values, public observer_base> + struct window_with_time_or_count_observer : public observer_base> { typedef window_with_time_or_count_observer this_type; typedef observer_base> base_type; typedef typename base_type::value_type value_type; typedef typename std::decay::type dest_type; typedef observer observer_type; - dest_type dest; - coordinator_type coordinator; - rxsc::worker worker; - mutable int cursor; - mutable int subj_id; - mutable rxcpp::subjects::subject subj; + + struct window_with_time_or_count_subscriber_values : public window_with_time_or_count_values + { + window_with_time_or_count_subscriber_values(dest_type d, window_with_time_or_count_values v, coordinator_type c) + : window_with_time_or_count_values(std::move(v)) + , dest(std::move(d)) + , coordinator(std::move(c)) + , worker(std::move(coordinator.get_worker())) + , cursor(0) + , subj_id(0) + { + } + dest_type dest; + coordinator_type coordinator; + rxsc::worker worker; + mutable int cursor; + mutable int subj_id; + mutable rxcpp::subjects::subject subj; + }; + typedef std::shared_ptr state_type; + state_type state; window_with_time_or_count_observer(dest_type d, window_with_time_or_count_values v, coordinator_type c) - : window_with_time_or_count_values(v) - , dest(std::move(d)) - , coordinator(std::move(c)) - , worker(std::move(coordinator.get_worker())) - , cursor(0) - , subj_id(0) + : state(std::make_shared(window_with_time_or_count_subscriber_values(std::move(d), std::move(v), std::move(c)))) { - dest.on_next(subj.get_observable().as_dynamic()); - auto new_id = subj_id; - auto produce_time = worker.now() + period; - worker.schedule(produce_time, [=](const rxsc::schedulable&){release_window(new_id, produce_time);}); + state->dest.on_next(state->subj.get_observable().as_dynamic()); + auto new_id = state->subj_id; + auto produce_time = state->worker.now() + state->period; + auto localState = state; + state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ + release_window(new_id, produce_time, localState); + }); } - void release_window(int id, rxsc::scheduler::clock_type::time_point expected) const { - if (id != subj_id) + static void release_window(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) { + if (id != state->subj_id) return; - subj.get_subscriber().on_completed(); - subj = rxcpp::subjects::subject(); - dest.on_next(subj.get_observable().as_dynamic()); - cursor = 0; - auto new_id = ++subj_id; - auto produce_time = expected + period; - worker.schedule(produce_time, [=](const rxsc::schedulable&){release_window(new_id, produce_time);}); + state->subj.get_subscriber().on_completed(); + state->subj = rxcpp::subjects::subject(); + 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; + auto localState = state; + state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ + release_window(new_id, produce_time, localState); + }); } void on_next(T v) const { - subj.get_subscriber().on_next(v); - if (++cursor == count) { - release_window(subj_id, worker.now()); + state->subj.get_subscriber().on_next(v); + if (++state->cursor == state->count) { + release_window(state->subj_id, state->worker.now(), state); } } void on_error(std::exception_ptr e) const { - subj.get_subscriber().on_error(e); - dest.on_error(e); + state->subj.get_subscriber().on_error(e); + state->dest.on_error(e); } void on_completed() const { - subj.get_subscriber().on_completed(); - dest.on_completed(); + state->subj.get_subscriber().on_completed(); + state->dest.on_completed(); } static subscriber make(dest_type d, window_with_time_or_count_values v) { diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index 62bd1bd..5f97583 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -1125,3 +1125,57 @@ SCENARIO("buffer with time or count, dispose", "[buffer_with_time_or_count][oper } } } + +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 on; + const rxsc::test::messages> 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(300, rxu::to_vector({ 1 })), + v_on.next(400, rxu::to_vector({ 2 })), + v_on.next(500, std::vector()), + v_on.next(600, rxu::to_vector({ 3 })), + v_on.next(700, rxu::to_vector({ 4, 5 })), + v_on.next(800, std::vector()), + v_on.next(850, std::vector()), + v_on.completed(850) + }); + 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/window.cpp b/Rx/v2/test/operators/window.cpp index 931f694..f7b0e78 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -934,3 +934,57 @@ SCENARIO("window with time or count, disposed", "[window_with_time_or_count][ope } } } + +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 on; + const rxsc::test::messages> 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(205, 1), + on.next(305, 2), + on.next(505, 3), + on.next(605, 4), + on.next(610, 5), + on.completed(850) + }); + 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); + } + } + } +} -- GitLab From e283ca7fcfd9ec594543e26590e1eaac629060cc Mon Sep 17 00:00:00 2001 From: Andreas Reischuck Date: Fri, 14 Nov 2014 20:26:41 +0100 Subject: [PATCH 463/782] added markdown code syntax hints --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ed8a4f3..bcdc3b3 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ 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 13 -``` +```batch mkdir projects\build cd projects\build cmake -G"Visual Studio 12" ..\CMake -B. @@ -48,7 +48,7 @@ cmake -G"Visual Studio 12" ..\CMake -B. ###makefile builds ####OSX -``` +```shell mkdir projects/build cd projects/build cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake @@ -56,7 +56,7 @@ 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 -B. ../CMake @@ -64,7 +64,7 @@ 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 @@ -72,7 +72,7 @@ make ``` ####Windows -``` +```batch mkdir projects\build cd projects\build cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ..\CMake @@ -93,7 +93,7 @@ Example of by-tag #Using RxCpp Add ```Rx/v2/src``` to the include paths -``` +```cpp #include "rxcpp/rx.hpp" // create alias' to simplify code // these are owned by the user so that -- GitLab From 262a3b48dc44114c53504c48d67c03dfc218fc60 Mon Sep 17 00:00:00 2001 From: Tim Cheeseman Date: Mon, 26 Jan 2015 18:51:42 -0500 Subject: [PATCH 464/782] Implement pairwise operator --- Rx/v2/src/rxcpp/operators/rx-pairwise.hpp | 86 +++++++++++++++++++++++ Rx/v2/src/rxcpp/rx-includes.hpp | 1 + Rx/v2/src/rxcpp/rx-observable.hpp | 9 ++- Rx/v2/src/rxcpp/rx-operators.hpp | 1 + Rx/v2/test/operators/pairwise.cpp | 50 +++++++++++++ projects/CMake/CMakeLists.txt | 1 + 6 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 Rx/v2/src/rxcpp/operators/rx-pairwise.hpp create mode 100644 Rx/v2/test/operators/pairwise.cpp diff --git a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp new file mode 100644 index 0000000..582aba5 --- /dev/null +++ b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp @@ -0,0 +1,86 @@ +// 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_PAIRWISE_HPP) +#define RXCPP_OPERATORS_RX_PAIRWISE_HPP + +#include "../rx-includes.hpp" + +namespace rxcpp { + +namespace operators { + +namespace detail { + +template +struct pairwise +{ + typedef typename std::decay::type source_value_type; + typedef std::tuple value_type; + + template + struct pairwise_observer + { + typedef pairwise_observer this_type; + typedef std::tuple value_type; + typedef typename std::decay::type dest_type; + typedef observer observer_type; + dest_type dest; + mutable rxu::detail::maybe 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(std::exception_ptr e) const { + dest.on_error(e); + } + void on_completed() const { + dest.on_completed(); + } + + static subscriber make(dest_type d) { + auto cs = d.get_subscription(); + return make_subscriber(std::move(cs), observer_type(this_type(std::move(d)))); + } + }; + + template + auto operator()(Subscriber dest) const + -> decltype(pairwise_observer::make(std::move(dest))) { + return pairwise_observer::make(std::move(dest)); + } +}; + +class pairwise_factory +{ +public: + template + auto operator()(Observable&& source) + -> decltype(source.template lift::type::value_type>::value_type>(pairwise::type::value_type>())) { + return source.template lift::type::value_type>::value_type>(pairwise::type::value_type>()); + } +}; + +} + +inline auto pairwise() + -> detail::pairwise_factory { + return detail::pairwise_factory(); +} + +} + +} + +#endif diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 5ca50e1..1ac9de7 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -118,6 +118,7 @@ #include #include #include +#include #include "rx-util.hpp" #include "rx-predef.hpp" diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index c9efdc8..5f15ef6 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -1013,7 +1013,7 @@ public: return observable_type(operator_type(identity_current_thread(), rxu::pack(), std::make_tuple(src, std::move(on)...))); }; }; - + /// zip -> /// bring by one item from all given observables and use the Selector to select a value to emit from the new observable that is returned. /// @@ -1311,6 +1311,13 @@ public: return rxo::start_with(*this, std::move(v0), std::move(vn)...); } + /// pairwise -> + /// take values pairwise from the observable + /// + auto pairwise() const + -> decltype(EXPLICIT_THIS lift::value_type>(rxo::detail::pairwise())) { + return lift::value_type>(rxo::detail::pairwise()); + } }; template diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 37f443e..5e4e042 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -51,6 +51,7 @@ namespace rxo=operators; #include "operators/rx-merge.hpp" #include "operators/rx-multicast.hpp" #include "operators/rx-observe_on.hpp" +#include "operators/rx-pairwise.hpp" #include "operators/rx-publish.hpp" #include "operators/rx-reduce.hpp" #include "operators/rx-ref_count.hpp" diff --git a/Rx/v2/test/operators/pairwise.cpp b/Rx/v2/test/operators/pairwise.cpp new file mode 100644 index 0000000..cb0a888 --- /dev/null +++ b/Rx/v2/test/operators/pairwise.cpp @@ -0,0 +1,50 @@ +#include "rxcpp/rx.hpp" +namespace rxu=rxcpp::util; +namespace rxsc=rxcpp::schedulers; + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +SCENARIO("pairwise", "[pairwise][operators]") { + GIVEN("a cold observable of n ints") { + auto sc = rxsc::make_test(); + auto w = sc.create_worker(); + const rxsc::test::messages on; + const rxsc::test::messages> on_pairwise; + long invoked = 0; + + 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, &invoked]() { + return xs + .pairwise() + // forget type to workaround lambda deduction bug on msvc 2013 + .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); + } + } + } +} diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index e5696f3..a951c2d 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -54,6 +54,7 @@ set(TEST_SOURCES ${TEST_DIR}/operators/map.cpp ${TEST_DIR}/operators/merge.cpp ${TEST_DIR}/operators/observe_on.cpp + ${TEST_DIR}/operators/pairwise.cpp ${TEST_DIR}/operators/publish.cpp ${TEST_DIR}/operators/reduce.cpp ${TEST_DIR}/operators/repeat.cpp -- GitLab From 098b6aa734839cc33c379a60472db5305e05f270 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 27 Jan 2015 19:24:59 -0800 Subject: [PATCH 465/782] move to trusty apt repo for clang --- projects/scripts/travis-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index c6f9458..6712002 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -5,10 +5,10 @@ set -e #if OS is linux or is not set if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' + sudo add-apt-repository -y 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main' sudo add-apt-repository -y "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" sudo add-apt-repository -y ppa:28msec/utils # Recent cmake - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang-3.5 + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang sudo apt-get clean -qq || echo "ignore clean failure" sudo apt-get update -qq || echo "ignore update failure" -- GitLab From e32cc0c6261622e182ef6f383911a0454dda92cd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Sat, 31 Jan 2015 09:15:42 -0800 Subject: [PATCH 466/782] fixes #58 concat_map_factory initialiser list passes arguments in the wrong order --- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 4 +- Rx/v2/test/operators/concat_map.cpp | 51 +++++++++++++++++ Rx/v2/test/operators/flat_map.cpp | 61 +++++++++++++++++++++ 4 files changed, 116 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index a8be1a7..e5ea951 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -250,8 +250,8 @@ class concat_map_factory coordination_type coordination; public: concat_map_factory(collection_selector_type s, result_selector_type rs, coordination_type sf) - : selectorCollection(std::move(rs)) - , selectorResult(std::move(s)) + : selectorCollection(std::move(s)) + , selectorResult(std::move(rs)) , coordination(std::move(sf)) { } diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index f8fd1d7..f50ed43 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -233,8 +233,8 @@ class flat_map_factory coordination_type coordination; public: flat_map_factory(collection_selector_type s, result_selector_type rs, coordination_type sf) - : selectorCollection(std::move(rs)) - , selectorResult(std::move(s)) + : selectorCollection(std::move(s)) + , selectorResult(std::move(rs)) , coordination(std::move(sf)) { } diff --git a/Rx/v2/test/operators/concat_map.cpp b/Rx/v2/test/operators/concat_map.cpp index 8423e46..b82749a 100644 --- a/Rx/v2/test/operators/concat_map.cpp +++ b/Rx/v2/test/operators/concat_map.cpp @@ -2,6 +2,7 @@ namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxs=rxcpp::sources; +namespace rxo=rxcpp::operators; namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" @@ -269,6 +270,56 @@ SCENARIO("concat_map completes", "[concat_map][map][operators]"){ REQUIRE(required == actual); } } + + WHEN("streamed 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;}, + rx::identity_current_thread()) >> + // 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); + } + } } } diff --git a/Rx/v2/test/operators/flat_map.cpp b/Rx/v2/test/operators/flat_map.cpp index 44b6869..5a68023 100644 --- a/Rx/v2/test/operators/flat_map.cpp +++ b/Rx/v2/test/operators/flat_map.cpp @@ -2,6 +2,7 @@ namespace rx=rxcpp; namespace rxu=rxcpp::util; namespace rxs=rxcpp::sources; +namespace rxo=rxcpp::operators; namespace rxsc=rxcpp::schedulers; #include "rxcpp/rx-test.hpp" @@ -315,6 +316,66 @@ SCENARIO("flat_map completes", "[flat_map][map][operators]"){ REQUIRE(required == actual); } } + + WHEN("streamed, 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;}, + rx::identity_current_thread()) >> + // 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); + } + } } } -- GitLab From 2be2cf92acb6483a88e368a0a7deb5c0b292ab3b Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 17 Feb 2015 16:00:14 +0800 Subject: [PATCH 467/782] Fix Issue #93: Don't return a reference to a local variable in extract_list_front --- Rx/v2/src/rxcpp/rx-util.hpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 172720c..7b014a4 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -593,24 +593,11 @@ struct list_not_empty { }; struct extract_list_front { - // Clang optimisation loses moved list.front() value after list.pop_front(), so optimization must be switched off. template -#if defined(__clang__) && defined(__linux__) - // Clang on Linux has an attribute to forbid optimization - __attribute__((optnone)) -#endif - auto operator()(std::list& list) const - -> decltype(std::move(list.front())) { -#if defined(__clang__) && !defined(__linux__) - // Clang on OSX doesn't support the attribute - volatile auto val = std::move(list.front()); - list.pop_front(); - return std::move(const_cast(val)); -#else + T operator()(std::list& list) const { auto val = std::move(list.front()); list.pop_front(); - return std::move(val); -#endif + return val; } }; -- GitLab From 2e8e8903d6e33f7447313fccf98883f9991b83ce Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 17 Feb 2015 19:36:20 +0800 Subject: [PATCH 468/782] Unnecessary semicolons are nnecessary --- Rx/v2/src/rxcpp/rx-observable.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 5f15ef6..d1e60fc 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -867,7 +867,7 @@ public: template observable_type operator()(const Source& src, Coordination cn, ObservableN... on) const { return observable_type(operator_type(std::move(cn), rxu::pack(), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -879,7 +879,7 @@ public: template observable_type operator()(const Source& src, Coordination cn, T0 t0, ObservableN... on) const { return observable_type(operator_type(std::move(cn), std::move(t0), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -915,7 +915,7 @@ public: template observable_type operator()(const Source& src, Selector sel, ObservableN... on) const { return observable_type(operator_type(identity_current_thread(), std::move(sel), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -927,7 +927,7 @@ public: template observable_type operator()(const Source& src, ObservableN... on) const { return observable_type(operator_type(identity_current_thread(), rxu::pack(), std::make_tuple(src, std::move(on)...))); - }; + } }; /// combine_latest -> @@ -951,7 +951,7 @@ public: template observable_type operator()(const Source& src, Coordination cn, ObservableN... on) const { return observable_type(operator_type(std::move(cn), rxu::pack(), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -963,7 +963,7 @@ public: template observable_type operator()(const Source& src, Coordination cn, T0 t0, ObservableN... on) const { return observable_type(operator_type(std::move(cn), std::move(t0), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -999,7 +999,7 @@ public: template observable_type operator()(const Source& src, Selector sel, ObservableN... on) const { return observable_type(operator_type(identity_current_thread(), std::move(sel), std::make_tuple(src, std::move(on)...))); - }; + } }; template @@ -1011,7 +1011,7 @@ public: template observable_type operator()(const Source& src, ObservableN... on) const { return observable_type(operator_type(identity_current_thread(), rxu::pack(), std::make_tuple(src, std::move(on)...))); - }; + } }; /// zip -> -- GitLab From 14b0164c5a6ecda8777476f6c27af3bbab1ebd33 Mon Sep 17 00:00:00 2001 From: BenPope Date: Wed, 18 Feb 2015 00:48:16 +0800 Subject: [PATCH 469/782] Use type aliases or: How I learned to love the closing chevron --- Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 16 ++-- .../rxcpp/operators/rx-buffer_time_count.hpp | 16 ++-- .../src/rxcpp/operators/rx-combine_latest.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 22 +++--- .../rxcpp/operators/rx-connect_forever.hpp | 8 +- .../operators/rx-distinct_until_changed.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-filter.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-finally.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 22 +++--- Rx/v2/src/rxcpp/operators/rx-group_by.hpp | 20 ++--- Rx/v2/src/rxcpp/operators/rx-lift.hpp | 14 ++-- Rx/v2/src/rxcpp/operators/rx-map.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-multicast.hpp | 10 +-- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-pairwise.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-publish.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 30 ++++---- Rx/v2/src/rxcpp/operators/rx-ref_count.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-repeat.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-retry.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-scan.hpp | 18 ++--- Rx/v2/src/rxcpp/operators/rx-skip.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-skip_until.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-start_with.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-subscribe.hpp | 4 +- Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp | 12 +-- .../src/rxcpp/operators/rx-switch_on_next.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-take.hpp | 12 +-- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-window.hpp | 8 +- Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 16 ++-- .../rxcpp/operators/rx-window_time_count.hpp | 16 ++-- Rx/v2/src/rxcpp/operators/rx-zip.hpp | 16 ++-- Rx/v2/src/rxcpp/rx-connectable_observable.hpp | 4 +- Rx/v2/src/rxcpp/rx-coordination.hpp | 2 +- Rx/v2/src/rxcpp/rx-grouped_observable.hpp | 10 +-- Rx/v2/src/rxcpp/rx-notification.hpp | 2 +- Rx/v2/src/rxcpp/rx-observable.hpp | 74 +++++++++---------- Rx/v2/src/rxcpp/rx-observer.hpp | 16 ++-- Rx/v2/src/rxcpp/rx-operators.hpp | 2 +- Rx/v2/src/rxcpp/rx-predef.hpp | 24 +++--- Rx/v2/src/rxcpp/rx-scheduler.hpp | 2 +- Rx/v2/src/rxcpp/rx-sources.hpp | 2 +- Rx/v2/src/rxcpp/rx-subscriber.hpp | 2 +- Rx/v2/src/rxcpp/rx-subscription.hpp | 8 +- Rx/v2/src/rxcpp/rx-util.hpp | 9 ++- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 8 +- Rx/v2/src/rxcpp/sources/rx-create.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-defer.hpp | 10 +-- Rx/v2/src/rxcpp/sources/rx-error.hpp | 10 +-- Rx/v2/src/rxcpp/sources/rx-interval.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-iterate.hpp | 22 +++--- Rx/v2/src/rxcpp/sources/rx-range.hpp | 2 +- Rx/v2/src/rxcpp/sources/rx-scope.hpp | 12 +-- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 2 +- 58 files changed, 357 insertions(+), 354 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp index 56507d4..b729311 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_count.hpp @@ -17,7 +17,7 @@ namespace detail { template struct buffer_count { - typedef typename std::decay::type source_value_type; + typedef rxu::decay_t source_value_type; struct buffer_count_values { buffer_count_values(int c, int s) @@ -41,7 +41,7 @@ struct buffer_count { typedef buffer_count_observer this_type; typedef std::vector value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; mutable int cursor; @@ -105,8 +105,8 @@ public: buffer_count_factory(int c, int s) : count(c), skip(s) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(buffer_count::type::value_type>(count, skip))) { - return source.template lift::type::value_type>>(buffer_count::type::value_type>(count, skip)); + -> decltype(source.template lift>>>(buffer_count>>(count, skip))) { + return source.template lift>>>(buffer_count>>(count, skip)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index dac1302..5948347 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -19,10 +19,10 @@ struct buffer_with_time static_assert(std::is_convertible::value, "Duration parameter must convert to rxsc::scheduler::clock_type::duration"); static_assert(is_coordination::value, "Coordination parameter must satisfy the requirements for a Coordination"); - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - typedef typename std::decay::type duration_type; + typedef rxu::decay_t duration_type; struct buffer_with_time_values { @@ -48,7 +48,7 @@ struct buffer_with_time { typedef buffer_with_time_observer this_type; typedef std::vector value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; struct buffer_with_time_subscriber_values : public buffer_with_time_values @@ -131,8 +131,8 @@ struct buffer_with_time template class buffer_with_time_factory { - typedef typename std::decay::type duration_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t duration_type; + typedef rxu::decay_t coordination_type; duration_type period; duration_type skip; @@ -141,8 +141,8 @@ public: buffer_with_time_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { - return source.template lift::type::value_type>>(buffer_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); + -> decltype(source.template lift>>>(buffer_with_time>, Duration, Coordination>(period, skip, coordination))) { + return source.template lift>>>(buffer_with_time>, Duration, Coordination>(period, skip, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index ea4d608..87b6c2a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -19,10 +19,10 @@ struct buffer_with_time_or_count static_assert(std::is_convertible::value, "Duration parameter must convert to rxsc::scheduler::clock_type::duration"); static_assert(is_coordination::value, "Coordination parameter must satisfy the requirements for a Coordination"); - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - typedef typename std::decay::type duration_type; + typedef rxu::decay_t duration_type; struct buffer_with_time_or_count_values { @@ -48,7 +48,7 @@ struct buffer_with_time_or_count { typedef buffer_with_time_or_count_observer this_type; typedef std::vector value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; struct buffer_with_time_or_count_subscriber_values : public buffer_with_time_or_count_values @@ -127,8 +127,8 @@ struct buffer_with_time_or_count template class buffer_with_time_or_count_factory { - typedef typename std::decay::type duration_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t duration_type; + typedef rxu::decay_t coordination_type; duration_type period; duration_type skip; @@ -137,8 +137,8 @@ public: buffer_with_time_or_count_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(buffer_with_time_or_count::type::value_type, Duration, Coordination>(period, skip, coordination))) { - return source.template lift::type::value_type>>(buffer_with_time_or_count::type::value_type, Duration, Coordination>(period, skip, coordination)); + -> decltype(source.template lift>>>(buffer_with_time_or_count>, Duration, Coordination>(period, skip, coordination))) { + return source.template lift>>>(buffer_with_time_or_count>, Duration, Coordination>(period, skip, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 3128217..3513dd0 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -19,8 +19,8 @@ struct combine_latest_traits { typedef std::tuple tuple_source_type; typedef std::tuple...> tuple_source_value_type; - typedef typename std::decay::type selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t selector_type; + typedef rxu::decay_t coordination_type; struct tag_not_valid {}; template @@ -34,7 +34,7 @@ struct combine_latest_traits { }; template -struct combine_latest : public operator_base::value_type> +struct combine_latest : public operator_base>> { typedef combine_latest this_type; @@ -179,8 +179,8 @@ struct combine_latest : public operator_base class combine_latest_factory { - typedef typename std::decay::type coordination_type; - typedef typename std::decay::type selector_type; + typedef rxu::decay_t coordination_type; + typedef rxu::decay_t selector_type; typedef std::tuple tuple_source_type; coordination_type coordination; @@ -189,9 +189,9 @@ class combine_latest_factory template auto make(std::tuple source) - -> observable::value_type, combine_latest> { - return observable::value_type, combine_latest>( - combine_latest(coordination, selector, std::move(source))); + -> observable>, combine_latest> { + return observable>, combine_latest>( + combine_latest(coordination, selector, std::move(source))); } public: combine_latest_factory(coordination_type sf, selector_type s, ObservableN... on) diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 2afe974..01f023d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -15,13 +15,13 @@ namespace detail { template struct concat - : public operator_base::type::value_type> + : public operator_base>> { typedef concat this_type; - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; @@ -184,7 +184,7 @@ struct concat template class concat_factory { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; coordination_type coordination; public: @@ -195,9 +195,9 @@ public: template auto operator()(Observable source) - -> observable::value_type, concat> { - return observable::value_type, concat>( - concat(std::move(source), coordination)); + -> observable, Observable, Coordination>>, concat, Observable, Coordination>> { + return observable, Observable, Coordination>>, concat, Observable, Coordination>>( + concat, Observable, Coordination>(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index e5ea951..72280e8 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -15,10 +15,10 @@ namespace detail { template struct concat_traits { - typedef typename std::decay::type source_type; - typedef typename std::decay::type collection_selector_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t collection_selector_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t coordination_type; typedef typename source_type::value_type source_value_type; @@ -50,7 +50,7 @@ struct concat_traits { template struct concat_map - : public operator_base::value_type> + : public operator_base>> { typedef concat_map this_type; typedef concat_traits traits; @@ -241,9 +241,9 @@ private: template class concat_map_factory { - typedef typename std::decay::type collection_selector_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t collection_selector_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t coordination_type; collection_selector_type selectorCollection; result_selector_type selectorResult; @@ -258,9 +258,9 @@ public: template auto operator()(Observable&& source) - -> observable::value_type, concat_map> { - return observable::value_type, concat_map>( - concat_map(std::forward(source), selectorCollection, selectorResult, coordination)); + -> observable>, concat_map> { + return observable>, concat_map>( + concat_map(std::forward(source), selectorCollection, selectorResult, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp index b38aa08..7713c2c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-connect_forever.hpp @@ -16,7 +16,7 @@ namespace detail { template struct connect_forever : public operator_base { - typedef typename std::decay::type source_type; + typedef rxu::decay_t source_type; source_type source; @@ -38,9 +38,9 @@ public: connect_forever_factory() {} template auto operator()(Observable&& source) - -> observable::type::value_type, connect_forever::type::value_type, Observable>> { - return observable::type::value_type, connect_forever::type::value_type, Observable>>( - connect_forever::type::value_type, Observable>(std::forward(source))); + -> observable>, connect_forever>, Observable>> { + return observable>, connect_forever>, Observable>>( + connect_forever>, Observable>(std::forward(source))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp index 910edda..d43c03f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-distinct_until_changed.hpp @@ -16,14 +16,14 @@ namespace detail { template struct distinct_until_changed { - typedef typename std::decay::type source_value_type; + typedef rxu::decay_t source_value_type; template struct distinct_until_changed_observer { typedef distinct_until_changed_observer this_type; typedef source_value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; mutable rxu::detail::maybe remembered; @@ -62,8 +62,8 @@ class distinct_until_changed_factory public: template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>(distinct_until_changed::type>::value_type)) { - return source.template lift::type::value_type>(distinct_until_changed::type>::value_type); + -> decltype(source.template lift>>(distinct_until_changed>::value_type)) { + return source.template lift>>(distinct_until_changed>::value_type); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-filter.hpp b/Rx/v2/src/rxcpp/operators/rx-filter.hpp index 775bc16..f5aba00 100644 --- a/Rx/v2/src/rxcpp/operators/rx-filter.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-filter.hpp @@ -16,8 +16,8 @@ namespace detail { template struct filter { - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type test_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t test_type; test_type test; filter(test_type t) @@ -30,7 +30,7 @@ struct filter { typedef filter_observer this_type; typedef source_value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; test_type test; @@ -73,14 +73,14 @@ struct filter template class filter_factory { - typedef typename std::decay::type test_type; + typedef rxu::decay_t test_type; test_type predicate; public: filter_factory(test_type p) : predicate(std::move(p)) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>(filter::type::value_type, test_type>(predicate))) { - return source.template lift::type::value_type>(filter::type::value_type, test_type>(predicate)); + -> decltype(source.template lift>>(filter>, test_type>(predicate))) { + return source.template lift>>(filter>, test_type>(predicate)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-finally.hpp b/Rx/v2/src/rxcpp/operators/rx-finally.hpp index 6e2b7ad..cd45d75 100644 --- a/Rx/v2/src/rxcpp/operators/rx-finally.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-finally.hpp @@ -16,8 +16,8 @@ namespace detail { template struct finally { - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type last_call_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t last_call_type; last_call_type last_call; finally(last_call_type lc) @@ -30,7 +30,7 @@ struct finally { typedef finally_observer this_type; typedef source_value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; @@ -70,14 +70,14 @@ struct finally template class finally_factory { - typedef typename std::decay::type last_call_type; + typedef rxu::decay_t last_call_type; last_call_type last_call; public: finally_factory(last_call_type lc) : last_call(std::move(lc)) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>(filter::type::value_type, last_call_type>(last_call))) { - return source.template lift::type::value_type>(filter::type::value_type, last_call_type>(last_call)); + -> decltype(source.template lift>>(filter>, last_call_type>(last_call))) { + return source.template lift>>(filter>, last_call_type>(last_call)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index f50ed43..afe6ae7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -15,10 +15,10 @@ namespace detail { template struct flat_map_traits { - typedef typename std::decay::type source_type; - typedef typename std::decay::type collection_selector_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t collection_selector_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t coordination_type; typedef typename source_type::value_type source_value_type; @@ -48,7 +48,7 @@ struct flat_map_traits { template struct flat_map - : public operator_base::value_type> + : public operator_base>> { typedef flat_map this_type; typedef flat_map_traits traits; @@ -224,9 +224,9 @@ struct flat_map template class flat_map_factory { - typedef typename std::decay::type collection_selector_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t collection_selector_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t coordination_type; collection_selector_type selectorCollection; result_selector_type selectorResult; @@ -241,9 +241,9 @@ public: template auto operator()(Observable&& source) - -> observable::value_type, flat_map> { - return observable::value_type, flat_map>( - flat_map(std::forward(source), selectorCollection, selectorResult, coordination)); + -> observable>, flat_map> { + return observable>, flat_map>( + flat_map(std::forward(source), selectorCollection, selectorResult, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp index 5ef609b..8afb4b9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-group_by.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-group_by.hpp @@ -16,7 +16,7 @@ namespace detail { template struct is_group_by_selector_for { - typedef typename std::decay::type selector_type; + typedef rxu::decay_t selector_type; typedef T source_value_type; struct tag_not_valid {}; @@ -33,10 +33,10 @@ template::type source_type; - typedef typename std::decay::type key_selector_type; - typedef typename std::decay::type marble_selector_type; - typedef typename std::decay::type predicate_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t key_selector_type; + typedef rxu::decay_t marble_selector_type; + typedef rxu::decay_t predicate_type; static_assert(is_group_by_selector_for::value, "group_by KeySelector must be a function with the signature key_type(source_value_type)"); @@ -110,7 +110,7 @@ struct group_by { typedef group_by_observer this_type; typedef typename traits_type::grouped_observable_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; @@ -174,9 +174,9 @@ struct group_by template class group_by_factory { - typedef typename std::decay::type key_selector_type; - typedef typename std::decay::type marble_selector_type; - typedef typename std::decay::type predicate_type; + typedef rxu::decay_t key_selector_type; + typedef rxu::decay_t marble_selector_type; + typedef rxu::decay_t predicate_type; key_selector_type keySelector; marble_selector_type marbleSelector; predicate_type predicate; @@ -190,7 +190,7 @@ public: template struct group_by_factory_traits { - typedef typename Observable::value_type value_type; + typedef rxu::value_type_t value_type; typedef detail::group_by_traits traits_type; typedef detail::group_by group_by_type; }; diff --git a/Rx/v2/src/rxcpp/operators/rx-lift.hpp b/Rx/v2/src/rxcpp/operators/rx-lift.hpp index 58fa4d6..4e95cb2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-lift.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-lift.hpp @@ -20,8 +20,8 @@ struct is_lift_function_for { template static tag_not_valid check(...); - typedef typename std::decay::type for_type; - typedef typename std::decay::type func_type; + typedef rxu::decay_t for_type; + typedef rxu::decay_t func_type; typedef decltype(check(0)) detail_result; static const bool value = is_subscriber::value && is_subscriber::value && std::is_convertible::type>::value; }; @@ -35,9 +35,9 @@ namespace detail { template struct lift_traits { - typedef typename std::decay::type result_value_type; - typedef typename std::decay::type source_operator_type; - typedef typename std::decay::type operator_type; + typedef rxu::decay_t result_value_type; + typedef rxu::decay_t source_operator_type; + typedef rxu::decay_t operator_type; typedef typename source_operator_type::value_type source_value_type; @@ -70,7 +70,7 @@ struct lift_operator : public operator_base class lift_factory { - typedef typename std::decay::type operator_type; + typedef rxu::decay_t operator_type; operator_type chain; public: lift_factory(operator_type op) : chain(std::move(op)) {} @@ -78,7 +78,7 @@ public: auto operator()(const Observable& source) -> decltype(source.template lift(chain)) { return source.template lift(chain); - static_assert(rxcpp::detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); + static_assert(rxcpp::detail::is_lift_function_for, subscriber, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-map.hpp b/Rx/v2/src/rxcpp/operators/rx-map.hpp index 662cf95..855f8eb 100644 --- a/Rx/v2/src/rxcpp/operators/rx-map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-map.hpp @@ -17,8 +17,8 @@ namespace detail { template struct map { - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type select_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t select_type; typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type; select_type selector; @@ -32,7 +32,7 @@ struct map { typedef map_observer this_type; typedef decltype((*(select_type*)nullptr)(*(source_value_type*)nullptr)) value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; select_type selector; @@ -75,14 +75,14 @@ struct map template class map_factory { - typedef typename std::decay::type select_type; + typedef rxu::decay_t select_type; select_type selector; public: map_factory(select_type s) : selector(std::move(s)) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector))) { - return source.template lift::type::value_type, select_type>::value_type>(map::type::value_type, select_type>(selector)); + -> decltype(source.template lift>, select_type>>>(map>, select_type>(selector))) { + return source.template lift>, select_type>>>(map>, select_type>(selector)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 9faa862..04d5a41 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -15,20 +15,20 @@ namespace detail { template struct merge - : public operator_base::type::value_type> + : public operator_base>> { //static_assert(is_observable::value, "merge requires an observable"); //static_assert(is_observable::value, "merge requires an observable that contains observables"); typedef merge this_type; - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type source_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t source_type; typedef typename source_type::source_operator_type source_operator_type; typedef typename source_value_type::value_type value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct values @@ -172,7 +172,7 @@ struct merge template class merge_factory { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; coordination_type coordination; public: @@ -183,9 +183,9 @@ public: template auto operator()(Observable source) - -> observable::value_type, merge> { - return observable::value_type, merge>( - merge(std::move(source), coordination)); + -> observable, Observable, Coordination>>, merge, Observable, Coordination>> { + return observable, Observable, Coordination>>, merge, Observable, Coordination>>( + merge, Observable, Coordination>(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp index 966bfa3..e970bfe 100644 --- a/Rx/v2/src/rxcpp/operators/rx-multicast.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-multicast.hpp @@ -16,8 +16,8 @@ namespace detail { template struct multicast : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type subject_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t subject_type; struct multicast_state : public std::enable_shared_from_this { @@ -76,9 +76,9 @@ public: } template auto operator()(Observable&& source) - -> connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject>> { - return connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject>>( - multicast::type::value_type, Observable, Subject>(std::forward(source), caster)); + -> connectable_observable>, multicast>, Observable, Subject>> { + return connectable_observable>, multicast>, Observable, Subject>>( + multicast>, Observable, Subject>(std::forward(source), caster)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 4d89044..8f52473 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -16,9 +16,9 @@ namespace detail { template struct observe_on { - typedef typename std::decay::type source_value_type; + typedef rxu::decay_t source_value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; coordination_type coordination; @@ -34,7 +34,7 @@ struct observe_on typedef observe_on_observer this_type; typedef observer_base base_type; typedef source_value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; typedef rxn::notification notification_type; @@ -184,14 +184,14 @@ struct observe_on template class observe_on_factory { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; coordination_type coordination; public: observe_on_factory(coordination_type cn) : coordination(std::move(cn)) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>(observe_on::type::value_type, coordination_type>(coordination))) { - return source.template lift::type::value_type>(observe_on::type::value_type, coordination_type>(coordination)); + -> decltype(source.template lift>>(observe_on>, coordination_type>(coordination))) { + return source.template lift>>(observe_on>, coordination_type>(coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp index 582aba5..8531e8c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-pairwise.hpp @@ -16,7 +16,7 @@ namespace detail { template struct pairwise { - typedef typename std::decay::type source_value_type; + typedef rxu::decay_t source_value_type; typedef std::tuple value_type; template @@ -24,7 +24,7 @@ struct pairwise { typedef pairwise_observer this_type; typedef std::tuple value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; mutable rxu::detail::maybe remembered; @@ -67,8 +67,8 @@ class pairwise_factory public: template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>::value_type>(pairwise::type::value_type>())) { - return source.template lift::type::value_type>::value_type>(pairwise::type::value_type>()); + -> decltype(source.template lift>>>>(pairwise>>())) { + return source.template lift>>>>(pairwise>>()); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-publish.hpp b/Rx/v2/src/rxcpp/operators/rx-publish.hpp index 34de51a..3589cc9 100644 --- a/Rx/v2/src/rxcpp/operators/rx-publish.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-publish.hpp @@ -20,10 +20,10 @@ public: publish_factory() {} template auto operator()(Observable&& source) - -> connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject::type::value_type>>> { - return connectable_observable::type::value_type, multicast::type::value_type, Observable, Subject::type::value_type>>>( - multicast::type::value_type, Observable, Subject::type::value_type>>( - std::forward(source), Subject::type::value_type>())); + -> connectable_observable>, multicast>, Observable, Subject>>>> { + return connectable_observable>, multicast>, Observable, Subject>>>>( + multicast>, Observable, Subject>>>( + std::forward(source), Subject>>())); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 9d3d39b..1c740bc 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -16,8 +16,8 @@ namespace detail { template struct is_accumulate_function_for { - typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t accumulator_type; + typedef rxu::decay_t seed_type; typedef T source_value_type; struct tag_not_valid {}; @@ -33,8 +33,8 @@ struct is_accumulate_function_for { template struct is_result_function_for { - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t seed_type; struct tag_not_valid {}; @@ -50,10 +50,10 @@ struct is_result_function_for { template struct reduce_traits { - typedef typename std::decay::type source_type; - typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t accumulator_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t seed_type; typedef T source_value_type; @@ -65,7 +65,7 @@ struct reduce_traits }; template -struct reduce : public operator_base::value_type> +struct reduce : public operator_base>> { typedef reduce this_type; typedef reduce_traits traits; @@ -164,9 +164,9 @@ private: template class reduce_factory { - typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type result_selector_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t accumulator_type; + typedef rxu::decay_t result_selector_type; + typedef rxu::decay_t seed_type; accumulator_type accumulator; result_selector_type result_selector; @@ -180,9 +180,9 @@ public: } template auto operator()(const Observable& source) - -> observable> { - return observable>( - reduce(source.source_operator, accumulator, result_selector, seed)); + -> observable, typename Observable::source_operator_type, Accumulator, ResultSelector, Seed>> { + return observable, typename Observable::source_operator_type, Accumulator, ResultSelector, Seed>>( + reduce, typename Observable::source_operator_type, Accumulator, ResultSelector, Seed>(source.source_operator, accumulator, result_selector, seed)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp index 41e4bd9..2d41ef2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-ref_count.hpp @@ -16,7 +16,7 @@ namespace detail { template struct ref_count : public operator_base { - typedef typename std::decay::type source_type; + typedef rxu::decay_t source_type; struct ref_count_state : public std::enable_shared_from_this { @@ -65,9 +65,9 @@ public: ref_count_factory() {} template auto operator()(Observable&& source) - -> observable::type::value_type, ref_count::type::value_type, Observable>> { - return observable::type::value_type, ref_count::type::value_type, Observable>>( - ref_count::type::value_type, Observable>(std::forward(source))); + -> observable>, ref_count>, Observable>> { + return observable>, ref_count>, Observable>>( + ref_count>, Observable>(std::forward(source))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp index 91f59b8..b9038ac 100644 --- a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp @@ -16,8 +16,8 @@ namespace detail { template struct repeat : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type count_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t count_type; struct values { values(source_type s, count_type t) @@ -94,16 +94,16 @@ struct repeat : public operator_base template class repeat_factory { - typedef typename std::decay::type count_type; + typedef rxu::decay_t count_type; count_type count; public: repeat_factory(count_type t) : count(std::move(t)) {} template auto operator()(Observable&& source) - -> observable::type::value_type, repeat::type::value_type, Observable, count_type>> { - return observable::type::value_type, repeat::type::value_type, Observable, count_type>>( - repeat::type::value_type, Observable, count_type>(std::forward(source), count)); + -> observable>, repeat>, Observable, count_type>> { + return observable>, repeat>, Observable, count_type>>( + repeat>, Observable, count_type>(std::forward(source), count)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-retry.hpp b/Rx/v2/src/rxcpp/operators/rx-retry.hpp index 112edef..acfa20b 100644 --- a/Rx/v2/src/rxcpp/operators/rx-retry.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-retry.hpp @@ -15,8 +15,8 @@ namespace rxcpp { template struct retry : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type count_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t count_type; struct values { values(source_type s, count_type t) : source(std::move(s)) @@ -90,16 +90,16 @@ namespace rxcpp { template class retry_factory { - typedef typename std::decay::type count_type; + typedef rxu::decay_t count_type; count_type count; public: retry_factory(count_type t) : count(std::move(t)) {} template auto operator()(Observable&& source) - -> observable::type::value_type, retry::type::value_type, Observable, count_type>> { - return observable::type::value_type, retry::type::value_type, Observable, count_type>>( - retry::type::value_type, Observable, count_type>(std::forward(source), count)); + -> observable>, retry>, Observable, count_type>> { + return observable>, retry>, Observable, count_type>>( + retry>, Observable, count_type>(std::forward(source), count)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp index 1b45437..7f2a314 100644 --- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -14,11 +14,11 @@ namespace operators { namespace detail { template -struct scan : public operator_base::type> +struct scan : public operator_base> { - typedef typename std::decay::type source_type; - typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t accumulator_type; + typedef rxu::decay_t seed_type; struct scan_initial_type { @@ -88,8 +88,8 @@ struct scan : public operator_base::type> template class scan_factory { - typedef typename std::decay::type accumulator_type; - typedef typename std::decay::type seed_type; + typedef rxu::decay_t accumulator_type; + typedef rxu::decay_t seed_type; accumulator_type accumulator; seed_type seed; @@ -101,9 +101,9 @@ public: } template auto operator()(Observable&& source) - -> observable::type, scan::type::value_type, Observable, Accumulator, Seed>> { - return observable::type, scan::type::value_type, Observable, Accumulator, Seed>>( - scan::type::value_type, Observable, Accumulator, Seed>(std::forward(source), accumulator, seed)); + -> observable, scan>, Observable, Accumulator, Seed>> { + return observable, scan>, Observable, Accumulator, Seed>>( + scan>, Observable, Accumulator, Seed>(std::forward(source), accumulator, seed)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp index 3fa7209..94ebe5a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -16,8 +16,8 @@ namespace detail { template struct skip : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type count_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t count_type; struct values { values(source_type s, count_type t) @@ -99,15 +99,15 @@ struct skip : public operator_base template class skip_factory { - typedef typename std::decay::type count_type; + typedef rxu::decay_t count_type; count_type count; public: skip_factory(count_type t) : count(std::move(t)) {} template auto operator()(Observable&& source) - -> observable::type::value_type, skip::type::value_type, Observable, count_type>> { - return observable::type::value_type, skip::type::value_type, Observable, count_type>>( - skip::type::value_type, Observable, count_type>(std::forward(source), count)); + -> observable>, skip>, Observable, count_type>> { + return observable>, skip>, Observable, count_type>>( + skip>, Observable, count_type>(std::forward(source), count)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp index 49441e4..4b4644f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp @@ -16,9 +16,9 @@ namespace detail { template struct skip_until : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t trigger_source_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct values { @@ -164,8 +164,8 @@ struct skip_until : public operator_base template class skip_until_factory { - typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t trigger_source_type; + typedef rxu::decay_t coordination_type; trigger_source_type trigger_source; coordination_type coordination; @@ -177,9 +177,9 @@ public: } template auto operator()(Observable&& source) - -> observable::type::value_type, skip_until::type::value_type, Observable, trigger_source_type, Coordination>> { - return observable::type::value_type, skip_until::type::value_type, Observable, trigger_source_type, Coordination>>( - skip_until::type::value_type, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); + -> observable>, skip_until>, Observable, trigger_source_type, Coordination>> { + return observable>, skip_until>, Observable, trigger_source_type, Coordination>>( + skip_until>, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-start_with.hpp b/Rx/v2/src/rxcpp/operators/rx-start_with.hpp index d605ceb..16e909f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-start_with.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-start_with.hpp @@ -13,8 +13,8 @@ namespace operators { template auto start_with(Observable o, Value0 v0, ValueN... vn) - -> decltype(rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o)) { - return rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o); + -> decltype(rxs::from(rxu::value_type_t(v0), rxu::value_type_t(vn)...).concat(o)) { + return rxs::from(rxu::value_type_t(v0), rxu::value_type_t(vn)...).concat(o); } } diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp index cc25c1d..af74d2e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe.hpp @@ -77,8 +77,8 @@ class dynamic_factory public: template auto operator()(Observable&& source) - -> observable::type::value_type> { - return observable::type::value_type>(std::forward(source)); + -> observable>> { + return observable>>(std::forward(source)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp index c1adb2c..4142890 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp @@ -16,8 +16,8 @@ namespace detail { template struct subscribe_on : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct subscribe_on_values { @@ -110,7 +110,7 @@ private: template class subscribe_on_factory { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; coordination_type coordination; public: @@ -120,9 +120,9 @@ public: } template auto operator()(Observable&& source) - -> observable::type::value_type, subscribe_on::type::value_type, Observable, Coordination>> { - return observable::type::value_type, subscribe_on::type::value_type, Observable, Coordination>>( - subscribe_on::type::value_type, Observable, Coordination>(std::forward(source), coordination)); + -> observable>, subscribe_on>, Observable, Coordination>> { + return observable>, subscribe_on>, Observable, Coordination>>( + subscribe_on>, Observable, Coordination>(std::forward(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index 3403553..a3620b2 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -15,22 +15,22 @@ namespace detail { template struct switch_on_next - : public operator_base::type::value_type> + : public operator_base>> { //static_assert(is_observable::value, "switch_on_next requires an observable"); //static_assert(is_observable::value, "switch_on_next requires an observable that contains observables"); typedef switch_on_next this_type; - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type source_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t 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 typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct values @@ -183,7 +183,7 @@ struct switch_on_next template class switch_on_next_factory { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; coordination_type coordination; public: @@ -194,9 +194,9 @@ public: template auto operator()(Observable source) - -> observable::value_type, switch_on_next> { - return observable::value_type, switch_on_next>( - switch_on_next(std::move(source), coordination)); + -> observable, Observable, Coordination>>, switch_on_next, Observable, Coordination>> { + return observable, Observable, Coordination>>, switch_on_next, Observable, Coordination>>( + switch_on_next, Observable, Coordination>(std::move(source), coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index 5043385..182a20f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -16,8 +16,8 @@ namespace detail { template struct take : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type count_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t count_type; struct values { values(source_type s, count_type t) @@ -103,15 +103,15 @@ struct take : public operator_base template class take_factory { - typedef typename std::decay::type count_type; + typedef rxu::decay_t count_type; count_type count; public: take_factory(count_type t) : count(std::move(t)) {} template auto operator()(Observable&& source) - -> observable::type::value_type, take::type::value_type, Observable, count_type>> { - return observable::type::value_type, take::type::value_type, Observable, count_type>>( - take::type::value_type, Observable, count_type>(std::forward(source), count)); + -> observable>, take>, Observable, count_type>> { + return observable>, take>, Observable, count_type>>( + take>, Observable, count_type>(std::forward(source), count)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index b1fb8ff..e4109cd 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -16,9 +16,9 @@ namespace detail { template struct take_until : public operator_base { - typedef typename std::decay::type source_type; - typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t trigger_source_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct values { @@ -162,8 +162,8 @@ struct take_until : public operator_base template class take_until_factory { - typedef typename std::decay::type trigger_source_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t trigger_source_type; + typedef rxu::decay_t coordination_type; trigger_source_type trigger_source; coordination_type coordination; @@ -175,9 +175,9 @@ public: } template auto operator()(Observable&& source) - -> observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, Coordination>> { - return observable::type::value_type, take_until::type::value_type, Observable, trigger_source_type, Coordination>>( - take_until::type::value_type, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); + -> observable>, take_until>, Observable, trigger_source_type, Coordination>> { + return observable>, take_until>, Observable, trigger_source_type, Coordination>>( + take_until>, Observable, trigger_source_type, Coordination>(std::forward(source), trigger_source, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window.hpp b/Rx/v2/src/rxcpp/operators/rx-window.hpp index c2bf220..57d04f0 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window.hpp @@ -16,7 +16,7 @@ namespace detail { template struct window { - typedef typename std::decay::type source_value_type; + typedef rxu::decay_t source_value_type; struct window_values { window_values(int c, int s) @@ -41,7 +41,7 @@ struct window typedef window_observer this_type; typedef observer_base> base_type; typedef typename base_type::value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; dest_type dest; mutable int cursor; @@ -107,8 +107,8 @@ public: window_factory(int c, int s) : count(c), skip(s) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(window::type::value_type>(count, skip))) { - return source.template lift::type::value_type>>(window::type::value_type>(count, skip)); + -> decltype(source.template lift>>>(window>>(count, skip))) { + return source.template lift>>>(window>>(count, skip)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index aca16de..734520e 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -16,10 +16,10 @@ namespace detail { template struct window_with_time { - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - typedef typename std::decay::type duration_type; + typedef rxu::decay_t duration_type; struct window_with_time_values { @@ -46,7 +46,7 @@ struct window_with_time typedef window_with_time_observer this_type; typedef observer_base> base_type; typedef typename base_type::value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; struct window_with_time_subscriber_values : public window_with_time_values @@ -128,8 +128,8 @@ struct window_with_time template class window_with_time_factory { - typedef typename std::decay::type duration_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t duration_type; + typedef rxu::decay_t coordination_type; duration_type period; duration_type skip; @@ -138,8 +138,8 @@ public: window_with_time_factory(duration_type p, duration_type s, coordination_type c) : period(p), skip(s), coordination(c) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(window_with_time::type::value_type, Duration, Coordination>(period, skip, coordination))) { - return source.template lift::type::value_type>>(window_with_time::type::value_type, Duration, Coordination>(period, skip, coordination)); + -> decltype(source.template lift>>>(window_with_time>, Duration, Coordination>(period, skip, coordination))) { + return source.template lift>>>(window_with_time>, Duration, Coordination>(period, skip, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index a3e45f4..fa50a57 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -16,10 +16,10 @@ namespace detail { template struct window_with_time_or_count { - typedef typename std::decay::type source_value_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t source_value_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; - typedef typename std::decay::type duration_type; + typedef rxu::decay_t duration_type; struct window_with_time_or_count_values { @@ -46,7 +46,7 @@ struct window_with_time_or_count typedef window_with_time_or_count_observer this_type; typedef observer_base> base_type; typedef typename base_type::value_type value_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef observer observer_type; struct window_with_time_or_count_subscriber_values : public window_with_time_or_count_values @@ -133,8 +133,8 @@ struct window_with_time_or_count template class window_with_time_or_count_factory { - typedef typename std::decay::type duration_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t duration_type; + typedef rxu::decay_t coordination_type; duration_type period; int count; @@ -143,8 +143,8 @@ public: window_with_time_or_count_factory(duration_type p, int n, coordination_type c) : period(p), count(n), coordination(c) {} template auto operator()(Observable&& source) - -> decltype(source.template lift::type::value_type>>(window_with_time_or_count::type::value_type, Duration, Coordination>(period, count, coordination))) { - return source.template lift::type::value_type>>(window_with_time_or_count::type::value_type, Duration, Coordination>(period, count, coordination)); + -> decltype(source.template lift>>>(window_with_time_or_count>, Duration, Coordination>(period, count, coordination))) { + return source.template lift>>>(window_with_time_or_count>, Duration, Coordination>(period, count, coordination)); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp index a391c48..19e03f6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -18,8 +18,8 @@ struct zip_traits { typedef std::tuple tuple_source_type; typedef std::tuple...> tuple_source_values_type; - typedef typename std::decay::type selector_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t selector_type; + typedef rxu::decay_t coordination_type; struct tag_not_valid {}; template @@ -33,7 +33,7 @@ struct zip_traits { }; template -struct zip : public operator_base::value_type> +struct zip : public operator_base>> { typedef zip this_type; @@ -171,8 +171,8 @@ struct zip : public operator_base class zip_factory { - typedef typename std::decay::type coordination_type; - typedef typename std::decay::type selector_type; + typedef rxu::decay_t coordination_type; + typedef rxu::decay_t selector_type; typedef std::tuple tuple_source_type; coordination_type coordination; @@ -181,9 +181,9 @@ class zip_factory template auto make(std::tuple source) - -> observable::value_type, zip> { - return observable::value_type, zip>( - zip(coordination, selector, std::move(source))); + -> observable>, zip> { + return observable>, zip>( + zip(coordination, selector, std::move(source))); } public: zip_factory(coordination_type sf, selector_type s, ObservableN... on) diff --git a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp index 731d844..b650b09 100644 --- a/Rx/v2/src/rxcpp/rx-connectable_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-connectable_observable.hpp @@ -51,7 +51,7 @@ class dynamic_connectable_observable template void construct(SO&& source, rxs::tag_source&&) { - auto so = std::make_shared::type>(std::forward(source)); + auto so = std::make_shared>(std::forward(source)); state->on_connect = [so](composite_subscription cs) mutable { so->on_connect(std::move(cs)); }; @@ -102,7 +102,7 @@ class connectable_observable { typedef connectable_observable this_type; typedef observable base_type; - typedef typename std::decay::type source_operator_type; + typedef rxu::decay_t source_operator_type; static_assert(detail::has_on_connect::value, "inner must have on_connect method void(composite_subscription)"); diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index 23c5405..0b95db3 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -193,7 +193,7 @@ class serialize_one_worker : public coordination_base struct serialize_observer { typedef serialize_observer this_type; - typedef typename std::decay::type dest_type; + typedef rxu::decay_t dest_type; typedef typename dest_type::value_type value_type; typedef observer observer_type; dest_type dest; diff --git a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp index 84deef9..8c81400 100644 --- a/Rx/v2/src/rxcpp/rx-grouped_observable.hpp +++ b/Rx/v2/src/rxcpp/rx-grouped_observable.hpp @@ -21,7 +21,7 @@ struct has_on_get_key_for static not_void check(...); typedef decltype(check(0)) detail_result; - static const bool value = std::is_same::type>::value; + static const bool value = std::is_same>::value; }; } @@ -31,7 +31,7 @@ class dynamic_grouped_observable : public dynamic_observable { public: - typedef typename std::decay::type key_type; + typedef rxu::decay_t key_type; typedef tag_dynamic_grouped_observable dynamic_observable_tag; private: @@ -59,7 +59,7 @@ private: template void construct(SO&& source, const rxs::tag_source&) { - auto so = std::make_shared::type>(std::forward(source)); + auto so = std::make_shared>(std::forward(source)); state->on_get_key = [so]() mutable { return so->on_get_key(); }; @@ -117,12 +117,12 @@ class grouped_observable { typedef grouped_observable this_type; typedef observable base_type; - typedef typename std::decay::type source_operator_type; + typedef rxu::decay_t source_operator_type; static_assert(detail::has_on_get_key_for::value, "inner must have on_get_key method key_type()"); public: - typedef typename std::decay::type key_type; + typedef rxu::decay_t key_type; typedef tag_grouped_observable observable_tag; grouped_observable() diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index 0ba09ea..f8cafbb 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -224,7 +224,7 @@ private: template type operator()(Exception&& e) const { return make_on_error(typename std::conditional< - std::is_same::type, std::exception_ptr>::value, + std::is_same, std::exception_ptr>::value, exception_ptr_tag, exception_tag>::type(), std::forward(e)); } diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index d1e60fc..bb0e275 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -26,8 +26,8 @@ struct is_operator_factory_for template static not_void check(...); - typedef typename std::decay::type source_type; - typedef typename std::decay::type function_type; + typedef rxu::decay_t source_type; + typedef rxu::decay_t function_type; typedef decltype(check(0)) detail_result; static const bool value = !std::is_same::value && is_observable::value; @@ -42,7 +42,7 @@ struct has_on_subscribe_for template static not_void check(...); - typedef decltype(check::type, T>(0)) detail_result; + typedef decltype(check, T>(0)) detail_result; static const bool value = std::is_same::value; }; @@ -66,7 +66,7 @@ class dynamic_observable template void construct(SO&& source, rxs::tag_source&&) { - typename std::decay::type so = std::forward(source); + rxu::decay_t so = std::forward(source); state->on_subscribe = [so](subscriber o) mutable { so.on_subscribe(std::move(o)); }; @@ -234,7 +234,7 @@ class blocking_observable } public: - typedef typename std::decay::type observable_type; + typedef rxu::decay_t observable_type; observable_type source; ~blocking_observable() { @@ -296,7 +296,7 @@ class observable typedef observable this_type; public: - typedef typename std::decay::type source_operator_type; + typedef rxu::decay_t source_operator_type; mutable source_operator_type source_operator; private: @@ -311,7 +311,7 @@ private: auto detail_subscribe(Subscriber o) const -> composite_subscription { - typedef typename std::decay::type subscriber_type; + typedef rxu::decay_t subscriber_type; static_assert(is_subscriber::value, "subscribe must be passed a subscriber"); static_assert(std::is_same::value && std::is_convertible::value, "the value types in the sequence must match or be convertible"); @@ -426,9 +426,9 @@ public: /// template auto lift(Operator&& op) const - -> observable::value_type, rxo::detail::lift_operator> { - return observable::value_type, rxo::detail::lift_operator>( - rxo::detail::lift_operator(source_operator, std::forward(op))); + -> observable>, rxo::detail::lift_operator> { + return observable>, rxo::detail::lift_operator>( + rxo::detail::lift_operator(source_operator, std::forward(op))); static_assert(detail::is_lift_function_for, Operator>::value, "Function passed for lift() must have the signature subscriber<...>(subscriber)"); } @@ -440,9 +440,9 @@ public: template auto lift_if(Operator&& op) const -> typename std::enable_if, Operator>::value, - observable::value_type, rxo::detail::lift_operator>>::type { - return observable::value_type, rxo::detail::lift_operator>( - rxo::detail::lift_operator(source_operator, std::forward(op))); + observable>, rxo::detail::lift_operator>>::type { + return observable>, rxo::detail::lift_operator>( + rxo::detail::lift_operator(source_operator, std::forward(op))); } /// /// takes any function that will take a subscriber for this observable and produce a subscriber. @@ -494,8 +494,8 @@ public: /// template auto map(Selector s) const - -> decltype(EXPLICIT_THIS lift::value_type>(rxo::detail::map(std::move(s)))) { - return lift::value_type>(rxo::detail::map(std::move(s))); + -> decltype(EXPLICIT_THIS lift>>(rxo::detail::map(std::move(s)))) { + return lift>>(rxo::detail::map(std::move(s))); } /// distinct_until_changed -> @@ -747,9 +747,9 @@ public: /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); + -> observable>, rxo::detail::flat_map> { + return observable>, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); } /// flat_map (AKA SelectMany) -> @@ -759,9 +759,9 @@ public: /// template auto flat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) const - -> observable::value_type, rxo::detail::flat_map> { - return observable::value_type, rxo::detail::flat_map>( - rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + -> observable>, rxo::detail::flat_map> { + return observable>, rxo::detail::flat_map>( + rxo::detail::flat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } template @@ -838,9 +838,9 @@ public: /// template auto concat_map(CollectionSelector&& s, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::concat_map> { - return observable::value_type, rxo::detail::concat_map>( - rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); + -> observable>, rxo::detail::concat_map> { + return observable>, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), identity_current_thread())); } /// concat_map -> @@ -850,9 +850,9 @@ public: /// template auto concat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) const - -> observable::value_type, rxo::detail::concat_map> { - return observable::value_type, rxo::detail::concat_map>( - rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); + -> observable>, rxo::detail::concat_map> { + return observable>, rxo::detail::concat_map>( + rxo::detail::concat_map(*this, std::forward(s), std::forward(rs), std::forward(sf))); } template @@ -1082,9 +1082,9 @@ public: /// template auto subscribe_on(Coordination cn) const - -> observable::value_type, rxo::detail::subscribe_on> { - return observable::value_type, rxo::detail::subscribe_on>( - rxo::detail::subscribe_on(*this, std::move(cn))); + -> observable>, rxo::detail::subscribe_on> { + return observable>, rxo::detail::subscribe_on>( + rxo::detail::subscribe_on(*this, std::move(cn))); } /// observe_on -> @@ -1101,9 +1101,9 @@ public: /// template auto reduce(Seed seed, Accumulator&& a, ResultSelector&& rs) const - -> observable::value_type, rxo::detail::reduce> { - return observable::value_type, rxo::detail::reduce>( - rxo::detail::reduce(source_operator, std::forward(a), std::forward(rs), seed)); + -> observable>, rxo::detail::reduce> { + return observable>, rxo::detail::reduce>( + rxo::detail::reduce(source_operator, std::forward(a), std::forward(rs), seed)); } template @@ -1315,8 +1315,8 @@ public: /// take values pairwise from the observable /// auto pairwise() const - -> decltype(EXPLICIT_THIS lift::value_type>(rxo::detail::pairwise())) { - return lift::value_type>(rxo::detail::pairwise()); + -> decltype(EXPLICIT_THIS lift>>(rxo::detail::pairwise())) { + return lift>>(rxo::detail::pairwise()); } }; @@ -1473,8 +1473,8 @@ public: } template static auto start_with(Observable o, Value0 v0, ValueN... vn) - -> decltype(rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o)) { - return rxs::from(typename Observable::value_type(v0), typename Observable::value_type(vn)...).concat(o); + -> decltype(rxs::from(rxu::value_type_t(v0), rxu::value_type_t(vn)...).concat(o)) { + return rxs::from(rxu::value_type_t(v0), rxu::value_type_t(vn)...).concat(o); } template static auto scope(ResourceFactory rf, ObservableFactory of) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index 6fad944..da93bff 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -44,7 +44,7 @@ struct is_on_next_of template static not_void check(...); - typedef decltype(check::type>(0)) detail_result; + typedef decltype(check>(0)) detail_result; static const bool value = std::is_same::value; }; @@ -57,7 +57,7 @@ struct is_on_error template static not_void check(...); - static const bool value = std::is_same::type>(0)), void>::value; + static const bool value = std::is_same>(0)), void>::value; }; template @@ -69,7 +69,7 @@ struct is_on_completed template static not_void check(...); - static const bool value = std::is_same::type>(0)), void>::value; + static const bool value = std::is_same>(0)), void>::value; }; } @@ -79,9 +79,9 @@ class static_observer { public: typedef static_observer this_type; - typedef typename std::decay::type on_next_t; - typedef typename std::decay::type on_error_t; - typedef typename std::decay::type on_completed_t; + typedef rxu::decay_t on_next_t; + typedef rxu::decay_t on_error_t; + typedef rxu::decay_t on_completed_t; private: on_next_t onnext; @@ -224,7 +224,7 @@ template class observer : public observer_base { typedef observer this_type; - typedef typename std::decay::type inner_t; + typedef rxu::decay_t inner_t; inner_t inner; @@ -387,7 +387,7 @@ template struct maybe_from_result { typedef decltype((*(F*)nullptr)()) decl_result_type; - typedef typename std::decay::type result_type; + typedef rxu::decay_t result_type; typedef rxu::maybe type; }; diff --git a/Rx/v2/src/rxcpp/rx-operators.hpp b/Rx/v2/src/rxcpp/rx-operators.hpp index 5e4e042..9d9aec8 100644 --- a/Rx/v2/src/rxcpp/rx-operators.hpp +++ b/Rx/v2/src/rxcpp/rx-operators.hpp @@ -26,7 +26,7 @@ class is_operator template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_operator*>::value; + static const bool value = std::is_convertible>(0)), tag_operator*>::value; }; } diff --git a/Rx/v2/src/rxcpp/rx-predef.hpp b/Rx/v2/src/rxcpp/rx-predef.hpp index 634b73f..ebb20ea 100644 --- a/Rx/v2/src/rxcpp/rx-predef.hpp +++ b/Rx/v2/src/rxcpp/rx-predef.hpp @@ -37,7 +37,7 @@ class is_worker template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_worker*>::value; + static const bool value = std::is_convertible>(0)), tag_worker*>::value; }; struct tag_scheduler {}; @@ -50,7 +50,7 @@ class is_scheduler template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_scheduler*>::value; + static const bool value = std::is_convertible>(0)), tag_scheduler*>::value; }; struct tag_schedulable {}; @@ -63,7 +63,7 @@ class is_schedulable template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_schedulable*>::value; + static const bool value = std::is_convertible>(0)), tag_schedulable*>::value; }; @@ -82,7 +82,7 @@ class is_observer template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_observer*>::value; + static const bool value = std::is_convertible>(0)), tag_observer*>::value; }; struct tag_dynamic_observer {}; @@ -95,7 +95,7 @@ class is_dynamic_observer template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_dynamic_observer*>::value; + static const bool value = std::is_convertible>(0)), tag_dynamic_observer*>::value; }; struct tag_subscriber {}; @@ -108,7 +108,7 @@ class is_subscriber template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_subscriber*>::value; + static const bool value = std::is_convertible>(0)), tag_subscriber*>::value; }; struct tag_dynamic_observable {}; @@ -121,7 +121,7 @@ class is_dynamic_observable template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_dynamic_observable*>::value; + static const bool value = std::is_convertible>(0)), tag_dynamic_observable*>::value; }; template @@ -153,7 +153,7 @@ class is_observable template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_observable>::value; + static const bool value = std::is_convertible>(0)), tag_observable>::value; }; struct tag_dynamic_connectable_observable : public tag_dynamic_observable {}; @@ -167,7 +167,7 @@ class is_dynamic_connectable_observable template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_dynamic_connectable_observable*>::value; + static const bool value = std::is_convertible>(0)), tag_dynamic_connectable_observable*>::value; }; template @@ -187,7 +187,7 @@ class is_connectable_observable template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_connectable_observable>::value; + static const bool value = std::is_convertible>(0)), tag_connectable_observable>::value; }; struct tag_dynamic_grouped_observable : public tag_dynamic_observable {}; @@ -201,7 +201,7 @@ class is_dynamic_grouped_observable template static not_void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_dynamic_grouped_observable*>::value; + static const bool value = std::is_convertible>(0)), tag_dynamic_grouped_observable*>::value; }; template @@ -224,7 +224,7 @@ class is_grouped_observable template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_grouped_observable>::value; + static const bool value = std::is_convertible>(0)), tag_grouped_observable>::value; }; // diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index f91e66c..bd490fa 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -180,7 +180,7 @@ struct is_action_function template static not_void check(...); - static const bool value = std::is_same::type>(0)), void>::value; + static const bool value = std::is_same>(0)), void>::value; }; } diff --git a/Rx/v2/src/rxcpp/rx-sources.hpp b/Rx/v2/src/rxcpp/rx-sources.hpp index 25d40ec..7afcf73 100644 --- a/Rx/v2/src/rxcpp/rx-sources.hpp +++ b/Rx/v2/src/rxcpp/rx-sources.hpp @@ -27,7 +27,7 @@ class is_source template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_source*>::value; + static const bool value = std::is_convertible>(0)), tag_source*>::value; }; } diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index 0092637..ad8e5b2 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -21,7 +21,7 @@ class subscriber : public subscriber_base static_assert(!is_subscriber::value, "not allowed to nest subscribers"); static_assert(is_observer::value, "subscriber must contain an observer"); typedef subscriber this_type; - typedef typename std::decay::type observer_type; + typedef rxu::decay_t observer_type; composite_subscription lifetime; observer_type destination; diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 6263a1f..a5fce21 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -20,7 +20,7 @@ struct is_unsubscribe_function template static not_void check(...); - static const bool value = std::is_same::type>(0)), void>::value; + static const bool value = std::is_same>(0)), void>::value; }; } @@ -35,13 +35,13 @@ class is_subscription template static void check(...); public: - static const bool value = std::is_convertible::type>(0)), tag_subscription*>::value; + static const bool value = std::is_convertible>(0)), tag_subscription*>::value; }; template class static_subscription { - typedef typename std::decay::type unsubscribe_call_type; + typedef rxu::decay_t unsubscribe_call_type; unsubscribe_call_type unsubscribe_call; static_subscription() { @@ -86,7 +86,7 @@ private: template struct subscription_state : public base_subscription_state { - typedef typename std::decay::type inner_t; + typedef rxu::decay_t inner_t; subscription_state(inner_t i) : base_subscription_state(true) , inner(std::move(i)) diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index 7b014a4..b2493f3 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -40,6 +40,9 @@ namespace rxcpp { namespace util { +template using value_type_t = typename T::value_type; +template using decay_t = typename std::decay::type; + template std::vector to_vector(const T (&arr) [size]) { return std::vector(std::begin(arr), std::end(arr)); @@ -125,8 +128,8 @@ template struct value_type_from : public std::false_type {typedef types_checked type;}; template -struct value_type_from::type> - : public std::true_type {typedef typename T::value_type type;}; +struct value_type_from>::type> + : public std::true_type {typedef value_type_t type;}; @@ -281,7 +284,7 @@ struct defer_value_type struct tag_not_valid {typedef void type; static const bool value = false;}; typedef Deferred::type...> resolved_type; template - static auto check(int) -> tag_valid; + static auto check(int) -> tag_valid>; template static tag_not_valid check(...); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 331bea9..24a88d9 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -347,7 +347,7 @@ struct is_create_source_function template static not_void check(...); - static const bool value = is_observable::type>(0))>::value; + static const bool value = is_observable>(0))>::value; }; } @@ -512,21 +512,21 @@ public: auto start(F createSource, long created, long subscribed, long unsubscribed) const -> typename std::enable_if::value, start_traits>::type::subscriber_type { - return start::value_type>(std::move(createSource), created, subscribed, unsubscribed); + return start>>(std::move(createSource), created, subscribed, unsubscribed); } template auto start(F createSource, long unsubscribed) const -> typename std::enable_if::value, start_traits>::type::subscriber_type { - return start::value_type>(std::move(createSource), created_time, subscribed_time, unsubscribed); + return start>>(std::move(createSource), created_time, subscribed_time, unsubscribed); } template auto start(F createSource) const -> typename std::enable_if::value, start_traits>::type::subscriber_type { - return start::value_type>(std::move(createSource), created_time, subscribed_time, unsubscribed_time); + return start>>(std::move(createSource), created_time, subscribed_time, unsubscribed_time); } void start() const { diff --git a/Rx/v2/src/rxcpp/sources/rx-create.hpp b/Rx/v2/src/rxcpp/sources/rx-create.hpp index 2c50e98..ed27fea 100644 --- a/Rx/v2/src/rxcpp/sources/rx-create.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-create.hpp @@ -18,7 +18,7 @@ struct create : public source_base { typedef create this_type; - typedef typename std::decay::type on_subscribe_type; + typedef rxu::decay_t on_subscribe_type; on_subscribe_type on_subscribe_function; diff --git a/Rx/v2/src/rxcpp/sources/rx-defer.hpp b/Rx/v2/src/rxcpp/sources/rx-defer.hpp index 5aef7ef..3afff64 100644 --- a/Rx/v2/src/rxcpp/sources/rx-defer.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-defer.hpp @@ -16,13 +16,13 @@ namespace detail { template struct defer_traits { - typedef typename std::decay::type observable_factory_type; + typedef rxu::decay_t observable_factory_type; typedef decltype((*(observable_factory_type*)nullptr)()) collection_type; typedef typename collection_type::value_type value_type; }; template -struct defer : public source_base::value_type> +struct defer : public source_base>> { typedef defer this_type; typedef defer_traits traits; @@ -54,9 +54,9 @@ struct defer : public source_base::valu template auto defer(ObservableFactory of) - -> observable::value_type, detail::defer> { - return observable::value_type, detail::defer>( - detail::defer(std::move(of))); + -> observable>, detail::defer> { + return observable>, detail::defer>( + detail::defer(std::move(of))); } } diff --git a/Rx/v2/src/rxcpp/sources/rx-error.hpp b/Rx/v2/src/rxcpp/sources/rx-error.hpp index 5014c7c..3f3e07b 100644 --- a/Rx/v2/src/rxcpp/sources/rx-error.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-error.hpp @@ -18,7 +18,7 @@ struct error : public source_base { typedef error this_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; @@ -88,13 +88,13 @@ auto make_error(throw_instance_tag&&, E e, Coordination cn) template auto error(E e) - -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate())) { - return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate()); + -> decltype(detail::make_error(typename std::conditional>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate())) { + return detail::make_error(typename std::conditional>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), identity_immediate()); } template auto error(E e, Coordination cn) - -> decltype(detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn))) { - return detail::make_error(typename std::conditional::type>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn)); + -> decltype(detail::make_error(typename std::conditional>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn))) { + return detail::make_error(typename std::conditional>::value, detail::throw_ptr_tag, detail::throw_instance_tag>::type(), std::move(e), std::move(cn)); } } diff --git a/Rx/v2/src/rxcpp/sources/rx-interval.hpp b/Rx/v2/src/rxcpp/sources/rx-interval.hpp index dade61a..afd5dac 100644 --- a/Rx/v2/src/rxcpp/sources/rx-interval.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-interval.hpp @@ -18,7 +18,7 @@ struct interval : public source_base { typedef interval this_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct interval_initial_type diff --git a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp index c78d0a2..be98c0c 100644 --- a/Rx/v2/src/rxcpp/sources/rx-iterate.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-iterate.hpp @@ -16,7 +16,7 @@ namespace detail { template struct is_iterable { - typedef typename std::decay::type collection_type; + typedef rxu::decay_t collection_type; struct not_void {}; template @@ -30,18 +30,18 @@ struct is_iterable template struct iterate_traits { - typedef typename std::decay::type collection_type; + typedef rxu::decay_t collection_type; typedef decltype(std::begin(*(collection_type*)nullptr)) iterator_type; - typedef typename std::iterator_traits::value_type value_type; + typedef rxu::value_type_t> value_type; }; template -struct iterate : public source_base::value_type> +struct iterate : public source_base>> { typedef iterate this_type; typedef iterate_traits traits; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; typedef typename traits::collection_type collection_type; @@ -134,15 +134,15 @@ struct iterate : public source_base::value_t template auto iterate(Collection c) - -> observable::value_type, detail::iterate> { - return observable::value_type, detail::iterate>( - detail::iterate(std::move(c), identity_immediate())); + -> observable>, detail::iterate> { + return observable>, detail::iterate>( + detail::iterate(std::move(c), identity_immediate())); } template auto iterate(Collection c, Coordination cn) - -> observable::value_type, detail::iterate> { - return observable::value_type, detail::iterate>( - detail::iterate(std::move(c), std::move(cn))); + -> observable>, detail::iterate> { + return observable>, detail::iterate>( + detail::iterate(std::move(c), std::move(cn))); } template diff --git a/Rx/v2/src/rxcpp/sources/rx-range.hpp b/Rx/v2/src/rxcpp/sources/rx-range.hpp index 4af7c24..0be3ae4 100644 --- a/Rx/v2/src/rxcpp/sources/rx-range.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-range.hpp @@ -16,7 +16,7 @@ namespace detail { template struct range : public source_base { - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; struct range_state_type diff --git a/Rx/v2/src/rxcpp/sources/rx-scope.hpp b/Rx/v2/src/rxcpp/sources/rx-scope.hpp index 1b7a26d..8105ef4 100644 --- a/Rx/v2/src/rxcpp/sources/rx-scope.hpp +++ b/Rx/v2/src/rxcpp/sources/rx-scope.hpp @@ -16,8 +16,8 @@ namespace detail { template struct scope_traits { - typedef typename std::decay::type resource_factory_type; - typedef typename std::decay::type observable_factory_type; + typedef rxu::decay_t resource_factory_type; + typedef rxu::decay_t 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; @@ -26,7 +26,7 @@ struct scope_traits }; template -struct scope : public source_base::value_type> +struct scope : public source_base>> { typedef scope_traits traits; typedef typename traits::resource_factory_type resource_factory_type; @@ -93,9 +93,9 @@ struct scope : public source_base auto scope(ResourceFactory rf, ObservableFactory of) - -> observable::value_type, detail::scope> { - return observable::value_type, detail::scope>( - detail::scope(std::move(rf), std::move(of))); + -> observable>, detail::scope> { + return observable>, detail::scope>( + detail::scope(std::move(rf), std::move(of))); } } diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 564f564..25f79cf 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -19,7 +19,7 @@ class synchronize_observer : public detail::multicast_observer typedef synchronize_observer this_type; typedef detail::multicast_observer base_type; - typedef typename std::decay::type coordination_type; + typedef rxu::decay_t coordination_type; typedef typename coordination_type::coordinator_type coordinator_type; typedef typename coordinator_type::template get>::type output_type; -- GitLab From ff6617f703d7eba1db496d31aa1f51fb09077868 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 14:56:50 -0800 Subject: [PATCH 470/782] vc2015 issue is forcing a shift away from on_exception usage --- .../src/rxcpp/operators/rx-combine_latest.hpp | 13 ++------ Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 9 ++--- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 33 ++++--------------- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 17 +++------- Rx/v2/src/rxcpp/operators/rx-reduce.hpp | 18 +++------- Rx/v2/src/rxcpp/operators/rx-scan.hpp | 8 +---- .../src/rxcpp/operators/rx-switch_on_next.hpp | 17 ++-------- Rx/v2/src/rxcpp/operators/rx-zip.hpp | 11 ++----- Rx/v2/src/rxcpp/rx-subscriber.hpp | 11 +++++-- 9 files changed, 34 insertions(+), 103 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index 3513dd0..d051f83 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -93,7 +93,6 @@ struct combine_latest : public operator_base(state->latest); if (value.empty()) { @@ -103,15 +102,9 @@ struct combine_latest : public operator_basevaluesSet == sizeof... (ObservableN)) { - auto selectedResult = on_exception( - [&](){ - return rxu::apply(rxu::surely(state->latest), state->selector); - }, - state->out); - if (selectedResult.empty()) { - return; - } - state->out.on_next(selectedResult.get()); + auto values = rxu::surely(state->latest); + auto selectedResult = rxu::apply(values, state->selector); + state->out.on_next(selectedResult); } }, // on_error diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 72280e8..4d9fb5c 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -143,13 +143,8 @@ struct concat_map collectionLifetime, // on_next [state, st](collection_value_type ct) { - auto selectedResult = on_exception( - [&](){return state->selectResult(st, std::move(ct));}, - state->out); - if (selectedResult.empty()) { - return; - } - state->out.on_next(std::move(*selectedResult)); + auto selectedResult = state->selectResult(st, std::move(ct)); + state->out.on_next(std::move(selectedResult)); }, // on_error [state](std::exception_ptr e) { diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index afe6ae7..7cce410 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -136,12 +136,6 @@ struct flat_map outercs, // on_next [state](source_value_type st) { - auto selectedCollection = on_exception( - [&](){return state->selectCollection(st);}, - state->out); - if (selectedCollection.empty()) { - return; - } composite_subscription innercs; @@ -153,12 +147,8 @@ struct flat_map state->out.remove(innercstoken); })); - auto selectedSource = on_exception( - [&](){return state->coordinator.in(selectedCollection.get());}, - state->out); - if (selectedSource.empty()) { - return; - } + auto selectedCollection = state->selectCollection(st); + auto selectedSource = state->coordinator.in(selectedCollection); ++state->pendingCompletions; // this subscribe does not share the source subscription @@ -168,13 +158,8 @@ struct flat_map innercs, // on_next [state, st](collection_value_type ct) { - auto selectedResult = on_exception( - [&](){return state->selectResult(st, std::move(ct));}, - state->out); - if (selectedResult.empty()) { - return; - } - state->out.on_next(std::move(*selectedResult)); + auto selectedResult = state->selectResult(st, std::move(ct)); + state->out.on_next(std::move(selectedResult)); }, // on_error [state](std::exception_ptr e) { @@ -188,14 +173,8 @@ struct flat_map } ); - auto selectedSinkInner = on_exception( - [&](){return state->coordinator.out(sinkInner);}, - state->out); - if (selectedSinkInner.empty()) { - return; - } - - selectedSource->subscribe(std::move(selectedSinkInner.get())); + auto selectedSinkInner = state->coordinator.out(sinkInner); + selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error [state](std::exception_ptr e) { diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 04d5a41..6e5dd2f 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -112,12 +112,7 @@ struct merge state->out.remove(innercstoken); })); - auto selectedSource = on_exception( - [&](){return state->coordinator.in(st);}, - state->out); - if (selectedSource.empty()) { - return; - } + auto selectedSource = state->coordinator.in(st); ++state->pendingCompletions; // this subscribe does not share the source subscription @@ -140,13 +135,9 @@ struct merge } } ); - auto selectedSinkInner = on_exception( - [&](){return state->coordinator.out(sinkInner);}, - state->out); - if (selectedSinkInner.empty()) { - return; - } - selectedSource->subscribe(std::move(selectedSinkInner.get())); + + auto selectedSinkInner = state->coordinator.out(sinkInner); + selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error [state](std::exception_ptr e) { diff --git a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp index 1c740bc..221b163 100644 --- a/Rx/v2/src/rxcpp/operators/rx-reduce.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-reduce.hpp @@ -132,13 +132,8 @@ struct reduce : public operator_baseout, // on_next [state](T t) { - auto next = on_exception( - [&](){return state->accumulator(state->current, t);}, - state->out); - if (next.empty()) { - return; - } - state->current = next.get(); + auto next = state->accumulator(state->current, t); + state->current = next; }, // on_error [state](std::exception_ptr e) { @@ -146,13 +141,8 @@ struct reduce : public operator_baseresult_selector(state->current);}, - state->out); - if (result.empty()) { - return; - } - state->out.on_next(result.get()); + auto result = state->result_selector(state->current); + state->out.on_next(result); state->out.on_completed(); } ); diff --git a/Rx/v2/src/rxcpp/operators/rx-scan.hpp b/Rx/v2/src/rxcpp/operators/rx-scan.hpp index 7f2a314..24d2886 100644 --- a/Rx/v2/src/rxcpp/operators/rx-scan.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-scan.hpp @@ -64,13 +64,7 @@ struct scan : public operator_base> state->out, // on_next [state](T t) { - auto result = on_exception( - [&](){return state->accumulator(state->result, t);}, - state->out); - if (result.empty()) { - return; - } - state->result = result.get(); + state->result = state->accumulator(state->result, t); state->out.on_next(state->result); }, // on_error diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index a3620b2..91a20a7 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -118,12 +118,7 @@ struct switch_on_next --state->pendingCompletions; })); - auto selectedSource = on_exception( - [&](){return state->coordinator.in(st);}, - state->out); - if (selectedSource.empty()) { - return; - } + auto selectedSource = state->coordinator.in(st); // this subscribe does not share the source subscription // so that when it is unsubscribed the source will continue @@ -146,15 +141,9 @@ struct switch_on_next } ); - auto selectedSinkInner = on_exception( - [&](){return state->coordinator.out(sinkInner);}, - state->out); - if (selectedSinkInner.empty()) { - return; - } - + auto selectedSinkInner = state->coordinator.out(sinkInner); ++state->pendingCompletions; - selectedSource->subscribe(std::move(selectedSinkInner.get())); + selectedSource.subscribe(std::move(selectedSinkInner)); }, // on_error [state](std::exception_ptr e) { diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp index 19e03f6..d62073d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -95,15 +95,8 @@ struct zip : public operator_base(state->pending); values.push_back(st); if (rxu::apply_to_each(state->pending, rxu::list_not_empty(), rxu::all_values_true())) { - auto selectedResult = on_exception( - [&](){ - return rxu::apply_to_each(state->pending, rxu::extract_list_front(), state->selector); - }, - state->out); - if (selectedResult.empty()) { - return; - } - state->out.on_next(selectedResult.get()); + auto selectedResult = rxu::apply_to_each(state->pending, rxu::extract_list_front(), state->selector); + state->out.on_next(selectedResult); } }, // on_error diff --git a/Rx/v2/src/rxcpp/rx-subscriber.hpp b/Rx/v2/src/rxcpp/rx-subscriber.hpp index ad8e5b2..6e6d10a 100644 --- a/Rx/v2/src/rxcpp/rx-subscriber.hpp +++ b/Rx/v2/src/rxcpp/rx-subscriber.hpp @@ -44,8 +44,15 @@ class subscriber : public subscriber_base template void operator()(U u) { trace_activity().on_next_enter(*that, u); - that->destination.on_next(std::move(u)); - do_unsubscribe = false; + try { + that->destination.on_next(std::move(u)); + do_unsubscribe = false; + } catch(...) { + auto ex = std::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; bool do_unsubscribe; -- GitLab From ba5fb591d035a151ed58a6083217614e234d39cd Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 15:02:46 -0800 Subject: [PATCH 471/782] vs2015 warns of name hiding --- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 2 -- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 4 ++-- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 8f52473..82235f4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -57,7 +57,6 @@ struct observe_on mutable queue_type queue; mutable queue_type drain_queue; composite_subscription lifetime; - rxsc::worker processor; mutable typename mode::type current; coordinator_type coordinator; dest_type destination; @@ -119,7 +118,6 @@ struct observe_on [&](){return coordinator.act(drain);}, destination); if (selectedDrain.empty()) { - std::unique_lock guard(lock); current = mode::Errored; using std::swap; queue_type expired; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 24a88d9..0d65d5f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -404,8 +404,8 @@ public: struct subscribe_factory { - rxn::subscription operator()(long subscribe, long unsubscribe) const { - return rxn::subscription(subscribe, unsubscribe); + rxn::subscription operator()(long subscribeAt, long unsubscribeAt) const { + return rxn::subscription(subscribeAt, unsubscribeAt); } }; static const subscribe_factory subscribe; diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 25f79cf..4e167bc 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -43,7 +43,6 @@ class synchronize_observer : public detail::multicast_observer mutable std::condition_variable wake; mutable queue_type queue; composite_subscription lifetime; - rxsc::worker processor; mutable typename mode::type current; coordinator_type coordinator; output_type destination; -- GitLab From 13b6df5513d509b5bddd03cc806f476c358b1db6 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 15:06:38 -0800 Subject: [PATCH 472/782] vs2015 size mismatch warning --- Rx/v2/test/operators/zip.1.cpp | 4 ++-- Rx/v2/test/operators/zip.2.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Rx/v2/test/operators/zip.1.cpp b/Rx/v2/test/operators/zip.1.cpp index a1313c6..4ebb165 100644 --- a/Rx/v2/test/operators/zip.1.cpp +++ b/Rx/v2/test/operators/zip.1.cpp @@ -290,10 +290,10 @@ SCENARIO("zip empty N", "[zip][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const size_t N = 16; + const int N = 16; std::vector> e; - for (size_t i = 0; i < N; ++i) { + for (int i = 0; i < N; ++i) { e.push_back( sc.make_hot_observable({ on.next(150, 1), diff --git a/Rx/v2/test/operators/zip.2.cpp b/Rx/v2/test/operators/zip.2.cpp index 38eaec7..d56cb83 100644 --- a/Rx/v2/test/operators/zip.2.cpp +++ b/Rx/v2/test/operators/zip.2.cpp @@ -322,12 +322,12 @@ SCENARIO("zip selector throws N", "[zip][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const size_t N = 16; + const int N = 16; std::runtime_error ex("zip on_error from source"); std::vector> e; - for (size_t i = 0; i < N; ++i) { + for (int i = 0; i < N; ++i) { e.push_back( sc.make_hot_observable({ on.next(210 + 10 * i, 1), @@ -380,10 +380,10 @@ SCENARIO("zip typical N", "[zip][join][operators]"){ auto w = sc.create_worker(); const rxsc::test::messages on; - const size_t N = 16; + const int N = 16; std::vector> o; - for (size_t i = 0; i < N; ++i) { + for (int i = 0; i < N; ++i) { o.push_back( sc.make_hot_observable({ on.next(150, 1), -- GitLab From 93f04f7a7b8a2ab6fafb72debd37d3342054bd8e Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 15:13:45 -0800 Subject: [PATCH 473/782] rework pi tests and fix io sideeffects --- Rx/v2/test/operators/group_by.cpp | 72 ++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index 674c54a..8c80fe3 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -25,25 +25,37 @@ SCENARIO("range partitioned by group_by across hardware threads to derive pi", " // 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, 19). + 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( - [](int i) -> int {return i % std::thread::hardware_concurrency();}, - [](int i){return i;}). + [](work w) -> int {return w.index % std::thread::hardware_concurrency();}, + [](work w){return w;}). map( - [=, &c](rxcpp::grouped_observable onproc) { + [=, &c](rxcpp::grouped_observable onproc) { auto key = onproc.get_key(); - // share a producer thread across all the ranges in this group + // 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( - [=, &c](int index){ - static const int chunk = 1000000; - auto first = (chunk * index) + 1; - auto last = chunk * (index + 1); - std::cout << std::setw(3) << index << ": range - " << first << "-" << last << std::endl; + [=, &c](work w){ + std::stringstream message; + message << std::setw(3) << w.index << ": range - " << w.first << "-" << w.last; - return rxcpp::observable<>::range(first, last, producerthread). + return rxcpp::observable<>::range(w.first, w.last, producerthread). map(pi). sum(). // each thread maps and reduces its contribution to the answer map( @@ -52,6 +64,7 @@ SCENARIO("range partitioned by group_by across hardware threads to derive pi", " 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)). as_dynamic(); }). concat(). // only subscribe to one range at a time in this group. @@ -91,32 +104,41 @@ SCENARIO("range partitioned by dividing work across hardware threads to derive p 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, std::thread::hardware_concurrency() - 1). + 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( - [=, &c](int index){ - // partition equally across threads - static const int chunk = 20000000 / std::thread::hardware_concurrency(); - auto first = (chunk * index) + 1; - auto last = chunk * (index + 1); - std::cout << std::setw(3) << index << ": range - " << first << "-" << last << std::endl; - - return rxcpp::observable<>::range(first, last, rxcpp::observe_on_new_thread()). + [=, &c](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 << std::this_thread::get_id() << " - value: " << std::setprecision(16) << v; + 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)). as_dynamic(); }). - observe_on(outputthread). - merge(). + merge(rxcpp::observe_on_new_thread()). map(rxcpp::util::apply_to( [](std::string message, long double v){ std::cout << message << std::endl; -- GitLab From 20706a51e3d7ebfe390ff9653c3f3200af752fd0 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 15:17:41 -0800 Subject: [PATCH 474/782] update nuget description --- projects/nuget/rxcpp.autoconfig | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/nuget/rxcpp.autoconfig b/projects/nuget/rxcpp.autoconfig index bb3b63e..25d1193 100644 --- a/projects/nuget/rxcpp.autoconfig +++ b/projects/nuget/rxcpp.autoconfig @@ -1,7 +1,7 @@ nuget { nuspec { id = rxcpp; - version : 1.0.2; + version : 2.1.1; title: Reactive Extensions for C++; authors: {Microsoft Open Technologies Inc.}; owners: {Microsoft Open Technologies Inc.}; @@ -10,10 +10,11 @@ nuget { iconUrl: "http://go.microsoft.com/fwlink/?LinkId=261274"; requireLicenseAcceptance:false; summary: "The Reactive Extensions (Rx) asynchronous programming library"; - description: @"The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and operators. Operators are the asynchronous form of standard library algorithms and they operate on Observables instead of iterators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize the concurrency in the asynchronous data streams using Schedulers."; - releaseNotes: "This release has many new operators and schedulers. Also some preliminary support for MVVM in WinRT."; - copyright: Copyright 2013; - tags: { RxCpp, RxC++, Rx, Reactive, Observable, Functional, native}; + description: @"The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and operators. Operators are the asynchronous form of standard library algorithms and they operate on Observables instead of iterators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. + Compiles for gcc, clang and VisualStudio on Linux, OSX and Windows."; + releaseNotes: "bug fixes, blocking_observable, tracing hooks and new operators; subscribe_on/observe_on, repeat, skip, finally, group_by, window, retry, scope, start_with, first, last, count"; + copyright: Copyright 2014; + tags: { RxCpp, RxC++, Rx, Reactive, Observable, Functional, native, nativepackage}; }; files { @@ -21,8 +22,8 @@ nuget { #defines { SDK_RX = ..\..\; } - include: { "${SDK_RX}Rx\v2\src\**\*", "${SDK_RX}Ix\CPP\src\**\*" }; - docs: { ${SDK_RX}Readme.html, ${SDK_RX}AUTHORS.txt, ${SDK_RX}v2\license.txt }; + include: { "${SDK_RX}Rx\v2\src\**\*" }; + docs: { ${SDK_RX}AUTHORS.txt, ${SDK_RX}Rx\v2\license.txt, ${SDK_RX}Rx\v2\examples\**\* }; } targets { -- GitLab From 41b0d2338987741a5aab28a99adc0cc952e78a2b Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Feb 2015 22:34:53 -0800 Subject: [PATCH 475/782] travis ci changes --- .travis.yml | 24 ++++++++++------ Rx/v2/src/rxcpp/rx-observer.hpp | 6 ++-- projects/CMake/CMakeLists.txt | 16 +++++++---- projects/scripts/travis-install.sh | 44 ++++++++++++------------------ 4 files changed, 46 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7f1c83..e698adb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,13 @@ compiler: - gcc env: - - BUILD_TYPE=Release + - CMAKE_BUILD_TYPE=RelWithDebInfo +# - CMAKE_BUILD_TYPE=Debug matrix: + allow_failures: + - compiler: clang + os: linux exclude: - compiler: gcc os: osx @@ -21,25 +25,27 @@ before_install: - sh projects/scripts/travis-install.sh install: - - export PATH=/usr/bin:$PATH + - $CXX --version + - /usr/local/bin/cmake --version - cd projects - - cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX - - cd build - - make -j2 - - cd ../.. + - /usr/local/bin/cmake -GUnix\ Makefiles -HCMake -Bbuild -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX + - cd .. script: - cd projects/build - - ./rxcppv2_test --success -r compact + - make -j2 - cd ../.. +#after_success: +# - projects/build/rxcppv2_test + branches: only: - master notifications: - recipients: - - kirk.shoop@microsoft.com email: + recipients: + - kirk.shoop@microsoft.com on_success: always on_failure: always diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index da93bff..bbc72e0 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -143,9 +143,9 @@ private: struct virtual_observer : public std::enable_shared_from_this { - virtual void on_next(T) const =0; - virtual void on_error(std::exception_ptr e) const =0; - virtual void on_completed() const =0; + virtual void on_next(T) const {}; + virtual void on_error(std::exception_ptr) const {}; + virtual void on_completed() const {}; }; template diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index a951c2d..a0b1e66 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -2,20 +2,24 @@ cmake_minimum_required(VERSION 2.8) project(rxcpp) -MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) - FIND_PACKAGE(Threads) -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +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 ) + 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}" STREQUAL "GNU") +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}" STREQUAL "MSVC") +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( /bigobj ) add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium endif() diff --git a/projects/scripts/travis-install.sh b/projects/scripts/travis-install.sh index 6712002..8f2ae7b 100755 --- a/projects/scripts/travis-install.sh +++ b/projects/scripts/travis-install.sh @@ -4,45 +4,37 @@ set -e #if OS is linux or is not set if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main' - sudo add-apt-repository -y "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" - sudo add-apt-repository -y ppa:28msec/utils # Recent cmake - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # gcc-4.8 backport for clang +# wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - +# sudo add-apt-repository -y 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main' +# sudo add-apt-repository -y "deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe" + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get clean -qq || echo "ignore clean failure" sudo apt-get update -qq || echo "ignore update failure" - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing cmake libssl-dev || echo "ignore install failure" - - if [ "$CC" = clang ]; then - sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing clang-3.6 || echo "ignore install failure" - - sudo update-alternatives --remove-all clang || echo "ignore remove failure" - sudo update-alternatives --remove-all clang++ || echo "ignore remove failure" - - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 20 - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 20 - - sudo update-alternatives --config clang - sudo update-alternatives --config clang++ - fi + wget http://www.cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.sh + chmod a+x cmake-3.1.3-Linux-x86_64.sh + sudo ./cmake-3.1.3-Linux-x86_64.sh --skip-license --prefix=/usr/local + export PATH=/usr/local/bin:$PATH + cmake --version if [ "$CC" = gcc ]; then sudo apt-get install -qq --allow-unauthenticated --force-yes --fix-missing gcc-4.8 g++-4.8 || echo "ignore install failure" - sudo update-alternatives --remove-all gcc || echo "ignore remove failure" - sudo update-alternatives --remove-all g++ || echo "ignore remove failure" + sudo update-alternatives --remove-all gcc || echo "ignore remove failure" + sudo update-alternatives --remove-all g++ || echo "ignore remove failure" + + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + sudo update-alternatives --config gcc + sudo update-alternatives --config g++ - sudo update-alternatives --config gcc - sudo update-alternatives --config g++ + g++ --version fi elif [ "$TRAVIS_OS_NAME" = osx ]; then xcode-select --install - brew update || echo "suppress failures in order to ignore warnings" + brew update || echo "suppress failures in order to ignore warnings" brew doctor || echo "suppress failures in order to ignore warnings" brew list cmake || brew install cmake || echo "suppress failures in order to ignore warnings" fi -- GitLab From bd97cedb5a11c0666c14efa9d5abb9769480a884 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Mar 2015 09:51:54 -0700 Subject: [PATCH 476/782] add cep sample answers #105 --- .gitignore | 8 +++++ Rx/v2/examples/cep/CMakeLists.txt | 53 +++++++++++++++++++++++++++++++ Rx/v2/examples/cep/main.cpp | 43 +++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 Rx/v2/examples/cep/CMakeLists.txt create mode 100644 Rx/v2/examples/cep/main.cpp diff --git a/.gitignore b/.gitignore index 73574ce..0dde6a3 100644 --- a/.gitignore +++ b/.gitignore @@ -109,6 +109,14 @@ projects/* !projects/CMake/CMakeLists.txt !projects/nuget/rxcpp.autopackage +CMakeCache.txt +CMakeFiles +*.cmake +*.log +*.vcxproj* +*.sln +Makefile + ############ ## Sublime ############ diff --git a/Rx/v2/examples/cep/CMakeLists.txt b/Rx/v2/examples/cep/CMakeLists.txt new file mode 100644 index 0000000..c04bead --- /dev/null +++ b/Rx/v2/examples/cep/CMakeLists.txt @@ -0,0 +1,53 @@ +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( /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} ${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/cep/main.cpp b/Rx/v2/examples/cep/main.cpp new file mode 100644 index 0000000..587595f --- /dev/null +++ b/Rx/v2/examples/cep/main.cpp @@ -0,0 +1,43 @@ + +#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 +#include + +// 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( + [](rx::subscriber 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; +} -- GitLab From ea776beda7d2e13293cce5606cd86bddd205a804 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Tue, 24 Mar 2015 11:57:27 -0700 Subject: [PATCH 477/782] added win_text example --- Rx/v2/examples/win_text/CMakeLists.txt | 54 +++++ Rx/v2/examples/win_text/main.cpp | 244 ++++++++++++++++++++++ Rx/v2/examples/win_text/rx_windows_user.h | 117 +++++++++++ Rx/v2/examples/win_text/unwinder.h | 54 +++++ Rx/v2/examples/win_text/windows_user.h | 118 +++++++++++ 5 files changed, 587 insertions(+) create mode 100644 Rx/v2/examples/win_text/CMakeLists.txt create mode 100644 Rx/v2/examples/win_text/main.cpp create mode 100644 Rx/v2/examples/win_text/rx_windows_user.h create mode 100644 Rx/v2/examples/win_text/unwinder.h create mode 100644 Rx/v2/examples/win_text/windows_user.h diff --git a/Rx/v2/examples/win_text/CMakeLists.txt b/Rx/v2/examples/win_text/CMakeLists.txt new file mode 100644 index 0000000..8aabd25 --- /dev/null +++ b/Rx/v2/examples/win_text/CMakeLists.txt @@ -0,0 +1,54 @@ +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 new file mode 100644 index 0000000..709cc2f --- /dev/null +++ b/Rx/v2/examples/win_text/main.cpp @@ -0,0 +1,244 @@ + +// win_text.cpp : Defines the entry point for the application. +// +// + +#define STRICT +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX + +#include +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "gdi32.lib") +#pragma comment(lib, "Comctl32.lib") +#pragma comment(lib, "Ole32.lib") + +#include +#include +#include +#include +#include +#include + +#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 +{ + // window class + using window_class = wu::window_class; + 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(). + 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(). + map( + [this](auto m) { + m.handled(); // skip DefWindowProc + + return this->messages(). + take_until(this->messages()); + }). + merge(); + + moves_while_lbutton_down. + subscribe([this](auto m) { + m.handled(); // skip DefWindowProc + + position = MAKEPOINTS(m.lParam); + InvalidateRect(window, nullptr, true); + }); + } + + void OnPaint() { + messages(). + subscribe([this](auto m) { + m.handled(); // skip DefWindowProc + + PAINTSTRUCT ps; + BeginPaint(window, &ps); + PaintContent(ps); + EndPaint(window, &ps); + }); + } + + void OnPrintClient() { + messages(). + 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 new file mode 100644 index 0000000..d8054fc --- /dev/null +++ b/Rx/v2/examples/win_text/rx_windows_user.h @@ -0,0 +1,117 @@ +#pragma once + +namespace rxcpp { namespace windows_user { + + struct rx_messages + { + struct Result + { + LRESULT lres = 0; + bool handled = false; + }; + + struct Message + { + template + 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 + T wparam_cast(){ + return *reinterpret_cast(std::addressof(wParam)); + } + + template + T lparam_cast(){ + return *reinterpret_cast(std::addressof(lParam)); + } + }; + + template + struct TypedMessage + { + static auto as() { return [](Message m){return TypedMessage{m}; }; } + + TypedMessage(Message m) + : hWnd(m.hWnd) + , message(m.message) + , wParam(m.wparam_cast()) + , lParam(m.lparam_cast()) + , 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 subject; + subscriber sub; + + ~rx_messages() { + sub.on_completed(); + } + rx_messages() : sub(subject.get_subscriber()) {} + + std::tuple 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 messages() { + return subject.get_observable(); + } + + template + observable messages() { + return messages().filter(Message::is()); + } + + template + observable> messages() { + return messages().map(TypedMessage::as()); + } + + }; + + template + struct enable_send_call + { + static LRESULT send_call(HWND w, std::function f) { + auto fp = reinterpret_cast(std::addressof(f)); + return SendMessage(w, WM_USER+1, 0, fp); + } + + void OnSendCall() { + auto derived = static_cast(this); + derived->messages*>(). + 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 new file mode 100644 index 0000000..a01a170 --- /dev/null +++ b/Rx/v2/examples/win_text/unwinder.h @@ -0,0 +1,54 @@ +#pragma once + +namespace unwinder { namespace detail { + + template + 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 UnwinderName(std::addressof(FunctionName)) diff --git a/Rx/v2/examples/win_text/windows_user.h b/Rx/v2/examples/win_text/windows_user.h new file mode 100644 index 0000000..418f73f --- /dev/null +++ b/Rx/v2/examples/win_text/windows_user.h @@ -0,0 +1,118 @@ +#pragma once + +namespace windows_user { + + EXTERN_C IMAGE_DOS_HEADER __ImageBase; + inline HINSTANCE GetCurrentInstance(){ return ((HINSTANCE)&__ImageBase); } + + template + LRESULT CALLBACK WindowCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept; + + template + 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; + + return RegisterClassEx(&wcex); + } + + private: + ~window_class(); + window_class(); + window_class(window_class&); + window_class& operator=(window_class&); + }; + + namespace detail { + template + std::unique_ptr find(HWND hwnd) { + return std::unique_ptr(reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA))); + } + + void erase(HWND hwnd) { + SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); + } + + template + std::unique_ptr insert(HWND hwnd, std::unique_ptr type) { + if (!type) { + return nullptr; + } + + SetLastError(0); + + ON_UNWIND(unwind_userdata, [&](){erase(hwnd);}); + auto result = SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast(type.get())); + + LONG winerror = !result ? GetLastError() : ERROR_SUCCESS; + + if (!!winerror || !!result) { + return nullptr; + } + + unwind_userdata.dismiss(); + return type; + } + } + + template + LRESULT CALLBACK WindowCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) noexcept { + auto type = detail::find(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(lParam); + auto param = reinterpret_cast(cs->lpCreateParams); + type = detail::insert(hWnd, std::unique_ptr(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; + } +} -- GitLab From b38a4f085b9abd9dba694964e5bc68e1a92f3fb8 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 17 Feb 2015 16:26:54 +0800 Subject: [PATCH 478/782] Prefer std::make_shared to using std::shared_ptr(new T()) --- Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-concat.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-concat_map.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-flat_map.hpp | 4 ++-- Rx/v2/src/rxcpp/operators/rx-merge.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-repeat.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-retry.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-skip.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-skip_until.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-take_until.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-zip.hpp | 2 +- Rx/v2/src/rxcpp/rx-scheduler.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 2 +- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 14 ++++++-------- 20 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp index d051f83..8441dc4 100644 --- a/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-combine_latest.hpp @@ -163,7 +163,7 @@ struct combine_latest : public operator_base(new combine_latest_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); subscribe_all(state, typename rxu::values_from::type()); } diff --git a/Rx/v2/src/rxcpp/operators/rx-concat.hpp b/Rx/v2/src/rxcpp/operators/rx-concat.hpp index 01f023d..a92b8b3 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat.hpp @@ -131,7 +131,7 @@ struct concat auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); state->sourceLifetime = composite_subscription(); diff --git a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp index 4d9fb5c..49f50af 100644 --- a/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-concat_map.hpp @@ -180,7 +180,7 @@ struct concat_map auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new concat_map_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); state->sourceLifetime = composite_subscription(); diff --git a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp index 7cce410..dcc3521 100644 --- a/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-flat_map.hpp @@ -112,7 +112,7 @@ struct flat_map auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); composite_subscription outercs; @@ -238,4 +238,4 @@ auto flat_map(CollectionSelector&& s, ResultSelector&& rs, Coordination&& sf) } -#endif +#endif \ No newline at end of file diff --git a/Rx/v2/src/rxcpp/operators/rx-merge.hpp b/Rx/v2/src/rxcpp/operators/rx-merge.hpp index 6e5dd2f..17409d3 100644 --- a/Rx/v2/src/rxcpp/operators/rx-merge.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-merge.hpp @@ -77,7 +77,7 @@ struct merge auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new merge_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); composite_subscription outercs; diff --git a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp index b9038ac..332d2da 100644 --- a/Rx/v2/src/rxcpp/operators/rx-repeat.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-repeat.hpp @@ -84,7 +84,7 @@ struct repeat : public operator_base }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, s)); + auto state = std::make_shared(initial, s); // start the first iteration state->do_subscribe(); diff --git a/Rx/v2/src/rxcpp/operators/rx-retry.hpp b/Rx/v2/src/rxcpp/operators/rx-retry.hpp index acfa20b..baf2111 100644 --- a/Rx/v2/src/rxcpp/operators/rx-retry.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-retry.hpp @@ -81,7 +81,7 @@ namespace rxcpp { }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, s)); + auto state = std::make_shared(initial, s); // start the first iteration state->do_subscribe(); diff --git a/Rx/v2/src/rxcpp/operators/rx-skip.hpp b/Rx/v2/src/rxcpp/operators/rx-skip.hpp index 94ebe5a..9e4611a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip.hpp @@ -63,7 +63,7 @@ struct skip : public operator_base output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, s)); + auto state = std::make_shared(initial, s); composite_subscription source_lifetime; diff --git a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp index 4b4644f..c717fad 100644 --- a/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-skip_until.hpp @@ -77,7 +77,7 @@ struct skip_until : public operator_base auto coordinator = initial.coordination.create_coordinator(); // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, std::move(coordinator), std::move(s))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(s)); auto trigger = on_exception( [&](){return state->coordinator.in(state->trigger);}, diff --git a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp index 4142890..e38cd8d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-subscribe_on.hpp @@ -70,7 +70,7 @@ struct subscribe_on : public operator_base auto controller = coordinator.get_worker(); // take a copy of the values for each subscription - auto state = std::shared_ptr(new subscribe_on_state_type(initial, std::move(coordinator), std::move(s))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(s)); auto disposer = [=](const rxsc::schedulable&){ state->source_lifetime.unsubscribe(); diff --git a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp index 91a20a7..35b8e67 100644 --- a/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-switch_on_next.hpp @@ -80,7 +80,7 @@ struct switch_on_next auto coordinator = initial.coordination.create_coordinator(scbr.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new switch_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); composite_subscription outercs; diff --git a/Rx/v2/src/rxcpp/operators/rx-take.hpp b/Rx/v2/src/rxcpp/operators/rx-take.hpp index 182a20f..c7259a3 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take.hpp @@ -63,7 +63,7 @@ struct take : public operator_base output_type out; }; // take a copy of the values for each subscription - auto state = std::shared_ptr(new state_type(initial, s)); + auto state = std::make_shared(initial, s); composite_subscription source_lifetime; diff --git a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp index e4109cd..422679a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-take_until.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-take_until.hpp @@ -77,7 +77,7 @@ struct take_until : public operator_base auto coordinator = initial.coordination.create_coordinator(s.get_subscription()); // take a copy of the values for each subscription - auto state = std::shared_ptr(new take_until_state_type(initial, std::move(coordinator), std::move(s))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(s)); auto trigger = on_exception( [&](){return state->coordinator.in(state->trigger);}, diff --git a/Rx/v2/src/rxcpp/operators/rx-zip.hpp b/Rx/v2/src/rxcpp/operators/rx-zip.hpp index d62073d..36f4915 100644 --- a/Rx/v2/src/rxcpp/operators/rx-zip.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-zip.hpp @@ -155,7 +155,7 @@ struct zip : public operator_base(new zip_state_type(initial, std::move(coordinator), std::move(scbr))); + auto state = std::make_shared(initial, std::move(coordinator), std::move(scbr)); subscribe_all(state, typename rxu::values_from::type()); } diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index bd490fa..9e3d1a6 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -780,7 +780,7 @@ auto worker::schedule_periodically(clock_type::time_point initial, clock_type::d } template void worker::schedule_periodically_rebind(clock_type::time_point initial, clock_type::duration period, const schedulable& scbl, ArgN&&... an) const { - std::shared_ptr target(new clock_type::time_point(initial)); + auto target = std::make_shared(initial); auto activity = make_schedulable(scbl, *this, std::forward(an)...); auto periodic = make_schedulable( activity, diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 64ae60b..677291f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -228,7 +228,7 @@ private: public: current_thread() - : wi(new current_worker()) + : wi(std::make_shared()) { } virtual ~current_thread() diff --git a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp index b5adf5b..2771955 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp @@ -91,7 +91,7 @@ public: } virtual worker create_worker(composite_subscription cs) const { - return worker(cs, std::shared_ptr(new loop_worker(cs, loops[++count % loops.size()]))); + return worker(cs, std::make_shared(cs, loops[++count % loops.size()])); } const static scheduler instance; }; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index c990837..d610d33 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -56,7 +56,7 @@ private: public: immediate() - : wi(new immediate_worker()) + : wi(std::make_shared()) { } virtual ~immediate() diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index 4d60cb6..9795b59 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -160,7 +160,7 @@ public: } virtual worker create_worker(composite_subscription cs) const { - return worker(cs, std::shared_ptr(new new_worker(cs, factory))); + return worker(cs, std::make_shared(cs, factory)); } const static scheduler instance; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 0d65d5f..2cacca2 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -124,7 +124,7 @@ public: public: test_type() - : state(new test_type_state()) + : state(std::make_shared()) { } @@ -133,8 +133,7 @@ public: } virtual worker create_worker(composite_subscription cs) const { - std::shared_ptr wi(new test_type_worker(state)); - return worker(cs, wi); + return worker(cs, std::make_shared(state)); } bool is_enabled() const {return state->is_enabled();} @@ -143,8 +142,7 @@ public: } std::shared_ptr create_test_type_worker_interface() const { - std::shared_ptr wi(new test_type_worker(state)); - return wi; + return std::make_shared(state); } template @@ -188,7 +186,7 @@ subscriber> test_type::test_type_worker::make_subsc typedef typename rxn::notification notification_type; typedef rxn::recorded recorded_type; - std::shared_ptr> ts(new mock_observer(state)); + auto ts = std::make_shared>(state); return rxcpp::make_subscriber(rxt::testable_observer(ts, make_observer_dynamic( // on_next @@ -272,7 +270,7 @@ public: template rxt::testable_observable test_type::make_cold_observable(std::vector>>> messages) const { - auto co = std::shared_ptr>(new cold_observable(state, create_worker(composite_subscription()), std::move(messages))); + auto co = std::make_shared>(state, create_worker(composite_subscription()), std::move(messages)); return rxt::testable_observable(co); } @@ -469,7 +467,7 @@ public: { } }; - std::shared_ptr state(new state_type(this->make_subscriber())); + auto state = std::make_shared(this->make_subscriber()); schedule_absolute(created, [createSource, state](const schedulable&) { state->source.reset(new typename state_type::source_type(createSource())); -- GitLab From d7a795119a52d76fba64a8bf2fa672575e07a012 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 17 Feb 2015 17:05:29 +0800 Subject: [PATCH 479/782] Don't return std::move(t); It prevents NRVO and is almost always wrong --- Ix/CPP/src/cpplinq/linq.hpp | 2 +- Ix/CPP/src/cpplinq/linq_last.hpp | 4 ++-- Ix/CPP/src/cpplinq/linq_skip.hpp | 2 +- Ix/CPP/src/cpplinq/linq_take.hpp | 2 +- Rx/v2/src/rxcpp/operators/rx-observe_on.hpp | 4 ++-- Rx/v2/src/rxcpp/rx-coordination.hpp | 8 ++++---- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 4 ++-- Rx/v2/test/operators/group_by.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Ix/CPP/src/cpplinq/linq.hpp b/Ix/CPP/src/cpplinq/linq.hpp index 5f08588..80894e8 100644 --- a/Ix/CPP/src/cpplinq/linq.hpp +++ b/Ix/CPP/src/cpplinq/linq.hpp @@ -526,7 +526,7 @@ template linq_driver::iterator>> from(TContainer& c) { auto cur = iter_cursor::iterator>(begin(c), end(c)); - return std::move(cur); + return cur; } template const linq_driver& from(const linq_driver& c) diff --git a/Ix/CPP/src/cpplinq/linq_last.hpp b/Ix/CPP/src/cpplinq/linq_last.hpp index fd08823..cb2bf76 100644 --- a/Ix/CPP/src/cpplinq/linq_last.hpp +++ b/Ix/CPP/src/cpplinq/linq_last.hpp @@ -17,7 +17,7 @@ namespace cpplinq { if (c.empty()) break; elem = c.get(); } - return std::move(elem); + return elem; } // TODO: bidirectional iterator in constant time @@ -54,7 +54,7 @@ namespace cpplinq { elem = c.get(); c.inc(); } - return std::move(elem); + return elem; } template diff --git a/Ix/CPP/src/cpplinq/linq_skip.hpp b/Ix/CPP/src/cpplinq/linq_skip.hpp index 422592a..bcaf5f4 100644 --- a/Ix/CPP/src/cpplinq/linq_skip.hpp +++ b/Ix/CPP/src/cpplinq/linq_skip.hpp @@ -22,7 +22,7 @@ namespace cpplinq cur.inc(); } cur.forget(); - return std::move(cur); + return cur; } private: diff --git a/Ix/CPP/src/cpplinq/linq_take.hpp b/Ix/CPP/src/cpplinq/linq_take.hpp index 63f7449..7e16d6e 100644 --- a/Ix/CPP/src/cpplinq/linq_take.hpp +++ b/Ix/CPP/src/cpplinq/linq_take.hpp @@ -56,7 +56,7 @@ namespace cpplinq if (cur.size() > n) { cur.truncate(n); } - return std::move(cur); + return cur; } } diff --git a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp index 82235f4..dfad938 100644 --- a/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-observe_on.hpp @@ -237,12 +237,12 @@ class observe_on_one_worker : public coordination_base template auto out(Subscriber s) const -> Subscriber { - return std::move(s); + return s; } template auto act(F f) const -> F { - return std::move(f); + return f; } }; diff --git a/Rx/v2/src/rxcpp/rx-coordination.hpp b/Rx/v2/src/rxcpp/rx-coordination.hpp index 0b95db3..560304c 100644 --- a/Rx/v2/src/rxcpp/rx-coordination.hpp +++ b/Rx/v2/src/rxcpp/rx-coordination.hpp @@ -125,17 +125,17 @@ class identity_one_worker : public coordination_base template auto in(Observable o) const -> Observable { - return std::move(o); + return o; } template auto out(Subscriber s) const -> Subscriber { - return std::move(s); + return s; } template auto act(F f) const -> F { - return std::move(f); + return f; } }; @@ -250,7 +250,7 @@ class serialize_one_worker : public coordination_base template auto in(Observable o) const -> Observable { - return std::move(o); + return o; } template auto out(const Subscriber& s) const diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 4e167bc..9625a14 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -222,12 +222,12 @@ class synchronize_in_one_worker : public coordination_base template auto out(Subscriber s) const -> Subscriber { - return std::move(s); + return s; } template auto act(F f) const -> F { - return std::move(f); + return f; } }; diff --git a/Rx/v2/test/operators/group_by.cpp b/Rx/v2/test/operators/group_by.cpp index 8c80fe3..6677f9e 100644 --- a/Rx/v2/test/operators/group_by.cpp +++ b/Rx/v2/test/operators/group_by.cpp @@ -168,7 +168,7 @@ std::string trim(std::string s) { s.erase(s.end() - (last-s.rbegin()), s.end()); } s.erase(s.begin(), first); - return std::move(s); + return s; } bool tolowerLess(char lhs, char rhs) { -- GitLab From 71254f2e6a51fe861869f22a1eaebd9d09001132 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 17 Feb 2015 19:27:02 +0800 Subject: [PATCH 480/782] Change the way statics work to avoid namespace detail { --- Rx/v2/src/rxcpp/rx-notification.hpp | 53 +++++----------- Rx/v2/src/rxcpp/rx-scheduler.hpp | 12 ++-- Rx/v2/src/rxcpp/rx-subscription.hpp | 17 ++++-- Rx/v2/src/rxcpp/rx-util.hpp | 8 --- .../src/rxcpp/schedulers/rx-currentthread.hpp | 7 +-- Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp | 7 +-- Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp | 7 +-- Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp | 8 +-- Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 61 +++++-------------- 9 files changed, 56 insertions(+), 124 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-notification.hpp b/Rx/v2/src/rxcpp/rx-notification.hpp index f8cafbb..3928fd5 100644 --- a/Rx/v2/src/rxcpp/rx-notification.hpp +++ b/Rx/v2/src/rxcpp/rx-notification.hpp @@ -205,47 +205,24 @@ private: return std::make_shared(ep); } - struct on_next_factory - { - type operator()(T value) const { - return std::make_shared(std::move(value)); - } - }; - - struct on_completed_factory - { - type operator()() const { - return std::make_shared(); - } - }; - - struct on_error_factory - { - template - type operator()(Exception&& e) const { - return make_on_error(typename std::conditional< - std::is_same, std::exception_ptr>::value, - exception_ptr_tag, exception_tag>::type(), - std::forward(e)); - } - }; public: - const static on_next_factory on_next; - const static on_completed_factory on_completed; - const static on_error_factory on_error; -}; - -template -//static -RXCPP_SELECT_ANY const typename notification::on_next_factory notification::on_next = notification::on_next_factory(); + template + static type on_next(U value) { + return std::make_shared(std::move(value)); + } -template -//static -RXCPP_SELECT_ANY const typename notification::on_completed_factory notification::on_completed = notification::on_completed_factory(); + static type on_completed() { + return std::make_shared(); + } -template -//static -RXCPP_SELECT_ANY const typename notification::on_error_factory notification::on_error = notification::on_error_factory(); + template + static type on_error(Exception&& e) { + return make_on_error(typename std::conditional< + std::is_same, std::exception_ptr>::value, + exception_ptr_tag, exception_tag>::type(), + std::forward(e)); + } +}; template bool operator == (const std::shared_ptr>& lhs, const std::shared_ptr>& rhs) { diff --git a/Rx/v2/src/rxcpp/rx-scheduler.hpp b/Rx/v2/src/rxcpp/rx-scheduler.hpp index 9e3d1a6..d9d4741 100644 --- a/Rx/v2/src/rxcpp/rx-scheduler.hpp +++ b/Rx/v2/src/rxcpp/rx-scheduler.hpp @@ -25,6 +25,11 @@ typedef std::shared_ptr const_worker_interface_ptr; typedef std::shared_ptr scheduler_interface_ptr; typedef std::shared_ptr const_scheduler_interface_ptr; +inline action_ptr shared_empty() { + static action_ptr shared_empty = std::make_shared(); + return shared_empty; +} + } // It is essential to keep virtual function calls out of an inner loop. @@ -123,7 +128,6 @@ class action : public action_base { typedef action this_type; detail::action_ptr inner; - static detail::action_ptr shared_empty; public: action() { @@ -135,7 +139,7 @@ public: /// return the empty action inline static action empty() { - return action(shared_empty); + return action(detail::shared_empty()); } /// call the function @@ -640,10 +644,6 @@ inline void action::operator()(const schedulable& s, const recurse& r) const { (*inner)(s, r); } -//static -RXCPP_SELECT_ANY detail::action_ptr action::shared_empty = detail::action_ptr(new detail::action_type()); - - inline action make_action_empty() { return action::empty(); } diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index a5fce21..77c9b20 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -210,6 +210,8 @@ auto make_subscription(Unsubscribe&& u) return subscription(static_subscription(std::forward(u))); } +class composite_subscription; + namespace detail { struct tag_composite_subscription_empty {}; @@ -348,6 +350,8 @@ public: } }; +inline composite_subscription shared_empty(); + } class composite_subscription @@ -358,8 +362,6 @@ class composite_subscription public: typedef subscription::weak_state_type weak_subscription; - static composite_subscription shared_empty; - composite_subscription(detail::tag_composite_subscription_empty et) : inner_type(et) , subscription() // use empty base @@ -393,7 +395,7 @@ public: } static inline composite_subscription empty() { - return shared_empty; + return detail::shared_empty(); } using subscription::is_subscribed; @@ -438,9 +440,14 @@ inline bool operator!=(const composite_subscription& lhs, const composite_subscr return !(lhs == rhs); } -//static -RXCPP_SELECT_ANY composite_subscription composite_subscription::shared_empty = composite_subscription(detail::tag_composite_subscription_empty()); +namespace detail { +inline composite_subscription shared_empty() { + static composite_subscription shared_empty = composite_subscription(tag_composite_subscription_empty()); + return shared_empty; +} + +} template class resource : public subscription_base diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index b2493f3..faedf0f 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -15,14 +15,6 @@ #endif #endif -#if !defined(RXCPP_SELECT_ANY) -#if defined(_MSC_VER) -#define RXCPP_SELECT_ANY __declspec(selectany) -#else -#define RXCPP_SELECT_ANY __attribute__((weak)) -#endif -#endif - #if !defined(RXCPP_DELETE) #if defined(_MSC_VER) #define RXCPP_DELETE __pragma(warning(disable: 4822)) =delete diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 677291f..4f9f9b5 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -248,14 +248,11 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(std::move(cs), wi); } - const static scheduler instance; }; -//static -RXCPP_SELECT_ANY const scheduler current_thread::instance = make_scheduler(); - inline const scheduler& make_current_thread() { - return current_thread::instance; + static scheduler instance = make_scheduler(); + return instance; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp index 2771955..18bfee5 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-eventloop.hpp @@ -93,14 +93,11 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(cs, std::make_shared(cs, loops[++count % loops.size()])); } - const static scheduler instance; }; -//static -RXCPP_SELECT_ANY const scheduler event_loop::instance = make_scheduler(); - inline scheduler make_event_loop() { - return event_loop::instance; + static scheduler instance = make_scheduler(); + return instance; } inline scheduler make_event_loop(thread_factory tf) { return make_scheduler(tf); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp index d610d33..0d2b695 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-immediate.hpp @@ -70,14 +70,11 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(std::move(cs), wi); } - const static scheduler instance; }; -//static -RXCPP_SELECT_ANY const scheduler immediate::instance = make_scheduler(); - inline const scheduler& make_immediate() { - return immediate::instance; + static scheduler instance = make_scheduler(); + return instance; } } diff --git a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp index 9795b59..2e24c0f 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-newthread.hpp @@ -162,15 +162,11 @@ public: virtual worker create_worker(composite_subscription cs) const { return worker(cs, std::make_shared(cs, factory)); } - - const static scheduler instance; }; -//static -RXCPP_SELECT_ANY const scheduler new_thread::instance = make_scheduler(); - inline scheduler make_new_thread() { - return new_thread::instance; + static scheduler instance = make_scheduler(); + return instance; } inline scheduler make_new_thread(thread_factory tf) { return make_scheduler(tf); diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 2cacca2..20ad0bf 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -376,37 +376,23 @@ public: messages() {} - struct on_next_factory - { - recorded_type operator()(long ticks, T value) const { - return recorded_type(ticks, notification_type::on_next(value)); - } - }; - struct on_completed_factory - { - recorded_type operator()(long ticks) const { - return recorded_type(ticks, notification_type::on_completed()); - } - }; - struct on_error_factory - { - template - recorded_type operator()(long ticks, Exception&& e) const { - return recorded_type(ticks, notification_type::on_error(std::forward(e))); - } - }; + template + static recorded_type next(long ticks, U value) { + return recorded_type(ticks, notification_type::on_next(std::move(value))); + } - static const on_next_factory next; - static const on_completed_factory completed; - static const on_error_factory error; + static recorded_type completed(long ticks) { + return recorded_type(ticks, notification_type::on_completed()); + } - struct subscribe_factory - { - rxn::subscription operator()(long subscribeAt, long unsubscribeAt) const { - return rxn::subscription(subscribeAt, unsubscribeAt); - } - }; - static const subscribe_factory subscribe; + template + static recorded_type error(long ticks, Exception&& e) { + return recorded_type(ticks, notification_type::on_error(std::forward(e))); + } + + static rxn::subscription subscribe(long subscribe, long unsubscribe) { + return rxn::subscription(subscribe, unsubscribe); + } }; class test_worker : public worker @@ -583,23 +569,6 @@ public: } }; -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_next_factory test::messages::next = test::messages::on_next_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_completed_factory test::messages::completed = test::messages::on_completed_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::on_error_factory test::messages::error = test::messages::on_error_factory(); - -template -//static -RXCPP_SELECT_ANY const typename test::messages::subscribe_factory test::messages::subscribe = test::messages::subscribe_factory(); - - inline test make_test() { return test(std::make_shared()); -- GitLab From bd3eecdd5c8cbdb6b4a801821a70cd78af45dcd5 Mon Sep 17 00:00:00 2001 From: Kirk Shoop Date: Wed, 25 Feb 2015 12:28:34 -0800 Subject: [PATCH 481/782] schedule observer and subscription in buffer and window when using time --- Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp | 118 ++++++++-- .../rxcpp/operators/rx-buffer_time_count.hpp | 118 ++++++++-- Rx/v2/src/rxcpp/operators/rx-window_time.hpp | 115 +++++++-- .../rxcpp/operators/rx-window_time_count.hpp | 126 +++++++--- Rx/v2/test/operators/buffer.cpp | 106 ++++----- Rx/v2/test/operators/window.cpp | 220 +++++++++--------- 6 files changed, 543 insertions(+), 260 deletions(-) diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp index 5948347..f1edbe6 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time.hpp @@ -53,14 +53,16 @@ struct buffer_with_time struct buffer_with_time_subscriber_values : public buffer_with_time_values { - buffer_with_time_subscriber_values(dest_type d, buffer_with_time_values v, coordinator_type c) + 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(std::move(coordinator.get_worker())) , expected(worker.now()) { } + composite_subscription cs; dest_type dest; coordinator_type coordinator; rxsc::worker worker; @@ -69,55 +71,125 @@ struct buffer_with_time }; std::shared_ptr state; - buffer_with_time_observer(dest_type d, buffer_with_time_values v, coordinator_type c) - : state(std::make_shared(buffer_with_time_subscriber_values(std::move(d), v, std::move(c)))) + 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(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 create_buffer = [localState, produce_buffer](const rxsc::schedulable&) { + 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, produce_buffer); + 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, - create_buffer); + [localState, selectedCreate](const rxsc::schedulable&) { + localState->worker.schedule(selectedCreate.get()); + }); } void on_next(T v) const { - for(auto& chunk : state->chunks) { - chunk.push_back(v); + 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(std::exception_ptr e) const { - state->dest.on_error(e); + 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 done = on_exception( - [&](){ - while (!state->chunks.empty()) { - state->dest.on_next(std::move(state->chunks.front())); - state->chunks.pop_front(); - } - return true; - }, - state->dest); - if (done.empty()) { + 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; } - state->dest.on_completed(); + localState->worker.schedule(selectedWork.get()); } static subscriber> make(dest_type d, buffer_with_time_values v) { - auto cs = d.get_subscription(); - auto coordinator = v.coordination.create_coordinator(cs); + auto cs = composite_subscription(); + auto coordinator = v.coordination.create_coordinator(); - return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v), std::move(coordinator))); + return make_subscriber(cs, this_type(cs, std::move(d), std::move(v), std::move(coordinator))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp index 87b6c2a..ba8d62a 100644 --- a/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-buffer_time_count.hpp @@ -53,14 +53,16 @@ struct buffer_with_time_or_count struct buffer_with_time_or_count_subscriber_values : public buffer_with_time_or_count_values { - buffer_with_time_or_count_subscriber_values(dest_type d, buffer_with_time_or_count_values v, coordinator_type c) + 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(std::move(coordinator.get_worker())) , chunk_id(0) { } + composite_subscription cs; dest_type dest; coordinator_type coordinator; rxsc::worker worker; @@ -70,50 +72,116 @@ struct buffer_with_time_or_count typedef std::shared_ptr state_type; state_type state; - buffer_with_time_or_count_observer(dest_type d, buffer_with_time_or_count_values v, coordinator_type c) - : state(std::make_shared(buffer_with_time_or_count_subscriber_values(std::move(d), std::move(v), std::move(c)))) + 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(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; - state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ - produce_buffer(new_id, produce_time, localState); - }); - } - static void produce_buffer(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) { - if (id != state->chunk_id) + 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; + } - state->dest.on_next(state->chunk); - state->chunk.resize(0); - auto new_id = ++state->chunk_id; - auto produce_time = expected + state->period; - auto localState = state; - state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ - produce_buffer(new_id, produce_time, localState); + 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 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(); + } + + return std::function(selectedProduce.get()); } void on_next(T v) const { - state->chunk.push_back(v); - if (int(state->chunk.size()) == state->count) { - produce_buffer(state->chunk_id, state->worker.now(), state); + 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(std::exception_ptr e) const { - state->dest.on_error(e); + 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 { - state->dest.on_next(state->chunk); - state->dest.on_completed(); + 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> make(dest_type d, buffer_with_time_or_count_values v) { - auto cs = d.get_subscription(); - auto coordinator = v.coordination.create_coordinator(cs); + auto cs = composite_subscription(); + auto coordinator = v.coordination.create_coordinator(); - return make_subscriber(std::move(cs), this_type(std::move(d), std::move(v), std::move(coordinator))); + return make_subscriber(cs, this_type(cs, std::move(d), std::move(v), std::move(coordinator))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp index 734520e..a64d83d 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time.hpp @@ -51,14 +51,16 @@ struct window_with_time struct window_with_time_subscriber_values : public window_with_time_values { - window_with_time_subscriber_values(dest_type d, window_with_time_values v, coordinator_type c) + 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(std::move(coordinator.get_worker())) , expected(worker.now()) { } + composite_subscription cs; dest_type dest; coordinator_type coordinator; rxsc::worker worker; @@ -67,54 +69,129 @@ struct window_with_time }; std::shared_ptr state; - window_with_time_observer(dest_type d, window_with_time_values v, coordinator_type c) - : state(std::make_shared(window_with_time_subscriber_values(std::move(d), v, std::move(c)))) + 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(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->subj[0].get_subscriber().on_completed(); - localState->subj.pop_front(); + localState->worker.schedule([localState](const rxsc::schedulable&) { + localState->subj[0].get_subscriber().on_completed(); + localState->subj.pop_front(); + }); }; - auto create_window = [localState, release_window](const rxsc::schedulable&) { + 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()); 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, release_window); + 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, - create_window); + [localState, selectedCreate](const rxsc::schedulable&) { + localState->worker.schedule(selectedCreate.get()); + }); } void on_next(T v) const { - for (auto s : state->subj) { - s.get_subscriber().on_next(v); + 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(std::exception_ptr e) const { - for (auto s : state->subj) { - s.get_subscriber().on_error(e); + 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; } - state->dest.on_error(e); + localState->worker.schedule(selectedWork.get()); } void on_completed() const { - for (auto s : state->subj) { - s.get_subscriber().on_completed(); + 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; } - state->dest.on_completed(); + localState->worker.schedule(selectedWork.get()); } static subscriber make(dest_type d, window_with_time_values v) { - auto cs = d.get_subscription(); - auto coordinator = v.coordination.create_coordinator(cs); + auto cs = composite_subscription(); + auto coordinator = v.coordination.create_coordinator(); - return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v), std::move(coordinator)))); + return make_subscriber(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator)))); } }; diff --git a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp index fa50a57..5bb65ab 100644 --- a/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp +++ b/Rx/v2/src/rxcpp/operators/rx-window_time_count.hpp @@ -51,8 +51,9 @@ struct window_with_time_or_count struct window_with_time_or_count_subscriber_values : public window_with_time_or_count_values { - window_with_time_or_count_subscriber_values(dest_type d, window_with_time_or_count_values v, coordinator_type c) + 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(std::move(coordinator.get_worker())) @@ -60,6 +61,7 @@ struct window_with_time_or_count , subj_id(0) { } + composite_subscription cs; dest_type dest; coordinator_type coordinator; rxsc::worker worker; @@ -70,56 +72,120 @@ struct window_with_time_or_count typedef std::shared_ptr state_type; state_type state; - window_with_time_or_count_observer(dest_type d, window_with_time_or_count_values v, coordinator_type c) - : state(std::make_shared(window_with_time_or_count_subscriber_values(std::move(d), std::move(v), std::move(c)))) + 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(std::move(cs), std::move(d), std::move(v), std::move(c)))) { - state->dest.on_next(state->subj.get_observable().as_dynamic()); auto new_id = state->subj_id; - auto produce_time = state->worker.now() + state->period; + auto produce_time = state->worker.now(); auto localState = state; - state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ - release_window(new_id, produce_time, localState); - }); - } - static void release_window(int id, rxsc::scheduler::clock_type::time_point expected, state_type state) { - if (id != state->subj_id) + 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; + } - state->subj.get_subscriber().on_completed(); - state->subj = rxcpp::subjects::subject(); - 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; - auto localState = state; - state->worker.schedule(produce_time, [new_id, produce_time, localState](const rxsc::schedulable&){ - release_window(new_id, produce_time, localState); + 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 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(); + 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(); + } + + return std::function(selectedRelease.get()); } void on_next(T v) const { - state->subj.get_subscriber().on_next(v); - if (++state->cursor == state->count) { - release_window(state->subj_id, state->worker.now(), state); + auto localState = state; + auto work = [v, localState](const rxsc::schedulable&){ + localState->subj.get_subscriber().on_next(v); + if (++localState->cursor == localState->count) { + release_window(localState->subj_id, localState->worker.now(), localState); + } + }; + auto selectedWork = on_exception( + [&](){return localState->coordinator.act(work);}, + localState->dest); + if (selectedWork.empty()) { + return; } + localState->worker.schedule(selectedWork.get()); } void on_error(std::exception_ptr e) const { - state->subj.get_subscriber().on_error(e); - state->dest.on_error(e); + 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 { - state->subj.get_subscriber().on_completed(); - state->dest.on_completed(); + 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 make(dest_type d, window_with_time_or_count_values v) { - auto cs = d.get_subscription(); - auto coordinator = v.coordination.create_coordinator(cs); + auto cs = composite_subscription(); + auto coordinator = v.coordination.create_coordinator(); - return make_subscriber(std::move(cs), observer_type(this_type(std::move(d), std::move(v), std::move(coordinator)))); + return make_subscriber(cs, observer_type(this_type(cs, std::move(d), std::move(v), std::move(coordinator)))); } }; diff --git a/Rx/v2/test/operators/buffer.cpp b/Rx/v2/test/operators/buffer.cpp index 5f97583..118709e 100644 --- a/Rx/v2/test/operators/buffer.cpp +++ b/Rx/v2/test/operators/buffer.cpp @@ -712,13 +712,13 @@ SCENARIO("buffer with time, overlapping intervals", "[buffer_with_time][operator THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(300, rxu::to_vector({ 2, 3, 4 })), - v_on.next(370, rxu::to_vector({ 4, 5, 6 })), - v_on.next(440, rxu::to_vector({ 6, 7, 8 })), - v_on.next(510, rxu::to_vector({ 8, 9 })), - v_on.next(580, std::vector()), - v_on.next(600, std::vector()), - v_on.completed(600) + 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()), + v_on.next(601, std::vector()), + v_on.completed(601) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -769,11 +769,11 @@ SCENARIO("buffer with time, intervals with skips", "[buffer_with_time][operators THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(270, rxu::to_vector({ 2, 3 })), - v_on.next(370, rxu::to_vector({ 5, 6 })), - v_on.next(470, rxu::to_vector({ 8, 9 })), - v_on.next(570, std::vector()), - v_on.completed(600) + 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()), + v_on.completed(601) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -826,12 +826,12 @@ SCENARIO("buffer with time, error", "[buffer_with_time][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(300, rxu::to_vector({ 2, 3, 4 })), - v_on.next(370, rxu::to_vector({ 4, 5, 6 })), - v_on.next(440, rxu::to_vector({ 6, 7, 8 })), - v_on.next(510, rxu::to_vector({ 8, 9 })), - v_on.next(580, std::vector()), - v_on.error(600, ex) + 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()), + v_on.error(601, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -883,7 +883,7 @@ SCENARIO("buffer with time, disposed", "[buffer_with_time][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(300, rxu::to_vector({ 2, 3, 4 })), + v_on.next(301, rxu::to_vector({ 2, 3, 4 })), }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -891,7 +891,7 @@ SCENARIO("buffer with time, disposed", "[buffer_with_time][operators]"){ THEN("there was one subscription and one unsubscription to the xs"){ auto required = rxu::to_vector({ - on.subscribe(200, 370) + on.subscribe(200, 371) }); auto actual = xs.subscriptions(); REQUIRE(required == actual); @@ -934,11 +934,11 @@ SCENARIO("buffer with time, same", "[buffer_with_time][operators]"){ THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(300, rxu::to_vector({ 2, 3, 4 })), - v_on.next(400, rxu::to_vector({ 5, 6, 7 })), - v_on.next(500, rxu::to_vector({ 8, 9 })), - v_on.next(600, std::vector()), - v_on.completed(600) + 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()), + v_on.completed(601) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -989,14 +989,14 @@ SCENARIO("buffer with time or count, basic", "[buffer_with_time_or_count][operat THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(240, rxu::to_vector({ 1, 2, 3 })), - v_on.next(310, rxu::to_vector({ 4 })), - v_on.next(370, rxu::to_vector({ 5, 6, 7 })), - v_on.next(440, rxu::to_vector({ 8 })), - v_on.next(510, rxu::to_vector({ 9 })), - v_on.next(580, std::vector()), - v_on.next(600, std::vector()), - v_on.completed(600) + 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()), + v_on.next(601, std::vector()), + v_on.completed(601) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -1049,13 +1049,13 @@ SCENARIO("buffer with time or count, error", "[buffer_with_time_or_count][operat THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(240, rxu::to_vector({ 1, 2, 3 })), - v_on.next(310, rxu::to_vector({ 4 })), - v_on.next(370, rxu::to_vector({ 5, 6, 7 })), - v_on.next(440, rxu::to_vector({ 8 })), - v_on.next(510, rxu::to_vector({ 9 })), - v_on.next(580, std::vector()), - v_on.error(600, ex) + 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()), + v_on.error(601, ex) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); @@ -1102,14 +1102,14 @@ SCENARIO("buffer with time or count, dispose", "[buffer_with_time_or_count][oper // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); }, - 370 + 372 ); THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(240, rxu::to_vector({ 1, 2, 3 })), - v_on.next(310, rxu::to_vector({ 4 })), - v_on.next(370, rxu::to_vector({ 5, 6, 7 })), + 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); @@ -1117,7 +1117,7 @@ SCENARIO("buffer with time or count, dispose", "[buffer_with_time_or_count][oper THEN("there was one subscription and one unsubscription to the xs"){ auto required = rxu::to_vector({ - on.subscribe(200, 370) + on.subscribe(200, 373) }); auto actual = xs.subscriptions(); REQUIRE(required == actual); @@ -1156,14 +1156,14 @@ SCENARIO("buffer with time or count, only time triggered", "[buffer_with_time_or THEN("the output contains groups of ints"){ auto required = rxu::to_vector({ - v_on.next(300, rxu::to_vector({ 1 })), - v_on.next(400, rxu::to_vector({ 2 })), - v_on.next(500, std::vector()), - v_on.next(600, rxu::to_vector({ 3 })), - v_on.next(700, rxu::to_vector({ 4, 5 })), - v_on.next(800, std::vector()), - v_on.next(850, std::vector()), - v_on.completed(850) + v_on.next(301, rxu::to_vector({ 1 })), + v_on.next(401, rxu::to_vector({ 2 })), + v_on.next(501, std::vector()), + v_on.next(601, rxu::to_vector({ 3 })), + v_on.next(701, rxu::to_vector({ 4, 5 })), + v_on.next(801, std::vector()), + v_on.next(851, std::vector()), + v_on.completed(851) }); auto actual = res.get_observer().messages(); REQUIRE(required == actual); diff --git a/Rx/v2/test/operators/window.cpp b/Rx/v2/test/operators/window.cpp index f7b0e78..35dc77d 100644 --- a/Rx/v2/test/operators/window.cpp +++ b/Rx/v2/test/operators/window.cpp @@ -343,23 +343,23 @@ SCENARIO("window with time, basic", "[window_with_time][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.next(210, 2), - on.next(240, 3), - on.next(270, 4), - on.next(270, 4), - on.next(320, 5), - on.next(320, 5), - on.next(360, 6), - on.next(360, 6), - on.next(390, 7), - on.next(390, 7), - on.next(410, 8), - on.next(410, 8), - on.next(460, 9), - on.next(460, 9), - on.next(470, 10), - on.next(470, 10), - on.completed(490) + 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); @@ -413,16 +413,16 @@ SCENARIO("window with time, basic same", "[window_with_time][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - 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) + 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); @@ -475,18 +475,18 @@ SCENARIO("window with time, basic 1", "[window_with_time][operators]"){ 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) + 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); @@ -539,13 +539,13 @@ SCENARIO("window with time, basic 2", "[window_with_time][operators]"){ THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.next(210, 2), - on.next(240, 3), - on.next(320, 5), - on.next(350, 6), - on.next(420, 8), - on.next(470, 9), - on.completed(600) + 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); @@ -600,18 +600,18 @@ SCENARIO("window with time, error", "[window_with_time][operators]"){ 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) + 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); @@ -665,13 +665,13 @@ SCENARIO("window with time, disposed", "[window_with_time][operators]"){ 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(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); @@ -679,7 +679,7 @@ SCENARIO("window with time, disposed", "[window_with_time][operators]"){ THEN("there was one subscription and one unsubscription to the observable"){ auto required = rxu::to_vector({ - o_on.subscribe(200, 370) + o_on.subscribe(200, 371) }); auto actual = xs.subscriptions(); REQUIRE(required == actual); @@ -724,15 +724,15 @@ SCENARIO("window with time, basic same 1", "[window_with_time][operators]"){ 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(320, 5), - on.next(350, 6), - on.next(380, 7), - on.next(420, 8), - on.next(470, 9), - on.completed(600) + 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); @@ -785,16 +785,16 @@ SCENARIO("window with time or count, basic", "[window_with_time_or_count][operat THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - 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) + 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); @@ -849,16 +849,16 @@ SCENARIO("window with time or count, error", "[window_with_time_or_count][operat THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - 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) + 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); @@ -907,18 +907,18 @@ SCENARIO("window with time or count, disposed", "[window_with_time_or_count][ope // forget type to workaround lambda deduction bug on msvc 2013 .as_dynamic(); }, - 370 + 372 ); THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - 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(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); @@ -926,7 +926,7 @@ SCENARIO("window with time or count, disposed", "[window_with_time_or_count][ope THEN("there was one subscription and one unsubscription to the observable"){ auto required = rxu::to_vector({ - o_on.subscribe(200, 370) + o_on.subscribe(200, 373) }); auto actual = xs.subscriptions(); REQUIRE(required == actual); @@ -967,12 +967,12 @@ SCENARIO("window with time or count, only time triggered", "[window_with_time_or THEN("the output contains merged groups of ints"){ auto required = rxu::to_vector({ - on.next(205, 1), - on.next(305, 2), - on.next(505, 3), - on.next(605, 4), - on.next(610, 5), - on.completed(850) + 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); -- GitLab From 25dbb1162d5379fc86e85d9a3fae3e101ab67e8c Mon Sep 17 00:00:00 2001 From: Valery Kopylov Date: Thu, 16 Apr 2015 13:06:31 +0300 Subject: [PATCH 482/782] Implement thread local storage for iOS --- Rx/v2/src/rxcpp/rx-includes.hpp | 11 +++++ Rx/v2/src/rxcpp/rx-util.hpp | 43 ++++++++++++++++++- .../src/rxcpp/schedulers/rx-currentthread.hpp | 22 +++++++--- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/Rx/v2/src/rxcpp/rx-includes.hpp b/Rx/v2/src/rxcpp/rx-includes.hpp index 1ac9de7..bfec60a 100644 --- a/Rx/v2/src/rxcpp/rx-includes.hpp +++ b/Rx/v2/src/rxcpp/rx-includes.hpp @@ -86,6 +86,13 @@ #define _VARIADIC_MAX 10 #endif +#if defined(__APPLE__) && defined(__MACH__) +#include +#if (TARGET_OS_IPHONE == 1) || (TARGET_IPHONE_SIMULATOR == 1) +#define RXCPP_ON_IOS +#endif +#endif + #pragma push_macro("min") #pragma push_macro("max") #undef min @@ -120,6 +127,10 @@ #include #include +#if defined(RXCPP_ON_IOS) +#include +#endif + #include "rx-util.hpp" #include "rx-predef.hpp" #include "rx-subscription.hpp" diff --git a/Rx/v2/src/rxcpp/rx-util.hpp b/Rx/v2/src/rxcpp/rx-util.hpp index faedf0f..80014bd 100644 --- a/Rx/v2/src/rxcpp/rx-util.hpp +++ b/Rx/v2/src/rxcpp/rx-util.hpp @@ -7,7 +7,7 @@ #include "rx-includes.hpp" -#if !defined(RXCPP_THREAD_LOCAL) +#if !defined(RXCPP_ON_IOS) && !defined(RXCPP_THREAD_LOCAL) #if defined(_MSC_VER) #define RXCPP_THREAD_LOCAL __declspec(thread) #else @@ -634,6 +634,47 @@ private: } +#if !defined(RXCPP_THREAD_LOCAL) +template +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(pthread_getspecific(key)); + } + + T* get() + { + return static_cast(pthread_getspecific(key)); + } +}; +#endif + } namespace rxu=util; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp index 4f9f9b5..f9847f9 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-currentthread.hpp @@ -31,10 +31,17 @@ public: }; private: - static current_thread_queue_type*& current_thread_queue() { - static RXCPP_THREAD_LOCAL current_thread_queue_type* queue; +#if defined(RXCPP_THREAD_LOCAL) + static current_thread_queue_type*& current_thread_queue() { + static RXCPP_THREAD_LOCAL current_thread_queue_type* queue; + return queue; + } +#else + static rxu::thread_local_storage& current_thread_queue() { + static rxu::thread_local_storage queue; return queue; } +#endif public: @@ -60,7 +67,7 @@ public: return current_thread_queue()->queue.top(); } static void pop() { - auto state = current_thread_queue(); + auto& state = current_thread_queue(); if (!state) { abort(); } @@ -71,7 +78,7 @@ public: } } static void push(item_type item) { - auto state = current_thread_queue(); + auto& state = current_thread_queue(); if (!state) { abort(); } @@ -110,12 +117,15 @@ public: if (!current_thread_queue()) { abort(); } - destroy(current_thread_queue()); +#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 -- GitLab From 64c13fbd6cc2720f690e99a298857a7d7ab95d11 Mon Sep 17 00:00:00 2001 From: Shiva Shankar P Date: Mon, 20 Apr 2015 11:34:14 -0700 Subject: [PATCH 483/782] Fixing compilation error "class has virtual functions and accessible non-virtual destructor". The Fix is to add explicit virtual destructors where they're missing. --- Rx/v2/src/rxcpp/rx-observer.hpp | 1 + Rx/v2/src/rxcpp/rx-subscription.hpp | 1 + Rx/v2/src/rxcpp/rx-test.hpp | 1 + Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 2 ++ 4 files changed, 5 insertions(+) diff --git a/Rx/v2/src/rxcpp/rx-observer.hpp b/Rx/v2/src/rxcpp/rx-observer.hpp index bbc72e0..a302c64 100644 --- a/Rx/v2/src/rxcpp/rx-observer.hpp +++ b/Rx/v2/src/rxcpp/rx-observer.hpp @@ -143,6 +143,7 @@ private: struct virtual_observer : public std::enable_shared_from_this { + virtual ~virtual_observer() {} virtual void on_next(T) const {}; virtual void on_error(std::exception_ptr) const {}; virtual void on_completed() const {}; diff --git a/Rx/v2/src/rxcpp/rx-subscription.hpp b/Rx/v2/src/rxcpp/rx-subscription.hpp index 77c9b20..5cfde65 100644 --- a/Rx/v2/src/rxcpp/rx-subscription.hpp +++ b/Rx/v2/src/rxcpp/rx-subscription.hpp @@ -75,6 +75,7 @@ class subscription : public subscription_base : issubscribed(initial) { } + virtual ~base_subscription_state() {} virtual void unsubscribe() { } std::atomic issubscribed; diff --git a/Rx/v2/src/rxcpp/rx-test.hpp b/Rx/v2/src/rxcpp/rx-test.hpp index 542c55b..0a248e9 100644 --- a/Rx/v2/src/rxcpp/rx-test.hpp +++ b/Rx/v2/src/rxcpp/rx-test.hpp @@ -18,6 +18,7 @@ struct test_subject_base typedef rxn::recorded::type> recorded_type; typedef std::shared_ptr> type; + virtual ~test_subject_base() {} virtual void on_subscribe(subscriber) const =0; virtual std::vector messages() const =0; virtual std::vector subscriptions() const =0; diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index 20ad0bf..866ab31 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -309,6 +309,8 @@ public: } } + virtual ~hot_observable() {} + virtual void on_subscribe(observer_type o) const { observers.push_back(o); sv.push_back(rxn::subscription(sc->clock())); -- GitLab From 3c434df8c9b26d92f30a719ee6607b81e7734937 Mon Sep 17 00:00:00 2001 From: Shiva Shankar P Date: Mon, 20 Apr 2015 11:53:13 -0700 Subject: [PATCH 484/782] Fixing two issues of memory usage after free... 1) Using member variable instead of locally captured variable in lambda. Causes problem when the enclosing instance is destroyed. 2) Race condition that causes 'current_completer' to be reset and observer list to be emptied while another thread is iterating through the observers in on_next. --- Rx/v2/src/rxcpp/subjects/rx-subject.hpp | 8 +++++--- Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp index f94f8f9..9c4339c 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-subject.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-subject.hpp @@ -155,10 +155,12 @@ public: b->current_generation = b->state->generation; b->current_completer = b->completer; } - if (!b->current_completer || b->current_completer->observers.empty()) { + + auto current_completer = b->current_completer; + if (!current_completer || current_completer->observers.empty()) { return; } - for (auto& o : b->current_completer->observers) { + for (auto& o : current_completer->observers) { if (o.is_subscribed()) { o.on_next(v); } @@ -236,7 +238,7 @@ public: observable get_observable() const { auto keepAlive = s; return make_observable_dynamic([=](subscriber o){ - keepAlive.add(s.get_subscriber(), std::move(o)); + keepAlive.add(keepAlive.get_subscriber(), std::move(o)); }); } }; diff --git a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp index 9625a14..278209d 100644 --- a/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp +++ b/Rx/v2/src/rxcpp/subjects/rx-synchronize.hpp @@ -182,7 +182,7 @@ public: observable get_observable() const { auto keepAlive = s; return make_observable_dynamic([=](subscriber o){ - keepAlive.add(s.get_subscriber(), std::move(o)); + keepAlive.add(keepAlive.get_subscriber(), std::move(o)); }); } }; -- GitLab From d0b152042f0a0f5abba9a64c0e206b1cf9eef979 Mon Sep 17 00:00:00 2001 From: Valeriy Kopylov Date: Fri, 17 Apr 2015 12:36:40 +0300 Subject: [PATCH 485/782] Add Doxygen generator as a new task for make --- projects/CMake/CMakeLists.txt | 21 +- projects/doxygen/doxygen.conf.in | 2432 ++++++++++++++++++++++++++++++ 2 files changed, 2452 insertions(+), 1 deletion(-) create mode 100644 projects/doxygen/doxygen.conf.in diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index a0b1e66..54ea3bc 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -30,8 +30,11 @@ get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) +set(IX_SRC_DIR ${RXCPP_DIR}/Ix/CPP/src) +set(RX_SRC_DIR ${RXCPP_DIR}/Rx/v2/src) + include_directories(SYSTEM ${RXCPP_DIR}/ext/catch/include) -include_directories(${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) +include_directories(IX_SRC_DIR RX_SRC_DIR) set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) @@ -120,3 +123,19 @@ set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test c add_test(NAME ListTags COMMAND rxcppv2_test --list-tags) set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") + +# target to generate documentation with Doxygen +find_package(Doxygen) +if(DOXYGEN_FOUND) + set(DOXY_CONF ${RXCPP_DIR}/projects/doxygen/doxygen.conf) + set(DOXY_OUTPUT_DIR ${RXCPP_DIR}/projects/doxygen) + set(DOXY_INPUT_DIR "${IX_SRC_DIR} ${RX_SRC_DIR}") + + configure_file(${DOXY_CONF}.in ${DOXY_CONF}) + + add_custom_target(doc + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXY_CONF} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating documentation with Doxygen" + VERBATIM) +endif() diff --git a/projects/doxygen/doxygen.conf.in b/projects/doxygen/doxygen.conf.in new file mode 100644 index 0000000..1ed8ca0 --- /dev/null +++ b/projects/doxygen/doxygen.conf.in @@ -0,0 +1,2432 @@ +# 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 = + +# 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 ... \endif and \cond +# ... \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 = + +# 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 = + +# 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: +# +# +# +# where is the value of the INPUT_FILTER tag, and 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 = + +# 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 + S +# (what the is depends on the OS and browser, but it is typically +# , /

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 Rx MSDN Developer Center.

k3MLRane>0b1V#GKAwLFGwedsqm5s#WbfaX#%ESywpK1%0MmqK#)}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